@armoriq/sdk-dev 0.8.5 → 0.8.6
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 +2 -30
- package/dist/_version.d.ts +1 -1
- package/dist/_version.js +1 -1
- package/dist/client.d.ts +0 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +15 -39
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -5
- package/dist/index.js.map +1 -1
- package/dist/observability/index.d.ts +2 -2
- package/dist/observability/index.d.ts.map +1 -1
- package/dist/observability/index.js.map +1 -1
- package/dist/observability/otel-runtime.d.ts +10 -1
- package/dist/observability/otel-runtime.d.ts.map +1 -1
- package/dist/observability/otel-runtime.js +56 -10
- package/dist/observability/otel-runtime.js.map +1 -1
- package/dist/observability/otel-session.d.ts +14 -2
- package/dist/observability/otel-session.d.ts.map +1 -1
- package/dist/observability/otel-session.js +39 -18
- package/dist/observability/otel-session.js.map +1 -1
- package/dist/token_usage.d.ts +10 -33
- package/dist/token_usage.d.ts.map +1 -1
- package/dist/token_usage.js +38 -85
- package/dist/token_usage.js.map +1 -1
- package/package.json +9 -9
- package/dist/session_transcripts.d.ts +0 -8
- package/dist/session_transcripts.d.ts.map +0 -1
- package/dist/session_transcripts.js +0 -72
- package/dist/session_transcripts.js.map +0 -1
package/dist/token_usage.d.ts
CHANGED
|
@@ -11,31 +11,22 @@ export interface RecordTokenUsagePayload {
|
|
|
11
11
|
product: string;
|
|
12
12
|
sessionId: string;
|
|
13
13
|
entries: TokenUsageEntry[];
|
|
14
|
-
/** UTC day (YYYY-MM-DD) the tokens were spent. */
|
|
15
|
-
usageDate
|
|
16
|
-
/** UTC hour (0-23) of `usageDate` the tokens were spent. */
|
|
17
|
-
usageHour: number;
|
|
14
|
+
/** UTC day (YYYY-MM-DD) the tokens were spent. Omitted means the server's today. */
|
|
15
|
+
usageDate?: string;
|
|
18
16
|
/** Working directory the session ran in, shown as the repo. */
|
|
19
17
|
repo?: string;
|
|
20
18
|
deviceId?: string;
|
|
21
19
|
deviceName?: string;
|
|
22
20
|
armored?: boolean;
|
|
23
21
|
}
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
* undefined when both are valid: a real UTC calendar date in `YYYY-MM-DD` form
|
|
27
|
-
* and an integer hour from 0 to 23.
|
|
28
|
-
*/
|
|
29
|
-
export declare function usageHourError(payload: Pick<RecordTokenUsagePayload, 'usageDate' | 'usageHour'>): string | undefined;
|
|
30
|
-
/** One UTC hour of a session's usage, ready to post as its own row. */
|
|
31
|
-
export interface HourlyTokenUsage {
|
|
22
|
+
/** One UTC day of a session's usage, ready to post as its own row. */
|
|
23
|
+
export interface DailyTokenUsage {
|
|
32
24
|
usageDate: string;
|
|
33
|
-
usageHour: number;
|
|
34
25
|
entries: TokenUsageEntry[];
|
|
35
26
|
}
|
|
36
|
-
/** A transcript's usage split by UTC
|
|
27
|
+
/** A transcript's usage split by UTC day, plus the working directory it ran in. */
|
|
37
28
|
export interface TranscriptUsage {
|
|
38
|
-
|
|
29
|
+
days: DailyTokenUsage[];
|
|
39
30
|
repo?: string;
|
|
40
31
|
}
|
|
41
32
|
/**
|
|
@@ -56,23 +47,9 @@ export interface TranscriptUsage {
|
|
|
56
47
|
*/
|
|
57
48
|
export declare function summarizeTranscriptUsage(transcriptPath: string, otel?: OtelSession | null): Promise<TokenUsageEntry[]>;
|
|
58
49
|
/**
|
|
59
|
-
* Same parse as `summarizeTranscriptUsage`, split by the UTC
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*/
|
|
63
|
-
export declare function summarizeTranscriptUsageByHour(transcriptPath: string): TranscriptUsage;
|
|
64
|
-
export interface SessionUsageOptions {
|
|
65
|
-
/**
|
|
66
|
-
* Message keys already counted. Pass the same set across sessions to count a
|
|
67
|
-
* message copied into a forked or resumed session once; it is filled in place.
|
|
68
|
-
*/
|
|
69
|
-
seen?: Set<string>;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* A Claude Code session's usage split by UTC date and hour: the main transcript
|
|
73
|
-
* plus its subagent transcripts, each assistant message counted once across all
|
|
74
|
-
* of them and filed under the hour of its own timestamp. `repo` is the first
|
|
75
|
-
* working directory found, main transcript first.
|
|
50
|
+
* Same parse as `summarizeTranscriptUsage`, split by the UTC day each message
|
|
51
|
+
* was sent and carrying the transcript's working directory. Posting one row per
|
|
52
|
+
* day keeps a multi-day session's tokens on the days they were spent.
|
|
76
53
|
*/
|
|
77
|
-
export declare function
|
|
54
|
+
export declare function summarizeTranscriptUsageByDay(transcriptPath: string): TranscriptUsage;
|
|
78
55
|
//# sourceMappingURL=token_usage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token_usage.d.ts","sourceRoot":"","sources":["../src/token_usage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"token_usage.d.ts","sourceRoot":"","sources":["../src/token_usage.ts"],"names":[],"mappings":"AAUA,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnE,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,uBAAuB;IACtC,wFAAwF;IACxF,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,oFAAoF;IACpF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,sEAAsE;AACtE,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,eAAe,EAAE,CAAC;CAC5B;AAED,mFAAmF;AACnF,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,eAAe,EAAE,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAYD;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,wBAAwB,CAC5C,cAAc,EAAE,MAAM,EACtB,IAAI,CAAC,EAAE,WAAW,GAAG,IAAI,GACxB,OAAO,CAAC,eAAe,EAAE,CAAC,CAK5B;AAED;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,cAAc,EAAE,MAAM,GAAG,eAAe,CAErF"}
|
package/dist/token_usage.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.usageHourError = usageHourError;
|
|
4
3
|
exports.summarizeTranscriptUsage = summarizeTranscriptUsage;
|
|
5
|
-
exports.
|
|
6
|
-
exports.summarizeSessionUsageByHour = summarizeSessionUsageByHour;
|
|
4
|
+
exports.summarizeTranscriptUsageByDay = summarizeTranscriptUsageByDay;
|
|
7
5
|
/**
|
|
8
6
|
* Token-usage capture — shared across all ArmorIQ tool integrations
|
|
9
7
|
* (ArmorClaude / ArmorCodex / ArmorCopilot / future agents).
|
|
@@ -13,27 +11,8 @@ exports.summarizeSessionUsageByHour = summarizeSessionUsageByHour;
|
|
|
13
11
|
* transcript (Claude Code / Codex CLI) into per-model entries; tools whose
|
|
14
12
|
* transcript differs can build entries themselves and still post via the client.
|
|
15
13
|
*/
|
|
16
|
-
const session_transcripts_1 = require("./session_transcripts");
|
|
17
14
|
const fs_1 = require("fs");
|
|
18
15
|
const observability_1 = require("./observability");
|
|
19
|
-
/**
|
|
20
|
-
* Why the backend would reject this payload's `usageDate` / `usageHour`, or
|
|
21
|
-
* undefined when both are valid: a real UTC calendar date in `YYYY-MM-DD` form
|
|
22
|
-
* and an integer hour from 0 to 23.
|
|
23
|
-
*/
|
|
24
|
-
function usageHourError(payload) {
|
|
25
|
-
const { usageDate, usageHour } = payload;
|
|
26
|
-
const date = typeof usageDate === 'string' && /^\d{4}-\d{2}-\d{2}$/.test(usageDate)
|
|
27
|
-
? new Date(`${usageDate}T00:00:00Z`)
|
|
28
|
-
: undefined;
|
|
29
|
-
if (!date || Number.isNaN(date.getTime()) || date.toISOString().slice(0, 10) !== usageDate) {
|
|
30
|
-
return 'usageDate must be a UTC calendar date in YYYY-MM-DD form';
|
|
31
|
-
}
|
|
32
|
-
if (!Number.isInteger(usageHour) || usageHour < 0 || usageHour > 23) {
|
|
33
|
-
return 'usageHour must be an integer from 0 to 23 (UTC hour of usageDate)';
|
|
34
|
-
}
|
|
35
|
-
return undefined;
|
|
36
|
-
}
|
|
37
16
|
function safeEmit(fn) {
|
|
38
17
|
try {
|
|
39
18
|
return fn();
|
|
@@ -61,17 +40,17 @@ function safeEmit(fn) {
|
|
|
61
40
|
* failure never affects the returned entries.
|
|
62
41
|
*/
|
|
63
42
|
async function summarizeTranscriptUsage(transcriptPath, otel) {
|
|
64
|
-
const {
|
|
65
|
-
const entries = mergeEntries(
|
|
43
|
+
const { days } = readTranscriptUsage(transcriptPath);
|
|
44
|
+
const entries = mergeEntries(days.flatMap((day) => day.entries));
|
|
66
45
|
await emitModelSpans(entries, otel ?? null);
|
|
67
46
|
return entries;
|
|
68
47
|
}
|
|
69
48
|
/**
|
|
70
|
-
* Same parse as `summarizeTranscriptUsage`, split by the UTC
|
|
71
|
-
*
|
|
72
|
-
*
|
|
49
|
+
* Same parse as `summarizeTranscriptUsage`, split by the UTC day each message
|
|
50
|
+
* was sent and carrying the transcript's working directory. Posting one row per
|
|
51
|
+
* day keeps a multi-day session's tokens on the days they were spent.
|
|
73
52
|
*/
|
|
74
|
-
function
|
|
53
|
+
function summarizeTranscriptUsageByDay(transcriptPath) {
|
|
75
54
|
return readTranscriptUsage(transcriptPath);
|
|
76
55
|
}
|
|
77
56
|
function emptyEntry(model) {
|
|
@@ -93,20 +72,19 @@ function mergeEntries(entries) {
|
|
|
93
72
|
return [...byModel.values()];
|
|
94
73
|
}
|
|
95
74
|
function readTranscriptUsage(transcriptPath) {
|
|
96
|
-
const acc = { byHour: new Map(), seen: new Set() };
|
|
97
|
-
accumulateTranscript(transcriptPath, acc);
|
|
98
|
-
return finishUsage(acc);
|
|
99
|
-
}
|
|
100
|
-
function accumulateTranscript(transcriptPath, acc) {
|
|
101
75
|
let raw;
|
|
102
76
|
try {
|
|
103
77
|
raw = (0, fs_1.readFileSync)(transcriptPath, 'utf8');
|
|
104
78
|
}
|
|
105
79
|
catch {
|
|
106
|
-
return;
|
|
80
|
+
return { days: [] };
|
|
107
81
|
}
|
|
108
|
-
const
|
|
109
|
-
|
|
82
|
+
const byDay = new Map();
|
|
83
|
+
// Claude Code writes one line per content block of an assistant message, each
|
|
84
|
+
// repeating that message's full usage. Count each message once.
|
|
85
|
+
const seen = new Set();
|
|
86
|
+
let repo;
|
|
87
|
+
let lastDay;
|
|
110
88
|
for (const line of raw.split('\n')) {
|
|
111
89
|
const trimmed = line.trim();
|
|
112
90
|
if (!trimmed)
|
|
@@ -118,19 +96,16 @@ function accumulateTranscript(transcriptPath, acc) {
|
|
|
118
96
|
catch {
|
|
119
97
|
continue;
|
|
120
98
|
}
|
|
121
|
-
if (!
|
|
122
|
-
|
|
123
|
-
const
|
|
124
|
-
if (
|
|
125
|
-
|
|
99
|
+
if (!repo && typeof obj?.cwd === 'string' && obj.cwd)
|
|
100
|
+
repo = obj.cwd;
|
|
101
|
+
const day = utcDay(obj?.timestamp) ?? lastDay;
|
|
102
|
+
if (day)
|
|
103
|
+
lastDay = day;
|
|
126
104
|
const msg = firstObject(obj?.message, obj?.payload) ?? obj;
|
|
127
105
|
const usage = msg?.usage ?? obj?.usage;
|
|
128
106
|
const model = typeof msg?.model === 'string' ? msg.model : typeof obj?.model === 'string' ? obj.model : '';
|
|
129
107
|
if (!usage || !model || model === '<synthetic>')
|
|
130
108
|
continue;
|
|
131
|
-
// Claude Code writes one line per content block of an assistant message, each
|
|
132
|
-
// repeating that message's full usage, and a forked session copies earlier
|
|
133
|
-
// messages into its own file. Count each message once.
|
|
134
109
|
const messageId = typeof msg?.id === 'string' ? msg.id : '';
|
|
135
110
|
if (messageId) {
|
|
136
111
|
const key = `${messageId}:${typeof obj?.requestId === 'string' ? obj.requestId : ''}`;
|
|
@@ -144,71 +119,49 @@ function accumulateTranscript(transcriptPath, acc) {
|
|
|
144
119
|
const cacheWrite = tokenCount(usage.cache_creation_input_tokens);
|
|
145
120
|
if (inTok + outTok + cacheRead + cacheWrite === 0)
|
|
146
121
|
continue;
|
|
147
|
-
const bucketKey =
|
|
148
|
-
let models =
|
|
122
|
+
const bucketKey = day ?? '';
|
|
123
|
+
let models = byDay.get(bucketKey);
|
|
149
124
|
if (!models) {
|
|
150
125
|
models = new Map();
|
|
151
|
-
|
|
126
|
+
byDay.set(bucketKey, models);
|
|
152
127
|
}
|
|
153
|
-
const
|
|
154
|
-
addInto(
|
|
128
|
+
const acc = models.get(model) ?? emptyEntry(model);
|
|
129
|
+
addInto(acc, {
|
|
155
130
|
model,
|
|
156
131
|
inputTokens: inTok,
|
|
157
132
|
outputTokens: outTok,
|
|
158
133
|
cacheReadTokens: cacheRead,
|
|
159
134
|
cacheWriteTokens: cacheWrite,
|
|
160
135
|
});
|
|
161
|
-
models.set(model,
|
|
136
|
+
models.set(model, acc);
|
|
162
137
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
const
|
|
167
|
-
byHour.delete('');
|
|
168
|
-
const keys = [...byHour.keys()].sort();
|
|
138
|
+
// Lines before the first timestamp belong to the first dated day.
|
|
139
|
+
const undated = byDay.get('');
|
|
140
|
+
byDay.delete('');
|
|
141
|
+
const dates = [...byDay.keys()].sort();
|
|
169
142
|
if (undated) {
|
|
170
|
-
const target =
|
|
171
|
-
const models =
|
|
143
|
+
const target = dates[0] ?? new Date().toISOString().slice(0, 10);
|
|
144
|
+
const models = byDay.get(target) ?? new Map();
|
|
172
145
|
for (const e of undated.values()) {
|
|
173
146
|
const acc = models.get(e.model) ?? emptyEntry(e.model);
|
|
174
147
|
addInto(acc, e);
|
|
175
148
|
models.set(e.model, acc);
|
|
176
149
|
}
|
|
177
|
-
|
|
150
|
+
byDay.set(target, models);
|
|
178
151
|
}
|
|
179
|
-
const
|
|
152
|
+
const days = [...byDay.entries()]
|
|
180
153
|
.sort(([a], [b]) => a.localeCompare(b))
|
|
181
|
-
.map(([
|
|
182
|
-
|
|
183
|
-
usageHour: Number(key.slice(11, 13)),
|
|
184
|
-
entries: [...models.values()],
|
|
185
|
-
}));
|
|
186
|
-
return repo ? { hours, repo } : { hours };
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* A Claude Code session's usage split by UTC date and hour: the main transcript
|
|
190
|
-
* plus its subagent transcripts, each assistant message counted once across all
|
|
191
|
-
* of them and filed under the hour of its own timestamp. `repo` is the first
|
|
192
|
-
* working directory found, main transcript first.
|
|
193
|
-
*/
|
|
194
|
-
function summarizeSessionUsageByHour(mainTranscriptPath, opts = {}) {
|
|
195
|
-
const acc = { byHour: new Map(), seen: opts.seen ?? new Set() };
|
|
196
|
-
for (const file of (0, session_transcripts_1.sessionTranscriptPaths)(mainTranscriptPath))
|
|
197
|
-
accumulateTranscript(file, acc);
|
|
198
|
-
return finishUsage(acc);
|
|
154
|
+
.map(([usageDate, models]) => ({ usageDate, entries: [...models.values()] }));
|
|
155
|
+
return repo ? { days, repo } : { days };
|
|
199
156
|
}
|
|
200
157
|
// A timestamp with no offset is read as UTC, not the machine's zone, so every
|
|
201
|
-
// machine files the same message under the same
|
|
202
|
-
function
|
|
158
|
+
// machine files the same message under the same day (matches the Python SDK).
|
|
159
|
+
function utcDay(timestamp) {
|
|
203
160
|
if (typeof timestamp !== 'string' || !timestamp)
|
|
204
161
|
return undefined;
|
|
205
162
|
const hasZone = /(?:Z|[+-]\d{2}:?\d{2})$/i.test(timestamp.trim());
|
|
206
163
|
const d = new Date(hasZone || !timestamp.includes('T') ? timestamp : `${timestamp}Z`);
|
|
207
|
-
return Number.isNaN(d.getTime()) ? undefined :
|
|
208
|
-
}
|
|
209
|
-
/** `YYYY-MM-DDTHH` of a date in UTC, the bucket key a message is filed under. */
|
|
210
|
-
function hourKey(d) {
|
|
211
|
-
return d.toISOString().slice(0, 13);
|
|
164
|
+
return Number.isNaN(d.getTime()) ? undefined : d.toISOString().slice(0, 10);
|
|
212
165
|
}
|
|
213
166
|
/** Whole, non-negative token count; anything unparseable counts as 0. */
|
|
214
167
|
function tokenCount(value) {
|
package/dist/token_usage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token_usage.js","sourceRoot":"","sources":["../src/token_usage.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"token_usage.js","sourceRoot":"","sources":["../src/token_usage.ts"],"names":[],"mappings":";;AAwEA,4DAQC;AAOD,sEAEC;AAzFD;;;;;;;;GAQG;AACH,2BAAkC;AAClC,mDAAmE;AAoCnE,SAAS,QAAQ,CAAI,EAAW;IAC9B,IAAI,CAAC;QACH,OAAO,EAAE,EAAE,CAAC;IACd,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC7D,OAAO,CAAC,IAAI,CAAC,qDAAqD,GAAG,EAAE,CAAC,CAAC;QACzE,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACI,KAAK,UAAU,wBAAwB,CAC5C,cAAsB,EACtB,IAAyB;IAEzB,MAAM,EAAE,IAAI,EAAE,GAAG,mBAAmB,CAAC,cAAc,CAAC,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AgB;YACzD,uBAAuB,EAAE,OAAO;SACjC,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@armoriq/sdk-dev",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.6",
|
|
4
4
|
"description": "ArmorIQ SDK - Build secure AI agents with cryptographic intent verification.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@opentelemetry/api": "^1.9.1",
|
|
50
|
-
"@opentelemetry/core": "^2.
|
|
51
|
-
"@opentelemetry/exporter-trace-otlp-http": "^0.
|
|
52
|
-
"@opentelemetry/otlp-exporter-base": "^0.
|
|
53
|
-
"@opentelemetry/otlp-transformer": "^0.
|
|
50
|
+
"@opentelemetry/core": "^2.10.0",
|
|
51
|
+
"@opentelemetry/exporter-trace-otlp-http": "^0.221.0",
|
|
52
|
+
"@opentelemetry/otlp-exporter-base": "^0.221.0",
|
|
53
|
+
"@opentelemetry/otlp-transformer": "^0.221.0",
|
|
54
54
|
"@opentelemetry/resources": "^2.10.0",
|
|
55
55
|
"@opentelemetry/sdk-trace-base": "^2.10.0",
|
|
56
56
|
"@opentelemetry/sdk-trace-node": "^2.10.0",
|
|
@@ -65,11 +65,11 @@
|
|
|
65
65
|
"@google/adk": "^0.6.1",
|
|
66
66
|
"@langchain/core": "^1.2.4",
|
|
67
67
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
68
|
-
"@opentelemetry/api-logs": "^0.
|
|
69
|
-
"@opentelemetry/exporter-logs-otlp-http": "^0.
|
|
70
|
-
"@opentelemetry/exporter-metrics-otlp-http": "^0.
|
|
68
|
+
"@opentelemetry/api-logs": "^0.221.0",
|
|
69
|
+
"@opentelemetry/exporter-logs-otlp-http": "^0.221.0",
|
|
70
|
+
"@opentelemetry/exporter-metrics-otlp-http": "^0.221.0",
|
|
71
71
|
"@opentelemetry/resource-detector-gcp": "^0.40.3",
|
|
72
|
-
"@opentelemetry/sdk-logs": "^0.
|
|
72
|
+
"@opentelemetry/sdk-logs": "^0.221.0",
|
|
73
73
|
"@opentelemetry/sdk-metrics": "^2.10.0",
|
|
74
74
|
"@strands-agents/sdk": "^1.11.2",
|
|
75
75
|
"@types/jest": "^29.5.0",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Transcripts that belong to a Claude Code session: the main transcript, then
|
|
3
|
-
* every `.jsonl` under the `<sessionId>/subagents/` directory beside it, in path
|
|
4
|
-
* order. Workflow `journal.jsonl` files record orchestration, not model calls,
|
|
5
|
-
* and are left out.
|
|
6
|
-
*/
|
|
7
|
-
export declare function sessionTranscriptPaths(mainTranscriptPath: string): string[];
|
|
8
|
-
//# sourceMappingURL=session_transcripts.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session_transcripts.d.ts","sourceRoot":"","sources":["../src/session_transcripts.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,kBAAkB,EAAE,MAAM,GAAG,MAAM,EAAE,CAwB3E"}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.sessionTranscriptPaths = sessionTranscriptPaths;
|
|
37
|
-
const fs_1 = require("fs");
|
|
38
|
-
const path = __importStar(require("path"));
|
|
39
|
-
/**
|
|
40
|
-
* Transcripts that belong to a Claude Code session: the main transcript, then
|
|
41
|
-
* every `.jsonl` under the `<sessionId>/subagents/` directory beside it, in path
|
|
42
|
-
* order. Workflow `journal.jsonl` files record orchestration, not model calls,
|
|
43
|
-
* and are left out.
|
|
44
|
-
*/
|
|
45
|
-
function sessionTranscriptPaths(mainTranscriptPath) {
|
|
46
|
-
const sessionDir = path.join(path.dirname(mainTranscriptPath), path.basename(mainTranscriptPath, '.jsonl'), 'subagents');
|
|
47
|
-
const nested = [];
|
|
48
|
-
const walk = (dir) => {
|
|
49
|
-
let entries;
|
|
50
|
-
try {
|
|
51
|
-
entries = (0, fs_1.readdirSync)(dir, { withFileTypes: true });
|
|
52
|
-
}
|
|
53
|
-
catch {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
entries.sort((a, b) => a.name.localeCompare(b.name));
|
|
57
|
-
for (const entry of entries) {
|
|
58
|
-
const full = path.join(dir, entry.name);
|
|
59
|
-
if (entry.isDirectory())
|
|
60
|
-
walk(full);
|
|
61
|
-
else if (entry.name.endsWith('.jsonl') && !isWorkflowJournal(path.relative(sessionDir, full)))
|
|
62
|
-
nested.push(full);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
walk(sessionDir);
|
|
66
|
-
return [mainTranscriptPath, ...nested];
|
|
67
|
-
}
|
|
68
|
-
function isWorkflowJournal(relativePath) {
|
|
69
|
-
const parts = relativePath.split(path.sep);
|
|
70
|
-
return parts[0] === 'workflows' && parts[parts.length - 1] === 'journal.jsonl';
|
|
71
|
-
}
|
|
72
|
-
//# sourceMappingURL=session_transcripts.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session_transcripts.js","sourceRoot":"","sources":["../src/session_transcripts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,wDAwBC;AAjCD,2BAA8C;AAC9C,2CAA6B;AAE7B;;;;;GAKG;AACH,SAAgB,sBAAsB,CAAC,kBAA0B;IAC/D,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAC1B,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAChC,IAAI,CAAC,QAAQ,CAAC,kBAAkB,EAAE,QAAQ,CAAC,EAC3C,WAAW,CACZ,CAAC;IACF,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,IAAI,GAAG,CAAC,GAAW,EAAQ,EAAE;QACjC,IAAI,OAAiB,CAAC;QACtB,IAAI,CAAC;YACH,OAAO,GAAG,IAAA,gBAAW,EAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,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