@orq-ai/node 4.0.0-rc.67 → 4.0.0-rc.68

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.
Files changed (143) hide show
  1. package/README.md +23 -18
  2. package/bin/mcp-server.js +2320 -1152
  3. package/bin/mcp-server.js.map +49 -46
  4. package/docs/sdks/responses/README.md +139 -0
  5. package/examples/package-lock.json +1 -1
  6. package/funcs/agentsResponsesCreate.d.ts +17 -0
  7. package/funcs/agentsResponsesCreate.d.ts.map +1 -0
  8. package/funcs/agentsResponsesCreate.js +120 -0
  9. package/funcs/agentsResponsesCreate.js.map +1 -0
  10. package/jsr.json +1 -1
  11. package/lib/config.d.ts +2 -2
  12. package/lib/config.js +2 -2
  13. package/mcp-server/mcp-server.js +1 -1
  14. package/mcp-server/server.d.ts.map +1 -1
  15. package/mcp-server/server.js +3 -1
  16. package/mcp-server/server.js.map +1 -1
  17. package/mcp-server/tools/agentsResponsesCreate.d.ts +8 -0
  18. package/mcp-server/tools/agentsResponsesCreate.d.ts.map +1 -0
  19. package/mcp-server/tools/agentsResponsesCreate.js +64 -0
  20. package/mcp-server/tools/agentsResponsesCreate.js.map +1 -0
  21. package/models/operations/createagent.js +4 -4
  22. package/models/operations/createagent.js.map +1 -1
  23. package/models/operations/createagentresponse.d.ts +564 -0
  24. package/models/operations/createagentresponse.d.ts.map +1 -0
  25. package/models/operations/createagentresponse.js +605 -0
  26. package/models/operations/createagentresponse.js.map +1 -0
  27. package/models/operations/createbudget.js +2 -2
  28. package/models/operations/createcontact.js +2 -2
  29. package/models/operations/createdataset.js +2 -2
  30. package/models/operations/createdatasetitem.js +8 -8
  31. package/models/operations/createdatasource.js +2 -2
  32. package/models/operations/createeval.js +28 -28
  33. package/models/operations/createtool.js +12 -12
  34. package/models/operations/fileget.js +2 -2
  35. package/models/operations/filelist.js +2 -2
  36. package/models/operations/fileupload.js +2 -2
  37. package/models/operations/getagent.js +2 -2
  38. package/models/operations/getagent.js.map +1 -1
  39. package/models/operations/getagenttask.d.ts +32 -32
  40. package/models/operations/getagenttask.d.ts.map +1 -1
  41. package/models/operations/getagenttask.js +50 -50
  42. package/models/operations/getagenttask.js.map +1 -1
  43. package/models/operations/getalltools.js +12 -12
  44. package/models/operations/getbudget.js +2 -2
  45. package/models/operations/getevals.js +28 -28
  46. package/models/operations/index.d.ts +1 -0
  47. package/models/operations/index.d.ts.map +1 -1
  48. package/models/operations/index.js +1 -0
  49. package/models/operations/index.js.map +1 -1
  50. package/models/operations/invokeagent.d.ts +95 -95
  51. package/models/operations/invokeagent.d.ts.map +1 -1
  52. package/models/operations/invokeagent.js +143 -134
  53. package/models/operations/invokeagent.js.map +1 -1
  54. package/models/operations/listagents.js +2 -2
  55. package/models/operations/listagents.js.map +1 -1
  56. package/models/operations/listbudgets.js +2 -2
  57. package/models/operations/listcontacts.js +2 -2
  58. package/models/operations/listdatasetdatapoints.js +8 -8
  59. package/models/operations/listdatasets.js +2 -2
  60. package/models/operations/listdatasources.js +2 -2
  61. package/models/operations/retrievecontact.js +2 -2
  62. package/models/operations/retrievedatapoint.js +8 -8
  63. package/models/operations/retrievedataset.js +2 -2
  64. package/models/operations/retrievedatasource.js +2 -2
  65. package/models/operations/retrievetool.js +12 -12
  66. package/models/operations/runagent.d.ts +54 -54
  67. package/models/operations/runagent.d.ts.map +1 -1
  68. package/models/operations/runagent.js +90 -90
  69. package/models/operations/runagent.js.map +1 -1
  70. package/models/operations/streamagent.d.ts +541 -68
  71. package/models/operations/streamagent.d.ts.map +1 -1
  72. package/models/operations/streamagent.js +649 -118
  73. package/models/operations/streamagent.js.map +1 -1
  74. package/models/operations/streamrunagent.d.ts +541 -68
  75. package/models/operations/streamrunagent.d.ts.map +1 -1
  76. package/models/operations/streamrunagent.js +657 -127
  77. package/models/operations/streamrunagent.js.map +1 -1
  78. package/models/operations/updateagent.js +4 -4
  79. package/models/operations/updateagent.js.map +1 -1
  80. package/models/operations/updatebudget.js +2 -2
  81. package/models/operations/updatecontact.js +2 -2
  82. package/models/operations/updatedatapoint.js +8 -8
  83. package/models/operations/updatedataset.js +2 -2
  84. package/models/operations/updatedatasource.js +2 -2
  85. package/models/operations/updateeval.js +28 -28
  86. package/models/operations/updatetool.js +14 -14
  87. package/package.json +1 -1
  88. package/sdk/agents.d.ts +3 -0
  89. package/sdk/agents.d.ts.map +1 -1
  90. package/sdk/agents.js +4 -0
  91. package/sdk/agents.js.map +1 -1
  92. package/sdk/responses.d.ts +12 -0
  93. package/sdk/responses.d.ts.map +1 -0
  94. package/sdk/responses.js +22 -0
  95. package/sdk/responses.js.map +1 -0
  96. package/src/funcs/agentsResponsesCreate.ts +168 -0
  97. package/src/lib/config.ts +2 -2
  98. package/src/mcp-server/mcp-server.ts +1 -1
  99. package/src/mcp-server/server.ts +3 -1
  100. package/src/mcp-server/tools/agentsResponsesCreate.ts +37 -0
  101. package/src/models/operations/createagent.ts +4 -4
  102. package/src/models/operations/createagentresponse.ts +1339 -0
  103. package/src/models/operations/createbudget.ts +2 -2
  104. package/src/models/operations/createcontact.ts +2 -2
  105. package/src/models/operations/createdataset.ts +2 -2
  106. package/src/models/operations/createdatasetitem.ts +8 -8
  107. package/src/models/operations/createdatasource.ts +2 -2
  108. package/src/models/operations/createeval.ts +28 -28
  109. package/src/models/operations/createtool.ts +12 -12
  110. package/src/models/operations/fileget.ts +2 -2
  111. package/src/models/operations/filelist.ts +2 -2
  112. package/src/models/operations/fileupload.ts +2 -2
  113. package/src/models/operations/getagent.ts +2 -2
  114. package/src/models/operations/getagenttask.ts +94 -94
  115. package/src/models/operations/getalltools.ts +12 -12
  116. package/src/models/operations/getbudget.ts +2 -2
  117. package/src/models/operations/getevals.ts +28 -28
  118. package/src/models/operations/index.ts +1 -0
  119. package/src/models/operations/invokeagent.ts +322 -246
  120. package/src/models/operations/listagents.ts +2 -2
  121. package/src/models/operations/listbudgets.ts +2 -2
  122. package/src/models/operations/listcontacts.ts +2 -2
  123. package/src/models/operations/listdatasetdatapoints.ts +8 -8
  124. package/src/models/operations/listdatasets.ts +2 -2
  125. package/src/models/operations/listdatasources.ts +2 -2
  126. package/src/models/operations/retrievecontact.ts +2 -2
  127. package/src/models/operations/retrievedatapoint.ts +8 -8
  128. package/src/models/operations/retrievedataset.ts +2 -2
  129. package/src/models/operations/retrievedatasource.ts +2 -2
  130. package/src/models/operations/retrievetool.ts +12 -12
  131. package/src/models/operations/runagent.ts +174 -157
  132. package/src/models/operations/streamagent.ts +1739 -297
  133. package/src/models/operations/streamrunagent.ts +1742 -307
  134. package/src/models/operations/updateagent.ts +4 -4
  135. package/src/models/operations/updatebudget.ts +2 -2
  136. package/src/models/operations/updatecontact.ts +2 -2
  137. package/src/models/operations/updatedatapoint.ts +8 -8
  138. package/src/models/operations/updatedataset.ts +2 -2
  139. package/src/models/operations/updatedatasource.ts +2 -2
  140. package/src/models/operations/updateeval.ts +28 -28
  141. package/src/models/operations/updatetool.ts +14 -14
  142. package/src/sdk/agents.ts +6 -0
  143. package/src/sdk/responses.ts +27 -0
