@tangle-network/traces 0.15.3 → 0.15.4
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/{chunk-U4EB4HK7.js → chunk-SKOW5V5U.js} +13 -2
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
|
@@ -2225,6 +2225,7 @@ function projectClaudeEvent(event) {
|
|
|
2225
2225
|
cacheWriteInputTokens: event.message.usage?.cache_creation_input_tokens ?? null,
|
|
2226
2226
|
content: textOf2(event.message.content) || null,
|
|
2227
2227
|
contentSource: textSources(event.message, "content"),
|
|
2228
|
+
parentToolUseId: event.parent_tool_use_id ?? null,
|
|
2228
2229
|
tools
|
|
2229
2230
|
};
|
|
2230
2231
|
}
|
|
@@ -2255,6 +2256,7 @@ function projectClaudeEvent(event) {
|
|
|
2255
2256
|
timestamp,
|
|
2256
2257
|
prompt: prompt || null,
|
|
2257
2258
|
contentSource: textSources(event.message, "content"),
|
|
2259
|
+
parentToolUseId: event.parent_tool_use_id ?? null,
|
|
2258
2260
|
...prompt ? {
|
|
2259
2261
|
isSidechain: event.isSidechain === true,
|
|
2260
2262
|
isMeta: event.isMeta === true,
|
|
@@ -2374,15 +2376,21 @@ function consumeDistinctClaudeEvent(event, ctx, state, seen, sourcePath) {
|
|
|
2374
2376
|
consumeClaudeEvent(accepted.projection, accepted.uid, ctx, state);
|
|
2375
2377
|
return true;
|
|
2376
2378
|
}
|
|
2379
|
+
function inStreamParent(parentToolUseId, state) {
|
|
2380
|
+
if (!parentToolUseId) return void 0;
|
|
2381
|
+
const parentTool = state.toolSpanByUseId.get(parentToolUseId);
|
|
2382
|
+
return parentTool ? { span: parentTool, confidence: "explicit" } : void 0;
|
|
2383
|
+
}
|
|
2377
2384
|
function consumeClaudeEvent(event, uid, ctx, state) {
|
|
2378
2385
|
if (event.kind === "assistant") {
|
|
2379
2386
|
const messageId = event.messageId ?? uid;
|
|
2380
2387
|
let llmSpan = state.llmSpanByMessageId.get(messageId);
|
|
2381
2388
|
if (!llmSpan) {
|
|
2389
|
+
const parent = inStreamParent(event.parentToolUseId, state);
|
|
2382
2390
|
llmSpan = span({
|
|
2383
2391
|
traceId: ctx.traceId,
|
|
2384
2392
|
spanId: `${ctx.idPrefix}${uid}`,
|
|
2385
|
-
parentSpanId: ctx.rootParent,
|
|
2393
|
+
parentSpanId: parent ? parent.span.span_id : ctx.rootParent,
|
|
2386
2394
|
name: "llm.turn",
|
|
2387
2395
|
kind: "LLM",
|
|
2388
2396
|
startTime: event.timestamp,
|
|
@@ -2395,6 +2403,7 @@ function consumeClaudeEvent(event, uid, ctx, state) {
|
|
|
2395
2403
|
cacheWriteInputTokens: event.cacheWriteInputTokens,
|
|
2396
2404
|
step: state.step
|
|
2397
2405
|
});
|
|
2406
|
+
if (parent) llmSpan.attributes[ATTR3.parentConfidence] = parent.confidence;
|
|
2398
2407
|
state.spans.push(llmSpan);
|
|
2399
2408
|
state.llmSpanByMessageId.set(messageId, llmSpan);
|
|
2400
2409
|
state.step += 1;
|
|
@@ -2466,10 +2475,11 @@ function consumeClaudeEvent(event, uid, ctx, state) {
|
|
|
2466
2475
|
}));
|
|
2467
2476
|
state.sawUserTurn = true;
|
|
2468
2477
|
if (event.originKind) state.sawRecordedOrigin = true;
|
|
2478
|
+
const userParent = inStreamParent(event.parentToolUseId, state);
|
|
2469
2479
|
const prompt = userPromptSpan({
|
|
2470
2480
|
traceId: ctx.traceId,
|
|
2471
2481
|
spanId: `${ctx.idPrefix}${uid}:user`,
|
|
2472
|
-
parentSpanId: ctx.rootParent,
|
|
2482
|
+
parentSpanId: userParent ? userParent.span.span_id : ctx.rootParent,
|
|
2473
2483
|
startTime: event.timestamp,
|
|
2474
2484
|
service: SERVICE2,
|
|
2475
2485
|
agent: ctx.agent,
|
|
@@ -2482,6 +2492,7 @@ function consumeClaudeEvent(event, uid, ctx, state) {
|
|
|
2482
2492
|
prompt.attributes[ORIGIN_RECORDED_ATTR] = true;
|
|
2483
2493
|
prompt.attributes[ORIGIN_KIND_ATTR] = event.originKind;
|
|
2484
2494
|
}
|
|
2495
|
+
if (userParent) prompt.attributes[ATTR3.parentConfidence] = userParent.confidence;
|
|
2485
2496
|
state.spans.push(prompt);
|
|
2486
2497
|
state.promptSpans.push(prompt);
|
|
2487
2498
|
state.step += 1;
|
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/traces",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.4",
|
|
4
4
|
"description": "Point it at your coding-agent session traces (Claude Code, Codex, OpenCode, Gemini, Pi, …) and get failure-mode + efficiency findings. CLI + SDK over the @tangle-network/agent-eval analyst suite — observe live sessions, run your own analysts, redact, and upload to the Tangle Intelligence Platform.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"@tangle-network/agent-eval": "0.186.2",
|
|
64
64
|
"@tangle-network/agent-interface": "2.12.0",
|
|
65
65
|
"@tangle-network/agent-runtime": "0.257.0",
|
|
66
|
-
"@tangle-network/agent-trace-contract": "1.
|
|
66
|
+
"@tangle-network/agent-trace-contract": "1.3.0",
|
|
67
67
|
"@tangle-network/sandbox": "0.45.0"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|