@autohq/cli 0.1.229 → 0.1.230
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-bridge.js +98 -6
- package/dist/index.js +101 -9
- package/package.json +1 -1
package/dist/agent-bridge.js
CHANGED
|
@@ -19474,6 +19474,21 @@ var RuntimeTurnStatusSchema = external_exports.enum([
|
|
|
19474
19474
|
"completed",
|
|
19475
19475
|
"failed"
|
|
19476
19476
|
]);
|
|
19477
|
+
var RuntimeBridgeUsageHarnessSchema = external_exports.enum(["claude-code", "codex"]);
|
|
19478
|
+
var RuntimeBridgeModelUsageSchema = external_exports.object({
|
|
19479
|
+
model: external_exports.string().trim().min(1),
|
|
19480
|
+
inputTokens: external_exports.number().int().nonnegative(),
|
|
19481
|
+
outputTokens: external_exports.number().int().nonnegative(),
|
|
19482
|
+
cacheCreationTokens: external_exports.number().int().nonnegative(),
|
|
19483
|
+
cacheReadTokens: external_exports.number().int().nonnegative(),
|
|
19484
|
+
// The harness provider's own per-model cost, for reconciliation only; null
|
|
19485
|
+
// when the harness reports none. Never the billed figure.
|
|
19486
|
+
providerCostUsd: external_exports.number().nonnegative().nullable()
|
|
19487
|
+
}).strict();
|
|
19488
|
+
var RuntimeBridgeTurnUsageSchema = external_exports.object({
|
|
19489
|
+
harness: RuntimeBridgeUsageHarnessSchema,
|
|
19490
|
+
models: external_exports.array(RuntimeBridgeModelUsageSchema)
|
|
19491
|
+
}).strict();
|
|
19477
19492
|
var ConversationTextContentPartSchema = external_exports.object({
|
|
19478
19493
|
type: external_exports.literal("text"),
|
|
19479
19494
|
text: external_exports.string()
|
|
@@ -19656,7 +19671,10 @@ var RuntimeBridgeOutputEntryEnvelopeWireSchema = external_exports.object({
|
|
|
19656
19671
|
content: ConversationEntryContentSchema,
|
|
19657
19672
|
createdAt: external_exports.string().datetime(),
|
|
19658
19673
|
completedAt: external_exports.string().datetime().nullable(),
|
|
19659
|
-
turnStatus: RuntimeTurnStatusSchema.optional()
|
|
19674
|
+
turnStatus: RuntimeTurnStatusSchema.optional(),
|
|
19675
|
+
// Present only on a turn's terminal result entry; carries the captured
|
|
19676
|
+
// token/cost usage the persisting side turns into ledger rows.
|
|
19677
|
+
usage: RuntimeBridgeTurnUsageSchema.optional()
|
|
19660
19678
|
}).strict();
|
|
19661
19679
|
var LegacyRuntimeBridgeOutputEntryEnvelopeSchema = RuntimeBridgeOutputEntryEnvelopeWireSchema.omit({ turnStatus: true }).extend({
|
|
19662
19680
|
sessionStatusAfter: external_exports.enum(["awaiting", "failed"])
|
|
@@ -23322,7 +23340,7 @@ Object.assign(lookup, {
|
|
|
23322
23340
|
// package.json
|
|
23323
23341
|
var package_default = {
|
|
23324
23342
|
name: "@autohq/cli",
|
|
23325
|
-
version: "0.1.
|
|
23343
|
+
version: "0.1.230",
|
|
23326
23344
|
license: "SEE LICENSE IN README.md",
|
|
23327
23345
|
publishConfig: {
|
|
23328
23346
|
access: "public"
|
|
@@ -24565,13 +24583,29 @@ var ClaudeCodeUserRecordSchema = external_exports.object({
|
|
|
24565
24583
|
type: external_exports.literal("user"),
|
|
24566
24584
|
message: ClaudeCodeUserMessageSchema
|
|
24567
24585
|
}).passthrough();
|
|
24586
|
+
var ClaudeCodeAggregateUsageSchema = external_exports.object({
|
|
24587
|
+
input_tokens: external_exports.number().optional(),
|
|
24588
|
+
output_tokens: external_exports.number().optional(),
|
|
24589
|
+
cache_creation_input_tokens: external_exports.number().optional(),
|
|
24590
|
+
cache_read_input_tokens: external_exports.number().optional()
|
|
24591
|
+
}).passthrough();
|
|
24592
|
+
var ClaudeCodeModelUsageSchema = external_exports.object({
|
|
24593
|
+
inputTokens: external_exports.number().optional(),
|
|
24594
|
+
outputTokens: external_exports.number().optional(),
|
|
24595
|
+
cacheCreationInputTokens: external_exports.number().optional(),
|
|
24596
|
+
cacheReadInputTokens: external_exports.number().optional(),
|
|
24597
|
+
costUSD: external_exports.number().optional()
|
|
24598
|
+
}).passthrough();
|
|
24568
24599
|
var ClaudeCodeResultRecordSchema = external_exports.object({
|
|
24569
24600
|
type: external_exports.literal("result"),
|
|
24570
24601
|
subtype: external_exports.string().optional(),
|
|
24571
24602
|
is_error: external_exports.boolean().optional(),
|
|
24572
24603
|
error: external_exports.string().optional(),
|
|
24573
24604
|
errors: external_exports.array(external_exports.string()).optional(),
|
|
24574
|
-
result: external_exports.string().optional()
|
|
24605
|
+
result: external_exports.string().optional(),
|
|
24606
|
+
total_cost_usd: external_exports.number().optional(),
|
|
24607
|
+
usage: ClaudeCodeAggregateUsageSchema.optional(),
|
|
24608
|
+
modelUsage: external_exports.record(external_exports.string(), ClaudeCodeModelUsageSchema).optional()
|
|
24575
24609
|
}).passthrough();
|
|
24576
24610
|
var ClaudeCodeSessionRecordSchema = external_exports.object({
|
|
24577
24611
|
session_id: external_exports.string().trim().min(1)
|
|
@@ -24601,11 +24635,13 @@ function parseClaudeCodeStreamRecord(parsed) {
|
|
|
24601
24635
|
const isError = record2.is_error === true || record2.subtype === "error";
|
|
24602
24636
|
const sdkErrorMessage = record2.errors?.map((error51) => error51.trim()).filter(Boolean).join("\n");
|
|
24603
24637
|
const errorMessage4 = isError ? record2.error ?? record2.result ?? (sdkErrorMessage || void 0) ?? "claude-code reported an error" : void 0;
|
|
24638
|
+
const usage = claudeCodeUsageFromRecord(record2);
|
|
24604
24639
|
return {
|
|
24605
24640
|
projections: [],
|
|
24606
24641
|
result: {
|
|
24607
24642
|
isError,
|
|
24608
|
-
errorMessage: errorMessage4
|
|
24643
|
+
errorMessage: errorMessage4,
|
|
24644
|
+
...usage ? { usage } : {}
|
|
24609
24645
|
}
|
|
24610
24646
|
};
|
|
24611
24647
|
}
|
|
@@ -24742,6 +24778,43 @@ function userContentProjections(message) {
|
|
|
24742
24778
|
}
|
|
24743
24779
|
return projections;
|
|
24744
24780
|
}
|
|
24781
|
+
function claudeCodeUsageFromRecord(record2) {
|
|
24782
|
+
const aggregate = record2.usage;
|
|
24783
|
+
const modelUsage = record2.modelUsage;
|
|
24784
|
+
if (!aggregate && !modelUsage) {
|
|
24785
|
+
return void 0;
|
|
24786
|
+
}
|
|
24787
|
+
const perModel = Object.entries(modelUsage ?? {}).map(
|
|
24788
|
+
([model, usage]) => ({
|
|
24789
|
+
model,
|
|
24790
|
+
inputTokens: tokenCount(usage.inputTokens),
|
|
24791
|
+
outputTokens: tokenCount(usage.outputTokens),
|
|
24792
|
+
cacheCreationTokens: tokenCount(usage.cacheCreationInputTokens),
|
|
24793
|
+
cacheReadTokens: tokenCount(usage.cacheReadInputTokens),
|
|
24794
|
+
providerCostUsd: usdAmount(usage.costUSD)
|
|
24795
|
+
})
|
|
24796
|
+
);
|
|
24797
|
+
return {
|
|
24798
|
+
inputTokens: tokenCount(aggregate?.input_tokens),
|
|
24799
|
+
outputTokens: tokenCount(aggregate?.output_tokens),
|
|
24800
|
+
cacheCreationTokens: tokenCount(aggregate?.cache_creation_input_tokens),
|
|
24801
|
+
cacheReadTokens: tokenCount(aggregate?.cache_read_input_tokens),
|
|
24802
|
+
totalCostUsd: usdAmount(record2.total_cost_usd),
|
|
24803
|
+
perModel
|
|
24804
|
+
};
|
|
24805
|
+
}
|
|
24806
|
+
function tokenCount(value2) {
|
|
24807
|
+
if (typeof value2 !== "number" || !Number.isFinite(value2) || value2 < 0) {
|
|
24808
|
+
return 0;
|
|
24809
|
+
}
|
|
24810
|
+
return Math.trunc(value2);
|
|
24811
|
+
}
|
|
24812
|
+
function usdAmount(value2) {
|
|
24813
|
+
if (typeof value2 !== "number" || !Number.isFinite(value2) || value2 < 0) {
|
|
24814
|
+
return 0;
|
|
24815
|
+
}
|
|
24816
|
+
return value2;
|
|
24817
|
+
}
|
|
24745
24818
|
|
|
24746
24819
|
// ../../packages/schemas/src/codex.ts
|
|
24747
24820
|
var CodexRequestIdSchema = external_exports.union([external_exports.string(), external_exports.number()]);
|
|
@@ -27873,7 +27946,8 @@ function buildOutputEnvelope(context, outputSeq, projection) {
|
|
|
27873
27946
|
content: entry.content,
|
|
27874
27947
|
createdAt,
|
|
27875
27948
|
completedAt: entry.status === "in_progress" ? null : createdAt,
|
|
27876
|
-
...entry.turnStatus ? { turnStatus: entry.turnStatus } : {}
|
|
27949
|
+
...entry.turnStatus ? { turnStatus: entry.turnStatus } : {},
|
|
27950
|
+
...entry.usage ? { usage: entry.usage } : {}
|
|
27877
27951
|
});
|
|
27878
27952
|
}
|
|
27879
27953
|
function buildDeltaOutputEnvelope(input) {
|
|
@@ -27934,6 +28008,7 @@ var ClaudeCodeProjector = class {
|
|
|
27934
28008
|
}
|
|
27935
28009
|
};
|
|
27936
28010
|
function projectClaudeCodeResult(result) {
|
|
28011
|
+
const usage = claudeCodeTurnUsage(result.usage);
|
|
27937
28012
|
return {
|
|
27938
28013
|
type: "entry",
|
|
27939
28014
|
entry: {
|
|
@@ -27948,10 +28023,27 @@ function projectClaudeCodeResult(result) {
|
|
|
27948
28023
|
text: result.isError ? `claude-code failed: ${result.errorMessage ?? "unknown error"}` : "claude-code completed"
|
|
27949
28024
|
}
|
|
27950
28025
|
]
|
|
27951
|
-
}
|
|
28026
|
+
},
|
|
28027
|
+
...usage ? { usage } : {}
|
|
27952
28028
|
}
|
|
27953
28029
|
};
|
|
27954
28030
|
}
|
|
28031
|
+
function claudeCodeTurnUsage(usage) {
|
|
28032
|
+
if (!usage || usage.perModel.length === 0) {
|
|
28033
|
+
return void 0;
|
|
28034
|
+
}
|
|
28035
|
+
return {
|
|
28036
|
+
harness: "claude-code",
|
|
28037
|
+
models: usage.perModel.map((model) => ({
|
|
28038
|
+
model: model.model,
|
|
28039
|
+
inputTokens: model.inputTokens,
|
|
28040
|
+
outputTokens: model.outputTokens,
|
|
28041
|
+
cacheCreationTokens: model.cacheCreationTokens,
|
|
28042
|
+
cacheReadTokens: model.cacheReadTokens,
|
|
28043
|
+
providerCostUsd: model.providerCostUsd
|
|
28044
|
+
}))
|
|
28045
|
+
};
|
|
28046
|
+
}
|
|
27955
28047
|
function anthropicMessageIdFromStreamStart(message) {
|
|
27956
28048
|
const event = message.event;
|
|
27957
28049
|
if (event.type !== "message_start") {
|
package/dist/index.js
CHANGED
|
@@ -15967,11 +15967,13 @@ function parseClaudeCodeStreamRecord(parsed) {
|
|
|
15967
15967
|
const isError = record2.is_error === true || record2.subtype === "error";
|
|
15968
15968
|
const sdkErrorMessage = record2.errors?.map((error51) => error51.trim()).filter(Boolean).join("\n");
|
|
15969
15969
|
const errorMessage6 = isError ? record2.error ?? record2.result ?? (sdkErrorMessage || void 0) ?? "claude-code reported an error" : void 0;
|
|
15970
|
+
const usage = claudeCodeUsageFromRecord(record2);
|
|
15970
15971
|
return {
|
|
15971
15972
|
projections: [],
|
|
15972
15973
|
result: {
|
|
15973
15974
|
isError,
|
|
15974
|
-
errorMessage: errorMessage6
|
|
15975
|
+
errorMessage: errorMessage6,
|
|
15976
|
+
...usage ? { usage } : {}
|
|
15975
15977
|
}
|
|
15976
15978
|
};
|
|
15977
15979
|
}
|
|
@@ -16105,7 +16107,44 @@ function userContentProjections(message) {
|
|
|
16105
16107
|
}
|
|
16106
16108
|
return projections;
|
|
16107
16109
|
}
|
|
16108
|
-
|
|
16110
|
+
function claudeCodeUsageFromRecord(record2) {
|
|
16111
|
+
const aggregate = record2.usage;
|
|
16112
|
+
const modelUsage = record2.modelUsage;
|
|
16113
|
+
if (!aggregate && !modelUsage) {
|
|
16114
|
+
return void 0;
|
|
16115
|
+
}
|
|
16116
|
+
const perModel = Object.entries(modelUsage ?? {}).map(
|
|
16117
|
+
([model, usage]) => ({
|
|
16118
|
+
model,
|
|
16119
|
+
inputTokens: tokenCount(usage.inputTokens),
|
|
16120
|
+
outputTokens: tokenCount(usage.outputTokens),
|
|
16121
|
+
cacheCreationTokens: tokenCount(usage.cacheCreationInputTokens),
|
|
16122
|
+
cacheReadTokens: tokenCount(usage.cacheReadInputTokens),
|
|
16123
|
+
providerCostUsd: usdAmount(usage.costUSD)
|
|
16124
|
+
})
|
|
16125
|
+
);
|
|
16126
|
+
return {
|
|
16127
|
+
inputTokens: tokenCount(aggregate?.input_tokens),
|
|
16128
|
+
outputTokens: tokenCount(aggregate?.output_tokens),
|
|
16129
|
+
cacheCreationTokens: tokenCount(aggregate?.cache_creation_input_tokens),
|
|
16130
|
+
cacheReadTokens: tokenCount(aggregate?.cache_read_input_tokens),
|
|
16131
|
+
totalCostUsd: usdAmount(record2.total_cost_usd),
|
|
16132
|
+
perModel
|
|
16133
|
+
};
|
|
16134
|
+
}
|
|
16135
|
+
function tokenCount(value) {
|
|
16136
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
|
|
16137
|
+
return 0;
|
|
16138
|
+
}
|
|
16139
|
+
return Math.trunc(value);
|
|
16140
|
+
}
|
|
16141
|
+
function usdAmount(value) {
|
|
16142
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
|
|
16143
|
+
return 0;
|
|
16144
|
+
}
|
|
16145
|
+
return value;
|
|
16146
|
+
}
|
|
16147
|
+
var ASK_USER_QUESTION_TOOL_NAME, ClaudeCodeTextBlockSchema, ClaudeCodeToolUseBlockSchema, ClaudeCodeToolResultBlockSchema, ClaudeCodeAssistantContentBlockSchema, OptionalClaudeCodeAssistantContentBlockSchema, ClaudeCodeAssistantContentSchema, OptionalClaudeCodeToolResultBlockSchema, ClaudeCodeToolResultContentSchema, ClaudeCodeUserContentSchema, ClaudeCodeAssistantMessageSchema, ClaudeCodeUserMessageSchema, ClaudeCodeSystemRecordSchema, ClaudeCodeAssistantRecordSchema, ClaudeCodeUserRecordSchema, ClaudeCodeAggregateUsageSchema, ClaudeCodeModelUsageSchema, ClaudeCodeResultRecordSchema, ClaudeCodeSessionRecordSchema, ClaudeCodeStreamRecordSchema, AskUserQuestionInputSchema;
|
|
16109
16148
|
var init_claude_code = __esm({
|
|
16110
16149
|
"../../packages/schemas/src/claude-code.ts"() {
|
|
16111
16150
|
"use strict";
|
|
@@ -16176,13 +16215,29 @@ var init_claude_code = __esm({
|
|
|
16176
16215
|
type: external_exports.literal("user"),
|
|
16177
16216
|
message: ClaudeCodeUserMessageSchema
|
|
16178
16217
|
}).passthrough();
|
|
16218
|
+
ClaudeCodeAggregateUsageSchema = external_exports.object({
|
|
16219
|
+
input_tokens: external_exports.number().optional(),
|
|
16220
|
+
output_tokens: external_exports.number().optional(),
|
|
16221
|
+
cache_creation_input_tokens: external_exports.number().optional(),
|
|
16222
|
+
cache_read_input_tokens: external_exports.number().optional()
|
|
16223
|
+
}).passthrough();
|
|
16224
|
+
ClaudeCodeModelUsageSchema = external_exports.object({
|
|
16225
|
+
inputTokens: external_exports.number().optional(),
|
|
16226
|
+
outputTokens: external_exports.number().optional(),
|
|
16227
|
+
cacheCreationInputTokens: external_exports.number().optional(),
|
|
16228
|
+
cacheReadInputTokens: external_exports.number().optional(),
|
|
16229
|
+
costUSD: external_exports.number().optional()
|
|
16230
|
+
}).passthrough();
|
|
16179
16231
|
ClaudeCodeResultRecordSchema = external_exports.object({
|
|
16180
16232
|
type: external_exports.literal("result"),
|
|
16181
16233
|
subtype: external_exports.string().optional(),
|
|
16182
16234
|
is_error: external_exports.boolean().optional(),
|
|
16183
16235
|
error: external_exports.string().optional(),
|
|
16184
16236
|
errors: external_exports.array(external_exports.string()).optional(),
|
|
16185
|
-
result: external_exports.string().optional()
|
|
16237
|
+
result: external_exports.string().optional(),
|
|
16238
|
+
total_cost_usd: external_exports.number().optional(),
|
|
16239
|
+
usage: ClaudeCodeAggregateUsageSchema.optional(),
|
|
16240
|
+
modelUsage: external_exports.record(external_exports.string(), ClaudeCodeModelUsageSchema).optional()
|
|
16186
16241
|
}).passthrough();
|
|
16187
16242
|
ClaudeCodeSessionRecordSchema = external_exports.object({
|
|
16188
16243
|
session_id: external_exports.string().trim().min(1)
|
|
@@ -22241,7 +22296,7 @@ var init_package = __esm({
|
|
|
22241
22296
|
"package.json"() {
|
|
22242
22297
|
package_default = {
|
|
22243
22298
|
name: "@autohq/cli",
|
|
22244
|
-
version: "0.1.
|
|
22299
|
+
version: "0.1.230",
|
|
22245
22300
|
license: "SEE LICENSE IN README.md",
|
|
22246
22301
|
publishConfig: {
|
|
22247
22302
|
access: "public"
|
|
@@ -26882,7 +26937,7 @@ function conversationEscapeAction(input) {
|
|
|
26882
26937
|
function WorkingIndicator({
|
|
26883
26938
|
word,
|
|
26884
26939
|
startedAt,
|
|
26885
|
-
tokenCount
|
|
26940
|
+
tokenCount: tokenCount2
|
|
26886
26941
|
}) {
|
|
26887
26942
|
const [tick, setTick] = useState2(0);
|
|
26888
26943
|
useEffect2(() => {
|
|
@@ -26910,7 +26965,7 @@ function WorkingIndicator({
|
|
|
26910
26965
|
/* @__PURE__ */ jsx4(Text4, { color: TRANSCRIPT_COLORS.spinner, children: "\u2026 " }),
|
|
26911
26966
|
/* @__PURE__ */ jsx4(Text4, { color: TRANSCRIPT_COLORS.dim, children: formatWorkingSuffix({
|
|
26912
26967
|
elapsedSeconds: elapsedSeconds(startedAt),
|
|
26913
|
-
tokenCount
|
|
26968
|
+
tokenCount: tokenCount2
|
|
26914
26969
|
}) })
|
|
26915
26970
|
] })
|
|
26916
26971
|
] });
|
|
@@ -31666,6 +31721,21 @@ var RuntimeTurnStatusSchema = external_exports.enum([
|
|
|
31666
31721
|
"completed",
|
|
31667
31722
|
"failed"
|
|
31668
31723
|
]);
|
|
31724
|
+
var RuntimeBridgeUsageHarnessSchema = external_exports.enum(["claude-code", "codex"]);
|
|
31725
|
+
var RuntimeBridgeModelUsageSchema = external_exports.object({
|
|
31726
|
+
model: external_exports.string().trim().min(1),
|
|
31727
|
+
inputTokens: external_exports.number().int().nonnegative(),
|
|
31728
|
+
outputTokens: external_exports.number().int().nonnegative(),
|
|
31729
|
+
cacheCreationTokens: external_exports.number().int().nonnegative(),
|
|
31730
|
+
cacheReadTokens: external_exports.number().int().nonnegative(),
|
|
31731
|
+
// The harness provider's own per-model cost, for reconciliation only; null
|
|
31732
|
+
// when the harness reports none. Never the billed figure.
|
|
31733
|
+
providerCostUsd: external_exports.number().nonnegative().nullable()
|
|
31734
|
+
}).strict();
|
|
31735
|
+
var RuntimeBridgeTurnUsageSchema = external_exports.object({
|
|
31736
|
+
harness: RuntimeBridgeUsageHarnessSchema,
|
|
31737
|
+
models: external_exports.array(RuntimeBridgeModelUsageSchema)
|
|
31738
|
+
}).strict();
|
|
31669
31739
|
var ConversationTextContentPartSchema2 = external_exports.object({
|
|
31670
31740
|
type: external_exports.literal("text"),
|
|
31671
31741
|
text: external_exports.string()
|
|
@@ -31848,7 +31918,10 @@ var RuntimeBridgeOutputEntryEnvelopeWireSchema = external_exports.object({
|
|
|
31848
31918
|
content: ConversationEntryContentSchema2,
|
|
31849
31919
|
createdAt: external_exports.string().datetime(),
|
|
31850
31920
|
completedAt: external_exports.string().datetime().nullable(),
|
|
31851
|
-
turnStatus: RuntimeTurnStatusSchema.optional()
|
|
31921
|
+
turnStatus: RuntimeTurnStatusSchema.optional(),
|
|
31922
|
+
// Present only on a turn's terminal result entry; carries the captured
|
|
31923
|
+
// token/cost usage the persisting side turns into ledger rows.
|
|
31924
|
+
usage: RuntimeBridgeTurnUsageSchema.optional()
|
|
31852
31925
|
}).strict();
|
|
31853
31926
|
var LegacyRuntimeBridgeOutputEntryEnvelopeSchema = RuntimeBridgeOutputEntryEnvelopeWireSchema.omit({ turnStatus: true }).extend({
|
|
31854
31927
|
sessionStatusAfter: external_exports.enum(["awaiting", "failed"])
|
|
@@ -32592,7 +32665,8 @@ function buildOutputEnvelope(context, outputSeq, projection) {
|
|
|
32592
32665
|
content: entry.content,
|
|
32593
32666
|
createdAt,
|
|
32594
32667
|
completedAt: entry.status === "in_progress" ? null : createdAt,
|
|
32595
|
-
...entry.turnStatus ? { turnStatus: entry.turnStatus } : {}
|
|
32668
|
+
...entry.turnStatus ? { turnStatus: entry.turnStatus } : {},
|
|
32669
|
+
...entry.usage ? { usage: entry.usage } : {}
|
|
32596
32670
|
});
|
|
32597
32671
|
}
|
|
32598
32672
|
function buildDeltaOutputEnvelope(input) {
|
|
@@ -32654,6 +32728,7 @@ var ClaudeCodeProjector = class {
|
|
|
32654
32728
|
}
|
|
32655
32729
|
};
|
|
32656
32730
|
function projectClaudeCodeResult(result) {
|
|
32731
|
+
const usage = claudeCodeTurnUsage(result.usage);
|
|
32657
32732
|
return {
|
|
32658
32733
|
type: "entry",
|
|
32659
32734
|
entry: {
|
|
@@ -32668,10 +32743,27 @@ function projectClaudeCodeResult(result) {
|
|
|
32668
32743
|
text: result.isError ? `claude-code failed: ${result.errorMessage ?? "unknown error"}` : "claude-code completed"
|
|
32669
32744
|
}
|
|
32670
32745
|
]
|
|
32671
|
-
}
|
|
32746
|
+
},
|
|
32747
|
+
...usage ? { usage } : {}
|
|
32672
32748
|
}
|
|
32673
32749
|
};
|
|
32674
32750
|
}
|
|
32751
|
+
function claudeCodeTurnUsage(usage) {
|
|
32752
|
+
if (!usage || usage.perModel.length === 0) {
|
|
32753
|
+
return void 0;
|
|
32754
|
+
}
|
|
32755
|
+
return {
|
|
32756
|
+
harness: "claude-code",
|
|
32757
|
+
models: usage.perModel.map((model) => ({
|
|
32758
|
+
model: model.model,
|
|
32759
|
+
inputTokens: model.inputTokens,
|
|
32760
|
+
outputTokens: model.outputTokens,
|
|
32761
|
+
cacheCreationTokens: model.cacheCreationTokens,
|
|
32762
|
+
cacheReadTokens: model.cacheReadTokens,
|
|
32763
|
+
providerCostUsd: model.providerCostUsd
|
|
32764
|
+
}))
|
|
32765
|
+
};
|
|
32766
|
+
}
|
|
32675
32767
|
function anthropicMessageIdFromStreamStart(message) {
|
|
32676
32768
|
const event = message.event;
|
|
32677
32769
|
if (event.type !== "message_start") {
|