@orq-ai/node 4.1.0-rc.4 → 4.1.0-rc.7
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/bin/mcp-server.js +25494 -27422
- package/bin/mcp-server.js.map +68 -51
- package/examples/package-lock.json +1 -1
- package/jsr.json +1 -1
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/mcp-server/mcp-server.js +1 -1
- package/mcp-server/server.js +1 -1
- package/models/components/actionreviewedstreamingevent.d.ts +76 -0
- package/models/components/actionreviewedstreamingevent.d.ts.map +1 -0
- package/models/components/actionreviewedstreamingevent.js +127 -0
- package/models/components/actionreviewedstreamingevent.js.map +1 -0
- package/models/components/actionreviewrequestedstreamingevent.d.ts +135 -0
- package/models/components/actionreviewrequestedstreamingevent.d.ts.map +1 -0
- package/models/components/actionreviewrequestedstreamingevent.js +180 -0
- package/models/components/actionreviewrequestedstreamingevent.js.map +1 -0
- package/models/components/agenterroredstreamingevent.d.ts +58 -0
- package/models/components/agenterroredstreamingevent.d.ts.map +1 -0
- package/models/components/agenterroredstreamingevent.js +91 -0
- package/models/components/agenterroredstreamingevent.js.map +1 -0
- package/models/components/agentexecutionstartedstreamingevent.d.ts +62 -0
- package/models/components/agentexecutionstartedstreamingevent.d.ts.map +1 -0
- package/models/components/agentexecutionstartedstreamingevent.js +103 -0
- package/models/components/agentexecutionstartedstreamingevent.js.map +1 -0
- package/models/components/agenthandedoffstreamingevent.d.ts +51 -0
- package/models/components/agenthandedoffstreamingevent.d.ts.map +1 -0
- package/models/components/agenthandedoffstreamingevent.js +96 -0
- package/models/components/agenthandedoffstreamingevent.js.map +1 -0
- package/models/components/agentinactivestreamingevent.d.ts +309 -0
- package/models/components/agentinactivestreamingevent.d.ts.map +1 -0
- package/models/components/agentinactivestreamingevent.js +385 -0
- package/models/components/agentinactivestreamingevent.js.map +1 -0
- package/models/components/agentmessagecreatedstreamingevent.d.ts +141 -0
- package/models/components/agentmessagecreatedstreamingevent.d.ts.map +1 -0
- package/models/components/agentmessagecreatedstreamingevent.js +190 -0
- package/models/components/agentmessagecreatedstreamingevent.js.map +1 -0
- package/models/components/agentstartedstreamingevent.d.ts +382 -0
- package/models/components/agentstartedstreamingevent.d.ts.map +1 -0
- package/models/components/agentstartedstreamingevent.js +441 -0
- package/models/components/agentstartedstreamingevent.js.map +1 -0
- package/models/components/agentthoughtstreamingevent.d.ts +542 -0
- package/models/components/agentthoughtstreamingevent.d.ts.map +1 -0
- package/models/components/agentthoughtstreamingevent.js +626 -0
- package/models/components/agentthoughtstreamingevent.js.map +1 -0
- package/models/components/errorstreamingevent.d.ts +51 -0
- package/models/components/errorstreamingevent.d.ts.map +1 -0
- package/models/components/errorstreamingevent.js +87 -0
- package/models/components/errorstreamingevent.js.map +1 -0
- package/models/components/executionnamedstreamingevent.d.ts +51 -0
- package/models/components/executionnamedstreamingevent.d.ts.map +1 -0
- package/models/components/executionnamedstreamingevent.js +96 -0
- package/models/components/executionnamedstreamingevent.js.map +1 -0
- package/models/components/executionreviewedstreamingevent.d.ts +45 -0
- package/models/components/executionreviewedstreamingevent.d.ts.map +1 -0
- package/models/components/executionreviewedstreamingevent.js +81 -0
- package/models/components/executionreviewedstreamingevent.js.map +1 -0
- package/models/components/executionreviewrequiredstreamingevent.d.ts +45 -0
- package/models/components/executionreviewrequiredstreamingevent.d.ts.map +1 -0
- package/models/components/executionreviewrequiredstreamingevent.js +82 -0
- package/models/components/executionreviewrequiredstreamingevent.js.map +1 -0
- package/models/components/filepart.d.ts +1 -1
- package/models/components/index.d.ts +17 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +17 -0
- package/models/components/index.js.map +1 -1
- package/models/components/invokedeploymentrequest.d.ts +13 -13
- package/models/components/invokedeploymentrequest.d.ts.map +1 -1
- package/models/components/invokedeploymentrequest.js +17 -17
- package/models/components/invokedeploymentrequest.js.map +1 -1
- package/models/components/timeoutstreamingevent.d.ts +49 -0
- package/models/components/timeoutstreamingevent.d.ts.map +1 -0
- package/models/components/timeoutstreamingevent.js +85 -0
- package/models/components/timeoutstreamingevent.js.map +1 -0
- package/models/components/toolexecutionfailedstreamingevent.d.ts +144 -0
- package/models/components/toolexecutionfailedstreamingevent.d.ts.map +1 -0
- package/models/components/toolexecutionfailedstreamingevent.js +223 -0
- package/models/components/toolexecutionfailedstreamingevent.js.map +1 -0
- package/models/components/toolexecutionfinishedstreamingevent.d.ts +129 -0
- package/models/components/toolexecutionfinishedstreamingevent.d.ts.map +1 -0
- package/models/components/toolexecutionfinishedstreamingevent.js +205 -0
- package/models/components/toolexecutionfinishedstreamingevent.js.map +1 -0
- package/models/components/toolexecutionstartedstreamingevent.d.ts +139 -0
- package/models/components/toolexecutionstartedstreamingevent.d.ts.map +1 -0
- package/models/components/toolexecutionstartedstreamingevent.js +217 -0
- package/models/components/toolexecutionstartedstreamingevent.js.map +1 -0
- package/models/components/toolresultpart.d.ts +1 -1
- package/models/operations/createagentrequest.d.ts +3 -0
- package/models/operations/createagentrequest.d.ts.map +1 -1
- package/models/operations/createagentrequest.js.map +1 -1
- package/models/operations/createagentresponserequest.d.ts +4 -137
- package/models/operations/createagentresponserequest.d.ts.map +1 -1
- package/models/operations/createagentresponserequest.js +9 -138
- package/models/operations/createagentresponserequest.js.map +1 -1
- package/models/operations/createbudget.js +2 -2
- package/models/operations/createcontact.js +2 -2
- package/models/operations/createdataset.js +2 -2
- package/models/operations/createdatasetitem.js +8 -8
- package/models/operations/createdatasource.js +2 -2
- package/models/operations/createeval.d.ts +80 -145
- package/models/operations/createeval.d.ts.map +1 -1
- package/models/operations/createeval.js +190 -266
- package/models/operations/createeval.js.map +1 -1
- package/models/operations/createtool.js +12 -12
- package/models/operations/fileget.js +2 -2
- package/models/operations/filelist.js +2 -2
- package/models/operations/fileupload.js +2 -2
- package/models/operations/getalltools.js +12 -12
- package/models/operations/getbudget.js +2 -2
- package/models/operations/getevals.d.ts +14 -79
- package/models/operations/getevals.d.ts.map +1 -1
- package/models/operations/getevals.js +49 -132
- package/models/operations/getevals.js.map +1 -1
- package/models/operations/invokeagent.d.ts +14 -147
- package/models/operations/invokeagent.d.ts.map +1 -1
- package/models/operations/invokeagent.js +19 -148
- package/models/operations/invokeagent.js.map +1 -1
- package/models/operations/listagents.d.ts +3 -0
- package/models/operations/listagents.d.ts.map +1 -1
- package/models/operations/listagents.js.map +1 -1
- package/models/operations/listbudgets.js +2 -2
- package/models/operations/listcontacts.js +2 -2
- package/models/operations/listdatasetdatapoints.js +8 -8
- package/models/operations/listdatasets.js +2 -2
- package/models/operations/listdatasources.js +2 -2
- package/models/operations/listknowledgebases.d.ts +16 -16
- package/models/operations/listknowledgebases.d.ts.map +1 -1
- package/models/operations/listknowledgebases.js +27 -25
- package/models/operations/listknowledgebases.js.map +1 -1
- package/models/operations/retrieveagentrequest.d.ts +3 -0
- package/models/operations/retrieveagentrequest.d.ts.map +1 -1
- package/models/operations/retrieveagentrequest.js.map +1 -1
- package/models/operations/retrievecontact.js +2 -2
- package/models/operations/retrievedatapoint.js +8 -8
- package/models/operations/retrievedataset.js +2 -2
- package/models/operations/retrievedatasource.js +2 -2
- package/models/operations/retrievetool.js +12 -12
- package/models/operations/runagent.d.ts +4 -137
- package/models/operations/runagent.d.ts.map +1 -1
- package/models/operations/runagent.js +17 -145
- package/models/operations/runagent.js.map +1 -1
- package/models/operations/streamagent.d.ts +241 -2491
- package/models/operations/streamagent.d.ts.map +1 -1
- package/models/operations/streamagent.js +172 -2826
- package/models/operations/streamagent.js.map +1 -1
- package/models/operations/streamrunagent.d.ts +889 -3139
- package/models/operations/streamrunagent.d.ts.map +1 -1
- package/models/operations/streamrunagent.js +175 -2825
- package/models/operations/streamrunagent.js.map +1 -1
- package/models/operations/updateagent.d.ts +3 -0
- package/models/operations/updateagent.d.ts.map +1 -1
- package/models/operations/updateagent.js.map +1 -1
- package/models/operations/updatebudget.js +2 -2
- package/models/operations/updatecontact.js +2 -2
- package/models/operations/updatedatapoint.js +8 -8
- package/models/operations/updatedataset.js +2 -2
- package/models/operations/updatedatasource.js +2 -2
- package/models/operations/updateeval.d.ts +14 -79
- package/models/operations/updateeval.d.ts.map +1 -1
- package/models/operations/updateeval.js +51 -134
- package/models/operations/updateeval.js.map +1 -1
- package/models/operations/updatetool.js +14 -14
- package/package.json +1 -1
- package/src/lib/config.ts +3 -3
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +1 -1
- package/src/models/components/actionreviewedstreamingevent.ts +189 -0
- package/src/models/components/actionreviewrequestedstreamingevent.ts +326 -0
- package/src/models/components/agenterroredstreamingevent.ts +142 -0
- package/src/models/components/agentexecutionstartedstreamingevent.ts +145 -0
- package/src/models/components/agenthandedoffstreamingevent.ts +142 -0
- package/src/models/components/agentinactivestreamingevent.ts +857 -0
- package/src/models/components/agentmessagecreatedstreamingevent.ts +396 -0
- package/src/models/components/agentstartedstreamingevent.ts +909 -0
- package/src/models/components/agentthoughtstreamingevent.ts +1419 -0
- package/src/models/components/errorstreamingevent.ts +129 -0
- package/src/models/components/executionnamedstreamingevent.ts +142 -0
- package/src/models/components/executionreviewedstreamingevent.ts +122 -0
- package/src/models/components/executionreviewrequiredstreamingevent.ts +130 -0
- package/src/models/components/filepart.ts +1 -1
- package/src/models/components/index.ts +17 -0
- package/src/models/components/invokedeploymentrequest.ts +32 -27
- package/src/models/components/timeoutstreamingevent.ts +125 -0
- package/src/models/components/toolexecutionfailedstreamingevent.ts +406 -0
- package/src/models/components/toolexecutionfinishedstreamingevent.ts +373 -0
- package/src/models/components/toolexecutionstartedstreamingevent.ts +350 -0
- package/src/models/components/toolresultpart.ts +1 -1
- package/src/models/operations/createagentrequest.ts +3 -0
- package/src/models/operations/createagentresponserequest.ts +20 -321
- package/src/models/operations/createbudget.ts +2 -2
- package/src/models/operations/createcontact.ts +2 -2
- package/src/models/operations/createdataset.ts +2 -2
- package/src/models/operations/createdatasetitem.ts +8 -8
- package/src/models/operations/createdatasource.ts +2 -2
- package/src/models/operations/createeval.ts +318 -615
- package/src/models/operations/createtool.ts +12 -12
- package/src/models/operations/fileget.ts +2 -2
- package/src/models/operations/filelist.ts +2 -2
- package/src/models/operations/fileupload.ts +2 -2
- package/src/models/operations/getalltools.ts +12 -12
- package/src/models/operations/getbudget.ts +2 -2
- package/src/models/operations/getevals.ts +52 -287
- package/src/models/operations/invokeagent.ts +36 -373
- package/src/models/operations/listagents.ts +3 -0
- package/src/models/operations/listbudgets.ts +2 -2
- package/src/models/operations/listcontacts.ts +2 -2
- package/src/models/operations/listdatasetdatapoints.ts +8 -8
- package/src/models/operations/listdatasets.ts +2 -2
- package/src/models/operations/listdatasources.ts +2 -2
- package/src/models/operations/listknowledgebases.ts +82 -102
- package/src/models/operations/retrieveagentrequest.ts +3 -0
- package/src/models/operations/retrievecontact.ts +2 -2
- package/src/models/operations/retrievedatapoint.ts +8 -8
- package/src/models/operations/retrievedataset.ts +2 -2
- package/src/models/operations/retrievedatasource.ts +2 -2
- package/src/models/operations/retrievetool.ts +12 -12
- package/src/models/operations/runagent.ts +17 -365
- package/src/models/operations/streamagent.ts +794 -6985
- package/src/models/operations/streamrunagent.ts +3939 -9983
- package/src/models/operations/updateagent.ts +3 -0
- package/src/models/operations/updatebudget.ts +2 -2
- package/src/models/operations/updatecontact.ts +2 -2
- package/src/models/operations/updatedatapoint.ts +8 -8
- package/src/models/operations/updatedataset.ts +2 -2
- package/src/models/operations/updatedatasource.ts +2 -2
- package/src/models/operations/updateeval.ts +52 -287
- package/src/models/operations/updatetool.ts +14 -14
|
@@ -0,0 +1,857 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
9
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
10
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
|
+
import {
|
|
12
|
+
DataPart,
|
|
13
|
+
DataPart$inboundSchema,
|
|
14
|
+
DataPart$Outbound,
|
|
15
|
+
DataPart$outboundSchema,
|
|
16
|
+
} from "./datapart.js";
|
|
17
|
+
import {
|
|
18
|
+
FilePart,
|
|
19
|
+
FilePart$inboundSchema,
|
|
20
|
+
FilePart$Outbound,
|
|
21
|
+
FilePart$outboundSchema,
|
|
22
|
+
} from "./filepart.js";
|
|
23
|
+
import {
|
|
24
|
+
TextPart,
|
|
25
|
+
TextPart$inboundSchema,
|
|
26
|
+
TextPart$Outbound,
|
|
27
|
+
TextPart$outboundSchema,
|
|
28
|
+
} from "./textpart.js";
|
|
29
|
+
import {
|
|
30
|
+
ToolCallPart,
|
|
31
|
+
ToolCallPart$inboundSchema,
|
|
32
|
+
ToolCallPart$Outbound,
|
|
33
|
+
ToolCallPart$outboundSchema,
|
|
34
|
+
} from "./toolcallpart.js";
|
|
35
|
+
import {
|
|
36
|
+
ToolResultPart,
|
|
37
|
+
ToolResultPart$inboundSchema,
|
|
38
|
+
ToolResultPart$Outbound,
|
|
39
|
+
ToolResultPart$outboundSchema,
|
|
40
|
+
} from "./toolresultpart.js";
|
|
41
|
+
|
|
42
|
+
export const AgentInactiveStreamingEventType = {
|
|
43
|
+
EventAgentsInactive: "event.agents.inactive",
|
|
44
|
+
} as const;
|
|
45
|
+
export type AgentInactiveStreamingEventType = ClosedEnum<
|
|
46
|
+
typeof AgentInactiveStreamingEventType
|
|
47
|
+
>;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Extended A2A message role
|
|
51
|
+
*/
|
|
52
|
+
export const AgentInactiveStreamingEventRole = {
|
|
53
|
+
User: "user",
|
|
54
|
+
Agent: "agent",
|
|
55
|
+
Tool: "tool",
|
|
56
|
+
System: "system",
|
|
57
|
+
} as const;
|
|
58
|
+
/**
|
|
59
|
+
* Extended A2A message role
|
|
60
|
+
*/
|
|
61
|
+
export type AgentInactiveStreamingEventRole = ClosedEnum<
|
|
62
|
+
typeof AgentInactiveStreamingEventRole
|
|
63
|
+
>;
|
|
64
|
+
|
|
65
|
+
export type AgentInactiveStreamingEventParts =
|
|
66
|
+
| (ToolCallPart & { kind: "tool_call" })
|
|
67
|
+
| (TextPart & { kind: "text" })
|
|
68
|
+
| (DataPart & { kind: "data" })
|
|
69
|
+
| (FilePart & { kind: "file" })
|
|
70
|
+
| (ToolResultPart & { kind: "tool_result" });
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Full last message in A2A format (for backwards compatibility)
|
|
74
|
+
*/
|
|
75
|
+
export type LastMessageFull = {
|
|
76
|
+
messageId?: string | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Extended A2A message role
|
|
79
|
+
*/
|
|
80
|
+
role: AgentInactiveStreamingEventRole;
|
|
81
|
+
parts: Array<
|
|
82
|
+
| (ToolCallPart & { kind: "tool_call" })
|
|
83
|
+
| (TextPart & { kind: "text" })
|
|
84
|
+
| (DataPart & { kind: "data" })
|
|
85
|
+
| (FilePart & { kind: "file" })
|
|
86
|
+
| (ToolResultPart & { kind: "tool_result" })
|
|
87
|
+
>;
|
|
88
|
+
metadata?: { [k: string]: any } | undefined;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* The reason why the agent execution became inactive
|
|
93
|
+
*/
|
|
94
|
+
export const FinishReason = {
|
|
95
|
+
Stop: "stop",
|
|
96
|
+
Length: "length",
|
|
97
|
+
ToolCalls: "tool_calls",
|
|
98
|
+
ContentFilter: "content_filter",
|
|
99
|
+
FunctionCall: "function_call",
|
|
100
|
+
MaxIterations: "max_iterations",
|
|
101
|
+
MaxTime: "max_time",
|
|
102
|
+
} as const;
|
|
103
|
+
/**
|
|
104
|
+
* The reason why the agent execution became inactive
|
|
105
|
+
*/
|
|
106
|
+
export type FinishReason = ClosedEnum<typeof FinishReason>;
|
|
107
|
+
|
|
108
|
+
export const AgentInactiveStreamingEventDataType = {
|
|
109
|
+
Function: "function",
|
|
110
|
+
} as const;
|
|
111
|
+
export type AgentInactiveStreamingEventDataType = ClosedEnum<
|
|
112
|
+
typeof AgentInactiveStreamingEventDataType
|
|
113
|
+
>;
|
|
114
|
+
|
|
115
|
+
export type FunctionT = {
|
|
116
|
+
name?: string | undefined;
|
|
117
|
+
arguments?: string | undefined;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export type PendingToolCalls = {
|
|
121
|
+
id: string;
|
|
122
|
+
type: AgentInactiveStreamingEventDataType;
|
|
123
|
+
function: FunctionT;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export type AgentInactiveStreamingEventPromptTokensDetails = {
|
|
127
|
+
cachedTokens?: number | null | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* The number of audio input tokens consumed by the request.
|
|
130
|
+
*/
|
|
131
|
+
audioTokens?: number | null | undefined;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export type AgentInactiveStreamingEventCompletionTokensDetails = {
|
|
135
|
+
reasoningTokens?: number | null | undefined;
|
|
136
|
+
acceptedPredictionTokens?: number | null | undefined;
|
|
137
|
+
rejectedPredictionTokens?: number | null | undefined;
|
|
138
|
+
/**
|
|
139
|
+
* The number of audio output tokens produced by the response.
|
|
140
|
+
*/
|
|
141
|
+
audioTokens?: number | null | undefined;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Token usage from the last agent message
|
|
146
|
+
*/
|
|
147
|
+
export type AgentInactiveStreamingEventUsage = {
|
|
148
|
+
/**
|
|
149
|
+
* Number of tokens in the generated completion.
|
|
150
|
+
*/
|
|
151
|
+
completionTokens?: number | undefined;
|
|
152
|
+
/**
|
|
153
|
+
* Number of tokens in the prompt.
|
|
154
|
+
*/
|
|
155
|
+
promptTokens?: number | undefined;
|
|
156
|
+
/**
|
|
157
|
+
* Total number of tokens used in the request (prompt + completion).
|
|
158
|
+
*/
|
|
159
|
+
totalTokens?: number | undefined;
|
|
160
|
+
promptTokensDetails?:
|
|
161
|
+
| AgentInactiveStreamingEventPromptTokensDetails
|
|
162
|
+
| null
|
|
163
|
+
| undefined;
|
|
164
|
+
completionTokensDetails?:
|
|
165
|
+
| AgentInactiveStreamingEventCompletionTokensDetails
|
|
166
|
+
| null
|
|
167
|
+
| undefined;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
export type AgentInactiveStreamingEventData = {
|
|
171
|
+
lastMessage: string;
|
|
172
|
+
/**
|
|
173
|
+
* Full last message in A2A format (for backwards compatibility)
|
|
174
|
+
*/
|
|
175
|
+
lastMessageFull?: LastMessageFull | undefined;
|
|
176
|
+
/**
|
|
177
|
+
* The reason why the agent execution became inactive
|
|
178
|
+
*/
|
|
179
|
+
finishReason: FinishReason;
|
|
180
|
+
/**
|
|
181
|
+
* Tool calls that are pending user response (for function_call finish reason)
|
|
182
|
+
*/
|
|
183
|
+
pendingToolCalls?: Array<PendingToolCalls> | undefined;
|
|
184
|
+
/**
|
|
185
|
+
* Token usage from the last agent message
|
|
186
|
+
*/
|
|
187
|
+
usage?: AgentInactiveStreamingEventUsage | undefined;
|
|
188
|
+
workflowRunId: string;
|
|
189
|
+
/**
|
|
190
|
+
* ID of the response tracking this execution
|
|
191
|
+
*/
|
|
192
|
+
responseId?: string | undefined;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Emitted when the agent completes processing or pauses for input. Contains the final message, finish reason (stop, tool_calls, max_iterations, etc.), and any pending tool calls awaiting user response.
|
|
197
|
+
*/
|
|
198
|
+
export type AgentInactiveStreamingEvent = {
|
|
199
|
+
type: AgentInactiveStreamingEventType;
|
|
200
|
+
/**
|
|
201
|
+
* ISO timestamp of the event
|
|
202
|
+
*/
|
|
203
|
+
timestamp: string;
|
|
204
|
+
data: AgentInactiveStreamingEventData;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
/** @internal */
|
|
208
|
+
export const AgentInactiveStreamingEventType$inboundSchema: z.ZodNativeEnum<
|
|
209
|
+
typeof AgentInactiveStreamingEventType
|
|
210
|
+
> = z.nativeEnum(AgentInactiveStreamingEventType);
|
|
211
|
+
/** @internal */
|
|
212
|
+
export const AgentInactiveStreamingEventType$outboundSchema: z.ZodNativeEnum<
|
|
213
|
+
typeof AgentInactiveStreamingEventType
|
|
214
|
+
> = AgentInactiveStreamingEventType$inboundSchema;
|
|
215
|
+
|
|
216
|
+
/** @internal */
|
|
217
|
+
export const AgentInactiveStreamingEventRole$inboundSchema: z.ZodNativeEnum<
|
|
218
|
+
typeof AgentInactiveStreamingEventRole
|
|
219
|
+
> = z.nativeEnum(AgentInactiveStreamingEventRole);
|
|
220
|
+
/** @internal */
|
|
221
|
+
export const AgentInactiveStreamingEventRole$outboundSchema: z.ZodNativeEnum<
|
|
222
|
+
typeof AgentInactiveStreamingEventRole
|
|
223
|
+
> = AgentInactiveStreamingEventRole$inboundSchema;
|
|
224
|
+
|
|
225
|
+
/** @internal */
|
|
226
|
+
export const AgentInactiveStreamingEventParts$inboundSchema: z.ZodType<
|
|
227
|
+
AgentInactiveStreamingEventParts,
|
|
228
|
+
z.ZodTypeDef,
|
|
229
|
+
unknown
|
|
230
|
+
> = z.union([
|
|
231
|
+
ToolCallPart$inboundSchema.and(
|
|
232
|
+
z.object({ kind: z.literal("tool_call") }).transform((v) => ({
|
|
233
|
+
kind: v.kind,
|
|
234
|
+
})),
|
|
235
|
+
),
|
|
236
|
+
TextPart$inboundSchema.and(
|
|
237
|
+
z.object({ kind: z.literal("text") }).transform((v) => ({ kind: v.kind })),
|
|
238
|
+
),
|
|
239
|
+
DataPart$inboundSchema.and(
|
|
240
|
+
z.object({ kind: z.literal("data") }).transform((v) => ({ kind: v.kind })),
|
|
241
|
+
),
|
|
242
|
+
FilePart$inboundSchema.and(
|
|
243
|
+
z.object({ kind: z.literal("file") }).transform((v) => ({ kind: v.kind })),
|
|
244
|
+
),
|
|
245
|
+
ToolResultPart$inboundSchema.and(
|
|
246
|
+
z.object({ kind: z.literal("tool_result") }).transform((v) => ({
|
|
247
|
+
kind: v.kind,
|
|
248
|
+
})),
|
|
249
|
+
),
|
|
250
|
+
]);
|
|
251
|
+
/** @internal */
|
|
252
|
+
export type AgentInactiveStreamingEventParts$Outbound =
|
|
253
|
+
| (ToolCallPart$Outbound & { kind: "tool_call" })
|
|
254
|
+
| (TextPart$Outbound & { kind: "text" })
|
|
255
|
+
| (DataPart$Outbound & { kind: "data" })
|
|
256
|
+
| (FilePart$Outbound & { kind: "file" })
|
|
257
|
+
| (ToolResultPart$Outbound & { kind: "tool_result" });
|
|
258
|
+
|
|
259
|
+
/** @internal */
|
|
260
|
+
export const AgentInactiveStreamingEventParts$outboundSchema: z.ZodType<
|
|
261
|
+
AgentInactiveStreamingEventParts$Outbound,
|
|
262
|
+
z.ZodTypeDef,
|
|
263
|
+
AgentInactiveStreamingEventParts
|
|
264
|
+
> = z.union([
|
|
265
|
+
ToolCallPart$outboundSchema.and(
|
|
266
|
+
z.object({ kind: z.literal("tool_call") }).transform((v) => ({
|
|
267
|
+
kind: v.kind,
|
|
268
|
+
})),
|
|
269
|
+
),
|
|
270
|
+
TextPart$outboundSchema.and(
|
|
271
|
+
z.object({ kind: z.literal("text") }).transform((v) => ({ kind: v.kind })),
|
|
272
|
+
),
|
|
273
|
+
DataPart$outboundSchema.and(
|
|
274
|
+
z.object({ kind: z.literal("data") }).transform((v) => ({ kind: v.kind })),
|
|
275
|
+
),
|
|
276
|
+
FilePart$outboundSchema.and(
|
|
277
|
+
z.object({ kind: z.literal("file") }).transform((v) => ({ kind: v.kind })),
|
|
278
|
+
),
|
|
279
|
+
ToolResultPart$outboundSchema.and(
|
|
280
|
+
z.object({ kind: z.literal("tool_result") }).transform((v) => ({
|
|
281
|
+
kind: v.kind,
|
|
282
|
+
})),
|
|
283
|
+
),
|
|
284
|
+
]);
|
|
285
|
+
|
|
286
|
+
export function agentInactiveStreamingEventPartsToJSON(
|
|
287
|
+
agentInactiveStreamingEventParts: AgentInactiveStreamingEventParts,
|
|
288
|
+
): string {
|
|
289
|
+
return JSON.stringify(
|
|
290
|
+
AgentInactiveStreamingEventParts$outboundSchema.parse(
|
|
291
|
+
agentInactiveStreamingEventParts,
|
|
292
|
+
),
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
export function agentInactiveStreamingEventPartsFromJSON(
|
|
296
|
+
jsonString: string,
|
|
297
|
+
): SafeParseResult<AgentInactiveStreamingEventParts, SDKValidationError> {
|
|
298
|
+
return safeParse(
|
|
299
|
+
jsonString,
|
|
300
|
+
(x) => AgentInactiveStreamingEventParts$inboundSchema.parse(JSON.parse(x)),
|
|
301
|
+
`Failed to parse 'AgentInactiveStreamingEventParts' from JSON`,
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/** @internal */
|
|
306
|
+
export const LastMessageFull$inboundSchema: z.ZodType<
|
|
307
|
+
LastMessageFull,
|
|
308
|
+
z.ZodTypeDef,
|
|
309
|
+
unknown
|
|
310
|
+
> = z.object({
|
|
311
|
+
messageId: z.string().optional(),
|
|
312
|
+
role: AgentInactiveStreamingEventRole$inboundSchema,
|
|
313
|
+
parts: z.array(
|
|
314
|
+
z.union([
|
|
315
|
+
ToolCallPart$inboundSchema.and(
|
|
316
|
+
z.object({ kind: z.literal("tool_call") }).transform((v) => ({
|
|
317
|
+
kind: v.kind,
|
|
318
|
+
})),
|
|
319
|
+
),
|
|
320
|
+
TextPart$inboundSchema.and(
|
|
321
|
+
z.object({ kind: z.literal("text") }).transform((v) => ({
|
|
322
|
+
kind: v.kind,
|
|
323
|
+
})),
|
|
324
|
+
),
|
|
325
|
+
DataPart$inboundSchema.and(
|
|
326
|
+
z.object({ kind: z.literal("data") }).transform((v) => ({
|
|
327
|
+
kind: v.kind,
|
|
328
|
+
})),
|
|
329
|
+
),
|
|
330
|
+
FilePart$inboundSchema.and(
|
|
331
|
+
z.object({ kind: z.literal("file") }).transform((v) => ({
|
|
332
|
+
kind: v.kind,
|
|
333
|
+
})),
|
|
334
|
+
),
|
|
335
|
+
ToolResultPart$inboundSchema.and(
|
|
336
|
+
z.object({ kind: z.literal("tool_result") }).transform((v) => ({
|
|
337
|
+
kind: v.kind,
|
|
338
|
+
})),
|
|
339
|
+
),
|
|
340
|
+
]),
|
|
341
|
+
),
|
|
342
|
+
metadata: z.record(z.any()).optional(),
|
|
343
|
+
});
|
|
344
|
+
/** @internal */
|
|
345
|
+
export type LastMessageFull$Outbound = {
|
|
346
|
+
messageId?: string | undefined;
|
|
347
|
+
role: string;
|
|
348
|
+
parts: Array<
|
|
349
|
+
| (ToolCallPart$Outbound & { kind: "tool_call" })
|
|
350
|
+
| (TextPart$Outbound & { kind: "text" })
|
|
351
|
+
| (DataPart$Outbound & { kind: "data" })
|
|
352
|
+
| (FilePart$Outbound & { kind: "file" })
|
|
353
|
+
| (ToolResultPart$Outbound & { kind: "tool_result" })
|
|
354
|
+
>;
|
|
355
|
+
metadata?: { [k: string]: any } | undefined;
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
/** @internal */
|
|
359
|
+
export const LastMessageFull$outboundSchema: z.ZodType<
|
|
360
|
+
LastMessageFull$Outbound,
|
|
361
|
+
z.ZodTypeDef,
|
|
362
|
+
LastMessageFull
|
|
363
|
+
> = z.object({
|
|
364
|
+
messageId: z.string().optional(),
|
|
365
|
+
role: AgentInactiveStreamingEventRole$outboundSchema,
|
|
366
|
+
parts: z.array(
|
|
367
|
+
z.union([
|
|
368
|
+
ToolCallPart$outboundSchema.and(
|
|
369
|
+
z.object({ kind: z.literal("tool_call") }).transform((v) => ({
|
|
370
|
+
kind: v.kind,
|
|
371
|
+
})),
|
|
372
|
+
),
|
|
373
|
+
TextPart$outboundSchema.and(
|
|
374
|
+
z.object({ kind: z.literal("text") }).transform((v) => ({
|
|
375
|
+
kind: v.kind,
|
|
376
|
+
})),
|
|
377
|
+
),
|
|
378
|
+
DataPart$outboundSchema.and(
|
|
379
|
+
z.object({ kind: z.literal("data") }).transform((v) => ({
|
|
380
|
+
kind: v.kind,
|
|
381
|
+
})),
|
|
382
|
+
),
|
|
383
|
+
FilePart$outboundSchema.and(
|
|
384
|
+
z.object({ kind: z.literal("file") }).transform((v) => ({
|
|
385
|
+
kind: v.kind,
|
|
386
|
+
})),
|
|
387
|
+
),
|
|
388
|
+
ToolResultPart$outboundSchema.and(
|
|
389
|
+
z.object({ kind: z.literal("tool_result") }).transform((v) => ({
|
|
390
|
+
kind: v.kind,
|
|
391
|
+
})),
|
|
392
|
+
),
|
|
393
|
+
]),
|
|
394
|
+
),
|
|
395
|
+
metadata: z.record(z.any()).optional(),
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
export function lastMessageFullToJSON(
|
|
399
|
+
lastMessageFull: LastMessageFull,
|
|
400
|
+
): string {
|
|
401
|
+
return JSON.stringify(LastMessageFull$outboundSchema.parse(lastMessageFull));
|
|
402
|
+
}
|
|
403
|
+
export function lastMessageFullFromJSON(
|
|
404
|
+
jsonString: string,
|
|
405
|
+
): SafeParseResult<LastMessageFull, SDKValidationError> {
|
|
406
|
+
return safeParse(
|
|
407
|
+
jsonString,
|
|
408
|
+
(x) => LastMessageFull$inboundSchema.parse(JSON.parse(x)),
|
|
409
|
+
`Failed to parse 'LastMessageFull' from JSON`,
|
|
410
|
+
);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/** @internal */
|
|
414
|
+
export const FinishReason$inboundSchema: z.ZodNativeEnum<typeof FinishReason> =
|
|
415
|
+
z.nativeEnum(FinishReason);
|
|
416
|
+
/** @internal */
|
|
417
|
+
export const FinishReason$outboundSchema: z.ZodNativeEnum<typeof FinishReason> =
|
|
418
|
+
FinishReason$inboundSchema;
|
|
419
|
+
|
|
420
|
+
/** @internal */
|
|
421
|
+
export const AgentInactiveStreamingEventDataType$inboundSchema: z.ZodNativeEnum<
|
|
422
|
+
typeof AgentInactiveStreamingEventDataType
|
|
423
|
+
> = z.nativeEnum(AgentInactiveStreamingEventDataType);
|
|
424
|
+
/** @internal */
|
|
425
|
+
export const AgentInactiveStreamingEventDataType$outboundSchema:
|
|
426
|
+
z.ZodNativeEnum<typeof AgentInactiveStreamingEventDataType> =
|
|
427
|
+
AgentInactiveStreamingEventDataType$inboundSchema;
|
|
428
|
+
|
|
429
|
+
/** @internal */
|
|
430
|
+
export const FunctionT$inboundSchema: z.ZodType<
|
|
431
|
+
FunctionT,
|
|
432
|
+
z.ZodTypeDef,
|
|
433
|
+
unknown
|
|
434
|
+
> = z.object({
|
|
435
|
+
name: z.string().optional(),
|
|
436
|
+
arguments: z.string().optional(),
|
|
437
|
+
});
|
|
438
|
+
/** @internal */
|
|
439
|
+
export type FunctionT$Outbound = {
|
|
440
|
+
name?: string | undefined;
|
|
441
|
+
arguments?: string | undefined;
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
/** @internal */
|
|
445
|
+
export const FunctionT$outboundSchema: z.ZodType<
|
|
446
|
+
FunctionT$Outbound,
|
|
447
|
+
z.ZodTypeDef,
|
|
448
|
+
FunctionT
|
|
449
|
+
> = z.object({
|
|
450
|
+
name: z.string().optional(),
|
|
451
|
+
arguments: z.string().optional(),
|
|
452
|
+
});
|
|
453
|
+
|
|
454
|
+
export function functionToJSON(functionT: FunctionT): string {
|
|
455
|
+
return JSON.stringify(FunctionT$outboundSchema.parse(functionT));
|
|
456
|
+
}
|
|
457
|
+
export function functionFromJSON(
|
|
458
|
+
jsonString: string,
|
|
459
|
+
): SafeParseResult<FunctionT, SDKValidationError> {
|
|
460
|
+
return safeParse(
|
|
461
|
+
jsonString,
|
|
462
|
+
(x) => FunctionT$inboundSchema.parse(JSON.parse(x)),
|
|
463
|
+
`Failed to parse 'FunctionT' from JSON`,
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/** @internal */
|
|
468
|
+
export const PendingToolCalls$inboundSchema: z.ZodType<
|
|
469
|
+
PendingToolCalls,
|
|
470
|
+
z.ZodTypeDef,
|
|
471
|
+
unknown
|
|
472
|
+
> = z.object({
|
|
473
|
+
id: z.string(),
|
|
474
|
+
type: AgentInactiveStreamingEventDataType$inboundSchema,
|
|
475
|
+
function: z.lazy(() => FunctionT$inboundSchema),
|
|
476
|
+
});
|
|
477
|
+
/** @internal */
|
|
478
|
+
export type PendingToolCalls$Outbound = {
|
|
479
|
+
id: string;
|
|
480
|
+
type: string;
|
|
481
|
+
function: FunctionT$Outbound;
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
/** @internal */
|
|
485
|
+
export const PendingToolCalls$outboundSchema: z.ZodType<
|
|
486
|
+
PendingToolCalls$Outbound,
|
|
487
|
+
z.ZodTypeDef,
|
|
488
|
+
PendingToolCalls
|
|
489
|
+
> = z.object({
|
|
490
|
+
id: z.string(),
|
|
491
|
+
type: AgentInactiveStreamingEventDataType$outboundSchema,
|
|
492
|
+
function: z.lazy(() => FunctionT$outboundSchema),
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
export function pendingToolCallsToJSON(
|
|
496
|
+
pendingToolCalls: PendingToolCalls,
|
|
497
|
+
): string {
|
|
498
|
+
return JSON.stringify(
|
|
499
|
+
PendingToolCalls$outboundSchema.parse(pendingToolCalls),
|
|
500
|
+
);
|
|
501
|
+
}
|
|
502
|
+
export function pendingToolCallsFromJSON(
|
|
503
|
+
jsonString: string,
|
|
504
|
+
): SafeParseResult<PendingToolCalls, SDKValidationError> {
|
|
505
|
+
return safeParse(
|
|
506
|
+
jsonString,
|
|
507
|
+
(x) => PendingToolCalls$inboundSchema.parse(JSON.parse(x)),
|
|
508
|
+
`Failed to parse 'PendingToolCalls' from JSON`,
|
|
509
|
+
);
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
/** @internal */
|
|
513
|
+
export const AgentInactiveStreamingEventPromptTokensDetails$inboundSchema:
|
|
514
|
+
z.ZodType<
|
|
515
|
+
AgentInactiveStreamingEventPromptTokensDetails,
|
|
516
|
+
z.ZodTypeDef,
|
|
517
|
+
unknown
|
|
518
|
+
> = z.object({
|
|
519
|
+
cached_tokens: z.nullable(z.number().int()).optional(),
|
|
520
|
+
audio_tokens: z.nullable(z.number().int()).optional(),
|
|
521
|
+
}).transform((v) => {
|
|
522
|
+
return remap$(v, {
|
|
523
|
+
"cached_tokens": "cachedTokens",
|
|
524
|
+
"audio_tokens": "audioTokens",
|
|
525
|
+
});
|
|
526
|
+
});
|
|
527
|
+
/** @internal */
|
|
528
|
+
export type AgentInactiveStreamingEventPromptTokensDetails$Outbound = {
|
|
529
|
+
cached_tokens?: number | null | undefined;
|
|
530
|
+
audio_tokens?: number | null | undefined;
|
|
531
|
+
};
|
|
532
|
+
|
|
533
|
+
/** @internal */
|
|
534
|
+
export const AgentInactiveStreamingEventPromptTokensDetails$outboundSchema:
|
|
535
|
+
z.ZodType<
|
|
536
|
+
AgentInactiveStreamingEventPromptTokensDetails$Outbound,
|
|
537
|
+
z.ZodTypeDef,
|
|
538
|
+
AgentInactiveStreamingEventPromptTokensDetails
|
|
539
|
+
> = z.object({
|
|
540
|
+
cachedTokens: z.nullable(z.number().int()).optional(),
|
|
541
|
+
audioTokens: z.nullable(z.number().int()).optional(),
|
|
542
|
+
}).transform((v) => {
|
|
543
|
+
return remap$(v, {
|
|
544
|
+
cachedTokens: "cached_tokens",
|
|
545
|
+
audioTokens: "audio_tokens",
|
|
546
|
+
});
|
|
547
|
+
});
|
|
548
|
+
|
|
549
|
+
export function agentInactiveStreamingEventPromptTokensDetailsToJSON(
|
|
550
|
+
agentInactiveStreamingEventPromptTokensDetails:
|
|
551
|
+
AgentInactiveStreamingEventPromptTokensDetails,
|
|
552
|
+
): string {
|
|
553
|
+
return JSON.stringify(
|
|
554
|
+
AgentInactiveStreamingEventPromptTokensDetails$outboundSchema.parse(
|
|
555
|
+
agentInactiveStreamingEventPromptTokensDetails,
|
|
556
|
+
),
|
|
557
|
+
);
|
|
558
|
+
}
|
|
559
|
+
export function agentInactiveStreamingEventPromptTokensDetailsFromJSON(
|
|
560
|
+
jsonString: string,
|
|
561
|
+
): SafeParseResult<
|
|
562
|
+
AgentInactiveStreamingEventPromptTokensDetails,
|
|
563
|
+
SDKValidationError
|
|
564
|
+
> {
|
|
565
|
+
return safeParse(
|
|
566
|
+
jsonString,
|
|
567
|
+
(x) =>
|
|
568
|
+
AgentInactiveStreamingEventPromptTokensDetails$inboundSchema.parse(
|
|
569
|
+
JSON.parse(x),
|
|
570
|
+
),
|
|
571
|
+
`Failed to parse 'AgentInactiveStreamingEventPromptTokensDetails' from JSON`,
|
|
572
|
+
);
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/** @internal */
|
|
576
|
+
export const AgentInactiveStreamingEventCompletionTokensDetails$inboundSchema:
|
|
577
|
+
z.ZodType<
|
|
578
|
+
AgentInactiveStreamingEventCompletionTokensDetails,
|
|
579
|
+
z.ZodTypeDef,
|
|
580
|
+
unknown
|
|
581
|
+
> = z.object({
|
|
582
|
+
reasoning_tokens: z.nullable(z.number()).optional(),
|
|
583
|
+
accepted_prediction_tokens: z.nullable(z.number()).optional(),
|
|
584
|
+
rejected_prediction_tokens: z.nullable(z.number()).optional(),
|
|
585
|
+
audio_tokens: z.nullable(z.number().int()).optional(),
|
|
586
|
+
}).transform((v) => {
|
|
587
|
+
return remap$(v, {
|
|
588
|
+
"reasoning_tokens": "reasoningTokens",
|
|
589
|
+
"accepted_prediction_tokens": "acceptedPredictionTokens",
|
|
590
|
+
"rejected_prediction_tokens": "rejectedPredictionTokens",
|
|
591
|
+
"audio_tokens": "audioTokens",
|
|
592
|
+
});
|
|
593
|
+
});
|
|
594
|
+
/** @internal */
|
|
595
|
+
export type AgentInactiveStreamingEventCompletionTokensDetails$Outbound = {
|
|
596
|
+
reasoning_tokens?: number | null | undefined;
|
|
597
|
+
accepted_prediction_tokens?: number | null | undefined;
|
|
598
|
+
rejected_prediction_tokens?: number | null | undefined;
|
|
599
|
+
audio_tokens?: number | null | undefined;
|
|
600
|
+
};
|
|
601
|
+
|
|
602
|
+
/** @internal */
|
|
603
|
+
export const AgentInactiveStreamingEventCompletionTokensDetails$outboundSchema:
|
|
604
|
+
z.ZodType<
|
|
605
|
+
AgentInactiveStreamingEventCompletionTokensDetails$Outbound,
|
|
606
|
+
z.ZodTypeDef,
|
|
607
|
+
AgentInactiveStreamingEventCompletionTokensDetails
|
|
608
|
+
> = z.object({
|
|
609
|
+
reasoningTokens: z.nullable(z.number()).optional(),
|
|
610
|
+
acceptedPredictionTokens: z.nullable(z.number()).optional(),
|
|
611
|
+
rejectedPredictionTokens: z.nullable(z.number()).optional(),
|
|
612
|
+
audioTokens: z.nullable(z.number().int()).optional(),
|
|
613
|
+
}).transform((v) => {
|
|
614
|
+
return remap$(v, {
|
|
615
|
+
reasoningTokens: "reasoning_tokens",
|
|
616
|
+
acceptedPredictionTokens: "accepted_prediction_tokens",
|
|
617
|
+
rejectedPredictionTokens: "rejected_prediction_tokens",
|
|
618
|
+
audioTokens: "audio_tokens",
|
|
619
|
+
});
|
|
620
|
+
});
|
|
621
|
+
|
|
622
|
+
export function agentInactiveStreamingEventCompletionTokensDetailsToJSON(
|
|
623
|
+
agentInactiveStreamingEventCompletionTokensDetails:
|
|
624
|
+
AgentInactiveStreamingEventCompletionTokensDetails,
|
|
625
|
+
): string {
|
|
626
|
+
return JSON.stringify(
|
|
627
|
+
AgentInactiveStreamingEventCompletionTokensDetails$outboundSchema.parse(
|
|
628
|
+
agentInactiveStreamingEventCompletionTokensDetails,
|
|
629
|
+
),
|
|
630
|
+
);
|
|
631
|
+
}
|
|
632
|
+
export function agentInactiveStreamingEventCompletionTokensDetailsFromJSON(
|
|
633
|
+
jsonString: string,
|
|
634
|
+
): SafeParseResult<
|
|
635
|
+
AgentInactiveStreamingEventCompletionTokensDetails,
|
|
636
|
+
SDKValidationError
|
|
637
|
+
> {
|
|
638
|
+
return safeParse(
|
|
639
|
+
jsonString,
|
|
640
|
+
(x) =>
|
|
641
|
+
AgentInactiveStreamingEventCompletionTokensDetails$inboundSchema.parse(
|
|
642
|
+
JSON.parse(x),
|
|
643
|
+
),
|
|
644
|
+
`Failed to parse 'AgentInactiveStreamingEventCompletionTokensDetails' from JSON`,
|
|
645
|
+
);
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
/** @internal */
|
|
649
|
+
export const AgentInactiveStreamingEventUsage$inboundSchema: z.ZodType<
|
|
650
|
+
AgentInactiveStreamingEventUsage,
|
|
651
|
+
z.ZodTypeDef,
|
|
652
|
+
unknown
|
|
653
|
+
> = z.object({
|
|
654
|
+
completion_tokens: z.number().optional(),
|
|
655
|
+
prompt_tokens: z.number().optional(),
|
|
656
|
+
total_tokens: z.number().optional(),
|
|
657
|
+
prompt_tokens_details: z.nullable(
|
|
658
|
+
z.lazy(() => AgentInactiveStreamingEventPromptTokensDetails$inboundSchema),
|
|
659
|
+
).optional(),
|
|
660
|
+
completion_tokens_details: z.nullable(
|
|
661
|
+
z.lazy(() =>
|
|
662
|
+
AgentInactiveStreamingEventCompletionTokensDetails$inboundSchema
|
|
663
|
+
),
|
|
664
|
+
).optional(),
|
|
665
|
+
}).transform((v) => {
|
|
666
|
+
return remap$(v, {
|
|
667
|
+
"completion_tokens": "completionTokens",
|
|
668
|
+
"prompt_tokens": "promptTokens",
|
|
669
|
+
"total_tokens": "totalTokens",
|
|
670
|
+
"prompt_tokens_details": "promptTokensDetails",
|
|
671
|
+
"completion_tokens_details": "completionTokensDetails",
|
|
672
|
+
});
|
|
673
|
+
});
|
|
674
|
+
/** @internal */
|
|
675
|
+
export type AgentInactiveStreamingEventUsage$Outbound = {
|
|
676
|
+
completion_tokens?: number | undefined;
|
|
677
|
+
prompt_tokens?: number | undefined;
|
|
678
|
+
total_tokens?: number | undefined;
|
|
679
|
+
prompt_tokens_details?:
|
|
680
|
+
| AgentInactiveStreamingEventPromptTokensDetails$Outbound
|
|
681
|
+
| null
|
|
682
|
+
| undefined;
|
|
683
|
+
completion_tokens_details?:
|
|
684
|
+
| AgentInactiveStreamingEventCompletionTokensDetails$Outbound
|
|
685
|
+
| null
|
|
686
|
+
| undefined;
|
|
687
|
+
};
|
|
688
|
+
|
|
689
|
+
/** @internal */
|
|
690
|
+
export const AgentInactiveStreamingEventUsage$outboundSchema: z.ZodType<
|
|
691
|
+
AgentInactiveStreamingEventUsage$Outbound,
|
|
692
|
+
z.ZodTypeDef,
|
|
693
|
+
AgentInactiveStreamingEventUsage
|
|
694
|
+
> = z.object({
|
|
695
|
+
completionTokens: z.number().optional(),
|
|
696
|
+
promptTokens: z.number().optional(),
|
|
697
|
+
totalTokens: z.number().optional(),
|
|
698
|
+
promptTokensDetails: z.nullable(
|
|
699
|
+
z.lazy(() => AgentInactiveStreamingEventPromptTokensDetails$outboundSchema),
|
|
700
|
+
).optional(),
|
|
701
|
+
completionTokensDetails: z.nullable(
|
|
702
|
+
z.lazy(() =>
|
|
703
|
+
AgentInactiveStreamingEventCompletionTokensDetails$outboundSchema
|
|
704
|
+
),
|
|
705
|
+
).optional(),
|
|
706
|
+
}).transform((v) => {
|
|
707
|
+
return remap$(v, {
|
|
708
|
+
completionTokens: "completion_tokens",
|
|
709
|
+
promptTokens: "prompt_tokens",
|
|
710
|
+
totalTokens: "total_tokens",
|
|
711
|
+
promptTokensDetails: "prompt_tokens_details",
|
|
712
|
+
completionTokensDetails: "completion_tokens_details",
|
|
713
|
+
});
|
|
714
|
+
});
|
|
715
|
+
|
|
716
|
+
export function agentInactiveStreamingEventUsageToJSON(
|
|
717
|
+
agentInactiveStreamingEventUsage: AgentInactiveStreamingEventUsage,
|
|
718
|
+
): string {
|
|
719
|
+
return JSON.stringify(
|
|
720
|
+
AgentInactiveStreamingEventUsage$outboundSchema.parse(
|
|
721
|
+
agentInactiveStreamingEventUsage,
|
|
722
|
+
),
|
|
723
|
+
);
|
|
724
|
+
}
|
|
725
|
+
export function agentInactiveStreamingEventUsageFromJSON(
|
|
726
|
+
jsonString: string,
|
|
727
|
+
): SafeParseResult<AgentInactiveStreamingEventUsage, SDKValidationError> {
|
|
728
|
+
return safeParse(
|
|
729
|
+
jsonString,
|
|
730
|
+
(x) => AgentInactiveStreamingEventUsage$inboundSchema.parse(JSON.parse(x)),
|
|
731
|
+
`Failed to parse 'AgentInactiveStreamingEventUsage' from JSON`,
|
|
732
|
+
);
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
/** @internal */
|
|
736
|
+
export const AgentInactiveStreamingEventData$inboundSchema: z.ZodType<
|
|
737
|
+
AgentInactiveStreamingEventData,
|
|
738
|
+
z.ZodTypeDef,
|
|
739
|
+
unknown
|
|
740
|
+
> = z.object({
|
|
741
|
+
last_message: z.string(),
|
|
742
|
+
last_message_full: z.lazy(() => LastMessageFull$inboundSchema).optional(),
|
|
743
|
+
finish_reason: FinishReason$inboundSchema,
|
|
744
|
+
pending_tool_calls: z.array(z.lazy(() => PendingToolCalls$inboundSchema))
|
|
745
|
+
.optional(),
|
|
746
|
+
usage: z.lazy(() => AgentInactiveStreamingEventUsage$inboundSchema)
|
|
747
|
+
.optional(),
|
|
748
|
+
workflowRunId: z.string(),
|
|
749
|
+
responseId: z.string().optional(),
|
|
750
|
+
}).transform((v) => {
|
|
751
|
+
return remap$(v, {
|
|
752
|
+
"last_message": "lastMessage",
|
|
753
|
+
"last_message_full": "lastMessageFull",
|
|
754
|
+
"finish_reason": "finishReason",
|
|
755
|
+
"pending_tool_calls": "pendingToolCalls",
|
|
756
|
+
});
|
|
757
|
+
});
|
|
758
|
+
/** @internal */
|
|
759
|
+
export type AgentInactiveStreamingEventData$Outbound = {
|
|
760
|
+
last_message: string;
|
|
761
|
+
last_message_full?: LastMessageFull$Outbound | undefined;
|
|
762
|
+
finish_reason: string;
|
|
763
|
+
pending_tool_calls?: Array<PendingToolCalls$Outbound> | undefined;
|
|
764
|
+
usage?: AgentInactiveStreamingEventUsage$Outbound | undefined;
|
|
765
|
+
workflowRunId: string;
|
|
766
|
+
responseId?: string | undefined;
|
|
767
|
+
};
|
|
768
|
+
|
|
769
|
+
/** @internal */
|
|
770
|
+
export const AgentInactiveStreamingEventData$outboundSchema: z.ZodType<
|
|
771
|
+
AgentInactiveStreamingEventData$Outbound,
|
|
772
|
+
z.ZodTypeDef,
|
|
773
|
+
AgentInactiveStreamingEventData
|
|
774
|
+
> = z.object({
|
|
775
|
+
lastMessage: z.string(),
|
|
776
|
+
lastMessageFull: z.lazy(() => LastMessageFull$outboundSchema).optional(),
|
|
777
|
+
finishReason: FinishReason$outboundSchema,
|
|
778
|
+
pendingToolCalls: z.array(z.lazy(() => PendingToolCalls$outboundSchema))
|
|
779
|
+
.optional(),
|
|
780
|
+
usage: z.lazy(() => AgentInactiveStreamingEventUsage$outboundSchema)
|
|
781
|
+
.optional(),
|
|
782
|
+
workflowRunId: z.string(),
|
|
783
|
+
responseId: z.string().optional(),
|
|
784
|
+
}).transform((v) => {
|
|
785
|
+
return remap$(v, {
|
|
786
|
+
lastMessage: "last_message",
|
|
787
|
+
lastMessageFull: "last_message_full",
|
|
788
|
+
finishReason: "finish_reason",
|
|
789
|
+
pendingToolCalls: "pending_tool_calls",
|
|
790
|
+
});
|
|
791
|
+
});
|
|
792
|
+
|
|
793
|
+
export function agentInactiveStreamingEventDataToJSON(
|
|
794
|
+
agentInactiveStreamingEventData: AgentInactiveStreamingEventData,
|
|
795
|
+
): string {
|
|
796
|
+
return JSON.stringify(
|
|
797
|
+
AgentInactiveStreamingEventData$outboundSchema.parse(
|
|
798
|
+
agentInactiveStreamingEventData,
|
|
799
|
+
),
|
|
800
|
+
);
|
|
801
|
+
}
|
|
802
|
+
export function agentInactiveStreamingEventDataFromJSON(
|
|
803
|
+
jsonString: string,
|
|
804
|
+
): SafeParseResult<AgentInactiveStreamingEventData, SDKValidationError> {
|
|
805
|
+
return safeParse(
|
|
806
|
+
jsonString,
|
|
807
|
+
(x) => AgentInactiveStreamingEventData$inboundSchema.parse(JSON.parse(x)),
|
|
808
|
+
`Failed to parse 'AgentInactiveStreamingEventData' from JSON`,
|
|
809
|
+
);
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
/** @internal */
|
|
813
|
+
export const AgentInactiveStreamingEvent$inboundSchema: z.ZodType<
|
|
814
|
+
AgentInactiveStreamingEvent,
|
|
815
|
+
z.ZodTypeDef,
|
|
816
|
+
unknown
|
|
817
|
+
> = z.object({
|
|
818
|
+
type: AgentInactiveStreamingEventType$inboundSchema,
|
|
819
|
+
timestamp: z.string(),
|
|
820
|
+
data: z.lazy(() => AgentInactiveStreamingEventData$inboundSchema),
|
|
821
|
+
});
|
|
822
|
+
/** @internal */
|
|
823
|
+
export type AgentInactiveStreamingEvent$Outbound = {
|
|
824
|
+
type: string;
|
|
825
|
+
timestamp: string;
|
|
826
|
+
data: AgentInactiveStreamingEventData$Outbound;
|
|
827
|
+
};
|
|
828
|
+
|
|
829
|
+
/** @internal */
|
|
830
|
+
export const AgentInactiveStreamingEvent$outboundSchema: z.ZodType<
|
|
831
|
+
AgentInactiveStreamingEvent$Outbound,
|
|
832
|
+
z.ZodTypeDef,
|
|
833
|
+
AgentInactiveStreamingEvent
|
|
834
|
+
> = z.object({
|
|
835
|
+
type: AgentInactiveStreamingEventType$outboundSchema,
|
|
836
|
+
timestamp: z.string(),
|
|
837
|
+
data: z.lazy(() => AgentInactiveStreamingEventData$outboundSchema),
|
|
838
|
+
});
|
|
839
|
+
|
|
840
|
+
export function agentInactiveStreamingEventToJSON(
|
|
841
|
+
agentInactiveStreamingEvent: AgentInactiveStreamingEvent,
|
|
842
|
+
): string {
|
|
843
|
+
return JSON.stringify(
|
|
844
|
+
AgentInactiveStreamingEvent$outboundSchema.parse(
|
|
845
|
+
agentInactiveStreamingEvent,
|
|
846
|
+
),
|
|
847
|
+
);
|
|
848
|
+
}
|
|
849
|
+
export function agentInactiveStreamingEventFromJSON(
|
|
850
|
+
jsonString: string,
|
|
851
|
+
): SafeParseResult<AgentInactiveStreamingEvent, SDKValidationError> {
|
|
852
|
+
return safeParse(
|
|
853
|
+
jsonString,
|
|
854
|
+
(x) => AgentInactiveStreamingEvent$inboundSchema.parse(JSON.parse(x)),
|
|
855
|
+
`Failed to parse 'AgentInactiveStreamingEvent' from JSON`,
|
|
856
|
+
);
|
|
857
|
+
}
|