@@ -0,0 +1,1339 @@
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
+
12
+ /**
13
+ * Message containing tool execution results
14
+ */
15
+ export const RoleToolMessage = {
16
+ Tool: "tool",
17
+ } as const;
18
+ /**
19
+ * Message containing tool execution results
20
+ */
21
+ export type RoleToolMessage = ClosedEnum<typeof RoleToolMessage>;
22
+
23
+ /**
24
+ * Message from the end user
25
+ */
26
+ export const RoleUserMessage = {
27
+ User: "user",
28
+ } as const;
29
+ /**
30
+ * Message from the end user
31
+ */
32
+ export type RoleUserMessage = ClosedEnum<typeof RoleUserMessage>;
33
+
34
+ /**
35
+ * Message role (user or tool for continuing executions)
36
+ */
37
+ export type CreateAgentResponseRole = RoleUserMessage | RoleToolMessage;
38
+
39
+ export const CreateAgentResponsePublicMessagePartKind = {
40
+ ToolResult: "tool_result",
41
+ } as const;
42
+ export type CreateAgentResponsePublicMessagePartKind = ClosedEnum<
43
+ typeof CreateAgentResponsePublicMessagePartKind
44
+ >;
45
+
46
+ /**
47
+ * Tool execution result part. Use this ONLY when providing results for a pending tool call from the agent. The tool_call_id must match the ID from the agent's tool call request.
48
+ */
49
+ export type ToolResultPart = {
50
+ kind: CreateAgentResponsePublicMessagePartKind;
51
+ toolCallId: string;
52
+ result?: any | undefined;
53
+ metadata?: { [k: string]: any } | undefined;
54
+ };
55
+
56
+ export const PublicMessagePartKind = {
57
+ File: "file",
58
+ } as const;
59
+ export type PublicMessagePartKind = ClosedEnum<typeof PublicMessagePartKind>;
60
+
61
+ /**
62
+ * File in URI format. Check in the model's documentation for the supported mime types for the URI format
63
+ */
64
+ export type FileInURIFormat = {
65
+ /**
66
+ * URL for the File content
67
+ */
68
+ uri: string;
69
+ /**
70
+ * Optional mimeType for the file
71
+ */
72
+ mimeType?: string | undefined;
73
+ /**
74
+ * Optional name for the file
75
+ */
76
+ name?: string | undefined;
77
+ };
78
+
79
+ /**
80
+ * Binary in base64 format. Check in the model's documentation for the supported mime types for the binary format.
81
+ */
82
+ export type BinaryFormat = {
83
+ /**
84
+ * base64 encoded content of the file
85
+ */
86
+ bytes: string;
87
+ /**
88
+ * Optional mimeType for the file
89
+ */
90
+ mimeType?: string | undefined;
91
+ /**
92
+ * Optional name for the file
93
+ */
94
+ name?: string | undefined;
95
+ };
96
+
97
+ export type PublicMessagePartFile = BinaryFormat | FileInURIFormat;
98
+
99
+ /**
100
+ * File attachment part. Use this to send files (images, documents, etc.) to the agent for processing.
101
+ */
102
+ export type FilePart = {
103
+ kind: PublicMessagePartKind;
104
+ file: BinaryFormat | FileInURIFormat;
105
+ metadata?: { [k: string]: any } | undefined;
106
+ };
107
+
108
+ export const Kind = {
109
+ Text: "text",
110
+ } as const;
111
+ export type Kind = ClosedEnum<typeof Kind>;
112
+
113
+ /**
114
+ * Text content part. Use this to send text messages to the agent.
115
+ */
116
+ export type TextPart = {
117
+ kind: Kind;
118
+ text: string;
119
+ };
120
+
121
+ /**
122
+ * Message part that can be provided by users. Use "text" for regular messages, "file" for attachments, or "tool_result" when responding to tool call requests.
123
+ */
124
+ export type PublicMessagePart = TextPart | FilePart | ToolResultPart;
125
+
126
+ /**
127
+ * The A2A message to send to the agent (user input or tool results)
128
+ */
129
+ export type A2AMessage = {
130
+ /**
131
+ * Optional A2A message ID in ULID format
132
+ */
133
+ messageId?: string | undefined;
134
+ /**
135
+ * Message role (user or tool for continuing executions)
136
+ */
137
+ role: RoleUserMessage | RoleToolMessage;
138
+ /**
139
+ * A2A message parts (text, file, or tool_result only)
140
+ */
141
+ parts: Array<TextPart | FilePart | ToolResultPart>;
142
+ };
143
+
144
+ /**
145
+ * Information about the contact making the request. If the contact does not exist, it will be created automatically.
146
+ */
147
+ export type Contact = {
148
+ /**
149
+ * Unique identifier for the contact
150
+ */
151
+ id: string;
152
+ /**
153
+ * Display name of the contact
154
+ */
155
+ displayName?: string | undefined;
156
+ /**
157
+ * Email address of the contact
158
+ */
159
+ email?: string | undefined;
160
+ /**
161
+ * A hash of key/value pairs containing any other data about the contact
162
+ */
163
+ metadata?: Array<{ [k: string]: any }> | undefined;
164
+ /**
165
+ * URL to the contact's avatar or logo
166
+ */
167
+ logoUrl?: string | undefined;
168
+ /**
169
+ * A list of tags associated with the contact
170
+ */
171
+ tags?: Array<string> | undefined;
172
+ };
173
+
174
+ /**
175
+ * Thread information to group related requests
176
+ */
177
+ export type CreateAgentResponseThread = {
178
+ /**
179
+ * Unique thread identifier to group related invocations.
180
+ */
181
+ id: string;
182
+ /**
183
+ * Optional tags to differentiate or categorize threads
184
+ */
185
+ tags?: Array<string> | undefined;
186
+ };
187
+
188
+ /**
189
+ * Memory configuration for the agent execution. Used to associate memory stores with specific entities like users or sessions.
190
+ */
191
+ export type Memory = {
192
+ /**
193
+ * An entity ID used to link memory stores to a specific user, session, or conversation. This ID is used to isolate and retrieve memories specific to the entity across agent executions.
194
+ */
195
+ entityId: string;
196
+ };
197
+
198
+ export type CreateAgentResponseRequestBody = {
199
+ /**
200
+ * Optional task ID to continue an existing agent execution. When provided, the agent will continue the conversation from the existing task state. The task must be in an inactive state to continue.
201
+ */
202
+ taskId?: string | undefined;
203
+ /**
204
+ * The A2A message to send to the agent (user input or tool results)
205
+ */
206
+ message: A2AMessage;
207
+ /**
208
+ * Optional variables for template replacement in system prompt, instructions, and messages
209
+ */
210
+ variables?: { [k: string]: any } | undefined;
211
+ /**
212
+ * Information about the contact making the request. If the contact does not exist, it will be created automatically.
213
+ */
214
+ contact?: Contact | undefined;
215
+ /**
216
+ * Thread information to group related requests
217
+ */
218
+ thread?: CreateAgentResponseThread | undefined;
219
+ /**
220
+ * Memory configuration for the agent execution. Used to associate memory stores with specific entities like users or sessions.
221
+ */
222
+ memory?: Memory | undefined;
223
+ /**
224
+ * Optional metadata for the agent invocation as key-value pairs that will be included in traces
225
+ */
226
+ metadata?: { [k: string]: any } | undefined;
227
+ /**
228
+ * If true, returns immediately without waiting for completion. If false (default), waits until the agent becomes inactive or errors.
229
+ */
230
+ background?: boolean | undefined;
231
+ };
232
+
233
+ export type CreateAgentResponseRequest = {
234
+ /**
235
+ * The key or ID of the agent to invoke
236
+ */
237
+ agentKey: string;
238
+ requestBody?: CreateAgentResponseRequestBody | undefined;
239
+ };
240
+
241
+ export const CreateAgentResponseAgentsResponsesRole = {
242
+ User: "user",
243
+ Agent: "agent",
244
+ Tool: "tool",
245
+ System: "system",
246
+ } as const;
247
+ export type CreateAgentResponseAgentsResponsesRole = ClosedEnum<
248
+ typeof CreateAgentResponseAgentsResponsesRole
249
+ >;
250
+
251
+ export type Output = {
252
+ messageId: string;
253
+ role: CreateAgentResponseAgentsResponsesRole;
254
+ parts: Array<any>;
255
+ metadata?: { [k: string]: any } | undefined;
256
+ };
257
+
258
+ export type PromptTokensDetails = {
259
+ cachedTokens?: number | null | undefined;
260
+ /**
261
+ * The number of audio input tokens consumed by the request.
262
+ */
263
+ audioTokens?: number | null | undefined;
264
+ };
265
+
266
+ export type CompletionTokensDetails = {
267
+ reasoningTokens?: number | null | undefined;
268
+ acceptedPredictionTokens?: number | null | undefined;
269
+ rejectedPredictionTokens?: number | null | undefined;
270
+ /**
271
+ * The number of audio output tokens produced by the response.
272
+ */
273
+ audioTokens?: number | null | undefined;
274
+ };
275
+
276
+ /**
277
+ * Token usage from the agent execution
278
+ */
279
+ export type CreateAgentResponseUsage = {
280
+ /**
281
+ * Number of tokens in the generated completion.
282
+ */
283
+ completionTokens?: number | undefined;
284
+ /**
285
+ * Number of tokens in the prompt.
286
+ */
287
+ promptTokens?: number | undefined;
288
+ /**
289
+ * Total number of tokens used in the request (prompt + completion).
290
+ */
291
+ totalTokens?: number | undefined;
292
+ promptTokensDetails?: PromptTokensDetails | null | undefined;
293
+ completionTokensDetails?: CompletionTokensDetails | null | undefined;
294
+ };
295
+
296
+ /**
297
+ * Agent response created successfully
298
+ */
299
+ export type CreateAgentResponseResponseBody = {
300
+ /**
301
+ * The unique response ID
302
+ */
303
+ id: string;
304
+ /**
305
+ * The agent execution task ID
306
+ */
307
+ taskId: string;
308
+ /**
309
+ * Array of messages from the agent execution
310
+ */
311
+ output: Array<Output>;
312
+ /**
313
+ * ISO timestamp of response creation
314
+ */
315
+ createdAt: string;
316
+ /**
317
+ * Model used in provider/model format
318
+ */
319
+ model: string;
320
+ /**
321
+ * Token usage from the agent execution
322
+ */
323
+ usage?: CreateAgentResponseUsage | null | undefined;
324
+ };
325
+
326
+ /** @internal */
327
+ export const RoleToolMessage$inboundSchema: z.ZodNativeEnum<
328
+ typeof RoleToolMessage
329
+ > = z.nativeEnum(RoleToolMessage);
330
+ /** @internal */
331
+ export const RoleToolMessage$outboundSchema: z.ZodNativeEnum<
332
+ typeof RoleToolMessage
333
+ > = RoleToolMessage$inboundSchema;
334
+
335
+ /** @internal */
336
+ export const RoleUserMessage$inboundSchema: z.ZodNativeEnum<
337
+ typeof RoleUserMessage
338
+ > = z.nativeEnum(RoleUserMessage);
339
+ /** @internal */
340
+ export const RoleUserMessage$outboundSchema: z.ZodNativeEnum<
341
+ typeof RoleUserMessage
342
+ > = RoleUserMessage$inboundSchema;
343
+
344
+ /** @internal */
345
+ export const CreateAgentResponseRole$inboundSchema: z.ZodType<
346
+ CreateAgentResponseRole,
347
+ z.ZodTypeDef,
348
+ unknown
349
+ > = z.union([RoleUserMessage$inboundSchema, RoleToolMessage$inboundSchema]);
350
+ /** @internal */
351
+ export type CreateAgentResponseRole$Outbound = string | string;
352
+
353
+ /** @internal */
354
+ export const CreateAgentResponseRole$outboundSchema: z.ZodType<
355
+ CreateAgentResponseRole$Outbound,
356
+ z.ZodTypeDef,
357
+ CreateAgentResponseRole
358
+ > = z.union([RoleUserMessage$outboundSchema, RoleToolMessage$outboundSchema]);
359
+
360
+ export function createAgentResponseRoleToJSON(
361
+ createAgentResponseRole: CreateAgentResponseRole,
362
+ ): string {
363
+ return JSON.stringify(
364
+ CreateAgentResponseRole$outboundSchema.parse(createAgentResponseRole),
365
+ );
366
+ }
367
+ export function createAgentResponseRoleFromJSON(
368
+ jsonString: string,
369
+ ): SafeParseResult<CreateAgentResponseRole, SDKValidationError> {
370
+ return safeParse(
371
+ jsonString,
372
+ (x) => CreateAgentResponseRole$inboundSchema.parse(JSON.parse(x)),
373
+ `Failed to parse 'CreateAgentResponseRole' from JSON`,
374
+ );
375
+ }
376
+
377
+ /** @internal */
378
+ export const CreateAgentResponsePublicMessagePartKind$inboundSchema:
379
+ z.ZodNativeEnum<typeof CreateAgentResponsePublicMessagePartKind> = z
380
+ .nativeEnum(CreateAgentResponsePublicMessagePartKind);
381
+ /** @internal */
382
+ export const CreateAgentResponsePublicMessagePartKind$outboundSchema:
383
+ z.ZodNativeEnum<typeof CreateAgentResponsePublicMessagePartKind> =
384
+ CreateAgentResponsePublicMessagePartKind$inboundSchema;
385
+
386
+ /** @internal */
387
+ export const ToolResultPart$inboundSchema: z.ZodType<
388
+ ToolResultPart,
389
+ z.ZodTypeDef,
390
+ unknown
391
+ > = z.object({
392
+ kind: CreateAgentResponsePublicMessagePartKind$inboundSchema,
393
+ tool_call_id: z.string(),
394
+ result: z.any().optional(),
395
+ metadata: z.record(z.any()).optional(),
396
+ }).transform((v) => {
397
+ return remap$(v, {
398
+ "tool_call_id": "toolCallId",
399
+ });
400
+ });
401
+ /** @internal */
402
+ export type ToolResultPart$Outbound = {
403
+ kind: string;
404
+ tool_call_id: string;
405
+ result?: any | undefined;
406
+ metadata?: { [k: string]: any } | undefined;
407
+ };
408
+
409
+ /** @internal */
410
+ export const ToolResultPart$outboundSchema: z.ZodType<
411
+ ToolResultPart$Outbound,
412
+ z.ZodTypeDef,
413
+ ToolResultPart
414
+ > = z.object({
415
+ kind: CreateAgentResponsePublicMessagePartKind$outboundSchema,
416
+ toolCallId: z.string(),
417
+ result: z.any().optional(),
418
+ metadata: z.record(z.any()).optional(),
419
+ }).transform((v) => {
420
+ return remap$(v, {
421
+ toolCallId: "tool_call_id",
422
+ });
423
+ });
424
+
425
+ export function toolResultPartToJSON(toolResultPart: ToolResultPart): string {
426
+ return JSON.stringify(ToolResultPart$outboundSchema.parse(toolResultPart));
427
+ }
428
+ export function toolResultPartFromJSON(
429
+ jsonString: string,
430
+ ): SafeParseResult<ToolResultPart, SDKValidationError> {
431
+ return safeParse(
432
+ jsonString,
433
+ (x) => ToolResultPart$inboundSchema.parse(JSON.parse(x)),
434
+ `Failed to parse 'ToolResultPart' from JSON`,
435
+ );
436
+ }
437
+
438
+ /** @internal */
439
+ export const PublicMessagePartKind$inboundSchema: z.ZodNativeEnum<
440
+ typeof PublicMessagePartKind
441
+ > = z.nativeEnum(PublicMessagePartKind);
442
+ /** @internal */
443
+ export const PublicMessagePartKind$outboundSchema: z.ZodNativeEnum<
444
+ typeof PublicMessagePartKind
445
+ > = PublicMessagePartKind$inboundSchema;
446
+
447
+ /** @internal */
448
+ export const FileInURIFormat$inboundSchema: z.ZodType<
449
+ FileInURIFormat,
450
+ z.ZodTypeDef,
451
+ unknown
452
+ > = z.object({
453
+ uri: z.string(),
454
+ mimeType: z.string().optional(),
455
+ name: z.string().optional(),
456
+ });
457
+ /** @internal */
458
+ export type FileInURIFormat$Outbound = {
459
+ uri: string;
460
+ mimeType?: string | undefined;
461
+ name?: string | undefined;
462
+ };
463
+
464
+ /** @internal */
465
+ export const FileInURIFormat$outboundSchema: z.ZodType<
466
+ FileInURIFormat$Outbound,
467
+ z.ZodTypeDef,
468
+ FileInURIFormat
469
+ > = z.object({
470
+ uri: z.string(),
471
+ mimeType: z.string().optional(),
472
+ name: z.string().optional(),
473
+ });
474
+
475
+ export function fileInURIFormatToJSON(
476
+ fileInURIFormat: FileInURIFormat,
477
+ ): string {
478
+ return JSON.stringify(FileInURIFormat$outboundSchema.parse(fileInURIFormat));
479
+ }
480
+ export function fileInURIFormatFromJSON(
481
+ jsonString: string,
482
+ ): SafeParseResult<FileInURIFormat, SDKValidationError> {
483
+ return safeParse(
484
+ jsonString,
485
+ (x) => FileInURIFormat$inboundSchema.parse(JSON.parse(x)),
486
+ `Failed to parse 'FileInURIFormat' from JSON`,
487
+ );
488
+ }
489
+
490
+ /** @internal */
491
+ export const BinaryFormat$inboundSchema: z.ZodType<
492
+ BinaryFormat,
493
+ z.ZodTypeDef,
494
+ unknown
495
+ > = z.object({
496
+ bytes: z.string(),
497
+ mimeType: z.string().optional(),
498
+ name: z.string().optional(),
499
+ });
500
+ /** @internal */
501
+ export type BinaryFormat$Outbound = {
502
+ bytes: string;
503
+ mimeType?: string | undefined;
504
+ name?: string | undefined;
505
+ };
506
+
507
+ /** @internal */
508
+ export const BinaryFormat$outboundSchema: z.ZodType<
509
+ BinaryFormat$Outbound,
510
+ z.ZodTypeDef,
511
+ BinaryFormat
512
+ > = z.object({
513
+ bytes: z.string(),
514
+ mimeType: z.string().optional(),
515
+ name: z.string().optional(),
516
+ });
517
+
518
+ export function binaryFormatToJSON(binaryFormat: BinaryFormat): string {
519
+ return JSON.stringify(BinaryFormat$outboundSchema.parse(binaryFormat));
520
+ }
521
+ export function binaryFormatFromJSON(
522
+ jsonString: string,
523
+ ): SafeParseResult<BinaryFormat, SDKValidationError> {
524
+ return safeParse(
525
+ jsonString,
526
+ (x) => BinaryFormat$inboundSchema.parse(JSON.parse(x)),
527
+ `Failed to parse 'BinaryFormat' from JSON`,
528
+ );
529
+ }
530
+
531
+ /** @internal */
532
+ export const PublicMessagePartFile$inboundSchema: z.ZodType<
533
+ PublicMessagePartFile,
534
+ z.ZodTypeDef,
535
+ unknown
536
+ > = z.union([
537
+ z.lazy(() => BinaryFormat$inboundSchema),
538
+ z.lazy(() => FileInURIFormat$inboundSchema),
539
+ ]);
540
+ /** @internal */
541
+ export type PublicMessagePartFile$Outbound =
542
+ | BinaryFormat$Outbound
543
+ | FileInURIFormat$Outbound;
544
+
545
+ /** @internal */
546
+ export const PublicMessagePartFile$outboundSchema: z.ZodType<
547
+ PublicMessagePartFile$Outbound,
548
+ z.ZodTypeDef,
549
+ PublicMessagePartFile
550
+ > = z.union([
551
+ z.lazy(() => BinaryFormat$outboundSchema),
552
+ z.lazy(() => FileInURIFormat$outboundSchema),
553
+ ]);
554
+
555
+ export function publicMessagePartFileToJSON(
556
+ publicMessagePartFile: PublicMessagePartFile,
557
+ ): string {
558
+ return JSON.stringify(
559
+ PublicMessagePartFile$outboundSchema.parse(publicMessagePartFile),
560
+ );
561
+ }
562
+ export function publicMessagePartFileFromJSON(
563
+ jsonString: string,
564
+ ): SafeParseResult<PublicMessagePartFile, SDKValidationError> {
565
+ return safeParse(
566
+ jsonString,
567
+ (x) => PublicMessagePartFile$inboundSchema.parse(JSON.parse(x)),
568
+ `Failed to parse 'PublicMessagePartFile' from JSON`,
569
+ );
570
+ }
571
+
572
+ /** @internal */
573
+ export const FilePart$inboundSchema: z.ZodType<
574
+ FilePart,
575
+ z.ZodTypeDef,
576
+ unknown
577
+ > = z.object({
578
+ kind: PublicMessagePartKind$inboundSchema,
579
+ file: z.union([
580
+ z.lazy(() => BinaryFormat$inboundSchema),
581
+ z.lazy(() => FileInURIFormat$inboundSchema),
582
+ ]),
583
+ metadata: z.record(z.any()).optional(),
584
+ });
585
+ /** @internal */
586
+ export type FilePart$Outbound = {
587
+ kind: string;
588
+ file: BinaryFormat$Outbound | FileInURIFormat$Outbound;
589
+ metadata?: { [k: string]: any } | undefined;
590
+ };
591
+
592
+ /** @internal */
593
+ export const FilePart$outboundSchema: z.ZodType<
594
+ FilePart$Outbound,
595
+ z.ZodTypeDef,
596
+ FilePart
597
+ > = z.object({
598
+ kind: PublicMessagePartKind$outboundSchema,
599
+ file: z.union([
600
+ z.lazy(() => BinaryFormat$outboundSchema),
601
+ z.lazy(() => FileInURIFormat$outboundSchema),
602
+ ]),
603
+ metadata: z.record(z.any()).optional(),
604
+ });
605
+
606
+ export function filePartToJSON(filePart: FilePart): string {
607
+ return JSON.stringify(FilePart$outboundSchema.parse(filePart));
608
+ }
609
+ export function filePartFromJSON(
610
+ jsonString: string,
611
+ ): SafeParseResult<FilePart, SDKValidationError> {
612
+ return safeParse(
613
+ jsonString,
614
+ (x) => FilePart$inboundSchema.parse(JSON.parse(x)),
615
+ `Failed to parse 'FilePart' from JSON`,
616
+ );
617
+ }
618
+
619
+ /** @internal */
620
+ export const Kind$inboundSchema: z.ZodNativeEnum<typeof Kind> = z.nativeEnum(
621
+ Kind,
622
+ );
623
+ /** @internal */
624
+ export const Kind$outboundSchema: z.ZodNativeEnum<typeof Kind> =
625
+ Kind$inboundSchema;
626
+
627
+ /** @internal */
628
+ export const TextPart$inboundSchema: z.ZodType<
629
+ TextPart,
630
+ z.ZodTypeDef,
631
+ unknown
632
+ > = z.object({
633
+ kind: Kind$inboundSchema,
634
+ text: z.string(),
635
+ });
636
+ /** @internal */
637
+ export type TextPart$Outbound = {
638
+ kind: string;
639
+ text: string;
640
+ };
641
+
642
+ /** @internal */
643
+ export const TextPart$outboundSchema: z.ZodType<
644
+ TextPart$Outbound,
645
+ z.ZodTypeDef,
646
+ TextPart
647
+ > = z.object({
648
+ kind: Kind$outboundSchema,
649
+ text: z.string(),
650
+ });
651
+
652
+ export function textPartToJSON(textPart: TextPart): string {
653
+ return JSON.stringify(TextPart$outboundSchema.parse(textPart));
654
+ }
655
+ export function textPartFromJSON(
656
+ jsonString: string,
657
+ ): SafeParseResult<TextPart, SDKValidationError> {
658
+ return safeParse(
659
+ jsonString,
660
+ (x) => TextPart$inboundSchema.parse(JSON.parse(x)),
661
+ `Failed to parse 'TextPart' from JSON`,
662
+ );
663
+ }
664
+
665
+ /** @internal */
666
+ export const PublicMessagePart$inboundSchema: z.ZodType<
667
+ PublicMessagePart,
668
+ z.ZodTypeDef,
669
+ unknown
670
+ > = z.union([
671
+ z.lazy(() => TextPart$inboundSchema),
672
+ z.lazy(() => FilePart$inboundSchema),
673
+ z.lazy(() => ToolResultPart$inboundSchema),
674
+ ]);
675
+ /** @internal */
676
+ export type PublicMessagePart$Outbound =
677
+ | TextPart$Outbound
678
+ | FilePart$Outbound
679
+ | ToolResultPart$Outbound;
680
+
681
+ /** @internal */
682
+ export const PublicMessagePart$outboundSchema: z.ZodType<
683
+ PublicMessagePart$Outbound,
684
+ z.ZodTypeDef,
685
+ PublicMessagePart
686
+ > = z.union([
687
+ z.lazy(() => TextPart$outboundSchema),
688
+ z.lazy(() => FilePart$outboundSchema),
689
+ z.lazy(() => ToolResultPart$outboundSchema),
690
+ ]);
691
+
692
+ export function publicMessagePartToJSON(
693
+ publicMessagePart: PublicMessagePart,
694
+ ): string {
695
+ return JSON.stringify(
696
+ PublicMessagePart$outboundSchema.parse(publicMessagePart),
697
+ );
698
+ }
699
+ export function publicMessagePartFromJSON(
700
+ jsonString: string,
701
+ ): SafeParseResult<PublicMessagePart, SDKValidationError> {
702
+ return safeParse(
703
+ jsonString,
704
+ (x) => PublicMessagePart$inboundSchema.parse(JSON.parse(x)),
705
+ `Failed to parse 'PublicMessagePart' from JSON`,
706
+ );
707
+ }
708
+
709
+ /** @internal */
710
+ export const A2AMessage$inboundSchema: z.ZodType<
711
+ A2AMessage,
712
+ z.ZodTypeDef,
713
+ unknown
714
+ > = z.object({
715
+ messageId: z.string().optional(),
716
+ role: z.union([RoleUserMessage$inboundSchema, RoleToolMessage$inboundSchema]),
717
+ parts: z.array(
718
+ z.union([
719
+ z.lazy(() => TextPart$inboundSchema),
720
+ z.lazy(() => FilePart$inboundSchema),
721
+ z.lazy(() => ToolResultPart$inboundSchema),
722
+ ]),
723
+ ),
724
+ });
725
+ /** @internal */
726
+ export type A2AMessage$Outbound = {
727
+ messageId?: string | undefined;
728
+ role: string | string;
729
+ parts: Array<TextPart$Outbound | FilePart$Outbound | ToolResultPart$Outbound>;
730
+ };
731
+
732
+ /** @internal */
733
+ export const A2AMessage$outboundSchema: z.ZodType<
734
+ A2AMessage$Outbound,
735
+ z.ZodTypeDef,
736
+ A2AMessage
737
+ > = z.object({
738
+ messageId: z.string().optional(),
739
+ role: z.union([
740
+ RoleUserMessage$outboundSchema,
741
+ RoleToolMessage$outboundSchema,
742
+ ]),
743
+ parts: z.array(
744
+ z.union([
745
+ z.lazy(() => TextPart$outboundSchema),
746
+ z.lazy(() => FilePart$outboundSchema),
747
+ z.lazy(() => ToolResultPart$outboundSchema),
748
+ ]),
749
+ ),
750
+ });
751
+
752
+ export function a2AMessageToJSON(a2AMessage: A2AMessage): string {
753
+ return JSON.stringify(A2AMessage$outboundSchema.parse(a2AMessage));
754
+ }
755
+ export function a2AMessageFromJSON(
756
+ jsonString: string,
757
+ ): SafeParseResult<A2AMessage, SDKValidationError> {
758
+ return safeParse(
759
+ jsonString,
760
+ (x) => A2AMessage$inboundSchema.parse(JSON.parse(x)),
761
+ `Failed to parse 'A2AMessage' from JSON`,
762
+ );
763
+ }
764
+
765
+ /** @internal */
766
+ export const Contact$inboundSchema: z.ZodType<Contact, z.ZodTypeDef, unknown> =
767
+ z.object({
768
+ id: z.string(),
769
+ display_name: z.string().optional(),
770
+ email: z.string().optional(),
771
+ metadata: z.array(z.record(z.any())).optional(),
772
+ logo_url: z.string().optional(),
773
+ tags: z.array(z.string()).optional(),
774
+ }).transform((v) => {
775
+ return remap$(v, {
776
+ "display_name": "displayName",
777
+ "logo_url": "logoUrl",
778
+ });
779
+ });
780
+ /** @internal */
781
+ export type Contact$Outbound = {
782
+ id: string;
783
+ display_name?: string | undefined;
784
+ email?: string | undefined;
785
+ metadata?: Array<{ [k: string]: any }> | undefined;
786
+ logo_url?: string | undefined;
787
+ tags?: Array<string> | undefined;
788
+ };
789
+
790
+ /** @internal */
791
+ export const Contact$outboundSchema: z.ZodType<
792
+ Contact$Outbound,
793
+ z.ZodTypeDef,
794
+ Contact
795
+ > = z.object({
796
+ id: z.string(),
797
+ displayName: z.string().optional(),
798
+ email: z.string().optional(),
799
+ metadata: z.array(z.record(z.any())).optional(),
800
+ logoUrl: z.string().optional(),
801
+ tags: z.array(z.string()).optional(),
802
+ }).transform((v) => {
803
+ return remap$(v, {
804
+ displayName: "display_name",
805
+ logoUrl: "logo_url",
806
+ });
807
+ });
808
+
809
+ export function contactToJSON(contact: Contact): string {
810
+ return JSON.stringify(Contact$outboundSchema.parse(contact));
811
+ }
812
+ export function contactFromJSON(
813
+ jsonString: string,
814
+ ): SafeParseResult<Contact, SDKValidationError> {
815
+ return safeParse(
816
+ jsonString,
817
+ (x) => Contact$inboundSchema.parse(JSON.parse(x)),
818
+ `Failed to parse 'Contact' from JSON`,
819
+ );
820
+ }
821
+
822
+ /** @internal */
823
+ export const CreateAgentResponseThread$inboundSchema: z.ZodType<
824
+ CreateAgentResponseThread,
825
+ z.ZodTypeDef,
826
+ unknown
827
+ > = z.object({
828
+ id: z.string(),
829
+ tags: z.array(z.string()).optional(),
830
+ });
831
+ /** @internal */
832
+ export type CreateAgentResponseThread$Outbound = {
833
+ id: string;
834
+ tags?: Array<string> | undefined;
835
+ };
836
+
837
+ /** @internal */
838
+ export const CreateAgentResponseThread$outboundSchema: z.ZodType<
839
+ CreateAgentResponseThread$Outbound,
840
+ z.ZodTypeDef,
841
+ CreateAgentResponseThread
842
+ > = z.object({
843
+ id: z.string(),
844
+ tags: z.array(z.string()).optional(),
845
+ });
846
+
847
+ export function createAgentResponseThreadToJSON(
848
+ createAgentResponseThread: CreateAgentResponseThread,
849
+ ): string {
850
+ return JSON.stringify(
851
+ CreateAgentResponseThread$outboundSchema.parse(createAgentResponseThread),
852
+ );
853
+ }
854
+ export function createAgentResponseThreadFromJSON(
855
+ jsonString: string,
856
+ ): SafeParseResult<CreateAgentResponseThread, SDKValidationError> {
857
+ return safeParse(
858
+ jsonString,
859
+ (x) => CreateAgentResponseThread$inboundSchema.parse(JSON.parse(x)),
860
+ `Failed to parse 'CreateAgentResponseThread' from JSON`,
861
+ );
862
+ }
863
+
864
+ /** @internal */
865
+ export const Memory$inboundSchema: z.ZodType<Memory, z.ZodTypeDef, unknown> = z
866
+ .object({
867
+ entity_id: z.string(),
868
+ }).transform((v) => {
869
+ return remap$(v, {
870
+ "entity_id": "entityId",
871
+ });
872
+ });
873
+ /** @internal */
874
+ export type Memory$Outbound = {
875
+ entity_id: string;
876
+ };
877
+
878
+ /** @internal */
879
+ export const Memory$outboundSchema: z.ZodType<
880
+ Memory$Outbound,
881
+ z.ZodTypeDef,
882
+ Memory
883
+ > = z.object({
884
+ entityId: z.string(),
885
+ }).transform((v) => {
886
+ return remap$(v, {
887
+ entityId: "entity_id",
888
+ });
889
+ });
890
+
891
+ export function memoryToJSON(memory: Memory): string {
892
+ return JSON.stringify(Memory$outboundSchema.parse(memory));
893
+ }
894
+ export function memoryFromJSON(
895
+ jsonString: string,
896
+ ): SafeParseResult<Memory, SDKValidationError> {
897
+ return safeParse(
898
+ jsonString,
899
+ (x) => Memory$inboundSchema.parse(JSON.parse(x)),
900
+ `Failed to parse 'Memory' from JSON`,
901
+ );
902
+ }
903
+
904
+ /** @internal */
905
+ export const CreateAgentResponseRequestBody$inboundSchema: z.ZodType<
906
+ CreateAgentResponseRequestBody,
907
+ z.ZodTypeDef,
908
+ unknown
909
+ > = z.object({
910
+ task_id: z.string().optional(),
911
+ message: z.lazy(() => A2AMessage$inboundSchema),
912
+ variables: z.record(z.any()).optional(),
913
+ contact: z.lazy(() => Contact$inboundSchema).optional(),
914
+ thread: z.lazy(() => CreateAgentResponseThread$inboundSchema).optional(),
915
+ memory: z.lazy(() => Memory$inboundSchema).optional(),
916
+ metadata: z.record(z.any()).optional(),
917
+ background: z.boolean().default(false),
918
+ }).transform((v) => {
919
+ return remap$(v, {
920
+ "task_id": "taskId",
921
+ });
922
+ });
923
+ /** @internal */
924
+ export type CreateAgentResponseRequestBody$Outbound = {
925
+ task_id?: string | undefined;
926
+ message: A2AMessage$Outbound;
927
+ variables?: { [k: string]: any } | undefined;
928
+ contact?: Contact$Outbound | undefined;
929
+ thread?: CreateAgentResponseThread$Outbound | undefined;
930
+ memory?: Memory$Outbound | undefined;
931
+ metadata?: { [k: string]: any } | undefined;
932
+ background: boolean;
933
+ };
934
+
935
+ /** @internal */
936
+ export const CreateAgentResponseRequestBody$outboundSchema: z.ZodType<
937
+ CreateAgentResponseRequestBody$Outbound,
938
+ z.ZodTypeDef,
939
+ CreateAgentResponseRequestBody
940
+ > = z.object({
941
+ taskId: z.string().optional(),
942
+ message: z.lazy(() => A2AMessage$outboundSchema),
943
+ variables: z.record(z.any()).optional(),
944
+ contact: z.lazy(() => Contact$outboundSchema).optional(),
945
+ thread: z.lazy(() => CreateAgentResponseThread$outboundSchema).optional(),
946
+ memory: z.lazy(() => Memory$outboundSchema).optional(),
947
+ metadata: z.record(z.any()).optional(),
948
+ background: z.boolean().default(false),
949
+ }).transform((v) => {
950
+ return remap$(v, {
951
+ taskId: "task_id",
952
+ });
953
+ });
954
+
955
+ export function createAgentResponseRequestBodyToJSON(
956
+ createAgentResponseRequestBody: CreateAgentResponseRequestBody,
957
+ ): string {
958
+ return JSON.stringify(
959
+ CreateAgentResponseRequestBody$outboundSchema.parse(
960
+ createAgentResponseRequestBody,
961
+ ),
962
+ );
963
+ }
964
+ export function createAgentResponseRequestBodyFromJSON(
965
+ jsonString: string,
966
+ ): SafeParseResult<CreateAgentResponseRequestBody, SDKValidationError> {
967
+ return safeParse(
968
+ jsonString,
969
+ (x) => CreateAgentResponseRequestBody$inboundSchema.parse(JSON.parse(x)),
970
+ `Failed to parse 'CreateAgentResponseRequestBody' from JSON`,
971
+ );
972
+ }
973
+
974
+ /** @internal */
975
+ export const CreateAgentResponseRequest$inboundSchema: z.ZodType<
976
+ CreateAgentResponseRequest,
977
+ z.ZodTypeDef,
978
+ unknown
979
+ > = z.object({
980
+ agent_key: z.string(),
981
+ RequestBody: z.lazy(() => CreateAgentResponseRequestBody$inboundSchema)
982
+ .optional(),
983
+ }).transform((v) => {
984
+ return remap$(v, {
985
+ "agent_key": "agentKey",
986
+ "RequestBody": "requestBody",
987
+ });
988
+ });
989
+ /** @internal */
990
+ export type CreateAgentResponseRequest$Outbound = {
991
+ agent_key: string;
992
+ RequestBody?: CreateAgentResponseRequestBody$Outbound | undefined;
993
+ };
994
+
995
+ /** @internal */
996
+ export const CreateAgentResponseRequest$outboundSchema: z.ZodType<
997
+ CreateAgentResponseRequest$Outbound,
998
+ z.ZodTypeDef,
999
+ CreateAgentResponseRequest
1000
+ > = z.object({
1001
+ agentKey: z.string(),
1002
+ requestBody: z.lazy(() => CreateAgentResponseRequestBody$outboundSchema)
1003
+ .optional(),
1004
+ }).transform((v) => {
1005
+ return remap$(v, {
1006
+ agentKey: "agent_key",
1007
+ requestBody: "RequestBody",
1008
+ });
1009
+ });
1010
+
1011
+ export function createAgentResponseRequestToJSON(
1012
+ createAgentResponseRequest: CreateAgentResponseRequest,
1013
+ ): string {
1014
+ return JSON.stringify(
1015
+ CreateAgentResponseRequest$outboundSchema.parse(createAgentResponseRequest),
1016
+ );
1017
+ }
1018
+ export function createAgentResponseRequestFromJSON(
1019
+ jsonString: string,
1020
+ ): SafeParseResult<CreateAgentResponseRequest, SDKValidationError> {
1021
+ return safeParse(
1022
+ jsonString,
1023
+ (x) => CreateAgentResponseRequest$inboundSchema.parse(JSON.parse(x)),
1024
+ `Failed to parse 'CreateAgentResponseRequest' from JSON`,
1025
+ );
1026
+ }
1027
+
1028
+ /** @internal */
1029
+ export const CreateAgentResponseAgentsResponsesRole$inboundSchema:
1030
+ z.ZodNativeEnum<typeof CreateAgentResponseAgentsResponsesRole> = z.nativeEnum(
1031
+ CreateAgentResponseAgentsResponsesRole,
1032
+ );
1033
+ /** @internal */
1034
+ export const CreateAgentResponseAgentsResponsesRole$outboundSchema:
1035
+ z.ZodNativeEnum<typeof CreateAgentResponseAgentsResponsesRole> =
1036
+ CreateAgentResponseAgentsResponsesRole$inboundSchema;
1037
+
1038
+ /** @internal */
1039
+ export const Output$inboundSchema: z.ZodType<Output, z.ZodTypeDef, unknown> = z
1040
+ .object({
1041
+ messageId: z.string(),
1042
+ role: CreateAgentResponseAgentsResponsesRole$inboundSchema,
1043
+ parts: z.array(z.any()),
1044
+ metadata: z.record(z.any()).optional(),
1045
+ });
1046
+ /** @internal */
1047
+ export type Output$Outbound = {
1048
+ messageId: string;
1049
+ role: string;
1050
+ parts: Array<any>;
1051
+ metadata?: { [k: string]: any } | undefined;
1052
+ };
1053
+
1054
+ /** @internal */
1055
+ export const Output$outboundSchema: z.ZodType<
1056
+ Output$Outbound,
1057
+ z.ZodTypeDef,
1058
+ Output
1059
+ > = z.object({
1060
+ messageId: z.string(),
1061
+ role: CreateAgentResponseAgentsResponsesRole$outboundSchema,
1062
+ parts: z.array(z.any()),
1063
+ metadata: z.record(z.any()).optional(),
1064
+ });
1065
+
1066
+ export function outputToJSON(output: Output): string {
1067
+ return JSON.stringify(Output$outboundSchema.parse(output));
1068
+ }
1069
+ export function outputFromJSON(
1070
+ jsonString: string,
1071
+ ): SafeParseResult<Output, SDKValidationError> {
1072
+ return safeParse(
1073
+ jsonString,
1074
+ (x) => Output$inboundSchema.parse(JSON.parse(x)),
1075
+ `Failed to parse 'Output' from JSON`,
1076
+ );
1077
+ }
1078
+
1079
+ /** @internal */
1080
+ export const PromptTokensDetails$inboundSchema: z.ZodType<
1081
+ PromptTokensDetails,
1082
+ z.ZodTypeDef,
1083
+ unknown
1084
+ > = z.object({
1085
+ cached_tokens: z.nullable(z.number().int()).optional(),
1086
+ audio_tokens: z.nullable(z.number().int()).optional(),
1087
+ }).transform((v) => {
1088
+ return remap$(v, {
1089
+ "cached_tokens": "cachedTokens",
1090
+ "audio_tokens": "audioTokens",
1091
+ });
1092
+ });
1093
+ /** @internal */
1094
+ export type PromptTokensDetails$Outbound = {
1095
+ cached_tokens?: number | null | undefined;
1096
+ audio_tokens?: number | null | undefined;
1097
+ };
1098
+
1099
+ /** @internal */
1100
+ export const PromptTokensDetails$outboundSchema: z.ZodType<
1101
+ PromptTokensDetails$Outbound,
1102
+ z.ZodTypeDef,
1103
+ PromptTokensDetails
1104
+ > = z.object({
1105
+ cachedTokens: z.nullable(z.number().int()).optional(),
1106
+ audioTokens: z.nullable(z.number().int()).optional(),
1107
+ }).transform((v) => {
1108
+ return remap$(v, {
1109
+ cachedTokens: "cached_tokens",
1110
+ audioTokens: "audio_tokens",
1111
+ });
1112
+ });
1113
+
1114
+ export function promptTokensDetailsToJSON(
1115
+ promptTokensDetails: PromptTokensDetails,
1116
+ ): string {
1117
+ return JSON.stringify(
1118
+ PromptTokensDetails$outboundSchema.parse(promptTokensDetails),
1119
+ );
1120
+ }
1121
+ export function promptTokensDetailsFromJSON(
1122
+ jsonString: string,
1123
+ ): SafeParseResult<PromptTokensDetails, SDKValidationError> {
1124
+ return safeParse(
1125
+ jsonString,
1126
+ (x) => PromptTokensDetails$inboundSchema.parse(JSON.parse(x)),
1127
+ `Failed to parse 'PromptTokensDetails' from JSON`,
1128
+ );
1129
+ }
1130
+
1131
+ /** @internal */
1132
+ export const CompletionTokensDetails$inboundSchema: z.ZodType<
1133
+ CompletionTokensDetails,
1134
+ z.ZodTypeDef,
1135
+ unknown
1136
+ > = z.object({
1137
+ reasoning_tokens: z.nullable(z.number()).optional(),
1138
+ accepted_prediction_tokens: z.nullable(z.number()).optional(),
1139
+ rejected_prediction_tokens: z.nullable(z.number()).optional(),
1140
+ audio_tokens: z.nullable(z.number().int()).optional(),
1141
+ }).transform((v) => {
1142
+ return remap$(v, {
1143
+ "reasoning_tokens": "reasoningTokens",
1144
+ "accepted_prediction_tokens": "acceptedPredictionTokens",
1145
+ "rejected_prediction_tokens": "rejectedPredictionTokens",
1146
+ "audio_tokens": "audioTokens",
1147
+ });
1148
+ });
1149
+ /** @internal */
1150
+ export type CompletionTokensDetails$Outbound = {
1151
+ reasoning_tokens?: number | null | undefined;
1152
+ accepted_prediction_tokens?: number | null | undefined;
1153
+ rejected_prediction_tokens?: number | null | undefined;
1154
+ audio_tokens?: number | null | undefined;
1155
+ };
1156
+
1157
+ /** @internal */
1158
+ export const CompletionTokensDetails$outboundSchema: z.ZodType<
1159
+ CompletionTokensDetails$Outbound,
1160
+ z.ZodTypeDef,
1161
+ CompletionTokensDetails
1162
+ > = z.object({
1163
+ reasoningTokens: z.nullable(z.number()).optional(),
1164
+ acceptedPredictionTokens: z.nullable(z.number()).optional(),
1165
+ rejectedPredictionTokens: z.nullable(z.number()).optional(),
1166
+ audioTokens: z.nullable(z.number().int()).optional(),
1167
+ }).transform((v) => {
1168
+ return remap$(v, {
1169
+ reasoningTokens: "reasoning_tokens",
1170
+ acceptedPredictionTokens: "accepted_prediction_tokens",
1171
+ rejectedPredictionTokens: "rejected_prediction_tokens",
1172
+ audioTokens: "audio_tokens",
1173
+ });
1174
+ });
1175
+
1176
+ export function completionTokensDetailsToJSON(
1177
+ completionTokensDetails: CompletionTokensDetails,
1178
+ ): string {
1179
+ return JSON.stringify(
1180
+ CompletionTokensDetails$outboundSchema.parse(completionTokensDetails),
1181
+ );
1182
+ }
1183
+ export function completionTokensDetailsFromJSON(
1184
+ jsonString: string,
1185
+ ): SafeParseResult<CompletionTokensDetails, SDKValidationError> {
1186
+ return safeParse(
1187
+ jsonString,
1188
+ (x) => CompletionTokensDetails$inboundSchema.parse(JSON.parse(x)),
1189
+ `Failed to parse 'CompletionTokensDetails' from JSON`,
1190
+ );
1191
+ }
1192
+
1193
+ /** @internal */
1194
+ export const CreateAgentResponseUsage$inboundSchema: z.ZodType<
1195
+ CreateAgentResponseUsage,
1196
+ z.ZodTypeDef,
1197
+ unknown
1198
+ > = z.object({
1199
+ completion_tokens: z.number().optional(),
1200
+ prompt_tokens: z.number().optional(),
1201
+ total_tokens: z.number().optional(),
1202
+ prompt_tokens_details: z.nullable(
1203
+ z.lazy(() => PromptTokensDetails$inboundSchema),
1204
+ ).optional(),
1205
+ completion_tokens_details: z.nullable(
1206
+ z.lazy(() => CompletionTokensDetails$inboundSchema),
1207
+ ).optional(),
1208
+ }).transform((v) => {
1209
+ return remap$(v, {
1210
+ "completion_tokens": "completionTokens",
1211
+ "prompt_tokens": "promptTokens",
1212
+ "total_tokens": "totalTokens",
1213
+ "prompt_tokens_details": "promptTokensDetails",
1214
+ "completion_tokens_details": "completionTokensDetails",
1215
+ });
1216
+ });
1217
+ /** @internal */
1218
+ export type CreateAgentResponseUsage$Outbound = {
1219
+ completion_tokens?: number | undefined;
1220
+ prompt_tokens?: number | undefined;
1221
+ total_tokens?: number | undefined;
1222
+ prompt_tokens_details?: PromptTokensDetails$Outbound | null | undefined;
1223
+ completion_tokens_details?:
1224
+ | CompletionTokensDetails$Outbound
1225
+ | null
1226
+ | undefined;
1227
+ };
1228
+
1229
+ /** @internal */
1230
+ export const CreateAgentResponseUsage$outboundSchema: z.ZodType<
1231
+ CreateAgentResponseUsage$Outbound,
1232
+ z.ZodTypeDef,
1233
+ CreateAgentResponseUsage
1234
+ > = z.object({
1235
+ completionTokens: z.number().optional(),
1236
+ promptTokens: z.number().optional(),
1237
+ totalTokens: z.number().optional(),
1238
+ promptTokensDetails: z.nullable(
1239
+ z.lazy(() => PromptTokensDetails$outboundSchema),
1240
+ ).optional(),
1241
+ completionTokensDetails: z.nullable(
1242
+ z.lazy(() => CompletionTokensDetails$outboundSchema),
1243
+ ).optional(),
1244
+ }).transform((v) => {
1245
+ return remap$(v, {
1246
+ completionTokens: "completion_tokens",
1247
+ promptTokens: "prompt_tokens",
1248
+ totalTokens: "total_tokens",
1249
+ promptTokensDetails: "prompt_tokens_details",
1250
+ completionTokensDetails: "completion_tokens_details",
1251
+ });
1252
+ });
1253
+
1254
+ export function createAgentResponseUsageToJSON(
1255
+ createAgentResponseUsage: CreateAgentResponseUsage,
1256
+ ): string {
1257
+ return JSON.stringify(
1258
+ CreateAgentResponseUsage$outboundSchema.parse(createAgentResponseUsage),
1259
+ );
1260
+ }
1261
+ export function createAgentResponseUsageFromJSON(
1262
+ jsonString: string,
1263
+ ): SafeParseResult<CreateAgentResponseUsage, SDKValidationError> {
1264
+ return safeParse(
1265
+ jsonString,
1266
+ (x) => CreateAgentResponseUsage$inboundSchema.parse(JSON.parse(x)),
1267
+ `Failed to parse 'CreateAgentResponseUsage' from JSON`,
1268
+ );
1269
+ }
1270
+
1271
+ /** @internal */
1272
+ export const CreateAgentResponseResponseBody$inboundSchema: z.ZodType<
1273
+ CreateAgentResponseResponseBody,
1274
+ z.ZodTypeDef,
1275
+ unknown
1276
+ > = z.object({
1277
+ _id: z.string(),
1278
+ task_id: z.string(),
1279
+ output: z.array(z.lazy(() => Output$inboundSchema)),
1280
+ created_at: z.string(),
1281
+ model: z.string(),
1282
+ usage: z.nullable(z.lazy(() => CreateAgentResponseUsage$inboundSchema))
1283
+ .optional(),
1284
+ }).transform((v) => {
1285
+ return remap$(v, {
1286
+ "_id": "id",
1287
+ "task_id": "taskId",
1288
+ "created_at": "createdAt",
1289
+ });
1290
+ });
1291
+ /** @internal */
1292
+ export type CreateAgentResponseResponseBody$Outbound = {
1293
+ _id: string;
1294
+ task_id: string;
1295
+ output: Array<Output$Outbound>;
1296
+ created_at: string;
1297
+ model: string;
1298
+ usage?: CreateAgentResponseUsage$Outbound | null | undefined;
1299
+ };
1300
+
1301
+ /** @internal */
1302
+ export const CreateAgentResponseResponseBody$outboundSchema: z.ZodType<
1303
+ CreateAgentResponseResponseBody$Outbound,
1304
+ z.ZodTypeDef,
1305
+ CreateAgentResponseResponseBody
1306
+ > = z.object({
1307
+ id: z.string(),
1308
+ taskId: z.string(),
1309
+ output: z.array(z.lazy(() => Output$outboundSchema)),
1310
+ createdAt: z.string(),
1311
+ model: z.string(),
1312
+ usage: z.nullable(z.lazy(() => CreateAgentResponseUsage$outboundSchema))
1313
+ .optional(),
1314
+ }).transform((v) => {
1315
+ return remap$(v, {
1316
+ id: "_id",
1317
+ taskId: "task_id",
1318
+ createdAt: "created_at",
1319
+ });
1320
+ });
1321
+
1322
+ export function createAgentResponseResponseBodyToJSON(
1323
+ createAgentResponseResponseBody: CreateAgentResponseResponseBody,
1324
+ ): string {
1325
+ return JSON.stringify(
1326
+ CreateAgentResponseResponseBody$outboundSchema.parse(
1327
+ createAgentResponseResponseBody,
1328
+ ),
1329
+ );
1330
+ }
1331
+ export function createAgentResponseResponseBodyFromJSON(
1332
+ jsonString: string,
1333
+ ): SafeParseResult<CreateAgentResponseResponseBody, SDKValidationError> {
1334
+ return safeParse(
1335
+ jsonString,
1336
+ (x) => CreateAgentResponseResponseBody$inboundSchema.parse(JSON.parse(x)),
1337
+ `Failed to parse 'CreateAgentResponseResponseBody' from JSON`,
1338
+ );
1339
+ }