@orq-ai/node 4.5.0-rc.26 → 4.5.0-rc.33

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 (222) hide show
  1. package/README.md +38 -28
  2. package/funcs/agentsList.d.ts +1 -1
  3. package/funcs/agentsList.d.ts.map +1 -1
  4. package/funcs/agentsList.js +5 -3
  5. package/funcs/agentsList.js.map +1 -1
  6. package/funcs/agentsPostV2AgentsA2a.d.ts +18 -0
  7. package/funcs/agentsPostV2AgentsA2a.d.ts.map +1 -0
  8. package/funcs/agentsPostV2AgentsA2a.js +120 -0
  9. package/funcs/agentsPostV2AgentsA2a.js.map +1 -0
  10. package/funcs/agentsPostV2AgentsKeyCardRefresh.d.ts +18 -0
  11. package/funcs/agentsPostV2AgentsKeyCardRefresh.d.ts.map +1 -0
  12. package/funcs/agentsPostV2AgentsKeyCardRefresh.js +124 -0
  13. package/funcs/agentsPostV2AgentsKeyCardRefresh.js.map +1 -0
  14. package/funcs/agentsResponsesGet.d.ts +19 -0
  15. package/funcs/agentsResponsesGet.d.ts.map +1 -0
  16. package/funcs/agentsResponsesGet.js +128 -0
  17. package/funcs/agentsResponsesGet.js.map +1 -0
  18. package/funcs/agentsUpdate.d.ts +1 -1
  19. package/funcs/agentsUpdate.d.ts.map +1 -1
  20. package/funcs/agentsUpdate.js.map +1 -1
  21. package/jsr.json +1 -1
  22. package/lib/config.d.ts +3 -3
  23. package/lib/config.js +3 -3
  24. package/models/components/extendedmessage.d.ts +71 -0
  25. package/models/components/extendedmessage.d.ts.map +1 -0
  26. package/models/components/extendedmessage.js +98 -0
  27. package/models/components/extendedmessage.js.map +1 -0
  28. package/models/components/getagentresponse.d.ts +157 -0
  29. package/models/components/getagentresponse.d.ts.map +1 -0
  30. package/models/components/getagentresponse.js +175 -0
  31. package/models/components/getagentresponse.js.map +1 -0
  32. package/models/components/index.d.ts +2 -0
  33. package/models/components/index.d.ts.map +1 -1
  34. package/models/components/index.js +2 -0
  35. package/models/components/index.js.map +1 -1
  36. package/models/components/partdoneevent.js +1 -1
  37. package/models/components/reasoningpart.js +1 -1
  38. package/models/errors/index.d.ts +2 -0
  39. package/models/errors/index.d.ts.map +1 -1
  40. package/models/errors/index.js +2 -0
  41. package/models/errors/index.js.map +1 -1
  42. package/models/errors/postv2agentsa2a.d.ts +43 -0
  43. package/models/errors/postv2agentsa2a.d.ts.map +1 -0
  44. package/models/errors/postv2agentsa2a.js +94 -0
  45. package/models/errors/postv2agentsa2a.js.map +1 -0
  46. package/models/errors/postv2agentskeycardrefresh.d.ts +43 -0
  47. package/models/errors/postv2agentskeycardrefresh.d.ts.map +1 -0
  48. package/models/errors/postv2agentskeycardrefresh.js +94 -0
  49. package/models/errors/postv2agentskeycardrefresh.js.map +1 -0
  50. package/models/operations/createagentrequest.d.ts +309 -142
  51. package/models/operations/createagentrequest.d.ts.map +1 -1
  52. package/models/operations/createagentrequest.js +292 -160
  53. package/models/operations/createagentrequest.js.map +1 -1
  54. package/models/operations/createagentresponserequest.d.ts +22 -1
  55. package/models/operations/createagentresponserequest.d.ts.map +1 -1
  56. package/models/operations/createagentresponserequest.js +10 -1
  57. package/models/operations/createagentresponserequest.js.map +1 -1
  58. package/models/operations/createannotation.d.ts +1 -1
  59. package/models/operations/createannotation.d.ts.map +1 -1
  60. package/models/operations/createannotation.js +4 -0
  61. package/models/operations/createannotation.js.map +1 -1
  62. package/models/operations/createcontact.js +1 -1
  63. package/models/operations/createdataset.js +1 -1
  64. package/models/operations/createdatasetitem.js +4 -4
  65. package/models/operations/createdatasource.js +1 -1
  66. package/models/operations/createeval.js +16 -16
  67. package/models/operations/createidentity.js +1 -1
  68. package/models/operations/createknowledge.d.ts +7 -7
  69. package/models/operations/createknowledge.d.ts.map +1 -1
  70. package/models/operations/createknowledge.js +11 -11
  71. package/models/operations/createknowledge.js.map +1 -1
  72. package/models/operations/createtool.d.ts +39 -39
  73. package/models/operations/createtool.d.ts.map +1 -1
  74. package/models/operations/createtool.js +52 -49
  75. package/models/operations/createtool.js.map +1 -1
  76. package/models/operations/deploymentinvoke.d.ts +14 -0
  77. package/models/operations/deploymentinvoke.d.ts.map +1 -1
  78. package/models/operations/deploymentinvoke.js +16 -1
  79. package/models/operations/deploymentinvoke.js.map +1 -1
  80. package/models/operations/deploymentstream.d.ts +14 -0
  81. package/models/operations/deploymentstream.d.ts.map +1 -1
  82. package/models/operations/deploymentstream.js +16 -1
  83. package/models/operations/deploymentstream.js.map +1 -1
  84. package/models/operations/fileget.js +1 -1
  85. package/models/operations/filelist.js +1 -1
  86. package/models/operations/fileupload.js +1 -1
  87. package/models/operations/getagentresponse.d.ts +20 -0
  88. package/models/operations/getagentresponse.d.ts.map +1 -0
  89. package/models/operations/getagentresponse.js +56 -0
  90. package/models/operations/getagentresponse.js.map +1 -0
  91. package/models/operations/getalltools.d.ts +39 -39
  92. package/models/operations/getalltools.d.ts.map +1 -1
  93. package/models/operations/getalltools.js +49 -47
  94. package/models/operations/getalltools.js.map +1 -1
  95. package/models/operations/getevals.js +16 -16
  96. package/models/operations/index.d.ts +3 -0
  97. package/models/operations/index.d.ts.map +1 -1
  98. package/models/operations/index.js +3 -0
  99. package/models/operations/index.js.map +1 -1
  100. package/models/operations/invokeagent.d.ts +26 -1
  101. package/models/operations/invokeagent.d.ts.map +1 -1
  102. package/models/operations/invokeagent.js +12 -1
  103. package/models/operations/invokeagent.js.map +1 -1
  104. package/models/operations/listagents.d.ts +331 -147
  105. package/models/operations/listagents.d.ts.map +1 -1
  106. package/models/operations/listagents.js +314 -171
  107. package/models/operations/listagents.js.map +1 -1
  108. package/models/operations/listdatasetdatapoints.js +4 -4
  109. package/models/operations/listdatasets.js +1 -1
  110. package/models/operations/listdatasources.js +1 -1
  111. package/models/operations/listidentities.js +1 -1
  112. package/models/operations/listknowledgebases.d.ts +8 -8
  113. package/models/operations/listknowledgebases.d.ts.map +1 -1
  114. package/models/operations/listknowledgebases.js +13 -15
  115. package/models/operations/listknowledgebases.js.map +1 -1
  116. package/models/operations/postv2agentsa2a.d.ts +119 -0
  117. package/models/operations/postv2agentsa2a.d.ts.map +1 -0
  118. package/models/operations/postv2agentsa2a.js +147 -0
  119. package/models/operations/postv2agentsa2a.js.map +1 -0
  120. package/models/operations/postv2agentskeycardrefresh.d.ts +35 -0
  121. package/models/operations/postv2agentskeycardrefresh.d.ts.map +1 -0
  122. package/models/operations/postv2agentskeycardrefresh.js +71 -0
  123. package/models/operations/postv2agentskeycardrefresh.js.map +1 -0
  124. package/models/operations/retrieveagentrequest.d.ts +316 -150
  125. package/models/operations/retrieveagentrequest.d.ts.map +1 -1
  126. package/models/operations/retrieveagentrequest.js +307 -173
  127. package/models/operations/retrieveagentrequest.js.map +1 -1
  128. package/models/operations/retrievedatapoint.js +4 -4
  129. package/models/operations/retrievedataset.js +1 -1
  130. package/models/operations/retrievedatasource.js +1 -1
  131. package/models/operations/retrieveidentity.js +1 -1
  132. package/models/operations/retrievetool.js +6 -6
  133. package/models/operations/runagent.d.ts +15 -11
  134. package/models/operations/runagent.d.ts.map +1 -1
  135. package/models/operations/runagent.js +12 -12
  136. package/models/operations/runagent.js.map +1 -1
  137. package/models/operations/streamagent.d.ts +22 -1
  138. package/models/operations/streamagent.d.ts.map +1 -1
  139. package/models/operations/streamagent.js +11 -1
  140. package/models/operations/streamagent.js.map +1 -1
  141. package/models/operations/streamrunagent.d.ts +1 -1
  142. package/models/operations/streamrunagent.js +1 -1
  143. package/models/operations/updateagent.d.ts +370 -157
  144. package/models/operations/updateagent.d.ts.map +1 -1
  145. package/models/operations/updateagent.js +336 -179
  146. package/models/operations/updateagent.js.map +1 -1
  147. package/models/operations/updatedatapoint.js +4 -4
  148. package/models/operations/updatedataset.js +1 -1
  149. package/models/operations/updatedatasource.js +1 -1
  150. package/models/operations/updateeval.js +16 -16
  151. package/models/operations/updateidentity.js +1 -1
  152. package/models/operations/updatetool.js +7 -7
  153. package/package.json +1 -1
  154. package/sdk/agents.d.ts +16 -2
  155. package/sdk/agents.d.ts.map +1 -1
  156. package/sdk/agents.js +22 -2
  157. package/sdk/agents.js.map +1 -1
  158. package/sdk/responses.d.ts +8 -0
  159. package/sdk/responses.d.ts.map +1 -1
  160. package/sdk/responses.js +10 -0
  161. package/sdk/responses.js.map +1 -1
  162. package/src/funcs/agentsList.ts +5 -0
  163. package/src/funcs/agentsPostV2AgentsA2a.ts +178 -0
  164. package/src/funcs/agentsPostV2AgentsKeyCardRefresh.ts +187 -0
  165. package/src/funcs/agentsResponsesGet.ts +182 -0
  166. package/src/funcs/agentsUpdate.ts +2 -2
  167. package/src/lib/config.ts +3 -3
  168. package/src/models/components/extendedmessage.ts +146 -0
  169. package/src/models/components/getagentresponse.ts +348 -0
  170. package/src/models/components/index.ts +2 -0
  171. package/src/models/components/partdoneevent.ts +1 -1
  172. package/src/models/components/reasoningpart.ts +1 -1
  173. package/src/models/errors/index.ts +2 -0
  174. package/src/models/errors/postv2agentsa2a.ts +96 -0
  175. package/src/models/errors/postv2agentskeycardrefresh.ts +97 -0
  176. package/src/models/operations/createagentrequest.ts +714 -360
  177. package/src/models/operations/createagentresponserequest.ts +35 -1
  178. package/src/models/operations/createannotation.ts +5 -1
  179. package/src/models/operations/createcontact.ts +1 -1
  180. package/src/models/operations/createdataset.ts +1 -1
  181. package/src/models/operations/createdatasetitem.ts +4 -4
  182. package/src/models/operations/createdatasource.ts +1 -1
  183. package/src/models/operations/createeval.ts +16 -16
  184. package/src/models/operations/createidentity.ts +1 -1
  185. package/src/models/operations/createknowledge.ts +19 -17
  186. package/src/models/operations/createtool.ts +103 -91
  187. package/src/models/operations/deploymentinvoke.ts +38 -0
  188. package/src/models/operations/deploymentstream.ts +38 -0
  189. package/src/models/operations/fileget.ts +1 -1
  190. package/src/models/operations/filelist.ts +1 -1
  191. package/src/models/operations/fileupload.ts +1 -1
  192. package/src/models/operations/getagentresponse.ts +46 -0
  193. package/src/models/operations/getalltools.ts +93 -87
  194. package/src/models/operations/getevals.ts +16 -16
  195. package/src/models/operations/index.ts +3 -0
  196. package/src/models/operations/invokeagent.ts +45 -1
  197. package/src/models/operations/listagents.ts +723 -366
  198. package/src/models/operations/listdatasetdatapoints.ts +4 -4
  199. package/src/models/operations/listdatasets.ts +1 -1
  200. package/src/models/operations/listdatasources.ts +1 -1
  201. package/src/models/operations/listidentities.ts +1 -1
  202. package/src/models/operations/listknowledgebases.ts +72 -64
  203. package/src/models/operations/postv2agentsa2a.ts +252 -0
  204. package/src/models/operations/postv2agentskeycardrefresh.ts +100 -0
  205. package/src/models/operations/retrieveagentrequest.ts +975 -468
  206. package/src/models/operations/retrievedatapoint.ts +4 -4
  207. package/src/models/operations/retrievedataset.ts +1 -1
  208. package/src/models/operations/retrievedatasource.ts +1 -1
  209. package/src/models/operations/retrieveidentity.ts +1 -1
  210. package/src/models/operations/retrievetool.ts +6 -6
  211. package/src/models/operations/runagent.ts +35 -21
  212. package/src/models/operations/streamagent.ts +40 -1
  213. package/src/models/operations/streamrunagent.ts +2 -2
  214. package/src/models/operations/updateagent.ts +876 -385
  215. package/src/models/operations/updatedatapoint.ts +4 -4
  216. package/src/models/operations/updatedataset.ts +1 -1
  217. package/src/models/operations/updatedatasource.ts +1 -1
  218. package/src/models/operations/updateeval.ts +16 -16
  219. package/src/models/operations/updateidentity.ts +1 -1
  220. package/src/models/operations/updatetool.ts +7 -7
  221. package/src/sdk/agents.ts +39 -1
  222. package/src/sdk/responses.ts +19 -0
