@dexto/core 1.9.3 → 1.9.5
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/agent/DextoAgent.cjs +3 -3
- package/dist/agent/DextoAgent.d.ts +3 -3
- package/dist/agent/DextoAgent.js +3 -3
- package/dist/llm/curation-config.cjs +1 -1
- package/dist/llm/curation-config.js +1 -1
- package/dist/llm/executor/model-request-diagnostics.cjs +286 -0
- package/dist/llm/executor/model-request-diagnostics.d.ts +63 -0
- package/dist/llm/executor/model-request-diagnostics.d.ts.map +1 -0
- package/dist/llm/executor/model-request-diagnostics.js +262 -0
- package/dist/llm/executor/turn-executor.cjs +43 -7
- package/dist/llm/executor/turn-executor.d.ts.map +1 -1
- package/dist/llm/executor/turn-executor.js +46 -7
- package/dist/llm/services/factory.cjs +60 -40
- package/dist/llm/services/factory.d.ts +4 -4
- package/dist/llm/services/factory.d.ts.map +1 -1
- package/dist/llm/services/factory.js +31 -21
- package/dist/llm/services/types.d.ts +2 -2
- package/dist/llm/services/types.d.ts.map +1 -1
- package/dist/session/title-generator.cjs +2 -2
- package/dist/session/title-generator.d.ts.map +1 -1
- package/dist/session/title-generator.js +2 -2
- package/package.json +2 -2
|
@@ -1867,10 +1867,10 @@ Either:
|
|
|
1867
1867
|
* await agent.switchLLM({ model: 'gpt-5' });
|
|
1868
1868
|
*
|
|
1869
1869
|
* // Switch to a different provider with explicit API key
|
|
1870
|
-
* await agent.switchLLM({ provider: 'anthropic', model: 'claude-4-
|
|
1870
|
+
* await agent.switchLLM({ provider: 'anthropic', model: 'claude-sonnet-4-5', apiKey: 'sk-ant-...' });
|
|
1871
1871
|
*
|
|
1872
1872
|
* // Switch with session options
|
|
1873
|
-
* await agent.switchLLM({ provider: 'anthropic', model: 'claude-4-
|
|
1873
|
+
* await agent.switchLLM({ provider: 'anthropic', model: 'claude-sonnet-4-5' }, 'user-123');
|
|
1874
1874
|
*
|
|
1875
1875
|
* // Switch for all sessions
|
|
1876
1876
|
* await agent.switchLLM({ model: 'gpt-5' }, '*');
|
|
@@ -2014,7 +2014,7 @@ Either:
|
|
|
2014
2014
|
* const provider = agent.inferProviderFromModel('gpt-5');
|
|
2015
2015
|
* console.log(provider); // 'openai'
|
|
2016
2016
|
*
|
|
2017
|
-
* const provider2 = agent.inferProviderFromModel('claude-4-
|
|
2017
|
+
* const provider2 = agent.inferProviderFromModel('claude-sonnet-4-5');
|
|
2018
2018
|
* console.log(provider2); // 'anthropic'
|
|
2019
2019
|
*
|
|
2020
2020
|
* const provider3 = agent.inferProviderFromModel('unknown-model');
|
|
@@ -617,10 +617,10 @@ export declare class DextoAgent {
|
|
|
617
617
|
* await agent.switchLLM({ model: 'gpt-5' });
|
|
618
618
|
*
|
|
619
619
|
* // Switch to a different provider with explicit API key
|
|
620
|
-
* await agent.switchLLM({ provider: 'anthropic', model: 'claude-4-
|
|
620
|
+
* await agent.switchLLM({ provider: 'anthropic', model: 'claude-sonnet-4-5', apiKey: 'sk-ant-...' });
|
|
621
621
|
*
|
|
622
622
|
* // Switch with session options
|
|
623
|
-
* await agent.switchLLM({ provider: 'anthropic', model: 'claude-4-
|
|
623
|
+
* await agent.switchLLM({ provider: 'anthropic', model: 'claude-sonnet-4-5' }, 'user-123');
|
|
624
624
|
*
|
|
625
625
|
* // Switch for all sessions
|
|
626
626
|
* await agent.switchLLM({ model: 'gpt-5' }, '*');
|
|
@@ -706,7 +706,7 @@ export declare class DextoAgent {
|
|
|
706
706
|
* const provider = agent.inferProviderFromModel('gpt-5');
|
|
707
707
|
* console.log(provider); // 'openai'
|
|
708
708
|
*
|
|
709
|
-
* const provider2 = agent.inferProviderFromModel('claude-4-
|
|
709
|
+
* const provider2 = agent.inferProviderFromModel('claude-sonnet-4-5');
|
|
710
710
|
* console.log(provider2); // 'anthropic'
|
|
711
711
|
*
|
|
712
712
|
* const provider3 = agent.inferProviderFromModel('unknown-model');
|
package/dist/agent/DextoAgent.js
CHANGED
|
@@ -1818,10 +1818,10 @@ Either:
|
|
|
1818
1818
|
* await agent.switchLLM({ model: 'gpt-5' });
|
|
1819
1819
|
*
|
|
1820
1820
|
* // Switch to a different provider with explicit API key
|
|
1821
|
-
* await agent.switchLLM({ provider: 'anthropic', model: 'claude-4-
|
|
1821
|
+
* await agent.switchLLM({ provider: 'anthropic', model: 'claude-sonnet-4-5', apiKey: 'sk-ant-...' });
|
|
1822
1822
|
*
|
|
1823
1823
|
* // Switch with session options
|
|
1824
|
-
* await agent.switchLLM({ provider: 'anthropic', model: 'claude-4-
|
|
1824
|
+
* await agent.switchLLM({ provider: 'anthropic', model: 'claude-sonnet-4-5' }, 'user-123');
|
|
1825
1825
|
*
|
|
1826
1826
|
* // Switch for all sessions
|
|
1827
1827
|
* await agent.switchLLM({ model: 'gpt-5' }, '*');
|
|
@@ -1965,7 +1965,7 @@ Either:
|
|
|
1965
1965
|
* const provider = agent.inferProviderFromModel('gpt-5');
|
|
1966
1966
|
* console.log(provider); // 'openai'
|
|
1967
1967
|
*
|
|
1968
|
-
* const provider2 = agent.inferProviderFromModel('claude-4-
|
|
1968
|
+
* const provider2 = agent.inferProviderFromModel('claude-sonnet-4-5');
|
|
1969
1969
|
* console.log(provider2); // 'anthropic'
|
|
1970
1970
|
*
|
|
1971
1971
|
* const provider3 = agent.inferProviderFromModel('unknown-model');
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var model_request_diagnostics_exports = {};
|
|
20
|
+
__export(model_request_diagnostics_exports, {
|
|
21
|
+
createModelRequestDiagnostics: () => createModelRequestDiagnostics,
|
|
22
|
+
modelRequestDiagnosticAttributes: () => modelRequestDiagnosticAttributes
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(model_request_diagnostics_exports);
|
|
25
|
+
function createModelRequestDiagnostics(input) {
|
|
26
|
+
const messageJson = measureMessagesJson(input.formattedMessages);
|
|
27
|
+
const toolJson = safeJsonUtf8Bytes(input.toolDefinitions);
|
|
28
|
+
const providerOptionsJson = safeJsonUtf8Bytes(input.providerOptions);
|
|
29
|
+
const reasoningJson = safeJsonUtf8Bytes(input.reasoning);
|
|
30
|
+
const media = summarizeModelMessageMedia(input.formattedMessages);
|
|
31
|
+
return {
|
|
32
|
+
...media,
|
|
33
|
+
compacted: input.compacted,
|
|
34
|
+
estimatedInputTokens: input.estimatedInputTokens,
|
|
35
|
+
formattedMessageCount: input.formattedMessages.length,
|
|
36
|
+
formattedMessagesJsonBytes: messageJson.bytes,
|
|
37
|
+
maxFormattedMessageJsonBytes: messageJson.maxMessageBytes,
|
|
38
|
+
model: input.model,
|
|
39
|
+
preparedHistoryCount: input.preparedHistoryCount,
|
|
40
|
+
preparedHistoryFilteredCount: input.preparedHistoryStats.filteredCount,
|
|
41
|
+
preparedHistoryOriginalCount: input.preparedHistoryStats.originalCount,
|
|
42
|
+
preparedHistoryPrunedToolCount: input.preparedHistoryStats.prunedToolCount,
|
|
43
|
+
provider: input.provider,
|
|
44
|
+
providerOptionsJsonBytes: providerOptionsJson.bytes,
|
|
45
|
+
...input.reasoning?.reasoningBudgetTokens === void 0 ? {} : { reasoningBudgetTokens: input.reasoning.reasoningBudgetTokens },
|
|
46
|
+
reasoningJsonBytes: reasoningJson.bytes,
|
|
47
|
+
...input.reasoning?.reasoningVariant === void 0 ? {} : { reasoningVariant: input.reasoning.reasoningVariant },
|
|
48
|
+
serializationErrorCount: messageJson.errorCount + toolJson.errorCount + providerOptionsJson.errorCount + reasoningJson.errorCount,
|
|
49
|
+
streaming: input.streaming,
|
|
50
|
+
systemPromptBytes: utf8ByteLength(input.systemPrompt),
|
|
51
|
+
toolCount: Object.keys(input.toolDefinitions).length,
|
|
52
|
+
toolDefinitionsJsonBytes: toolJson.bytes
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function modelRequestDiagnosticAttributes(diagnostics) {
|
|
56
|
+
return {
|
|
57
|
+
"context.estimated_input_tokens": diagnostics.estimatedInputTokens,
|
|
58
|
+
"llm.model": diagnostics.model,
|
|
59
|
+
"llm.provider": diagnostics.provider,
|
|
60
|
+
"model_request.binary_media_bytes": diagnostics.binaryMediaBytes,
|
|
61
|
+
"model_request.binary_media_part_count": diagnostics.binaryMediaPartCount,
|
|
62
|
+
"model_request.compacted": diagnostics.compacted,
|
|
63
|
+
"model_request.file_part_count": diagnostics.filePartCount,
|
|
64
|
+
"model_request.formatted_message_count": diagnostics.formattedMessageCount,
|
|
65
|
+
"model_request.formatted_messages_json_bytes": diagnostics.formattedMessagesJsonBytes,
|
|
66
|
+
"model_request.image_part_count": diagnostics.imagePartCount,
|
|
67
|
+
"model_request.inline_file_payload_chars": diagnostics.inlineFilePayloadChars,
|
|
68
|
+
"model_request.inline_file_payload_decoded_bytes": diagnostics.inlineFilePayloadDecodedBytes,
|
|
69
|
+
"model_request.inline_file_part_count": diagnostics.inlineFilePartCount,
|
|
70
|
+
"model_request.inline_image_payload_chars": diagnostics.inlineImagePayloadChars,
|
|
71
|
+
"model_request.inline_image_payload_decoded_bytes": diagnostics.inlineImagePayloadDecodedBytes,
|
|
72
|
+
"model_request.inline_image_part_count": diagnostics.inlineImagePartCount,
|
|
73
|
+
"model_request.max_formatted_message_json_bytes": diagnostics.maxFormattedMessageJsonBytes,
|
|
74
|
+
"model_request.max_inline_file_payload_chars": diagnostics.maxInlineFilePayloadChars,
|
|
75
|
+
"model_request.max_inline_image_payload_chars": diagnostics.maxInlineImagePayloadChars,
|
|
76
|
+
"model_request.prepared_history_count": diagnostics.preparedHistoryCount,
|
|
77
|
+
"model_request.prepared_history_filtered_count": diagnostics.preparedHistoryFilteredCount,
|
|
78
|
+
"model_request.prepared_history_original_count": diagnostics.preparedHistoryOriginalCount,
|
|
79
|
+
"model_request.prepared_history_pruned_tool_count": diagnostics.preparedHistoryPrunedToolCount,
|
|
80
|
+
"model_request.provider_options_json_bytes": diagnostics.providerOptionsJsonBytes,
|
|
81
|
+
...diagnostics.reasoningBudgetTokens === void 0 ? {} : {
|
|
82
|
+
"model_request.reasoning_budget_tokens": diagnostics.reasoningBudgetTokens
|
|
83
|
+
},
|
|
84
|
+
"model_request.reasoning_json_bytes": diagnostics.reasoningJsonBytes,
|
|
85
|
+
...diagnostics.reasoningVariant === void 0 ? {} : {
|
|
86
|
+
"model_request.reasoning_variant": diagnostics.reasoningVariant
|
|
87
|
+
},
|
|
88
|
+
"model_request.remote_media_part_count": diagnostics.remoteMediaPartCount,
|
|
89
|
+
"model_request.resource_media_part_count": diagnostics.resourceMediaPartCount,
|
|
90
|
+
"model_request.serialization_error_count": diagnostics.serializationErrorCount,
|
|
91
|
+
"model_request.streaming": diagnostics.streaming,
|
|
92
|
+
"model_request.system_prompt_bytes": diagnostics.systemPromptBytes,
|
|
93
|
+
"model_request.text_chars": diagnostics.textChars,
|
|
94
|
+
"model_request.text_part_count": diagnostics.textPartCount,
|
|
95
|
+
"model_request.tool_count": diagnostics.toolCount,
|
|
96
|
+
"model_request.tool_definitions_json_bytes": diagnostics.toolDefinitionsJsonBytes
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function measureMessagesJson(messages) {
|
|
100
|
+
let bodyBytes = 0;
|
|
101
|
+
let errorCount = 0;
|
|
102
|
+
let maxMessageBytes = 0;
|
|
103
|
+
for (const message of messages) {
|
|
104
|
+
const measurement = safeJsonUtf8Bytes(message);
|
|
105
|
+
bodyBytes += measurement.bytes;
|
|
106
|
+
errorCount += measurement.errorCount;
|
|
107
|
+
maxMessageBytes = Math.max(maxMessageBytes, measurement.bytes);
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
bytes: messages.length === 0 ? 2 : bodyBytes + messages.length + 1,
|
|
111
|
+
errorCount,
|
|
112
|
+
maxMessageBytes
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function safeJsonUtf8Bytes(value) {
|
|
116
|
+
if (value === void 0) {
|
|
117
|
+
return { bytes: 0, errorCount: 0 };
|
|
118
|
+
}
|
|
119
|
+
try {
|
|
120
|
+
return {
|
|
121
|
+
bytes: utf8ByteLength(JSON.stringify(value, diagnosticJsonReplacer) ?? ""),
|
|
122
|
+
errorCount: 0
|
|
123
|
+
};
|
|
124
|
+
} catch {
|
|
125
|
+
return { bytes: 0, errorCount: 1 };
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function diagnosticJsonReplacer(_key, value) {
|
|
129
|
+
if (value instanceof Uint8Array) {
|
|
130
|
+
return { diagnosticType: "Uint8Array", byteLength: value.byteLength };
|
|
131
|
+
}
|
|
132
|
+
if (value instanceof ArrayBuffer) {
|
|
133
|
+
return { diagnosticType: "ArrayBuffer", byteLength: value.byteLength };
|
|
134
|
+
}
|
|
135
|
+
return value;
|
|
136
|
+
}
|
|
137
|
+
function summarizeModelMessageMedia(messages) {
|
|
138
|
+
const summary = {
|
|
139
|
+
binaryMediaBytes: 0,
|
|
140
|
+
binaryMediaPartCount: 0,
|
|
141
|
+
filePartCount: 0,
|
|
142
|
+
imagePartCount: 0,
|
|
143
|
+
inlineFilePayloadChars: 0,
|
|
144
|
+
inlineFilePayloadDecodedBytes: 0,
|
|
145
|
+
inlineFilePartCount: 0,
|
|
146
|
+
inlineImagePayloadChars: 0,
|
|
147
|
+
inlineImagePayloadDecodedBytes: 0,
|
|
148
|
+
inlineImagePartCount: 0,
|
|
149
|
+
maxInlineFilePayloadChars: 0,
|
|
150
|
+
maxInlineImagePayloadChars: 0,
|
|
151
|
+
remoteMediaPartCount: 0,
|
|
152
|
+
resourceMediaPartCount: 0,
|
|
153
|
+
textChars: 0,
|
|
154
|
+
textPartCount: 0
|
|
155
|
+
};
|
|
156
|
+
for (const message of messages) {
|
|
157
|
+
summarizeContent(message.content, summary);
|
|
158
|
+
}
|
|
159
|
+
return summary;
|
|
160
|
+
}
|
|
161
|
+
function summarizeContent(content, summary) {
|
|
162
|
+
if (typeof content === "string") {
|
|
163
|
+
summary.textPartCount += 1;
|
|
164
|
+
summary.textChars += content.length;
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (!Array.isArray(content)) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
for (const part of content) {
|
|
171
|
+
if (!isRecord(part) || typeof part.type !== "string") {
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
switch (part.type) {
|
|
175
|
+
case "text":
|
|
176
|
+
case "reasoning":
|
|
177
|
+
summarizeTextLikePart(part, summary);
|
|
178
|
+
break;
|
|
179
|
+
case "image":
|
|
180
|
+
summary.imagePartCount += 1;
|
|
181
|
+
summarizeMediaPayload(part.image, "image", summary);
|
|
182
|
+
break;
|
|
183
|
+
case "file":
|
|
184
|
+
summary.filePartCount += 1;
|
|
185
|
+
summarizeMediaPayload(part.data, "file", summary);
|
|
186
|
+
break;
|
|
187
|
+
case "resource":
|
|
188
|
+
case "ui-resource":
|
|
189
|
+
summary.resourceMediaPartCount += 1;
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
function summarizeTextLikePart(part, summary) {
|
|
195
|
+
if (typeof part.text !== "string") {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
summary.textPartCount += 1;
|
|
199
|
+
summary.textChars += part.text.length;
|
|
200
|
+
}
|
|
201
|
+
function summarizeMediaPayload(payload, kind, summary) {
|
|
202
|
+
if (payload instanceof URL || isRemoteUrlString(payload)) {
|
|
203
|
+
summary.remoteMediaPartCount += 1;
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
if (typeof payload === "string") {
|
|
207
|
+
summarizeInlinePayload(payload, kind, summary);
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
const binaryBytes = getBinaryByteLength(payload);
|
|
211
|
+
if (binaryBytes !== void 0) {
|
|
212
|
+
summary.binaryMediaPartCount += 1;
|
|
213
|
+
summary.binaryMediaBytes += binaryBytes;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
function summarizeInlinePayload(payload, kind, summary) {
|
|
217
|
+
const payloadChars = extractInlinePayload(payload).length;
|
|
218
|
+
const decodedBytes = estimateBase64DecodedBytes(payload);
|
|
219
|
+
if (kind === "image") {
|
|
220
|
+
summary.inlineImagePartCount += 1;
|
|
221
|
+
summary.inlineImagePayloadChars += payloadChars;
|
|
222
|
+
summary.inlineImagePayloadDecodedBytes += decodedBytes;
|
|
223
|
+
summary.maxInlineImagePayloadChars = Math.max(
|
|
224
|
+
summary.maxInlineImagePayloadChars,
|
|
225
|
+
payloadChars
|
|
226
|
+
);
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
summary.inlineFilePartCount += 1;
|
|
230
|
+
summary.inlineFilePayloadChars += payloadChars;
|
|
231
|
+
summary.inlineFilePayloadDecodedBytes += decodedBytes;
|
|
232
|
+
summary.maxInlineFilePayloadChars = Math.max(summary.maxInlineFilePayloadChars, payloadChars);
|
|
233
|
+
}
|
|
234
|
+
function extractInlinePayload(payload) {
|
|
235
|
+
const trimmed = payload.trim();
|
|
236
|
+
const dataUriMatch = /^data:[^,]*,(.*)$/is.exec(trimmed);
|
|
237
|
+
return (dataUriMatch?.[1] ?? trimmed).replace(/\s/g, "");
|
|
238
|
+
}
|
|
239
|
+
function estimateBase64DecodedBytes(payload) {
|
|
240
|
+
const normalized = extractInlinePayload(payload);
|
|
241
|
+
if (normalized.length === 0) {
|
|
242
|
+
return 0;
|
|
243
|
+
}
|
|
244
|
+
const padding = normalized.endsWith("==") ? 2 : normalized.endsWith("=") ? 1 : 0;
|
|
245
|
+
return Math.max(0, Math.floor(normalized.length * 3 / 4) - padding);
|
|
246
|
+
}
|
|
247
|
+
function getBinaryByteLength(value) {
|
|
248
|
+
if (value instanceof Uint8Array) {
|
|
249
|
+
return value.byteLength;
|
|
250
|
+
}
|
|
251
|
+
if (value instanceof ArrayBuffer) {
|
|
252
|
+
return value.byteLength;
|
|
253
|
+
}
|
|
254
|
+
return void 0;
|
|
255
|
+
}
|
|
256
|
+
function isRemoteUrlString(value) {
|
|
257
|
+
return typeof value === "string" && /^https?:\/\//i.test(value);
|
|
258
|
+
}
|
|
259
|
+
function isRecord(value) {
|
|
260
|
+
return typeof value === "object" && value !== null;
|
|
261
|
+
}
|
|
262
|
+
function utf8ByteLength(value) {
|
|
263
|
+
let bytes = 0;
|
|
264
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
265
|
+
const codePoint = value.codePointAt(index);
|
|
266
|
+
if (codePoint === void 0) {
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
if (codePoint <= 127) {
|
|
270
|
+
bytes += 1;
|
|
271
|
+
} else if (codePoint <= 2047) {
|
|
272
|
+
bytes += 2;
|
|
273
|
+
} else if (codePoint <= 65535) {
|
|
274
|
+
bytes += 3;
|
|
275
|
+
} else {
|
|
276
|
+
bytes += 4;
|
|
277
|
+
index += 1;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return bytes;
|
|
281
|
+
}
|
|
282
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
283
|
+
0 && (module.exports = {
|
|
284
|
+
createModelRequestDiagnostics,
|
|
285
|
+
modelRequestDiagnosticAttributes
|
|
286
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { SharedV2ProviderOptions } from '@ai-sdk/provider';
|
|
2
|
+
import type { ModelMessage } from 'ai';
|
|
3
|
+
import type { ReasoningVariant } from '@dexto/llm';
|
|
4
|
+
import type { PreparedHistoryResult } from '../../context/manager.js';
|
|
5
|
+
import type { ToolSet } from '../../tools/types.js';
|
|
6
|
+
export type ModelRequestDiagnostics = {
|
|
7
|
+
readonly binaryMediaBytes: number;
|
|
8
|
+
readonly binaryMediaPartCount: number;
|
|
9
|
+
readonly compacted: boolean;
|
|
10
|
+
readonly estimatedInputTokens: number;
|
|
11
|
+
readonly filePartCount: number;
|
|
12
|
+
readonly formattedMessageCount: number;
|
|
13
|
+
readonly formattedMessagesJsonBytes: number;
|
|
14
|
+
readonly imagePartCount: number;
|
|
15
|
+
readonly inlineFilePayloadChars: number;
|
|
16
|
+
readonly inlineFilePayloadDecodedBytes: number;
|
|
17
|
+
readonly inlineFilePartCount: number;
|
|
18
|
+
readonly inlineImagePayloadChars: number;
|
|
19
|
+
readonly inlineImagePayloadDecodedBytes: number;
|
|
20
|
+
readonly inlineImagePartCount: number;
|
|
21
|
+
readonly maxFormattedMessageJsonBytes: number;
|
|
22
|
+
readonly maxInlineFilePayloadChars: number;
|
|
23
|
+
readonly maxInlineImagePayloadChars: number;
|
|
24
|
+
readonly model: string;
|
|
25
|
+
readonly preparedHistoryCount: number;
|
|
26
|
+
readonly preparedHistoryFilteredCount: number;
|
|
27
|
+
readonly preparedHistoryOriginalCount: number;
|
|
28
|
+
readonly preparedHistoryPrunedToolCount: number;
|
|
29
|
+
readonly provider: string;
|
|
30
|
+
readonly providerOptionsJsonBytes: number;
|
|
31
|
+
readonly reasoningBudgetTokens?: number;
|
|
32
|
+
readonly reasoningJsonBytes: number;
|
|
33
|
+
readonly reasoningVariant?: ReasoningVariant;
|
|
34
|
+
readonly remoteMediaPartCount: number;
|
|
35
|
+
readonly resourceMediaPartCount: number;
|
|
36
|
+
readonly serializationErrorCount: number;
|
|
37
|
+
readonly streaming: boolean;
|
|
38
|
+
readonly systemPromptBytes: number;
|
|
39
|
+
readonly textChars: number;
|
|
40
|
+
readonly textPartCount: number;
|
|
41
|
+
readonly toolCount: number;
|
|
42
|
+
readonly toolDefinitionsJsonBytes: number;
|
|
43
|
+
};
|
|
44
|
+
export type ModelRequestDiagnosticAttributes = Record<string, string | number | boolean>;
|
|
45
|
+
export declare function createModelRequestDiagnostics(input: {
|
|
46
|
+
compacted: boolean;
|
|
47
|
+
estimatedInputTokens: number;
|
|
48
|
+
formattedMessages: readonly ModelMessage[];
|
|
49
|
+
model: string;
|
|
50
|
+
preparedHistoryCount: number;
|
|
51
|
+
preparedHistoryStats: PreparedHistoryResult['stats'];
|
|
52
|
+
provider: string;
|
|
53
|
+
providerOptions: SharedV2ProviderOptions | undefined;
|
|
54
|
+
reasoning: {
|
|
55
|
+
reasoningVariant?: ReasoningVariant;
|
|
56
|
+
reasoningBudgetTokens?: number;
|
|
57
|
+
} | undefined;
|
|
58
|
+
streaming: boolean;
|
|
59
|
+
systemPrompt: string;
|
|
60
|
+
toolDefinitions: ToolSet;
|
|
61
|
+
}): ModelRequestDiagnostics;
|
|
62
|
+
export declare function modelRequestDiagnosticAttributes(diagnostics: ModelRequestDiagnostics): ModelRequestDiagnosticAttributes;
|
|
63
|
+
//# sourceMappingURL=model-request-diagnostics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-request-diagnostics.d.ts","sourceRoot":"","sources":["../../../src/llm/executor/model-request-diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD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