@openclaw/tokenjuice 2026.9.5 → 2026.9.6
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.
- package/node_modules/tokenjuice/README.md +4 -0
- package/node_modules/tokenjuice/dist/cli/main.d.ts +3 -0
- package/node_modules/tokenjuice/dist/cli/main.js +58 -10
- package/node_modules/tokenjuice/dist/core/analysis.js +3 -3
- package/node_modules/tokenjuice/dist/core/artifacts.d.ts +5 -1
- package/node_modules/tokenjuice/dist/core/artifacts.js +93 -45
- package/node_modules/tokenjuice/dist/core/bounded-jsonl.d.ts +26 -0
- package/node_modules/tokenjuice/dist/core/bounded-jsonl.js +407 -0
- package/node_modules/tokenjuice/dist/core/integrations/compact-bash-result.d.ts +1 -0
- package/node_modules/tokenjuice/dist/core/integrations/compact-bash-result.js +2 -1
- package/node_modules/tokenjuice/dist/core/reduce.js +5 -0
- package/node_modules/tokenjuice/dist/core/wrap.js +1 -1
- package/node_modules/tokenjuice/dist/hosts/codex/index.d.ts +6 -0
- package/node_modules/tokenjuice/dist/hosts/codex/index.js +365 -147
- package/node_modules/tokenjuice/dist/hosts/droid/index.js +12 -3
- package/node_modules/tokenjuice/dist/hosts/opencode/extension/runtime.js +1489 -1193
- package/node_modules/tokenjuice/dist/hosts/pi/extension/runtime.js +1471 -1175
- package/node_modules/tokenjuice/dist/index.d.ts +1 -1
- package/node_modules/tokenjuice/dist/index.js +1 -1
- package/node_modules/tokenjuice/dist/types.d.ts +15 -0
- package/node_modules/tokenjuice/package.json +1 -1
- package/package.json +5 -5
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
2
2
|
import { dirname, join } from "node:path";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
|
+
import { shouldRecordStats } from "../../core/artifacts.js";
|
|
4
5
|
import { stripLeadingCdPrefix } from "../../core/command.js";
|
|
5
6
|
import { compactBashResult } from "../../core/integrations/compact-bash-result.js";
|
|
6
7
|
import { buildTokenjuiceHookCommand, } from "../shared/host-command.js";
|
|
@@ -220,9 +221,17 @@ function stringifyToolResponse(value) {
|
|
|
220
221
|
return String(value);
|
|
221
222
|
}
|
|
222
223
|
async function writeHookDebug(record) {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
224
|
+
if (!shouldRecordStats()) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
try {
|
|
228
|
+
const debugPath = join(getFactoryHome(), "tokenjuice-hook.last.json");
|
|
229
|
+
await mkdir(dirname(debugPath), { recursive: true });
|
|
230
|
+
await writeFile(debugPath, `${JSON.stringify(record, null, 2)}\n`, "utf8");
|
|
231
|
+
}
|
|
232
|
+
catch {
|
|
233
|
+
// Optional diagnostics must not fail a hook or duplicate an already-written response.
|
|
234
|
+
}
|
|
226
235
|
}
|
|
227
236
|
export async function runDroidPostToolUseHook(rawText) {
|
|
228
237
|
let payload;
|