@openclaw/tokenjuice 2026.11.7 → 2026.11.10-beta.2

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 (361) hide show
  1. package/README.md +1 -1
  2. package/dist/.source-module-urls/e1cd11006f37307698d3ccaa0b9377541a8f8fcd96acf7a0d93ee391c8c5abfa.json +1 -1
  3. package/dist/index.js +1 -2
  4. package/dist/tool-result-middleware.js +33 -19
  5. package/node_modules/tokenjuice/README.md +71 -272
  6. package/node_modules/tokenjuice/dist/cli/command-types.d.ts +36 -0
  7. package/node_modules/tokenjuice/dist/cli/command-types.js +1 -0
  8. package/node_modules/tokenjuice/dist/cli/doctor-commands.d.ts +2 -0
  9. package/node_modules/tokenjuice/dist/cli/doctor-commands.js +674 -0
  10. package/node_modules/tokenjuice/dist/cli/doctor-output.d.ts +2 -1
  11. package/node_modules/tokenjuice/dist/cli/doctor-output.js +9 -0
  12. package/node_modules/tokenjuice/dist/cli/host-command.d.ts +4 -0
  13. package/node_modules/tokenjuice/dist/cli/host-command.js +19 -0
  14. package/node_modules/tokenjuice/dist/cli/install-commands.d.ts +2 -0
  15. package/node_modules/tokenjuice/dist/cli/install-commands.js +1263 -0
  16. package/node_modules/tokenjuice/dist/cli/main.d.ts +2 -33
  17. package/node_modules/tokenjuice/dist/cli/main.js +255 -5950
  18. package/node_modules/tokenjuice/dist/cli/uninstall-commands.d.ts +2 -0
  19. package/node_modules/tokenjuice/dist/cli/uninstall-commands.js +554 -0
  20. package/node_modules/tokenjuice/dist/core/bounded-jsonl.js +15 -3
  21. package/node_modules/tokenjuice/dist/core/bounded-text-file.d.ts +3 -0
  22. package/node_modules/tokenjuice/dist/core/bounded-text-file.js +32 -0
  23. package/node_modules/tokenjuice/dist/core/classify.d.ts +0 -5
  24. package/node_modules/tokenjuice/dist/core/classify.js +1 -1
  25. package/node_modules/tokenjuice/dist/core/command-identity.d.ts +0 -2
  26. package/node_modules/tokenjuice/dist/core/command-identity.js +2 -2
  27. package/node_modules/tokenjuice/dist/core/command-match.d.ts +0 -3
  28. package/node_modules/tokenjuice/dist/core/command-match.js +88 -8
  29. package/node_modules/tokenjuice/dist/core/command.d.ts +0 -1
  30. package/node_modules/tokenjuice/dist/core/compaction-metadata.d.ts +1 -1
  31. package/node_modules/tokenjuice/dist/core/env.d.ts +1 -0
  32. package/node_modules/tokenjuice/dist/core/env.js +8 -0
  33. package/node_modules/tokenjuice/dist/core/integrations/compact-bash-result.d.ts +7 -3
  34. package/node_modules/tokenjuice/dist/core/integrations/compact-bash-result.js +190 -10
  35. package/node_modules/tokenjuice/dist/core/integrations/compact-copilot-result.d.ts +6 -0
  36. package/node_modules/tokenjuice/dist/core/integrations/compact-copilot-result.js +50 -0
  37. package/node_modules/tokenjuice/dist/core/integrations/compact-deepseek-result.d.ts +7 -0
  38. package/node_modules/tokenjuice/dist/core/integrations/compact-deepseek-result.js +46 -0
  39. package/node_modules/tokenjuice/dist/core/integrations/compact-framework-result.d.ts +11 -0
  40. package/node_modules/tokenjuice/dist/core/integrations/compact-framework-result.js +19 -0
  41. package/node_modules/tokenjuice/dist/core/integrations/compact-opencode-v2-result.d.ts +2 -0
  42. package/node_modules/tokenjuice/dist/core/integrations/compact-opencode-v2-result.js +39 -0
  43. package/node_modules/tokenjuice/dist/core/integrations/compact-qoder-result.d.ts +2 -0
  44. package/node_modules/tokenjuice/dist/core/integrations/compact-qoder-result.js +34 -0
  45. package/node_modules/tokenjuice/dist/core/integrations/openclaw-command.d.ts +2 -0
  46. package/node_modules/tokenjuice/dist/core/integrations/openclaw-command.js +13 -0
  47. package/node_modules/tokenjuice/dist/core/integrations/rewrite-cline-input.d.ts +4 -0
  48. package/node_modules/tokenjuice/dist/core/integrations/rewrite-cline-input.js +18 -0
  49. package/node_modules/tokenjuice/dist/core/inventory-safety.d.ts +0 -1
  50. package/node_modules/tokenjuice/dist/core/inventory-safety.js +1 -1
  51. package/node_modules/tokenjuice/dist/core/record-fields.d.ts +1 -0
  52. package/node_modules/tokenjuice/dist/core/record-fields.js +9 -0
  53. package/node_modules/tokenjuice/dist/core/reduce-inspection-summary.d.ts +2 -1
  54. package/node_modules/tokenjuice/dist/core/reduce-inspection-summary.js +7 -94
  55. package/node_modules/tokenjuice/dist/core/simple-yaml-frontmatter.d.ts +9 -0
  56. package/node_modules/tokenjuice/dist/core/simple-yaml-frontmatter.js +125 -0
  57. package/node_modules/tokenjuice/dist/core/source.d.ts +0 -1
  58. package/node_modules/tokenjuice/dist/core/source.js +14 -4
  59. package/node_modules/tokenjuice/dist/core/structural-markers.d.ts +11 -0
  60. package/node_modules/tokenjuice/dist/core/structural-markers.js +49 -0
  61. package/node_modules/tokenjuice/dist/core/text.d.ts +0 -1
  62. package/node_modules/tokenjuice/dist/core/text.js +0 -3
  63. package/node_modules/tokenjuice/dist/core/toml-structure.d.ts +2 -0
  64. package/node_modules/tokenjuice/dist/core/toml-structure.js +83 -0
  65. package/node_modules/tokenjuice/dist/core/validate-rules.d.ts +2 -2
  66. package/node_modules/tokenjuice/dist/core/wrap.js +1 -1
  67. package/node_modules/tokenjuice/dist/hosts/adal/index.d.ts +5 -17
  68. package/node_modules/tokenjuice/dist/hosts/adal/index.js +15 -125
  69. package/node_modules/tokenjuice/dist/hosts/aether/index.d.ts +2 -7
  70. package/node_modules/tokenjuice/dist/hosts/aether/index.js +17 -155
  71. package/node_modules/tokenjuice/dist/hosts/agent-layer/index.d.ts +2 -9
  72. package/node_modules/tokenjuice/dist/hosts/agent-layer/index.js +10 -64
  73. package/node_modules/tokenjuice/dist/hosts/agentinit/index.d.ts +2 -8
  74. package/node_modules/tokenjuice/dist/hosts/agentinit/index.js +15 -111
  75. package/node_modules/tokenjuice/dist/hosts/agentlink/index.d.ts +2 -8
  76. package/node_modules/tokenjuice/dist/hosts/agentlink/index.js +14 -97
  77. package/node_modules/tokenjuice/dist/hosts/agentloom/index.d.ts +2 -9
  78. package/node_modules/tokenjuice/dist/hosts/agentloom/index.js +11 -52
  79. package/node_modules/tokenjuice/dist/hosts/agents-cli/index.d.ts +2 -8
  80. package/node_modules/tokenjuice/dist/hosts/agents-cli/index.js +10 -41
  81. package/node_modules/tokenjuice/dist/hosts/agents-md/index.d.ts +5 -16
  82. package/node_modules/tokenjuice/dist/hosts/agents-md/index.js +16 -128
  83. package/node_modules/tokenjuice/dist/hosts/agentsge/index.d.ts +2 -9
  84. package/node_modules/tokenjuice/dist/hosts/agentsge/index.js +11 -52
  85. package/node_modules/tokenjuice/dist/hosts/agentsmesh/index.d.ts +2 -8
  86. package/node_modules/tokenjuice/dist/hosts/agentsmesh/index.js +10 -53
  87. package/node_modules/tokenjuice/dist/hosts/ai-memory-protocol/index.d.ts +2 -8
  88. package/node_modules/tokenjuice/dist/hosts/ai-memory-protocol/index.js +13 -42
  89. package/node_modules/tokenjuice/dist/hosts/aictl/index.d.ts +5 -16
  90. package/node_modules/tokenjuice/dist/hosts/aictl/index.js +17 -128
  91. package/node_modules/tokenjuice/dist/hosts/aider/index.d.ts +2 -9
  92. package/node_modules/tokenjuice/dist/hosts/aider/index.js +6 -18
  93. package/node_modules/tokenjuice/dist/hosts/amazon-q/index.d.ts +2 -9
  94. package/node_modules/tokenjuice/dist/hosts/amazon-q/index.js +31 -105
  95. package/node_modules/tokenjuice/dist/hosts/amp/index.d.ts +2 -9
  96. package/node_modules/tokenjuice/dist/hosts/amp/index.js +11 -72
  97. package/node_modules/tokenjuice/dist/hosts/ante/index.d.ts +11 -0
  98. package/node_modules/tokenjuice/dist/hosts/ante/index.js +76 -0
  99. package/node_modules/tokenjuice/dist/hosts/antigravity/index.d.ts +2 -9
  100. package/node_modules/tokenjuice/dist/hosts/antigravity/index.js +29 -117
  101. package/node_modules/tokenjuice/dist/hosts/anywhere-agents/index.d.ts +2 -8
  102. package/node_modules/tokenjuice/dist/hosts/anywhere-agents/index.js +14 -97
  103. package/node_modules/tokenjuice/dist/hosts/augment/index.d.ts +2 -9
  104. package/node_modules/tokenjuice/dist/hosts/augment/index.js +29 -117
  105. package/node_modules/tokenjuice/dist/hosts/avante/index.d.ts +5 -17
  106. package/node_modules/tokenjuice/dist/hosts/avante/index.js +5 -27
  107. package/node_modules/tokenjuice/dist/hosts/baz/index.d.ts +2 -8
  108. package/node_modules/tokenjuice/dist/hosts/baz/index.js +17 -132
  109. package/node_modules/tokenjuice/dist/hosts/bito/index.d.ts +2 -8
  110. package/node_modules/tokenjuice/dist/hosts/bito/index.js +11 -108
  111. package/node_modules/tokenjuice/dist/hosts/blackbox/index.d.ts +2 -8
  112. package/node_modules/tokenjuice/dist/hosts/blackbox/index.js +16 -157
  113. package/node_modules/tokenjuice/dist/hosts/blocks/index.d.ts +2 -8
  114. package/node_modules/tokenjuice/dist/hosts/blocks/index.js +16 -157
  115. package/node_modules/tokenjuice/dist/hosts/bob/index.d.ts +5 -17
  116. package/node_modules/tokenjuice/dist/hosts/bob/index.js +13 -123
  117. package/node_modules/tokenjuice/dist/hosts/builder/index.d.ts +2 -9
  118. package/node_modules/tokenjuice/dist/hosts/builder/index.js +34 -131
  119. package/node_modules/tokenjuice/dist/hosts/charlie/index.d.ts +5 -16
  120. package/node_modules/tokenjuice/dist/hosts/charlie/index.js +16 -140
  121. package/node_modules/tokenjuice/dist/hosts/claude-code/index.js +12 -49
  122. package/node_modules/tokenjuice/dist/hosts/clawdbot/index.d.ts +2 -8
  123. package/node_modules/tokenjuice/dist/hosts/clawdbot/index.js +48 -235
  124. package/node_modules/tokenjuice/dist/hosts/cline/index.d.ts +6 -13
  125. package/node_modules/tokenjuice/dist/hosts/cline/index.js +134 -135
  126. package/node_modules/tokenjuice/dist/hosts/codeant/index.d.ts +5 -16
  127. package/node_modules/tokenjuice/dist/hosts/codeant/index.js +12 -123
  128. package/node_modules/tokenjuice/dist/hosts/codebuddy/index.js +14 -58
  129. package/node_modules/tokenjuice/dist/hosts/codebuff/index.d.ts +5 -17
  130. package/node_modules/tokenjuice/dist/hosts/codebuff/index.js +13 -123
  131. package/node_modules/tokenjuice/dist/hosts/codegen/index.d.ts +5 -17
  132. package/node_modules/tokenjuice/dist/hosts/codegen/index.js +13 -123
  133. package/node_modules/tokenjuice/dist/hosts/coder-agents/index.d.ts +2 -8
  134. package/node_modules/tokenjuice/dist/hosts/coder-agents/index.js +25 -193
  135. package/node_modules/tokenjuice/dist/hosts/coderabbit/index.d.ts +2 -8
  136. package/node_modules/tokenjuice/dist/hosts/coderabbit/index.js +16 -173
  137. package/node_modules/tokenjuice/dist/hosts/codex/index.d.ts +3 -4
  138. package/node_modules/tokenjuice/dist/hosts/codex/index.js +26 -58
  139. package/node_modules/tokenjuice/dist/hosts/command-code/index.d.ts +6 -13
  140. package/node_modules/tokenjuice/dist/hosts/command-code/index.js +87 -331
  141. package/node_modules/tokenjuice/dist/hosts/continue/index.d.ts +2 -9
  142. package/node_modules/tokenjuice/dist/hosts/continue/index.js +6 -18
  143. package/node_modules/tokenjuice/dist/hosts/copilot-agent/index.d.ts +2 -11
  144. package/node_modules/tokenjuice/dist/hosts/copilot-agent/index.js +15 -166
  145. package/node_modules/tokenjuice/dist/hosts/copilot-cli/index.d.ts +2 -11
  146. package/node_modules/tokenjuice/dist/hosts/copilot-cli/index.js +24 -196
  147. package/node_modules/tokenjuice/dist/hosts/copilot-sdk/index.d.ts +12 -0
  148. package/node_modules/tokenjuice/dist/hosts/copilot-sdk/index.js +15 -0
  149. package/node_modules/tokenjuice/dist/hosts/crush/index.d.ts +2 -9
  150. package/node_modules/tokenjuice/dist/hosts/crush/index.js +6 -18
  151. package/node_modules/tokenjuice/dist/hosts/cursor/index.js +7 -8
  152. package/node_modules/tokenjuice/dist/hosts/deepagents/index.d.ts +5 -17
  153. package/node_modules/tokenjuice/dist/hosts/deepagents/index.js +15 -125
  154. package/node_modules/tokenjuice/dist/hosts/deepseek-harness/bundle/cordis.patch.yml +3 -0
  155. package/node_modules/tokenjuice/dist/hosts/deepseek-harness/bundle/index.js +9656 -0
  156. package/node_modules/tokenjuice/dist/hosts/deepseek-harness/bundle/package.json +18 -0
  157. package/node_modules/tokenjuice/dist/hosts/deepseek-harness/runtime.d.ts +7 -0
  158. package/node_modules/tokenjuice/dist/hosts/deepseek-harness/runtime.js +23 -0
  159. package/node_modules/tokenjuice/dist/hosts/devin/index.d.ts +2 -11
  160. package/node_modules/tokenjuice/dist/hosts/devin/index.js +7 -9
  161. package/node_modules/tokenjuice/dist/hosts/docker-agent/index.d.ts +2 -7
  162. package/node_modules/tokenjuice/dist/hosts/docker-agent/index.js +19 -99
  163. package/node_modules/tokenjuice/dist/hosts/dot-agents/index.d.ts +2 -8
  164. package/node_modules/tokenjuice/dist/hosts/dot-agents/index.js +12 -41
  165. package/node_modules/tokenjuice/dist/hosts/droid/index.d.ts +5 -12
  166. package/node_modules/tokenjuice/dist/hosts/droid/index.js +106 -211
  167. package/node_modules/tokenjuice/dist/hosts/eca/index.d.ts +2 -8
  168. package/node_modules/tokenjuice/dist/hosts/eca/index.js +26 -190
  169. package/node_modules/tokenjuice/dist/hosts/elyra/index.d.ts +2 -8
  170. package/node_modules/tokenjuice/dist/hosts/elyra/index.js +26 -190
  171. package/node_modules/tokenjuice/dist/hosts/firebase-studio/index.d.ts +2 -9
  172. package/node_modules/tokenjuice/dist/hosts/firebase-studio/index.js +16 -123
  173. package/node_modules/tokenjuice/dist/hosts/forgecode/index.d.ts +5 -16
  174. package/node_modules/tokenjuice/dist/hosts/forgecode/index.js +20 -161
  175. package/node_modules/tokenjuice/dist/hosts/gemini-cli/index.d.ts +5 -12
  176. package/node_modules/tokenjuice/dist/hosts/gemini-cli/index.js +87 -94
  177. package/node_modules/tokenjuice/dist/hosts/gitlab-duo/index.d.ts +2 -9
  178. package/node_modules/tokenjuice/dist/hosts/gitlab-duo/index.js +17 -123
  179. package/node_modules/tokenjuice/dist/hosts/goose/index.d.ts +2 -9
  180. package/node_modules/tokenjuice/dist/hosts/goose/index.js +34 -77
  181. package/node_modules/tokenjuice/dist/hosts/gptme/index.d.ts +5 -17
  182. package/node_modules/tokenjuice/dist/hosts/gptme/index.js +13 -123
  183. package/node_modules/tokenjuice/dist/hosts/greptile/index.d.ts +2 -8
  184. package/node_modules/tokenjuice/dist/hosts/greptile/index.js +18 -156
  185. package/node_modules/tokenjuice/dist/hosts/grok-bot/index.d.ts +2 -8
  186. package/node_modules/tokenjuice/dist/hosts/grok-bot/index.js +14 -110
  187. package/node_modules/tokenjuice/dist/hosts/grok-build/index.d.ts +5 -17
  188. package/node_modules/tokenjuice/dist/hosts/grok-build/index.js +13 -113
  189. package/node_modules/tokenjuice/dist/hosts/grok-cli/index.d.ts +7 -14
  190. package/node_modules/tokenjuice/dist/hosts/grok-cli/index.js +32 -188
  191. package/node_modules/tokenjuice/dist/hosts/hermes/bundle/__init__.py +1 -0
  192. package/node_modules/tokenjuice/dist/hosts/hermes/bundle/plugin.yaml +7 -0
  193. package/node_modules/tokenjuice/dist/hosts/hermes/bundle/tokenjuice_integrations/README.md +29 -0
  194. package/node_modules/tokenjuice/dist/hosts/hermes/bundle/tokenjuice_integrations/__init__.py +3 -0
  195. package/node_modules/tokenjuice/dist/hosts/hermes/bundle/tokenjuice_integrations/bridge.py +39 -0
  196. package/node_modules/tokenjuice/dist/hosts/hermes/bundle/tokenjuice_integrations/fastmcp.py +24 -0
  197. package/node_modules/tokenjuice/dist/hosts/hermes/bundle/tokenjuice_integrations/hermes.py +13 -0
  198. package/node_modules/tokenjuice/dist/hosts/hermes/bundle/tokenjuice_integrations/langchain.py +38 -0
  199. package/node_modules/tokenjuice/dist/hosts/hermes/bundle/tokenjuice_integrations/plugin.yaml +7 -0
  200. package/node_modules/tokenjuice/dist/hosts/jean2/index.d.ts +5 -17
  201. package/node_modules/tokenjuice/dist/hosts/jean2/index.js +13 -123
  202. package/node_modules/tokenjuice/dist/hosts/jetbrains-ai/index.d.ts +2 -9
  203. package/node_modules/tokenjuice/dist/hosts/jetbrains-ai/index.js +33 -133
  204. package/node_modules/tokenjuice/dist/hosts/jules/index.d.ts +5 -17
  205. package/node_modules/tokenjuice/dist/hosts/jules/index.js +13 -123
  206. package/node_modules/tokenjuice/dist/hosts/junie/index.d.ts +5 -17
  207. package/node_modules/tokenjuice/dist/hosts/junie/index.js +5 -27
  208. package/node_modules/tokenjuice/dist/hosts/kilo/index.d.ts +2 -8
  209. package/node_modules/tokenjuice/dist/hosts/kilo/index.js +6 -18
  210. package/node_modules/tokenjuice/dist/hosts/kimi/index.d.ts +7 -13
  211. package/node_modules/tokenjuice/dist/hosts/kimi/index.js +38 -156
  212. package/node_modules/tokenjuice/dist/hosts/kiro/index.d.ts +2 -9
  213. package/node_modules/tokenjuice/dist/hosts/kiro/index.js +6 -18
  214. package/node_modules/tokenjuice/dist/hosts/knowns/index.d.ts +5 -16
  215. package/node_modules/tokenjuice/dist/hosts/knowns/index.js +35 -203
  216. package/node_modules/tokenjuice/dist/hosts/leanctl/index.d.ts +5 -16
  217. package/node_modules/tokenjuice/dist/hosts/leanctl/index.js +15 -156
  218. package/node_modules/tokenjuice/dist/hosts/localcode/index.d.ts +2 -7
  219. package/node_modules/tokenjuice/dist/hosts/localcode/index.js +10 -68
  220. package/node_modules/tokenjuice/dist/hosts/mastra/index.d.ts +28 -0
  221. package/node_modules/tokenjuice/dist/hosts/mastra/index.js +26 -0
  222. package/node_modules/tokenjuice/dist/hosts/mcp-agent/index.d.ts +2 -7
  223. package/node_modules/tokenjuice/dist/hosts/mcp-agent/index.js +15 -109
  224. package/node_modules/tokenjuice/dist/hosts/mini-swe-agent/index.d.ts +2 -7
  225. package/node_modules/tokenjuice/dist/hosts/mini-swe-agent/index.js +21 -110
  226. package/node_modules/tokenjuice/dist/hosts/mistral-vibe/index.d.ts +5 -17
  227. package/node_modules/tokenjuice/dist/hosts/mistral-vibe/index.js +13 -123
  228. package/node_modules/tokenjuice/dist/hosts/mux/index.d.ts +6 -13
  229. package/node_modules/tokenjuice/dist/hosts/mux/index.js +54 -349
  230. package/node_modules/tokenjuice/dist/hosts/novakit/index.d.ts +5 -16
  231. package/node_modules/tokenjuice/dist/hosts/novakit/index.js +35 -203
  232. package/node_modules/tokenjuice/dist/hosts/ona/index.d.ts +2 -8
  233. package/node_modules/tokenjuice/dist/hosts/ona/index.js +19 -283
  234. package/node_modules/tokenjuice/dist/hosts/open-interpreter/index.d.ts +2 -9
  235. package/node_modules/tokenjuice/dist/hosts/open-interpreter/index.js +11 -66
  236. package/node_modules/tokenjuice/dist/hosts/openclaw/extension.js +6 -5
  237. package/node_modules/tokenjuice/dist/hosts/opencode/extension/runtime.js +540 -363
  238. package/node_modules/tokenjuice/dist/hosts/opencode/index.js +8 -54
  239. package/node_modules/tokenjuice/dist/hosts/opencode/v2/bundle/index.js +9648 -0
  240. package/node_modules/tokenjuice/dist/hosts/opencode/v2/index.d.ts +37 -0
  241. package/node_modules/tokenjuice/dist/hosts/opencode/v2/index.js +97 -0
  242. package/node_modules/tokenjuice/dist/hosts/opencode/v2/runtime.d.ts +13 -0
  243. package/node_modules/tokenjuice/dist/hosts/opencode/v2/runtime.js +23 -0
  244. package/node_modules/tokenjuice/dist/hosts/openhands/index.d.ts +7 -14
  245. package/node_modules/tokenjuice/dist/hosts/openhands/index.js +111 -186
  246. package/node_modules/tokenjuice/dist/hosts/openwebui/index.d.ts +2 -7
  247. package/node_modules/tokenjuice/dist/hosts/openwebui/index.js +2 -24
  248. package/node_modules/tokenjuice/dist/hosts/pi/extension/pi-types.d.ts +3 -2
  249. package/node_modules/tokenjuice/dist/hosts/pi/extension/runtime.d.ts +2 -1
  250. package/node_modules/tokenjuice/dist/hosts/pi/extension/runtime.js +545 -359
  251. package/node_modules/tokenjuice/dist/hosts/pi/extension/status-panel.d.ts +1 -1
  252. package/node_modules/tokenjuice/dist/hosts/pi/extension/status.d.ts +1 -1
  253. package/node_modules/tokenjuice/dist/hosts/pi/extension/tool-result.d.ts +1 -1
  254. package/node_modules/tokenjuice/dist/hosts/pi/index.d.ts +1 -0
  255. package/node_modules/tokenjuice/dist/hosts/pi/index.js +5 -53
  256. package/node_modules/tokenjuice/dist/hosts/pi-go/index.d.ts +2 -8
  257. package/node_modules/tokenjuice/dist/hosts/pi-go/index.js +26 -190
  258. package/node_modules/tokenjuice/dist/hosts/plandex/index.d.ts +2 -9
  259. package/node_modules/tokenjuice/dist/hosts/plandex/index.js +10 -41
  260. package/node_modules/tokenjuice/dist/hosts/qoder/hook-install.d.ts +22 -0
  261. package/node_modules/tokenjuice/dist/hosts/qoder/hook-install.js +105 -0
  262. package/node_modules/tokenjuice/dist/hosts/qoder/hook.d.ts +1 -0
  263. package/node_modules/tokenjuice/dist/hosts/qoder/hook.js +22 -0
  264. package/node_modules/tokenjuice/dist/hosts/qoder/index.d.ts +5 -17
  265. package/node_modules/tokenjuice/dist/hosts/qoder/index.js +13 -113
  266. package/node_modules/tokenjuice/dist/hosts/qoderwork/index.d.ts +36 -0
  267. package/node_modules/tokenjuice/dist/hosts/qoderwork/index.js +20 -0
  268. package/node_modules/tokenjuice/dist/hosts/qodo/index.d.ts +2 -8
  269. package/node_modules/tokenjuice/dist/hosts/qodo/index.js +20 -290
  270. package/node_modules/tokenjuice/dist/hosts/qwen-code/index.d.ts +6 -13
  271. package/node_modules/tokenjuice/dist/hosts/qwen-code/index.js +60 -165
  272. package/node_modules/tokenjuice/dist/hosts/qwenwork/index.d.ts +36 -0
  273. package/node_modules/tokenjuice/dist/hosts/qwenwork/index.js +20 -0
  274. package/node_modules/tokenjuice/dist/hosts/replit/index.d.ts +5 -17
  275. package/node_modules/tokenjuice/dist/hosts/replit/index.js +13 -123
  276. package/node_modules/tokenjuice/dist/hosts/roo/index.d.ts +5 -17
  277. package/node_modules/tokenjuice/dist/hosts/roo/index.js +5 -31
  278. package/node_modules/tokenjuice/dist/hosts/rovo/index.d.ts +5 -17
  279. package/node_modules/tokenjuice/dist/hosts/rovo/index.js +13 -123
  280. package/node_modules/tokenjuice/dist/hosts/ruler/index.d.ts +2 -9
  281. package/node_modules/tokenjuice/dist/hosts/ruler/index.js +10 -64
  282. package/node_modules/tokenjuice/dist/hosts/shared/bundle-runtime.d.ts +2 -0
  283. package/node_modules/tokenjuice/dist/hosts/shared/bundle-runtime.js +56 -0
  284. package/node_modules/tokenjuice/dist/hosts/shared/hook-command-doctor.d.ts +3 -8
  285. package/node_modules/tokenjuice/dist/hosts/shared/hook-command-doctor.js +3 -3
  286. package/node_modules/tokenjuice/dist/hosts/shared/hook-doctor.d.ts +112 -101
  287. package/node_modules/tokenjuice/dist/hosts/shared/hook-doctor.js +10 -0
  288. package/node_modules/tokenjuice/dist/hosts/shared/hook-output.d.ts +0 -1
  289. package/node_modules/tokenjuice/dist/hosts/shared/hook-output.js +1 -1
  290. package/node_modules/tokenjuice/dist/hosts/shared/hooks-json-file.d.ts +15 -0
  291. package/node_modules/tokenjuice/dist/hosts/shared/hooks-json-file.js +93 -0
  292. package/node_modules/tokenjuice/dist/hosts/shared/host-command.d.ts +1 -1
  293. package/node_modules/tokenjuice/dist/hosts/shared/host-command.js +4 -4
  294. package/node_modules/tokenjuice/dist/hosts/shared/instruction-doctor.d.ts +4 -0
  295. package/node_modules/tokenjuice/dist/hosts/shared/instruction-file.d.ts +26 -6
  296. package/node_modules/tokenjuice/dist/hosts/shared/instruction-file.js +125 -5
  297. package/node_modules/tokenjuice/dist/hosts/shared/instruction-guidance.d.ts +7 -0
  298. package/node_modules/tokenjuice/dist/hosts/shared/instruction-guidance.js +24 -0
  299. package/node_modules/tokenjuice/dist/hosts/shared/managed-skill.d.ts +42 -0
  300. package/node_modules/tokenjuice/dist/hosts/shared/managed-skill.js +87 -0
  301. package/node_modules/tokenjuice/dist/hosts/shared/marker-instruction-doctor.d.ts +29 -0
  302. package/node_modules/tokenjuice/dist/hosts/shared/marker-instruction-doctor.js +72 -0
  303. package/node_modules/tokenjuice/dist/hosts/shared/marker-instructions.d.ts +12 -0
  304. package/node_modules/tokenjuice/dist/hosts/shared/marker-instructions.js +43 -0
  305. package/node_modules/tokenjuice/dist/hosts/shared/owned-instruction-doctor.d.ts +9 -0
  306. package/node_modules/tokenjuice/dist/hosts/shared/owned-instruction-doctor.js +17 -0
  307. package/node_modules/tokenjuice/dist/hosts/shared/path-ancestors.d.ts +14 -0
  308. package/node_modules/tokenjuice/dist/hosts/shared/path-ancestors.js +117 -0
  309. package/node_modules/tokenjuice/dist/hosts/shared/pre-tool-wrap.d.ts +7 -7
  310. package/node_modules/tokenjuice/dist/hosts/shared/pre-tool-wrap.js +13 -48
  311. package/node_modules/tokenjuice/dist/hosts/shared/private-config-file.d.ts +2 -0
  312. package/node_modules/tokenjuice/dist/hosts/shared/private-config-file.js +36 -0
  313. package/node_modules/tokenjuice/dist/hosts/shared/project-root.d.ts +5 -0
  314. package/node_modules/tokenjuice/dist/hosts/shared/project-root.js +33 -0
  315. package/node_modules/tokenjuice/dist/hosts/shared/project-skill-doctor.d.ts +14 -0
  316. package/node_modules/tokenjuice/dist/hosts/shared/project-skill-doctor.js +62 -0
  317. package/node_modules/tokenjuice/dist/hosts/shared/restorable-rule.d.ts +15 -0
  318. package/node_modules/tokenjuice/dist/hosts/shared/restorable-rule.js +64 -0
  319. package/node_modules/tokenjuice/dist/hosts/shared/restorable-skill.d.ts +15 -0
  320. package/node_modules/tokenjuice/dist/hosts/shared/restorable-skill.js +48 -0
  321. package/node_modules/tokenjuice/dist/hosts/shared/settings-file.d.ts +5 -1
  322. package/node_modules/tokenjuice/dist/hosts/shared/settings-file.js +33 -5
  323. package/node_modules/tokenjuice/dist/hosts/shared/skill-frontmatter.d.ts +5 -0
  324. package/node_modules/tokenjuice/dist/hosts/shared/skill-frontmatter.js +18 -0
  325. package/node_modules/tokenjuice/dist/hosts/stagewise/index.d.ts +2 -8
  326. package/node_modules/tokenjuice/dist/hosts/stagewise/index.js +50 -377
  327. package/node_modules/tokenjuice/dist/hosts/swe-agent/index.d.ts +2 -7
  328. package/node_modules/tokenjuice/dist/hosts/swe-agent/index.js +20 -88
  329. package/node_modules/tokenjuice/dist/hosts/tabby/index.d.ts +2 -8
  330. package/node_modules/tokenjuice/dist/hosts/tabby/index.js +13 -190
  331. package/node_modules/tokenjuice/dist/hosts/tabnine/index.d.ts +5 -17
  332. package/node_modules/tokenjuice/dist/hosts/tabnine/index.js +13 -123
  333. package/node_modules/tokenjuice/dist/hosts/trae/index.d.ts +2 -9
  334. package/node_modules/tokenjuice/dist/hosts/trae/index.js +17 -123
  335. package/node_modules/tokenjuice/dist/hosts/uipath/index.d.ts +5 -17
  336. package/node_modules/tokenjuice/dist/hosts/uipath/index.js +13 -123
  337. package/node_modules/tokenjuice/dist/hosts/vscode-copilot/index.d.ts +2 -11
  338. package/node_modules/tokenjuice/dist/hosts/vscode-copilot/index.js +15 -101
  339. package/node_modules/tokenjuice/dist/hosts/warp/index.d.ts +5 -17
  340. package/node_modules/tokenjuice/dist/hosts/warp/index.js +14 -116
  341. package/node_modules/tokenjuice/dist/hosts/windsurf/index.d.ts +2 -9
  342. package/node_modules/tokenjuice/dist/hosts/windsurf/index.js +6 -18
  343. package/node_modules/tokenjuice/dist/hosts/zed/index.d.ts +5 -17
  344. package/node_modules/tokenjuice/dist/hosts/zed/index.js +5 -27
  345. package/node_modules/tokenjuice/dist/hosts/zencoder/index.d.ts +2 -9
  346. package/node_modules/tokenjuice/dist/hosts/zencoder/index.js +42 -139
  347. package/node_modules/tokenjuice/dist/index.d.ts +20 -4
  348. package/node_modules/tokenjuice/dist/index.js +14 -4
  349. package/node_modules/tokenjuice/dist/python/LICENSE +21 -0
  350. package/node_modules/tokenjuice/dist/python/README.md +38 -0
  351. package/node_modules/tokenjuice/dist/python/pyproject.toml +30 -0
  352. package/node_modules/tokenjuice/dist/python/tokenjuice_integrations/README.md +29 -0
  353. package/node_modules/tokenjuice/dist/python/tokenjuice_integrations/__init__.py +3 -0
  354. package/node_modules/tokenjuice/dist/python/tokenjuice_integrations/bridge.py +39 -0
  355. package/node_modules/tokenjuice/dist/python/tokenjuice_integrations/fastmcp.py +24 -0
  356. package/node_modules/tokenjuice/dist/python/tokenjuice_integrations/hermes.py +13 -0
  357. package/node_modules/tokenjuice/dist/python/tokenjuice_integrations/langchain.py +38 -0
  358. package/node_modules/tokenjuice/dist/python/tokenjuice_integrations/plugin.yaml +7 -0
  359. package/node_modules/tokenjuice/dist/types.d.ts +9 -8
  360. package/node_modules/tokenjuice/package.json +32 -11
  361. package/package.json +5 -5
