@aid-framework/cli 0.1.63 → 0.1.65
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/dist/.tsbuildinfo +1 -1
- package/dist/commands/cost.d.ts +14 -6
- package/dist/commands/cost.d.ts.map +1 -1
- package/dist/commands/cost.js +74 -89
- package/dist/commands/cost.js.map +1 -1
- package/dist/commands/trace.d.ts +31 -0
- package/dist/commands/trace.d.ts.map +1 -0
- package/dist/commands/trace.js +240 -0
- package/dist/commands/trace.js.map +1 -0
- package/dist/diagnostics.d.ts +6 -0
- package/dist/diagnostics.d.ts.map +1 -1
- package/dist/diagnostics.js +11 -0
- package/dist/diagnostics.js.map +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +19 -1
- package/dist/main.js.map +1 -1
- package/dist/output.d.ts +12 -0
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +29 -0
- package/dist/output.js.map +1 -1
- package/dist/trace-dir.d.ts +75 -0
- package/dist/trace-dir.d.ts.map +1 -0
- package/dist/trace-dir.js +139 -0
- package/dist/trace-dir.js.map +1 -0
- package/dist/trace.d.ts +71 -0
- package/dist/trace.d.ts.map +1 -1
- package/dist/trace.js +157 -0
- package/dist/trace.js.map +1 -1
- package/package.json +6 -6
package/dist/commands/cost.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `aid cost`
|
|
2
|
+
* `aid cost`  a cost and latency report read from the local trace sink.
|
|
3
3
|
*
|
|
4
4
|
* The numbers already exist. `runtimes/{python,typescript}` write one JSONL span per line
|
|
5
5
|
* whenever `AID_TRACE_DIR` is set, and those spans carry the GenAI token attributes and
|
|
@@ -10,13 +10,19 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Exit codes follow the CLI's taxonomy rather than "did the bill look big":
|
|
12
12
|
*
|
|
13
|
-
* - `2` when there is nowhere to read from (no directory, or one that does not exist),
|
|
14
|
-
*
|
|
15
|
-
* judgement about the project has been
|
|
16
|
-
*
|
|
17
|
-
*
|
|
13
|
+
* - `2` when there is nowhere to read from (no directory, or one that does not exist), when
|
|
14
|
+
* `--since` is not a date, or when `--budget` is not a non-negative number. The
|
|
15
|
+
* invocation or the environment is wrong, so no judgement about the project has been
|
|
16
|
+
* made.
|
|
17
|
+
* - `1` when a trace file exists and could not be read, or when `--budget` was given and
|
|
18
|
+
* the measured spend exceeds it. The report still prints what was readable, because a
|
|
19
|
+
* partial report is more useful than none.
|
|
18
20
|
* - `0` otherwise, including for an empty directory: a report of zero spans is true, and
|
|
19
21
|
* the warning on stderr says why it is zero.
|
|
22
|
+
*
|
|
23
|
+
* `--budget` is a ceiling on the directory's total, not a price model: it compares the
|
|
24
|
+
* runtime's recorded `aid.cost.usd` against a number the caller chose, so the CLI still
|
|
25
|
+
* holds exactly one answer to "what does this cost".
|
|
20
26
|
*/
|
|
21
27
|
import type { CliContext } from '../context.js';
|
|
22
28
|
import type { CommandOutcome } from '../output.js';
|
|
@@ -24,6 +30,8 @@ export interface CostOptions {
|
|
|
24
30
|
/** The directory to read; defaults to `$AID_TRACE_DIR`. */
|
|
25
31
|
readonly dir: string | undefined;
|
|
26
32
|
readonly since: string | undefined;
|
|
33
|
+
/** A ceiling in USD for the directory's total measured spend; unset means report only. */
|
|
34
|
+
readonly budget: string | undefined;
|
|
27
35
|
}
|
|
28
36
|
export declare function cost(context: CliContext, options: CostOptions): CommandOutcome;
|
|
29
37
|
//# sourceMappingURL=cost.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cost.d.ts","sourceRoot":"","sources":["../../src/commands/cost.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cost.d.ts","sourceRoot":"","sources":["../../src/commands/cost.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAIhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAMnD,MAAM,WAAW,WAAW;IAC1B,2DAA2D;IAC3D,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,0FAA0F;IAC1F,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC;AAiED,wBAAgB,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,GAAG,cAAc,CA4H9E"}
|
package/dist/commands/cost.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `aid cost`
|
|
2
|
+
* `aid cost`  a cost and latency report read from the local trace sink.
|
|
3
3
|
*
|
|
4
4
|
* The numbers already exist. `runtimes/{python,typescript}` write one JSONL span per line
|
|
5
5
|
* whenever `AID_TRACE_DIR` is set, and those spans carry the GenAI token attributes and
|
|
@@ -10,35 +10,34 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Exit codes follow the CLI's taxonomy rather than "did the bill look big":
|
|
12
12
|
*
|
|
13
|
-
* - `2` when there is nowhere to read from (no directory, or one that does not exist),
|
|
14
|
-
*
|
|
15
|
-
* judgement about the project has been
|
|
16
|
-
*
|
|
17
|
-
*
|
|
13
|
+
* - `2` when there is nowhere to read from (no directory, or one that does not exist), when
|
|
14
|
+
* `--since` is not a date, or when `--budget` is not a non-negative number. The
|
|
15
|
+
* invocation or the environment is wrong, so no judgement about the project has been
|
|
16
|
+
* made.
|
|
17
|
+
* - `1` when a trace file exists and could not be read, or when `--budget` was given and
|
|
18
|
+
* the measured spend exceeds it. The report still prints what was readable, because a
|
|
19
|
+
* partial report is more useful than none.
|
|
18
20
|
* - `0` otherwise, including for an empty directory: a report of zero spans is true, and
|
|
19
21
|
* the warning on stderr says why it is zero.
|
|
22
|
+
*
|
|
23
|
+
* `--budget` is a ceiling on the directory's total, not a price model: it compares the
|
|
24
|
+
* runtime's recorded `aid.cost.usd` against a number the caller chose, so the CLI still
|
|
25
|
+
* holds exactly one answer to "what does this cost".
|
|
20
26
|
*/
|
|
21
|
-
import { readdirSync, readFileSync, statSync } from 'node:fs';
|
|
22
|
-
import { isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
23
27
|
import { CLI_DIAGNOSTIC_CODES, cliError, cliWarning } from '../diagnostics.js';
|
|
24
28
|
import { EXIT_FAILURE, EXIT_OK, EXIT_USAGE } from '../exit.js';
|
|
25
|
-
import { outcome } from '../output.js';
|
|
26
|
-
import { parseSince,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
function group(value) {
|
|
38
|
-
return String(Math.trunc(value)).replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
39
|
-
}
|
|
40
|
-
function usd(value) {
|
|
41
|
-
return `$${value.toFixed(6)}`;
|
|
29
|
+
import { group, outcome, usd } from '../output.js';
|
|
30
|
+
import { parseSince, summariseSpans } from '../trace.js';
|
|
31
|
+
import { confirmTraceDir, locateTraceDir, readTraceDir, TRACE_DIR_ENV } from '../trace-dir.js';
|
|
32
|
+
/**
|
|
33
|
+
* A budget is a plain non-negative decimal. `Number('')` is `0` and `Number('0x10')` is
|
|
34
|
+
* `16`, so the accepted shape is pinned here rather than left to the constructor.
|
|
35
|
+
*/
|
|
36
|
+
function parseBudget(raw) {
|
|
37
|
+
const text = raw.trim();
|
|
38
|
+
if (!/^(\d+(\.\d+)?|\.\d+)$/.test(text))
|
|
39
|
+
return undefined;
|
|
40
|
+
return Number(text);
|
|
42
41
|
}
|
|
43
42
|
function modelLines(models) {
|
|
44
43
|
if (models.length === 0)
|
|
@@ -52,22 +51,28 @@ function modelLines(models) {
|
|
|
52
51
|
`${String(model.calls).padStart(4)} calls`,
|
|
53
52
|
`${group(model.inputTokens).padStart(9)} in`,
|
|
54
53
|
`${group(model.outputTokens).padStart(9)} out`,
|
|
55
|
-
usd(model.costUsd).padStart(14),
|
|
54
|
+
usd(model.costUsd, 6).padStart(14),
|
|
56
55
|
unpriced,
|
|
57
56
|
].join(' '));
|
|
58
57
|
}
|
|
59
58
|
return lines;
|
|
60
59
|
}
|
|
61
|
-
function reportLines(summary, dir, since) {
|
|
60
|
+
function reportLines(summary, dir, since, budget) {
|
|
62
61
|
const scope = since === undefined ? '' : ` since ${since}`;
|
|
63
62
|
const lines = [
|
|
64
63
|
`dir: ${dir}`,
|
|
65
64
|
`spans: ${group(summary.spans)} in ${group(summary.traces)} trace(s)${scope}`,
|
|
66
65
|
summary.unpricedSpans === 0
|
|
67
|
-
? `cost: ${usd(summary.costUsd)}`
|
|
68
|
-
: `cost: ${usd(summary.costUsd)} (${summary.unpricedSpans} unpriced span(s) not included)`,
|
|
66
|
+
? `cost: ${usd(summary.costUsd, 6)}`
|
|
67
|
+
: `cost: ${usd(summary.costUsd, 6)} (${summary.unpricedSpans} unpriced span(s) not included)`,
|
|
69
68
|
`tokens: ${group(summary.inputTokens)} input, ${group(summary.outputTokens)} output`,
|
|
70
69
|
];
|
|
70
|
+
if (budget !== undefined) {
|
|
71
|
+
const over = summary.costUsd - budget;
|
|
72
|
+
lines.push(over > 0
|
|
73
|
+
? `budget: ${usd(budget, 6)} (over by ${usd(over, 6)})`
|
|
74
|
+
: `budget: ${usd(budget, 6)} (within)`);
|
|
75
|
+
}
|
|
71
76
|
if (summary.latency !== undefined) {
|
|
72
77
|
lines.push(`latency: p50 ${group(summary.latency.p50)}ms, p95 ${group(summary.latency.p95)}ms over ${group(summary.latency.samples)} model call(s)`);
|
|
73
78
|
}
|
|
@@ -78,21 +83,10 @@ function reportLines(summary, dir, since) {
|
|
|
78
83
|
}
|
|
79
84
|
export function cost(context, options) {
|
|
80
85
|
const command = 'cost';
|
|
81
|
-
const
|
|
82
|
-
if (
|
|
83
|
-
return outcome
|
|
84
|
-
|
|
85
|
-
exitCode: EXIT_USAGE,
|
|
86
|
-
diagnostics: [
|
|
87
|
-
cliError({
|
|
88
|
-
code: CLI_DIAGNOSTIC_CODES.traceDirMissing,
|
|
89
|
-
message: `no trace directory: \`aid cost\` needs one to read.`,
|
|
90
|
-
hint: `Pass it as \`aid ${command} <dir>\`, or set ${TRACE_DIR_ENV} to the directory the runtime writes to.`,
|
|
91
|
-
}),
|
|
92
|
-
],
|
|
93
|
-
text: `aid: no trace directory. Pass one, or set ${TRACE_DIR_ENV}.\n`,
|
|
94
|
-
});
|
|
95
|
-
}
|
|
86
|
+
const located = locateTraceDir(context, options.dir, command);
|
|
87
|
+
if (located.kind === 'refused')
|
|
88
|
+
return located.outcome;
|
|
89
|
+
const shown = located.shown;
|
|
96
90
|
let since;
|
|
97
91
|
if (options.since !== undefined) {
|
|
98
92
|
since = parseSince(options.since);
|
|
@@ -111,51 +105,29 @@ export function cost(context, options) {
|
|
|
111
105
|
});
|
|
112
106
|
}
|
|
113
107
|
}
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
let
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}),
|
|
134
|
-
],
|
|
135
|
-
text: `aid: "${shown}" is not a directory.\n`,
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
const names = readdirSync(absolute, { withFileTypes: true })
|
|
139
|
-
.filter((entry) => entry.isFile() && entry.name.endsWith('.jsonl'))
|
|
140
|
-
.map((entry) => entry.name)
|
|
141
|
-
.sort();
|
|
142
|
-
let skipped = 0;
|
|
143
|
-
const all = [];
|
|
144
|
-
let unreadable = 0;
|
|
145
|
-
for (const name of names) {
|
|
146
|
-
let text;
|
|
147
|
-
try {
|
|
148
|
-
text = readFileSync(join(absolute, name), 'utf8');
|
|
149
|
-
}
|
|
150
|
-
catch {
|
|
151
|
-
// Counted, not thrown: one unreadable file should not hide the spans in the rest.
|
|
152
|
-
unreadable += 1;
|
|
153
|
-
continue;
|
|
108
|
+
const confirmed = confirmTraceDir(located, command);
|
|
109
|
+
if (confirmed.kind === 'refused')
|
|
110
|
+
return confirmed.outcome;
|
|
111
|
+
let budget;
|
|
112
|
+
if (options.budget !== undefined) {
|
|
113
|
+
budget = parseBudget(options.budget);
|
|
114
|
+
if (budget === undefined) {
|
|
115
|
+
return outcome({
|
|
116
|
+
command,
|
|
117
|
+
exitCode: EXIT_USAGE,
|
|
118
|
+
diagnostics: [
|
|
119
|
+
cliError({
|
|
120
|
+
code: CLI_DIAGNOSTIC_CODES.costBudgetInvalid,
|
|
121
|
+
message: `--budget "${options.budget}" is not a non-negative amount in USD.`,
|
|
122
|
+
hint: 'Use a decimal amount, such as 0.25 or 5. The value is compared against the cost the runtime recorded.',
|
|
123
|
+
}),
|
|
124
|
+
],
|
|
125
|
+
text: `aid: --budget "${options.budget}" is not a non-negative amount in USD.\n`,
|
|
126
|
+
});
|
|
154
127
|
}
|
|
155
|
-
const parsed = parseTraceLines(text);
|
|
156
|
-
all.push(...parsed.spans);
|
|
157
|
-
skipped += parsed.skipped;
|
|
158
128
|
}
|
|
129
|
+
const diagnostics = [];
|
|
130
|
+
const { files: names, spans: all, skipped, unreadable } = readTraceDir(confirmed.absolute);
|
|
159
131
|
if (unreadable > 0) {
|
|
160
132
|
diagnostics.push(cliError({
|
|
161
133
|
code: CLI_DIAGNOSTIC_CODES.traceUnreadable,
|
|
@@ -178,7 +150,19 @@ export function cost(context, options) {
|
|
|
178
150
|
}));
|
|
179
151
|
}
|
|
180
152
|
const summary = summariseSpans(all, since === undefined ? {} : { since });
|
|
181
|
-
|
|
153
|
+
let budgetExceeded = false;
|
|
154
|
+
if (budget !== undefined && summary.costUsd > budget) {
|
|
155
|
+
budgetExceeded = true;
|
|
156
|
+
const unpriced = summary.unpricedSpans === 0
|
|
157
|
+
? ''
|
|
158
|
+
: ` ${summary.unpricedSpans} span(s) recorded no cost, so the total is a lower bound.`;
|
|
159
|
+
diagnostics.push(cliError({
|
|
160
|
+
code: CLI_DIAGNOSTIC_CODES.costOverBudget,
|
|
161
|
+
message: `cost ${usd(summary.costUsd, 6)} exceeds the --budget ceiling ${usd(budget, 6)} by ${usd(summary.costUsd - budget, 6)}.`,
|
|
162
|
+
hint: `The report above names the model that spent it.${unpriced}`,
|
|
163
|
+
}));
|
|
164
|
+
}
|
|
165
|
+
const exitCode = unreadable > 0 || budgetExceeded ? EXIT_FAILURE : EXIT_OK;
|
|
182
166
|
return outcome({
|
|
183
167
|
command,
|
|
184
168
|
exitCode,
|
|
@@ -193,13 +177,14 @@ export function cost(context, options) {
|
|
|
193
177
|
outputTokens: summary.outputTokens,
|
|
194
178
|
costUsd: summary.costUsd,
|
|
195
179
|
unpricedSpans: summary.unpricedSpans,
|
|
180
|
+
...(budget === undefined ? {} : { budgetUsd: budget, overBudget: budgetExceeded }),
|
|
196
181
|
...(summary.latency === undefined
|
|
197
182
|
? {}
|
|
198
183
|
: { latencyMs: { p50: summary.latency.p50, p95: summary.latency.p95 } }),
|
|
199
184
|
models: summary.models,
|
|
200
185
|
},
|
|
201
186
|
diagnostics,
|
|
202
|
-
text: reportLines(summary, shown, since).join('\n'),
|
|
187
|
+
text: reportLines(summary, shown, since, budget).join('\n'),
|
|
203
188
|
});
|
|
204
189
|
}
|
|
205
190
|
//# sourceMappingURL=cost.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cost.js","sourceRoot":"","sources":["../../src/commands/cost.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cost.js","sourceRoot":"","sources":["../../src/commands/cost.ts"],"names":[],"mappings":"AA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AAW,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;KAC5D,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `aid trace` — read a traced run back out of the local trace sink.
|
|
3
|
+
*
|
|
4
|
+
* The sink records *what happened*, not *what was said*: spans carry timing, kind, model,
|
|
5
|
+
* token counts and priced cost, but no prompts and no completions. So this command
|
|
6
|
+
* **inspects** a run; it does not replay one. A replay needs the request payloads, and
|
|
7
|
+
* inventing them -- asking the model again -- would answer a different question than "what
|
|
8
|
+
* happened here", while looking like an answer to it. Replay stays unimplemented until the
|
|
9
|
+
* sink records payloads, and the help text says so rather than letting a reader assume.
|
|
10
|
+
*
|
|
11
|
+
* Exit codes:
|
|
12
|
+
*
|
|
13
|
+
* - `2` when the invocation is wrong: no directory, a selector that matches no run or more
|
|
14
|
+
* than one, or `--run` together with `--all`.
|
|
15
|
+
* - `1` only when a trace file exists and could not be read. The tree still prints: what
|
|
16
|
+
* was readable is worth seeing.
|
|
17
|
+
* - `0` otherwise, including a directory with no runs yet -- "nothing ran" is a true
|
|
18
|
+
* answer, and the warning on stderr says why it is empty.
|
|
19
|
+
*/
|
|
20
|
+
import type { CliContext } from '../context.js';
|
|
21
|
+
import type { CommandOutcome } from '../output.js';
|
|
22
|
+
export interface TraceOptions {
|
|
23
|
+
/** The directory to read; defaults to `$AID_TRACE_DIR`. */
|
|
24
|
+
readonly dir: string | undefined;
|
|
25
|
+
/** A full trace id, or an unambiguous prefix of one. */
|
|
26
|
+
readonly run: string | undefined;
|
|
27
|
+
/** Print every run's tree instead of the run list. */
|
|
28
|
+
readonly all: boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare function trace(context: CliContext, options: TraceOptions): CommandOutcome;
|
|
31
|
+
//# sourceMappingURL=trace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../src/commands/trace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAIhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAMnD,MAAM,WAAW,YAAY;IAC3B,2DAA2D;IAC3D,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,wDAAwD;IACxD,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,sDAAsD;IACtD,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;CACvB;AAgJD,wBAAgB,KAAK,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,GAAG,cAAc,CA6GhF"}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `aid trace` — read a traced run back out of the local trace sink.
|
|
3
|
+
*
|
|
4
|
+
* The sink records *what happened*, not *what was said*: spans carry timing, kind, model,
|
|
5
|
+
* token counts and priced cost, but no prompts and no completions. So this command
|
|
6
|
+
* **inspects** a run; it does not replay one. A replay needs the request payloads, and
|
|
7
|
+
* inventing them -- asking the model again -- would answer a different question than "what
|
|
8
|
+
* happened here", while looking like an answer to it. Replay stays unimplemented until the
|
|
9
|
+
* sink records payloads, and the help text says so rather than letting a reader assume.
|
|
10
|
+
*
|
|
11
|
+
* Exit codes:
|
|
12
|
+
*
|
|
13
|
+
* - `2` when the invocation is wrong: no directory, a selector that matches no run or more
|
|
14
|
+
* than one, or `--run` together with `--all`.
|
|
15
|
+
* - `1` only when a trace file exists and could not be read. The tree still prints: what
|
|
16
|
+
* was readable is worth seeing.
|
|
17
|
+
* - `0` otherwise, including a directory with no runs yet -- "nothing ran" is a true
|
|
18
|
+
* answer, and the warning on stderr says why it is empty.
|
|
19
|
+
*/
|
|
20
|
+
import { CLI_DIAGNOSTIC_CODES, cliError, cliWarning } from '../diagnostics.js';
|
|
21
|
+
import { EXIT_FAILURE, EXIT_OK, EXIT_USAGE } from '../exit.js';
|
|
22
|
+
import { group, outcome, usd } from '../output.js';
|
|
23
|
+
import { runsOf, treeRowsOf } from '../trace.js';
|
|
24
|
+
import { readTraceDir, resolveTraceDir, TRACE_DIR_ENV } from '../trace-dir.js';
|
|
25
|
+
/** What a reader wants to know about a run before opening it. */
|
|
26
|
+
function summaryOf(run) {
|
|
27
|
+
return {
|
|
28
|
+
traceId: run.traceId,
|
|
29
|
+
startedAt: run.startedAt,
|
|
30
|
+
durationMs: run.durationMs,
|
|
31
|
+
spans: run.spans.length,
|
|
32
|
+
errors: run.errors,
|
|
33
|
+
costUsd: run.costUsd,
|
|
34
|
+
unpricedSpans: run.unpricedSpans,
|
|
35
|
+
...(run.root === undefined ? {} : { rootSpanId: run.root.span_id, rootName: run.root.name }),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function rowOf(row) {
|
|
39
|
+
const { facts } = row;
|
|
40
|
+
return {
|
|
41
|
+
spanId: row.span.span_id,
|
|
42
|
+
...(row.span.parent_span_id == null ? {} : { parentSpanId: row.span.parent_span_id }),
|
|
43
|
+
name: row.span.name,
|
|
44
|
+
...(row.span.kind === undefined ? {} : { kind: row.span.kind }),
|
|
45
|
+
depth: row.depth,
|
|
46
|
+
...(row.offsetMs === undefined ? {} : { offsetMs: row.offsetMs }),
|
|
47
|
+
...(row.span.started_at === undefined ? {} : { startedAt: row.span.started_at }),
|
|
48
|
+
...(facts.durationMs === undefined ? {} : { durationMs: facts.durationMs }),
|
|
49
|
+
...(facts.model === undefined ? {} : { model: facts.model }),
|
|
50
|
+
...(facts.inputTokens === undefined ? {} : { inputTokens: facts.inputTokens }),
|
|
51
|
+
...(facts.outputTokens === undefined ? {} : { outputTokens: facts.outputTokens }),
|
|
52
|
+
...(facts.costUsd === undefined ? {} : { costUsd: facts.costUsd }),
|
|
53
|
+
...(row.span.status?.message == null ? {} : { statusMessage: row.span.status.message }),
|
|
54
|
+
error: facts.error,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function maxNameWidth(rows) {
|
|
58
|
+
return Math.max(0, ...rows.map((row) => row.span.name.length));
|
|
59
|
+
}
|
|
60
|
+
function treeLines(rows) {
|
|
61
|
+
const width = maxNameWidth(rows);
|
|
62
|
+
return rows.map((row) => {
|
|
63
|
+
const indent = ' '.repeat(row.depth);
|
|
64
|
+
const offset = row.offsetMs === undefined ? '-' : `+${group(row.offsetMs)}ms`;
|
|
65
|
+
const duration = row.facts.durationMs === undefined ? '-' : `${group(row.facts.durationMs)}ms`;
|
|
66
|
+
const parts = [indent + row.span.name.padEnd(width), row.span.kind ?? '-'];
|
|
67
|
+
if (row.facts.model !== undefined) {
|
|
68
|
+
const tokens = row.facts.inputTokens === undefined && row.facts.outputTokens === undefined
|
|
69
|
+
? ''
|
|
70
|
+
: ` ${group(row.facts.inputTokens ?? 0)}→${group(row.facts.outputTokens ?? 0)}`;
|
|
71
|
+
parts.push(row.facts.model + tokens);
|
|
72
|
+
}
|
|
73
|
+
if (row.facts.costUsd !== undefined)
|
|
74
|
+
parts.push(usd(row.facts.costUsd, 6));
|
|
75
|
+
if (row.facts.error) {
|
|
76
|
+
const message = row.span.status?.message;
|
|
77
|
+
parts.push(message == null || message === '' ? 'ERROR' : `ERROR ${message}`);
|
|
78
|
+
}
|
|
79
|
+
return `${offset.padStart(9)} ${duration.padStart(9)} ${parts.join(' ')}`;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function runHeader(run, spanCount) {
|
|
83
|
+
const label = run.root === undefined ? '(no single root)' : run.root.name;
|
|
84
|
+
const cost = run.unpricedSpans === 0
|
|
85
|
+
? usd(run.costUsd, 6)
|
|
86
|
+
: `${usd(run.costUsd, 6)} + ${group(run.unpricedSpans)} unpriced`;
|
|
87
|
+
return [
|
|
88
|
+
`run: ${run.traceId} ${label}`,
|
|
89
|
+
`started: ${run.startedAt === '' ? '-' : run.startedAt}`,
|
|
90
|
+
`wall: ${group(run.durationMs)}ms spans: ${group(spanCount)} errors: ${group(run.errors)}`,
|
|
91
|
+
`cost: ${cost}`,
|
|
92
|
+
];
|
|
93
|
+
}
|
|
94
|
+
function listLines(runs) {
|
|
95
|
+
if (runs.length === 0)
|
|
96
|
+
return ['no runs recorded.'];
|
|
97
|
+
const ids = Math.max(...runs.map((run) => run.traceId.length));
|
|
98
|
+
const lines = [`${group(runs.length)} run(s), newest first:`];
|
|
99
|
+
for (const run of runs) {
|
|
100
|
+
const label = run.root === undefined ? '-' : run.root.name;
|
|
101
|
+
const cost = run.unpricedSpans === 0 ? usd(run.costUsd, 6) : `${usd(run.costUsd, 6)}+`;
|
|
102
|
+
const errors = run.errors === 0 ? '' : ` ${group(run.errors)} ERROR`;
|
|
103
|
+
lines.push(` ${run.traceId.padEnd(ids)} ${run.startedAt.padEnd(24)} ${`${group(run.durationMs)}ms`.padStart(9)} ${`${group(run.spans.length)} spans`.padStart(10)} ${label} ${cost}${errors}`);
|
|
104
|
+
}
|
|
105
|
+
return lines;
|
|
106
|
+
}
|
|
107
|
+
/** Exact id first, then a unique prefix; ambiguity is reported, never guessed through. */
|
|
108
|
+
function selectRun(runs, selector) {
|
|
109
|
+
const exact = runs.find((run) => run.traceId === selector);
|
|
110
|
+
if (exact !== undefined)
|
|
111
|
+
return { run: exact };
|
|
112
|
+
const matches = runs.filter((run) => run.traceId.startsWith(selector)).map((run) => run.traceId);
|
|
113
|
+
if (matches.length === 1) {
|
|
114
|
+
const only = runs.find((run) => run.traceId === matches[0]);
|
|
115
|
+
if (only !== undefined)
|
|
116
|
+
return { run: only };
|
|
117
|
+
}
|
|
118
|
+
if (matches.length > 1)
|
|
119
|
+
return { matches };
|
|
120
|
+
return undefined;
|
|
121
|
+
}
|
|
122
|
+
function selectionRefusal(command, selector, matches) {
|
|
123
|
+
if (matches === undefined) {
|
|
124
|
+
return outcome({
|
|
125
|
+
command,
|
|
126
|
+
exitCode: EXIT_USAGE,
|
|
127
|
+
diagnostics: [
|
|
128
|
+
cliError({
|
|
129
|
+
code: CLI_DIAGNOSTIC_CODES.traceRunNotFound,
|
|
130
|
+
message: `no run starts with "${selector}".`,
|
|
131
|
+
hint: 'Run `aid trace` with no selector to list the runs in the directory, then pass an id or an unambiguous prefix.',
|
|
132
|
+
}),
|
|
133
|
+
],
|
|
134
|
+
text: `aid: no run starts with "${selector}".\n`,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
return outcome({
|
|
138
|
+
command,
|
|
139
|
+
exitCode: EXIT_USAGE,
|
|
140
|
+
diagnostics: [
|
|
141
|
+
cliError({
|
|
142
|
+
code: CLI_DIAGNOSTIC_CODES.traceRunAmbiguous,
|
|
143
|
+
message: `"${selector}" matches ${matches.length} runs: ${matches.join(', ')}.`,
|
|
144
|
+
hint: 'Pass a longer prefix, or the whole id.',
|
|
145
|
+
}),
|
|
146
|
+
],
|
|
147
|
+
text: `aid: "${selector}" matches ${matches.length} runs. Pass a longer prefix.\n`,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
export function trace(context, options) {
|
|
151
|
+
const command = 'trace';
|
|
152
|
+
if (options.run !== undefined && options.all) {
|
|
153
|
+
return outcome({
|
|
154
|
+
command,
|
|
155
|
+
exitCode: EXIT_USAGE,
|
|
156
|
+
diagnostics: [
|
|
157
|
+
cliError({
|
|
158
|
+
code: CLI_DIAGNOSTIC_CODES.traceFlagsConflict,
|
|
159
|
+
message: '--run and --all ask for different reports.',
|
|
160
|
+
hint: 'Pass --run <id> for one run, or --all for every run, not both.',
|
|
161
|
+
}),
|
|
162
|
+
],
|
|
163
|
+
text: 'aid: --run and --all ask for different reports.\n',
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
const resolved = resolveTraceDir(context, options.dir, command, '--dir <dir>');
|
|
167
|
+
if (resolved.kind === 'refused')
|
|
168
|
+
return resolved.outcome;
|
|
169
|
+
const shown = resolved.shown;
|
|
170
|
+
const diagnostics = [];
|
|
171
|
+
const { files, spans, skipped, unreadable } = readTraceDir(resolved.absolute);
|
|
172
|
+
if (unreadable > 0) {
|
|
173
|
+
diagnostics.push(cliError({
|
|
174
|
+
code: CLI_DIAGNOSTIC_CODES.traceUnreadable,
|
|
175
|
+
message: `could not read ${unreadable} trace file(s) in "${shown}": this view covers only the files that were readable.`,
|
|
176
|
+
hint: 'Check the file permissions, or move the unreadable file out of the directory.',
|
|
177
|
+
}));
|
|
178
|
+
}
|
|
179
|
+
if (skipped > 0) {
|
|
180
|
+
diagnostics.push(cliWarning({
|
|
181
|
+
code: CLI_DIAGNOSTIC_CODES.traceMalformed,
|
|
182
|
+
message: `skipped ${skipped} line(s) in "${shown}" that are not complete span records.`,
|
|
183
|
+
hint: 'A trace file is appended to while it is read, so a truncated last line is normal; a large count is not.',
|
|
184
|
+
}));
|
|
185
|
+
}
|
|
186
|
+
if (files.length === 0) {
|
|
187
|
+
diagnostics.push(cliWarning({
|
|
188
|
+
code: CLI_DIAGNOSTIC_CODES.traceEmpty,
|
|
189
|
+
message: `no trace files in "${shown}".`,
|
|
190
|
+
hint: `The runtime writes one when ${TRACE_DIR_ENV} is set and a model call runs; check that this is the directory it names.`,
|
|
191
|
+
}));
|
|
192
|
+
}
|
|
193
|
+
const runs = runsOf(spans);
|
|
194
|
+
const exitCode = unreadable > 0 ? EXIT_FAILURE : EXIT_OK;
|
|
195
|
+
const base = { dir: shown, files: files.length, spans: spans.length };
|
|
196
|
+
if (options.run !== undefined) {
|
|
197
|
+
const selected = selectRun(runs, options.run);
|
|
198
|
+
if (selected === undefined || !('run' in selected)) {
|
|
199
|
+
return selectionRefusal(command, options.run, selected?.matches);
|
|
200
|
+
}
|
|
201
|
+
const rows = treeRowsOf(selected.run);
|
|
202
|
+
return outcome({
|
|
203
|
+
command,
|
|
204
|
+
exitCode,
|
|
205
|
+
fields: { ...base, run: summaryOf(selected.run), tree: rows.map(rowOf) },
|
|
206
|
+
diagnostics,
|
|
207
|
+
text: [...runHeader(selected.run, rows.length), '', ...treeLines(rows)].join('\n'),
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
if (runs.length === 0 && files.length > 0) {
|
|
211
|
+
diagnostics.push(cliWarning({
|
|
212
|
+
code: CLI_DIAGNOSTIC_CODES.traceNoRuns,
|
|
213
|
+
message: `"${shown}" has ${files.length} trace file(s) but no complete span records.`,
|
|
214
|
+
hint: 'Check that the runtime finished the call it was tracing, and that the files are not empty.',
|
|
215
|
+
}));
|
|
216
|
+
}
|
|
217
|
+
if (options.all) {
|
|
218
|
+
const blocks = [];
|
|
219
|
+
for (const run of runs)
|
|
220
|
+
blocks.push([...runHeader(run, run.spans.length), '', ...treeLines(treeRowsOf(run))].join('\n'));
|
|
221
|
+
return outcome({
|
|
222
|
+
command,
|
|
223
|
+
exitCode,
|
|
224
|
+
fields: {
|
|
225
|
+
...base,
|
|
226
|
+
runs: runs.map((run) => ({ ...summaryOf(run), tree: treeRowsOf(run).map(rowOf) })),
|
|
227
|
+
},
|
|
228
|
+
diagnostics,
|
|
229
|
+
text: blocks.length === 0 ? 'no runs recorded.\n' : blocks.join('\n\n'),
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
return outcome({
|
|
233
|
+
command,
|
|
234
|
+
exitCode,
|
|
235
|
+
fields: { ...base, runs: runs.map(summaryOf) },
|
|
236
|
+
diagnostics,
|
|
237
|
+
text: listLines(runs).join('\n'),
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
//# sourceMappingURL=trace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace.js","sourceRoot":"","sources":["../../src/commands/trace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE/D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54,12 @@ export declare const CLI_DIAGNOSTIC_CODES: {
|
|
|
54
54
|
readonly traceUnreadable: 'cli/trace-unreadable';
|
|
55
55
|
readonly traceMalformed: 'cli/trace-malformed';
|
|
56
56
|
readonly traceEmpty: 'cli/trace-empty';
|
|
57
|
+
readonly costBudgetInvalid: 'cli/cost-budget-invalid';
|
|
58
|
+
readonly costOverBudget: 'cli/cost-over-budget';
|
|
59
|
+
readonly traceRunNotFound: 'cli/trace-run-not-found';
|
|
60
|
+
readonly traceRunAmbiguous: 'cli/trace-run-ambiguous';
|
|
61
|
+
readonly traceNoRuns: 'cli/trace-no-runs';
|
|
62
|
+
readonly traceFlagsConflict: 'cli/trace-flags-conflict';
|
|
57
63
|
readonly devPortInvalid: 'cli/dev-port-invalid';
|
|
58
64
|
readonly devEntryMissing: 'cli/dev-entry-missing';
|
|
59
65
|
readonly devUvicornMissing: 'cli/dev-uvicorn-missing';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGtD,gEAAgE;AAChE,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;AAE/C,eAAO,MAAM,oBAAoB;aAC/B,cAAc,EAAE,qBAAqB;aACrC,aAAa,EAAE,oBAAoB;aACnC,mBAAmB,EAAE,2BAA2B;aAChD,aAAa,EAAE,oBAAoB;aACnC,aAAa,EAAE,qBAAqB;aACpC,kBAAkB,EAAE,0BAA0B;aAC9C,iBAAiB,EAAE,wBAAwB;aAC3C,iBAAiB,EAAE,wBAAwB;aAC3C,iBAAiB,EAAE,yBAAyB;aAC5C,oBAAoB,EAAE,4BAA4B;aAClD,iBAAiB,EAAE,wBAAwB;aAC3C,YAAY,EAAE,mBAAmB;aACjC,YAAY,EAAE,mBAAmB;aAGjC,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