@tangle-network/traces 0.9.15 → 0.9.16
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-CLJJ5YFI.js → chunk-I4W6DECY.js} +32 -1
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -4180,6 +4180,24 @@ import { readdir as readdir11, stat as stat9 } from "fs/promises";
|
|
|
4180
4180
|
import { homedir as homedir10 } from "os";
|
|
4181
4181
|
import { basename as basename8, join as join10 } from "path";
|
|
4182
4182
|
var SERVICE9 = "pi";
|
|
4183
|
+
function terminalStatus(message) {
|
|
4184
|
+
const stopReason = message?.stopReason ?? "missing";
|
|
4185
|
+
if (message?.role === "assistant" && stopReason === "stop") {
|
|
4186
|
+
return { status: "OK", stopReason };
|
|
4187
|
+
}
|
|
4188
|
+
if (message?.role === "assistant" && (stopReason === "error" || message.errorMessage)) {
|
|
4189
|
+
return {
|
|
4190
|
+
status: "ERROR",
|
|
4191
|
+
statusMessage: message.errorMessage?.slice(0, 500) ?? "Pi assistant stopped with an error",
|
|
4192
|
+
stopReason
|
|
4193
|
+
};
|
|
4194
|
+
}
|
|
4195
|
+
return {
|
|
4196
|
+
status: "UNSET",
|
|
4197
|
+
statusMessage: message === void 0 ? "Pi session contained no messages" : `Pi session ended after ${message.role} with stopReason "${stopReason}"`,
|
|
4198
|
+
stopReason
|
|
4199
|
+
};
|
|
4200
|
+
}
|
|
4183
4201
|
function isToolBlock(b) {
|
|
4184
4202
|
return typeof b.type === "string" && /tool[_-]?call|tool[_-]?use|^tool$/i.test(b.type);
|
|
4185
4203
|
}
|
|
@@ -4255,6 +4273,7 @@ var PiAdapter = class {
|
|
|
4255
4273
|
let firstTimestamp;
|
|
4256
4274
|
let lastTimestamp;
|
|
4257
4275
|
let sessionLine;
|
|
4276
|
+
let terminalMessage;
|
|
4258
4277
|
let sawLine = false;
|
|
4259
4278
|
let step = 0;
|
|
4260
4279
|
for await (const l of readJsonl(ref.path, sessionJsonlOptions(ref, options))) {
|
|
@@ -4270,6 +4289,11 @@ var PiAdapter = class {
|
|
|
4270
4289
|
const ts = l.timestamp ?? (/* @__PURE__ */ new Date(0)).toISOString();
|
|
4271
4290
|
const mid = l.id ?? `m${step}`;
|
|
4272
4291
|
const msg = l.message;
|
|
4292
|
+
terminalMessage = {
|
|
4293
|
+
role: msg.role ?? "unknown",
|
|
4294
|
+
stopReason: msg.stopReason,
|
|
4295
|
+
errorMessage: msg.errorMessage
|
|
4296
|
+
};
|
|
4273
4297
|
const llmId = `llm:${mid}`;
|
|
4274
4298
|
if (msg.role === "toolResult") {
|
|
4275
4299
|
const callId = msg.toolCallId ?? `${mid}:result`;
|
|
@@ -4324,6 +4348,9 @@ var PiAdapter = class {
|
|
|
4324
4348
|
model: msg.model ?? null,
|
|
4325
4349
|
inputTokens: msg.usage?.input ?? null,
|
|
4326
4350
|
outputTokens: msg.usage?.output ?? null,
|
|
4351
|
+
reasoningTokens: msg.usage?.reasoning ?? null,
|
|
4352
|
+
cachedInputTokens: msg.usage?.cacheRead ?? null,
|
|
4353
|
+
cacheWriteInputTokens: msg.usage?.cacheWrite ?? null,
|
|
4327
4354
|
step,
|
|
4328
4355
|
content: textOf8(msg.content) || null
|
|
4329
4356
|
})
|
|
@@ -4393,6 +4420,7 @@ var PiAdapter = class {
|
|
|
4393
4420
|
}
|
|
4394
4421
|
const traceId = sessionLine?.id ?? sourceTraceId;
|
|
4395
4422
|
const rootId = `root:${traceId}`;
|
|
4423
|
+
const terminal = terminalStatus(terminalMessage);
|
|
4396
4424
|
for (const item of spans) {
|
|
4397
4425
|
item.trace_id = traceId;
|
|
4398
4426
|
if (item.parent_span_id === sourceRootId) item.parent_span_id = rootId;
|
|
@@ -4405,8 +4433,11 @@ var PiAdapter = class {
|
|
|
4405
4433
|
kind: "AGENT",
|
|
4406
4434
|
startTime: sessionLine?.timestamp ?? firstTimestamp ?? (/* @__PURE__ */ new Date(0)).toISOString(),
|
|
4407
4435
|
endTime: lastTimestamp,
|
|
4436
|
+
status: terminal.status,
|
|
4437
|
+
statusMessage: terminal.statusMessage,
|
|
4408
4438
|
service: SERVICE9,
|
|
4409
|
-
agent: SERVICE9
|
|
4439
|
+
agent: SERVICE9,
|
|
4440
|
+
extra: { "traces.pi.stop_reason": terminal.stopReason }
|
|
4410
4441
|
});
|
|
4411
4442
|
return [root, ...spans];
|
|
4412
4443
|
}
|
package/dist/cli.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -712,7 +712,8 @@ declare class FactoryAdapter implements HarnessTraceAdapter {
|
|
|
712
712
|
*
|
|
713
713
|
* Line types: `session` (id + cwd), `model_change`, `thinking_level_change`,
|
|
714
714
|
* and `message`. A `message` line wraps `message.{role, model, provider,
|
|
715
|
-
* content[], usage.{input,output}, stopReason,
|
|
715
|
+
* content[], usage.{input,output,reasoning,cacheRead,cacheWrite}, stopReason,
|
|
716
|
+
* errorMessage}`. Tool calls
|
|
716
717
|
* ride inside assistant `message.content[]` blocks; their completions are
|
|
717
718
|
* separate `role: "toolResult"` messages keyed by `message.toolCallId`.
|
|
718
719
|
*/
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/traces",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.16",
|
|
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",
|