@trazum/cli 2.7.11 → 3.0.0
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/README.md +4 -2
- package/assets/trazum-statusline.sh +131 -0
- package/dist/git.d.ts +38 -0
- package/dist/git.d.ts.map +1 -1
- package/dist/git.js +54 -0
- package/dist/git.js.map +1 -1
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +170 -3
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +174 -3
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/types.d.ts +84 -0
- package/dist/i18n/types.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +670 -262
- package/dist/index.js.map +1 -1
- package/dist/proactive.d.ts +344 -0
- package/dist/proactive.d.ts.map +1 -0
- package/dist/proactive.js +1079 -0
- package/dist/proactive.js.map +1 -0
- package/dist/style.d.ts +305 -26
- package/dist/style.d.ts.map +1 -1
- package/dist/style.js +449 -47
- package/dist/style.js.map +1 -1
- package/dist/watch-notify.d.ts +82 -0
- package/dist/watch-notify.d.ts.map +1 -0
- package/dist/watch-notify.js +118 -0
- package/dist/watch-notify.js.map +1 -0
- package/dist/watch-run.d.ts +7 -0
- package/dist/watch-run.d.ts.map +1 -1
- package/dist/watch-run.js.map +1 -1
- package/dist/weekly.d.ts +32 -0
- package/dist/weekly.d.ts.map +1 -0
- package/dist/weekly.js +119 -0
- package/dist/weekly.js.map +1 -0
- package/package.json +3 -2
- package/src/git.ts +77 -0
- package/src/i18n/en.ts +198 -3
- package/src/i18n/es.ts +202 -3
- package/src/i18n/types.ts +130 -0
- package/src/index.ts +715 -302
- package/src/proactive.ts +1319 -0
- package/src/style.ts +502 -54
- package/src/watch-notify.ts +152 -0
- package/src/watch-run.ts +7 -0
- package/src/weekly.ts +133 -0
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ npx @trazum/cli bill ./usage-export.jsonl
|
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
[Supported inputs](https://github.com/Davmunrey/Trazum/blob/main/docs/usage-logs.md) ·
|
|
32
|
-
[Try sample data in your browser](https://trazum.vercel.app
|
|
32
|
+
[Try sample data in your browser](https://trazum.vercel.app/app?tab=playground)
|
|
33
33
|
|
|
34
34
|
## Choose one change, then check it
|
|
35
35
|
|
|
@@ -93,7 +93,9 @@ trazum bill
|
|
|
93
93
|
| `trazum history <dir>` | the long run: series from stored `--json` reports, the climbs and decays no pairwise comparison finds, and plans nobody is executing. Shapes named, nothing forecast |
|
|
94
94
|
| `trazum connect <provider>` | your bill read from the provider's usage API — no export by hand. The credential is borrowed from the environment and never stored; a connected report is restricted on purpose and names the findings a sum cannot support |
|
|
95
95
|
| `trazum store` | what the local store holds and what a prune would take. Re-pulls converge instead of doubling; records it cannot tell apart are kept as two and named; pruning refuses without a retention policy and says what went |
|
|
96
|
-
| `trazum
|
|
96
|
+
| `trazum weekly` | the week written down: the bill for seven days, what moved against the seven before, and the three ranked changes, each a projection that says so beside what was measured. A file, or one line on the desktop with `--notify`; every figure is checked against the bills before it is written |
|
|
97
|
+
| `trazum proactive [status\|on\|off]` | what speaks first, and whether it is on: the status line and its Stop hook, a scheduled `watch`, the MCP server. Offers each one, says which files and which lines, writes only after a yes, and removes exactly what it added. Sends nothing anywhere |
|
|
98
|
+
| `trazum watch` | the spend gates evaluated as the money moves, not three weeks later. Measured crossings only, a day half-measured is not-yet-judgeable rather than passed, a restart neither re-alerts nor calls a blown budget clean. `--sessions` watches what `bill` reads, no store; `--notify` tells the person at the machine |
|
|
97
99
|
| `trazum serve` | a loopback endpoint answering what a call will cost and whether there is budget, in milliseconds. The measured half and the estimated half stay apart, and the verdict says which it rests on |
|
|
98
100
|
| `trazum doctor [dir]` | the whole workspace: what nothing is watching, and what fixing would be worth |
|
|
99
101
|
| `trazum rank <dir>` | of these forty prompts, which is worth an afternoon |
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
#
|
|
3
|
+
# Trazum in the Claude Code status line, at zero token cost.
|
|
4
|
+
#
|
|
5
|
+
# Two modes, one file:
|
|
6
|
+
#
|
|
7
|
+
# trazum-statusline.sh the status line itself: prints a cached
|
|
8
|
+
# line, never computes
|
|
9
|
+
# trazum-statusline.sh --refresh the Stop hook: computes the line and
|
|
10
|
+
# writes the cache, once per turn
|
|
11
|
+
#
|
|
12
|
+
# **Why this costs nothing.** Claude Code renders the status line's stdout in
|
|
13
|
+
# the terminal, and writes a Stop hook's stdout to the debug log. Neither
|
|
14
|
+
# reaches the model, so neither is tokens. `SessionStart` is the hook whose
|
|
15
|
+
# stdout *is* handed to the model as context, which is exactly why the refresh
|
|
16
|
+
# is not wired to it: that version of this script would charge you for the
|
|
17
|
+
# privilege of being told what you are spending.
|
|
18
|
+
#
|
|
19
|
+
# **Why the work is not in the status line.** Claude Code runs the status line
|
|
20
|
+
# on every assistant message, debounced 300ms, and cancels the script if
|
|
21
|
+
# another update arrives while it is running. Reading a whole transcript there
|
|
22
|
+
# is fine on a normal session and not fine on a long one: measured on 208 real
|
|
23
|
+
# transcripts, the median took 0.50s and the largest, at 212 MB, took 6.5s,
|
|
24
|
+
# which is long enough to be cancelled every time and show nothing. So the
|
|
25
|
+
# status line only reads a file, and the Stop hook pays the cost once per turn,
|
|
26
|
+
# after the turn, where taking a second does not matter.
|
|
27
|
+
#
|
|
28
|
+
# **And the hook does not re-read the transcript either.** `--state` records
|
|
29
|
+
# where the last conversion stopped and the next one resumes there, re-deriving
|
|
30
|
+
# only the call that was still streaming. On that same 212 MB session the hook's
|
|
31
|
+
# conversion drops from 2.6s to 0.19s, and the records it appends are byte for
|
|
32
|
+
# byte what a full read would have produced.
|
|
33
|
+
#
|
|
34
|
+
# Install (both lines, in ~/.claude/settings.json):
|
|
35
|
+
#
|
|
36
|
+
# "statusLine": { "type": "command", "command": "/path/to/trazum-statusline.sh" },
|
|
37
|
+
# "hooks": { "Stop": [{ "matcher": "*", "hooks": [
|
|
38
|
+
# { "type": "command", "command": "/path/to/trazum-statusline.sh --refresh" }
|
|
39
|
+
# ]}]}
|
|
40
|
+
#
|
|
41
|
+
# The status line alone works without the hook: it just never has a cache to
|
|
42
|
+
# read, and falls back to the number Claude Code computes itself, saying so.
|
|
43
|
+
set -uo pipefail
|
|
44
|
+
|
|
45
|
+
trazum_bin="${TRAZUM_BIN:-trazum}"
|
|
46
|
+
cache_dir="${TRAZUM_STATUSLINE_CACHE:-${TMPDIR:-/tmp}/trazum-statusline}"
|
|
47
|
+
|
|
48
|
+
json="$(cat)"
|
|
49
|
+
field() { printf '%s' "$json" | node -e '
|
|
50
|
+
let raw = "";
|
|
51
|
+
process.stdin.on("data", (c) => { raw += c; });
|
|
52
|
+
process.stdin.on("end", () => {
|
|
53
|
+
let value;
|
|
54
|
+
try { value = process.argv[1].split(".").reduce((o, k) => o?.[k], JSON.parse(raw)); }
|
|
55
|
+
catch { value = undefined; }
|
|
56
|
+
process.stdout.write(String(value ?? process.argv[2] ?? ""));
|
|
57
|
+
});' "$1" "${2-}"; }
|
|
58
|
+
|
|
59
|
+
session="$(field session_id)"
|
|
60
|
+
model="$(field model.display_name '?')"
|
|
61
|
+
cache="$cache_dir/${session:-unknown}.txt"
|
|
62
|
+
|
|
63
|
+
if [ "${1-}" != "--refresh" ]; then
|
|
64
|
+
# The status line. Reads, never computes. A missing cache is the normal
|
|
65
|
+
# state of the first turn and of an install without the hook, so it is not
|
|
66
|
+
# an error: Claude Code's own figure stands in, labelled, because a number
|
|
67
|
+
# from somewhere else presented as Trazum's is the one thing this product
|
|
68
|
+
# does not do.
|
|
69
|
+
if [ -s "$cache" ]; then
|
|
70
|
+
printf '%s %s' "$model" "$(cat "$cache")"
|
|
71
|
+
else
|
|
72
|
+
printf '%s $%s (Claude Code)' "$model" "$(field cost.total_cost_usd 0)"
|
|
73
|
+
fi
|
|
74
|
+
exit 0
|
|
75
|
+
fi
|
|
76
|
+
|
|
77
|
+
# The Stop hook. Everything below runs once per turn, after the turn.
|
|
78
|
+
path="$(field transcript_path)"
|
|
79
|
+
[ -s "$path" ] || exit 0
|
|
80
|
+
|
|
81
|
+
mkdir -p "$cache_dir" || exit 0
|
|
82
|
+
|
|
83
|
+
# The converted log and its resume point live beside the cached line, so a
|
|
84
|
+
# session that ends takes its working files with it when $TMPDIR is cleared.
|
|
85
|
+
log="$cache.log"
|
|
86
|
+
"$trazum_bin" from-claude-code "$path" -o "$log" --state "$cache.state" >/dev/null 2>&1 || exit 0
|
|
87
|
+
[ -s "$log" ] || exit 0
|
|
88
|
+
|
|
89
|
+
# The session's subagents. Claude Code writes each one's transcript into a
|
|
90
|
+
# folder named after the session, `<session>/subagents/...`, and none of it is
|
|
91
|
+
# in `transcript_path`: without this the line left out every subagent the
|
|
92
|
+
# session ran, a quarter of the cost on this repository's own sessions. The
|
|
93
|
+
# folder is read whole each turn, because `--state` resumes one file and a
|
|
94
|
+
# folder of them grows by new files; on a 60 MB folder of 73 subagents that is
|
|
95
|
+
# 0.9s, after the turn, where the hook already lives.
|
|
96
|
+
whole="$log"
|
|
97
|
+
folder="${path%.jsonl}"
|
|
98
|
+
if [ -d "$folder/subagents" ]; then
|
|
99
|
+
sublog="$cache.subagents.log"
|
|
100
|
+
if "$trazum_bin" from-claude-code "$folder/subagents" -o "$sublog" >/dev/null 2>&1 && [ -s "$sublog" ]; then
|
|
101
|
+
whole="$cache.whole.log"
|
|
102
|
+
cat "$log" "$sublog" > "$whole" || whole="$log"
|
|
103
|
+
fi
|
|
104
|
+
fi
|
|
105
|
+
|
|
106
|
+
# The program below is JavaScript, handed to node in single quotes on purpose:
|
|
107
|
+
# its ${...} are template literals, and the shell must leave them alone.
|
|
108
|
+
# shellcheck disable=SC2016
|
|
109
|
+
line="$(
|
|
110
|
+
"$trazum_bin" profile "$whole" --json 2>/dev/null | node -e '
|
|
111
|
+
let raw = "";
|
|
112
|
+
process.stdin.on("data", (c) => { raw += c; });
|
|
113
|
+
process.stdin.on("end", () => {
|
|
114
|
+
let total;
|
|
115
|
+
try { total = JSON.parse(raw).total; } catch { total = null; }
|
|
116
|
+
if (!total) process.exit(1);
|
|
117
|
+
const read = total.cacheReadTokens ?? 0;
|
|
118
|
+
const billed = read + (total.inputTokens ?? 0) + (total.cacheWriteTokens ?? 0);
|
|
119
|
+
const hit = billed ? Math.round((read / billed) * 100) : 0;
|
|
120
|
+
const saved = (total.cachedTokensAtInputRateUsd ?? 0) - (total.cacheReadUsd ?? 0);
|
|
121
|
+
const parts = [`$${total.totalUsd.toFixed(4)}`, `${total.calls} calls`, `cache ${hit}%`];
|
|
122
|
+
if (saved > 0) parts.push(`saved $${saved.toFixed(2)}`);
|
|
123
|
+
process.stdout.write(parts.join(" · "));
|
|
124
|
+
});'
|
|
125
|
+
)" || exit 0
|
|
126
|
+
|
|
127
|
+
# Written whole or not at all: the status line reads this file at an arbitrary
|
|
128
|
+
# moment, and half a line is worse than a stale one.
|
|
129
|
+
[ -n "$line" ] || exit 0
|
|
130
|
+
printf '%s' "$line" > "$cache.tmp" && mv "$cache.tmp" "$cache"
|
|
131
|
+
exit 0
|
package/dist/git.d.ts
CHANGED
|
@@ -55,6 +55,44 @@ export declare function pathInRepository(root: string, target: string): string |
|
|
|
55
55
|
* produced; nothing typed by a user reaches this argv.
|
|
56
56
|
*/
|
|
57
57
|
export declare function runSelf(scriptPath: string, args: readonly string[]): string;
|
|
58
|
+
/** What `crontab` said: its exit status and both streams, or the error that kept it from starting. */
|
|
59
|
+
export interface CrontabResult {
|
|
60
|
+
status: number | null;
|
|
61
|
+
stdout: string;
|
|
62
|
+
stderr: string;
|
|
63
|
+
/** `ENOENT` when there is no `crontab` program on this machine. */
|
|
64
|
+
errorCode: string | null;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Runs the system `crontab` with one of its two fixed argument lists.
|
|
68
|
+
*
|
|
69
|
+
* `trazum proactive` reads the user's crontab with `crontab -l` and writes it
|
|
70
|
+
* back with `crontab -`, the text on stdin. It is here, beside the other two
|
|
71
|
+
* spawns, so the invariant the security suite asserts, that child_process
|
|
72
|
+
* appears in exactly one file, stays whole. The same rules: no shell, and
|
|
73
|
+
* **no argument of anybody's**: the argv is one of two literals, and the text
|
|
74
|
+
* that changes travels on stdin, where a `;` is a character and not a command.
|
|
75
|
+
*/
|
|
76
|
+
export declare function runCrontab(args: readonly ['-l'] | readonly ['-'], input?: string): CrontabResult;
|
|
77
|
+
/** What a desktop notifier said: its exit status and stderr, or the error that kept it from starting. */
|
|
78
|
+
export interface NotifierRun {
|
|
79
|
+
status: number | null;
|
|
80
|
+
stderr: string;
|
|
81
|
+
/** `ENOENT` when this machine has no such program. */
|
|
82
|
+
errorCode: string | null;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Runs the platform's notifier, for `trazum watch --notify`.
|
|
86
|
+
*
|
|
87
|
+
* It is here, beside the other spawns, so the invariant the security suite
|
|
88
|
+
* asserts, that child_process appears in exactly one file, stays whole. The
|
|
89
|
+
* same rules: no shell, a timeout so a notifier that hangs cannot hang the
|
|
90
|
+
* watcher, and output bounded. The command is one of three literals, and the
|
|
91
|
+
* argument list is built by `watch-notify.ts`, which hands the text over as
|
|
92
|
+
* data (arguments of a fixed script, an environment variable, or after `--`)
|
|
93
|
+
* and never splices it into anything a program would run.
|
|
94
|
+
*/
|
|
95
|
+
export declare function runNotifier(command: 'osascript' | 'notify-send' | 'powershell.exe', args: readonly string[], env: NodeJS.ProcessEnv): NotifierRun;
|
|
58
96
|
/**
|
|
59
97
|
* Commits that touched `repoPath`, newest first.
|
|
60
98
|
*
|
package/dist/git.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAyC/C,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAA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,EAAE,MAAM,GAAG,aAAa,CAehG;AAED,yGAAyG;AACzG,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,WAAW,GAAG,aAAa,GAAG,gBAAgB,EACvD,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,GAAG,EAAE,MAAM,CAAC,UAAU,GACrB,WAAW,CAgBb;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,GACvD,QAAQ,EAAE,CAyCZ;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKnF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAwB/F"}
|
package/dist/git.js
CHANGED
|
@@ -160,6 +160,60 @@ export function runSelf(scriptPath, args) {
|
|
|
160
160
|
}
|
|
161
161
|
return result.stdout;
|
|
162
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Runs the system `crontab` with one of its two fixed argument lists.
|
|
165
|
+
*
|
|
166
|
+
* `trazum proactive` reads the user's crontab with `crontab -l` and writes it
|
|
167
|
+
* back with `crontab -`, the text on stdin. It is here, beside the other two
|
|
168
|
+
* spawns, so the invariant the security suite asserts, that child_process
|
|
169
|
+
* appears in exactly one file, stays whole. The same rules: no shell, and
|
|
170
|
+
* **no argument of anybody's**: the argv is one of two literals, and the text
|
|
171
|
+
* that changes travels on stdin, where a `;` is a character and not a command.
|
|
172
|
+
*/
|
|
173
|
+
export function runCrontab(args, input) {
|
|
174
|
+
const result = spawnSync('crontab', [...args], {
|
|
175
|
+
shell: false,
|
|
176
|
+
encoding: 'utf8',
|
|
177
|
+
timeout: TIMEOUT_MS,
|
|
178
|
+
maxBuffer: MAX_BUFFER,
|
|
179
|
+
...(input === undefined ? {} : { input }),
|
|
180
|
+
});
|
|
181
|
+
const code = result.error !== undefined && 'code' in result.error ? String(result.error.code) : null;
|
|
182
|
+
return {
|
|
183
|
+
status: result.status,
|
|
184
|
+
stdout: typeof result.stdout === 'string' ? result.stdout : '',
|
|
185
|
+
stderr: typeof result.stderr === 'string' ? result.stderr : '',
|
|
186
|
+
errorCode: result.error === undefined ? null : (code ?? 'ERROR'),
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Runs the platform's notifier, for `trazum watch --notify`.
|
|
191
|
+
*
|
|
192
|
+
* It is here, beside the other spawns, so the invariant the security suite
|
|
193
|
+
* asserts, that child_process appears in exactly one file, stays whole. The
|
|
194
|
+
* same rules: no shell, a timeout so a notifier that hangs cannot hang the
|
|
195
|
+
* watcher, and output bounded. The command is one of three literals, and the
|
|
196
|
+
* argument list is built by `watch-notify.ts`, which hands the text over as
|
|
197
|
+
* data (arguments of a fixed script, an environment variable, or after `--`)
|
|
198
|
+
* and never splices it into anything a program would run.
|
|
199
|
+
*/
|
|
200
|
+
export function runNotifier(command, args, env) {
|
|
201
|
+
const result = spawnSync(command, [...args], {
|
|
202
|
+
shell: false,
|
|
203
|
+
encoding: 'utf8',
|
|
204
|
+
timeout: TIMEOUT_MS,
|
|
205
|
+
maxBuffer: MAX_BUFFER,
|
|
206
|
+
windowsHide: true,
|
|
207
|
+
stdio: ['ignore', 'ignore', 'pipe'],
|
|
208
|
+
env,
|
|
209
|
+
});
|
|
210
|
+
const code = result.error !== undefined && 'code' in result.error ? String(result.error.code) : null;
|
|
211
|
+
return {
|
|
212
|
+
status: result.status,
|
|
213
|
+
stderr: typeof result.stderr === 'string' ? result.stderr : '',
|
|
214
|
+
errorCode: result.error === undefined ? null : (code ?? 'ERROR'),
|
|
215
|
+
};
|
|
216
|
+
}
|
|
163
217
|
/**
|
|
164
218
|
* Commits that touched `repoPath`, newest first.
|
|
165
219
|
*
|
package/dist/git.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.js","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,kFAAkF;AAClF,MAAM,UAAU,GAAG,MAAM,CAAC;AAE1B,0DAA0D;AAC1D,MAAM,UAAU,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAEpC,MAAM,GAAG,GAAG,gBAAgB,CAAC;AAW7B;;;;;;;GAOG;AACH,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;AAiChD,SAAS,MAAM,CACb,IAAuB,EACvB,GAAW,EACX,KAAK,GAAc,SAAS;IAE5B;;;;;;;;;;;;OAYG;IACH,MAAM,QAAQ,GAAG,CAAC,CAAC;IACnB,IAAI,IAAI,GAAe,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC;IAE7E,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,QAAQ,EAAE,OAAO,EAAE,EAAE,CAAC;QACpD,MAAM,MAAM,GAAG,KAAK,C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pB,IAAI;QACJ,QAAQ;KACT,EACD,GAAG,CACJ,CAAC;IAEF,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;IACxC,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAE/B,KAAK,MAAM,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACrC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC;QAC1F,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,KAAK,CAAC;QAC1B,IAAI,GAAG,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC;YAAE,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACrF,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/i18n/en.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/i18n/en.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAqB9C;;;;;;GAMG;AACH,eAAO,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/i18n/en.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAqB9C;;;;;;GAMG;AACH,eAAO,MAAM,EAAE,EAAE,WA+xHhB,CAAC"}
|
package/dist/i18n/en.js
CHANGED
|
@@ -43,7 +43,7 @@ ${bold('USAGE')}
|
|
|
43
43
|
trazum history <dir-of-stored-reports> [options]
|
|
44
44
|
trazum connect <provider> [options]
|
|
45
45
|
trazum store [--prune] [options]
|
|
46
|
-
trazum watch [--once | --interval 15m] [options]
|
|
46
|
+
trazum watch [--once | --interval 15m] [--sessions] [--notify] [options]
|
|
47
47
|
trazum serve [--port <n> | --socket <path>]
|
|
48
48
|
trazum diff <before> <after> [options]
|
|
49
49
|
trazum diff --all <dir> <dir> [options]
|
|
@@ -59,6 +59,7 @@ ${bold('USAGE')}
|
|
|
59
59
|
trazum receipt <usage.jsonl> [--stamp] [--since <when>] [--until <when>] [-o <file>]
|
|
60
60
|
trazum bill [<file|dir>...] [--label <name>] [--no-label-from-project] [--receipt|--table] [--stamp] [-o <file>]
|
|
61
61
|
[--since <when>] [--until <when>] [--by day|week|month] [--pdf-out|--html-out|--markdown-out|--csv-out <file>]
|
|
62
|
+
trazum weekly [<file|dir>...] [--until <when>] [--label <name>] [--notify] [-o <file>]
|
|
62
63
|
trazum from-claude-code <file|dir> [--label <name>] [-o <file>]
|
|
63
64
|
trazum from-codex <file|dir> [--label <name>] [-o <file>]
|
|
64
65
|
trazum from-gemini-cli <file|dir> [--label <name>] [-o <file>]
|
|
@@ -73,6 +74,7 @@ ${bold('USAGE')}
|
|
|
73
74
|
trazum switch <usage.jsonl> --to <model> [--migration-usd <n>] [--cases <n>]
|
|
74
75
|
trazum ownrate --gpu-usd-hour <n> --tokens-per-second <n> [--utilization <0-1>]
|
|
75
76
|
trazum pulse [--max-stale-hours <n>]
|
|
77
|
+
trazum proactive [status|on|off] [--only <item,...>] [--dry-run | --yes] [--json]
|
|
76
78
|
trazum bench [--workload <id>] [--record <file>] [--against <file> --max-ratio <n>] [--json]
|
|
77
79
|
trazum write [--answers <file>] [--json] [-o <file>]
|
|
78
80
|
trazum models
|
|
@@ -253,6 +255,30 @@ ${bold('OPTIONS FOR bill')}
|
|
|
253
255
|
cost report is pointed at reconcile. Each file's line says how many rows
|
|
254
256
|
were left out, and the dedicated from-<shape> command says why.
|
|
255
257
|
|
|
258
|
+
${bold('OPTIONS FOR weekly')}
|
|
259
|
+
--until <when> Where the week ends: a UTC day (2026-11-19, the
|
|
260
|
+
whole of it), a timestamp, a relative window or
|
|
261
|
+
"now", the default. The week is the seven days
|
|
262
|
+
before it, and the week before that is what it
|
|
263
|
+
is compared with.
|
|
264
|
+
--label <name> The project this usage belongs to, for the
|
|
265
|
+
shapes that take one.
|
|
266
|
+
--notify Also show a desktop notification with one line of
|
|
267
|
+
it, the bill and its movement, through what the
|
|
268
|
+
platform has (as watch --notify does). Said, not
|
|
269
|
+
fatal, where there is none.
|
|
270
|
+
-o, --out <file> Write the summary there instead of stdout.
|
|
271
|
+
|
|
272
|
+
The week in Markdown: the bill, what moved against the week before, and the
|
|
273
|
+
three changes worth making first. Reads what bill reads, and with no path
|
|
274
|
+
the coding agents' own session folders. Both weeks are measured, from the
|
|
275
|
+
same logs and the same price list. The changes are projections and say so,
|
|
276
|
+
each beside what its workload cost this week; trazum verify is what
|
|
277
|
+
measures them afterwards. Every dollar amount and percentage is checked
|
|
278
|
+
against the two weeks' bills before anything is written, and a summary with
|
|
279
|
+
one that is not there is refused. It sends nothing anywhere: the file is
|
|
280
|
+
the output, and the GitHub Action is what posts it.
|
|
281
|
+
|
|
256
282
|
${bold('OPTIONS FOR from-openrouter')}
|
|
257
283
|
--label <name> The project this usage belongs to.
|
|
258
284
|
--label-by-workspace <file> One label per workspace id, as a JSON array of
|
|
@@ -404,6 +430,33 @@ ${bold('OPTIONS FOR pulse')}
|
|
|
404
430
|
late against, and never on how far the measurements reach, which is a
|
|
405
431
|
provider reporting on its own schedule rather than a job that failed.
|
|
406
432
|
|
|
433
|
+
${bold('OPTIONS FOR proactive')}
|
|
434
|
+
status What speaks first, on or off: the status line and
|
|
435
|
+
its Stop hook, a scheduled watch, the MCP server.
|
|
436
|
+
One line each. It is the default and writes nothing.
|
|
437
|
+
on Offer each one that is off, say which files it
|
|
438
|
+
would touch and every line it would add, and write
|
|
439
|
+
only after a yes for that item.
|
|
440
|
+
off Remove exactly the lines it added. Nothing else in
|
|
441
|
+
those files changes.
|
|
442
|
+
--only <item,...> Limit it to statusline, watch or mcp.
|
|
443
|
+
--dry-run Print every file and every line, write nothing.
|
|
444
|
+
This is what it does until somebody says yes: not
|
|
445
|
+
a terminal and no --yes means a dry run.
|
|
446
|
+
--yes Say yes to every item, without asking.
|
|
447
|
+
--json The report as data. See docs/json-output.md.
|
|
448
|
+
|
|
449
|
+
The three things Trazum can say without being asked, each off until somebody
|
|
450
|
+
wires it by hand. It edits ~/.claude/settings.json, your crontab, and the MCP
|
|
451
|
+
config of the project it runs in (.mcp.json, .cursor/mcp.json), and nothing
|
|
452
|
+
else. A file it cannot parse, or a symbolic link, is left alone and named. A
|
|
453
|
+
status line that is already configured is never replaced. It sends nothing
|
|
454
|
+
anywhere: all three read files already on this machine.
|
|
455
|
+
|
|
456
|
+
It never invents a budget and never fills the store. A watch with no store or
|
|
457
|
+
no spend limit is "not ready", with the command or the key that would make it
|
|
458
|
+
ready.
|
|
459
|
+
|
|
407
460
|
${bold('OPTIONS FOR bench')}
|
|
408
461
|
--workload <id> Run one standard workload instead of all of them.
|
|
409
462
|
An unknown id is refused with the known ones named.
|
|
@@ -890,6 +943,18 @@ ${bold('OPTIONS FOR watch')}
|
|
|
890
943
|
because URLs end up in logs and shell history.
|
|
891
944
|
--payload <file> Evaluate a usage payload you already have,
|
|
892
945
|
instead of the store.
|
|
946
|
+
--sessions Watch the sessions Claude Code, Codex and Gemini
|
|
947
|
+
CLI keep on this machine, the ones \`bill\` reads
|
|
948
|
+
with no path, instead of the store. Needs no
|
|
949
|
+
setup. Say \`--sessions\` again on every run: it
|
|
950
|
+
keeps its own record of what was reported.
|
|
951
|
+
--notify Also show a desktop notification for what newly
|
|
952
|
+
crossed: osascript on macOS, notify-send on
|
|
953
|
+
Linux, a PowerShell toast on Windows, nothing
|
|
954
|
+
installed. It carries the sentence printed here
|
|
955
|
+
and nothing more. Off unless asked for; where the
|
|
956
|
+
machine has none it says so and the other
|
|
957
|
+
transports carry on.
|
|
893
958
|
--json The cycle as data: crossings, abstentions, gap.
|
|
894
959
|
|
|
895
960
|
Evaluates the spend gates from your config, maxUsd, maxDayUsd,
|
|
@@ -1302,7 +1367,7 @@ ${bold('EXAMPLES')}
|
|
|
1302
1367
|
: `Not scaled to a month: ${days} days is under the week a scaling needs, and being shorter than one weekly cycle multiplies whichever part of the cycle it caught. These figures cover exactly the period measured.`,
|
|
1303
1368
|
perMonthSaving: (saving, pct) => `saving ${saving}/month (${pct}%)`,
|
|
1304
1369
|
beyondShortening: () => 'Beyond shortening the prompt',
|
|
1305
|
-
biggestLever: () => 'Start here
|
|
1370
|
+
biggestLever: () => 'Start here',
|
|
1306
1371
|
biggestLeverDetail: (title, amount, times) =>
|
|
1307
1372
|
// The title keeps its case: lowercasing it turned "Claude Opus 5" into
|
|
1308
1373
|
// "claude opus 5", which is a product name mangled to fit a sentence.
|
|
@@ -1994,6 +2059,103 @@ ${bold('EXAMPLES')}
|
|
|
1994
2059
|
source: () => 'Measured from this log alone, priced record by record. The store\'s provider-billed monthly standing is a different measurement, "trazum store" prints it, and the two are never merged into one figure.',
|
|
1995
2060
|
noLog: () => 'position needs a usage log: trazum position usage.jsonl',
|
|
1996
2061
|
},
|
|
2062
|
+
weekly: {
|
|
2063
|
+
heading: (firstDay, lastDay) => `Trazum, the week of ${firstDay} to ${lastDay}`,
|
|
2064
|
+
billHeading: () => 'The bill',
|
|
2065
|
+
billTotal: (usd, calls) => `**${usd}** over ${calls} ${calls === '1' ? 'call' : 'calls'}, measured from the logs and priced with the catalogue's own rates.`,
|
|
2066
|
+
noCalls: (firstDay, lastDay) => `No call in the logs falls between ${firstDay} and ${lastDay}, so there is no bill to state for it. That is not a bill of nothing: either nothing ran, or what ran was not written to a log this was given.`,
|
|
2067
|
+
colModel: () => 'Model',
|
|
2068
|
+
colCalls: () => 'Calls',
|
|
2069
|
+
colUsd: () => 'USD',
|
|
2070
|
+
moreModels: (count) => `${count} more models, smaller than these.`,
|
|
2071
|
+
unpriced: (models, calls) => `Calls on models the catalogue cannot price: ${calls} (${models}). They are not in the bill above, which is therefore a floor.`,
|
|
2072
|
+
undated: (count) => `Calls with no timestamp: ${count}. They cannot be placed in any week and are left out, not guessed into this one.`,
|
|
2073
|
+
movedHeading: (firstDay, lastDay) => `Against the week before (${firstDay} to ${lastDay})`,
|
|
2074
|
+
noWeekBefore: () => 'No call in the logs falls in the week before, so there is nothing to compare with. A percentage of nothing is not printed.',
|
|
2075
|
+
moved: (delta, pct, now, before, calls) => `The bill moved ${delta}${pct === null ? '' : ` (${pct})`} against the week before: ${now} now, ${before} then, over ${calls} ${calls === '1' ? 'call' : 'calls'}. Both are measured.`,
|
|
2076
|
+
unchanged: (now, before) => `The week cost the same as the week before: ${now} now, ${before} then. Both are measured.`,
|
|
2077
|
+
moversHeading: () => 'What moved most, by model:',
|
|
2078
|
+
mover: (model, before, now, delta) => `${model}: ${before} then, ${now} now (${delta})`,
|
|
2079
|
+
changesHeading: () => 'Three changes to make first',
|
|
2080
|
+
noChanges: () => "Nothing in this week's calls gives a change to propose: no cheaper model that fits, no batchable call, no settled cache loss and no truncation retry.",
|
|
2081
|
+
projected: (usd) => `${usd} projected saving on this week's calls. Projected, not measured: it has not happened.`,
|
|
2082
|
+
stake: (usd) => `${usd} already spent on this problem this week. Measured, not projected.`,
|
|
2083
|
+
measuredBefore: (usd, calls) => `Measured before the change: this workload on this model cost ${usd} over ${calls} ${calls === '1' ? 'call' : 'calls'} this week.`,
|
|
2084
|
+
moreChanges: (count) => `${count} more changes are in the plan and are smaller than these.`,
|
|
2085
|
+
verifyHow: () => 'How each will be checked: `trazum plan <log> --out plan.json` before changing anything, then `trazum verify plan.json --against <the newer log>` after. It says for each action whether the change arrived, did not arrive, or cannot be told, and what the bill did. Until then a projected saving is a projection.',
|
|
2086
|
+
footer: () => 'Written by `trazum weekly` from logs on the machine that ran it. Nothing was sent anywhere to produce it, and no model was called.',
|
|
2087
|
+
strayFigures: (figures) => `The summary was not written: it holds ${figures}, which is in neither week's bill. A figure nobody can find in the bill is not printed.`,
|
|
2088
|
+
wrote: (path) => `Weekly summary written to ${path}.`,
|
|
2089
|
+
notifyUnavailable: (command) => `--notify asked for a desktop notification, and this machine has no ${command}, so none was sent. The summary is written all the same.`,
|
|
2090
|
+
notifyFailed: (command, why) => `--notify: ${command} refused (${why}), so no notification was shown. The summary is written all the same.`,
|
|
2091
|
+
headline: (usd, calls, delta, pct) => `Trazum, this week: ${usd} over ${calls} ${calls === '1' ? 'call' : 'calls'}${delta === null ? '' : `, ${delta}${pct === null ? '' : ` (${pct})`} against the week before`}.`,
|
|
2092
|
+
},
|
|
2093
|
+
proactive: {
|
|
2094
|
+
heading: () => 'Trazum, speaking first',
|
|
2095
|
+
item: { statusline: 'status line', watch: 'watch', mcp: 'MCP server' },
|
|
2096
|
+
verdict: { on: 'on', off: 'off', 'not-ready': 'not ready', 'not-available': 'not available', 'could-not-tell': 'could not tell' },
|
|
2097
|
+
reason: {
|
|
2098
|
+
'statusline.on': (p) => `The status line and its Stop hook are in ${p.file}.`,
|
|
2099
|
+
'statusline.off': (p) => `Not in ${p.file}. Turning it on adds a status line, and a Stop hook that refreshes it after each turn.`,
|
|
2100
|
+
'statusline.partial': (p) => `${p.file} has part of it: the ${p.missing === 'hook' ? 'Stop hook' : 'status line'} is missing. Turning it on adds that part.`,
|
|
2101
|
+
'statusline.stale': (p) => `The entries in ${p.file} point at a script or a CLI that is no longer there. Turning it on repairs them.`,
|
|
2102
|
+
'statusline.windows': () => 'The status line is a bash script, and there is no Windows form of it yet.',
|
|
2103
|
+
'statusline.noClaude': (p) => `${p.dir} does not exist: Claude Code has not run on this machine, so there is no settings file to add to.`,
|
|
2104
|
+
'statusline.foreign': (p) => `${p.file} already has a status line (${p.command}). It is left alone. To switch by hand, follow plugin/README.md.`,
|
|
2105
|
+
'watch.on': (p) => `Scheduled in your crontab for ${p.project} (${p.schedule}), reading the store and the budget there.`,
|
|
2106
|
+
'watch.off': (p) => `Not scheduled for ${p.project}. Turning it on adds one crontab line that runs "trazum watch --once" there every hour.`,
|
|
2107
|
+
'watch.stale': (p) => `The crontab line for ${p.project} points at a CLI that is no longer there. Turning it on repairs it.`,
|
|
2108
|
+
'watch.windows': () => 'Scheduling here is cron, and Windows has none. docs/running.md has the Task Scheduler line to run by hand.',
|
|
2109
|
+
'watch.noCrontab': () => 'There is no crontab program on this machine, so nothing can be scheduled here.',
|
|
2110
|
+
'watch.crontabError': (p) => `"crontab -l" failed: ${p.why}`,
|
|
2111
|
+
'watch.configError': (p) => `trazum.config.json could not be read: ${p.why}`,
|
|
2112
|
+
'watch.noStore': () => 'The store has nothing in it. Fill it first with "trazum connect <provider> --store".',
|
|
2113
|
+
'watch.noBudget': (p) => `A budget is a policy, so none is written for you.${p.measured === '' ? '' : ` The store holds ${p.measured} measured.`} Set spend.maxUsd, spend.maxDayUsd or spend.maxCacheLossUsd in trazum.config.json to a limit you choose.`,
|
|
2114
|
+
'watch.noStoreNoBudget': () => 'Needs a store with something in it ("trazum connect <provider> --store") and a limit you choose (spend.maxUsd, spend.maxDayUsd or spend.maxCacheLossUsd in trazum.config.json).',
|
|
2115
|
+
'watch.scheduledNotReady': (p) => `Scheduled for ${p.project}, but every run refuses until the store has something in it and trazum.config.json has a spend limit. It is not watching yet.`,
|
|
2116
|
+
'watch.otherProjects': (p) => `${p.count} more managed crontab line(s) for other projects stay as they are. Run this in each of those projects to remove them.`,
|
|
2117
|
+
'mcp.on': (p) => `The trazum server is in ${p.files}.`,
|
|
2118
|
+
'mcp.off': (p) => `Turning it on adds the trazum server to ${p.files}.`,
|
|
2119
|
+
'mcp.noClient': (p) => `No .mcp.json and no .cursor folder in ${p.dir}, so there is no client config here to add to.`,
|
|
2120
|
+
'mcp.noClientClaude': (p) => `No .mcp.json in ${p.dir}. Claude Code takes the server through its plugin; run these yourself: claude plugin marketplace add Davmunrey/Trazum, then claude plugin install trazum@trazum.`,
|
|
2121
|
+
'mcp.other': (p) => `${p.file} already has a trazum entry that is not the one this writes. Left alone.`,
|
|
2122
|
+
'mcp.changed': (p) => `${p.file} has a trazum entry this command added and somebody has changed since. Left alone.`,
|
|
2123
|
+
'mcp.notAdded': (p) => `${p.file} already has exactly this entry, put there by hand. It stays when this is turned off.`,
|
|
2124
|
+
'cli.unstable': (p) => `The CLI at ${p.path} will not be there tomorrow: a one-off npx run, or the file is gone. Install it where it stays (npm install -g @trazum/cli) and run this again.`,
|
|
2125
|
+
'cli.unsafe': (p) => `The path ${p.path} has a quote, a percent sign or a newline in it, and cannot be written safely into a shell line or a crontab.`,
|
|
2126
|
+
'cli.notExecutable': (p) => `The CLI at ${p.path} is not executable, and the Stop hook starts it by its path: the status line would never have a figure. Make it executable (chmod +x) or install the CLI (npm install -g @trazum/cli), and run this again.`,
|
|
2127
|
+
'file.unparseable': (p) => `${p.file} could not be parsed as JSON (${p.why}). Left alone.`,
|
|
2128
|
+
'file.symlink': (p) => `${p.file} is a symbolic link. Left alone: edit the file it points to by hand.`,
|
|
2129
|
+
'file.shape': (p) => `${p.file} has a ${p.key} that is not the kind of value expected. Left alone.`,
|
|
2130
|
+
'file.notExact': (p) => `${p.file} is JSON, but writing it back would change a value, a key or an escape in it (a duplicate key, for one). Left alone, so that nothing else in it changes.`,
|
|
2131
|
+
'file.reformat': (p) => `${p.file} lays out some lines differently from what this writes (inline arrays, say). Its spacing and line breaks are normalised when it is written; every key and value stays.`,
|
|
2132
|
+
'file.unreadable': (p) => `${p.file} could not be read: ${p.why}.`,
|
|
2133
|
+
'file.outside': (p) => `${p.file} resolves outside the directory it belongs to. Left alone.`,
|
|
2134
|
+
'write.not-allowed': (p) => `Refused to write ${p.file}: it is not one of the files this command may touch (${p.allowed}).`,
|
|
2135
|
+
'write.symlink': (p) => `Refused to write ${p.file}: it is a symbolic link.`,
|
|
2136
|
+
'write.outside': (p) => `Refused to write ${p.file}: it resolves outside the directory it belongs to.`,
|
|
2137
|
+
'write.changed': (p) => `${p.file} changed while this ran. Nothing was written to it. Run it again.`,
|
|
2138
|
+
'write.unreadable': (p) => `${p.file} could not be read again just before writing, so nothing was written to it. Run it again.`,
|
|
2139
|
+
'write.partial': (p) => `A write failed part way, and what had already been written could not be put back: ${p.files}. Nothing records these as written by this command, so look at them by hand.`,
|
|
2140
|
+
'write.failed': (p) => `Could not write: ${p.why}.`,
|
|
2141
|
+
'statusline.scriptChanged': (p) => `The file at ${p.script} is not the script this command wrote: it was changed, or it is somebody's own. It is left as it is, and nothing is written over it. Move it away and run this again to install the status line.`,
|
|
2142
|
+
},
|
|
2143
|
+
unknownAction: (given) => `Unknown action "${given}". Use: trazum proactive [status|on|off].`,
|
|
2144
|
+
unknownItem: (given, allowed) => `Unknown item "${given}" in --only. The items are: ${allowed}.`,
|
|
2145
|
+
wouldTurnOn: (item) => `${item}: would write`,
|
|
2146
|
+
wouldTurnOff: (item) => `${item}: would remove`,
|
|
2147
|
+
nothingToChange: (item) => `${item}: nothing to change.`,
|
|
2148
|
+
dryRunAsked: () => 'Dry run: nothing was written.',
|
|
2149
|
+
dryRunNoTerminal: () => 'This is not a terminal and --yes was not given, so it is a dry run: nothing was written. Run it in a terminal to be asked about each item, or pass --yes to say yes to all of them.',
|
|
2150
|
+
askOn: (item, files) => `Write the ${item} (${files})? [y/N] `,
|
|
2151
|
+
askOff: (item, files) => `Remove the ${item} (${files})? [y/N] `,
|
|
2152
|
+
didTurnOn: (item) => `${item}: wrote`,
|
|
2153
|
+
didTurnOff: (item) => `${item}: removed`,
|
|
2154
|
+
declined: (item) => `${item}: not written, you said no.`,
|
|
2155
|
+
failed: (item, reason) => `${item}: not written. ${reason}`,
|
|
2156
|
+
backupNote: (suffix) => `The first time a file you own changes, a copy of it is kept beside it as <name>${suffix}. It is never replaced.`,
|
|
2157
|
+
crontab: () => 'your crontab',
|
|
2158
|
+
},
|
|
1997
2159
|
pulse: {
|
|
1998
2160
|
heading: () => 'Did the things that are supposed to run, run?',
|
|
1999
2161
|
kind: (kind) => {
|
|
@@ -2371,7 +2533,7 @@ ${bold('EXAMPLES')}
|
|
|
2371
2533
|
leversHeading: () => 'What would actually move this bill',
|
|
2372
2534
|
leverSlice: (label, model, usd, pct) => `${label} on ${model}, up to ${usd} of this bill (${pct})`,
|
|
2373
2535
|
leverRoute: (candidate, usd) => `route it to ${candidate}, ${usd}`,
|
|
2374
|
-
leverRouteVerify: (
|
|
2536
|
+
leverRouteVerify: () => `Whether that holds is an evaluation question, not an arithmetic one, and nothing here has seen a single answer. Measure it: trazum route <log> --prompt-file <prompt> --cases <cases> --yes`,
|
|
2375
2537
|
leverBatch: (usd) => `send it through the Batch API, ${usd}`,
|
|
2376
2538
|
leverCalls: (calls, spent) => `${calls}, ${spent} spent`,
|
|
2377
2539
|
leverPromptCeiling: (usd, pct) => `For comparison: shortening the prompt text can touch ${usd} at the very most, ${pct} of this bill, and only if you deleted every input token. The real figure is far below that, because most of those tokens are retrieved context, conversation history and tool results that no prompt file contains.`,
|
|
@@ -2677,6 +2839,11 @@ ${bold('EXAMPLES')}
|
|
|
2677
2839
|
allWithin: (gates) => `Within every threshold: ${gates} gates evaluated against measured spend.`,
|
|
2678
2840
|
webhookFailed: (status) => `The webhook did not deliver (${status}). The crossing is still in the exit code and in the output above: a receiver being down must not be the quietest failure in the room.`,
|
|
2679
2841
|
watching: (minutes) => `Watching every ${minutes} minutes. Ctrl-C stops it.`,
|
|
2842
|
+
readingSessions: (agent, dir) => `Watching ${agent}'s sessions in ${dir}`,
|
|
2843
|
+
sessionsAndPayload: () => '--sessions reads the sessions on this machine and --payload reads the file you name. A cycle has one source: give one of them.',
|
|
2844
|
+
noSessionUsage: () => 'The sessions found hold no usage a price can be put on yet. Watching nothing would report that everything is fine, so this is refused rather than passed.',
|
|
2845
|
+
notifyUnavailable: (command) => `--notify asked for a desktop notification, and this machine has no ${command}, so none was sent. The exit code, the output above and --webhook still carry the crossing.`,
|
|
2846
|
+
notifyFailed: (command, why) => `${command} would not show the notification (${why}), usually because nobody is logged in at a desktop. The crossing is still in the exit code and in the output above.`,
|
|
2680
2847
|
},
|
|
2681
2848
|
store: {
|
|
2682
2849
|
appended: (count, dir) => `Kept ${count} measurements in ${dir}.`,
|