troxy-cli 1.30.8 → 1.30.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "troxy-cli",
3
- "version": "1.30.8",
3
+ "version": "1.30.9",
4
4
  "description": "A secure control layer for AI agents: policies across payments, messages, logins, destructive actions, model usage, and secrets, all enforceable from the CLI",
5
5
  "homepage": "https://troxy.io",
6
6
  "bugs": {
@@ -171,6 +171,9 @@ async function readStdin(timeoutMs) {
171
171
  // (`troxy posttooluse-hook`, registered via patchClaudeCodeHooks in
172
172
  // init.js) and, below, by this file's own direct-execution guard.
173
173
  export async function runPostToolUseHook() {
174
+ // Off by default: the 2026-10-22 split A/B showed output compression alone made the model
175
+ // re-run and re-read (about 4.5x the tool calls) and cost more bar. TROXY_COMPRESS=1 re-enables it.
176
+ if (process.env.TROXY_COMPRESS !== '1') process.exit(0);
174
177
  try {
175
178
  const raw = await readStdin(STDIN_TIMEOUT_MS);
176
179
  const input = JSON.parse(raw);
@@ -114,6 +114,7 @@ test('end-to-end: real init -> real hook subprocess -> real recall, and real fai
114
114
  ...process.env,
115
115
  HOME: tmpHome,
116
116
  PATH: '/usr/bin:/bin',
117
+ TROXY_COMPRESS: '1',
117
118
  };
118
119
 
119
120
  let stdout = '';
@@ -255,3 +255,19 @@ test('the hook records the tokens fetched back with troxy_recall, per session, a
255
255
  await buildHookResponse({ tool_name: 'mcp__troxy__troxy_recall', tool_response: [{ type: 'text', text: 'z'.repeat(800) }] }, { storeDir: dir });
256
256
  assert.equal(fs.readdirSync(path.join(dir, 'recalled')).length, 1);
257
257
  });
258
+
259
+ test('posttooluse-hook is a no-op unless TROXY_COMPRESS=1', () => {
260
+ const tmpHome = fs.mkdtempSync(path.join(os.tmpdir(), 'troxy-home-'));
261
+ try {
262
+ const run = (extra) => execFileSync(process.execPath, [troxyBin, 'posttooluse-hook'], {
263
+ input: JSON.stringify({ session_id: 's1', tool_name: 'Bash', tool_response: bashResult('x'.repeat(5000)) }),
264
+ env: { ...process.env, HOME: tmpHome, TROXY_COMPRESS: '', ...extra },
265
+ encoding: 'utf8',
266
+ });
267
+ assert.equal(run({}), '');
268
+ // Enabled: either compressed (treated arm) or left alone (holdout arm), never an error.
269
+ assert.doesNotThrow(() => run({ TROXY_COMPRESS: '1' }));
270
+ } finally {
271
+ fs.rmSync(tmpHome, { recursive: true, force: true });
272
+ }
273
+ });