troxy-cli 1.29.36 → 1.29.37

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.36",
3
+ "version": "1.29.37",
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": {
@@ -131,6 +131,12 @@ function calculateSavings(fromModel, toModel) {
131
131
  return Math.round(((fromCost - toCost) / fromCost) * 100);
132
132
  }
133
133
 
134
+ // Status-line text for the running session savings, e.g. [████░░░░░░░░░░░░░░░░] Troxy: -20% saved
135
+ function savingsBar() {
136
+ const filled = Math.round((sessionSavingsPercent / 100) * 20);
137
+ return `[${'█'.repeat(filled)}${'░'.repeat(20 - filled)}] Troxy: -${sessionSavingsPercent}% saved`;
138
+ }
139
+
134
140
  // Where the local daemon looks for this session's routing note (see interceptor.js).
135
141
  // Only when installed under ~/.claude/skills, so a --plugin-dir test run never writes
136
142
  // into a real user's folder.
@@ -175,7 +181,7 @@ async function* routeStep($, e, next) {
175
181
  if (savings > 0) {
176
182
  routingCount += 1;
177
183
  sessionSavingsPercent = Math.round((sessionSavingsPercent * (routingCount - 1) + savings) / routingCount);
178
- $.ui.toast(`Troxy routed to cheaper model · -${savings}% on this turn`);
184
+ $.ui.status(savingsBar());
179
185
  }
180
186
  const sid = await $.session.id();
181
187
  const file = modRouteFile($.plugin.root, sid);
@@ -197,22 +203,9 @@ export function register(on) {
197
203
  on('command.run', { command: 'troxy' }, async ($, e) => {
198
204
  const r = troxyCommand(e.args, Boolean(await $.store.get('paused')));
199
205
  await $.store.set('paused', r.paused);
206
+ if (r.paused) $.ui.status(undefined);
200
207
  return { text: r.text };
201
208
  });
202
- // Show session savings bar on every turn
203
- on('turn.start', async ($, e, next) => {
204
- const paused = Boolean(await $.store.get('paused'));
205
-
206
- if (!paused && routingCount > 0) {
207
- const barLength = 20;
208
- const filledLength = Math.round((sessionSavingsPercent / 100) * barLength);
209
- const emptyLength = barLength - filledLength;
210
- const bar = '█'.repeat(filledLength) + '░'.repeat(emptyLength);
211
- $.ui.toast(`[${bar}] Session: -${sessionSavingsPercent}% saved`);
212
- }
213
-
214
- return next(e);
215
- });
216
209
  // Routing fails open: a scorer or hook error must never break the session,
217
210
  // it just means the requested model is used as-is.
218
211
  on('prompt.submit', scorePrompt).catch(($, e, next) => { decision = null; return next(e); });