@@ -0,0 +1,182 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { OrqCore } from "../core.js";
6
+ import { encodeSimple } from "../lib/encodings.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { RequestOptions } from "../lib/sdks.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
13
+ import * as components from "../models/components/index.js";
14
+ import {
15
+ ConnectionError,
16
+ InvalidRequestError,
17
+ RequestAbortedError,
18
+ RequestTimeoutError,
19
+ UnexpectedClientError,
20
+ } from "../models/errors/httpclienterrors.js";
21
+ import * as errors from "../models/errors/index.js";
22
+ import { OrqError } from "../models/errors/orqerror.js";
23
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
24
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
25
+ import * as operations from "../models/operations/index.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * Get response
31
+ *
32
+ * @remarks
33
+ * Retrieves the current state of an agent response by task ID. Returns the response output, model information, token usage, and execution status. When the agent is still processing, the output array will be empty and status will be `in_progress`. Once completed, the response includes the full output, usage statistics, and finish reason.
34
+ */
35
+ export function agentsResponsesGet(
36
+ client: OrqCore,
37
+ request: operations.GetAgentResponseRequest,
38
+ options?: RequestOptions,
39
+ ): APIPromise<
40
+ Result<
41
+ components.GetAgentResponse,
42
+ | errors.HonoApiError
43
+ | OrqError
44
+ | ResponseValidationError
45
+ | ConnectionError
46
+ | RequestAbortedError
47
+ | RequestTimeoutError
48
+ | InvalidRequestError
49
+ | UnexpectedClientError
50
+ | SDKValidationError
51
+ >
52
+ > {
53
+ return new APIPromise($do(
54
+ client,
55
+ request,
56
+ options,
57
+ ));
58
+ }
59
+
60
+ async function $do(
61
+ client: OrqCore,
62
+ request: operations.GetAgentResponseRequest,
63
+ options?: RequestOptions,
64
+ ): Promise<
65
+ [
66
+ Result<
67
+ components.GetAgentResponse,
68
+ | errors.HonoApiError
69
+ | OrqError
70
+ | ResponseValidationError
71
+ | ConnectionError
72
+ | RequestAbortedError
73
+ | RequestTimeoutError
74
+ | InvalidRequestError
75
+ | UnexpectedClientError
76
+ | SDKValidationError
77
+ >,
78
+ APICall,
79
+ ]
80
+ > {
81
+ const parsed = safeParse(
82
+ request,
83
+ (value) => operations.GetAgentResponseRequest$outboundSchema.parse(value),
84
+ "Input validation failed",
85
+ );
86
+ if (!parsed.ok) {
87
+ return [parsed, { status: "invalid" }];
88
+ }
89
+ const payload = parsed.value;
90
+ const body = null;
91
+
92
+ const pathParams = {
93
+ agent_key: encodeSimple("agent_key", payload.agent_key, {
94
+ explode: false,
95
+ charEncoding: "percent",
96
+ }),
97
+ task_id: encodeSimple("task_id", payload.task_id, {
98
+ explode: false,
99
+ charEncoding: "percent",
100
+ }),
101
+ };
102
+
103
+ const path = pathToFunc("/v2/agents/{agent_key}/responses/{task_id}")(
104
+ pathParams,
105
+ );
106
+
107
+ const headers = new Headers(compactMap({
108
+ Accept: "application/json",
109
+ }));
110
+
111
+ const secConfig = await extractSecurity(client._options.apiKey);
112
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
113
+ const requestSecurity = resolveGlobalSecurity(securityInput);
114
+
115
+ const context = {
116
+ options: client._options,
117
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
118
+ operationID: "GetAgentResponse",
119
+ oAuth2Scopes: null,
120
+
121
+ resolvedSecurity: requestSecurity,
122
+
123
+ securitySource: client._options.apiKey,
124
+ retryConfig: options?.retries
125
+ || client._options.retryConfig
126
+ || { strategy: "none" },
127
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
128
+ };
129
+
130
+ const requestRes = client._createRequest(context, {
131
+ security: requestSecurity,
132
+ method: "GET",
133
+ baseURL: options?.serverURL,
134
+ path: path,
135
+ headers: headers,
136
+ body: body,
137
+ userAgent: client._options.userAgent,
138
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
139
+ }, options);
140
+ if (!requestRes.ok) {
141
+ return [requestRes, { status: "invalid" }];
142
+ }
143
+ const req = requestRes.value;
144
+
145
+ const doResult = await client._do(req, {
146
+ context,
147
+ errorCodes: ["404", "4XX", "5XX"],
148
+ retryConfig: context.retryConfig,
149
+ retryCodes: context.retryCodes,
150
+ });
151
+ if (!doResult.ok) {
152
+ return [doResult, { status: "request-error", request: req }];
153
+ }
154
+ const response = doResult.value;
155
+
156
+ const responseFields = {
157
+ HttpMeta: { Response: response, Request: req },
158
+ };
159
+
160
+ const [result] = await M.match<
161
+ components.GetAgentResponse,
162
+ | errors.HonoApiError
163
+ | OrqError
164
+ | ResponseValidationError
165
+ | ConnectionError
166
+ | RequestAbortedError
167
+ | RequestTimeoutError
168
+ | InvalidRequestError
169
+ | UnexpectedClientError
170
+ | SDKValidationError
171
+ >(
172
+ M.json(200, components.GetAgentResponse$inboundSchema),
173
+ M.jsonErr(404, errors.HonoApiError$inboundSchema),
174
+ M.fail("4XX"),
175
+ M.fail("5XX"),
176
+ )(response, req, { extraFields: responseFields });
177
+ if (!result.ok) {
178
+ return [result, { status: "complete", request: req, response }];
179
+ }
180
+
181
+ return [result, { status: "complete", request: req, response }];
182
+ }
@@ -33,7 +33,7 @@ import { Result } from "../types/fp.js";
33
33
  */
