veryfront 0.1.847 → 0.1.848
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/esm/deno.js +1 -1
- package/esm/extensions/ext-llm-google/src/google-stream.d.ts.map +1 -1
- package/esm/extensions/ext-llm-google/src/google-stream.js +2 -0
- package/esm/extensions/ext-llm-openai/src/openai-chat-stream.d.ts.map +1 -1
- package/esm/extensions/ext-llm-openai/src/openai-chat-stream.js +3 -0
- package/esm/extensions/ext-llm-openai/src/openai-provider.d.ts.map +1 -1
- package/esm/extensions/ext-llm-openai/src/openai-provider.js +3 -0
- package/esm/extensions/ext-llm-openai/src/openai-responses-stream.d.ts +1 -0
- package/esm/extensions/ext-llm-openai/src/openai-responses-stream.d.ts.map +1 -1
- package/esm/extensions/ext-llm-openai/src/openai-responses-stream.js +3 -0
- package/esm/src/agent/ag-ui/browser-encoder.d.ts +5 -0
- package/esm/src/agent/ag-ui/browser-encoder.d.ts.map +1 -1
- package/esm/src/agent/ag-ui/browser-encoder.js +42 -0
- package/esm/src/agent/ag-ui/browser-finalize-tracker.d.ts.map +1 -1
- package/esm/src/agent/ag-ui/browser-finalize-tracker.js +15 -0
- package/esm/src/agent/ag-ui/chat-ui-chunk-browser-encoder.d.ts +1 -1
- package/esm/src/agent/ag-ui/chat-ui-chunk-browser-encoder.d.ts.map +1 -1
- package/esm/src/agent/ag-ui/chat-ui-chunk-browser-encoder.js +20 -0
- package/esm/src/agent/hosted/agent-run-lifecycle.d.ts +3 -0
- package/esm/src/agent/hosted/agent-run-lifecycle.d.ts.map +1 -1
- package/esm/src/agent/hosted/lifecycle.d.ts +3 -0
- package/esm/src/agent/hosted/lifecycle.d.ts.map +1 -1
- package/esm/src/agent/hosted/trace-attributes.d.ts +3 -0
- package/esm/src/agent/hosted/trace-attributes.d.ts.map +1 -1
- package/esm/src/agent/hosted/trace-attributes.js +10 -2
- package/esm/src/agent/runtime/chat-stream-handler.d.ts +8 -0
- package/esm/src/agent/runtime/chat-stream-handler.d.ts.map +1 -1
- package/esm/src/agent/runtime/chat-stream-handler.js +11 -1
- package/esm/src/agent/runtime/index.d.ts.map +1 -1
- package/esm/src/agent/runtime/index.js +6 -1
- package/esm/src/agent/runtime/input-utils.d.ts +8 -0
- package/esm/src/agent/runtime/input-utils.d.ts.map +1 -1
- package/esm/src/agent/runtime/input-utils.js +13 -0
- package/esm/src/agent/runtime/runtime-tool-types.d.ts +9 -0
- package/esm/src/agent/runtime/runtime-tool-types.d.ts.map +1 -1
- package/esm/src/agent/schemas/agent.schema.d.ts +4 -0
- package/esm/src/agent/schemas/agent.schema.d.ts.map +1 -1
- package/esm/src/agent/schemas/agent.schema.js +4 -0
- package/esm/src/channels/invoke.d.ts +8 -0
- package/esm/src/channels/invoke.d.ts.map +1 -1
- package/esm/src/channels/invoke.js +16 -0
- package/esm/src/chat/ag-ui.d.ts +4 -0
- package/esm/src/chat/ag-ui.d.ts.map +1 -1
- package/esm/src/chat/ag-ui.js +2 -0
- package/esm/src/chat/chat-ui-message-helpers.d.ts.map +1 -1
- package/esm/src/chat/chat-ui-message-helpers.js +26 -6
- package/esm/src/chat/protocol.d.ts +2 -0
- package/esm/src/chat/protocol.d.ts.map +1 -1
- package/esm/src/chat/types.d.ts +6 -0
- package/esm/src/chat/types.d.ts.map +1 -1
- package/esm/src/chat/types.js +2 -0
- package/esm/src/provider/runtime-loader/provider-usage.d.ts +1 -0
- package/esm/src/provider/runtime-loader/provider-usage.d.ts.map +1 -1
- package/esm/src/provider/runtime-loader/provider-usage.js +10 -0
- package/esm/src/rendering/renderer.d.ts +7 -0
- package/esm/src/rendering/renderer.d.ts.map +1 -1
- package/esm/src/rendering/renderer.js +169 -1
- package/esm/src/runtime/runtime-bridge.d.ts.map +1 -1
- package/esm/src/runtime/runtime-bridge.js +46 -0
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +1 -1
|
@@ -68,14 +68,30 @@ function normalizeUsage(usage) {
|
|
|
68
68
|
const inputTokens = "total" in usage.inputTokens && typeof usage.inputTokens.total === "number"
|
|
69
69
|
? usage.inputTokens.total
|
|
70
70
|
: undefined;
|
|
71
|
+
const cacheReadInputTokens = "cached" in usage.inputTokens && typeof usage.inputTokens.cached === "number"
|
|
72
|
+
? usage.inputTokens.cached
|
|
73
|
+
: "cacheRead" in usage.inputTokens && typeof usage.inputTokens.cacheRead === "number"
|
|
74
|
+
? usage.inputTokens.cacheRead
|
|
75
|
+
: undefined;
|
|
76
|
+
const cacheCreationInputTokens = "cacheCreation" in usage.inputTokens && typeof usage.inputTokens.cacheCreation === "number"
|
|
77
|
+
? usage.inputTokens.cacheCreation
|
|
78
|
+
: undefined;
|
|
71
79
|
const outputTokens = "outputTokens" in usage && typeof usage.outputTokens === "object" && usage.outputTokens &&
|
|
72
80
|
"total" in usage.outputTokens && typeof usage.outputTokens.total === "number"
|
|
73
81
|
? usage.outputTokens.total
|
|
74
82
|
: undefined;
|
|
83
|
+
const reasoningTokens = "outputTokens" in usage && typeof usage.outputTokens === "object" && usage.outputTokens &&
|
|
84
|
+
"reasoning" in usage.outputTokens && typeof usage.outputTokens.reasoning === "number"
|
|
85
|
+
? usage.outputTokens.reasoning
|
|
86
|
+
: undefined;
|
|
75
87
|
return {
|
|
76
88
|
inputTokens,
|
|
77
89
|
outputTokens,
|
|
78
90
|
totalTokens: (inputTokens ?? 0) + (outputTokens ?? 0),
|
|
91
|
+
...(cacheCreationInputTokens !== undefined ? { cacheCreationInputTokens } : {}),
|
|
92
|
+
...(cacheReadInputTokens !== undefined ? { cacheReadInputTokens } : {}),
|
|
93
|
+
...(cacheReadInputTokens !== undefined ? { cachedInputTokens: cacheReadInputTokens } : {}),
|
|
94
|
+
...(reasoningTokens !== undefined ? { reasoningTokens } : {}),
|
|
79
95
|
};
|
|
80
96
|
}
|
|
81
97
|
const flatUsage = usage;
|
|
@@ -83,6 +99,20 @@ function normalizeUsage(usage) {
|
|
|
83
99
|
inputTokens: flatUsage.inputTokens,
|
|
84
100
|
outputTokens: flatUsage.outputTokens,
|
|
85
101
|
totalTokens: flatUsage.totalTokens,
|
|
102
|
+
...(typeof flatUsage.cacheCreationInputTokens === "number"
|
|
103
|
+
? { cacheCreationInputTokens: flatUsage.cacheCreationInputTokens }
|
|
104
|
+
: {}),
|
|
105
|
+
...(typeof flatUsage.cacheReadInputTokens === "number"
|
|
106
|
+
? { cacheReadInputTokens: flatUsage.cacheReadInputTokens }
|
|
107
|
+
: {}),
|
|
108
|
+
...(typeof flatUsage.cachedInputTokens === "number"
|
|
109
|
+
? { cachedInputTokens: flatUsage.cachedInputTokens }
|
|
110
|
+
: typeof flatUsage.cacheReadInputTokens === "number"
|
|
111
|
+
? { cachedInputTokens: flatUsage.cacheReadInputTokens }
|
|
112
|
+
: {}),
|
|
113
|
+
...(typeof flatUsage.reasoningTokens === "number"
|
|
114
|
+
? { reasoningTokens: flatUsage.reasoningTokens }
|
|
115
|
+
: {}),
|
|
86
116
|
};
|
|
87
117
|
}
|
|
88
118
|
function normalizeFinishReason(finishReason) {
|
|
@@ -235,6 +265,7 @@ function normalizeStreamPart(part) {
|
|
|
235
265
|
}
|
|
236
266
|
const finishPart = part;
|
|
237
267
|
const usage = normalizeUsage(finishPart.usage);
|
|
268
|
+
const recomputedTotal = usage ? (usage.inputTokens ?? 0) + (usage.outputTokens ?? 0) : undefined;
|
|
238
269
|
return {
|
|
239
270
|
type: "finish",
|
|
240
271
|
finishReason: normalizeFinishReason(finishPart.finishReason),
|
|
@@ -243,6 +274,21 @@ function normalizeStreamPart(part) {
|
|
|
243
274
|
totalUsage: {
|
|
244
275
|
inputTokens: usage.inputTokens,
|
|
245
276
|
outputTokens: usage.outputTokens,
|
|
277
|
+
...(usage.totalTokens !== undefined && usage.totalTokens !== recomputedTotal
|
|
278
|
+
? { totalTokens: usage.totalTokens }
|
|
279
|
+
: {}),
|
|
280
|
+
...(usage.cacheCreationInputTokens !== undefined
|
|
281
|
+
? { cacheCreationInputTokens: usage.cacheCreationInputTokens }
|
|
282
|
+
: {}),
|
|
283
|
+
...(usage.cacheReadInputTokens !== undefined
|
|
284
|
+
? { cacheReadInputTokens: usage.cacheReadInputTokens }
|
|
285
|
+
: {}),
|
|
286
|
+
...(usage.cachedInputTokens !== undefined
|
|
287
|
+
? { cachedInputTokens: usage.cachedInputTokens }
|
|
288
|
+
: {}),
|
|
289
|
+
...(usage.reasoningTokens !== undefined
|
|
290
|
+
? { reasoningTokens: usage.reasoningTokens }
|
|
291
|
+
: {}),
|
|
246
292
|
},
|
|
247
293
|
}
|
|
248
294
|
: {}),
|