@orchestraai/agent-tools 0.8.1 → 0.9.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/.agents/plugins/marketplace.json +1 -1
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.cursor-plugin/plugin.json +1 -1
- package/.devin/adapter.json +1 -1
- package/.hermes/adapter.json +1 -1
- package/.opencode/adapter.json +1 -1
- package/README.md +10 -2
- package/dist/bin.d.ts +1 -1
- package/dist/bin.js +2 -0
- package/dist/bin.js.map +1 -1
- package/dist/claude-accounting.d.ts +75 -0
- package/dist/claude-accounting.js +155 -0
- package/dist/claude-accounting.js.map +1 -0
- package/dist/claude-reconciliation.d.ts +28 -0
- package/dist/claude-reconciliation.js +107 -0
- package/dist/claude-reconciliation.js.map +1 -0
- package/dist/commands/claude-session.d.ts +30 -0
- package/dist/commands/claude-session.js +132 -0
- package/dist/commands/claude-session.js.map +1 -0
- package/dist/commands/claude.d.ts +26 -0
- package/dist/commands/claude.js +123 -0
- package/dist/commands/claude.js.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -1
- package/dist/node-guard.d.ts +1 -0
- package/dist/node-guard.js +10 -0
- package/dist/node-guard.js.map +1 -0
- package/dist/node-version.d.ts +10 -0
- package/dist/node-version.js +50 -0
- package/dist/node-version.js.map +1 -0
- package/dist/onboarding/agents.js +5 -1
- package/dist/onboarding/agents.js.map +1 -1
- package/docs/claude-gateway.md +126 -0
- package/docs/release-checklist.md +6 -1
- package/install.sh +112 -3
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "orchestra",
|
|
3
3
|
"description": "Improve LLM apps and agents from real traces — reduce cost/latency, raise quality/reliability, capture traces, build evals, run local optimization (GEPA), compare models/providers, and route through Orchestra.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.9.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Orchestra"
|
|
7
7
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "orchestra",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Improve LLM apps and agents from real traces: capture evidence, build evals, optimize prompts/routes, compare models, run local models, and hand off to Orchestra.",
|
|
5
5
|
"skills": "./skills/"
|
|
6
6
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "orchestra",
|
|
3
3
|
"description": "Improve LLM apps and agents from real traces: capture evidence, build evals, optimize prompts/routes, compare models, run local models, and hand off to Orchestra.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.9.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Orchestra"
|
|
7
7
|
},
|
package/.devin/adapter.json
CHANGED
package/.hermes/adapter.json
CHANGED
package/.opencode/adapter.json
CHANGED
package/README.md
CHANGED
|
@@ -30,8 +30,11 @@ CLI alias, and rerunning the installer replaces the old `understudy` plugin).
|
|
|
30
30
|
curl -fsSL https://raw.githubusercontent.com/understudylabs/orchestra-agent-tools/main/install.sh | bash
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
You need
|
|
34
|
-
|
|
33
|
+
You need macOS or Linux (on Windows, use WSL) and Node.js 22.19 or newer. The
|
|
34
|
+
installer checks both before it changes anything and tells you the fix for your
|
|
35
|
+
machine; with Homebrew it offers to install Node for you. Run `orchestra doctor`
|
|
36
|
+
any time to see what Orchestra can find. The installer then installs the CLI
|
|
37
|
+
and hands over to `orchestra init`, a short guided setup:
|
|
35
38
|
|
|
36
39
|
1. **What to set up:** Orchestra account + coding-agent plugin (recommended),
|
|
37
40
|
the same plus the local model lab (Apple Silicon: the Orchestra 2B model,
|
|
@@ -484,3 +487,8 @@ command outputs that do not contain private payloads.
|
|
|
484
487
|
## License
|
|
485
488
|
|
|
486
489
|
MIT.
|
|
490
|
+
|
|
491
|
+
### Claude Code gateway attribution
|
|
492
|
+
|
|
493
|
+
Run Claude Code with persistent session and Git attribution using
|
|
494
|
+
`orchestra claude`. See [setup, resume, capture/cost reconciliation and PR linking](docs/claude-gateway.md).
|
package/dist/bin.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
import "./node-guard.js";
|
package/dist/bin.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
// First, so an old Node gets one sentence instead of a stack trace.
|
|
3
|
+
import "./node-guard.js";
|
|
2
4
|
import { migrateGlobalHome } from "./config/paths.js";
|
|
3
5
|
const INTERNAL_CONVERSATION_SIDECAR_ARG = "__understudy_conversation_sidecar__";
|
|
4
6
|
// Before any command module computes a path under the global directory.
|
package/dist/bin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,iCAAiC,GAAG,qCAAqC,CAAC;AAEhF,wEAAwE;AACxE,qEAAqE;AACrE,MAAM,IAAI,GAAG,iBAAiB,EAAE,CAAC;AACjC,IAAI,IAAI,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;IAC/B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,qFAAqF,CAAC,CAAC;AAC9G,CAAC;KAAM,IAAI,IAAI,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;IACnC,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,oHAAoH;QAClH,qEAAqE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAChI,CAAC;AACJ,CAAC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ope {
|
|
5
|
+
org: string;
|
|
6
|
+
projectId: string;
|
|
7
|
+
workloadId: string;
|
|
8
|
+
traceId: string;
|
|
9
|
+
environment: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function collectSessionRequests(scope: Scope, pageRequest: (cursor: string | null) => Promise<unknown>): Promise<{
|
|
12
|
+
calls: {
|
|
13
|
+
request_id: string;
|
|
14
|
+
ts: string;
|
|
15
|
+
project_id: string;
|
|
16
|
+
workload_id: string;
|
|
17
|
+
request_environment: "test" | "production";
|
|
18
|
+
trace_id: string;
|
|
19
|
+
status_code: number;
|
|
20
|
+
outcome: string;
|
|
21
|
+
tokens: {
|
|
22
|
+
[x: string]: unknown;
|
|
23
|
+
input_tokens: number;
|
|
24
|
+
cache_creation_input_tokens: number;
|
|
25
|
+
cache_read_input_tokens: number;
|
|
26
|
+
output_tokens: number;
|
|
27
|
+
reasoning_output_tokens: number;
|
|
28
|
+
};
|
|
29
|
+
capture_state: "unknown" | "expected" | "disabled";
|
|
30
|
+
}[];
|
|
31
|
+
snapshot: {
|
|
32
|
+
snapshot_watermark: string;
|
|
33
|
+
};
|
|
34
|
+
known_gaps: string[];
|
|
35
|
+
}>;
|
|
36
|
+
export declare function accountClaudeSession(session: Session, captureDirectory?: string): Promise<{
|
|
37
|
+
session_id: string;
|
|
38
|
+
trace_id: string;
|
|
39
|
+
snapshot: {
|
|
40
|
+
snapshot_watermark: string;
|
|
41
|
+
};
|
|
42
|
+
requests: number;
|
|
43
|
+
failed_requests: number;
|
|
44
|
+
priced_cost_usd: number;
|
|
45
|
+
customer_cost_usd: number | null;
|
|
46
|
+
unpriced_request_ids: string[];
|
|
47
|
+
uncaptured_request_ids: string[];
|
|
48
|
+
known_gaps: string[];
|
|
49
|
+
unmatched_requests: null;
|
|
50
|
+
ambiguous_requests: null;
|
|
51
|
+
attribution_note: string;
|
|
52
|
+
records: {
|
|
53
|
+
pricing_status: string;
|
|
54
|
+
customer_cost_usd: number | null;
|
|
55
|
+
capture_verification: string;
|
|
56
|
+
request_id: string;
|
|
57
|
+
ts: string;
|
|
58
|
+
project_id: string;
|
|
59
|
+
workload_id: string;
|
|
60
|
+
request_environment: "test" | "production";
|
|
61
|
+
trace_id: string;
|
|
62
|
+
status_code: number;
|
|
63
|
+
outcome: string;
|
|
64
|
+
tokens: {
|
|
65
|
+
[x: string]: unknown;
|
|
66
|
+
input_tokens: number;
|
|
67
|
+
cache_creation_input_tokens: number;
|
|
68
|
+
cache_read_input_tokens: number;
|
|
69
|
+
output_tokens: number;
|
|
70
|
+
reasoning_output_tokens: number;
|
|
71
|
+
};
|
|
72
|
+
capture_state: "unknown" | "expected" | "disabled";
|
|
73
|
+
}[];
|
|
74
|
+
}>;
|
|
75
|
+
export {};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { request, UnderstudyApiError } from "./internal/http.js";
|
|
5
|
+
import { resolveProject } from "./internal/projects.js";
|
|
6
|
+
import { resolveWorkload } from "./internal/workloads.js";
|
|
7
|
+
import { CallCostResponseSchema, CoverageSchema, TokenCountsSchema } from "./internal/reporting-contracts.js";
|
|
8
|
+
import { exportCapturesByRequestIds } from "./commands/captures.js";
|
|
9
|
+
import { verifySessionCapture } from "./claude-reconciliation.js";
|
|
10
|
+
// Customer request-log wire subset; unknown fields never enter the report.
|
|
11
|
+
const SessionRequestSchema = z.object({
|
|
12
|
+
request_id: z.string().uuid(), ts: z.string(), project_id: z.string(), workload_id: z.string(),
|
|
13
|
+
request_environment: z.enum(["test", "production"]), trace_id: z.string(), status_code: z.number().int(),
|
|
14
|
+
outcome: z.string(), tokens: TokenCountsSchema,
|
|
15
|
+
capture_state: z.enum(["expected", "disabled", "unknown"]),
|
|
16
|
+
});
|
|
17
|
+
const SessionPageSchema = z.object({
|
|
18
|
+
org_id: z.string(), trace_id: z.string(), snapshot_watermark: z.string(),
|
|
19
|
+
groups: z.array(z.object({ project_id: z.string(), total_count: z.number().int().nonnegative(), calls: z.array(SessionRequestSchema) })),
|
|
20
|
+
next_cursor: z.string().nullable(), coverage: CoverageSchema,
|
|
21
|
+
});
|
|
22
|
+
export async function collectSessionRequests(scope, pageRequest) {
|
|
23
|
+
const calls = [];
|
|
24
|
+
const seenRequests = new Set();
|
|
25
|
+
const seenCursors = new Set();
|
|
26
|
+
const gaps = new Set();
|
|
27
|
+
let cursor = null;
|
|
28
|
+
let snapshot;
|
|
29
|
+
let total;
|
|
30
|
+
let previous;
|
|
31
|
+
do {
|
|
32
|
+
const page = SessionPageSchema.parse(await pageRequest(cursor));
|
|
33
|
+
if (page.org_id !== scope.org || page.trace_id !== scope.traceId)
|
|
34
|
+
throw new Error("Session inventory scope mismatch.");
|
|
35
|
+
if (!Number.isFinite(Date.parse(page.snapshot_watermark)))
|
|
36
|
+
throw new Error("Invalid inventory timeline.");
|
|
37
|
+
if (snapshot && snapshot !== page.snapshot_watermark)
|
|
38
|
+
throw new Error("Inventory snapshot changed during pagination.");
|
|
39
|
+
snapshot ??= page.snapshot_watermark;
|
|
40
|
+
for (const gap of page.coverage.known_gaps)
|
|
41
|
+
gaps.add(gap);
|
|
42
|
+
if (page.coverage.data_completeness < 1)
|
|
43
|
+
gaps.add("Some gateway request metadata is incomplete.");
|
|
44
|
+
let pageCount = 0;
|
|
45
|
+
for (const group of page.groups) {
|
|
46
|
+
if (group.project_id !== scope.projectId)
|
|
47
|
+
throw new Error("Trace spans another project; attribution is ambiguous.");
|
|
48
|
+
if (total !== undefined && total !== group.total_count)
|
|
49
|
+
throw new Error("Inventory total changed during pagination.");
|
|
50
|
+
total ??= group.total_count;
|
|
51
|
+
for (const call of group.calls) {
|
|
52
|
+
if (call.project_id !== scope.projectId || call.workload_id !== scope.workloadId || call.request_environment !== scope.environment || call.trace_id !== scope.traceId)
|
|
53
|
+
throw new Error("Request scope mismatch.");
|
|
54
|
+
const at = Date.parse(call.ts);
|
|
55
|
+
if (!Number.isFinite(at))
|
|
56
|
+
throw new Error("Invalid request timestamp.");
|
|
57
|
+
if (seenRequests.has(call.request_id) || (previous && (at < Date.parse(previous.ts) || (at === Date.parse(previous.ts) && call.request_id <= previous.request_id))))
|
|
58
|
+
throw new Error("Repeated or unordered request in inventory.");
|
|
59
|
+
previous = call;
|
|
60
|
+
seenRequests.add(call.request_id);
|
|
61
|
+
calls.push(call);
|
|
62
|
+
pageCount++;
|
|
63
|
+
if (calls.length > 100_000)
|
|
64
|
+
throw new Error("Session exceeds 100000 requests; no partial report was returned.");
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
cursor = page.next_cursor;
|
|
68
|
+
if (cursor !== null) {
|
|
69
|
+
if (!cursor || seenCursors.has(cursor) || pageCount === 0)
|
|
70
|
+
throw new Error("Invalid inventory continuation cursor.");
|
|
71
|
+
seenCursors.add(cursor);
|
|
72
|
+
}
|
|
73
|
+
} while (cursor !== null);
|
|
74
|
+
if (calls.length !== (total ?? 0))
|
|
75
|
+
throw new Error("Inventory count does not match the trace total.");
|
|
76
|
+
return { calls, snapshot: { snapshot_watermark: snapshot }, known_gaps: [...gaps] };
|
|
77
|
+
}
|
|
78
|
+
export async function accountClaudeSession(session, captureDirectory) {
|
|
79
|
+
if (!session.traceparent)
|
|
80
|
+
throw new Error("This session predates trace attribution. Start a new session for transcript-free accounting; use reconcile for older sessions.");
|
|
81
|
+
const traceId = session.traceparent.split("-")[1];
|
|
82
|
+
const project = await resolveProject({ org: session.org, project: session.project });
|
|
83
|
+
if (project.auth.gatewayUrl !== session.gateway_url)
|
|
84
|
+
throw new Error("Gateway changed since session launch.");
|
|
85
|
+
const workload = await resolveWorkload(project, session.workload);
|
|
86
|
+
const inventory = await collectSessionRequests({ org: session.org, projectId: project.projectId, workloadId: workload.id, traceId, environment: session.environment }, async (cursor) => {
|
|
87
|
+
const params = new URLSearchParams({ request_environment: session.environment, limit: "100", include_rejection_details: "true" });
|
|
88
|
+
if (cursor)
|
|
89
|
+
params.set("cursor", cursor);
|
|
90
|
+
return (await request({ orgId: session.org, url: `/admin/v1/orgs/${encodeURIComponent(session.org)}/request-logs/traces/${traceId}?${params}` }, SessionPageSchema)).data;
|
|
91
|
+
});
|
|
92
|
+
const records = [];
|
|
93
|
+
for (const call of inventory.calls) {
|
|
94
|
+
let customerCost = null;
|
|
95
|
+
let pricingStatus = "missing";
|
|
96
|
+
try {
|
|
97
|
+
const cost = (await request({ orgId: session.org, url: `/admin/v1/orgs/${encodeURIComponent(session.org)}/calls/${encodeURIComponent(call.request_id)}/cost` }, CallCostResponseSchema)).data;
|
|
98
|
+
if (cost.org_id !== session.org || cost.project_id !== project.projectId || cost.workload_id !== workload.id || cost.request_id !== call.request_id)
|
|
99
|
+
throw new Error("Cost record scope mismatch.");
|
|
100
|
+
pricingStatus = cost.pricing_status;
|
|
101
|
+
if (cost.pricing_status === "priced") {
|
|
102
|
+
if (!Number.isFinite(cost.customer_cost_usd) || cost.customer_cost_usd < 0)
|
|
103
|
+
throw new Error("Invalid customer cost.");
|
|
104
|
+
customerCost = cost.customer_cost_usd;
|
|
105
|
+
}
|
|
106
|
+
if (cost.coverage.data_completeness < 1)
|
|
107
|
+
inventory.known_gaps.push("Some cost metadata is incomplete.");
|
|
108
|
+
for (const gap of cost.coverage.known_gaps)
|
|
109
|
+
inventory.known_gaps.push(gap);
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
if (!(error instanceof UnderstudyApiError) || error.status !== 404)
|
|
113
|
+
throw error;
|
|
114
|
+
}
|
|
115
|
+
records.push({ ...call, pricing_status: pricingStatus, customer_cost_usd: customerCost, capture_verification: captureDirectory && call.capture_state !== "expected" ? "not_captured" : "not_requested" });
|
|
116
|
+
}
|
|
117
|
+
if (captureDirectory && records.length) {
|
|
118
|
+
const expected = records.filter(row => row.capture_state === "expected").map(row => row.request_id);
|
|
119
|
+
if (expected.length) {
|
|
120
|
+
const batch = await exportCapturesByRequestIds({ requestIds: expected, outputDirectory: captureDirectory, includePayload: true, concurrency: 4, retries: 2, resume: false, orgId: session.org, projectId: project.projectId, workloadId: workload.id });
|
|
121
|
+
for (const row of records) {
|
|
122
|
+
if (row.capture_state !== "expected") {
|
|
123
|
+
row.capture_verification = "not_captured";
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
if (batch.failed_request_ids.includes(row.request_id)) {
|
|
127
|
+
row.capture_verification = "missing";
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
let capture;
|
|
131
|
+
try {
|
|
132
|
+
capture = JSON.parse(readFileSync(join(captureDirectory, `${encodeURIComponent(row.request_id)}.payload.json`), "utf8"));
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
throw new Error("Invalid capture JSON; raw content omitted.");
|
|
136
|
+
}
|
|
137
|
+
verifySessionCapture(capture, session, row.request_id);
|
|
138
|
+
row.capture_verification = "verified";
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
const unpriced = records.filter(row => row.customer_cost_usd === null).map(row => row.request_id);
|
|
143
|
+
const pricedCost = records.reduce((sum, row) => sum + (row.customer_cost_usd ?? 0), 0);
|
|
144
|
+
return {
|
|
145
|
+
session_id: session.session_id, trace_id: traceId, snapshot: inventory.snapshot, requests: records.length,
|
|
146
|
+
failed_requests: records.filter(row => row.status_code >= 400 || row.outcome === "error").length,
|
|
147
|
+
priced_cost_usd: pricedCost, customer_cost_usd: unpriced.length || !records.length ? null : pricedCost,
|
|
148
|
+
unpriced_request_ids: unpriced, uncaptured_request_ids: records.filter(row => row.capture_state !== "expected").map(row => row.request_id),
|
|
149
|
+
known_gaps: [...new Set([...inventory.known_gaps, "Snapshot covers ingested requests carrying this session trace ID, including background calls; later arrivals and traffic without the ID require a fresh inventory or separate investigation."])],
|
|
150
|
+
unmatched_requests: null, ambiguous_requests: null,
|
|
151
|
+
attribution_note: "Session membership is explicit. Requests missing this session trace ID and shared/reused IDs cannot be quantified from this filtered inventory alone.",
|
|
152
|
+
records,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=claude-accounting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-accounting.js","sourceRoot":"","sources":["../src/claude-accounting.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAE9G,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,2EAA2E;AAC3E,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IAC9F,mBAAmB,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IACxG,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,iBAAiB;IAC9C,aAAa,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,U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QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,MAAM;QACzG,eAAe,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,WAAW,IAAI,GAAG,IAAI,GAAG,CAAC,OAAO,KAAK,OAAO,CAAC,CAAC,MAAM;QAChG,eAAe,EAAE,UAAU,EAAE,iBAAiB,EAAE,QAAQ,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU;QACtG,oBAAoB,EAAE,QAAQ,EAAE,sBAAsB,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,aAAa,KAAK,UAAU,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC;QAC1I,UAAU,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,UAAU,EAAE,8LAA8L,CAAC,CAAC,CAAC;QACnP,kBAAkB,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI;QAClD,gBAAgB,EAAE,uJAAuJ;QACzK,OAAO;KACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ClaudeSessionSchema } from "./commands/claude.js";
|
|
3
|
+
type Session = z.infer<typeof ClaudeSessionSchema>;
|
|
4
|
+
export declare function readClaudeEvidence(files: string[], sessionId: string): {
|
|
5
|
+
messageIds: string[];
|
|
6
|
+
usage: {
|
|
7
|
+
[k: string]: number;
|
|
8
|
+
};
|
|
9
|
+
results: number;
|
|
10
|
+
};
|
|
11
|
+
export declare function verifySessionCapture(value: unknown, session: Session, requestId: string): void;
|
|
12
|
+
export declare function reconcileClaudeSession(session: Session, transcripts: string[], out: string): Promise<{
|
|
13
|
+
session_id: string;
|
|
14
|
+
verified_at: string;
|
|
15
|
+
requests: number;
|
|
16
|
+
verified_captures: number;
|
|
17
|
+
tokens: {
|
|
18
|
+
[k: string]: number;
|
|
19
|
+
};
|
|
20
|
+
customer_cost_usd: number;
|
|
21
|
+
costs: {
|
|
22
|
+
request_id: string;
|
|
23
|
+
customer_cost_usd: number;
|
|
24
|
+
}[];
|
|
25
|
+
scope: string;
|
|
26
|
+
limitation: string;
|
|
27
|
+
}>;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { request } from "./internal/http.js";
|
|
5
|
+
import { CallCostResponseSchema } from "./internal/reporting-contracts.js";
|
|
6
|
+
import { resolveProject } from "./internal/projects.js";
|
|
7
|
+
import { resolveWorkload } from "./internal/workloads.js";
|
|
8
|
+
import { exportCapturesByRequestIds } from "./commands/captures.js";
|
|
9
|
+
const tokenKeys = ["input_tokens", "output_tokens", "cache_read_input_tokens", "cache_creation_input_tokens"];
|
|
10
|
+
const UsageSchema = z.object(Object.fromEntries(tokenKeys.map(key => [key, z.number().int().nonnegative()])));
|
|
11
|
+
const emptyUsage = () => Object.fromEntries(tokenKeys.map(key => [key, 0]));
|
|
12
|
+
export function readClaudeEvidence(files, sessionId) {
|
|
13
|
+
const messageIds = new Set();
|
|
14
|
+
const results = new Set();
|
|
15
|
+
const usage = emptyUsage();
|
|
16
|
+
for (const file of files) {
|
|
17
|
+
let resultFound = false;
|
|
18
|
+
for (const line of readFileSync(file, "utf8").split("\n").filter(line => line.trim())) {
|
|
19
|
+
let row;
|
|
20
|
+
try {
|
|
21
|
+
row = JSON.parse(line);
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
throw new Error("Invalid transcript JSON; raw content omitted.");
|
|
25
|
+
}
|
|
26
|
+
if (row.session_id !== sessionId)
|
|
27
|
+
throw new Error("Transcript contains a different or missing session ID.");
|
|
28
|
+
if (row.type === "assistant") {
|
|
29
|
+
messageIds.add(z.string().min(1).max(256).parse(row.message?.id));
|
|
30
|
+
}
|
|
31
|
+
if (row.type === "result") {
|
|
32
|
+
if (row.is_error || row.subtype !== "success")
|
|
33
|
+
throw new Error("Transcript contains an unsuccessful result; reconcile failures separately.");
|
|
34
|
+
const id = z.string().min(1).parse(row.uuid);
|
|
35
|
+
if (results.has(id))
|
|
36
|
+
throw new Error("Repeated transcript result would double-count usage.");
|
|
37
|
+
results.add(id);
|
|
38
|
+
const parsed = UsageSchema.parse(row.usage);
|
|
39
|
+
for (const key of tokenKeys)
|
|
40
|
+
usage[key] += parsed[key];
|
|
41
|
+
resultFound = true;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (!resultFound)
|
|
45
|
+
throw new Error("Each transcript must contain a completed result.");
|
|
46
|
+
}
|
|
47
|
+
if (!messageIds.size)
|
|
48
|
+
throw new Error("No assistant message IDs to reconcile.");
|
|
49
|
+
return { messageIds: [...messageIds], usage, results: results.size };
|
|
50
|
+
}
|
|
51
|
+
export function verifySessionCapture(value, session, requestId) {
|
|
52
|
+
const capture = z.object({ request_id: z.string(), request_environment: z.string(), tags: z.record(z.string(), z.string()), customer_request_body: z.unknown(), response_body: z.unknown() }).parse(value);
|
|
53
|
+
if (capture.request_id !== requestId || capture.request_environment !== session.environment)
|
|
54
|
+
throw new Error("Capture identity or environment mismatch.");
|
|
55
|
+
const expected = { run_id: session.session_id, repository: session.repository, branch: session.branch, base_commit: session.base_commit, harness: "claude-code" };
|
|
56
|
+
for (const [key, expectedValue] of Object.entries(expected)) {
|
|
57
|
+
if (capture.tags[key] !== expectedValue)
|
|
58
|
+
throw new Error(`Capture attribution mismatch: ${key}.`);
|
|
59
|
+
}
|
|
60
|
+
if (!capture.customer_request_body || !capture.response_body)
|
|
61
|
+
throw new Error("Capture is missing request or response content.");
|
|
62
|
+
}
|
|
63
|
+
export async function reconcileClaudeSession(session, transcripts, out) {
|
|
64
|
+
const evidence = readClaudeEvidence(transcripts, session.session_id);
|
|
65
|
+
const project = await resolveProject({ org: session.org, project: session.project });
|
|
66
|
+
if (project.auth.gatewayUrl !== session.gateway_url)
|
|
67
|
+
throw new Error("Gateway changed since session launch.");
|
|
68
|
+
const workload = await resolveWorkload(project, session.workload);
|
|
69
|
+
const costs = [];
|
|
70
|
+
const seen = new Set();
|
|
71
|
+
const usage = emptyUsage();
|
|
72
|
+
for (const id of evidence.messageIds) {
|
|
73
|
+
const res = await request({ url: `/admin/v1/orgs/${encodeURIComponent(session.org)}/calls/${encodeURIComponent(id)}/cost`, orgId: session.org }, CallCostResponseSchema);
|
|
74
|
+
const cost = res.data;
|
|
75
|
+
if (cost.org_id !== session.org || cost.project_id !== project.projectId || cost.workload_id !== workload.id)
|
|
76
|
+
throw new Error("Cost record scope mismatch.");
|
|
77
|
+
if (seen.has(cost.request_id))
|
|
78
|
+
throw new Error("Multiple message IDs resolved to one request; refusing ambiguous attribution.");
|
|
79
|
+
seen.add(cost.request_id);
|
|
80
|
+
if (cost.pricing_status !== "priced" || cost.coverage.data_completeness !== 1 || cost.coverage.known_gaps.length)
|
|
81
|
+
throw new Error("Pricing is incomplete; retry after gateway pricing catches up.");
|
|
82
|
+
if (!Number.isFinite(cost.customer_cost_usd) || cost.customer_cost_usd < 0)
|
|
83
|
+
throw new Error("Invalid customer cost.");
|
|
84
|
+
for (const key of tokenKeys)
|
|
85
|
+
usage[key] += cost.tokens[key];
|
|
86
|
+
costs.push({ request_id: cost.request_id, customer_cost_usd: cost.customer_cost_usd });
|
|
87
|
+
}
|
|
88
|
+
for (const key of tokenKeys) {
|
|
89
|
+
if (usage[key] !== evidence.usage[key])
|
|
90
|
+
throw new Error(`Gateway and transcript usage differ for ${key}; reconciliation is incomplete.`);
|
|
91
|
+
}
|
|
92
|
+
const batch = await exportCapturesByRequestIds({ requestIds: [...seen], outputDirectory: out, includePayload: true, concurrency: 4, retries: 2, resume: false, orgId: session.org, projectId: project.projectId, workloadId: workload.id });
|
|
93
|
+
if (!batch.ok)
|
|
94
|
+
throw new Error("Capture export is incomplete.");
|
|
95
|
+
for (const id of seen) {
|
|
96
|
+
let capture;
|
|
97
|
+
try {
|
|
98
|
+
capture = JSON.parse(readFileSync(join(out, `${encodeURIComponent(id)}.payload.json`), "utf8"));
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
throw new Error("Cannot read exported capture JSON; raw content omitted.");
|
|
102
|
+
}
|
|
103
|
+
verifySessionCapture(capture, session, id);
|
|
104
|
+
}
|
|
105
|
+
return { session_id: session.session_id, verified_at: new Date().toISOString(), requests: seen.size, verified_captures: seen.size, tokens: usage, customer_cost_usd: costs.reduce((sum, row) => sum + row.customer_cost_usd, 0), costs, scope: "successful requests represented in the supplied completed Claude stream-json transcripts", limitation: "Does not enumerate background traffic, failures, or omitted invocations; compare gateway session inventory before claiming full-session coverage." };
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=claude-reconciliation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-reconciliation.js","sourceRoot":"","sources":["../src/claude-reconciliation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAGpE,MAAM,SAAS,GAAG,CAAC,cAAc,EAAE,eAAe,EAAE,yBAAyB,EAAE,6BAA6B,CAAU,CAA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OAAO,CAAC;QACZ,IAAI,CAAC;YAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,kBAAkB,CAAC,EAAE,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;QAAC,CAAC;QACxG,MAAM,CAAC;YAAC,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;QAAC,CAAC;QACrF,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,iBAAiB,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,0FAA0F,EAAE,UAAU,EAAE,mJAAmJ,EAAE,CAAC;AAC/e,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { ClaudeSessionSchema } from "./claude.js";
|
|
4
|
+
export declare function verifyClaudePullRequest(session: z.infer<typeof ClaudeSessionSchema>, value: unknown): {
|
|
5
|
+
session_id: string;
|
|
6
|
+
repository: string;
|
|
7
|
+
branch: string;
|
|
8
|
+
base_commit: string;
|
|
9
|
+
head_commit: string;
|
|
10
|
+
pull_request: string;
|
|
11
|
+
state: "OPEN" | "CLOSED" | "MERGED";
|
|
12
|
+
merged_at: string | null;
|
|
13
|
+
merge_commit: string | null;
|
|
14
|
+
verified_at: string;
|
|
15
|
+
attribution: "explicit-session-branch";
|
|
16
|
+
};
|
|
17
|
+
export declare function resolveClaudePullRequest(session: z.infer<typeof ClaudeSessionSchema>, number?: string): {
|
|
18
|
+
session_id: string;
|
|
19
|
+
repository: string;
|
|
20
|
+
branch: string;
|
|
21
|
+
base_commit: string;
|
|
22
|
+
head_commit: string;
|
|
23
|
+
pull_request: string;
|
|
24
|
+
state: "OPEN" | "CLOSED" | "MERGED";
|
|
25
|
+
merged_at: string | null;
|
|
26
|
+
merge_commit: string | null;
|
|
27
|
+
verified_at: string;
|
|
28
|
+
attribution: "explicit-session-branch";
|
|
29
|
+
};
|
|
30
|
+
export declare function registerClaudeSessionCommand(program: Command): void;
|