@@ -1,6 +1,12 @@
1
+ export { installQoderWorkSkill, doctorQoderWorkSkill, uninstallQoderWorkSkill } from "./hosts/qoderwork/index.js";
2
+ export { installQwenWorkSkill, doctorQwenWorkSkill, uninstallQwenWorkSkill } from "./hosts/qwenwork/index.js";
3
+ export { installOpenCodeV2Extension, doctorOpenCodeV2Extension, uninstallOpenCodeV2Extension } from "./hosts/opencode/v2/index.js";
1
4
  export { ARTIFACT_DIR_ENV, STATS_ENABLED_ENV, getArtifact, isValidArtifactId, listArtifactMetadata, listArtifactMetadataPage, listArtifacts, resolveArtifactBaseDir, shouldRecordStats, storeArtifact, storeArtifactMetadata } from "./core/artifacts.js";
2
5
  export { buildAnalysisEntry, discoverCandidates, doctorArtifacts, statsArtifacts } from "./core/analysis.js";
3
6
  export { classifyExecution } from "./core/classify.js";
7
+ export { compactFrameworkResult } from "./core/integrations/compact-framework-result.js";
8
+ export { createCopilotSdkHooks } from "./hosts/copilot-sdk/index.js";
9
+ export { createMastraProcessor } from "./hosts/mastra/index.js";
4
10
  export { normalizeCommandSignature, normalizeEffectiveCommandSignature, normalizeExecutionInput, tokenizeCommand } from "./core/command.js";
