agent-session-inspector 0.1.7 → 0.1.8
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/VERSION +1 -1
- package/app/.next/BUILD_ID +1 -1
- package/app/.next/app-path-routes-manifest.json +1 -0
- package/app/.next/build-manifest.json +3 -3
- package/app/.next/prerender-manifest.json +3 -3
- package/app/.next/required-server-files.json +1 -1
- package/app/.next/routes-manifest.json +9 -0
- package/app/.next/server/app/_global-error.html +1 -1
- package/app/.next/server/app/_global-error.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_not-found.html +1 -1
- package/app/.next/server/app/_not-found.rsc +2 -2
- package/app/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/api/analytics/route.js +2 -1
- package/app/.next/server/app/api/analytics/route.js.nft.json +1 -1
- package/app/.next/server/app/api/logs/route.js +2 -1
- package/app/.next/server/app/api/logs/route.js.nft.json +1 -1
- package/app/.next/server/app/api/pricing/route.js +2 -1
- package/app/.next/server/app/api/pricing/route.js.nft.json +1 -1
- package/app/.next/server/app/api/providers/route.js +2 -1
- package/app/.next/server/app/api/providers/route.js.nft.json +1 -1
- package/app/.next/server/app/api/search/route.js +3 -2
- package/app/.next/server/app/api/search/route.js.nft.json +1 -1
- package/app/.next/server/app/api/sessions/[provider]/[id]/record/route/app-paths-manifest.json +3 -0
- package/app/.next/server/app/api/sessions/[provider]/[id]/record/route/build-manifest.json +12 -0
- package/app/.next/server/app/api/sessions/[provider]/[id]/record/route/server-reference-manifest.json +4 -0
- package/app/.next/server/app/api/sessions/[provider]/[id]/record/route.js +8 -0
- package/app/.next/server/app/api/sessions/[provider]/[id]/record/route.js.map +5 -0
- package/app/.next/server/app/api/sessions/[provider]/[id]/record/route.js.nft.json +1 -0
- package/app/.next/server/app/api/sessions/[provider]/[id]/record/route_client-reference-manifest.js +3 -0
- package/app/.next/server/app/api/sessions/[provider]/[id]/reveal/route.js +2 -1
- package/app/.next/server/app/api/sessions/[provider]/[id]/reveal/route.js.nft.json +1 -1
- package/app/.next/server/app/api/sessions/[provider]/[id]/route.js +2 -1
- package/app/.next/server/app/api/sessions/[provider]/[id]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/sessions/route.js +2 -1
- package/app/.next/server/app/api/sessions/route.js.nft.json +1 -1
- package/app/.next/server/app/index.html +1 -1
- package/app/.next/server/app/index.rsc +3 -3
- package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +3 -3
- package/app/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/app/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/page.js.nft.json +1 -1
- package/app/.next/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/sessions/[provider]/[id]/page.js.nft.json +1 -1
- package/app/.next/server/app/sessions/[provider]/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app-paths-manifest.json +1 -0
- package/app/.next/server/chunks/1oeh_server_app_api_sessions_[provider]_[id]_record_route_actions_13lvgh0.js +3 -0
- package/app/.next/server/chunks/[externals]__0xll52b._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__014br-h._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__03bee2l._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__093lyxv._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__0co499t._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__0ne74op._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__0p_hyq8._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__0ryrg2h._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__0uv5tnc._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__0yxic1z._.js +3 -3
- package/app/.next/server/chunks/[root-of-the-server]__1lfc-ga._.js +3 -0
- package/app/.next/server/chunks/[root-of-the-server]__1n_sepq._.js +3 -0
- package/app/.next/server/chunks/ssr/_0o294sf._.js +1 -1
- package/app/.next/server/chunks/ssr/_0wfo2z0._.js +1 -1
- package/app/.next/server/chunks/ssr/src_app_sessions_[provider]_[id]_page_tsx_0uf635h._.js +3 -3
- package/app/.next/server/middleware-build-manifest.js +3 -3
- package/app/.next/server/pages/404.html +1 -1
- package/app/.next/server/pages/500.html +1 -1
- package/app/.next/server/server-reference-manifest.js +1 -1
- package/app/.next/server/server-reference-manifest.json +1 -1
- package/app/.next/static/chunks/1lmw5sxsr57p6.css +1 -0
- package/app/.next/static/chunks/{33valh9_p24ah.js → 1nuneih_2_kul.js} +1 -1
- package/app/.next/static/chunks/21ckxredfe3pr.js +6 -0
- package/app/package.json +1 -1
- package/app/server.js +1 -1
- package/cli/cli.mjs +159 -52
- package/package.json +1 -1
- package/app/.next/server/chunks/[root-of-the-server]__0dyq0rc._.js +0 -3
- package/app/.next/server/chunks/[root-of-the-server]__0kgkqhn._.js +0 -3
- package/app/.next/server/chunks/[root-of-the-server]__10p8y9z._.js +0 -3
- package/app/.next/server/chunks/[root-of-the-server]__1cceere._.js +0 -3
- package/app/.next/server/chunks/[root-of-the-server]__1eclfq8._.js +0 -3
- package/app/.next/server/chunks/[root-of-the-server]__1lz20wm._.js +0 -3
- package/app/.next/server/chunks/[root-of-the-server]__1zdh1mi._.js +0 -3
- package/app/.next/server/chunks/[root-of-the-server]__20epvou._.js +0 -3
- package/app/.next/static/chunks/0slbmtcht4v2w.css +0 -1
- package/app/.next/static/chunks/279fmcw99x0e9.js +0 -6
- package/app/AGENTS.md +0 -9
- package/app/CLAUDE.md +0 -1
- package/app/CONTRIBUTING.md +0 -90
- package/app/Dockerfile +0 -34
- package/app/LICENSE +0 -21
- package/app/README.md +0 -369
- package/app/bin/agent-session-inspector.mjs +0 -185
- package/app/components.json +0 -25
- package/app/docs/screenshots/analytics-dark.png +0 -0
- package/app/docs/screenshots/analytics.png +0 -0
- package/app/docs/screenshots/request-table.png +0 -0
- package/app/docs/screenshots/session-overview-dark.png +0 -0
- package/app/docs/screenshots/session-overview.png +0 -0
- package/app/docs/screenshots/sessions-dark.png +0 -0
- package/app/docs/screenshots/sessions.png +0 -0
- package/app/docs/screenshots/timeline-dark.png +0 -0
- package/app/docs/screenshots/timeline.png +0 -0
- package/app/docs/screenshots/token-optimizer-dark.png +0 -0
- package/app/docs/screenshots/token-optimizer.png +0 -0
- package/app/docs/social-preview.png +0 -0
- package/app/eslint.config.mjs +0 -20
- package/app/install.sh +0 -85
- package/app/next.config.ts +0 -17
- package/app/pnpm-lock.yaml +0 -7031
- package/app/pnpm-workspace.yaml +0 -3
- package/app/postcss.config.mjs +0 -7
- package/app/scripts/build-cli.mjs +0 -26
- package/app/scripts/demo-data.mjs +0 -335
- package/app/scripts/deploy-docker.sh +0 -71
- package/app/scripts/package-release.sh +0 -86
- package/app/tsconfig.json +0 -34
- /package/app/.next/static/{ji6govOHS2spXukBPOyFL → muuOFZsnyOfIG_5aUuqFV}/_buildManifest.js +0 -0
- /package/app/.next/static/{ji6govOHS2spXukBPOyFL → muuOFZsnyOfIG_5aUuqFV}/_clientMiddlewareManifest.js +0 -0
- /package/app/.next/static/{ji6govOHS2spXukBPOyFL → muuOFZsnyOfIG_5aUuqFV}/_ssgManifest.js +0 -0
package/cli/cli.mjs
CHANGED
|
@@ -3329,6 +3329,10 @@ function readJsonl(filePath) {
|
|
|
3329
3329
|
}
|
|
3330
3330
|
return out;
|
|
3331
3331
|
}
|
|
3332
|
+
function readJsonlRecord(filePath, index) {
|
|
3333
|
+
if (!/^\d+$/.test(index)) return null;
|
|
3334
|
+
return readJsonl(filePath)[Number(index)] ?? null;
|
|
3335
|
+
}
|
|
3332
3336
|
function walkFiles(dir, match, maxDepth = 6) {
|
|
3333
3337
|
if (maxDepth < 0) return [];
|
|
3334
3338
|
const out = [];
|
|
@@ -3377,12 +3381,16 @@ function findGitRoot(cwd) {
|
|
|
3377
3381
|
gitRoots.set(cwd, root);
|
|
3378
3382
|
return root;
|
|
3379
3383
|
}
|
|
3384
|
+
function runtimePlatform() {
|
|
3385
|
+
return globalThis.process?.platform ?? "linux";
|
|
3386
|
+
}
|
|
3380
3387
|
function appDataDir(appName) {
|
|
3381
3388
|
const home = os.homedir();
|
|
3382
|
-
|
|
3389
|
+
const platform = runtimePlatform();
|
|
3390
|
+
if (platform === "darwin") {
|
|
3383
3391
|
return path.join(home, "Library", "Application Support", appName);
|
|
3384
3392
|
}
|
|
3385
|
-
if (
|
|
3393
|
+
if (platform === "win32") {
|
|
3386
3394
|
return path.join(process.env.APPDATA ?? path.join(home, "AppData", "Roaming"), appName);
|
|
3387
3395
|
}
|
|
3388
3396
|
return path.join(process.env.XDG_CONFIG_HOME ?? path.join(home, ".config"), appName);
|
|
@@ -3399,6 +3407,86 @@ function capText(value) {
|
|
|
3399
3407
|
if (text.length <= TEXT_CAP) return { text, chars: text.length, truncated: false };
|
|
3400
3408
|
return { text: `${text.slice(0, TEXT_CAP)}\u2026`, chars: text.length, truncated: true };
|
|
3401
3409
|
}
|
|
3410
|
+
var TEXT_PARTS = /^(text|input_text|output_text)$/;
|
|
3411
|
+
var DATA_URI = /^data:([^;,]+)?(?:;[^,]*)?,/;
|
|
3412
|
+
function base64Bytes(data) {
|
|
3413
|
+
const padding = data.endsWith("==") ? 2 : data.endsWith("=") ? 1 : 0;
|
|
3414
|
+
return Math.max(0, Math.floor(data.length * 3 / 4) - padding);
|
|
3415
|
+
}
|
|
3416
|
+
function imageOf(part) {
|
|
3417
|
+
if (part.type === "image") {
|
|
3418
|
+
const source = part.source ?? {};
|
|
3419
|
+
return {
|
|
3420
|
+
mediaType: source.media_type,
|
|
3421
|
+
bytes: typeof source.data === "string" ? base64Bytes(source.data) : void 0
|
|
3422
|
+
};
|
|
3423
|
+
}
|
|
3424
|
+
if (part.type === "input_image" || part.type === "image_url") {
|
|
3425
|
+
const url = part.image_url;
|
|
3426
|
+
const href = typeof url === "string" ? url : url?.url ?? "";
|
|
3427
|
+
const uri = DATA_URI.exec(href);
|
|
3428
|
+
if (!uri) return {};
|
|
3429
|
+
return { mediaType: uri[1], bytes: base64Bytes(href.slice(uri[0].length)) };
|
|
3430
|
+
}
|
|
3431
|
+
return null;
|
|
3432
|
+
}
|
|
3433
|
+
function indentJson(text) {
|
|
3434
|
+
const trimmed = text.trim();
|
|
3435
|
+
if (!/^[{[]/.test(trimmed) || !/[}\]]$/.test(trimmed)) return null;
|
|
3436
|
+
const parsed = parseJson(trimmed);
|
|
3437
|
+
return parsed && typeof parsed === "object" ? JSON.stringify(parsed, null, 2) : null;
|
|
3438
|
+
}
|
|
3439
|
+
function toolResult(raw) {
|
|
3440
|
+
const images = [];
|
|
3441
|
+
let format = "text";
|
|
3442
|
+
let text;
|
|
3443
|
+
let chars;
|
|
3444
|
+
if (typeof raw === "string" || raw == null) {
|
|
3445
|
+
text = raw ?? "";
|
|
3446
|
+
chars = text.length;
|
|
3447
|
+
} else if (Array.isArray(raw)) {
|
|
3448
|
+
const texts = [];
|
|
3449
|
+
for (const part of raw) {
|
|
3450
|
+
if (typeof part === "string") {
|
|
3451
|
+
texts.push(part);
|
|
3452
|
+
continue;
|
|
3453
|
+
}
|
|
3454
|
+
const p = part ?? {};
|
|
3455
|
+
const image = imageOf(p);
|
|
3456
|
+
if (image) images.push(image);
|
|
3457
|
+
else if (typeof p.text === "string" && (!p.type || TEXT_PARTS.test(String(p.type)))) texts.push(p.text);
|
|
3458
|
+
else if (p.type === "tool_reference") texts.push(`[tool reference: ${String(p.tool_name ?? "")}]`);
|
|
3459
|
+
else texts.push(JSON.stringify(p));
|
|
3460
|
+
}
|
|
3461
|
+
text = texts.join("\n");
|
|
3462
|
+
chars = text.length;
|
|
3463
|
+
} else {
|
|
3464
|
+
text = JSON.stringify(raw, null, 2);
|
|
3465
|
+
chars = JSON.stringify(raw).length;
|
|
3466
|
+
format = "json";
|
|
3467
|
+
}
|
|
3468
|
+
if (format === "text") {
|
|
3469
|
+
const indented = indentJson(text);
|
|
3470
|
+
if (indented !== null) {
|
|
3471
|
+
text = indented;
|
|
3472
|
+
format = "json";
|
|
3473
|
+
}
|
|
3474
|
+
}
|
|
3475
|
+
const capped = capText(text);
|
|
3476
|
+
return {
|
|
3477
|
+
result: {
|
|
3478
|
+
content: capped.text,
|
|
3479
|
+
format,
|
|
3480
|
+
...images.length > 0 ? { images } : {}
|
|
3481
|
+
},
|
|
3482
|
+
resultChars: chars,
|
|
3483
|
+
truncated: capped.truncated
|
|
3484
|
+
};
|
|
3485
|
+
}
|
|
3486
|
+
function argumentChars(args) {
|
|
3487
|
+
if (typeof args === "string") return args.length;
|
|
3488
|
+
return args == null ? 0 : JSON.stringify(args)?.length ?? 0;
|
|
3489
|
+
}
|
|
3402
3490
|
function isoFromMs(ms) {
|
|
3403
3491
|
return typeof ms === "number" && Number.isFinite(ms) && ms > 0 ? new Date(ms).toISOString() : "";
|
|
3404
3492
|
}
|
|
@@ -3978,9 +4066,18 @@ function normalize(raw) {
|
|
|
3978
4066
|
const data = { ...raw.data };
|
|
3979
4067
|
if (raw.type === "tool.execution_complete" || raw.type === "external_tool.completed") {
|
|
3980
4068
|
const result = data.result;
|
|
3981
|
-
|
|
4069
|
+
const error = data.error?.message;
|
|
4070
|
+
const shaped = toolResult(result?.content ?? error);
|
|
4071
|
+
const detail = result?.detailedContent;
|
|
4072
|
+
if (typeof detail === "string" && detail.trim() && detail !== result?.content) {
|
|
4073
|
+
shaped.result.detail = capText(detail).text;
|
|
4074
|
+
}
|
|
4075
|
+
Object.assign(data, shaped);
|
|
3982
4076
|
data.toolName = data.toolName ?? data.name;
|
|
3983
4077
|
}
|
|
4078
|
+
if (raw.type === "tool.execution_start" || raw.type === "external_tool.requested") {
|
|
4079
|
+
data.argumentChars = argumentChars(data.arguments);
|
|
4080
|
+
}
|
|
3984
4081
|
if (raw.type === "session.shutdown") {
|
|
3985
4082
|
const usage = usageFromShutdown(data);
|
|
3986
4083
|
data.sessionTotals = {
|
|
@@ -4000,7 +4097,7 @@ function normalize(raw) {
|
|
|
4000
4097
|
}
|
|
4001
4098
|
function readEvents(id) {
|
|
4002
4099
|
const eventsPath = path3.join(SESSION_STATE_DIR, id, "events.jsonl");
|
|
4003
|
-
const events = readJsonl(eventsPath).
|
|
4100
|
+
const events = readJsonl(eventsPath).map((e, index) => e && typeof e.type === "string" ? { ...e, source: String(index) } : null).filter((e) => e !== null).map(normalize);
|
|
4004
4101
|
const lastShutdown = events.findLast((e) => e.type === "session.shutdown");
|
|
4005
4102
|
if (lastShutdown) {
|
|
4006
4103
|
lastShutdown.data.billedUsage = billedUsageFromShutdown(lastShutdown.data);
|
|
@@ -4085,6 +4182,10 @@ var copilotProvider = {
|
|
|
4085
4182
|
storagePath: sessionDir
|
|
4086
4183
|
};
|
|
4087
4184
|
},
|
|
4185
|
+
getRecord(id, source) {
|
|
4186
|
+
if (id.includes("/") || id.includes("..")) return null;
|
|
4187
|
+
return readJsonlRecord(path3.join(SESSION_STATE_DIR, id, "events.jsonl"), source);
|
|
4188
|
+
},
|
|
4088
4189
|
listLogs() {
|
|
4089
4190
|
return safeReaddir(LOGS_DIR).filter((f) => f.endsWith(".log")).map((name) => {
|
|
4090
4191
|
const p = path3.join(LOGS_DIR, name);
|
|
@@ -4298,16 +4399,19 @@ function parseClaudeTranscript(filePath, provider = "claude", id = path4.basenam
|
|
|
4298
4399
|
let seq2 = 0;
|
|
4299
4400
|
const hasOwnRecords = records.some((rec) => rec.sessionId === id);
|
|
4300
4401
|
let inherited = false;
|
|
4402
|
+
let recordIndex = 0;
|
|
4301
4403
|
const push = (timestamp2, type2, data, uuid, parentUuid) => {
|
|
4302
4404
|
events.push({
|
|
4303
4405
|
type: type2,
|
|
4304
4406
|
data: inherited ? { ...data, inherited: true } : data,
|
|
4305
4407
|
id: uuid ? `${uuid}:${seq2++}` : `claude-${seq2++}`,
|
|
4306
4408
|
timestamp: timestamp2,
|
|
4307
|
-
parentId: parentUuid ?? null
|
|
4409
|
+
parentId: parentUuid ?? null,
|
|
4410
|
+
source: String(recordIndex)
|
|
4308
4411
|
});
|
|
4309
4412
|
};
|
|
4310
|
-
for (const rec of records) {
|
|
4413
|
+
for (const [index, rec] of records.entries()) {
|
|
4414
|
+
recordIndex = index;
|
|
4311
4415
|
const ts = rec.timestamp ?? lastTimestamp;
|
|
4312
4416
|
if (rec.timestamp) {
|
|
4313
4417
|
if (!firstTimestamp) firstTimestamp = rec.timestamp;
|
|
@@ -4448,10 +4552,6 @@ ${prompt}` : prompt
|
|
|
4448
4552
|
if (block.type === "text") {
|
|
4449
4553
|
pushText(block.text);
|
|
4450
4554
|
} else if (block.type === "tool_result") {
|
|
4451
|
-
const raw = block.content ?? rec.toolUseResult;
|
|
4452
|
-
const { text, chars, truncated } = capText(
|
|
4453
|
-
typeof raw === "string" ? raw : raw
|
|
4454
|
-
);
|
|
4455
4555
|
const toolName = toolNames.get(block.tool_use_id ?? "") ?? "tool";
|
|
4456
4556
|
push(
|
|
4457
4557
|
ts,
|
|
@@ -4460,9 +4560,7 @@ ${prompt}` : prompt
|
|
|
4460
4560
|
toolName,
|
|
4461
4561
|
toolCallId: block.tool_use_id,
|
|
4462
4562
|
success: block.is_error !== true,
|
|
4463
|
-
|
|
4464
|
-
truncated,
|
|
4465
|
-
result: { content: text }
|
|
4563
|
+
...toolResult(block.content ?? rec.toolUseResult)
|
|
4466
4564
|
},
|
|
4467
4565
|
rec.uuid,
|
|
4468
4566
|
rec.parentUuid
|
|
@@ -4535,6 +4633,7 @@ ${prompt}` : prompt
|
|
|
4535
4633
|
toolName: name,
|
|
4536
4634
|
toolCallId: block.id,
|
|
4537
4635
|
arguments: block.input ?? {},
|
|
4636
|
+
argumentChars: argumentChars(block.input),
|
|
4538
4637
|
model: message.model,
|
|
4539
4638
|
...attachUsage()
|
|
4540
4639
|
},
|
|
@@ -4640,6 +4739,10 @@ var claudeProvider = {
|
|
|
4640
4739
|
storagePath: found.filePath
|
|
4641
4740
|
};
|
|
4642
4741
|
},
|
|
4742
|
+
getRecord(id, source) {
|
|
4743
|
+
const found = findSessionFile(id);
|
|
4744
|
+
return found ? readJsonlRecord(found.filePath, source) : null;
|
|
4745
|
+
},
|
|
4643
4746
|
listLogs() {
|
|
4644
4747
|
return [];
|
|
4645
4748
|
},
|
|
@@ -4703,16 +4806,19 @@ function parseFile2(filePath) {
|
|
|
4703
4806
|
let billedOutput = 0;
|
|
4704
4807
|
let localModel = false;
|
|
4705
4808
|
const toolNames = /* @__PURE__ */ new Map();
|
|
4809
|
+
let lineIndex = 0;
|
|
4706
4810
|
const push = (timestamp2, type2, data) => {
|
|
4707
4811
|
events.push({
|
|
4708
4812
|
type: type2,
|
|
4709
4813
|
data,
|
|
4710
4814
|
id: `codex-${seq2++}`,
|
|
4711
4815
|
timestamp: timestamp2,
|
|
4712
|
-
parentId: null
|
|
4816
|
+
parentId: null,
|
|
4817
|
+
source: String(lineIndex)
|
|
4713
4818
|
});
|
|
4714
4819
|
};
|
|
4715
|
-
for (const line of lines) {
|
|
4820
|
+
for (const [index, line] of lines.entries()) {
|
|
4821
|
+
lineIndex = index;
|
|
4716
4822
|
const ts = line.timestamp ?? lastTimestamp;
|
|
4717
4823
|
if (line.timestamp) {
|
|
4718
4824
|
if (!firstTimestamp) firstTimestamp = line.timestamp;
|
|
@@ -4916,14 +5022,14 @@ function parseFile2(filePath) {
|
|
|
4916
5022
|
break;
|
|
4917
5023
|
case "mcp_tool_call_end": {
|
|
4918
5024
|
const invocation = p.invocation;
|
|
4919
|
-
const
|
|
5025
|
+
const outcome = p.result;
|
|
4920
5026
|
push(ts, "external_tool.completed", {
|
|
4921
5027
|
toolName: invocation ? `${invocation.server}__${invocation.tool}` : "mcp tool",
|
|
4922
5028
|
toolCallId: p.call_id,
|
|
4923
5029
|
arguments: invocation?.arguments,
|
|
4924
|
-
|
|
4925
|
-
success: Boolean(
|
|
4926
|
-
|
|
5030
|
+
argumentChars: argumentChars(invocation?.arguments),
|
|
5031
|
+
success: Boolean(outcome?.Ok),
|
|
5032
|
+
...toolResult(outcome?.Ok?.content ?? outcome?.Ok ?? outcome?.Err ?? p.result)
|
|
4927
5033
|
});
|
|
4928
5034
|
break;
|
|
4929
5035
|
}
|
|
@@ -5019,21 +5125,20 @@ function parseFile2(filePath) {
|
|
|
5019
5125
|
toolName,
|
|
5020
5126
|
toolCallId: p.call_id,
|
|
5021
5127
|
status: p.status,
|
|
5022
|
-
arguments: args
|
|
5128
|
+
arguments: args,
|
|
5129
|
+
argumentChars: argumentChars(rawArgs)
|
|
5023
5130
|
});
|
|
5024
5131
|
break;
|
|
5025
5132
|
}
|
|
5026
5133
|
case "custom_tool_call_output":
|
|
5027
5134
|
case "function_call_output":
|
|
5028
5135
|
case "local_shell_call_output": {
|
|
5029
|
-
const
|
|
5136
|
+
const output = toolResult(p.output);
|
|
5030
5137
|
push(ts, "tool.execution_complete", {
|
|
5031
5138
|
toolName: toolNames.get(String(p.call_id)) ?? "exec",
|
|
5032
5139
|
toolCallId: p.call_id,
|
|
5033
|
-
success: !FAILED_EXIT.test(
|
|
5034
|
-
|
|
5035
|
-
truncated: capped.truncated,
|
|
5036
|
-
result: { content: capped.text }
|
|
5140
|
+
success: !FAILED_EXIT.test(output.result.content),
|
|
5141
|
+
...output
|
|
5037
5142
|
});
|
|
5038
5143
|
break;
|
|
5039
5144
|
}
|
|
@@ -5107,6 +5212,11 @@ var codexProvider = {
|
|
|
5107
5212
|
storagePath: filePath
|
|
5108
5213
|
};
|
|
5109
5214
|
},
|
|
5215
|
+
getRecord(id, source) {
|
|
5216
|
+
if (id.includes("/") || id.includes("..")) return null;
|
|
5217
|
+
const filePath = rolloutFiles().find((f) => path5.basename(f).endsWith(`-${id}.jsonl`));
|
|
5218
|
+
return filePath ? readJsonlRecord(filePath, source) : null;
|
|
5219
|
+
},
|
|
5110
5220
|
listLogs() {
|
|
5111
5221
|
return [];
|
|
5112
5222
|
},
|
|
@@ -5243,25 +5353,24 @@ function parseFile3(filePath) {
|
|
|
5243
5353
|
const detail = part.toolSpecificData;
|
|
5244
5354
|
if (call?.at && call.at > at) at = call.at;
|
|
5245
5355
|
const toolName = call?.name ?? part.toolId ?? "tool";
|
|
5356
|
+
const args = parseJson(call?.arguments) ?? (detail?.kind === "terminal" ? { command: detail.commandLine?.original } : detail?.kind === "subagent" ? { description: detail.description, agent: detail.agentName, prompt: detail.prompt } : { description: textOf(part.invocationMessage) });
|
|
5246
5357
|
push(at, "tool.execution_start", {
|
|
5247
5358
|
toolName,
|
|
5248
5359
|
toolCallId: callId,
|
|
5249
|
-
arguments:
|
|
5360
|
+
arguments: args,
|
|
5361
|
+
argumentChars: argumentChars(call?.arguments ?? args),
|
|
5250
5362
|
model: requestModel
|
|
5251
5363
|
}, requestId);
|
|
5252
5364
|
const finishedAt = detail?.terminalCommandState?.timestamp;
|
|
5253
5365
|
if (finishedAt && finishedAt > at) at = finishedAt;
|
|
5254
5366
|
const exitCode = detail?.terminalCommandState?.exitCode;
|
|
5255
|
-
const { text, chars, truncated } = capText(
|
|
5256
|
-
callId && results.get(callId) || detail?.result || detail?.terminalCommandOutput?.text?.replace(ANSI, "") || textOf(part.pastTenseMessage)
|
|
5257
|
-
);
|
|
5258
5367
|
push(at, "tool.execution_complete", {
|
|
5259
5368
|
toolName,
|
|
5260
5369
|
toolCallId: callId,
|
|
5261
5370
|
success: typeof exitCode !== "number" || exitCode === 0,
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5371
|
+
...toolResult(
|
|
5372
|
+
callId && results.get(callId) || detail?.result || detail?.terminalCommandOutput?.text?.replace(ANSI, "") || textOf(part.pastTenseMessage)
|
|
5373
|
+
)
|
|
5265
5374
|
}, requestId);
|
|
5266
5375
|
} else if (EDIT_PARTS.has(part.kind)) {
|
|
5267
5376
|
const file = part.uri?.fsPath ?? part.uri?.path;
|
|
@@ -5499,6 +5608,10 @@ var coworkProvider = {
|
|
|
5499
5608
|
storagePath: session.descriptorPath.slice(0, -".json".length)
|
|
5500
5609
|
};
|
|
5501
5610
|
},
|
|
5611
|
+
getRecord(id, source) {
|
|
5612
|
+
const session = sessions().find((s) => s.id === id);
|
|
5613
|
+
return session ? readJsonlRecord(session.transcript, source) : null;
|
|
5614
|
+
},
|
|
5502
5615
|
listLogs() {
|
|
5503
5616
|
return [];
|
|
5504
5617
|
},
|
|
@@ -5652,20 +5765,16 @@ function parse(session, messages, parts) {
|
|
|
5652
5765
|
toolName,
|
|
5653
5766
|
toolCallId: part.callID,
|
|
5654
5767
|
arguments: args,
|
|
5768
|
+
argumentChars: argumentChars(state.input),
|
|
5655
5769
|
model: messageModel,
|
|
5656
5770
|
...takeUsage()
|
|
5657
5771
|
}, row.id);
|
|
5658
5772
|
if (state.status !== "completed" && state.status !== "error") break;
|
|
5659
|
-
const { text, chars, truncated } = capText(
|
|
5660
|
-
state.status === "error" ? state.error : state.output
|
|
5661
|
-
);
|
|
5662
5773
|
push(isoFromMs(state.time?.end) || ts, "tool.execution_complete", {
|
|
5663
5774
|
toolName,
|
|
5664
5775
|
toolCallId: part.callID,
|
|
5665
5776
|
success: state.status === "completed",
|
|
5666
|
-
|
|
5667
|
-
truncated,
|
|
5668
|
-
result: { content: text }
|
|
5777
|
+
...toolResult(state.status === "error" ? state.error : state.output)
|
|
5669
5778
|
}, row.id);
|
|
5670
5779
|
break;
|
|
5671
5780
|
}
|
|
@@ -5872,18 +5981,16 @@ function parse2(session, messages) {
|
|
|
5872
5981
|
toolName,
|
|
5873
5982
|
toolCallId,
|
|
5874
5983
|
arguments: args,
|
|
5984
|
+
argumentChars: argumentChars(call.function?.arguments),
|
|
5875
5985
|
model: session.model
|
|
5876
5986
|
});
|
|
5877
5987
|
}
|
|
5878
5988
|
} else if (message.role === "tool") {
|
|
5879
|
-
const { text, chars, truncated } = capText(content);
|
|
5880
5989
|
push(ts, "tool.execution_complete", {
|
|
5881
5990
|
toolName: message.tool_name ?? toolNames.get(message.tool_call_id ?? "") ?? "tool",
|
|
5882
5991
|
toolCallId: message.tool_call_id,
|
|
5883
5992
|
success: !toolFailed(content),
|
|
5884
|
-
|
|
5885
|
-
truncated,
|
|
5886
|
-
result: { content: text }
|
|
5993
|
+
...toolResult(content)
|
|
5887
5994
|
});
|
|
5888
5995
|
} else if (content) {
|
|
5889
5996
|
const { text, chars, truncated } = capText(content);
|
|
@@ -6076,7 +6183,7 @@ function parseFile4(filePath) {
|
|
|
6076
6183
|
let lastTimestamp = metadata.startTime ?? "";
|
|
6077
6184
|
const push = (timestamp2, type2, data, parentId) => {
|
|
6078
6185
|
if (timestamp2 > lastTimestamp) lastTimestamp = timestamp2;
|
|
6079
|
-
events.push({ type: type2, data, id: `${parentId}:${events.length}`, timestamp: timestamp2, parentId });
|
|
6186
|
+
events.push({ type: type2, data, id: `${parentId}:${events.length}`, timestamp: timestamp2, parentId, source: parentId });
|
|
6080
6187
|
};
|
|
6081
6188
|
for (const message of messages) {
|
|
6082
6189
|
const ts = message.timestamp ?? lastTimestamp;
|
|
@@ -6149,20 +6256,18 @@ function parseFile4(filePath) {
|
|
|
6149
6256
|
toolName,
|
|
6150
6257
|
toolCallId: call.id,
|
|
6151
6258
|
arguments: args,
|
|
6259
|
+
argumentChars: argumentChars(call.args),
|
|
6152
6260
|
model: message.model,
|
|
6153
6261
|
...takeUsage()
|
|
6154
6262
|
}, message.id);
|
|
6155
6263
|
if (!FINISHED.test(call.status ?? "")) continue;
|
|
6156
|
-
const result = capText(toolOutput(call));
|
|
6157
6264
|
push(callTime, "tool.execution_complete", {
|
|
6158
6265
|
toolName,
|
|
6159
6266
|
toolCallId: call.id,
|
|
6160
6267
|
// The user turning a call down is not the tool failing.
|
|
6161
6268
|
success: call.status !== "error",
|
|
6162
6269
|
cancelled: call.status === "cancelled" || void 0,
|
|
6163
|
-
|
|
6164
|
-
truncated: result.truncated,
|
|
6165
|
-
result: { content: result.text }
|
|
6270
|
+
...toolResult(toolOutput(call))
|
|
6166
6271
|
}, message.id);
|
|
6167
6272
|
}
|
|
6168
6273
|
if (Object.keys(usage).length > 0) {
|
|
@@ -6246,6 +6351,10 @@ var geminiProvider = {
|
|
|
6246
6351
|
storagePath: filePath
|
|
6247
6352
|
};
|
|
6248
6353
|
},
|
|
6354
|
+
getRecord(id, source) {
|
|
6355
|
+
const filePath = listAll3().find(({ meta }) => meta.id === id)?.filePath;
|
|
6356
|
+
return filePath && replay(filePath).messages.find((message) => message.id === source) || null;
|
|
6357
|
+
},
|
|
6249
6358
|
listLogs() {
|
|
6250
6359
|
return [];
|
|
6251
6360
|
},
|
|
@@ -6330,20 +6439,18 @@ function parseComposer(composer, bubbles) {
|
|
|
6330
6439
|
toolName: tool.name,
|
|
6331
6440
|
toolCallId: tool.toolCallId,
|
|
6332
6441
|
arguments: args,
|
|
6442
|
+
argumentChars: argumentChars(tool.rawArgs || tool.params),
|
|
6333
6443
|
model,
|
|
6334
6444
|
...takeUsage()
|
|
6335
6445
|
}, id);
|
|
6336
6446
|
if (FINISHED2.test(tool.status ?? "")) {
|
|
6337
|
-
const result = capText(tool.result);
|
|
6338
6447
|
push(isoFromMs(bubble.completedAtMs) || ts, "tool.execution_complete", {
|
|
6339
6448
|
toolName: tool.name,
|
|
6340
6449
|
toolCallId: tool.toolCallId,
|
|
6341
6450
|
// The user turning a call down is not the tool failing.
|
|
6342
6451
|
success: tool.status !== "error",
|
|
6343
6452
|
cancelled: tool.status === "cancelled" || void 0,
|
|
6344
|
-
|
|
6345
|
-
truncated: result.truncated,
|
|
6346
|
-
result: { content: result.text }
|
|
6453
|
+
...toolResult(tool.result)
|
|
6347
6454
|
}, id);
|
|
6348
6455
|
}
|
|
6349
6456
|
}
|
|
@@ -6478,7 +6585,7 @@ function parseTranscript2(filePath) {
|
|
|
6478
6585
|
const value = args[key];
|
|
6479
6586
|
if (typeof value === "string" && EDIT_TOOLS5.test(toolName)) files.add(value);
|
|
6480
6587
|
}
|
|
6481
|
-
push("tool.execution_start", { toolName, arguments: args }, index);
|
|
6588
|
+
push("tool.execution_start", { toolName, arguments: args, argumentChars: argumentChars(part.input) }, index);
|
|
6482
6589
|
continue;
|
|
6483
6590
|
}
|
|
6484
6591
|
if (part.type !== "text" || !part.text?.trim()) continue;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-session-inspector",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "See where a coding-agent session's tokens and dollars went: a local inspector for Claude Code, Codex, GitHub Copilot, Cursor, Gemini CLI, OpenCode and Hermes sessions, with a step-by-step timeline, per-step cost and analytics.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
module.exports=[22734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},20635,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/action-async-storage.external.js",()=>require("next/dist/server/app-render/action-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},59043,(e,t,r)=>{t.exports=e.x("next/dist/server/runtime-reacts.external.js",()=>require("next/dist/server/runtime-reacts.external.js"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},81111,(e,t,r)=>{t.exports=e.x("node:stream",()=>require("node:stream"))},46786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},68937,e=>{"use strict";var t=e.i(22734),r=e.i(46786),a=e.i(14747);function u(e){try{return t.default.readFileSync(e,"utf-8")}catch{return""}}function n(e){try{return t.default.readdirSync(e)}catch{return[]}}function c(e){try{return t.default.statSync(e)}catch{return null}}let i=new Map;function o(e){let t=r.default.homedir();return a.default.join(process.env.XDG_CONFIG_HOME??a.default.join(t,".config"),e)}let s=process.env.ASI_HOST_HOME,l=process.env.ASI_HOST_APP_DATA;e.s(["ON_HOST",0,!s,"appDataDir",0,o,"capText",0,function(e){let t="string"==typeof e?e:null==e?"":JSON.stringify(e);return t.length<=2e4?{text:t,chars:t.length,truncated:!1}:{text:`${t.slice(0,2e4)}…`,chars:t.length,truncated:!0}},"createFileCache",0,function(e){let t=new Map;return r=>{let a=c(r),u=a?`${a.mtimeMs}:${a.size}`:"missing",n=t.get(r);if(n&&n.key===u)return n.value;let i=e(r);return t.set(r,{key:u,value:i}),i}},"findGitRoot",0,function(e){let t=i.get(e);if(void 0!==t)return t;let n=r.default.homedir(),o=null;for(let t=a.default.resolve(e);t!==n&&t!==a.default.dirname(t);t=a.default.dirname(t)){let e=c(a.default.join(t,".git"));if(e){if(o=t,e.isFile()){let e=u(a.default.join(t,".git")).match(/^gitdir:\s*(.+)[\\/]\.git[\\/]worktrees[\\/][^\\/]+\s*$/m);e&&(o=a.default.resolve(t,e[1]))}break}}return i.set(e,o),o},"hostPath",0,function(e){if(!s)return e;for(let[t,u]of[[o(""),l],[r.default.homedir(),s]]){let r=a.default.relative(t,e);if(u&&!r.startsWith("..")&&!a.default.isAbsolute(r))return a.default.join(u,r)}return e},"isoFromMs",0,function(e){return"number"==typeof e&&Number.isFinite(e)&&e>0?new Date(e).toISOString():""},"parseJson",0,function(e){if("string"!=typeof e||!e)return null;try{return JSON.parse(e)}catch{return null}},"readJsonl",0,function(e){let t=u(e);if(!t)return[];let r=[];for(let e of t.split("\n"))if(e.trim())try{r.push(JSON.parse(e))}catch{}return r},"safeReadFile",0,u,"safeReaddir",0,n,"statOf",0,c,"tildePath",0,function(e){let t=r.default.homedir();return e.startsWith(t)?`~${e.slice(t.length)}`:e},"walkFiles",0,function e(t,r,u=6){if(u<0)return[];let i=[];for(let o of n(t)){let n=a.default.join(t,o),s=c(n);s&&(s.isDirectory()?i.push(...e(n,r,u-1)):r(o)&&i.push(n))}return i}])},2817,(e,t,r)=>{t.exports={"claude-fable-5-1":[{input:10,output:50,cacheRead:.25,cacheWrite:12.5,cacheWrite1h:20}],"claude-mythos-5-1":[{input:10,output:50,cacheRead:.25,cacheWrite:12.5,cacheWrite1h:20}],"claude-fable-5":[{input:10,output:50,cacheRead:1,cacheWrite:12.5,cacheWrite1h:20}],"claude-mythos-5":[{input:10,output:50,cacheRead:1,cacheWrite:12.5,cacheWrite1h:20}],"claude-opus-5-5":[{input:4,output:20,cacheRead:.2,cacheWrite:5,cacheWrite1h:8,fast:2}],"claude-opus-5":[{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10,fast:2}],"claude-opus-4-8":[{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10,fast:2}],"claude-opus-4-7":[{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}],"claude-opus-4-6":[{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}],"claude-opus-4-5":[{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}],"claude-opus-4-1":[{input:15,output:75,cacheRead:1.5,cacheWrite:18.75,cacheWrite1h:30}],"claude-opus-4":[{input:15,output:75,cacheRead:1.5,cacheWrite:18.75,cacheWrite1h:30}],"claude-sonnet-5-5":[{input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4}],"claude-sonnet-5":[{input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4}],"claude-sonnet-4-6":[{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}],"claude-sonnet-4-5":[{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}],"claude-sonnet-4":[{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}],"claude-haiku-4-5":[{input:1,output:5,cacheRead:.1,cacheWrite:1.25,cacheWrite1h:2}],"claude-3-5-haiku":[{input:.8,output:4,cacheRead:.08,cacheWrite:1,cacheWrite1h:1.6}],"gpt-6-luna":[{input:.1,output:.5,cacheRead:.01,cacheWrite:.125}],"gpt-5.6-sol":[{input:4,output:20,cacheRead:.4}],"gpt-5.6-terra":[{input:2,output:12,cacheRead:.2}],"gpt-5.6-luna":[{input:.2,output:1.2,cacheRead:.02}],"gpt-5.5":[{input:5,output:30,cacheRead:.5}],"gpt-5.5-pro":[{input:30,output:180}],"gpt-5.4":[{input:2.5,output:15,cacheRead:.25}],"gpt-5.4-mini":[{input:.75,output:4.5,cacheRead:.075}],"gpt-5.4-nano":[{input:.2,output:1.25,cacheRead:.02}],"gpt-5.4-pro":[{input:30,output:180}],"gpt-5.3-codex":[{input:1.75,output:14,cacheRead:.175}],"gpt-5.2":[{input:1.75,output:14,cacheRead:.175}],"gpt-5.2-pro":[{input:21,output:168}],"gpt-5.1":[{input:1.25,output:10,cacheRead:.125}],"gpt-5":[{input:1.25,output:10,cacheRead:.125}],"gpt-5-mini":[{input:.25,output:2,cacheRead:.025}],"gpt-5-nano":[{input:.05,output:.4,cacheRead:.005}],"gpt-5-pro":[{input:15,output:120}],o3:[{input:2,output:8,cacheRead:.5}],"o3-pro":[{input:20,output:80}],"o3-mini":[{input:1.1,output:4.4,cacheRead:.55}],"o4-mini":[{input:1.1,output:4.4,cacheRead:.275}],o1:[{input:15,output:60,cacheRead:7.5}],"gemini-3.7-flash":[{input:.75,output:3.75,cacheRead:.075},{from:"2027-01-01",input:1.5,output:7.5,cacheRead:.15}],"mai-code-1.1-flash":[{input:.2,output:1.2,cacheRead:.02}],"mai-code-1-flash":[{input:.75,output:4.5,cacheRead:.075}]}},22999,e=>{"use strict";var t=e.i(46786),r=e.i(14747),a=e.i(2817),u=e.i(68937),n=e.i(88316);let c=r.default.join(process.env.ASI_HOME??r.default.join(t.default.homedir(),".agent-session-inspector"),"pricing.json");function i(e){return!!e&&"number"==typeof e.input&&"number"==typeof e.output}let o=(e,t)=>(e.from??"").localeCompare(t.from??"");function s(e){let t={};if(!e||"object"!=typeof e)return t;for(let[r,a]of Object.entries(e)){let e=(Array.isArray(a)?a:[a]).filter(i);e.length>0&&(t[r.toLowerCase()]=e.sort(o))}return t}let l=s(a.default),p=(0,u.createFileCache)(e=>{let t=(0,u.safeReadFile)(e);if(!t)return l;try{return{...l,...s(JSON.parse(t))}}catch{return l}}),d=/-(\d{8}|\d{4}-\d{2}-\d{2}|latest)$/;function h(e){let t=e.toLowerCase().replace(/\[.*\]$/,"").replace(/^.*\//,"").replace(/^([a-z]{2}\.)?anthropic\./,"");return t.startsWith("claude")?t.replace(/\./g,"-"):t}function f(){return c.replace(t.default.homedir(),"~")}function m(e,t){if(!e)return null;let r=h(e);if(t[r])return r;let a=r.replace(d,"");return t[a]?a:null}let k=["input","cacheWrite","cacheWrite1h","cacheRead","output"];function W(e,t){let r={input:e.inputTokens,cacheWrite:e.cacheWriteTokens??0,cacheWrite1h:e.cacheWrite1hTokens??0,cacheRead:e.cacheReadTokens??0,output:e.outputTokens},a=p(c),u=m(e.model,a),n=null;if(e.local)n={input:0,cacheWrite:0,cacheWrite1h:0,cacheRead:0,output:0};else if(u){let r=function(e,t){if(!t)return e[e.length-1];let r=e[0];for(let a of e)(a.from??"")<=t&&(r=a);return r}(a[u],t),c=r.cacheWrite??r.input,i=e.fast?r.fast??1:1;n={input:r.input*i,cacheWrite:c*i,cacheWrite1h:(r.cacheWrite1h??c)*i,cacheRead:(r.cacheRead??r.input)*i,output:r.output*i}}return k.filter(e=>r[e]>0).map(e=>({kind:e,tokens:r[e],rate:n?n[e]:null,usd:n?r[e]*n[e]/1e6:null}))}function R(e){let t=e.data.billedUsage;return t?(Array.isArray(t)?t:[t]).filter(e=>e.inputTokens+e.outputTokens+(e.cacheReadTokens??0)+(e.cacheWriteTokens??0)+(e.cacheWrite1hTokens??0)>0):[]}function T(e){return!0===e.data.inherited}let x="unknown";class g{models=new Map;breakdown={input:0,output:0,cacheRead:0,cacheWrite:0};lines=new Map;add(e,t){let r=e.model||x,a=null,u=W(e,t).map(e=>({model:r,...e}));for(let e of u){let t=`${r}|${e.kind}|${e.rate}`,u=this.lines.get(t);u?(u.tokens+=e.tokens,null!==u.usd&&null!==e.usd&&(u.usd+=e.usd)):this.lines.set(t,{...e}),null!==e.usd&&(a=(a??0)+e.usd,this.breakdown["cacheWrite1h"===e.kind?"cacheWrite":e.kind]+=e.usd)}let n=this.models.get(r);return n||(n={model:r,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheWriteTokens:0,costUSD:null===a?null:0},this.models.set(r,n)),n.inputTokens+=e.inputTokens,n.outputTokens+=e.outputTokens,n.cacheReadTokens+=e.cacheReadTokens??0,n.cacheWriteTokens+=(e.cacheWriteTokens??0)+(e.cacheWrite1hTokens??0),null!==a&&null!==n.costUSD&&(n.costUSD+=a),u}summary(){let e=[...this.models.values()].sort((e,t)=>(t.costUSD??-1)-(e.costUSD??-1)),t=p(c),r={};for(let{model:a}of e){if(a===x)continue;let e=m(a,t);r[e??h(a)]=e?t[e]:null}return{totalUSD:e.reduce((e,t)=>e+(t.costUSD??0),0),breakdown:this.breakdown,byModel:e,lines:e.flatMap(e=>[...this.lines.values()].filter(t=>t.model===e.model).sort((e,t)=>k.indexOf(e.kind)-k.indexOf(t.kind)||(e.rate??0)-(t.rate??0))),prices:r,overridePath:f(),unpricedModels:e.filter(e=>null===e.costUSD).map(e=>e.model)}}}e.s(["LOCAL_RUNTIME",0,/ollama|lm-?studio|llama\.?cpp|localhost|127\.0\.0\.1/i,"bucketUsage",0,function(e,t=!1){let r=new Map;for(let a of e){if(T(a)!==t)continue;let e=a.timestamp?.slice(0,10)??"",u=Date.parse(a.timestamp),c=Number.isNaN(u)?void 0:Math.floor(u/n.ACTIVITY_SLOT_MS)*n.ACTIVITY_SLOT_MS;for(let t of R(a)){let a=`${t.model??""}|${c??e}|${+!!t.fast}|${+!!t.local}`,u=r.get(a);if(!u){r.set(a,{day:e,t:c,model:t.model,fast:t.fast,local:t.local,inputTokens:t.inputTokens,outputTokens:t.outputTokens,cacheReadTokens:t.cacheReadTokens??0,cacheWriteTokens:t.cacheWriteTokens??0,cacheWrite1hTokens:t.cacheWrite1hTokens??0});continue}u.inputTokens+=t.inputTokens,u.outputTokens+=t.outputTokens,u.cacheReadTokens=(u.cacheReadTokens??0)+(t.cacheReadTokens??0),u.cacheWriteTokens=(u.cacheWriteTokens??0)+(t.cacheWriteTokens??0),u.cacheWrite1hTokens=(u.cacheWrite1hTokens??0)+(t.cacheWrite1hTokens??0)}}return[...r.values()]},"isInherited",0,T,"overrideKeyOf",0,function(e){return h(e).replace(d,"")},"overridePathLabel",0,f,"priceBucket",0,function(e){let t=null;for(let r of W(e,e.day||void 0))null!==r.usd&&(t=(t??0)+r.usd);return t},"priceBuckets",0,function(e){if(!e||0===e.length)return null;let t=new g;for(let r of e)t.add(r,r.day||void 0);return t.summary()},"priceEvents",0,function(e){let t=new g,r=null;for(let a of e){let e=R(a);if(0===e.length)continue;let u=T(a)?r??=new g:t,n=null,c=e.flatMap(e=>u.add(e,a.timestamp));for(let e of c)null!==e.usd&&(n=(n??0)+e.usd);null!==n&&(a.data.costUSD=n),a.data.costLines=c}let a=t.summary();return r&&(a.inherited=r.summary()),a}])},88316,e=>{"use strict";e.s(["ACTIVITY_SLOT_MS",0,9e5,"HEALTH_SIGNALS",0,["outcome","tool_failures","retry_loops","api_errors","aborted_turns","compactions"]])}];
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__0dyq0rc._.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
module.exports=[33405,(e,t,r)=>{t.exports=e.x("child_process",()=>require("child_process"))},22734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},20635,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/action-async-storage.external.js",()=>require("next/dist/server/app-render/action-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},59043,(e,t,r)=>{t.exports=e.x("next/dist/server/runtime-reacts.external.js",()=>require("next/dist/server/runtime-reacts.external.js"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},81111,(e,t,r)=>{t.exports=e.x("node:stream",()=>require("node:stream"))},46786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},91845,e=>{"use strict";var t=e.i(90453),r=e.i(16011),a=e.i(68937),n=e.i(33405),i=e.i(14747);async function o(e,{params:u}){let s=e.headers.get("origin");if(s&&URL.parse(s)?.host!==e.headers.get("host"))return t.NextResponse.json({error:"Forbidden"},{status:403});let{provider:c,id:l}=await u,p=(0,r.getProvider)(c)?.getSession(l)?.storagePath;return p?a.ON_HOST&&await function(e){let t=(0,a.statOf)(e);if(!t)return Promise.resolve(!1);let[r,o]=["xdg-open",[t.isDirectory()?e:i.default.dirname(e)]];return new Promise(e=>{let t=(0,n.spawn)(r,o,{detached:!0,stdio:"ignore"});t.once("error",()=>e(!1)),t.once("spawn",()=>{t.unref(),e(!0)})})}(p)?t.NextResponse.json({ok:!0}):t.NextResponse.json({error:"No file manager available"},{status:501}):t.NextResponse.json({error:"Session not found"},{status:404})}e.s(["POST",0,o],91845)},86486,e=>{"use strict";var t=e.i(66096),r=e.i(67637),a=e.i(47656),n=e.i(58227),i=e.i(98630),o=e.i(94609),u=e.i(98774),s=e.i(77679),c=e.i(99020),l=e.i(15304),p=e.i(97666),d=e.i(91817),h=e.i(81575),f=e.i(93310),R=e.i(66395),m=e.i(93695);e.i(17232);var g=e.i(86935);let x=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/sessions/[provider]/[id]/reveal/route",pathname:"/api/sessions/[provider]/[id]/reveal",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/sessions/[provider]/[id]/reveal/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(91845),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:T,serverHooks:k}=x;async function W(e,t,a){a.requestMeta&&(0,n.setRequestMeta)(e,a.requestMeta),x.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let v="/api/sessions/[provider]/[id]/reveal/route";v=v.replace(/\/index$/,"")||"/";let T=await x.prepare(e,t,{srcPage:v,multiZoneDraftMode:!1});if(!T)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:k,deploymentId:W,params:y,nextConfig:w,parsedUrl:S,isDraftMode:b,prerenderManifest:C,routerServerContext:A,isOnDemandRevalidate:E,revalidateOnlyGenerated:O,resolvedPathname:_,clientReferenceManifest:N,serverActionsManifest:P}=T,j=(0,u.normalizeAppPath)(v),M=!!(C.dynamicRoutes[j]||C.routes[_]),q=async()=>((null==A?void 0:A.render404)?await A.render404(e,t,S,!1):t.end("This page could not be found"),null);if(M&&!b){let e=!!C.routes[_],t=C.dynamicRoutes[j];if(t&&!1===t.fallback&&!e){if(w.adapterPath)return await q();throw new m.NoFallbackError}}let I=null;!M||x.isDev||b||(I="/index"===(I=_)?"/":I);let D=!0===x.isDev||!M,H=M&&!D;P&&N&&(0,o.setManifestsSingleton)({page:v,clientReferenceManifest:N,serverActionsManifest:P});let U=e.method||"GET",$=(0,i.getTracer)(),F=$.getActiveScopeSpan(),L=!!(null==A?void 0:A.isWrappedByNextServer),G=!!(0,n.getRequestMeta)(e,"minimalMode"),K=(0,n.getRequestMeta)(e,"incrementalCache")||await x.getIncrementalCache(e,w,C,G);null==K||K.resetRequestCache(),globalThis.__incrementalCache=K;let B={params:y,previewProps:C.preview,renderOpts:{experimental:{authInterrupts:!!w.experimental.authInterrupts,useCacheTimeout:w.experimental.useCacheTimeout},cacheComponents:!!w.cacheComponents,validationLevel:w.experimental.instantInsights.validationLevel,supportsDynamicResponse:D,incrementalCache:K,hmrRefreshHash:(0,n.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:w.cacheLife,staticPageGenerationTimeout:w.staticPageGenerationTimeout,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>x.onRequestError(e,t,a,n,A)},sharedContext:{buildId:k,deploymentId:W}},J=new s.NodeNextRequest(e),V=new s.NodeNextResponse(t),X=c.NextRequestAdapter.fromNodeNextRequest(J,(0,c.signalFromNodeResponse)(t)),z=async({previousCacheEntry:r})=>{try{if(!G&&E&&O&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let n=await x.handle(X,B);e.fetchMetrics=B.renderOpts.fetchMetrics;let i=B.renderOpts.pendingWaitUntil;i&&a.waitUntil&&(a.waitUntil(i),i=void 0);let o=B.renderOpts.collectedTags;if(!M)return await (0,d.sendResponse)(J,V,n,i),null;{let e=await n.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(n.headers);o&&(t[R.NEXT_CACHE_TAGS_HEADER]=o),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==B.renderOpts.collectedRevalidate&&!(B.renderOpts.collectedRevalidate>=R.INFINITE_CACHE)&&B.renderOpts.collectedRevalidate,a=void 0===B.renderOpts.collectedExpire||B.renderOpts.collectedExpire>=R.INFINITE_CACHE?!1!==r&&r>0?w.expireTime:void 0:B.renderOpts.collectedExpire;return{value:{kind:g.CachedRouteKind.APP_ROUTE,status:n.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await x.onRequestError(e,t,{routerKind:"App Router",routePath:v,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:E})},!1,A),t}},Y=async(n,o)=>{try{var u,s;let n=await x.handleResponse({req:e,nextConfig:w,cacheKey:I,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:C,isRoutePPREnabled:!1,isOnDemandRevalidate:E,revalidateOnlyGenerated:O,responseGenerator:z,waitUntil:a.waitUntil,isMinimalMode:G});if(!M)return;if((null==n||null==(u=n.value)?void 0:u.kind)!==g.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==n||null==(s=n.value)?void 0:s.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});G||t.setHeader("x-nextjs-cache",E?"REVALIDATED":n.isMiss?"MISS":n.isStale?"STALE":"HIT"),b&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let i=(0,h.fromNodeOutgoingHttpHeaders)(n.value.headers);G&&M||i.delete(R.NEXT_CACHE_TAGS_HEADER),!n.cacheControl||t.getHeader("Cache-Control")||i.get("Cache-Control")||i.set("Cache-Control",(0,f.getCacheControlHeader)(n.cacheControl)),await (0,d.sendResponse)(J,V,new Response(n.value.body,{headers:i,status:n.value.status||200}));return}catch(t){if(t instanceof m.NoFallbackError||await x.onRequestError(e,t,{routerKind:"App Router",routePath:j,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:E})},!1,A),M)throw t;await (0,d.sendResponse)(J,V,new Response(null,{status:500}));return}finally{(()=>{if(!n)return;let e=t.statusCode;n.setAttributes({"http.status_code":e,"next.rsc":!1}),e&&e>=500&&(n.setStatus({code:i.SpanStatusCode.ERROR}),n.setAttribute("error.type",e.toString()));let r=$.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==l.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route")||j,u=`${U} ${a}`;n.setAttributes({"next.route":a,"http.route":a,"next.span_name":u}),n.updateName(u),o&&o!==n&&(o.setAttribute("http.route",a),o.updateName(u))})()}};if(L&&F)await Y(F,void 0);else{let t=$.getActiveScopeSpan();await $.withPropagatedContext(e.headers,()=>$.trace(l.BaseServerSpan.handleRequest,{spanName:`${U} ${v}`,kind:i.SpanKind.SERVER,attributes:{"http.method":U,"http.target":e.url}},e=>Y(e,t)),void 0,!L)}}e.s(["handler",0,W,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:T})},"routeModule",0,x,"serverHooks",0,k,"workAsyncStorage",0,v,"workUnitAsyncStorage",0,T])},68937,e=>{"use strict";var t=e.i(22734),r=e.i(46786),a=e.i(14747);function n(e){try{return t.default.readFileSync(e,"utf-8")}catch{return""}}function i(e){try{return t.default.readdirSync(e)}catch{return[]}}function o(e){try{return t.default.statSync(e)}catch{return null}}let u=new Map;function s(e){let t=r.default.homedir();return a.default.join(process.env.XDG_CONFIG_HOME??a.default.join(t,".config"),e)}let c=process.env.ASI_HOST_HOME,l=process.env.ASI_HOST_APP_DATA;e.s(["ON_HOST",0,!c,"appDataDir",0,s,"capText",0,function(e){let t="string"==typeof e?e:null==e?"":JSON.stringify(e);return t.length<=2e4?{text:t,chars:t.length,truncated:!1}:{text:`${t.slice(0,2e4)}…`,chars:t.length,truncated:!0}},"createFileCache",0,function(e){let t=new Map;return r=>{let a=o(r),n=a?`${a.mtimeMs}:${a.size}`:"missing",i=t.get(r);if(i&&i.key===n)return i.value;let u=e(r);return t.set(r,{key:n,value:u}),u}},"findGitRoot",0,function(e){let t=u.get(e);if(void 0!==t)return t;let i=r.default.homedir(),s=null;for(let t=a.default.resolve(e);t!==i&&t!==a.default.dirname(t);t=a.default.dirname(t)){let e=o(a.default.join(t,".git"));if(e){if(s=t,e.isFile()){let e=n(a.default.join(t,".git")).match(/^gitdir:\s*(.+)[\\/]\.git[\\/]worktrees[\\/][^\\/]+\s*$/m);e&&(s=a.default.resolve(t,e[1]))}break}}return u.set(e,s),s},"hostPath",0,function(e){if(!c)return e;for(let[t,n]of[[s(""),l],[r.default.homedir(),c]]){let r=a.default.relative(t,e);if(n&&!r.startsWith("..")&&!a.default.isAbsolute(r))return a.default.join(n,r)}return e},"isoFromMs",0,function(e){return"number"==typeof e&&Number.isFinite(e)&&e>0?new Date(e).toISOString():""},"parseJson",0,function(e){if("string"!=typeof e||!e)return null;try{return JSON.parse(e)}catch{return null}},"readJsonl",0,function(e){let t=n(e);if(!t)return[];let r=[];for(let e of t.split("\n"))if(e.trim())try{r.push(JSON.parse(e))}catch{}return r},"safeReadFile",0,n,"safeReaddir",0,i,"statOf",0,o,"tildePath",0,function(e){let t=r.default.homedir();return e.startsWith(t)?`~${e.slice(t.length)}`:e},"walkFiles",0,function e(t,r,n=6){if(n<0)return[];let u=[];for(let s of i(t)){let i=a.default.join(t,s),c=o(i);c&&(c.isDirectory()?u.push(...e(i,r,n-1)):r(s)&&u.push(i))}return u}])},2817,(e,t,r)=>{t.exports={"claude-fable-5-1":[{input:10,output:50,cacheRead:.25,cacheWrite:12.5,cacheWrite1h:20}],"claude-mythos-5-1":[{input:10,output:50,cacheRead:.25,cacheWrite:12.5,cacheWrite1h:20}],"claude-fable-5":[{input:10,output:50,cacheRead:1,cacheWrite:12.5,cacheWrite1h:20}],"claude-mythos-5":[{input:10,output:50,cacheRead:1,cacheWrite:12.5,cacheWrite1h:20}],"claude-opus-5-5":[{input:4,output:20,cacheRead:.2,cacheWrite:5,cacheWrite1h:8,fast:2}],"claude-opus-5":[{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10,fast:2}],"claude-opus-4-8":[{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10,fast:2}],"claude-opus-4-7":[{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}],"claude-opus-4-6":[{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}],"claude-opus-4-5":[{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}],"claude-opus-4-1":[{input:15,output:75,cacheRead:1.5,cacheWrite:18.75,cacheWrite1h:30}],"claude-opus-4":[{input:15,output:75,cacheRead:1.5,cacheWrite:18.75,cacheWrite1h:30}],"claude-sonnet-5-5":[{input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4}],"claude-sonnet-5":[{input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4}],"claude-sonnet-4-6":[{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}],"claude-sonnet-4-5":[{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}],"claude-sonnet-4":[{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}],"claude-haiku-4-5":[{input:1,output:5,cacheRead:.1,cacheWrite:1.25,cacheWrite1h:2}],"claude-3-5-haiku":[{input:.8,output:4,cacheRead:.08,cacheWrite:1,cacheWrite1h:1.6}],"gpt-6-luna":[{input:.1,output:.5,cacheRead:.01,cacheWrite:.125}],"gpt-5.6-sol":[{input:4,output:20,cacheRead:.4}],"gpt-5.6-terra":[{input:2,output:12,cacheRead:.2}],"gpt-5.6-luna":[{input:.2,output:1.2,cacheRead:.02}],"gpt-5.5":[{input:5,output:30,cacheRead:.5}],"gpt-5.5-pro":[{input:30,output:180}],"gpt-5.4":[{input:2.5,output:15,cacheRead:.25}],"gpt-5.4-mini":[{input:.75,output:4.5,cacheRead:.075}],"gpt-5.4-nano":[{input:.2,output:1.25,cacheRead:.02}],"gpt-5.4-pro":[{input:30,output:180}],"gpt-5.3-codex":[{input:1.75,output:14,cacheRead:.175}],"gpt-5.2":[{input:1.75,output:14,cacheRead:.175}],"gpt-5.2-pro":[{input:21,output:168}],"gpt-5.1":[{input:1.25,output:10,cacheRead:.125}],"gpt-5":[{input:1.25,output:10,cacheRead:.125}],"gpt-5-mini":[{input:.25,output:2,cacheRead:.025}],"gpt-5-nano":[{input:.05,output:.4,cacheRead:.005}],"gpt-5-pro":[{input:15,output:120}],o3:[{input:2,output:8,cacheRead:.5}],"o3-pro":[{input:20,output:80}],"o3-mini":[{input:1.1,output:4.4,cacheRead:.55}],"o4-mini":[{input:1.1,output:4.4,cacheRead:.275}],o1:[{input:15,output:60,cacheRead:7.5}],"gemini-3.7-flash":[{input:.75,output:3.75,cacheRead:.075},{from:"2027-01-01",input:1.5,output:7.5,cacheRead:.15}],"mai-code-1.1-flash":[{input:.2,output:1.2,cacheRead:.02}],"mai-code-1-flash":[{input:.75,output:4.5,cacheRead:.075}]}},22999,e=>{"use strict";var t=e.i(46786),r=e.i(14747),a=e.i(2817),n=e.i(68937),i=e.i(88316);let o=r.default.join(process.env.ASI_HOME??r.default.join(t.default.homedir(),".agent-session-inspector"),"pricing.json");function u(e){return!!e&&"number"==typeof e.input&&"number"==typeof e.output}let s=(e,t)=>(e.from??"").localeCompare(t.from??"");function c(e){let t={};if(!e||"object"!=typeof e)return t;for(let[r,a]of Object.entries(e)){let e=(Array.isArray(a)?a:[a]).filter(u);e.length>0&&(t[r.toLowerCase()]=e.sort(s))}return t}let l=c(a.default),p=(0,n.createFileCache)(e=>{let t=(0,n.safeReadFile)(e);if(!t)return l;try{return{...l,...c(JSON.parse(t))}}catch{return l}}),d=/-(\d{8}|\d{4}-\d{2}-\d{2}|latest)$/;function h(e){let t=e.toLowerCase().replace(/\[.*\]$/,"").replace(/^.*\//,"").replace(/^([a-z]{2}\.)?anthropic\./,"");return t.startsWith("claude")?t.replace(/\./g,"-"):t}function f(){return o.replace(t.default.homedir(),"~")}function R(e,t){if(!e)return null;let r=h(e);if(t[r])return r;let a=r.replace(d,"");return t[a]?a:null}let m=["input","cacheWrite","cacheWrite1h","cacheRead","output"];function g(e,t){let r={input:e.inputTokens,cacheWrite:e.cacheWriteTokens??0,cacheWrite1h:e.cacheWrite1hTokens??0,cacheRead:e.cacheReadTokens??0,output:e.outputTokens},a=p(o),n=R(e.model,a),i=null;if(e.local)i={input:0,cacheWrite:0,cacheWrite1h:0,cacheRead:0,output:0};else if(n){let r=function(e,t){if(!t)return e[e.length-1];let r=e[0];for(let a of e)(a.from??"")<=t&&(r=a);return r}(a[n],t),o=r.cacheWrite??r.input,u=e.fast?r.fast??1:1;i={input:r.input*u,cacheWrite:o*u,cacheWrite1h:(r.cacheWrite1h??o)*u,cacheRead:(r.cacheRead??r.input)*u,output:r.output*u}}return m.filter(e=>r[e]>0).map(e=>({kind:e,tokens:r[e],rate:i?i[e]:null,usd:i?r[e]*i[e]/1e6:null}))}function x(e){let t=e.data.billedUsage;return t?(Array.isArray(t)?t:[t]).filter(e=>e.inputTokens+e.outputTokens+(e.cacheReadTokens??0)+(e.cacheWriteTokens??0)+(e.cacheWrite1hTokens??0)>0):[]}function v(e){return!0===e.data.inherited}let T="unknown";class k{models=new Map;breakdown={input:0,output:0,cacheRead:0,cacheWrite:0};lines=new Map;add(e,t){let r=e.model||T,a=null,n=g(e,t).map(e=>({model:r,...e}));for(let e of n){let t=`${r}|${e.kind}|${e.rate}`,n=this.lines.get(t);n?(n.tokens+=e.tokens,null!==n.usd&&null!==e.usd&&(n.usd+=e.usd)):this.lines.set(t,{...e}),null!==e.usd&&(a=(a??0)+e.usd,this.breakdown["cacheWrite1h"===e.kind?"cacheWrite":e.kind]+=e.usd)}let i=this.models.get(r);return i||(i={model:r,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheWriteTokens:0,costUSD:null===a?null:0},this.models.set(r,i)),i.inputTokens+=e.inputTokens,i.outputTokens+=e.outputTokens,i.cacheReadTokens+=e.cacheReadTokens??0,i.cacheWriteTokens+=(e.cacheWriteTokens??0)+(e.cacheWrite1hTokens??0),null!==a&&null!==i.costUSD&&(i.costUSD+=a),n}summary(){let e=[...this.models.values()].sort((e,t)=>(t.costUSD??-1)-(e.costUSD??-1)),t=p(o),r={};for(let{model:a}of e){if(a===T)continue;let e=R(a,t);r[e??h(a)]=e?t[e]:null}return{totalUSD:e.reduce((e,t)=>e+(t.costUSD??0),0),breakdown:this.breakdown,byModel:e,lines:e.flatMap(e=>[...this.lines.values()].filter(t=>t.model===e.model).sort((e,t)=>m.indexOf(e.kind)-m.indexOf(t.kind)||(e.rate??0)-(t.rate??0))),prices:r,overridePath:f(),unpricedModels:e.filter(e=>null===e.costUSD).map(e=>e.model)}}}e.s(["LOCAL_RUNTIME",0,/ollama|lm-?studio|llama\.?cpp|localhost|127\.0\.0\.1/i,"bucketUsage",0,function(e,t=!1){let r=new Map;for(let a of e){if(v(a)!==t)continue;let e=a.timestamp?.slice(0,10)??"",n=Date.parse(a.timestamp),o=Number.isNaN(n)?void 0:Math.floor(n/i.ACTIVITY_SLOT_MS)*i.ACTIVITY_SLOT_MS;for(let t of x(a)){let a=`${t.model??""}|${o??e}|${+!!t.fast}|${+!!t.local}`,n=r.get(a);if(!n){r.set(a,{day:e,t:o,model:t.model,fast:t.fast,local:t.local,inputTokens:t.inputTokens,outputTokens:t.outputTokens,cacheReadTokens:t.cacheReadTokens??0,cacheWriteTokens:t.cacheWriteTokens??0,cacheWrite1hTokens:t.cacheWrite1hTokens??0});continue}n.inputTokens+=t.inputTokens,n.outputTokens+=t.outputTokens,n.cacheReadTokens=(n.cacheReadTokens??0)+(t.cacheReadTokens??0),n.cacheWriteTokens=(n.cacheWriteTokens??0)+(t.cacheWriteTokens??0),n.cacheWrite1hTokens=(n.cacheWrite1hTokens??0)+(t.cacheWrite1hTokens??0)}}return[...r.values()]},"isInherited",0,v,"overrideKeyOf",0,function(e){return h(e).replace(d,"")},"overridePathLabel",0,f,"priceBucket",0,function(e){let t=null;for(let r of g(e,e.day||void 0))null!==r.usd&&(t=(t??0)+r.usd);return t},"priceBuckets",0,function(e){if(!e||0===e.length)return null;let t=new k;for(let r of e)t.add(r,r.day||void 0);return t.summary()},"priceEvents",0,function(e){let t=new k,r=null;for(let a of e){let e=x(a);if(0===e.length)continue;let n=v(a)?r??=new k:t,i=null,o=e.flatMap(e=>n.add(e,a.timestamp));for(let e of o)null!==e.usd&&(i=(i??0)+e.usd);null!==i&&(a.data.costUSD=i),a.data.costLines=o}let a=t.summary();return r&&(a.inherited=r.summary()),a}])},88316,e=>{"use strict";e.s(["ACTIVITY_SLOT_MS",0,9e5,"HEALTH_SIGNALS",0,["outcome","tool_failures","retry_loops","api_errors","aborted_turns","compactions"]])}];
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__0kgkqhn._.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
module.exports=[22734,(e,t,a)=>{t.exports=e.x("fs",()=>require("fs"))},70406,(e,t,a)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},18622,(e,t,a)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},20635,(e,t,a)=>{t.exports=e.x("next/dist/server/app-render/action-async-storage.external.js",()=>require("next/dist/server/app-render/action-async-storage.external.js"))},24725,(e,t,a)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},56704,(e,t,a)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,a)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},59043,(e,t,a)=>{t.exports=e.x("next/dist/server/runtime-reacts.external.js",()=>require("next/dist/server/runtime-reacts.external.js"))},93695,(e,t,a)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},81111,(e,t,a)=>{t.exports=e.x("node:stream",()=>require("node:stream"))},46786,(e,t,a)=>{t.exports=e.x("os",()=>require("os"))},14747,(e,t,a)=>{t.exports=e.x("path",()=>require("path"))},21293,e=>{"use strict";var t=e.i(90453),a=e.i(16011);async function r(e){let{searchParams:r}=e.nextUrl,n=r.get("name"),i=r.get("provider")??void 0;if(n){let e=(0,a.getLogContent)(i??"copilot",n);return t.NextResponse.json({name:n,content:e})}return t.NextResponse.json((0,a.listLogs)(i))}e.s(["GET",0,r])},81489,e=>{"use strict";var t=e.i(66096),a=e.i(67637),r=e.i(47656),n=e.i(58227),i=e.i(98630),o=e.i(94609),u=e.i(98774),c=e.i(77679),s=e.i(99020),l=e.i(15304),p=e.i(97666),d=e.i(91817),h=e.i(81575),f=e.i(93310),R=e.i(66395),m=e.i(93695);e.i(17232);var g=e.i(86935);let x=new t.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/logs/route",pathname:"/api/logs",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/logs/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(21293),...{}}),{workAsyncStorage:T,workUnitAsyncStorage:v,serverHooks:k}=x;async function W(e,t,r){r.requestMeta&&(0,n.setRequestMeta)(e,r.requestMeta),x.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let T="/api/logs/route";T=T.replace(/\/index$/,"")||"/";let v=await x.prepare(e,t,{srcPage:T,multiZoneDraftMode:!1});if(!v)return t.statusCode=400,t.end("Bad Request"),null==r.waitUntil||r.waitUntil.call(r,Promise.resolve()),null;let{buildId:k,deploymentId:W,params:y,nextConfig:w,parsedUrl:S,isDraftMode:C,prerenderManifest:b,routerServerContext:A,isOnDemandRevalidate:E,revalidateOnlyGenerated:O,resolvedPathname:_,clientReferenceManifest:N,serverActionsManifest:j}=v,M=(0,u.normalizeAppPath)(T),P=!!(b.dynamicRoutes[M]||b.routes[_]),q=async()=>((null==A?void 0:A.render404)?await A.render404(e,t,S,!1):t.end("This page could not be found"),null);if(P&&!C){let e=!!b.routes[_],t=b.dynamicRoutes[M];if(t&&!1===t.fallback&&!e){if(w.adapterPath)return await q();throw new m.NoFallbackError}}let I=null;!P||x.isDev||C||(I="/index"===(I=_)?"/":I);let D=!0===x.isDev||!P,U=P&&!D;j&&N&&(0,o.setManifestsSingleton)({page:T,clientReferenceManifest:N,serverActionsManifest:j});let H=e.method||"GET",$=(0,i.getTracer)(),L=$.getActiveScopeSpan(),F=!!(null==A?void 0:A.isWrappedByNextServer),G=!!(0,n.getRequestMeta)(e,"minimalMode"),K=(0,n.getRequestMeta)(e,"incrementalCache")||await x.getIncrementalCache(e,w,b,G);null==K||K.resetRequestCache(),globalThis.__incrementalCache=K;let B={params:y,previewProps:b.preview,renderOpts:{experimental:{authInterrupts:!!w.experimental.authInterrupts,useCacheTimeout:w.experimental.useCacheTimeout},cacheComponents:!!w.cacheComponents,validationLevel:w.experimental.instantInsights.validationLevel,supportsDynamicResponse:D,incrementalCache:K,hmrRefreshHash:(0,n.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:w.cacheLife,staticPageGenerationTimeout:w.staticPageGenerationTimeout,waitUntil:r.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,a,r,n)=>x.onRequestError(e,t,r,n,A)},sharedContext:{buildId:k,deploymentId:W}},J=new c.NodeNextRequest(e),V=new c.NodeNextResponse(t),X=s.NextRequestAdapter.fromNodeNextRequest(J,(0,s.signalFromNodeResponse)(t)),z=async({previousCacheEntry:a})=>{try{if(!G&&E&&O&&!a)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let n=await x.handle(X,B);e.fetchMetrics=B.renderOpts.fetchMetrics;let i=B.renderOpts.pendingWaitUntil;i&&r.waitUntil&&(r.waitUntil(i),i=void 0);let o=B.renderOpts.collectedTags;if(!P)return await (0,d.sendResponse)(J,V,n,i),null;{let e=await n.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(n.headers);o&&(t[R.NEXT_CACHE_TAGS_HEADER]=o),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let a=void 0!==B.renderOpts.collectedRevalidate&&!(B.renderOpts.collectedRevalidate>=R.INFINITE_CACHE)&&B.renderOpts.collectedRevalidate,r=void 0===B.renderOpts.collectedExpire||B.renderOpts.collectedExpire>=R.INFINITE_CACHE?!1!==a&&a>0?w.expireTime:void 0:B.renderOpts.collectedExpire;return{value:{kind:g.CachedRouteKind.APP_ROUTE,status:n.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:a,expire:r}}}}catch(t){throw(null==a?void 0:a.isStale)&&await x.onRequestError(e,t,{routerKind:"App Router",routePath:T,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:E})},!1,A),t}},Y=async(n,o)=>{try{var u,c;let n=await x.handleResponse({req:e,nextConfig:w,cacheKey:I,routeKind:a.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:b,isRoutePPREnabled:!1,isOnDemandRevalidate:E,revalidateOnlyGenerated:O,responseGenerator:z,waitUntil:r.waitUntil,isMinimalMode:G});if(!P)return;if((null==n||null==(u=n.value)?void 0:u.kind)!==g.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==n||null==(c=n.value)?void 0:c.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});G||t.setHeader("x-nextjs-cache",E?"REVALIDATED":n.isMiss?"MISS":n.isStale?"STALE":"HIT"),C&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let i=(0,h.fromNodeOutgoingHttpHeaders)(n.value.headers);G&&P||i.delete(R.NEXT_CACHE_TAGS_HEADER),!n.cacheControl||t.getHeader("Cache-Control")||i.get("Cache-Control")||i.set("Cache-Control",(0,f.getCacheControlHeader)(n.cacheControl)),await (0,d.sendResponse)(J,V,new Response(n.value.body,{headers:i,status:n.value.status||200}));return}catch(t){if(t instanceof m.NoFallbackError||await x.onRequestError(e,t,{routerKind:"App Router",routePath:M,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:E})},!1,A),P)throw t;await (0,d.sendResponse)(J,V,new Response(null,{status:500}));return}finally{(()=>{if(!n)return;let e=t.statusCode;n.setAttributes({"http.status_code":e,"next.rsc":!1}),e&&e>=500&&(n.setStatus({code:i.SpanStatusCode.ERROR}),n.setAttribute("error.type",e.toString()));let a=$.getRootSpanAttributes();if(!a)return;if(a.get("next.span_type")!==l.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${a.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let r=a.get("next.route")||M,u=`${H} ${r}`;n.setAttributes({"next.route":r,"http.route":r,"next.span_name":u}),n.updateName(u),o&&o!==n&&(o.setAttribute("http.route",r),o.updateName(u))})()}};if(F&&L)await Y(L,void 0);else{let t=$.getActiveScopeSpan();await $.withPropagatedContext(e.headers,()=>$.trace(l.BaseServerSpan.handleRequest,{spanName:`${H} ${T}`,kind:i.SpanKind.SERVER,attributes:{"http.method":H,"http.target":e.url}},e=>Y(e,t)),void 0,!F)}}e.s(["handler",0,W,"patchFetch",0,function(){return(0,r.patchFetch)({workAsyncStorage:T,workUnitAsyncStorage:v})},"routeModule",0,x,"serverHooks",0,k,"workAsyncStorage",0,T,"workUnitAsyncStorage",0,v])},68937,e=>{"use strict";var t=e.i(22734),a=e.i(46786),r=e.i(14747);function n(e){try{return t.default.readFileSync(e,"utf-8")}catch{return""}}function i(e){try{return t.default.readdirSync(e)}catch{return[]}}function o(e){try{return t.default.statSync(e)}catch{return null}}let u=new Map;function c(e){let t=a.default.homedir();return r.default.join(process.env.XDG_CONFIG_HOME??r.default.join(t,".config"),e)}let s=process.env.ASI_HOST_HOME,l=process.env.ASI_HOST_APP_DATA;e.s(["ON_HOST",0,!s,"appDataDir",0,c,"capText",0,function(e){let t="string"==typeof e?e:null==e?"":JSON.stringify(e);return t.length<=2e4?{text:t,chars:t.length,truncated:!1}:{text:`${t.slice(0,2e4)}…`,chars:t.length,truncated:!0}},"createFileCache",0,function(e){let t=new Map;return a=>{let r=o(a),n=r?`${r.mtimeMs}:${r.size}`:"missing",i=t.get(a);if(i&&i.key===n)return i.value;let u=e(a);return t.set(a,{key:n,value:u}),u}},"findGitRoot",0,function(e){let t=u.get(e);if(void 0!==t)return t;let i=a.default.homedir(),c=null;for(let t=r.default.resolve(e);t!==i&&t!==r.default.dirname(t);t=r.default.dirname(t)){let e=o(r.default.join(t,".git"));if(e){if(c=t,e.isFile()){let e=n(r.default.join(t,".git")).match(/^gitdir:\s*(.+)[\\/]\.git[\\/]worktrees[\\/][^\\/]+\s*$/m);e&&(c=r.default.resolve(t,e[1]))}break}}return u.set(e,c),c},"hostPath",0,function(e){if(!s)return e;for(let[t,n]of[[c(""),l],[a.default.homedir(),s]]){let a=r.default.relative(t,e);if(n&&!a.startsWith("..")&&!r.default.isAbsolute(a))return r.default.join(n,a)}return e},"isoFromMs",0,function(e){return"number"==typeof e&&Number.isFinite(e)&&e>0?new Date(e).toISOString():""},"parseJson",0,function(e){if("string"!=typeof e||!e)return null;try{return JSON.parse(e)}catch{return null}},"readJsonl",0,function(e){let t=n(e);if(!t)return[];let a=[];for(let e of t.split("\n"))if(e.trim())try{a.push(JSON.parse(e))}catch{}return a},"safeReadFile",0,n,"safeReaddir",0,i,"statOf",0,o,"tildePath",0,function(e){let t=a.default.homedir();return e.startsWith(t)?`~${e.slice(t.length)}`:e},"walkFiles",0,function e(t,a,n=6){if(n<0)return[];let u=[];for(let c of i(t)){let i=r.default.join(t,c),s=o(i);s&&(s.isDirectory()?u.push(...e(i,a,n-1)):a(c)&&u.push(i))}return u}])},2817,(e,t,a)=>{t.exports={"claude-fable-5-1":[{input:10,output:50,cacheRead:.25,cacheWrite:12.5,cacheWrite1h:20}],"claude-mythos-5-1":[{input:10,output:50,cacheRead:.25,cacheWrite:12.5,cacheWrite1h:20}],"claude-fable-5":[{input:10,output:50,cacheRead:1,cacheWrite:12.5,cacheWrite1h:20}],"claude-mythos-5":[{input:10,output:50,cacheRead:1,cacheWrite:12.5,cacheWrite1h:20}],"claude-opus-5-5":[{input:4,output:20,cacheRead:.2,cacheWrite:5,cacheWrite1h:8,fast:2}],"claude-opus-5":[{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10,fast:2}],"claude-opus-4-8":[{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10,fast:2}],"claude-opus-4-7":[{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}],"claude-opus-4-6":[{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}],"claude-opus-4-5":[{input:5,output:25,cacheRead:.5,cacheWrite:6.25,cacheWrite1h:10}],"claude-opus-4-1":[{input:15,output:75,cacheRead:1.5,cacheWrite:18.75,cacheWrite1h:30}],"claude-opus-4":[{input:15,output:75,cacheRead:1.5,cacheWrite:18.75,cacheWrite1h:30}],"claude-sonnet-5-5":[{input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4}],"claude-sonnet-5":[{input:2,output:10,cacheRead:.2,cacheWrite:2.5,cacheWrite1h:4}],"claude-sonnet-4-6":[{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}],"claude-sonnet-4-5":[{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}],"claude-sonnet-4":[{input:3,output:15,cacheRead:.3,cacheWrite:3.75,cacheWrite1h:6}],"claude-haiku-4-5":[{input:1,output:5,cacheRead:.1,cacheWrite:1.25,cacheWrite1h:2}],"claude-3-5-haiku":[{input:.8,output:4,cacheRead:.08,cacheWrite:1,cacheWrite1h:1.6}],"gpt-6-luna":[{input:.1,output:.5,cacheRead:.01,cacheWrite:.125}],"gpt-5.6-sol":[{input:4,output:20,cacheRead:.4}],"gpt-5.6-terra":[{input:2,output:12,cacheRead:.2}],"gpt-5.6-luna":[{input:.2,output:1.2,cacheRead:.02}],"gpt-5.5":[{input:5,output:30,cacheRead:.5}],"gpt-5.5-pro":[{input:30,output:180}],"gpt-5.4":[{input:2.5,output:15,cacheRead:.25}],"gpt-5.4-mini":[{input:.75,output:4.5,cacheRead:.075}],"gpt-5.4-nano":[{input:.2,output:1.25,cacheRead:.02}],"gpt-5.4-pro":[{input:30,output:180}],"gpt-5.3-codex":[{input:1.75,output:14,cacheRead:.175}],"gpt-5.2":[{input:1.75,output:14,cacheRead:.175}],"gpt-5.2-pro":[{input:21,output:168}],"gpt-5.1":[{input:1.25,output:10,cacheRead:.125}],"gpt-5":[{input:1.25,output:10,cacheRead:.125}],"gpt-5-mini":[{input:.25,output:2,cacheRead:.025}],"gpt-5-nano":[{input:.05,output:.4,cacheRead:.005}],"gpt-5-pro":[{input:15,output:120}],o3:[{input:2,output:8,cacheRead:.5}],"o3-pro":[{input:20,output:80}],"o3-mini":[{input:1.1,output:4.4,cacheRead:.55}],"o4-mini":[{input:1.1,output:4.4,cacheRead:.275}],o1:[{input:15,output:60,cacheRead:7.5}],"gemini-3.7-flash":[{input:.75,output:3.75,cacheRead:.075},{from:"2027-01-01",input:1.5,output:7.5,cacheRead:.15}],"mai-code-1.1-flash":[{input:.2,output:1.2,cacheRead:.02}],"mai-code-1-flash":[{input:.75,output:4.5,cacheRead:.075}]}},22999,e=>{"use strict";var t=e.i(46786),a=e.i(14747),r=e.i(2817),n=e.i(68937),i=e.i(88316);let o=a.default.join(process.env.ASI_HOME??a.default.join(t.default.homedir(),".agent-session-inspector"),"pricing.json");function u(e){return!!e&&"number"==typeof e.input&&"number"==typeof e.output}let c=(e,t)=>(e.from??"").localeCompare(t.from??"");function s(e){let t={};if(!e||"object"!=typeof e)return t;for(let[a,r]of Object.entries(e)){let e=(Array.isArray(r)?r:[r]).filter(u);e.length>0&&(t[a.toLowerCase()]=e.sort(c))}return t}let l=s(r.default),p=(0,n.createFileCache)(e=>{let t=(0,n.safeReadFile)(e);if(!t)return l;try{return{...l,...s(JSON.parse(t))}}catch{return l}}),d=/-(\d{8}|\d{4}-\d{2}-\d{2}|latest)$/;function h(e){let t=e.toLowerCase().replace(/\[.*\]$/,"").replace(/^.*\//,"").replace(/^([a-z]{2}\.)?anthropic\./,"");return t.startsWith("claude")?t.replace(/\./g,"-"):t}function f(){return o.replace(t.default.homedir(),"~")}function R(e,t){if(!e)return null;let a=h(e);if(t[a])return a;let r=a.replace(d,"");return t[r]?r:null}let m=["input","cacheWrite","cacheWrite1h","cacheRead","output"];function g(e,t){let a={input:e.inputTokens,cacheWrite:e.cacheWriteTokens??0,cacheWrite1h:e.cacheWrite1hTokens??0,cacheRead:e.cacheReadTokens??0,output:e.outputTokens},r=p(o),n=R(e.model,r),i=null;if(e.local)i={input:0,cacheWrite:0,cacheWrite1h:0,cacheRead:0,output:0};else if(n){let a=function(e,t){if(!t)return e[e.length-1];let a=e[0];for(let r of e)(r.from??"")<=t&&(a=r);return a}(r[n],t),o=a.cacheWrite??a.input,u=e.fast?a.fast??1:1;i={input:a.input*u,cacheWrite:o*u,cacheWrite1h:(a.cacheWrite1h??o)*u,cacheRead:(a.cacheRead??a.input)*u,output:a.output*u}}return m.filter(e=>a[e]>0).map(e=>({kind:e,tokens:a[e],rate:i?i[e]:null,usd:i?a[e]*i[e]/1e6:null}))}function x(e){let t=e.data.billedUsage;return t?(Array.isArray(t)?t:[t]).filter(e=>e.inputTokens+e.outputTokens+(e.cacheReadTokens??0)+(e.cacheWriteTokens??0)+(e.cacheWrite1hTokens??0)>0):[]}function T(e){return!0===e.data.inherited}let v="unknown";class k{models=new Map;breakdown={input:0,output:0,cacheRead:0,cacheWrite:0};lines=new Map;add(e,t){let a=e.model||v,r=null,n=g(e,t).map(e=>({model:a,...e}));for(let e of n){let t=`${a}|${e.kind}|${e.rate}`,n=this.lines.get(t);n?(n.tokens+=e.tokens,null!==n.usd&&null!==e.usd&&(n.usd+=e.usd)):this.lines.set(t,{...e}),null!==e.usd&&(r=(r??0)+e.usd,this.breakdown["cacheWrite1h"===e.kind?"cacheWrite":e.kind]+=e.usd)}let i=this.models.get(a);return i||(i={model:a,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheWriteTokens:0,costUSD:null===r?null:0},this.models.set(a,i)),i.inputTokens+=e.inputTokens,i.outputTokens+=e.outputTokens,i.cacheReadTokens+=e.cacheReadTokens??0,i.cacheWriteTokens+=(e.cacheWriteTokens??0)+(e.cacheWrite1hTokens??0),null!==r&&null!==i.costUSD&&(i.costUSD+=r),n}summary(){let e=[...this.models.values()].sort((e,t)=>(t.costUSD??-1)-(e.costUSD??-1)),t=p(o),a={};for(let{model:r}of e){if(r===v)continue;let e=R(r,t);a[e??h(r)]=e?t[e]:null}return{totalUSD:e.reduce((e,t)=>e+(t.costUSD??0),0),breakdown:this.breakdown,byModel:e,lines:e.flatMap(e=>[...this.lines.values()].filter(t=>t.model===e.model).sort((e,t)=>m.indexOf(e.kind)-m.indexOf(t.kind)||(e.rate??0)-(t.rate??0))),prices:a,overridePath:f(),unpricedModels:e.filter(e=>null===e.costUSD).map(e=>e.model)}}}e.s(["LOCAL_RUNTIME",0,/ollama|lm-?studio|llama\.?cpp|localhost|127\.0\.0\.1/i,"bucketUsage",0,function(e,t=!1){let a=new Map;for(let r of e){if(T(r)!==t)continue;let e=r.timestamp?.slice(0,10)??"",n=Date.parse(r.timestamp),o=Number.isNaN(n)?void 0:Math.floor(n/i.ACTIVITY_SLOT_MS)*i.ACTIVITY_SLOT_MS;for(let t of x(r)){let r=`${t.model??""}|${o??e}|${+!!t.fast}|${+!!t.local}`,n=a.get(r);if(!n){a.set(r,{day:e,t:o,model:t.model,fast:t.fast,local:t.local,inputTokens:t.inputTokens,outputTokens:t.outputTokens,cacheReadTokens:t.cacheReadTokens??0,cacheWriteTokens:t.cacheWriteTokens??0,cacheWrite1hTokens:t.cacheWrite1hTokens??0});continue}n.inputTokens+=t.inputTokens,n.outputTokens+=t.outputTokens,n.cacheReadTokens=(n.cacheReadTokens??0)+(t.cacheReadTokens??0),n.cacheWriteTokens=(n.cacheWriteTokens??0)+(t.cacheWriteTokens??0),n.cacheWrite1hTokens=(n.cacheWrite1hTokens??0)+(t.cacheWrite1hTokens??0)}}return[...a.values()]},"isInherited",0,T,"overrideKeyOf",0,function(e){return h(e).replace(d,"")},"overridePathLabel",0,f,"priceBucket",0,function(e){let t=null;for(let a of g(e,e.day||void 0))null!==a.usd&&(t=(t??0)+a.usd);return t},"priceBuckets",0,function(e){if(!e||0===e.length)return null;let t=new k;for(let a of e)t.add(a,a.day||void 0);return t.summary()},"priceEvents",0,function(e){let t=new k,a=null;for(let r of e){let e=x(r);if(0===e.length)continue;let n=T(r)?a??=new k:t,i=null,o=e.flatMap(e=>n.add(e,r.timestamp));for(let e of o)null!==e.usd&&(i=(i??0)+e.usd);null!==i&&(r.data.costUSD=i),r.data.costLines=o}let r=t.summary();return a&&(r.inherited=a.summary()),r}])},88316,e=>{"use strict";e.s(["ACTIVITY_SLOT_MS",0,9e5,"HEALTH_SIGNALS",0,["outcome","tool_failures","retry_loops","api_errors","aborted_turns","compactions"]])}];
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__10p8y9z._.js.map
|