@gobing-ai/ts-llm-jsonl-importer 0.4.31 → 0.4.33
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/jsonl-importer-dao.d.ts.map +1 -1
- package/dist/jsonl-importer-dao.js +1 -0
- package/dist/mappers.d.ts.map +1 -1
- package/dist/mappers.js +55 -14
- package/dist/schema-sql.d.ts.map +1 -1
- package/dist/schema-sql.js +1 -0
- package/package.json +4 -4
- package/src/jsonl-importer-dao.ts +1 -0
- package/src/mappers.ts +54 -13
- package/src/schema-sql.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonl-importer-dao.d.ts","sourceRoot":"","sources":["../src/jsonl-importer-dao.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAI7D,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE7F,UAAU,aAAa;IACnB,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;CACvC;
|
|
1
|
+
{"version":3,"file":"jsonl-importer-dao.d.ts","sourceRoot":"","sources":["../src/jsonl-importer-dao.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAI7D,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE7F,UAAU,aAAa;IACnB,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;CACvC;AAsDD,iBAAS,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAK7C;AAED,iBAAS,SAAS,CAAC,GAAG,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,MAAM,CAEpD;AAED,iBAAS,aAAa,CAAC,KAAK,EAA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AAE,SAAS,EAAE,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAShH;AAED,0EAA0E;AAC1E,wBAAsB,2BAA2B,CAAC,EAAE,EAAE,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,qBAAqB,EAAE,CAAC,CAAC,CAY9G;AAED,2EAA2E;AAC3E,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,SAAS,qBAAqB,EAAE,GAAG,SAAS,EAAE,CAW/F;AAED,6DAA6D;AAC7D,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,SAAS,CAKvF;AAED,iFAAiF;AACjF,wBAAgB,2BAA2B,CACvC,OAAO,EAAE,SAAS,mBAAmB,EAAE,EACvC,eAAe,EAAE,SAAS,MAAM,EAAE,EAClC,GAAG,EAAE,aAAa,CAAC,KAAK,CAAC,GAC1B,SAAS,EAAE,CA0Db;AAED,YAAY,EAAE,aAAa,EAAE,CAAC;AAC9B,OAAO,EACH,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,SAAS,EACT,eAAe,GAClB,CAAC"}
|
package/dist/mappers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mappers.d.ts","sourceRoot":"","sources":["../src/mappers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"mappers.d.ts","sourceRoot":"","sources":["../src/mappers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EA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aAAa,wBAAsE,CAAC;AACjG,+CAA+C;AAC/C,eAAO,MAAM,eAAe,wBAAsE,CAAC;AACnG,6CAA6C;AAC7C,eAAO,MAAM,aAAa,wBAAsE,CAAC;AACjG,8CAA8C;AAC9C,eAAO,MAAM,cAAc,wBAAsE,CAAC;AAClG,gDAAgD;AAChD,eAAO,MAAM,gBAAgB,wBAAsE,CAAC;AAQpG,oDAAoD;AACpD,eAAO,MAAM,aAAa,gCAAoB,CAAC;AAC/C,gDAAgD;AAChD,eAAO,MAAM,SAAS,gCAAoB,CAAC;AAC3C,iDAAiD;AACjD,eAAO,MAAM,UAAU,gCAAoB,CAAC;AAC5C,mDAAmD;AACnD,eAAO,MAAM,YAAY,gCAAoB,CAAC;AAC9C,iDAAiD;AACjD,eAAO,MAAM,UAAU,gCAAoB,CAAC;AAC5C,kDAAkD;AAClD,eAAO,MAAM,WAAW,gCAAoB,CAAC;AAC7C,oDAAoD;AACpD,eAAO,MAAM,aAAa,gCAAoB,CAAC"}
|
package/dist/mappers.js
CHANGED
|
@@ -32,6 +32,7 @@ const TOOL_CALL_MAPPER_KEYS = [
|
|
|
32
32
|
'seq',
|
|
33
33
|
'tool_name',
|
|
34
34
|
'args_digest',
|
|
35
|
+
'args_raw',
|
|
35
36
|
'status',
|
|
36
37
|
'started_at',
|
|
37
38
|
'completed_at',
|
|
@@ -50,12 +51,13 @@ function identityFieldMap(keys) {
|
|
|
50
51
|
// ---------------------------------------------------------------------------
|
|
51
52
|
// Source-specific helpers
|
|
52
53
|
// ---------------------------------------------------------------------------
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
// Launch provenance (`spur-run` vs `ambient`) is a fact only the import host knows:
|
|
55
|
+
// a session is spur-launched iff its (source, session_id) appears in the host's
|
|
56
|
+
// run→session mapping (spur: `history_run_session`, tasks 0557/0558). The mapper
|
|
57
|
+
// cannot see that, so every row imports as `ambient` and the host corrects mapped
|
|
58
|
+
// sessions after import. The old cwd-substring heuristic (path contains `/spur`)
|
|
59
|
+
// was deleted — it mislabelled ambient sessions that merely ran inside a spur
|
|
60
|
+
// directory (task 0559 R5).
|
|
59
61
|
/** Compute args_digest: sha256 of stable-jsonified, key-sorted, redacted args. */
|
|
60
62
|
export function argsDigest(args) {
|
|
61
63
|
const redacted = redactArgs(args);
|
|
@@ -81,6 +83,36 @@ function redactArgs(args) {
|
|
|
81
83
|
}
|
|
82
84
|
return args;
|
|
83
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Per-source todo-writing tool names whose raw arguments are retained for phase detection.
|
|
88
|
+
*
|
|
89
|
+
* Evidence: 0489 R4 confirmed omp/pi/claude; codex/grok/agy probed task 0553 R3 from real
|
|
90
|
+
* session JSONL. agy has no on-disk session format (VS Code fork); gemini deferred by the
|
|
91
|
+
* 2026-08-06 source-support ruling.
|
|
92
|
+
*/
|
|
93
|
+
const TODO_TOOL_ALLOWLIST = {
|
|
94
|
+
claude: ['TodoWrite'],
|
|
95
|
+
pi: ['todo'],
|
|
96
|
+
omp: ['TodoWrite', 'todo'],
|
|
97
|
+
codex: ['update_plan'],
|
|
98
|
+
grok: ['todo_write'],
|
|
99
|
+
agy: [],
|
|
100
|
+
gemini: [],
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Return JSON-stringified raw args when the tool is a todo-writing tool for its source,
|
|
104
|
+
* otherwise undefined. Codex `arguments` arrives as a JSON string already — store as-is.
|
|
105
|
+
*/
|
|
106
|
+
function maybeArgsRaw(source, toolName, args) {
|
|
107
|
+
const allow = TODO_TOOL_ALLOWLIST[source];
|
|
108
|
+
if (allow === undefined || !allow.includes(toolName))
|
|
109
|
+
return undefined;
|
|
110
|
+
if (typeof args === 'string')
|
|
111
|
+
return args;
|
|
112
|
+
if (args === undefined || args === null)
|
|
113
|
+
return undefined;
|
|
114
|
+
return JSON.stringify(args);
|
|
115
|
+
}
|
|
84
116
|
// ---------------------------------------------------------------------------
|
|
85
117
|
// Claude mapper
|
|
86
118
|
// ---------------------------------------------------------------------------
|
|
@@ -107,7 +139,7 @@ export function claudeSplit(raw) {
|
|
|
107
139
|
ts,
|
|
108
140
|
duration_ms: raw.durationMs,
|
|
109
141
|
content_text: null,
|
|
110
|
-
provenance:
|
|
142
|
+
provenance: 'ambient',
|
|
111
143
|
},
|
|
112
144
|
});
|
|
113
145
|
return entries;
|
|
@@ -122,7 +154,7 @@ export function claudeSplit(raw) {
|
|
|
122
154
|
record_type: recordType,
|
|
123
155
|
disposition: 'meta',
|
|
124
156
|
ts,
|
|
125
|
-
provenance:
|
|
157
|
+
provenance: 'ambient',
|
|
126
158
|
},
|
|
127
159
|
});
|
|
128
160
|
return entries;
|
|
@@ -157,7 +189,7 @@ export function claudeSplit(raw) {
|
|
|
157
189
|
cost_usd: costUsd ?? null,
|
|
158
190
|
content_text: contentText ?? null,
|
|
159
191
|
cwd: cwd ?? null,
|
|
160
|
-
provenance:
|
|
192
|
+
provenance: 'ambient',
|
|
161
193
|
},
|
|
162
194
|
});
|
|
163
195
|
// Tool calls from content blocks
|
|
@@ -175,6 +207,7 @@ export function claudeSplit(raw) {
|
|
|
175
207
|
seq,
|
|
176
208
|
tool_name: String(b.name ?? ''),
|
|
177
209
|
args_digest: argsDigest(b.input),
|
|
210
|
+
args_raw: maybeArgsRaw('claude', String(b.name ?? ''), b.input),
|
|
178
211
|
status: 'ok',
|
|
179
212
|
started_at: undefined,
|
|
180
213
|
completed_at: undefined,
|
|
@@ -229,7 +262,7 @@ export function piSplit(raw) {
|
|
|
229
262
|
cost_usd: costUsd ?? null,
|
|
230
263
|
content_text: s(r.content, r.text, msg?.content) ?? null,
|
|
231
264
|
cwd: cwd ?? null,
|
|
232
|
-
provenance:
|
|
265
|
+
provenance: 'ambient',
|
|
233
266
|
},
|
|
234
267
|
});
|
|
235
268
|
// Tool calls from toolCall blocks in assistant content
|
|
@@ -245,6 +278,7 @@ export function piSplit(raw) {
|
|
|
245
278
|
seq,
|
|
246
279
|
tool_name: String(tc.name ?? ''),
|
|
247
280
|
args_digest: argsDigest(tc.input ?? tc.arguments),
|
|
281
|
+
args_raw: maybeArgsRaw('pi', String(tc.name ?? ''), tc.input ?? tc.arguments),
|
|
248
282
|
status: 'ok',
|
|
249
283
|
started_at: undefined,
|
|
250
284
|
completed_at: undefined,
|
|
@@ -334,7 +368,7 @@ export function ompSplit(raw, context) {
|
|
|
334
368
|
cost_usd: costUsd ?? null,
|
|
335
369
|
content_text: extractContentText(contentBlocks) ?? s(raw.content, raw.text, msg?.content) ?? null,
|
|
336
370
|
cwd: cwd ?? null,
|
|
337
|
-
provenance:
|
|
371
|
+
provenance: 'ambient',
|
|
338
372
|
},
|
|
339
373
|
});
|
|
340
374
|
if (Array.isArray(contentBlocks) && role === 'assistant') {
|
|
@@ -350,6 +384,7 @@ export function ompSplit(raw, context) {
|
|
|
350
384
|
seq,
|
|
351
385
|
tool_name: String(call.name ?? ''),
|
|
352
386
|
args_digest: argsDigest(call.input ?? call.arguments),
|
|
387
|
+
args_raw: maybeArgsRaw('omp', String(call.name ?? ''), call.input ?? call.arguments),
|
|
353
388
|
status: 'ok',
|
|
354
389
|
started_at: undefined,
|
|
355
390
|
completed_at: undefined,
|
|
@@ -438,7 +473,7 @@ export function codexSplit(raw) {
|
|
|
438
473
|
cost_usd: costUsd ?? null,
|
|
439
474
|
content_text: s(payload.content, payload.text, raw.content, raw.text) ?? null,
|
|
440
475
|
cwd: cwd ?? null,
|
|
441
|
-
provenance:
|
|
476
|
+
provenance: 'ambient',
|
|
442
477
|
},
|
|
443
478
|
});
|
|
444
479
|
// Tool calls: function_call in response_item
|
|
@@ -458,6 +493,7 @@ export function codexSplit(raw) {
|
|
|
458
493
|
seq,
|
|
459
494
|
tool_name: String(fc.name ?? ''),
|
|
460
495
|
args_digest: argsDigest(fc.arguments),
|
|
496
|
+
args_raw: maybeArgsRaw('codex', String(fc.name ?? ''), fc.arguments),
|
|
461
497
|
status: 'ok',
|
|
462
498
|
started_at: undefined,
|
|
463
499
|
completed_at: undefined,
|
|
@@ -570,6 +606,7 @@ export function agySplit(raw) {
|
|
|
570
606
|
seq: typeof tc.step_index === 'number' ? tc.step_index : seq,
|
|
571
607
|
tool_name: String(tc.name ?? tc.tool_name ?? ''),
|
|
572
608
|
args_digest: argsDigest(tc.input ?? tc.arguments),
|
|
609
|
+
args_raw: maybeArgsRaw('agy', String(tc.name ?? tc.tool_name ?? ''), tc.input ?? tc.arguments),
|
|
573
610
|
status: 'ok',
|
|
574
611
|
started_at: undefined,
|
|
575
612
|
completed_at: undefined,
|
|
@@ -604,7 +641,7 @@ export function geminiSplit(raw, context) {
|
|
|
604
641
|
disposition: 'meta',
|
|
605
642
|
ts,
|
|
606
643
|
content_text: s(state.summary) ?? null,
|
|
607
|
-
provenance:
|
|
644
|
+
provenance: 'ambient',
|
|
608
645
|
},
|
|
609
646
|
},
|
|
610
647
|
];
|
|
@@ -631,7 +668,7 @@ export function geminiSplit(raw, context) {
|
|
|
631
668
|
cost_usd: null,
|
|
632
669
|
content_text: content,
|
|
633
670
|
cwd: null,
|
|
634
|
-
provenance:
|
|
671
|
+
provenance: 'ambient',
|
|
635
672
|
},
|
|
636
673
|
},
|
|
637
674
|
];
|
|
@@ -651,6 +688,7 @@ export function geminiSplit(raw, context) {
|
|
|
651
688
|
seq,
|
|
652
689
|
tool_name: s(tool.name, tool.displayName) ?? 'unknown',
|
|
653
690
|
args_digest: argsDigest(tool.args),
|
|
691
|
+
args_raw: maybeArgsRaw('gemini', s(tool.name, tool.displayName) ?? '', tool.args),
|
|
654
692
|
status,
|
|
655
693
|
started_at: timestamp,
|
|
656
694
|
completed_at: timestamp,
|
|
@@ -895,6 +933,7 @@ export function grokSplit(raw) {
|
|
|
895
933
|
seq,
|
|
896
934
|
tool_name: n.toolName,
|
|
897
935
|
args_digest: argsDigest(n.toolArgs),
|
|
936
|
+
args_raw: maybeArgsRaw('grok', n.toolName, n.toolArgs),
|
|
898
937
|
status: n.toolStatus || 'ok',
|
|
899
938
|
started_at: ts,
|
|
900
939
|
completed_at: undefined,
|
|
@@ -935,6 +974,7 @@ export function grokSplit(raw) {
|
|
|
935
974
|
seq,
|
|
936
975
|
tool_name: n.toolName,
|
|
937
976
|
args_digest: null,
|
|
977
|
+
args_raw: undefined,
|
|
938
978
|
status: n.toolStatus || 'ok',
|
|
939
979
|
started_at: undefined,
|
|
940
980
|
completed_at: ts,
|
|
@@ -977,6 +1017,7 @@ export function grokSplit(raw) {
|
|
|
977
1017
|
seq,
|
|
978
1018
|
tool_name: n.toolName,
|
|
979
1019
|
args_digest: argsDigest(n.toolArgs),
|
|
1020
|
+
args_raw: maybeArgsRaw('grok', n.toolName, n.toolArgs),
|
|
980
1021
|
status: n.toolStatus || 'ok',
|
|
981
1022
|
started_at: recordType === 'tool_call' ? ts : undefined,
|
|
982
1023
|
completed_at: recordType === 'tool_call_update' ? ts : undefined,
|
package/dist/schema-sql.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-sql.d.ts","sourceRoot":"","sources":["../src/schema-sql.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,
|
|
1
|
+
{"version":3,"file":"schema-sql.d.ts","sourceRoot":"","sources":["../src/schema-sql.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,QA4E9B,CAAC"}
|
package/dist/schema-sql.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gobing-ai/ts-llm-jsonl-importer",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.33",
|
|
4
4
|
"description": "@gobing-ai/ts-llm-jsonl-importer — Generic JSONL importer for LLM agent history files.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"release": "echo 'Manual publish is disabled. Releases go through GitHub Actions via Trusted Publishing — push a tag: git tag @gobing-ai/ts-llm-jsonl-importer-v<version> && git push --tags' && exit 1"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@gobing-ai/ts-db": "^0.4.
|
|
51
|
-
"@gobing-ai/ts-runtime": "^0.4.
|
|
52
|
-
"@gobing-ai/ts-utils": "^0.4.
|
|
50
|
+
"@gobing-ai/ts-db": "^0.4.33",
|
|
51
|
+
"@gobing-ai/ts-runtime": "^0.4.33",
|
|
52
|
+
"@gobing-ai/ts-utils": "^0.4.33",
|
|
53
53
|
"zod": "^4.1.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
package/src/mappers.ts
CHANGED
|
@@ -36,6 +36,7 @@ const TOOL_CALL_MAPPER_KEYS: readonly string[] = [
|
|
|
36
36
|
'seq',
|
|
37
37
|
'tool_name',
|
|
38
38
|
'args_digest',
|
|
39
|
+
'args_raw',
|
|
39
40
|
'status',
|
|
40
41
|
'started_at',
|
|
41
42
|
'completed_at',
|
|
@@ -57,11 +58,13 @@ function identityFieldMap(keys: readonly string[]): Record<string, string> {
|
|
|
57
58
|
// Source-specific helpers
|
|
58
59
|
// ---------------------------------------------------------------------------
|
|
59
60
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
// Launch provenance (`spur-run` vs `ambient`) is a fact only the import host knows:
|
|
62
|
+
// a session is spur-launched iff its (source, session_id) appears in the host's
|
|
63
|
+
// run→session mapping (spur: `history_run_session`, tasks 0557/0558). The mapper
|
|
64
|
+
// cannot see that, so every row imports as `ambient` and the host corrects mapped
|
|
65
|
+
// sessions after import. The old cwd-substring heuristic (path contains `/spur`)
|
|
66
|
+
// was deleted — it mislabelled ambient sessions that merely ran inside a spur
|
|
67
|
+
// directory (task 0559 R5).
|
|
65
68
|
|
|
66
69
|
/** Compute args_digest: sha256 of stable-jsonified, key-sorted, redacted args. */
|
|
67
70
|
export function argsDigest(args: unknown): string {
|
|
@@ -87,6 +90,35 @@ function redactArgs(args: unknown): unknown {
|
|
|
87
90
|
return args;
|
|
88
91
|
}
|
|
89
92
|
|
|
93
|
+
/**
|
|
94
|
+
* Per-source todo-writing tool names whose raw arguments are retained for phase detection.
|
|
95
|
+
*
|
|
96
|
+
* Evidence: 0489 R4 confirmed omp/pi/claude; codex/grok/agy probed task 0553 R3 from real
|
|
97
|
+
* session JSONL. agy has no on-disk session format (VS Code fork); gemini deferred by the
|
|
98
|
+
* 2026-08-06 source-support ruling.
|
|
99
|
+
*/
|
|
100
|
+
const TODO_TOOL_ALLOWLIST: Readonly<Record<string, readonly string[]>> = {
|
|
101
|
+
claude: ['TodoWrite'],
|
|
102
|
+
pi: ['todo'],
|
|
103
|
+
omp: ['TodoWrite', 'todo'],
|
|
104
|
+
codex: ['update_plan'],
|
|
105
|
+
grok: ['todo_write'],
|
|
106
|
+
agy: [],
|
|
107
|
+
gemini: [],
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Return JSON-stringified raw args when the tool is a todo-writing tool for its source,
|
|
112
|
+
* otherwise undefined. Codex `arguments` arrives as a JSON string already — store as-is.
|
|
113
|
+
*/
|
|
114
|
+
function maybeArgsRaw(source: string, toolName: string, args: unknown): string | undefined {
|
|
115
|
+
const allow = TODO_TOOL_ALLOWLIST[source];
|
|
116
|
+
if (allow === undefined || !allow.includes(toolName)) return undefined;
|
|
117
|
+
if (typeof args === 'string') return args;
|
|
118
|
+
if (args === undefined || args === null) return undefined;
|
|
119
|
+
return JSON.stringify(args);
|
|
120
|
+
}
|
|
121
|
+
|
|
90
122
|
// ---------------------------------------------------------------------------
|
|
91
123
|
// Claude mapper
|
|
92
124
|
// ---------------------------------------------------------------------------
|
|
@@ -115,7 +147,7 @@ export function claudeSplit(raw: Record<string, unknown>): readonly SplitEntry[]
|
|
|
115
147
|
ts,
|
|
116
148
|
duration_ms: raw.durationMs,
|
|
117
149
|
content_text: null,
|
|
118
|
-
provenance:
|
|
150
|
+
provenance: 'ambient',
|
|
119
151
|
},
|
|
120
152
|
});
|
|
121
153
|
return entries;
|
|
@@ -130,7 +162,7 @@ export function claudeSplit(raw: Record<string, unknown>): readonly SplitEntry[]
|
|
|
130
162
|
record_type: recordType,
|
|
131
163
|
disposition: 'meta',
|
|
132
164
|
ts,
|
|
133
|
-
provenance:
|
|
165
|
+
provenance: 'ambient',
|
|
134
166
|
},
|
|
135
167
|
});
|
|
136
168
|
return entries;
|
|
@@ -169,7 +201,7 @@ export function claudeSplit(raw: Record<string, unknown>): readonly SplitEntry[]
|
|
|
169
201
|
cost_usd: costUsd ?? null,
|
|
170
202
|
content_text: contentText ?? null,
|
|
171
203
|
cwd: cwd ?? null,
|
|
172
|
-
provenance:
|
|
204
|
+
provenance: 'ambient',
|
|
173
205
|
},
|
|
174
206
|
});
|
|
175
207
|
|
|
@@ -187,6 +219,7 @@ export function claudeSplit(raw: Record<string, unknown>): readonly SplitEntry[]
|
|
|
187
219
|
seq,
|
|
188
220
|
tool_name: String(b.name ?? ''),
|
|
189
221
|
args_digest: argsDigest(b.input),
|
|
222
|
+
args_raw: maybeArgsRaw('claude', String(b.name ?? ''), b.input),
|
|
190
223
|
status: 'ok',
|
|
191
224
|
started_at: undefined,
|
|
192
225
|
completed_at: undefined,
|
|
@@ -247,7 +280,7 @@ export function piSplit(raw: unknown): readonly SplitEntry[] {
|
|
|
247
280
|
cost_usd: costUsd ?? null,
|
|
248
281
|
content_text: s(r.content, r.text, msg?.content) ?? null,
|
|
249
282
|
cwd: cwd ?? null,
|
|
250
|
-
provenance:
|
|
283
|
+
provenance: 'ambient',
|
|
251
284
|
},
|
|
252
285
|
});
|
|
253
286
|
|
|
@@ -264,6 +297,7 @@ export function piSplit(raw: unknown): readonly SplitEntry[] {
|
|
|
264
297
|
seq,
|
|
265
298
|
tool_name: String(tc.name ?? ''),
|
|
266
299
|
args_digest: argsDigest(tc.input ?? tc.arguments),
|
|
300
|
+
args_raw: maybeArgsRaw('pi', String(tc.name ?? ''), tc.input ?? tc.arguments),
|
|
267
301
|
status: 'ok',
|
|
268
302
|
started_at: undefined,
|
|
269
303
|
completed_at: undefined,
|
|
@@ -362,7 +396,7 @@ export function ompSplit(raw: Record<string, unknown>, context?: TransformContex
|
|
|
362
396
|
cost_usd: costUsd ?? null,
|
|
363
397
|
content_text: extractContentText(contentBlocks) ?? s(raw.content, raw.text, msg?.content) ?? null,
|
|
364
398
|
cwd: cwd ?? null,
|
|
365
|
-
provenance:
|
|
399
|
+
provenance: 'ambient',
|
|
366
400
|
},
|
|
367
401
|
});
|
|
368
402
|
|
|
@@ -378,6 +412,7 @@ export function ompSplit(raw: Record<string, unknown>, context?: TransformContex
|
|
|
378
412
|
seq,
|
|
379
413
|
tool_name: String(call.name ?? ''),
|
|
380
414
|
args_digest: argsDigest(call.input ?? call.arguments),
|
|
415
|
+
args_raw: maybeArgsRaw('omp', String(call.name ?? ''), call.input ?? call.arguments),
|
|
381
416
|
status: 'ok',
|
|
382
417
|
started_at: undefined,
|
|
383
418
|
completed_at: undefined,
|
|
@@ -475,7 +510,7 @@ export function codexSplit(raw: Record<string, unknown>): readonly SplitEntry[]
|
|
|
475
510
|
cost_usd: costUsd ?? null,
|
|
476
511
|
content_text: s(payload.content, payload.text, raw.content, raw.text) ?? null,
|
|
477
512
|
cwd: cwd ?? null,
|
|
478
|
-
provenance:
|
|
513
|
+
provenance: 'ambient',
|
|
479
514
|
},
|
|
480
515
|
});
|
|
481
516
|
|
|
@@ -496,6 +531,7 @@ export function codexSplit(raw: Record<string, unknown>): readonly SplitEntry[]
|
|
|
496
531
|
seq,
|
|
497
532
|
tool_name: String(fc.name ?? ''),
|
|
498
533
|
args_digest: argsDigest(fc.arguments),
|
|
534
|
+
args_raw: maybeArgsRaw('codex', String(fc.name ?? ''), fc.arguments),
|
|
499
535
|
status: 'ok',
|
|
500
536
|
started_at: undefined,
|
|
501
537
|
completed_at: undefined,
|
|
@@ -615,6 +651,7 @@ export function agySplit(raw: Record<string, unknown>): readonly SplitEntry[] {
|
|
|
615
651
|
seq: typeof tc.step_index === 'number' ? tc.step_index : seq,
|
|
616
652
|
tool_name: String(tc.name ?? tc.tool_name ?? ''),
|
|
617
653
|
args_digest: argsDigest(tc.input ?? tc.arguments),
|
|
654
|
+
args_raw: maybeArgsRaw('agy', String(tc.name ?? tc.tool_name ?? ''), tc.input ?? tc.arguments),
|
|
618
655
|
status: 'ok',
|
|
619
656
|
started_at: undefined,
|
|
620
657
|
completed_at: undefined,
|
|
@@ -653,7 +690,7 @@ export function geminiSplit(raw: Record<string, unknown>, context?: TransformCon
|
|
|
653
690
|
disposition: 'meta',
|
|
654
691
|
ts,
|
|
655
692
|
content_text: s(state.summary) ?? null,
|
|
656
|
-
provenance:
|
|
693
|
+
provenance: 'ambient',
|
|
657
694
|
},
|
|
658
695
|
},
|
|
659
696
|
];
|
|
@@ -681,7 +718,7 @@ export function geminiSplit(raw: Record<string, unknown>, context?: TransformCon
|
|
|
681
718
|
cost_usd: null,
|
|
682
719
|
content_text: content,
|
|
683
720
|
cwd: null,
|
|
684
|
-
provenance:
|
|
721
|
+
provenance: 'ambient',
|
|
685
722
|
},
|
|
686
723
|
},
|
|
687
724
|
];
|
|
@@ -701,6 +738,7 @@ export function geminiSplit(raw: Record<string, unknown>, context?: TransformCon
|
|
|
701
738
|
seq,
|
|
702
739
|
tool_name: s(tool.name, tool.displayName) ?? 'unknown',
|
|
703
740
|
args_digest: argsDigest(tool.args),
|
|
741
|
+
args_raw: maybeArgsRaw('gemini', s(tool.name, tool.displayName) ?? '', tool.args),
|
|
704
742
|
status,
|
|
705
743
|
started_at: timestamp,
|
|
706
744
|
completed_at: timestamp,
|
|
@@ -988,6 +1026,7 @@ export function grokSplit(raw: Record<string, unknown>): readonly SplitEntry[] {
|
|
|
988
1026
|
seq,
|
|
989
1027
|
tool_name: n.toolName,
|
|
990
1028
|
args_digest: argsDigest(n.toolArgs),
|
|
1029
|
+
args_raw: maybeArgsRaw('grok', n.toolName, n.toolArgs),
|
|
991
1030
|
status: n.toolStatus || 'ok',
|
|
992
1031
|
started_at: ts,
|
|
993
1032
|
completed_at: undefined,
|
|
@@ -1029,6 +1068,7 @@ export function grokSplit(raw: Record<string, unknown>): readonly SplitEntry[] {
|
|
|
1029
1068
|
seq,
|
|
1030
1069
|
tool_name: n.toolName,
|
|
1031
1070
|
args_digest: null,
|
|
1071
|
+
args_raw: undefined,
|
|
1032
1072
|
status: n.toolStatus || 'ok',
|
|
1033
1073
|
started_at: undefined,
|
|
1034
1074
|
completed_at: ts,
|
|
@@ -1072,6 +1112,7 @@ export function grokSplit(raw: Record<string, unknown>): readonly SplitEntry[] {
|
|
|
1072
1112
|
seq,
|
|
1073
1113
|
tool_name: n.toolName,
|
|
1074
1114
|
args_digest: argsDigest(n.toolArgs),
|
|
1115
|
+
args_raw: maybeArgsRaw('grok', n.toolName, n.toolArgs),
|
|
1075
1116
|
status: n.toolStatus || 'ok',
|
|
1076
1117
|
started_at: recordType === 'tool_call' ? ts : undefined,
|
|
1077
1118
|
completed_at: recordType === 'tool_call_update' ? ts : undefined,
|