5
11
  export { doctorAdalInstructions, installAdalInstructions, uninstallAdalInstructions } from "./hosts/adal/index.js";
6
12
  export { doctorAetherPrompt, installAetherPrompt, uninstallAetherPrompt } from "./hosts/aether/index.js";
@@ -30,7 +36,7 @@ export { doctorBobInstructions, installBobInstructions, uninstallBobInstructions
30
36
  export { doctorBuilderRule, installBuilderRule, uninstallBuilderRule } from "./hosts/builder/index.js";
31
37
  export { doctorCharlieInstructions, installCharlieInstructions, uninstallCharlieInstructions } from "./hosts/charlie/index.js";
32
38
  export { doctorClaudeCodeHook, installClaudeCodeHook, runClaudeCodePostToolUseHook, runClaudeCodePreToolUseHook, uninstallClaudeCodeHook } from "./hosts/claude-code/index.js";
33
- export { doctorClineHook, installClineHook, runClinePostToolUseHook, uninstallClineHook } from "./hosts/cline/index.js";
39
+ export { doctorClineHook, installClineHook, runClinePreToolUseHook, runClinePostToolUseHook, uninstallClineHook } from "./hosts/cline/index.js";
34
40
  export { doctorCodeAntInstructions, installCodeAntInstructions, uninstallCodeAntInstructions } from "./hosts/codeant/index.js";
35
41
  export { doctorCodebuffInstructions, installCodebuffInstructions, uninstallCodebuffInstructions } from "./hosts/codebuff/index.js";
36
42
  export { doctorCodegenInstructions, installCodegenInstructions, uninstallCodegenInstructions } from "./hosts/codegen/index.js";
@@ -48,12 +54,12 @@ export { doctorDeepAgentsInstructions, installDeepAgentsInstructions, uninstallD
48
54
  export { doctorDevinHook, installDevinHook, runDevinPreToolUseHook, uninstallDevinHook } from "./hosts/devin/index.js";
49
55
  export { doctorDotAgentsRule, installDotAgentsRule, uninstallDotAgentsRule } from "./hosts/dot-agents/index.js";
50
56
  export { doctorDockerAgentPrompt, installDockerAgentPrompt, uninstallDockerAgentPrompt } from "./hosts/docker-agent/index.js";
51
- export { doctorDroidHook, installDroidHook, runDroidPostToolUseHook, uninstallDroidHook } from "./hosts/droid/index.js";
57
+ export { doctorDroidHook, installDroidHook, runDroidPostToolUseHook, runDroidPreToolUseHook, uninstallDroidHook } from "./hosts/droid/index.js";
52
58
  export { doctorEcaSkill, installEcaSkill, uninstallEcaSkill } from "./hosts/eca/index.js";
53
59
  export { doctorElyraSkill, installElyraSkill, uninstallElyraSkill } from "./hosts/elyra/index.js";
54
60
  export { doctorFirebaseStudioRule, installFirebaseStudioRule, uninstallFirebaseStudioRule } from "./hosts/firebase-studio/index.js";
55
61
  export { doctorForgeCodeInstructions, installForgeCodeInstructions, uninstallForgeCodeInstructions } from "./hosts/forgecode/index.js";
56
- export { doctorGeminiCliHook, installGeminiCliHook, runGeminiCliAfterToolHook, uninstallGeminiCliHook } from "./hosts/gemini-cli/index.js";
62
+ export { doctorGeminiCliHook, installGeminiCliHook, runGeminiCliAfterToolHook, runGeminiCliBeforeToolHook, uninstallGeminiCliHook } from "./hosts/gemini-cli/index.js";
57
63
  export { doctorGitLabDuoRule, installGitLabDuoRule, uninstallGitLabDuoRule } from "./hosts/gitlab-duo/index.js";
58
64
  export { doctorGooseHints, installGooseHints, uninstallGooseHints } from "./hosts/goose/index.js";
59
65
  export { doctorGreptileRule, installGreptileRule, uninstallGreptileRule } from "./hosts/greptile/index.js";
@@ -85,6 +91,7 @@ export { doctorPiGoSkill, installPiGoSkill, uninstallPiGoSkill } from "./hosts/p
85
91
  export { doctorPlandexConvention, installPlandexConvention, uninstallPlandexConvention } from "./hosts/plandex/index.js";
86
92
  export { doctorQodoReviewConfig, installQodoReviewConfig, uninstallQodoReviewConfig } from "./hosts/qodo/index.js";
87
93
  export { doctorQoderInstructions, installQoderInstructions, uninstallQoderInstructions } from "./hosts/qoder/index.js";
94
+ export { runQoderPostToolUseHook } from "./hosts/qoder/hook.js";
88
95
  export { doctorReplitInstructions, installReplitInstructions, uninstallReplitInstructions } from "./hosts/replit/index.js";
89
96
  export { doctorRooInstructions, installRooInstructions, uninstallRooInstructions } from "./hosts/roo/index.js";
90
97
  export { doctorRovoInstructions, installRovoInstructions, uninstallRovoInstructions } from "./hosts/rovo/index.js";
@@ -101,7 +108,7 @@ export { doctorZencoderRule, installZencoderRule, uninstallZencoderRule } from "
101
108
  export { doctorInstalledHooks } from "./hosts/shared/hook-doctor.js";
102
109
  export { doctorPiExtension, installPiExtension, uninstallPiExtension } from "./hosts/pi/index.js";
103
110
  export { doctorOpenCodeExtension, installOpenCodeExtension, uninstallOpenCodeExtension, } from "./hosts/opencode/index.js";
104
- export { doctorQwenCodeHook, installQwenCodeHook, runQwenCodePostToolUseHook, uninstallQwenCodeHook } from "./hosts/qwen-code/index.js";
111
+ export { doctorQwenCodeHook, installQwenCodeHook, runQwenCodePostToolUseHook, runQwenCodePreToolUseHook, uninstallQwenCodeHook } from "./hosts/qwen-code/index.js";
105
112
  export { doctorRulerRule, installRulerRule, uninstallRulerRule } from "./hosts/ruler/index.js";
106
113
  export { runReduceJsonCli } from "./core/cli-client.js";
107
114
  export { clearFixtureCache, loadBuiltinFixtures, verifyBuiltinFixtures } from "./core/fixtures.js";
@@ -112,3 +119,6 @@ export { normalizeArtifactSource, readStoredArtifactSource, resolveArtifactSourc
112
119
  export { clampText, countTerminalCells, countTextChars, stripAnsi } from "./core/text.js";
113
120
  export { runWrappedCommand } from "./core/wrap.js";
114
121
  export { assertValidRule, validateRule } from "./core/validate-rules.js";
122
+ export { doctorAnteInstructions, installAnteInstructions, uninstallAnteInstructions } from "./hosts/ante/index.js";
123
+ export { installQoderHook, uninstallQoderHook, doctorQoderHook } from "./hosts/qoder/hook-install.js";
124
+ export { onDeepSeekPostExecute } from "./hosts/deepseek-harness/runtime.js";
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vincent Koc
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,38 @@
1
+ # tokenjuice-integrations
2
+
3
+ Python adapters for [tokenjuice](https://github.com/vincentkoc/tokenjuice), a local
4
+ tool-output compactor. LangChain tool middleware and FastMCP server/proxy
5
+ middleware replace eligible successful shell output before model consumption.
6
+ Failures, unknown exit status, exact file reads, and explicit raw requests pass
7
+ through. Applications map their own trusted execution records; tool success
8
+ alone does not establish a shell exit code.
9
+
10
+ ## Install
11
+
12
+ Python 3.11 or newer and tokenjuice CLI 0.10.0 or newer are required. Install the CLI separately
13
+ with Node.js 22 or newer, and install only the Python extras your application uses:
14
+
15
+ ```sh
16
+ npm install --global tokenjuice
17
+ python -m pip install "tokenjuice-integrations[langchain]"
18
+ # Or: python -m pip install "tokenjuice-integrations[fastmcp]"
19
+ ```
20
+
21
+ Keep the CLI on your application's PATH or set `TOKENJUICE_BIN` to its executable
22
+ path. For an npm/release bundle, install its `dist/python` directory with the same
23
+ extras instead of a registry name.
24
+
25
+ ## Configure
26
+
27
+ - [LangChain middleware and execution-record mapping](https://github.com/vincentkoc/tokenjuice/blob/main/docs/framework-integrations.md#langchain)
28
+ - [FastMCP middleware and coherent result replacement](https://github.com/vincentkoc/tokenjuice/blob/main/docs/framework-integrations.md#fastmcp)
29
+ - [Hermes native plugin installation](https://github.com/vincentkoc/tokenjuice/blob/main/docs/framework-integrations.md#hermes)
30
+
31
+ The adapters send captured output to the local `tokenjuice compact-shell-result`
32
+ subprocess. They never execute the command string in that payload. Bridge calls
33
+ disable statistics and preserve the original result on missing executables,
34
+ invalid responses, inputs over 2 MB, or five-second timeouts. No model service or
35
+ API key is required. Remove middleware from the application to disable it.
36
+
37
+ MIT-licensed. Source, issue tracking, and native contract tests are in the
38
+ [tokenjuice repository](https://github.com/vincentkoc/tokenjuice).
@@ -0,0 +1,30 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77.0.3,<85"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "tokenjuice-integrations"
7
+ version = "0.11.0"
8
+ description = "Local tool-result compaction for LangChain and FastMCP"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ authors = [{ name = "Vincent Koc" }]
13
+ requires-python = ">=3.11"
14
+ dependencies = []
15
+
16
+ [project.urls]
17
+ Homepage = "https://github.com/vincentkoc/tokenjuice"
18
+ Documentation = "https://github.com/vincentkoc/tokenjuice/blob/main/docs/framework-integrations.md"
19
+ Source = "https://github.com/vincentkoc/tokenjuice"
20
+ Issues = "https://github.com/vincentkoc/tokenjuice/issues"
21
+
22
+ [project.optional-dependencies]
23
+ langchain = ["langchain>=1.4,<2"]
24
+ fastmcp = ["fastmcp>=4.1,<5"]
25
+
26
+ [tool.setuptools.packages.find]
27
+ include = ["tokenjuice_integrations*"]
28
+
29
+ [tool.setuptools.package-data]
30
+ tokenjuice_integrations = ["plugin.yaml", "README.md"]
@@ -0,0 +1,29 @@
1
+ # tokenjuice Hermes plugin
2
+
3
+ This directory is a self-contained Hermes plugin. It registers the public
4
+ `transform_terminal_output` hook and needs Hermes 0.22.5 or newer. Optional
5
+ LangChain and FastMCP modules are not loaded by Hermes.
6
+
7
+ Install the [tokenjuice CLI](https://github.com/vincentkoc/tokenjuice) separately
8
+ with `npm install --global tokenjuice` (Node.js 22 or newer), then install this
9
+ plugin through Hermes using the repository's `src/python/tokenjuice_integrations`
10
+ subdirectory. Use an exact commit when installing from Git. Enable it with
11
+ `hermes plugins enable tokenjuice` and check `hermes plugins doctor tokenjuice`.
12
+ See the [setup guide](https://github.com/vincentkoc/tokenjuice/blob/main/docs/framework-integrations.md#hermes)
13
+ for the bundled release alternative.
14
+
15
+ The plugin passes captured terminal output to the local `tokenjuice
16
+ compact-shell-result` subprocess. It never executes the command supplied in the
17
+ hook payload. Only successful foreground output is eligible; failures, background
18
+ polls, exact file reads, and explicit raw requests retain their original output.
19
+ Missing executables, invalid responses, inputs over 2 MB, and five-second timeouts
20
+ also preserve the original output.
21
+
22
+ The CLI reads tokenjuice's local configuration and rules. Bridge calls disable
23
+ statistics and require no credentials or network service. Keep `tokenjuice` on
24
+ PATH, or set `TOKENJUICE_BIN` to its executable path. No Hermes permissions are
25
+ changed. Disable with `hermes plugins disable tokenjuice`; remove with
26
+ `hermes plugins remove tokenjuice`.
27
+
28
+ Maintained by [vincentkoc](https://github.com/vincentkoc). MIT-licensed; see the
29
+ [repository license](https://github.com/vincentkoc/tokenjuice/blob/main/LICENSE).
@@ -0,0 +1,3 @@
1
+ """Optional native adapters and the dependency-free Hermes plugin entrypoint."""
2
+
3
+ from .hermes import register
@@ -0,0 +1,39 @@
1
+ """Pass captured output to tokenjuice; never execute the command in the payload."""
2
+ import asyncio
3
+ import json
4
+ import os
5
+ import subprocess
6
+
7
+ MAX_INPUT_BYTES = 2_000_000
8
+
9
+
10
+ def compact_result(source, result, *, launcher=None, timeout=5):
11
+ if not isinstance(result, dict) or type(result.get("exitCode")) is not int or result["exitCode"] != 0:
12
+ return None
13
+ if not isinstance(result.get("output"), str) or not isinstance(result.get("command"), str):
14
+ return None
15
+ try:
16
+ payload = json.dumps({"source": source, "result": result}).encode("utf-8")
17
+ if len(payload) > MAX_INPUT_BYTES:
18
+ return None
19
+ command = list(launcher) if launcher is not None else [os.environ.get("TOKENJUICE_BIN", "tokenjuice")]
20
+ completed = subprocess.run(
21
+ [*command, "compact-shell-result"], input=payload,
22
+ stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, timeout=timeout,
23
+ check=False, env={**os.environ, "TOKENJUICE_STATS": "off"},
24
+ )
25
+ if completed.returncode != 0 or len(completed.stdout) > MAX_INPUT_BYTES:
26
+ return None
27
+ response = json.loads(completed.stdout)
28
+ if not isinstance(response, dict):
29
+ return None
30
+ text = response.get("text")
31
+ if response.get("action") == "rewrite" and isinstance(text, str) and 0 < len(text) < len(result["output"]):
32
+ return text
33
+ except (OSError, ValueError, TypeError, subprocess.TimeoutExpired):
34
+ pass
35
+ return None
36
+
37
+
38
+ async def acompact_result(source, result, **options):
39
+ return await asyncio.to_thread(compact_result, source, result, **options)
@@ -0,0 +1,24 @@
1
+ """FastMCP response middleware, including servers backed by a proxy provider."""
2
+ from fastmcp.server.middleware import Middleware
3
+
4
+ from .bridge import acompact_result
5
+
6
+
7
+ class TokenjuiceMiddleware(Middleware):
8
+ def __init__(self, decode, replace, *, launcher=None):
9
+ self.decode = decode
10
+ self.replace = replace
11
+ self.launcher = launcher
12
+
13
+ async def on_call_tool(self, context, call_next):
14
+ result = await call_next(context)
15
+ if getattr(result, "isError", False) or getattr(result, "is_error", False):
16
+ return result
17
+ try:
18
+ execution = self.decode(context, result)
19
+ if execution is None:
20
+ return result
21
+ text = await acompact_result("fastmcp", execution, launcher=self.launcher)
22
+ return self.replace(result, text) if text is not None else result
23
+ except Exception:
24
+ return result
@@ -0,0 +1,13 @@
1
+ """Hermes native terminal transform. The host retains its own status envelope."""
2
+ from .bridge import compact_result
3
+
4
+
5
+ def transform_terminal_output(command, output, returncode=None, env_type="", **kwargs):
6
+ # Background poll output has no environment provenance; do not rewrite it.
7
+ if not isinstance(env_type, str) or not env_type:
8
+ return None
9
+ return compact_result("hermes", {"command": command, "output": output, "exitCode": returncode})
10
+
11
+
12
+ def register(ctx):
13
+ ctx.register_hook("transform_terminal_output", transform_terminal_output)
@@ -0,0 +1,38 @@
1
+ """LangChain sync/async middleware for explicitly mapped shell tools."""
2
+ from langchain.agents.middleware import AgentMiddleware
3
+ from langchain_core.messages import ToolMessage
4
+
5
+ from .bridge import acompact_result, compact_result
6
+
7
+
8
+ class TokenjuiceMiddleware(AgentMiddleware):
9
+ def __init__(self, decode, *, launcher=None):
10
+ self.decode = decode
11
+ self.launcher = launcher
12
+
13
+ def _execution(self, request, result):
14
+ if not isinstance(result, ToolMessage) or result.status == "error" or not isinstance(result.content, str):
15
+ return None
16
+ try:
17
+ execution = self.decode(request, result)
18
+ if isinstance(execution, dict) and execution.get("output") == result.content:
19
+ return execution
20
+ except Exception:
21
+ pass
22
+ return None
23
+
24
+ def wrap_tool_call(self, request, handler):
25
+ result = handler(request)
26
+ execution = self._execution(request, result)
27
+ if execution is None:
28
+ return result
29
+ text = compact_result("langchain", execution, launcher=self.launcher)
30
+ return result.model_copy(update={"content": text}) if text is not None else result
31
+
32
+ async def awrap_tool_call(self, request, handler):
33
+ result = await handler(request)
34
+ execution = self._execution(request, result)
35
+ if execution is None:
36
+ return result
37
+ text = await acompact_result("langchain", execution, launcher=self.launcher)
38
+ return result.model_copy(update={"content": text}) if text is not None else result
@@ -0,0 +1,7 @@
1
+ name: tokenjuice
2
+ version: 0.10.0
3
+ description: Compact successful terminal output before model consumption
4
+ author: vincentkoc
5
+ requires_hermes: ">=0.22.5"
6
+ provides_hooks:
7
+ - transform_terminal_output
@@ -16,17 +16,17 @@ export type ToolExecutionInput = {
16
16
  durationMs?: number;
17
17
  metadata?: Record<string, unknown>;
18
18
  };
19
- export type RuleCounter = {
19
+ type RuleCounter = {
20
20
  name: string;
21
21
  pattern: string;
22
22
  flags?: string;
23
23
  };
24
- export type RuleOutputMatch = {
24
+ type RuleOutputMatch = {
25
25
  pattern: string;
26
26
  message: string;
27
27
  flags?: string;
28
28
  };
29
- export type RuleMatch = {
29
+ type RuleMatch = {
30
30
  toolNames?: string[];
31
31
  argv0?: string[];
32
32
  gitSubcommands?: string[];
@@ -35,21 +35,21 @@ export type RuleMatch = {
35
35
  commandIncludes?: string[];
36
36
  commandIncludesAny?: string[];
37
37
  };
38
- export type RuleFilters = {
38
+ type RuleFilters = {
39
39
  skipPatterns?: string[];
40
40
  keepPatterns?: string[];
41
41
  };
42
- export type RuleTransforms = {
42
+ type RuleTransforms = {
43
43
  stripAnsi?: boolean;
44
44
  prettyPrintJson?: boolean;
45
45
  dedupeAdjacent?: boolean;
46
46
  trimEmptyEdges?: boolean;
47
47
  };
48
- export type RuleSummarize = {
48
+ type RuleSummarize = {
49
49
  head?: number;
50
50
  tail?: number;
51
51
  };
52
- export type RuleFailure = {
52
+ type RuleFailure = {
53
53
  preserveOnFailure?: boolean;
54
54
  head?: number;
55
55
  tail?: number;
@@ -180,7 +180,6 @@ export type ReduceOptions = {
180
180
  storeDir?: string;
181
181
  cwd?: string;
182
182
  };
183
- export type ReduceExecutionResult = CompactResult;
184
183
  export type ReduceJsonRequest = {
185
184
  input: ToolExecutionInput;
186
185
  options?: ReduceOptions;
@@ -207,6 +206,7 @@ export type RuleFixture = {
207
206
  };
208
207
  };
209
208
  export type WrapOptions = {
209
+ keepFailures?: boolean;
210
210
  cwd?: string;
211
211
  source?: string;
212
212
  noOmit?: boolean;
@@ -225,3 +225,4 @@ export type WrapResult = {
225
225
  stdout: string;
226
226
  stderr: string;
227
227
  };
228
+ export {};
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tokenjuice",
3
- "version": "0.8.5",
3
+ "version": "0.11.0",
4
4
  "description": "Lean output compaction for terminal-heavy agent workflows.",
5
5
  "keywords": [
6
6
  "cli",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "license": "MIT",
26
26
  "type": "module",
27
- "packageManager": "pnpm@10.11.0",
27
+ "packageManager": "pnpm@10.34.9",
28
28
  "main": "./dist/index.js",
29
29
  "types": "./dist/index.d.ts",
30
30
  "bin": {
@@ -35,6 +35,14 @@
35
35
  "./openclaw": {
36
36
  "types": "./dist/hosts/openclaw/index.d.ts",
37
37
  "default": "./dist/hosts/openclaw/index.js"
38
+ },
39
+ "./copilot-sdk": {
40
+ "types": "./dist/hosts/copilot-sdk/index.d.ts",
41
+ "default": "./dist/hosts/copilot-sdk/index.js"
42
+ },
43
+ "./mastra": {
44
+ "types": "./dist/hosts/mastra/index.d.ts",
45
+ "default": "./dist/hosts/mastra/index.js"
38
46
  }
39
47
  },
40
48
  "files": [
@@ -44,20 +52,20 @@
44
52
  "SECURITY.md"
45
53
  ],
46
54
  "engines": {
47
- "node": ">=20"
55
+ "node": ">=22"
48
56
  },
49
57
  "scripts": {
50
58
  "analyze:codex-logs": "node scripts/analyze-codex-logs.mjs",
51
59
  "bench:fixtures": "node scripts/bench.mjs fixtures",
52
60
  "bench:verify": "node scripts/bench.mjs verify",
53
61
  "contracts": "publint run --strict --pack pnpm",
54
- "e2e:local": "pnpm build && node scripts/local-host-e2e.mjs",
62
+ "test:hook-contracts": "pnpm build && node scripts/hook-contracts.mjs",
55
63
  "generate:builtin-rules": "node scripts/generate-builtin-rules.mjs",
56
64
  "prepare": "pnpm repair:pnpm-bin-shims",
57
65
  "repair:pnpm-bin-shims": "node scripts/repair-pnpm-bin-shims.mjs",
58
- "build": "node scripts/clean-dist.mjs && pnpm generate:builtin-rules && tsc -p tsconfig.json && node scripts/build-pi-runtime.mjs && node scripts/build-opencode-runtime.mjs && node scripts/copy-rules.mjs",
66
+ "build": "node scripts/clean-dist.mjs && pnpm generate:builtin-rules && tsc -p tsconfig.json && node scripts/build-pi-runtime.mjs && node scripts/build-opencode-runtime.mjs && node scripts/build-opencode-v2-runtime.mjs && node scripts/build-deepseek-runtime.mjs && node scripts/copy-rules.mjs && node scripts/build-framework-adapters.mjs",
59
67
  "lint": "oxlint --deny-warnings src test scripts",
60
- "lint:circular": "madge --circular --extensions ts,mjs --ts-config tsconfig.json src",
68
+ "lint:circular": "madge --circular --extensions ts,mjs src",
61
69
  "release:artifacts": "node scripts/build-release.mjs",
62
70
  "release:checksums": "node scripts/write-checksums.mjs",
63
71
  "release:formula": "node scripts/generate-homebrew-formula.mjs",
@@ -69,12 +77,25 @@
69
77
  "verify:package": "pnpm build && pnpm contracts && pnpm release:artifacts && pnpm release:checksums && pnpm release:formula"
70
78
  },
71
79
  "devDependencies": {
72
- "@types/node": "^24.7.0",
80
+ "@types/node": "^22.20.5",
73
81
  "esbuild": "^0.28.1",
74
82
  "madge": "^8.0.0",
75
- "oxlint": "^1.61.0",
76
- "publint": "^0.3.18",
77
- "typescript": "^5.9.3",
78
- "vitest": "^4.1.0"
83
+ "oxlint": "^1.90.0",
84
+ "publint": "^0.3.25",
85
+ "typescript": "^7.0.2",
86
+ "vitest": "5.0.5",
87
+ "vite": "8.3.5"
88
+ },
89
+ "pnpm": {
90
+ "overrides": {
91
+ "vite": "8.3.5",
92
+ "source-map-js": "1.2.2",
93
+ "nanoid@3": "3.3.20",
94
+ "postcss": "8.5.23",
95
+ "brace-expansion": "5.0.12",
96
+ "esbuild": "0.28.2",
97
+ "@vitest/mocker": "5.0.5",
98
+ "minimatch@10": "11.0.1"
99
+ }
79
100
  }
80
101
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/tokenjuice",
3
- "version": "2026.11.7",
3
+ "version": "2026.11.10-beta.2",
4
4
  "description": "OpenClaw tokenjuice exec output compaction plugin",
5
5
  "repository": {
6
6
  "type": "git",
@@ -8,10 +8,10 @@
8
8
  },
9
9
  "type": "module",
10
10
  "dependencies": {
11
- "tokenjuice": "0.8.5"
11
+ "tokenjuice": "0.11.0"
12
12
  },
13
13
  "peerDependencies": {
14
- "openclaw": ">=2026.11.7"
14
+ "openclaw": ">=2026.11.10-beta.2"
15
15
  },
16
16
  "peerDependenciesMeta": {
17
17
  "openclaw": {
@@ -29,10 +29,10 @@
29
29
  "minHostVersion": ">=2026.5.28"
30
30
  },
31
31
  "compat": {
32
- "pluginApi": ">=2026.11.7"
32
+ "pluginApi": ">=2026.11.10-beta.2"
33
33
  },
34
34
  "build": {
35
- "openclawVersion": "2026.11.7",
35
+ "openclawVersion": "2026.11.10-beta.2",
36
36
  "bundledDist": false
37
37
  },
38
38
  "release": {