34
34
  export function agentsUpdate(
35
35
  client: OrqCore,
36
- requestBody: operations.UpdateAgentUpdateAgentRequest,
36
+ requestBody: operations.UpdateAgentRequestBody,
37
37
  agentKey: string,
38
38
  options?: RequestOptions,
39
39
  ): APIPromise<
@@ -60,7 +60,7 @@ export function agentsUpdate(
60
60
 
61
61
  async function $do(
62
62
  client: OrqCore,
63
- requestBody: operations.UpdateAgentUpdateAgentRequest,
63
+ requestBody: operations.UpdateAgentRequestBody,
64
64
  agentKey: string,
65
65
  options?: RequestOptions,
66
66
  ): Promise<
package/src/lib/config.ts CHANGED
@@ -68,7 +68,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
68
68
  export const SDK_METADATA = {
69
69
  language: "typescript",
70
70
  openapiDocVersion: "2.0",
71
- sdkVersion: "4.5.0-rc.26",
72
- genVersion: "2.846.4",
73
- userAgent: "speakeasy-sdk/typescript 4.5.0-rc.26 2.846.4 2.0 @orq-ai/node",
71
+ sdkVersion: "4.5.0-rc.33",
72
+ genVersion: "2.849.8",
73
+ userAgent: "speakeasy-sdk/typescript 4.5.0-rc.33 2.849.8 2.0 @orq-ai/node",
74
74
  } as const;
@@ -0,0 +1,146 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { safeParse } from "../../lib/schemas.js";
7
+ import { ClosedEnum } from "../../types/enums.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+ import { DataPart, DataPart$inboundSchema } from "./datapart.js";
11
+ import { ErrorPart, ErrorPart$inboundSchema } from "./errorpart.js";
12
+ import { FilePart, FilePart$inboundSchema } from "./filepart.js";
13
+ import { TextPart, TextPart$inboundSchema } from "./textpart.js";
14
+ import { ToolCallPart, ToolCallPart$inboundSchema } from "./toolcallpart.js";
15
+ import {
16
+ ToolResultPart,
17
+ ToolResultPart$inboundSchema,
18
+ } from "./toolresultpart.js";
19
+
20
+ export const ExtendedMessageKind = {
21
+ Message: "message",
22
+ } as const;
23
+ export type ExtendedMessageKind = ClosedEnum<typeof ExtendedMessageKind>;
24
+
25
+ /**
26
+ * Role of the message sender in the A2A protocol. Values: user (end user), agent (AI agent), tool (tool execution result), system (system instructions/prompts).
27
+ */
28
+ export const ExtendedMessageRole = {
29
+ User: "user",
30
+ Agent: "agent",
31
+ Tool: "tool",
32
+ System: "system",
33
+ } as const;
34
+ /**
35
+ * Role of the message sender in the A2A protocol. Values: user (end user), agent (AI agent), tool (tool execution result), system (system instructions/prompts).
36
+ */
37
+ export type ExtendedMessageRole = ClosedEnum<typeof ExtendedMessageRole>;
38
+
39
+ export type ExtendedMessageParts =
40
+ | TextPart
41
+ | ErrorPart
42
+ | DataPart
43
+ | FilePart
44
+ | ToolCallPart
45
+ | ToolResultPart;
46
+
47
+ /**
48
+ * Extended Agent-to-Agent protocol message with support for tool calls and tool results. Extends the base A2A message format with Orquesta-specific features.
49
+ */
50
+ export type ExtendedMessage = {
51
+ kind: ExtendedMessageKind;
52
+ /**
53
+ * Unique identifier for the message
54
+ */
55
+ messageId: string;
56
+ /**
57
+ * Role of the message sender in the A2A protocol. Values: user (end user), agent (AI agent), tool (tool execution result), system (system instructions/prompts).
58
+ */
59
+ role: ExtendedMessageRole;
60
+ /**
61
+ * Array of message parts (text, file, tool_call, tool_result)
62
+ */
63
+ parts: Array<
64
+ TextPart | ErrorPart | DataPart | FilePart | ToolCallPart | ToolResultPart
65
+ >;
66
+ /**
67
+ * Associated task ID if applicable
68
+ */
69
+ taskId?: string | undefined;
70
+ /**
71
+ * Correlation ID for execution tracking
72
+ */
73
+ contextId?: string | undefined;
74
+ /**
75
+ * Additional message metadata
76
+ */
77
+ metadata?: { [k: string]: any } | undefined;
78
+ };
79
+
80
+ /** @internal */
81
+ export const ExtendedMessageKind$inboundSchema: z.ZodNativeEnum<
82
+ typeof ExtendedMessageKind
83
+ > = z.nativeEnum(ExtendedMessageKind);
84
+
85
+ /** @internal */
86
+ export const ExtendedMessageRole$inboundSchema: z.ZodNativeEnum<
87
+ typeof ExtendedMessageRole
88
+ > = z.nativeEnum(ExtendedMessageRole);
89
+
90
+ /** @internal */
91
+ export const ExtendedMessageParts$inboundSchema: z.ZodType<
92
+ ExtendedMessageParts,
93
+ z.ZodTypeDef,
94
+ unknown
95
+ > = z.union([
96
+ TextPart$inboundSchema,
97
+ ErrorPart$inboundSchema,
98
+ DataPart$inboundSchema,
99
+ FilePart$inboundSchema,
100
+ ToolCallPart$inboundSchema,
101
+ ToolResultPart$inboundSchema,
102
+ ]);
103
+
104
+ export function extendedMessagePartsFromJSON(
105
+ jsonString: string,
106
+ ): SafeParseResult<ExtendedMessageParts, SDKValidationError> {
107
+ return safeParse(
108
+ jsonString,
109
+ (x) => ExtendedMessageParts$inboundSchema.parse(JSON.parse(x)),
110
+ `Failed to parse 'ExtendedMessageParts' from JSON`,
111
+ );
112
+ }
113
+
114
+ /** @internal */
115
+ export const ExtendedMessage$inboundSchema: z.ZodType<
116
+ ExtendedMessage,
117
+ z.ZodTypeDef,
118
+ unknown
119
+ > = z.object({
120
+ kind: ExtendedMessageKind$inboundSchema,
121
+ messageId: z.string(),
122
+ role: ExtendedMessageRole$inboundSchema,
123
+ parts: z.array(
124
+ z.union([
125
+ TextPart$inboundSchema,
126
+ ErrorPart$inboundSchema,
127
+ DataPart$inboundSchema,
128
+ FilePart$inboundSchema,
129
+ ToolCallPart$inboundSchema,
130
+ ToolResultPart$inboundSchema,
131
+ ]),
132
+ ),
133
+ taskId: z.string().optional(),
134
+ contextId: z.string().optional(),
135
+ metadata: z.record(z.any()).optional(),
136
+ });
137
+
138
+ export function extendedMessageFromJSON(
139
+ jsonString: string,
140
+ ): SafeParseResult<ExtendedMessage, SDKValidationError> {
141
+ return safeParse(
142
+ jsonString,
143
+ (x) => ExtendedMessage$inboundSchema.parse(JSON.parse(x)),
144
+ `Failed to parse 'ExtendedMessage' from JSON`,
145
+ );
146
+ }
@@ -0,0 +1,348 @@
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
+ AgentResponseMessage,
13
+ AgentResponseMessage$inboundSchema,
14
+ } from "./agentresponsemessage.js";
15
+ import { Telemetry, Telemetry$inboundSchema } from "./telemetry.js";
16
+
17
+ export type GetAgentResponsePromptTokensDetails = {
18
+ cachedTokens?: number | null | undefined;
19
+ cacheCreationTokens?: number | null | undefined;
20
+ /**
21
+ * The number of audio input tokens consumed by the request.
22
+ */
23
+ audioTokens?: number | null | undefined;
24
+ };
25
+
26
+ export type GetAgentResponseCompletionTokensDetails = {
27
+ reasoningTokens?: number | null | undefined;
28
+ acceptedPredictionTokens?: number | null | undefined;
29
+ rejectedPredictionTokens?: number | null | undefined;
30
+ /**
31
+ * The number of audio output tokens produced by the response.
32
+ */
33
+ audioTokens?: number | null | undefined;
34
+ };
35
+
36
+ /**
37
+ * Token usage from the agent execution
38
+ */
39
+ export type GetAgentResponseUsage = {
40
+ /**
41
+ * Number of tokens in the generated completion.
42
+ */
43
+ completionTokens?: number | undefined;
44
+ /**
45
+ * Number of tokens in the prompt.
46
+ */
47
+ promptTokens?: number | undefined;
48
+ /**
49
+ * Total number of tokens used in the request (prompt + completion).
50
+ */
51
+ totalTokens?: number | undefined;
52
+ promptTokensDetails?: GetAgentResponsePromptTokensDetails | null | undefined;
53
+ completionTokensDetails?:
54
+ | GetAgentResponseCompletionTokensDetails
55
+ | null
56
+ | undefined;
57
+ };
58
+
59
+ /**
60
+ * The reason why the agent stopped generating
61
+ */
62
+ export const GetAgentResponseFinishReason = {
63
+ Stop: "stop",
64
+ Length: "length",
65
+ ToolCalls: "tool_calls",
66
+ ContentFilter: "content_filter",
67
+ FunctionCall: "function_call",
68
+ MaxIterations: "max_iterations",
69
+ MaxTime: "max_time",
70
+ } as const;
71
+ /**
72
+ * The reason why the agent stopped generating
73
+ */
74
+ export type GetAgentResponseFinishReason = ClosedEnum<
75
+ typeof GetAgentResponseFinishReason
76
+ >;
77
+
78
+ export const GetAgentResponseType = {
79
+ Function: "function",
80
+ } as const;
81
+ export type GetAgentResponseType = ClosedEnum<typeof GetAgentResponseType>;
82
+
83
+ export type GetAgentResponseFunction = {
84
+ name?: string | undefined;
85
+ arguments?: string | undefined;
86
+ };
87
+
88
+ export type GetAgentResponsePendingToolCalls = {
89
+ id: string;
90
+ type: GetAgentResponseType;
91
+ function: GetAgentResponseFunction;
92
+ };
93
+
94
+ /**
95
+ * Current status of the agent response
96
+ */
97
+ export const Status = {
98
+ InProgress: "in_progress",
99
+ Completed: "completed",
100
+ Failed: "failed",
101
+ } as const;
102
+ /**
103
+ * Current status of the agent response
104
+ */
105
+ export type Status = ClosedEnum<typeof Status>;
106
+
107
+ /**
108
+ * Response type from the get-response endpoint. Includes a status field indicating the current state of the agent execution.
109
+ */
110
+ export type GetAgentResponse = {
111
+ /**
112
+ * The unique response ID
113
+ */
114
+ id: string;
115
+ /**
116
+ * The agent execution task ID
117
+ */
118
+ taskId: string;
119
+ /**
120
+ * Array of messages from the agent execution
121
+ */
122
+ output: Array<AgentResponseMessage>;
123
+ /**
124
+ * ISO timestamp of response creation
125
+ */
126
+ createdAt: string;
127
+ /**
128
+ * Model used in provider/model format
129
+ */
130
+ model: string;
131
+ /**
132
+ * Token usage from the agent execution
133
+ */
134
+ usage?: GetAgentResponseUsage | null | undefined;
135
+ /**
136
+ * The reason why the agent stopped generating
137
+ */
138
+ finishReason?: GetAgentResponseFinishReason | undefined;
139
+ /**
140
+ * Tool calls awaiting user response (when finish_reason is function_call)
141
+ */
142
+ pendingToolCalls?: Array<GetAgentResponsePendingToolCalls> | undefined;
143
+ /**
144
+ * Telemetry information for correlating the response with traces
145
+ */
146
+ telemetry?: Telemetry | undefined;
147
+ /**
148
+ * Current status of the agent response
149
+ */
150
+ status: Status;
151
+ /**
152
+ * Error message when status is failed
153
+ */
154
+ error?: string | undefined;
155
+ };
156
+
157
+ /** @internal */
158
+ export const GetAgentResponsePromptTokensDetails$inboundSchema: z.ZodType<
159
+ GetAgentResponsePromptTokensDetails,
160
+ z.ZodTypeDef,
161
+ unknown
162
+ > = z.object({
163
+ cached_tokens: z.nullable(z.number().int()).optional(),
164
+ cache_creation_tokens: z.nullable(z.number().int()).optional(),
165
+ audio_tokens: z.nullable(z.number().int()).optional(),
166
+ }).transform((v) => {
167
+ return remap$(v, {
168
+ "cached_tokens": "cachedTokens",
169
+ "cache_creation_tokens": "cacheCreationTokens",
170
+ "audio_tokens": "audioTokens",
171
+ });
172
+ });
173
+
174
+ export function getAgentResponsePromptTokensDetailsFromJSON(
175
+ jsonString: string,
176
+ ): SafeParseResult<GetAgentResponsePromptTokensDetails, SDKValidationError> {
177
+ return safeParse(
178
+ jsonString,
179
+ (x) =>
180
+ GetAgentResponsePromptTokensDetails$inboundSchema.parse(JSON.parse(x)),
181
+ `Failed to parse 'GetAgentResponsePromptTokensDetails' from JSON`,
182
+ );
183
+ }
184
+
185
+ /** @internal */
186
+ export const GetAgentResponseCompletionTokensDetails$inboundSchema: z.ZodType<
187
+ GetAgentResponseCompletionTokensDetails,
188
+ z.ZodTypeDef,
189
+ unknown
190
+ > = z.object({
191
+ reasoning_tokens: z.nullable(z.number()).optional(),
192
+ accepted_prediction_tokens: z.nullable(z.number()).optional(),
193
+ rejected_prediction_tokens: z.nullable(z.number()).optional(),
194
+ audio_tokens: z.nullable(z.number().int()).optional(),
195
+ }).transform((v) => {
196
+ return remap$(v, {
197
+ "reasoning_tokens": "reasoningTokens",
198
+ "accepted_prediction_tokens": "acceptedPredictionTokens",
199
+ "rejected_prediction_tokens": "rejectedPredictionTokens",
200
+ "audio_tokens": "audioTokens",
201
+ });
202
+ });
203
+
204
+ export function getAgentResponseCompletionTokensDetailsFromJSON(
205
+ jsonString: string,
206
+ ): SafeParseResult<
207
+ GetAgentResponseCompletionTokensDetails,
208
+ SDKValidationError
209
+ > {
210
+ return safeParse(
211
+ jsonString,
212
+ (x) =>
213
+ GetAgentResponseCompletionTokensDetails$inboundSchema.parse(
214
+ JSON.parse(x),
215
+ ),
216
+ `Failed to parse 'GetAgentResponseCompletionTokensDetails' from JSON`,
217
+ );
218
+ }
219
+
220
+ /** @internal */
221
+ export const GetAgentResponseUsage$inboundSchema: z.ZodType<
222
+ GetAgentResponseUsage,
223
+ z.ZodTypeDef,
224
+ unknown
225
+ > = z.object({
226
+ completion_tokens: z.number().optional(),
227
+ prompt_tokens: z.number().optional(),
228
+ total_tokens: z.number().optional(),
229
+ prompt_tokens_details: z.nullable(
230
+ z.lazy(() => GetAgentResponsePromptTokensDetails$inboundSchema),
231
+ ).optional(),
232
+ completion_tokens_details: z.nullable(
233
+ z.lazy(() => GetAgentResponseCompletionTokensDetails$inboundSchema),
234
+ ).optional(),
235
+ }).transform((v) => {
236
+ return remap$(v, {
237
+ "completion_tokens": "completionTokens",
238
+ "prompt_tokens": "promptTokens",
239
+ "total_tokens": "totalTokens",
240
+ "prompt_tokens_details": "promptTokensDetails",
241
+ "completion_tokens_details": "completionTokensDetails",
242
+ });
243
+ });
244
+
245
+ export function getAgentResponseUsageFromJSON(
246
+ jsonString: string,
247
+ ): SafeParseResult<GetAgentResponseUsage, SDKValidationError> {
248
+ return safeParse(
249
+ jsonString,
250
+ (x) => GetAgentResponseUsage$inboundSchema.parse(JSON.parse(x)),
251
+ `Failed to parse 'GetAgentResponseUsage' from JSON`,
252
+ );
253
+ }
254
+
255
+ /** @internal */
256
+ export const GetAgentResponseFinishReason$inboundSchema: z.ZodNativeEnum<
257
+ typeof GetAgentResponseFinishReason
258
+ > = z.nativeEnum(GetAgentResponseFinishReason);
259
+
260
+ /** @internal */
261
+ export const GetAgentResponseType$inboundSchema: z.ZodNativeEnum<
262
+ typeof GetAgentResponseType
263
+ > = z.nativeEnum(GetAgentResponseType);
264
+
265
+ /** @internal */
266
+ export const GetAgentResponseFunction$inboundSchema: z.ZodType<
267
+ GetAgentResponseFunction,
268
+ z.ZodTypeDef,
269
+ unknown
270
+ > = z.object({
271
+ name: z.string().optional(),
272
+ arguments: z.string().optional(),
273
+ });
274
+
275
+ export function getAgentResponseFunctionFromJSON(
276
+ jsonString: string,
277
+ ): SafeParseResult<GetAgentResponseFunction, SDKValidationError> {
278
+ return safeParse(
279
+ jsonString,
280
+ (x) => GetAgentResponseFunction$inboundSchema.parse(JSON.parse(x)),
281
+ `Failed to parse 'GetAgentResponseFunction' from JSON`,
282
+ );
283
+ }
284
+
285
+ /** @internal */
286
+ export const GetAgentResponsePendingToolCalls$inboundSchema: z.ZodType<
287
+ GetAgentResponsePendingToolCalls,
288
+ z.ZodTypeDef,
289
+ unknown
290
+ > = z.object({
291
+ id: z.string(),
292
+ type: GetAgentResponseType$inboundSchema,
293
+ function: z.lazy(() => GetAgentResponseFunction$inboundSchema),
294
+ });
295
+
296
+ export function getAgentResponsePendingToolCallsFromJSON(
297
+ jsonString: string,
298
+ ): SafeParseResult<GetAgentResponsePendingToolCalls, SDKValidationError> {
299
+ return safeParse(
300
+ jsonString,
301
+ (x) => GetAgentResponsePendingToolCalls$inboundSchema.parse(JSON.parse(x)),
302
+ `Failed to parse 'GetAgentResponsePendingToolCalls' from JSON`,
303
+ );
304
+ }
305
+
306
+ /** @internal */
307
+ export const Status$inboundSchema: z.ZodNativeEnum<typeof Status> = z
308
+ .nativeEnum(Status);
309
+
310
+ /** @internal */
311
+ export const GetAgentResponse$inboundSchema: z.ZodType<
312
+ GetAgentResponse,
313
+ z.ZodTypeDef,
314
+ unknown
315
+ > = z.object({
316
+ _id: z.string(),
317
+ task_id: z.string(),
318
+ output: z.array(AgentResponseMessage$inboundSchema),
319
+ created_at: z.string(),
320
+ model: z.string(),
321
+ usage: z.nullable(z.lazy(() => GetAgentResponseUsage$inboundSchema))
322
+ .optional(),
323
+ finish_reason: GetAgentResponseFinishReason$inboundSchema.optional(),
324
+ pending_tool_calls: z.array(
325
+ z.lazy(() => GetAgentResponsePendingToolCalls$inboundSchema),
326
+ ).optional(),
327
+ telemetry: Telemetry$inboundSchema.optional(),
328
+ status: Status$inboundSchema,
329
+ error: z.string().optional(),
330
+ }).transform((v) => {
331
+ return remap$(v, {
332
+ "_id": "id",
333
+ "task_id": "taskId",
334
+ "created_at": "createdAt",
335
+ "finish_reason": "finishReason",
336
+ "pending_tool_calls": "pendingToolCalls",
337
+ });
338
+ });
339
+
340
+ export function getAgentResponseFromJSON(
341
+ jsonString: string,
342
+ ): SafeParseResult<GetAgentResponse, SDKValidationError> {
343
+ return safeParse(
344
+ jsonString,
345
+ (x) => GetAgentResponse$inboundSchema.parse(JSON.parse(x)),
346
+ `Failed to parse 'GetAgentResponse' from JSON`,
347
+ );
348
+ }