veryfront 0.1.201 → 0.1.203
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/src/agent/ag-ui-browser-encoder.d.ts.map +1 -1
- package/esm/src/agent/ag-ui-browser-encoder.js +6 -2
- package/esm/src/agent/runtime/default-provider-options.d.ts +11 -0
- package/esm/src/agent/runtime/default-provider-options.d.ts.map +1 -0
- package/esm/src/agent/runtime/default-provider-options.js +45 -0
- package/esm/src/agent/runtime/index.d.ts +6 -1
- package/esm/src/agent/runtime/index.d.ts.map +1 -1
- package/esm/src/agent/runtime/index.js +27 -11
- package/esm/src/agent/schemas/agent.schema.d.ts +14 -0
- package/esm/src/agent/schemas/agent.schema.d.ts.map +1 -1
- package/esm/src/agent/schemas/agent.schema.js +3 -0
- package/esm/src/chat/ag-ui.d.ts +1 -0
- package/esm/src/chat/ag-ui.d.ts.map +1 -1
- package/esm/src/chat/ag-ui.js +2 -1
- package/esm/src/provider/runtime-loader.d.ts.map +1 -1
- package/esm/src/provider/runtime-loader.js +10 -3
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +1 -1
- package/src/deno.js +1 -1
- package/src/src/agent/ag-ui-browser-encoder.ts +10 -6
- package/src/src/agent/runtime/default-provider-options.ts +52 -0
- package/src/src/agent/runtime/index.ts +38 -11
- package/src/src/agent/schemas/agent.schema.ts +3 -0
- package/src/src/chat/ag-ui.ts +2 -1
- package/src/src/provider/runtime-loader.ts +12 -3
- package/src/src/utils/version-constant.ts +1 -1
package/esm/deno.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ag-ui-browser-encoder.d.ts","sourceRoot":"","sources":["../../../src/src/agent/ag-ui-browser-encoder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,MAAM,sBAAsB,GAA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AAM,CAAA;CAAE,CAAC;AAEhF,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,oBAAoB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAClC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,QAAQ,EAAE,8BAA8B,CAAC;CAC1C;AAED,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,wBAAgB,6BAA6B,IAAI,uBAAuB,CAYvE;AAuND,wBAAgB,wCAAwC,CACtD,KAAK,EAAE,uBAAuB,EAC9B,KAAK,EAAE,sBAAsB,GAC5B,uBAAuB,EAAE,CA6M3B;AAED,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,uBAAuB,EAC9B,QAAQ,EAAE,aAAa,GAAG,IAAI,GAC7B,uBAAuB,EAAE,CA8B3B"}
|
|
@@ -253,13 +253,17 @@ export function mapRuntimeStreamEventToAgUiBrowserEvents(state, event) {
|
|
|
253
253
|
if (typeof event.toolCallId === "string") {
|
|
254
254
|
state.streamedToolInputIds.add(event.toolCallId);
|
|
255
255
|
}
|
|
256
|
-
return [
|
|
256
|
+
return [
|
|
257
|
+
...closeOpenTextEvent(state),
|
|
258
|
+
...closeOpenReasoningEvent(state),
|
|
259
|
+
{
|
|
257
260
|
event: "ToolCallArgs",
|
|
258
261
|
payload: {
|
|
259
262
|
toolCallId: event.toolCallId,
|
|
260
263
|
delta: typeof event.inputTextDelta === "string" ? event.inputTextDelta : "",
|
|
261
264
|
},
|
|
262
|
-
}
|
|
265
|
+
},
|
|
266
|
+
];
|
|
263
267
|
case "tool-input-available": {
|
|
264
268
|
state.sawVisibleOutput = true;
|
|
265
269
|
return [
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-default `providerOptions` for known providers.
|
|
3
|
+
*
|
|
4
|
+
* Currently: enable Anthropic extended thinking by default for any
|
|
5
|
+
* Anthropic model, since the `reasoning-*` event surface in this framework
|
|
6
|
+
* relies on the provider-side feature being on. Apps can override or opt
|
|
7
|
+
* out by returning their own `providerOptions.anthropic.thinking` from
|
|
8
|
+
* `AgentConfig.resolveModelTransport`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveProviderOptionsWithDefaults(modelString: string, existing: Record<string, unknown> | undefined): Record<string, unknown> | undefined;
|
|
11
|
+
//# sourceMappingURL=default-provider-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-provider-options.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/default-provider-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAoBH,wBAAgB,kCAAkC,CAChD,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAC5C,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAoBrC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-default `providerOptions` for known providers.
|
|
3
|
+
*
|
|
4
|
+
* Currently: enable Anthropic extended thinking by default for any
|
|
5
|
+
* Anthropic model, since the `reasoning-*` event surface in this framework
|
|
6
|
+
* relies on the provider-side feature being on. Apps can override or opt
|
|
7
|
+
* out by returning their own `providerOptions.anthropic.thinking` from
|
|
8
|
+
* `AgentConfig.resolveModelTransport`.
|
|
9
|
+
*/
|
|
10
|
+
const VERYFRONT_CLOUD_PREFIX = "veryfront-cloud/";
|
|
11
|
+
const ANTHROPIC_PREFIX = "anthropic/";
|
|
12
|
+
const DEFAULT_ANTHROPIC_THINKING_BUDGET_TOKENS = 2048;
|
|
13
|
+
function isAnthropicModel(modelString) {
|
|
14
|
+
const normalized = modelString.startsWith(VERYFRONT_CLOUD_PREFIX)
|
|
15
|
+
? modelString.slice(VERYFRONT_CLOUD_PREFIX.length)
|
|
16
|
+
: modelString;
|
|
17
|
+
return normalized.startsWith(ANTHROPIC_PREFIX);
|
|
18
|
+
}
|
|
19
|
+
function hasAnthropicThinkingConfig(existing) {
|
|
20
|
+
if (!existing || typeof existing !== "object")
|
|
21
|
+
return false;
|
|
22
|
+
const anthropic = existing.anthropic;
|
|
23
|
+
if (!anthropic || typeof anthropic !== "object")
|
|
24
|
+
return false;
|
|
25
|
+
return "thinking" in anthropic;
|
|
26
|
+
}
|
|
27
|
+
export function resolveProviderOptionsWithDefaults(modelString, existing) {
|
|
28
|
+
if (!isAnthropicModel(modelString)) {
|
|
29
|
+
return existing;
|
|
30
|
+
}
|
|
31
|
+
if (hasAnthropicThinkingConfig(existing)) {
|
|
32
|
+
return existing;
|
|
33
|
+
}
|
|
34
|
+
const existingAnthropic = (existing?.anthropic ?? {});
|
|
35
|
+
return {
|
|
36
|
+
...(existing ?? {}),
|
|
37
|
+
anthropic: {
|
|
38
|
+
// Defaults first; host-supplied fields (e.g. temperature) override them.
|
|
39
|
+
// Only `thinking` is forced because we already confirmed it isn't set.
|
|
40
|
+
temperature: 1,
|
|
41
|
+
...existingAnthropic,
|
|
42
|
+
thinking: { type: "enabled", budget_tokens: DEFAULT_ANTHROPIC_THINKING_BUDGET_TOKENS },
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import { type AgentConfig, type AgentResponse, type Message, type ToolCall, type ToolResultPart } from "../types.js";
|
|
14
14
|
import { type Memory } from "../memory/index.js";
|
|
15
|
-
import { type ChatStreamState, type StreamingToolResult } from "./chat-stream-handler.js";
|
|
15
|
+
import { type ChatStreamState, type StreamingToolCall, type StreamingToolResult } from "./chat-stream-handler.js";
|
|
16
16
|
export { closeSSEStream, generateMessageId, sendSSE } from "./sse-utils.js";
|
|
17
17
|
export { RunAlreadyExistsError, RunCancelledError, RunNotActiveError, RunResumeSessionManager, WaitConflictError, WaitNotPendingError, } from "./resume-session.js";
|
|
18
18
|
export type { RunResumeSessionManagerOptions, RunSessionStatus, SubmitResumeValueOutcome, } from "./resume-session.js";
|
|
@@ -26,6 +26,11 @@ import type { RuntimeGenerateToolResult } from "./runtime-tool-types.js";
|
|
|
26
26
|
export declare function collectFinalStreamToolResults(state: Pick<ChatStreamState, "toolResults">): Map<string, StreamingToolResult>;
|
|
27
27
|
export declare function collectPersistedToolResults(messages: Message[]): Map<string, ToolResultPart>;
|
|
28
28
|
export declare function collectGeneratedToolResults(toolResults: RuntimeGenerateToolResult[] | undefined): Map<string, RuntimeGenerateToolResult>;
|
|
29
|
+
export declare function captureStreamedToolCallInput(toolCall: Pick<StreamingToolCall, "arguments">): {
|
|
30
|
+
args: Record<string, unknown>;
|
|
31
|
+
inputText?: string;
|
|
32
|
+
parseError?: string;
|
|
33
|
+
};
|
|
29
34
|
/**
|
|
30
35
|
* Extract and validate the skill policy from a load-skill tool result.
|
|
31
36
|
* Returns `[]` (no tools allowed) for invalid/missing policies instead of
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,KAAK,WA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;IAIF;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;CAGnC"}
|
|
@@ -19,6 +19,7 @@ import { serverLogger } from "../../utils/index.js";
|
|
|
19
19
|
import { addSpanEvent, setSpanAttributes, withSpan, } from "../../observability/tracing/index.js";
|
|
20
20
|
import { convertToModelMessages } from "./model-message-converter.js";
|
|
21
21
|
import { convertToolsToRuntimeTools } from "./model-tool-converter.js";
|
|
22
|
+
import { resolveProviderOptionsWithDefaults } from "./default-provider-options.js";
|
|
22
23
|
import { createStreamState, processStream, } from "./chat-stream-handler.js";
|
|
23
24
|
import { repairToolCall } from "./repair-tool-call.js";
|
|
24
25
|
import { MiddlewareChain } from "../middleware/chain.js";
|
|
@@ -90,6 +91,14 @@ export function collectGeneratedToolResults(toolResults) {
|
|
|
90
91
|
}
|
|
91
92
|
return generatedToolResults;
|
|
92
93
|
}
|
|
94
|
+
export function captureStreamedToolCallInput(toolCall) {
|
|
95
|
+
const { args, error } = parseToolArgs(toolCall.arguments);
|
|
96
|
+
return {
|
|
97
|
+
args,
|
|
98
|
+
...(toolCall.arguments.length > 0 ? { inputText: toolCall.arguments } : {}),
|
|
99
|
+
...(error ? { parseError: error } : {}),
|
|
100
|
+
};
|
|
101
|
+
}
|
|
93
102
|
function isToolResultPart(part) {
|
|
94
103
|
return part.type === "tool-result" && "result" in part;
|
|
95
104
|
}
|
|
@@ -178,7 +187,7 @@ export class AgentRuntime {
|
|
|
178
187
|
resolvedModelString,
|
|
179
188
|
languageModel: transport?.model ?? resolveModel(resolvedModelString),
|
|
180
189
|
headers: transport?.headers,
|
|
181
|
-
providerOptions: transport?.providerOptions,
|
|
190
|
+
providerOptions: resolveProviderOptionsWithDefaults(resolvedModelString, transport?.providerOptions),
|
|
182
191
|
};
|
|
183
192
|
}
|
|
184
193
|
async resolveRuntimeState(messages, context, mode, step, systemPrompt) {
|
|
@@ -640,18 +649,19 @@ export class AgentRuntime {
|
|
|
640
649
|
if (state.accumulatedText)
|
|
641
650
|
streamParts.push({ type: "text", text: state.accumulatedText });
|
|
642
651
|
for (const tc of state.toolCalls.values()) {
|
|
643
|
-
const
|
|
644
|
-
if (
|
|
652
|
+
const capturedInput = captureStreamedToolCallInput(tc);
|
|
653
|
+
if (capturedInput.parseError) {
|
|
645
654
|
logger.warn("Failed to parse streamed tool arguments", {
|
|
646
655
|
toolCallId: tc.id,
|
|
647
|
-
error,
|
|
656
|
+
error: capturedInput.parseError,
|
|
648
657
|
});
|
|
649
658
|
}
|
|
650
659
|
streamParts.push({
|
|
651
660
|
type: `tool-${tc.name}`,
|
|
652
661
|
toolCallId: tc.id,
|
|
653
662
|
toolName: tc.name,
|
|
654
|
-
args,
|
|
663
|
+
args: capturedInput.args,
|
|
664
|
+
...(capturedInput.inputText ? { inputText: capturedInput.inputText } : {}),
|
|
655
665
|
});
|
|
656
666
|
}
|
|
657
667
|
const assistantMessage = {
|
|
@@ -701,8 +711,14 @@ export class AgentRuntime {
|
|
|
701
711
|
streamedToolCalls.some((tc) => tc.name === LOAD_SKILL_TOOL_ID);
|
|
702
712
|
for (const tc of streamedToolCalls) {
|
|
703
713
|
throwIfAborted(abortSignal);
|
|
704
|
-
const
|
|
705
|
-
const toolCall = {
|
|
714
|
+
const capturedInput = captureStreamedToolCallInput(tc);
|
|
715
|
+
const toolCall = {
|
|
716
|
+
id: tc.id,
|
|
717
|
+
name: tc.name,
|
|
718
|
+
args: capturedInput.args,
|
|
719
|
+
...(capturedInput.inputText ? { inputText: capturedInput.inputText } : {}),
|
|
720
|
+
status: "pending",
|
|
721
|
+
};
|
|
706
722
|
const matchingResult = finalToolResults.get(tc.id);
|
|
707
723
|
const persistedResult = currentStepToolResults.get(tc.id);
|
|
708
724
|
if (matchingResult) {
|
|
@@ -723,19 +739,19 @@ export class AgentRuntime {
|
|
|
723
739
|
toolCalls.push(toolCall);
|
|
724
740
|
continue;
|
|
725
741
|
}
|
|
726
|
-
if (
|
|
742
|
+
if (capturedInput.parseError) {
|
|
727
743
|
logger.warn("Invalid streamed tool arguments", {
|
|
728
744
|
toolCallId: tc.id,
|
|
729
|
-
error:
|
|
745
|
+
error: capturedInput.parseError,
|
|
730
746
|
});
|
|
731
747
|
const dynamic = isDynamicTool(tc.name);
|
|
732
748
|
sendSSE(controller, encoder, {
|
|
733
749
|
type: "tool-input-error",
|
|
734
750
|
toolCallId: tc.id,
|
|
735
|
-
errorText: `Invalid tool arguments: ${
|
|
751
|
+
errorText: `Invalid tool arguments: ${capturedInput.parseError}`,
|
|
736
752
|
...(dynamic ? { dynamic: true } : {}),
|
|
737
753
|
});
|
|
738
|
-
await this.recordToolError(toolCall, `Invalid tool arguments: ${
|
|
754
|
+
await this.recordToolError(toolCall, `Invalid tool arguments: ${capturedInput.parseError}`, controller, encoder, currentMessages, toolCalls);
|
|
739
755
|
continue;
|
|
740
756
|
}
|
|
741
757
|
const policyCheck = enforceSkillPolicy(tc.name, activeSkillPolicy, mustLoadSkillFirst);
|
|
@@ -34,23 +34,27 @@ export declare const ToolCallPartWithArgsSchema: z.ZodObject<{
|
|
|
34
34
|
toolCallId: z.ZodString;
|
|
35
35
|
toolName: z.ZodString;
|
|
36
36
|
args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
37
|
+
inputText: z.ZodOptional<z.ZodString>;
|
|
37
38
|
}, z.core.$strip>;
|
|
38
39
|
export declare const ToolCallPartWithInputSchema: z.ZodObject<{
|
|
39
40
|
type: z.ZodString;
|
|
40
41
|
toolCallId: z.ZodString;
|
|
41
42
|
toolName: z.ZodString;
|
|
42
43
|
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
44
|
+
inputText: z.ZodOptional<z.ZodString>;
|
|
43
45
|
}, z.core.$strip>;
|
|
44
46
|
export declare const ToolCallPartSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
45
47
|
type: z.ZodString;
|
|
46
48
|
toolCallId: z.ZodString;
|
|
47
49
|
toolName: z.ZodString;
|
|
48
50
|
args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
51
|
+
inputText: z.ZodOptional<z.ZodString>;
|
|
49
52
|
}, z.core.$strip>, z.ZodObject<{
|
|
50
53
|
type: z.ZodString;
|
|
51
54
|
toolCallId: z.ZodString;
|
|
52
55
|
toolName: z.ZodString;
|
|
53
56
|
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
57
|
+
inputText: z.ZodOptional<z.ZodString>;
|
|
54
58
|
}, z.core.$strip>]>;
|
|
55
59
|
export declare const ToolResultPartSchema: z.ZodObject<{
|
|
56
60
|
type: z.ZodLiteral<"tool-result">;
|
|
@@ -66,11 +70,13 @@ export declare const MessagePartSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
66
70
|
toolCallId: z.ZodString;
|
|
67
71
|
toolName: z.ZodString;
|
|
68
72
|
args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
73
|
+
inputText: z.ZodOptional<z.ZodString>;
|
|
69
74
|
}, z.core.$strip>, z.ZodObject<{
|
|
70
75
|
type: z.ZodString;
|
|
71
76
|
toolCallId: z.ZodString;
|
|
72
77
|
toolName: z.ZodString;
|
|
73
78
|
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
79
|
+
inputText: z.ZodOptional<z.ZodString>;
|
|
74
80
|
}, z.core.$strip>]>, z.ZodObject<{
|
|
75
81
|
type: z.ZodLiteral<"tool-call">;
|
|
76
82
|
toolCallId: z.ZodString;
|
|
@@ -98,11 +104,13 @@ export declare const MessageSchema: z.ZodObject<{
|
|
|
98
104
|
toolCallId: z.ZodString;
|
|
99
105
|
toolName: z.ZodString;
|
|
100
106
|
args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
107
|
+
inputText: z.ZodOptional<z.ZodString>;
|
|
101
108
|
}, z.core.$strip>, z.ZodObject<{
|
|
102
109
|
type: z.ZodString;
|
|
103
110
|
toolCallId: z.ZodString;
|
|
104
111
|
toolName: z.ZodString;
|
|
105
112
|
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
113
|
+
inputText: z.ZodOptional<z.ZodString>;
|
|
106
114
|
}, z.core.$strip>]>, z.ZodObject<{
|
|
107
115
|
type: z.ZodLiteral<"tool-call">;
|
|
108
116
|
toolCallId: z.ZodString;
|
|
@@ -126,6 +134,7 @@ export declare const ToolCallSchema: z.ZodObject<{
|
|
|
126
134
|
id: z.ZodString;
|
|
127
135
|
name: z.ZodString;
|
|
128
136
|
args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
137
|
+
inputText: z.ZodOptional<z.ZodString>;
|
|
129
138
|
status: z.ZodEnum<{
|
|
130
139
|
error: "error";
|
|
131
140
|
pending: "pending";
|
|
@@ -154,11 +163,13 @@ export declare const AgentResponseSchema: z.ZodObject<{
|
|
|
154
163
|
toolCallId: z.ZodString;
|
|
155
164
|
toolName: z.ZodString;
|
|
156
165
|
args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
166
|
+
inputText: z.ZodOptional<z.ZodString>;
|
|
157
167
|
}, z.core.$strip>, z.ZodObject<{
|
|
158
168
|
type: z.ZodString;
|
|
159
169
|
toolCallId: z.ZodString;
|
|
160
170
|
toolName: z.ZodString;
|
|
161
171
|
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
172
|
+
inputText: z.ZodOptional<z.ZodString>;
|
|
162
173
|
}, z.core.$strip>]>, z.ZodObject<{
|
|
163
174
|
type: z.ZodLiteral<"tool-call">;
|
|
164
175
|
toolCallId: z.ZodString;
|
|
@@ -177,6 +188,7 @@ export declare const AgentResponseSchema: z.ZodObject<{
|
|
|
177
188
|
id: z.ZodString;
|
|
178
189
|
name: z.ZodString;
|
|
179
190
|
args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
191
|
+
inputText: z.ZodOptional<z.ZodString>;
|
|
180
192
|
status: z.ZodEnum<{
|
|
181
193
|
error: "error";
|
|
182
194
|
pending: "pending";
|
|
@@ -222,11 +234,13 @@ export declare const AgentContextSchema: z.ZodObject<{
|
|
|
222
234
|
toolCallId: z.ZodString;
|
|
223
235
|
toolName: z.ZodString;
|
|
224
236
|
args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
237
|
+
inputText: z.ZodOptional<z.ZodString>;
|
|
225
238
|
}, z.core.$strip>, z.ZodObject<{
|
|
226
239
|
type: z.ZodString;
|
|
227
240
|
toolCallId: z.ZodString;
|
|
228
241
|
toolName: z.ZodString;
|
|
229
242
|
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
243
|
+
inputText: z.ZodOptional<z.ZodString>;
|
|
230
244
|
}, z.core.$strip>]>, z.ZodObject<{
|
|
231
245
|
type: z.ZodLiteral<"tool-call">;
|
|
232
246
|
toolCallId: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.schema.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/schemas/agent.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,mBAAmB;;;;;EAAqD,CAAC;AAEtF,eAAO,MAAM,iBAAiB;;;;;;;EAO5B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;iBAI7B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;iBAK3B,CAAC;AAEH,eAAO,MAAM,0BAA0B
|
|
1
|
+
{"version":3,"file":"agent.schema.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/schemas/agent.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,mBAAmB;;;;;EAAqD,CAAC;AAEtF,eAAO,MAAM,iBAAiB;;;;;;;EAO5B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;iBAI7B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;iBAK3B,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;iBAMrC,CAAC;AAEH,eAAO,MAAM,2BAA2B;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CAAC;AAClE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC5D,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AACpD,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AACtD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -24,12 +24,14 @@ export const ToolCallPartWithArgsSchema = z.object({
|
|
|
24
24
|
toolCallId: z.string(),
|
|
25
25
|
toolName: z.string(),
|
|
26
26
|
args: z.record(z.string(), z.unknown()),
|
|
27
|
+
inputText: z.string().optional(),
|
|
27
28
|
});
|
|
28
29
|
export const ToolCallPartWithInputSchema = z.object({
|
|
29
30
|
type: z.string().regex(/^tool-.+$/),
|
|
30
31
|
toolCallId: z.string(),
|
|
31
32
|
toolName: z.string(),
|
|
32
33
|
input: z.record(z.string(), z.unknown()),
|
|
34
|
+
inputText: z.string().optional(),
|
|
33
35
|
});
|
|
34
36
|
export const ToolCallPartSchema = z.union([
|
|
35
37
|
ToolCallPartWithArgsSchema,
|
|
@@ -71,6 +73,7 @@ export const ToolCallSchema = z.object({
|
|
|
71
73
|
id: z.string(),
|
|
72
74
|
name: z.string(),
|
|
73
75
|
args: z.record(z.string(), z.unknown()),
|
|
76
|
+
inputText: z.string().optional(),
|
|
74
77
|
status: z.enum(["pending", "executing", "completed", "error"]),
|
|
75
78
|
result: z.unknown().optional(),
|
|
76
79
|
error: z.string().optional(),
|
package/esm/src/chat/ag-ui.d.ts
CHANGED
|
@@ -180,6 +180,7 @@ export declare const AgUiWireEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
180
180
|
payload: z.ZodObject<{
|
|
181
181
|
messageId: z.ZodOptional<z.ZodString>;
|
|
182
182
|
toolCallId: z.ZodString;
|
|
183
|
+
input: z.ZodOptional<z.ZodUnknown>;
|
|
183
184
|
content: z.ZodOptional<z.ZodUnknown>;
|
|
184
185
|
result: z.ZodOptional<z.ZodUnknown>;
|
|
185
186
|
role: z.ZodOptional<z.ZodLiteral<"tool">>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ag-ui.d.ts","sourceRoot":"","sources":["../../../src/src/chat/ag-ui.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAoB,eAAe,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB,KAAK,aAAa,GAAG;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,eAAe,EAAE,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,YAAY,GAAG,QAAQ,CAAC;AAEhE,MAAM,MAAM,yBAAyB,GAAG;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAA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AO,6BAA6B,CAAC,CAAC;AACpF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC5E,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AA4XhE,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CA+BzD;AAED,wBAAgB,+BAA+B,CAC7C,KAAK,GAAE;IACL,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,yBAAyB,CAAC;IAC3C,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CAChF,GACL,yBAAyB,CAU3B;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,yBAAyB,EAChC,KAAK,EAAE,MAAM,GACZ,gBAAgB,CAuClB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,yBAAyB,GAAG,gBAAgB,CAWpF"}
|
package/esm/src/chat/ag-ui.js
CHANGED
|
@@ -160,6 +160,7 @@ export const AgUiWireEventSchema = z.discriminatedUnion("eventName", [
|
|
|
160
160
|
payload: z.object({
|
|
161
161
|
messageId: z.string().min(1).optional(),
|
|
162
162
|
toolCallId: z.string().min(1),
|
|
163
|
+
input: z.unknown().optional(),
|
|
163
164
|
content: z.unknown().optional(),
|
|
164
165
|
result: z.unknown().optional(),
|
|
165
166
|
role: z.literal("tool").optional(),
|
|
@@ -485,7 +486,7 @@ function mapWireEventToChatEvents(state, wireEvent) {
|
|
|
485
486
|
type: "tool-input-available",
|
|
486
487
|
toolCallId: wireEvent.payload.toolCallId,
|
|
487
488
|
toolName: "tool",
|
|
488
|
-
input: {},
|
|
489
|
+
input: wireEvent.payload.input ?? {},
|
|
489
490
|
dynamic: true,
|
|
490
491
|
providerExecuted: true,
|
|
491
492
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-loader.d.ts","sourceRoot":"","sources":["../../../src/src/provider/runtime-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEjE,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACjC;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACjC;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACjC;
|
|
1
|
+
{"version":3,"file":"runtime-loader.d.ts","sourceRoot":"","sources":["../../../src/src/provider/runtime-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEjE,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACjC;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACjC;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACjC;AAuqDD,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,MAAM,GACd,YAAY,CAkDd;AAED,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,sBAAsB,EAC9B,OAAO,EAAE,MAAM,GACd,YAAY,CA4Dd;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,MAAM,GACd,YAAY,CAkDd;AAED,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,MAAM,GACd,gBAAgB,CA0ClB;AAED,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,MAAM,GACd,gBAAgB,CAgDlB"}
|
|
@@ -171,7 +171,7 @@ function toOpenAICompatibleTools(tools) {
|
|
|
171
171
|
type: "function",
|
|
172
172
|
function: {
|
|
173
173
|
name: tool.name,
|
|
174
|
-
parameters: tool.inputSchema,
|
|
174
|
+
parameters: unwrapToolInputSchema(tool.inputSchema),
|
|
175
175
|
...(typeof tool.description === "string" ? { description: tool.description } : {}),
|
|
176
176
|
},
|
|
177
177
|
}]
|
|
@@ -323,7 +323,7 @@ function toAnthropicTools(tools) {
|
|
|
323
323
|
normalized.push({
|
|
324
324
|
name: tool.name,
|
|
325
325
|
...(typeof tool.description === "string" ? { description: tool.description } : {}),
|
|
326
|
-
input_schema: tool.inputSchema,
|
|
326
|
+
input_schema: unwrapToolInputSchema(tool.inputSchema),
|
|
327
327
|
});
|
|
328
328
|
continue;
|
|
329
329
|
}
|
|
@@ -813,11 +813,18 @@ function toGoogleTools(tools) {
|
|
|
813
813
|
? [{
|
|
814
814
|
name: tool.name,
|
|
815
815
|
...(typeof tool.description === "string" ? { description: tool.description } : {}),
|
|
816
|
-
parameters: tool.inputSchema,
|
|
816
|
+
parameters: unwrapToolInputSchema(tool.inputSchema),
|
|
817
817
|
}]
|
|
818
818
|
: []);
|
|
819
819
|
return functionDeclarations.length > 0 ? [{ functionDeclarations }] : undefined;
|
|
820
820
|
}
|
|
821
|
+
function unwrapToolInputSchema(inputSchema) {
|
|
822
|
+
if (typeof inputSchema !== "object" || inputSchema === null || Array.isArray(inputSchema)) {
|
|
823
|
+
return inputSchema;
|
|
824
|
+
}
|
|
825
|
+
const candidate = Reflect.get(inputSchema, "jsonSchema");
|
|
826
|
+
return candidate ?? inputSchema;
|
|
827
|
+
}
|
|
821
828
|
function normalizeGoogleToolChoice(toolChoice) {
|
|
822
829
|
if (toolChoice === undefined) {
|
|
823
830
|
return undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.
|
|
1
|
+
export declare const VERSION = "0.1.203";
|
|
2
2
|
//# sourceMappingURL=version-constant.d.ts.map
|
package/package.json
CHANGED
package/src/deno.js
CHANGED
|
@@ -361,13 +361,17 @@ export function mapRuntimeStreamEventToAgUiBrowserEvents(
|
|
|
361
361
|
if (typeof event.toolCallId === "string") {
|
|
362
362
|
state.streamedToolInputIds.add(event.toolCallId);
|
|
363
363
|
}
|
|
364
|
-
return [
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
364
|
+
return [
|
|
365
|
+
...closeOpenTextEvent(state),
|
|
366
|
+
...closeOpenReasoningEvent(state),
|
|
367
|
+
{
|
|
368
|
+
event: "ToolCallArgs",
|
|
369
|
+
payload: {
|
|
370
|
+
toolCallId: event.toolCallId,
|
|
371
|
+
delta: typeof event.inputTextDelta === "string" ? event.inputTextDelta : "",
|
|
372
|
+
},
|
|
369
373
|
},
|
|
370
|
-
|
|
374
|
+
];
|
|
371
375
|
|
|
372
376
|
case "tool-input-available": {
|
|
373
377
|
state.sawVisibleOutput = true;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-default `providerOptions` for known providers.
|
|
3
|
+
*
|
|
4
|
+
* Currently: enable Anthropic extended thinking by default for any
|
|
5
|
+
* Anthropic model, since the `reasoning-*` event surface in this framework
|
|
6
|
+
* relies on the provider-side feature being on. Apps can override or opt
|
|
7
|
+
* out by returning their own `providerOptions.anthropic.thinking` from
|
|
8
|
+
* `AgentConfig.resolveModelTransport`.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const VERYFRONT_CLOUD_PREFIX = "veryfront-cloud/";
|
|
12
|
+
const ANTHROPIC_PREFIX = "anthropic/";
|
|
13
|
+
const DEFAULT_ANTHROPIC_THINKING_BUDGET_TOKENS = 2048;
|
|
14
|
+
|
|
15
|
+
function isAnthropicModel(modelString: string): boolean {
|
|
16
|
+
const normalized = modelString.startsWith(VERYFRONT_CLOUD_PREFIX)
|
|
17
|
+
? modelString.slice(VERYFRONT_CLOUD_PREFIX.length)
|
|
18
|
+
: modelString;
|
|
19
|
+
return normalized.startsWith(ANTHROPIC_PREFIX);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function hasAnthropicThinkingConfig(existing: Record<string, unknown> | undefined): boolean {
|
|
23
|
+
if (!existing || typeof existing !== "object") return false;
|
|
24
|
+
const anthropic = (existing as { anthropic?: unknown }).anthropic;
|
|
25
|
+
if (!anthropic || typeof anthropic !== "object") return false;
|
|
26
|
+
return "thinking" in (anthropic as Record<string, unknown>);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function resolveProviderOptionsWithDefaults(
|
|
30
|
+
modelString: string,
|
|
31
|
+
existing: Record<string, unknown> | undefined,
|
|
32
|
+
): Record<string, unknown> | undefined {
|
|
33
|
+
if (!isAnthropicModel(modelString)) {
|
|
34
|
+
return existing;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (hasAnthropicThinkingConfig(existing)) {
|
|
38
|
+
return existing;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const existingAnthropic = (existing?.anthropic ?? {}) as Record<string, unknown>;
|
|
42
|
+
return {
|
|
43
|
+
...(existing ?? {}),
|
|
44
|
+
anthropic: {
|
|
45
|
+
// Defaults first; host-supplied fields (e.g. temperature) override them.
|
|
46
|
+
// Only `thinking` is forced because we already confirmed it isn't set.
|
|
47
|
+
temperature: 1,
|
|
48
|
+
...existingAnthropic,
|
|
49
|
+
thinking: { type: "enabled", budget_tokens: DEFAULT_ANTHROPIC_THINKING_BUDGET_TOKENS },
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -35,10 +35,12 @@ import {
|
|
|
35
35
|
} from "../../observability/tracing/index.js";
|
|
36
36
|
import { convertToModelMessages } from "./model-message-converter.js";
|
|
37
37
|
import { convertToolsToRuntimeTools } from "./model-tool-converter.js";
|
|
38
|
+
import { resolveProviderOptionsWithDefaults } from "./default-provider-options.js";
|
|
38
39
|
import {
|
|
39
40
|
type ChatStreamState,
|
|
40
41
|
createStreamState,
|
|
41
42
|
processStream,
|
|
43
|
+
type StreamingToolCall,
|
|
42
44
|
type StreamingToolResult,
|
|
43
45
|
} from "./chat-stream-handler.js";
|
|
44
46
|
import { repairToolCall } from "./repair-tool-call.js";
|
|
@@ -181,6 +183,21 @@ export function collectGeneratedToolResults(
|
|
|
181
183
|
return generatedToolResults;
|
|
182
184
|
}
|
|
183
185
|
|
|
186
|
+
export function captureStreamedToolCallInput(
|
|
187
|
+
toolCall: Pick<StreamingToolCall, "arguments">,
|
|
188
|
+
): {
|
|
189
|
+
args: Record<string, unknown>;
|
|
190
|
+
inputText?: string;
|
|
191
|
+
parseError?: string;
|
|
192
|
+
} {
|
|
193
|
+
const { args, error } = parseToolArgs(toolCall.arguments);
|
|
194
|
+
return {
|
|
195
|
+
args,
|
|
196
|
+
...(toolCall.arguments.length > 0 ? { inputText: toolCall.arguments } : {}),
|
|
197
|
+
...(error ? { parseError: error } : {}),
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
|
|
184
201
|
function isToolResultPart(part: MessagePart): part is ToolResultPart {
|
|
185
202
|
return part.type === "tool-result" && "result" in part;
|
|
186
203
|
}
|
|
@@ -313,7 +330,10 @@ export class AgentRuntime {
|
|
|
313
330
|
resolvedModelString,
|
|
314
331
|
languageModel: transport?.model ?? resolveModel(resolvedModelString),
|
|
315
332
|
headers: transport?.headers,
|
|
316
|
-
providerOptions:
|
|
333
|
+
providerOptions: resolveProviderOptionsWithDefaults(
|
|
334
|
+
resolvedModelString,
|
|
335
|
+
transport?.providerOptions,
|
|
336
|
+
),
|
|
317
337
|
};
|
|
318
338
|
}
|
|
319
339
|
|
|
@@ -941,18 +961,19 @@ export class AgentRuntime {
|
|
|
941
961
|
if (state.accumulatedText) streamParts.push({ type: "text", text: state.accumulatedText });
|
|
942
962
|
|
|
943
963
|
for (const tc of state.toolCalls.values()) {
|
|
944
|
-
const
|
|
945
|
-
if (
|
|
964
|
+
const capturedInput = captureStreamedToolCallInput(tc);
|
|
965
|
+
if (capturedInput.parseError) {
|
|
946
966
|
logger.warn("Failed to parse streamed tool arguments", {
|
|
947
967
|
toolCallId: tc.id,
|
|
948
|
-
error,
|
|
968
|
+
error: capturedInput.parseError,
|
|
949
969
|
});
|
|
950
970
|
}
|
|
951
971
|
streamParts.push({
|
|
952
972
|
type: `tool-${tc.name}`,
|
|
953
973
|
toolCallId: tc.id,
|
|
954
974
|
toolName: tc.name,
|
|
955
|
-
args,
|
|
975
|
+
args: capturedInput.args,
|
|
976
|
+
...(capturedInput.inputText ? { inputText: capturedInput.inputText } : {}),
|
|
956
977
|
});
|
|
957
978
|
}
|
|
958
979
|
|
|
@@ -1012,8 +1033,14 @@ export class AgentRuntime {
|
|
|
1012
1033
|
|
|
1013
1034
|
for (const tc of streamedToolCalls) {
|
|
1014
1035
|
throwIfAborted(abortSignal);
|
|
1015
|
-
const
|
|
1016
|
-
const toolCall: ToolCall = {
|
|
1036
|
+
const capturedInput = captureStreamedToolCallInput(tc);
|
|
1037
|
+
const toolCall: ToolCall = {
|
|
1038
|
+
id: tc.id,
|
|
1039
|
+
name: tc.name,
|
|
1040
|
+
args: capturedInput.args,
|
|
1041
|
+
...(capturedInput.inputText ? { inputText: capturedInput.inputText } : {}),
|
|
1042
|
+
status: "pending",
|
|
1043
|
+
};
|
|
1017
1044
|
const matchingResult = finalToolResults.get(tc.id);
|
|
1018
1045
|
const persistedResult = currentStepToolResults.get(tc.id);
|
|
1019
1046
|
|
|
@@ -1037,23 +1064,23 @@ export class AgentRuntime {
|
|
|
1037
1064
|
continue;
|
|
1038
1065
|
}
|
|
1039
1066
|
|
|
1040
|
-
if (
|
|
1067
|
+
if (capturedInput.parseError) {
|
|
1041
1068
|
logger.warn("Invalid streamed tool arguments", {
|
|
1042
1069
|
toolCallId: tc.id,
|
|
1043
|
-
error:
|
|
1070
|
+
error: capturedInput.parseError,
|
|
1044
1071
|
});
|
|
1045
1072
|
|
|
1046
1073
|
const dynamic = isDynamicTool(tc.name);
|
|
1047
1074
|
sendSSE(controller, encoder, {
|
|
1048
1075
|
type: "tool-input-error",
|
|
1049
1076
|
toolCallId: tc.id,
|
|
1050
|
-
errorText: `Invalid tool arguments: ${
|
|
1077
|
+
errorText: `Invalid tool arguments: ${capturedInput.parseError}`,
|
|
1051
1078
|
...(dynamic ? { dynamic: true } : {}),
|
|
1052
1079
|
});
|
|
1053
1080
|
|
|
1054
1081
|
await this.recordToolError(
|
|
1055
1082
|
toolCall,
|
|
1056
|
-
`Invalid tool arguments: ${
|
|
1083
|
+
`Invalid tool arguments: ${capturedInput.parseError}`,
|
|
1057
1084
|
controller,
|
|
1058
1085
|
encoder,
|
|
1059
1086
|
currentMessages,
|
|
@@ -29,6 +29,7 @@ export const ToolCallPartWithArgsSchema = z.object({
|
|
|
29
29
|
toolCallId: z.string(),
|
|
30
30
|
toolName: z.string(),
|
|
31
31
|
args: z.record(z.string(), z.unknown()),
|
|
32
|
+
inputText: z.string().optional(),
|
|
32
33
|
});
|
|
33
34
|
|
|
34
35
|
export const ToolCallPartWithInputSchema = z.object({
|
|
@@ -36,6 +37,7 @@ export const ToolCallPartWithInputSchema = z.object({
|
|
|
36
37
|
toolCallId: z.string(),
|
|
37
38
|
toolName: z.string(),
|
|
38
39
|
input: z.record(z.string(), z.unknown()),
|
|
40
|
+
inputText: z.string().optional(),
|
|
39
41
|
});
|
|
40
42
|
|
|
41
43
|
export const ToolCallPartSchema = z.union([
|
|
@@ -83,6 +85,7 @@ export const ToolCallSchema = z.object({
|
|
|
83
85
|
id: z.string(),
|
|
84
86
|
name: z.string(),
|
|
85
87
|
args: z.record(z.string(), z.unknown()),
|
|
88
|
+
inputText: z.string().optional(),
|
|
86
89
|
status: z.enum(["pending", "executing", "completed", "error"]),
|
|
87
90
|
result: z.unknown().optional(),
|
|
88
91
|
error: z.string().optional(),
|
package/src/src/chat/ag-ui.ts
CHANGED
|
@@ -214,6 +214,7 @@ export const AgUiWireEventSchema = z.discriminatedUnion("eventName", [
|
|
|
214
214
|
payload: z.object({
|
|
215
215
|
messageId: z.string().min(1).optional(),
|
|
216
216
|
toolCallId: z.string().min(1),
|
|
217
|
+
input: z.unknown().optional(),
|
|
217
218
|
content: z.unknown().optional(),
|
|
218
219
|
result: z.unknown().optional(),
|
|
219
220
|
role: z.literal("tool").optional(),
|
|
@@ -608,7 +609,7 @@ function mapWireEventToChatEvents(
|
|
|
608
609
|
type: "tool-input-available",
|
|
609
610
|
toolCallId: wireEvent.payload.toolCallId,
|
|
610
611
|
toolName: "tool",
|
|
611
|
-
input: {},
|
|
612
|
+
input: wireEvent.payload.input ?? {},
|
|
612
613
|
dynamic: true,
|
|
613
614
|
providerExecuted: true,
|
|
614
615
|
});
|
|
@@ -412,7 +412,7 @@ function toOpenAICompatibleTools(
|
|
|
412
412
|
type: "function" as const,
|
|
413
413
|
function: {
|
|
414
414
|
name: tool.name,
|
|
415
|
-
parameters: tool.inputSchema,
|
|
415
|
+
parameters: unwrapToolInputSchema(tool.inputSchema),
|
|
416
416
|
...(typeof tool.description === "string" ? { description: tool.description } : {}),
|
|
417
417
|
},
|
|
418
418
|
}]
|
|
@@ -623,7 +623,7 @@ function toAnthropicTools(
|
|
|
623
623
|
normalized.push({
|
|
624
624
|
name: tool.name,
|
|
625
625
|
...(typeof tool.description === "string" ? { description: tool.description } : {}),
|
|
626
|
-
input_schema: tool.inputSchema,
|
|
626
|
+
input_schema: unwrapToolInputSchema(tool.inputSchema),
|
|
627
627
|
});
|
|
628
628
|
continue;
|
|
629
629
|
}
|
|
@@ -1257,7 +1257,7 @@ function toGoogleTools(
|
|
|
1257
1257
|
? [{
|
|
1258
1258
|
name: tool.name,
|
|
1259
1259
|
...(typeof tool.description === "string" ? { description: tool.description } : {}),
|
|
1260
|
-
parameters: tool.inputSchema,
|
|
1260
|
+
parameters: unwrapToolInputSchema(tool.inputSchema),
|
|
1261
1261
|
}]
|
|
1262
1262
|
: []
|
|
1263
1263
|
);
|
|
@@ -1265,6 +1265,15 @@ function toGoogleTools(
|
|
|
1265
1265
|
return functionDeclarations.length > 0 ? [{ functionDeclarations }] : undefined;
|
|
1266
1266
|
}
|
|
1267
1267
|
|
|
1268
|
+
function unwrapToolInputSchema(inputSchema: unknown): unknown {
|
|
1269
|
+
if (typeof inputSchema !== "object" || inputSchema === null || Array.isArray(inputSchema)) {
|
|
1270
|
+
return inputSchema;
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
const candidate = Reflect.get(inputSchema, "jsonSchema");
|
|
1274
|
+
return candidate ?? inputSchema;
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1268
1277
|
function normalizeGoogleToolChoice(toolChoice: unknown):
|
|
1269
1278
|
| GoogleCompatibleRequest["toolConfig"]
|
|
1270
1279
|
| undefined {
|