sidekick-shared 0.23.1 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +115 -37
- package/dist/aggregation/EventAggregator.d.ts +5 -1
- package/dist/aggregation/EventAggregator.js +64 -131
- package/dist/aggregation/types.d.ts +3 -0
- package/dist/browser.d.ts +6 -0
- package/dist/browser.js +10 -1
- package/dist/context/sessionContext.js +8 -6
- package/dist/extractors/tokenUsage.js +1 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +23 -7
- package/dist/modelInfo.d.ts +17 -7
- package/dist/modelInfo.js +5 -2
- package/dist/node.d.ts +4 -0
- package/dist/node.js +8 -1
- package/dist/observedSessionCollector.d.ts +68 -0
- package/dist/observedSessionCollector.js +178 -0
- package/dist/parsers/codexParser.js +21 -6
- package/dist/parsers/openCodeParser.js +22 -1
- package/dist/parsers/subagentTraceParser.js +11 -5
- package/dist/providers/claudeCode.js +45 -1
- package/dist/providers/codex.js +17 -7
- package/dist/report/transcriptParser.d.ts +3 -11
- package/dist/report/transcriptParser.js +69 -154
- package/dist/schemas/index.d.ts +7 -1
- package/dist/schemas/index.js +18 -2
- package/dist/schemas/observedSessionV1.d.ts +32 -1
- package/dist/schemas/observedSessionV1.js +11 -1
- package/dist/schemas/sessionEvent.d.ts +353 -12
- package/dist/schemas/sessionEvent.js +76 -14
- package/dist/schemas/tokenEstimation.d.ts +14 -0
- package/dist/schemas/tokenEstimation.js +10 -0
- package/dist/schemas/transcript.d.ts +24 -0
- package/dist/schemas/transcript.js +81 -0
- package/dist/schemas/usageNormalization.d.ts +55 -0
- package/dist/schemas/usageNormalization.js +41 -0
- package/dist/sessionTranscripts.d.ts +16 -0
- package/dist/sessionTranscripts.js +47 -0
- package/dist/tokenEstimation.d.ts +24 -0
- package/dist/tokenEstimation.js +62 -0
- package/dist/transcript.d.ts +92 -0
- package/dist/transcript.js +240 -0
- package/dist/types/observedSessionV1.d.ts +3 -1
- package/dist/types/observedSessionV1.js +14 -1
- package/dist/types/sessionEvent.d.ts +65 -7
- package/dist/usageNormalization.d.ts +69 -0
- package/dist/usageNormalization.js +100 -0
- package/package.json +1 -1
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Parse Claude Code JSONL session files into typed transcript entries
|
|
4
|
-
* with full, untruncated content suitable for HTML report rendering.
|
|
5
|
-
*/
|
|
2
|
+
/** Report compatibility adapters over the canonical transcript projection. */
|
|
6
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
4
|
if (k2 === undefined) k2 = k;
|
|
8
5
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -39,167 +36,85 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
39
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
37
|
exports.parseTranscript = parseTranscript;
|
|
41
38
|
exports.parseTranscriptFromEvents = parseTranscriptFromEvents;
|
|
42
|
-
const fs = __importStar(require("fs"));
|
|
39
|
+
const fs = __importStar(require("node:fs"));
|
|
43
40
|
const jsonl_1 = require("../parsers/jsonl");
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
* Unlike the FollowEvent pipeline (which truncates to 120-200 chars),
|
|
48
|
-
* this preserves full message content for HTML report rendering.
|
|
49
|
-
*/
|
|
41
|
+
const sessionEvent_1 = require("../schemas/sessionEvent");
|
|
42
|
+
const transcript_1 = require("../transcript");
|
|
43
|
+
/** Parse a Claude Code JSONL session through the canonical provider reader. */
|
|
50
44
|
function parseTranscript(sessionPath) {
|
|
51
|
-
let data;
|
|
52
45
|
try {
|
|
53
|
-
|
|
46
|
+
const events = [];
|
|
47
|
+
const parser = new jsonl_1.JsonlParser({
|
|
48
|
+
onEvent: (raw) => events.push(...(0, sessionEvent_1.extractSessionEvents)(raw)),
|
|
49
|
+
});
|
|
50
|
+
parser.processChunk(fs.readFileSync(sessionPath, 'utf8'));
|
|
51
|
+
parser.flush();
|
|
52
|
+
return parseTranscriptFromEvents(events);
|
|
54
53
|
}
|
|
55
54
|
catch {
|
|
56
55
|
return [];
|
|
57
56
|
}
|
|
58
|
-
const events = [];
|
|
59
|
-
const parser = new jsonl_1.JsonlParser({
|
|
60
|
-
onEvent: (event) => events.push(event),
|
|
61
|
-
});
|
|
62
|
-
parser.processChunk(data);
|
|
63
|
-
parser.flush();
|
|
64
|
-
const entries = [];
|
|
65
|
-
for (const event of events) {
|
|
66
|
-
const entry = eventToTranscriptEntry(event);
|
|
67
|
-
if (entry) {
|
|
68
|
-
entries.push(entry);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return entries;
|
|
72
57
|
}
|
|
73
|
-
/**
|
|
58
|
+
/** Project canonical provider events into the legacy report transcript shape. */
|
|
74
59
|
function parseTranscriptFromEvents(events) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return null;
|
|
87
|
-
const role = event.message.role;
|
|
88
|
-
const timestamp = event.timestamp || '';
|
|
89
|
-
const sourceLabel = event.message.sourceLabel;
|
|
90
|
-
const model = event.message.model;
|
|
91
|
-
const usage = event.message.usage
|
|
92
|
-
? {
|
|
93
|
-
input_tokens: event.message.usage.input_tokens || 0,
|
|
94
|
-
output_tokens: event.message.usage.output_tokens || 0,
|
|
95
|
-
cache_creation_input_tokens: event.message.usage.cache_creation_input_tokens,
|
|
96
|
-
cache_read_input_tokens: event.message.usage.cache_read_input_tokens,
|
|
97
|
-
}
|
|
98
|
-
: undefined;
|
|
99
|
-
const content = extractContentBlocks(event.message.content);
|
|
100
|
-
// Skip empty entries (warmup messages, etc.)
|
|
101
|
-
if (content.length === 0) {
|
|
102
|
-
if (usage || sourceLabel) {
|
|
103
|
-
content.push({
|
|
104
|
-
type: 'text',
|
|
105
|
-
text: sourceLabel ? `${sourceLabel} updated` : 'Usage updated',
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
return null;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
let type;
|
|
113
|
-
// Check event.type first — summary events have role 'assistant' but should be typed as 'summary'
|
|
114
|
-
if (event.type === 'summary') {
|
|
115
|
-
type = 'summary';
|
|
116
|
-
}
|
|
117
|
-
else if (event.type === 'system') {
|
|
118
|
-
type = 'system';
|
|
119
|
-
}
|
|
120
|
-
else if (role === 'user') {
|
|
121
|
-
type = 'user';
|
|
122
|
-
}
|
|
123
|
-
else if (role === 'assistant') {
|
|
124
|
-
type = 'assistant';
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
type = 'system';
|
|
128
|
-
}
|
|
129
|
-
return { type, timestamp, sourceLabel, model, usage, content };
|
|
130
|
-
}
|
|
131
|
-
function extractContentBlocks(content) {
|
|
132
|
-
if (!content)
|
|
133
|
-
return [];
|
|
134
|
-
// Simple string content
|
|
135
|
-
if (typeof content === 'string') {
|
|
136
|
-
return content.trim() ? [{ type: 'text', text: content }] : [];
|
|
137
|
-
}
|
|
138
|
-
// Array of content blocks (Claude API format)
|
|
139
|
-
if (!Array.isArray(content))
|
|
140
|
-
return [];
|
|
141
|
-
const blocks = [];
|
|
142
|
-
for (const block of content) {
|
|
143
|
-
if (!block || typeof block !== 'object')
|
|
144
|
-
continue;
|
|
145
|
-
switch (block.type) {
|
|
146
|
-
case 'text': {
|
|
147
|
-
const text = typeof block.text === 'string' ? block.text : '';
|
|
148
|
-
if (text.trim()) {
|
|
149
|
-
blocks.push({ type: 'text', text });
|
|
150
|
-
}
|
|
151
|
-
break;
|
|
152
|
-
}
|
|
153
|
-
case 'thinking': {
|
|
154
|
-
const text = typeof block.thinking === 'string' ? block.thinking : '';
|
|
155
|
-
if (text.trim()) {
|
|
156
|
-
blocks.push({ type: 'thinking', text });
|
|
157
|
-
}
|
|
158
|
-
break;
|
|
159
|
-
}
|
|
160
|
-
case 'tool_use': {
|
|
161
|
-
const toolName = typeof block.name === 'string' ? block.name : 'unknown';
|
|
162
|
-
const toolInput = block.input && typeof block.input === 'object'
|
|
163
|
-
? block.input
|
|
164
|
-
: {};
|
|
165
|
-
const toolUseId = typeof block.id === 'string' ? block.id : undefined;
|
|
166
|
-
blocks.push({ type: 'tool_use', toolName, toolInput, toolUseId });
|
|
167
|
-
break;
|
|
60
|
+
return (0, transcript_1.projectSessionTranscript)(events, { fidelity: 'full' }).messages.map((message) => ({
|
|
61
|
+
type: message.role === 'tool' ? 'system' : message.role,
|
|
62
|
+
timestamp: message.timestamp,
|
|
63
|
+
sourceLabel: message.sourceLabel,
|
|
64
|
+
model: message.model,
|
|
65
|
+
usage: message.usage
|
|
66
|
+
? {
|
|
67
|
+
input_tokens: message.usage.uncachedInputTokens,
|
|
68
|
+
output_tokens: message.usage.outputTokens,
|
|
69
|
+
cache_creation_input_tokens: message.usage.cacheWriteTokens || undefined,
|
|
70
|
+
cache_read_input_tokens: message.usage.cacheReadTokens || undefined,
|
|
168
71
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
72
|
+
: undefined,
|
|
73
|
+
content: message.content.flatMap(toReportBlock),
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
function toReportBlock(block) {
|
|
77
|
+
switch (block.type) {
|
|
78
|
+
case 'text':
|
|
79
|
+
return block.text ? [{ type: 'text', text: block.text }] : [];
|
|
80
|
+
case 'thinking':
|
|
81
|
+
return block.text ? [{ type: 'thinking', text: block.text }] : [];
|
|
82
|
+
case 'tool_use':
|
|
83
|
+
return [
|
|
84
|
+
{
|
|
85
|
+
type: 'tool_use',
|
|
86
|
+
toolName: block.toolName ?? 'unknown',
|
|
87
|
+
toolInput: block.input && typeof block.input === 'object'
|
|
88
|
+
? block.input
|
|
89
|
+
: {},
|
|
90
|
+
toolUseId: block.toolUseId,
|
|
91
|
+
},
|
|
92
|
+
];
|
|
93
|
+
case 'tool_result':
|
|
94
|
+
return [
|
|
95
|
+
{
|
|
96
|
+
type: 'tool_result',
|
|
97
|
+
toolUseId: block.toolUseId,
|
|
98
|
+
output: reportToolOutput(block.output),
|
|
99
|
+
isError: block.isError,
|
|
100
|
+
},
|
|
101
|
+
];
|
|
102
|
+
case 'image':
|
|
103
|
+
return [{ type: 'image', text: block.text ?? '[Image content]' }];
|
|
104
|
+
case 'unknown':
|
|
105
|
+
return [];
|
|
183
106
|
}
|
|
184
|
-
return blocks;
|
|
185
107
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
typeof part === 'object' &&
|
|
197
|
-
part.type === 'text' &&
|
|
198
|
-
typeof part.text === 'string') {
|
|
199
|
-
parts.push(part.text);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
return parts.join('\n');
|
|
108
|
+
function reportToolOutput(output) {
|
|
109
|
+
if (typeof output === 'string')
|
|
110
|
+
return output;
|
|
111
|
+
if (Array.isArray(output)) {
|
|
112
|
+
return output
|
|
113
|
+
.flatMap((part) => part && typeof part === 'object' && part.type === 'text'
|
|
114
|
+
? [String(part.text ?? '')]
|
|
115
|
+
: [])
|
|
116
|
+
.filter(Boolean)
|
|
117
|
+
.join('\n');
|
|
203
118
|
}
|
|
204
|
-
return '';
|
|
119
|
+
return JSON.stringify(output ?? '');
|
|
205
120
|
}
|
package/dist/schemas/index.d.ts
CHANGED
|
@@ -10,8 +10,14 @@
|
|
|
10
10
|
* The mirrored TypeScript interfaces are re-exported as types so this
|
|
11
11
|
* subpath is self-sufficient for boundary-validation modules.
|
|
12
12
|
*/
|
|
13
|
-
export { messageUsageSchema, sessionMessageSchema, sessionEventSchema, permissionModeSchema, extractSessionEvents, } from './sessionEvent';
|
|
13
|
+
export { messageUsageSchema, sessionMessageSchema, sessionEventSchema, permissionModeSchema, extractSessionEvents, userSessionEventSchema, assistantSessionEventSchema, summarySessionEventSchema, systemSessionEventSchema, toolUseSessionEventSchema, toolResultSessionEventSchema, } from './sessionEvent';
|
|
14
14
|
export type { MessageUsage, SessionMessage, SessionEvent, PermissionMode, } from '../types/sessionEvent';
|
|
15
|
+
export { normalizedUsageSchema, normalizedUsageCostSchema } from './usageNormalization';
|
|
16
|
+
export type { NormalizedUsage, NormalizedUsageCost } from '../usageNormalization';
|
|
17
|
+
export { tokenEstimateSchema } from './tokenEstimation';
|
|
18
|
+
export type { TokenEstimate } from '../tokenEstimation';
|
|
19
|
+
export { canonicalTranscriptBlockSchema, canonicalToolCallSchema, canonicalTranscriptMessageSchema, canonicalSessionTranscriptSchema, } from './transcript';
|
|
20
|
+
export type { CanonicalSessionTranscript, CanonicalTranscriptMessage, CanonicalToolCall, } from '../transcript';
|
|
15
21
|
export { observationProvenanceV1Schema, observedAgentSessionV1Schema, observedValueV1Schema, pendingUserRequestV1Schema, providerCapabilitiesV1Schema, providerSessionAdapterV1Schema, sessionEvidenceRefV1Schema, } from './observedSessionV1';
|
|
16
22
|
export type { ObservationProvenanceV1, ObservedAgentSessionV1, ObservedValueV1, PendingUserRequestV1, ProviderCapabilitiesV1, ProviderSessionAdapterV1, SessionEvidenceRefV1, } from '../types/observedSessionV1';
|
|
17
23
|
export { quotaWindowSchema, quotaStateSchema, quotaFailureKindSchema, quotaProviderIdSchema, quotaSourceSchema, codexResetCreditSchema, codexResetCreditsSnapshotSchema, peakHoursStateSchema, quotaFailureDescriptorSchema, runtimeQuotaProviderSchema, providerQuotaStateSchema, claudeProviderQuotaStateSchema, codexProviderQuotaStateSchema, zaiProviderQuotaStateSchema, providerQuotaMapSchema, } from './quota';
|
package/dist/schemas/index.js
CHANGED
|
@@ -12,14 +12,30 @@
|
|
|
12
12
|
* subpath is self-sufficient for boundary-validation modules.
|
|
13
13
|
*/
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.
|
|
16
|
-
exports.assistantTurnToolRefSchema = void 0;
|
|
15
|
+
exports.accountEntrySchema = exports.accountLoginStatusSchema = exports.beginAccountLoginResultSchema = exports.accountManagerResultSchema = exports.accountProviderIdSchema = exports.activeAccountStatusSchema = exports.activeProviderAccountStatusSchema = exports.quotaHistoryDailyBucketSchema = exports.quotaHistorySampleSchema = exports.quotaHistoryRuntimeProviderSchema = exports.providerQuotaMapSchema = exports.zaiProviderQuotaStateSchema = exports.codexProviderQuotaStateSchema = exports.claudeProviderQuotaStateSchema = exports.providerQuotaStateSchema = exports.runtimeQuotaProviderSchema = exports.quotaFailureDescriptorSchema = exports.peakHoursStateSchema = exports.codexResetCreditsSnapshotSchema = exports.codexResetCreditSchema = exports.quotaSourceSchema = exports.quotaProviderIdSchema = exports.quotaFailureKindSchema = exports.quotaStateSchema = exports.quotaWindowSchema = exports.sessionEvidenceRefV1Schema = exports.providerSessionAdapterV1Schema = exports.providerCapabilitiesV1Schema = exports.pendingUserRequestV1Schema = exports.observedValueV1Schema = exports.observedAgentSessionV1Schema = exports.observationProvenanceV1Schema = exports.canonicalSessionTranscriptSchema = exports.canonicalTranscriptMessageSchema = exports.canonicalToolCallSchema = exports.canonicalTranscriptBlockSchema = exports.tokenEstimateSchema = exports.normalizedUsageCostSchema = exports.normalizedUsageSchema = exports.toolResultSessionEventSchema = exports.toolUseSessionEventSchema = exports.systemSessionEventSchema = exports.summarySessionEventSchema = exports.assistantSessionEventSchema = exports.userSessionEventSchema = exports.extractSessionEvents = exports.permissionModeSchema = exports.sessionEventSchema = exports.sessionMessageSchema = exports.messageUsageSchema = void 0;
|
|
16
|
+
exports.assistantTurnToolRefSchema = exports.assistantTurnToolGroupStepSchema = exports.assistantTurnTimelineItemSchema = exports.assistantTurnSubagentStatusSchema = exports.assistantTurnSubagentSchema = exports.assistantTurnReasoningTimelineItemSchema = exports.assistantTurnProjectionSchema = exports.assistantTurnProcessStepSchema = exports.assistantTurnProcessSchema = exports.assistantTurnNarrationStepSchema = exports.assistantTurnEventTypeSchema = exports.assistantTurnEventSchema = exports.listAllAccountsResultSchema = exports.savedAccountProfileSchema = void 0;
|
|
17
17
|
var sessionEvent_1 = require("./sessionEvent");
|
|
18
18
|
Object.defineProperty(exports, "messageUsageSchema", { enumerable: true, get: function () { return sessionEvent_1.messageUsageSchema; } });
|
|
19
19
|
Object.defineProperty(exports, "sessionMessageSchema", { enumerable: true, get: function () { return sessionEvent_1.sessionMessageSchema; } });
|
|
20
20
|
Object.defineProperty(exports, "sessionEventSchema", { enumerable: true, get: function () { return sessionEvent_1.sessionEventSchema; } });
|
|
21
21
|
Object.defineProperty(exports, "permissionModeSchema", { enumerable: true, get: function () { return sessionEvent_1.permissionModeSchema; } });
|
|
22
22
|
Object.defineProperty(exports, "extractSessionEvents", { enumerable: true, get: function () { return sessionEvent_1.extractSessionEvents; } });
|
|
23
|
+
Object.defineProperty(exports, "userSessionEventSchema", { enumerable: true, get: function () { return sessionEvent_1.userSessionEventSchema; } });
|
|
24
|
+
Object.defineProperty(exports, "assistantSessionEventSchema", { enumerable: true, get: function () { return sessionEvent_1.assistantSessionEventSchema; } });
|
|
25
|
+
Object.defineProperty(exports, "summarySessionEventSchema", { enumerable: true, get: function () { return sessionEvent_1.summarySessionEventSchema; } });
|
|
26
|
+
Object.defineProperty(exports, "systemSessionEventSchema", { enumerable: true, get: function () { return sessionEvent_1.systemSessionEventSchema; } });
|
|
27
|
+
Object.defineProperty(exports, "toolUseSessionEventSchema", { enumerable: true, get: function () { return sessionEvent_1.toolUseSessionEventSchema; } });
|
|
28
|
+
Object.defineProperty(exports, "toolResultSessionEventSchema", { enumerable: true, get: function () { return sessionEvent_1.toolResultSessionEventSchema; } });
|
|
29
|
+
var usageNormalization_1 = require("./usageNormalization");
|
|
30
|
+
Object.defineProperty(exports, "normalizedUsageSchema", { enumerable: true, get: function () { return usageNormalization_1.normalizedUsageSchema; } });
|
|
31
|
+
Object.defineProperty(exports, "normalizedUsageCostSchema", { enumerable: true, get: function () { return usageNormalization_1.normalizedUsageCostSchema; } });
|
|
32
|
+
var tokenEstimation_1 = require("./tokenEstimation");
|
|
33
|
+
Object.defineProperty(exports, "tokenEstimateSchema", { enumerable: true, get: function () { return tokenEstimation_1.tokenEstimateSchema; } });
|
|
34
|
+
var transcript_1 = require("./transcript");
|
|
35
|
+
Object.defineProperty(exports, "canonicalTranscriptBlockSchema", { enumerable: true, get: function () { return transcript_1.canonicalTranscriptBlockSchema; } });
|
|
36
|
+
Object.defineProperty(exports, "canonicalToolCallSchema", { enumerable: true, get: function () { return transcript_1.canonicalToolCallSchema; } });
|
|
37
|
+
Object.defineProperty(exports, "canonicalTranscriptMessageSchema", { enumerable: true, get: function () { return transcript_1.canonicalTranscriptMessageSchema; } });
|
|
38
|
+
Object.defineProperty(exports, "canonicalSessionTranscriptSchema", { enumerable: true, get: function () { return transcript_1.canonicalSessionTranscriptSchema; } });
|
|
23
39
|
var observedSessionV1_1 = require("./observedSessionV1");
|
|
24
40
|
Object.defineProperty(exports, "observationProvenanceV1Schema", { enumerable: true, get: function () { return observedSessionV1_1.observationProvenanceV1Schema; } });
|
|
25
41
|
Object.defineProperty(exports, "observedAgentSessionV1Schema", { enumerable: true, get: function () { return observedSessionV1_1.observedAgentSessionV1Schema; } });
|
|
@@ -290,8 +290,39 @@ export declare const observedAgentSessionV1Schema: z.ZodObject<{
|
|
|
290
290
|
timestamp: z.ZodOptional<z.ZodString>;
|
|
291
291
|
}, z.core.$strip>>;
|
|
292
292
|
}, z.core.$strip>;
|
|
293
|
+
normalized: z.ZodOptional<z.ZodObject<{
|
|
294
|
+
value: z.ZodObject<{
|
|
295
|
+
uncachedInputTokens: z.ZodNumber;
|
|
296
|
+
cacheReadTokens: z.ZodNumber;
|
|
297
|
+
cacheWriteTokens: z.ZodNumber;
|
|
298
|
+
outputTokens: z.ZodNumber;
|
|
299
|
+
reasoningTokens: z.ZodNumber;
|
|
300
|
+
cacheInclusiveInputTokens: z.ZodNumber;
|
|
301
|
+
billableOutputTokens: z.ZodNumber;
|
|
302
|
+
totalTokens: z.ZodNumber;
|
|
303
|
+
}, z.core.$strip>;
|
|
304
|
+
provenance: z.ZodEnum<{
|
|
305
|
+
reported: "reported";
|
|
306
|
+
estimated: "estimated";
|
|
307
|
+
inferred: "inferred";
|
|
308
|
+
}>;
|
|
309
|
+
confidence: z.ZodNumber;
|
|
310
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
311
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
312
|
+
provider: z.ZodEnum<{
|
|
313
|
+
"claude-code": "claude-code";
|
|
314
|
+
codex: "codex";
|
|
315
|
+
opencode: "opencode";
|
|
316
|
+
}>;
|
|
317
|
+
sessionId: z.ZodString;
|
|
318
|
+
sourcePath: z.ZodOptional<z.ZodString>;
|
|
319
|
+
eventIndex: z.ZodOptional<z.ZodNumber>;
|
|
320
|
+
eventId: z.ZodOptional<z.ZodString>;
|
|
321
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
322
|
+
}, z.core.$strip>>;
|
|
323
|
+
}, z.core.$strip>>;
|
|
293
324
|
costUsd: z.ZodObject<{
|
|
294
|
-
value: z.ZodNumber
|
|
325
|
+
value: z.ZodNullable<z.ZodNumber>;
|
|
295
326
|
provenance: z.ZodEnum<{
|
|
296
327
|
reported: "reported";
|
|
297
328
|
estimated: "estimated";
|
|
@@ -43,7 +43,17 @@ exports.observedAgentSessionV1Schema = zod_1.z.object({
|
|
|
43
43
|
outputTokens: (0, exports.observedValueV1Schema)(zod_1.z.number().nonnegative()),
|
|
44
44
|
cacheReadTokens: (0, exports.observedValueV1Schema)(zod_1.z.number().nonnegative()),
|
|
45
45
|
cacheWriteTokens: (0, exports.observedValueV1Schema)(zod_1.z.number().nonnegative()),
|
|
46
|
-
|
|
46
|
+
normalized: (0, exports.observedValueV1Schema)(zod_1.z.object({
|
|
47
|
+
uncachedInputTokens: zod_1.z.number().finite().nonnegative(),
|
|
48
|
+
cacheReadTokens: zod_1.z.number().finite().nonnegative(),
|
|
49
|
+
cacheWriteTokens: zod_1.z.number().finite().nonnegative(),
|
|
50
|
+
outputTokens: zod_1.z.number().finite().nonnegative(),
|
|
51
|
+
reasoningTokens: zod_1.z.number().finite().nonnegative(),
|
|
52
|
+
cacheInclusiveInputTokens: zod_1.z.number().finite().nonnegative(),
|
|
53
|
+
billableOutputTokens: zod_1.z.number().finite().nonnegative(),
|
|
54
|
+
totalTokens: zod_1.z.number().finite().nonnegative(),
|
|
55
|
+
})).optional(),
|
|
56
|
+
costUsd: (0, exports.observedValueV1Schema)(zod_1.z.number().nonnegative().nullable()),
|
|
47
57
|
}),
|
|
48
58
|
pendingUserRequest: exports.pendingUserRequestV1Schema.nullable(),
|
|
49
59
|
observedAt: zod_1.z.string(),
|