@tangle-network/agent-app 0.47.11 → 0.47.12
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 +1 -1
- package/dist/chat-routes/index.js +17 -0
- package/dist/chat-routes/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ pnpm add @tangle-network/agent-eval @tangle-network/agent-integrations
|
|
|
36
36
|
| Peer | Required by | Range |
|
|
37
37
|
|---|---|---|
|
|
38
38
|
| `@tangle-network/agent-eval` | `/eval`, `/eval-campaign`, `/profile`, `/knowledge` | `>=0.179.0 <0.180.0` |
|
|
39
|
-
| `@tangle-network/agent-runtime` | `/runtime`, `/chat-routes` | `>=0.
|
|
39
|
+
| `@tangle-network/agent-runtime` | `/runtime`, `/chat-routes` | `>=0.207.0 <0.208.0` |
|
|
40
40
|
| `@tangle-network/agent-integrations` | `/integrations` | `>=0.53.55 <0.54.0` |
|
|
41
41
|
| `@tangle-network/agent-interface` | `/interactions`, `/chat-store`, `/harness` | `^2.6.0` |
|
|
42
42
|
| `@tangle-network/sandbox` | `/sandbox` | `>=0.38.2 <0.39.0` |
|
|
@@ -573,6 +573,17 @@ function extractReportedTurnUsage(data) {
|
|
|
573
573
|
if (costUsd !== null) reported.costUsd = costUsd;
|
|
574
574
|
return reported;
|
|
575
575
|
}
|
|
576
|
+
function extractUsageSnapshot(value) {
|
|
577
|
+
const inputTokens = toFiniteNumber(value?.promptTokens);
|
|
578
|
+
const outputTokens = toFiniteNumber(value?.completionTokens);
|
|
579
|
+
if (inputTokens === null || outputTokens === null || inputTokens < 0 || outputTokens < 0) return null;
|
|
580
|
+
const reported = { inputTokens, outputTokens };
|
|
581
|
+
const reasoningTokens = toFiniteNumber(value?.reasoningTokens);
|
|
582
|
+
if (reasoningTokens !== null && reasoningTokens >= 0) reported.reasoningTokens = reasoningTokens;
|
|
583
|
+
const costUsd = toFiniteNumber(value?.providerCostUsd);
|
|
584
|
+
if (costUsd !== null && costUsd >= 0) reported.costUsd = costUsd;
|
|
585
|
+
return reported;
|
|
586
|
+
}
|
|
576
587
|
function applyTerminalUsage(reported, usage) {
|
|
577
588
|
usage.inputTokens = reported.inputTokens;
|
|
578
589
|
usage.outputTokens = reported.outputTokens;
|
|
@@ -931,6 +942,12 @@ function createSandboxChatProducer(options) {
|
|
|
931
942
|
yield toProducerWireEvent(record);
|
|
932
943
|
continue;
|
|
933
944
|
}
|
|
945
|
+
if (event.type === "usage") {
|
|
946
|
+
const reported = extractUsageSnapshot(asRecord(record.usage));
|
|
947
|
+
if (reported) applyTerminalUsage(reported, usage);
|
|
948
|
+
yield toProducerWireEvent(record);
|
|
949
|
+
continue;
|
|
950
|
+
}
|
|
934
951
|
if (event.type === "result") {
|
|
935
952
|
const finalText = asString(event.data?.finalText);
|
|
936
953
|
if (finalText) fullText = finalText;
|