From 2b15850b471a051770519667e2a1efddf1bfbc68 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 29 May 2026 20:54:07 +0100 Subject: [PATCH] build(plugins): externalize tokenjuice --- CHANGELOG.md | 1 + docs/plugins/plugin-inventory.md | 2 +- docs/plugins/reference.md | 2 +- docs/plugins/reference/tokenjuice.md | 2 +- docs/tools/tokenjuice.md | 17 ++++---- extensions/tokenjuice/index.test.ts | 2 +- extensions/tokenjuice/npm-shrinkwrap.json | 39 +++++++++++++++++++ extensions/tokenjuice/package.json | 36 +++++++++++++++-- package.json | 2 +- pnpm-lock.yaml | 6 +-- .../lib/official-external-plugin-catalog.json | 18 +++++++++ .../bundled-plugin-build-entries.test.ts | 2 +- 12 files changed, 110 insertions(+), 19 deletions(-) create mode 100644 extensions/tokenjuice/npm-shrinkwrap.json diff --git a/CHANGELOG.md b/CHANGELOG.md index ff630f83f77..86c57158a33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Docs: https://docs.openclaw.ai ### Changes +- Plugins: externalize Tokenjuice as the official `@openclaw/tokenjuice` plugin with npm and ClawHub publish metadata. - Plugins: externalize the GitHub Copilot agent runtime as the official `@openclaw/copilot` plugin with npm and ClawHub publish metadata. ### Fixes diff --git a/docs/plugins/plugin-inventory.md b/docs/plugins/plugin-inventory.md index 84c3168c12e..fec4fd0a0cc 100644 --- a/docs/plugins/plugin-inventory.md +++ b/docs/plugins/plugin-inventory.md @@ -125,7 +125,6 @@ commands. | [telegram](/plugins/reference/telegram) | Adds the Telegram channel surface for sending and receiving OpenClaw messages. | `@openclaw/telegram`
included in OpenClaw | channels: telegram | | [tencent](/plugins/reference/tencent) | Adds Tencent TokenHub model provider support to OpenClaw. | `@openclaw/tencent-provider`
included in OpenClaw | providers: tencent-tokenhub | | [together](/plugins/reference/together) | Adds Together model provider support to OpenClaw. | `@openclaw/together-provider`
included in OpenClaw | providers: together; contracts: videoGenerationProviders | -| [tokenjuice](/plugins/reference/tokenjuice) | Compacts exec and bash tool results with tokenjuice reducers. | `@openclaw/tokenjuice`
included in OpenClaw | contracts: agentToolResultMiddleware | | [tts-local-cli](/plugins/reference/tts-local-cli) | Adds text-to-speech provider support. | `@openclaw/tts-local-cli`
included in OpenClaw | contracts: speechProviders | | [venice](/plugins/reference/venice) | Adds Venice model provider support to OpenClaw. | `@openclaw/venice-provider`
included in OpenClaw | providers: venice | | [vercel-ai-gateway](/plugins/reference/vercel-ai-gateway) | Adds Vercel AI Gateway model provider support to OpenClaw. | `@openclaw/vercel-ai-gateway-provider`
included in OpenClaw | providers: vercel-ai-gateway | @@ -172,6 +171,7 @@ commands. | [slack](/plugins/reference/slack) | OpenClaw Slack channel plugin for channels, DMs, commands, and app events. | `@openclaw/slack`
npm; ClawHub | channels: slack | | [synology-chat](/plugins/reference/synology-chat) | Synology Chat channel plugin for OpenClaw channels and direct messages. | `@openclaw/synology-chat`
npm; ClawHub | channels: synology-chat | | [tlon](/plugins/reference/tlon) | OpenClaw Tlon/Urbit channel plugin for chat workflows. | `@openclaw/tlon`
npm; ClawHub | channels: tlon; skills | +| [tokenjuice](/plugins/reference/tokenjuice) | Compacts exec and bash tool results with tokenjuice reducers. | `@openclaw/tokenjuice`
npm; ClawHub: `clawhub:@openclaw/tokenjuice` | contracts: agentToolResultMiddleware | | [twitch](/plugins/reference/twitch) | OpenClaw Twitch channel plugin for chat and moderation workflows. | `@openclaw/twitch`
npm; ClawHub | channels: twitch | | [voice-call](/plugins/reference/voice-call) | OpenClaw voice-call plugin for Twilio, Telnyx, and Plivo phone calls. | `@openclaw/voice-call`
npm; ClawHub | contracts: tools | | [whatsapp](/plugins/reference/whatsapp) | OpenClaw WhatsApp channel plugin for WhatsApp Web chats. | `@openclaw/whatsapp`
ClawHub: `clawhub:@openclaw/whatsapp`; npm | channels: whatsapp | diff --git a/docs/plugins/reference.md b/docs/plugins/reference.md index 3406e385069..0de6467b787 100644 --- a/docs/plugins/reference.md +++ b/docs/plugins/reference.md @@ -122,7 +122,7 @@ pnpm plugins:inventory:gen | [tencent](/plugins/reference/tencent) | Adds Tencent TokenHub model provider support to OpenClaw. | `@openclaw/tencent-provider`
included in OpenClaw | providers: tencent-tokenhub | | [tlon](/plugins/reference/tlon) | OpenClaw Tlon/Urbit channel plugin for chat workflows. | `@openclaw/tlon`
npm; ClawHub | channels: tlon; skills | | [together](/plugins/reference/together) | Adds Together model provider support to OpenClaw. | `@openclaw/together-provider`
included in OpenClaw | providers: together; contracts: videoGenerationProviders | -| [tokenjuice](/plugins/reference/tokenjuice) | Compacts exec and bash tool results with tokenjuice reducers. | `@openclaw/tokenjuice`
included in OpenClaw | contracts: agentToolResultMiddleware | +| [tokenjuice](/plugins/reference/tokenjuice) | Compacts exec and bash tool results with tokenjuice reducers. | `@openclaw/tokenjuice`
npm; ClawHub: `clawhub:@openclaw/tokenjuice` | contracts: agentToolResultMiddleware | | [tts-local-cli](/plugins/reference/tts-local-cli) | Adds text-to-speech provider support. | `@openclaw/tts-local-cli`
included in OpenClaw | contracts: speechProviders | | [twitch](/plugins/reference/twitch) | OpenClaw Twitch channel plugin for chat and moderation workflows. | `@openclaw/twitch`
npm; ClawHub | channels: twitch | | [venice](/plugins/reference/venice) | Adds Venice model provider support to OpenClaw. | `@openclaw/venice-provider`
included in OpenClaw | providers: venice | diff --git a/docs/plugins/reference/tokenjuice.md b/docs/plugins/reference/tokenjuice.md index 72f8c1e1171..4c808a6854f 100644 --- a/docs/plugins/reference/tokenjuice.md +++ b/docs/plugins/reference/tokenjuice.md @@ -12,7 +12,7 @@ Compacts exec and bash tool results with tokenjuice reducers. ## Distribution - Package: `@openclaw/tokenjuice` -- Install route: included in OpenClaw +- Install route: npm; ClawHub: `clawhub:@openclaw/tokenjuice` ## Surface diff --git a/docs/tools/tokenjuice.md b/docs/tools/tokenjuice.md index b44cb013fa9..885d3898521 100644 --- a/docs/tools/tokenjuice.md +++ b/docs/tools/tokenjuice.md @@ -1,13 +1,13 @@ --- -summary: "Compact noisy exec and bash tool results with an optional bundled plugin" +summary: "Compact noisy exec and bash tool results with the optional Tokenjuice plugin" title: "Tokenjuice" read_when: - You want shorter `exec` or `bash` tool results in OpenClaw - - You want to enable the bundled tokenjuice plugin + - You want to install or enable the Tokenjuice plugin - You need to understand what tokenjuice changes and what it leaves raw --- -`tokenjuice` is an optional bundled plugin that compacts noisy `exec` and `bash` +`tokenjuice` is an optional external plugin that compacts noisy `exec` and `bash` tool results after the command has already run. It changes the returned `tool_result`, not the command itself. Tokenjuice does @@ -19,7 +19,13 @@ trims the output before it goes back into the active harness session. ## Enable the plugin -Fast path: +Install once: + +```bash +openclaw plugins install clawhub:@openclaw/tokenjuice +``` + +Then enable it: ```bash openclaw config set plugins.entries.tokenjuice.enabled true @@ -31,9 +37,6 @@ Equivalent: openclaw plugins enable tokenjuice ``` -OpenClaw already ships the plugin. There is no separate `plugins install` -or `tokenjuice install openclaw` step. - If you prefer editing config directly: ```json5 diff --git a/extensions/tokenjuice/index.test.ts b/extensions/tokenjuice/index.test.ts index b1480f96ea1..7d7e0c5b623 100644 --- a/extensions/tokenjuice/index.test.ts +++ b/extensions/tokenjuice/index.test.ts @@ -17,7 +17,7 @@ vi.mock("./runtime-api.js", () => ({ import plugin from "./index.js"; -describe("tokenjuice bundled plugin", () => { +describe("tokenjuice plugin", () => { beforeEach(() => { createTokenjuiceOpenClawEmbeddedExtension.mockClear(); tokenjuiceFactory.mockClear(); diff --git a/extensions/tokenjuice/npm-shrinkwrap.json b/extensions/tokenjuice/npm-shrinkwrap.json new file mode 100644 index 00000000000..f9538f34af2 --- /dev/null +++ b/extensions/tokenjuice/npm-shrinkwrap.json @@ -0,0 +1,39 @@ +{ + "name": "@openclaw/tokenjuice", + "version": "2026.5.28", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "@openclaw/tokenjuice", + "version": "2026.5.28", + "dependencies": { + "tokenjuice": "0.8.0" + }, + "peerDependencies": { + "openclaw": ">=2026.5.28" + }, + "peerDependenciesMeta": { + "openclaw": { + "optional": true + } + } + }, + "node_modules/tokenjuice": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/tokenjuice/-/tokenjuice-0.8.0.tgz", + "integrity": "sha512-8jSOhyW3NzYNx7HbbGDkNVltQPiGaZB10Tty5Ovqpsw1VOBw7y+FikykNZ4+Gp9Ze94UubtcPDak7kkyv6F2cg==", + "license": "MIT", + "bin": { + "tokenjuice": "dist/cli/main.js" + }, + "engines": { + "node": ">=20" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/vincentkoc" + } + } + } +} diff --git a/extensions/tokenjuice/package.json b/extensions/tokenjuice/package.json index c0820a00a09..133949b40f9 100644 --- a/extensions/tokenjuice/package.json +++ b/extensions/tokenjuice/package.json @@ -1,17 +1,47 @@ { "name": "@openclaw/tokenjuice", "version": "2026.5.28", - "description": "Bundled tokenjuice exec output compaction plugin", + "description": "OpenClaw tokenjuice exec output compaction plugin", + "repository": { + "type": "git", + "url": "https://github.com/openclaw/openclaw" + }, "type": "module", "dependencies": { "tokenjuice": "0.8.0" }, + "peerDependencies": { + "openclaw": ">=2026.5.28" + }, + "peerDependenciesMeta": { + "openclaw": { + "optional": true + } + }, "devDependencies": { - "@openclaw/plugin-sdk": "workspace:*" + "@openclaw/plugin-sdk": "workspace:*", + "openclaw": "workspace:*" }, "openclaw": { "extensions": [ "./index.ts" - ] + ], + "install": { + "clawhubSpec": "clawhub:@openclaw/tokenjuice", + "npmSpec": "@openclaw/tokenjuice", + "defaultChoice": "npm", + "minHostVersion": ">=2026.5.28" + }, + "compat": { + "pluginApi": ">=2026.5.28" + }, + "build": { + "openclawVersion": "2026.5.28", + "bundledDist": false + }, + "release": { + "publishToClawHub": true, + "publishToNpm": true + } } } diff --git a/package.json b/package.json index 038799c808f..6b67ef54dc8 100644 --- a/package.json +++ b/package.json @@ -105,6 +105,7 @@ "!dist/extensions/openshell/**", "!dist/extensions/slack/**", "!dist/extensions/synology-chat/**", + "!dist/extensions/tokenjuice/**", "!dist/extensions/tlon/**", "!dist/extensions/twitch/**", "!dist/extensions/voice-call/**", @@ -1876,7 +1877,6 @@ "quickjs-wasi": "3.0.0", "rastermill": "0.3.0", "tar": "7.5.15", - "tokenjuice": "0.8.0", "tree-sitter-bash": "0.25.1", "tslog": "4.10.2", "typebox": "1.1.38", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 08769e5c04f..f6acf766877 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -182,9 +182,6 @@ importers: tar: specifier: 7.5.15 version: 7.5.15 - tokenjuice: - specifier: 0.8.0 - version: 0.8.0 tree-sitter-bash: specifier: 0.25.1 version: 0.25.1 @@ -1565,6 +1562,9 @@ importers: '@openclaw/plugin-sdk': specifier: workspace:* version: link:../../packages/plugin-sdk + openclaw: + specifier: workspace:* + version: link:../.. extensions/tts-local-cli: devDependencies: diff --git a/scripts/lib/official-external-plugin-catalog.json b/scripts/lib/official-external-plugin-catalog.json index 854e5bbf986..0e08a520397 100644 --- a/scripts/lib/official-external-plugin-catalog.json +++ b/scripts/lib/official-external-plugin-catalog.json @@ -225,6 +225,24 @@ } } }, + { + "name": "@openclaw/tokenjuice", + "description": "OpenClaw tokenjuice exec output compaction plugin", + "source": "official", + "kind": "plugin", + "openclaw": { + "plugin": { + "id": "tokenjuice", + "label": "Tokenjuice" + }, + "install": { + "clawhubSpec": "clawhub:@openclaw/tokenjuice", + "npmSpec": "@openclaw/tokenjuice", + "defaultChoice": "npm", + "minHostVersion": ">=2026.5.28" + } + } + }, { "name": "@openclaw/voice-call", "description": "OpenClaw voice-call plugin", diff --git a/test/scripts/bundled-plugin-build-entries.test.ts b/test/scripts/bundled-plugin-build-entries.test.ts index 7e9ed472d06..96f6b22cf52 100644 --- a/test/scripts/bundled-plugin-build-entries.test.ts +++ b/test/scripts/bundled-plugin-build-entries.test.ts @@ -184,7 +184,7 @@ describe("bundled plugin build entries", () => { const entries = listBundledPluginBuildEntries(); const artifacts = listBundledPluginPackArtifacts(); - for (const pluginId of ["copilot", "openshell", "slack"]) { + for (const pluginId of ["copilot", "openshell", "slack", "tokenjuice"]) { expectNoPrefixMatches(Object.keys(entries), `extensions/${pluginId}/`); expectNoPrefixMatches(artifacts, `dist/extensions/${pluginId}/`); }