troxy-cli 1.29.59 → 1.29.60

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.29.59",
3
+ "version": "1.29.60",
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": {
@@ -188,9 +188,9 @@ function sessionLine(t) {
188
188
  // by the server. undefined until something was saved.
189
189
  function savingsText(s) {
190
190
  const c = (s && s.compressed_tokens) || 0, t = (s && s.trimmed_tokens) || 0;
191
- const k = n => n >= 1000 ? `${Math.round(n / 1000)}k` : String(n);
191
+ const k = n => n >= 1e6 ? `${Math.round(n / 1e5) / 10}M`.replace('.0M', 'M') : n >= 1000 ? `${Math.round(n / 1000)}k` : String(n);
192
192
  // Always show, even if 0, so the band is transparent: 0 means no trimming/compression on this turn
193
- return `${k(c + t)} tokens saved by compression and trimming`;
193
+ return `${k(c + t)} tokens not re-sent, thanks to compression and trimming`;
194
194
  }
195
195
 
196
196
  // This session's savings from the server, or null when there is no key, no session id or
@@ -134,10 +134,12 @@ test('compactPlan: big idle sessions compact, small ones and a nearly full bar d
134
134
 
135
135
  test('savingsText: shows compression + trimming together, 0 when nothing was saved', () => {
136
136
  const { savingsText } = _internal;
137
- assert.equal(savingsText({ compressed_tokens: 5200, trimmed_tokens: 40100 }), '45k tokens saved by compression and trimming');
138
- assert.equal(savingsText({ compressed_tokens: 300, trimmed_tokens: 0 }), '300 tokens saved by compression and trimming');
139
- assert.equal(savingsText({ compressed_tokens: 0, trimmed_tokens: 0 }), '0 tokens saved by compression and trimming');
140
- assert.equal(savingsText(null), '0 tokens saved by compression and trimming');
137
+ assert.equal(savingsText({ compressed_tokens: 5200, trimmed_tokens: 40100 }), '45k tokens not re-sent, thanks to compression and trimming');
138
+ assert.equal(savingsText({ compressed_tokens: 300, trimmed_tokens: 0 }), '300 tokens not re-sent, thanks to compression and trimming');
139
+ assert.equal(savingsText({ compressed_tokens: 0, trimmed_tokens: 0 }), '0 tokens not re-sent, thanks to compression and trimming');
140
+ assert.equal(savingsText({ compressed_tokens: 123277, trimmed_tokens: 154512861 }), '154.6M tokens not re-sent, thanks to compression and trimming');
141
+ assert.equal(savingsText({ compressed_tokens: 0, trimmed_tokens: 2000000 }), '2M tokens not re-sent, thanks to compression and trimming');
142
+ assert.equal(savingsText(null), '0 tokens not re-sent, thanks to compression and trimming');
141
143
  });
142
144
 
143
145
  test('fetchSavings: sends the saved key and the session id; null without a key or on an error', async () => {