@orq-ai/node 4.16.6 → 4.16.8

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 (130) hide show
  1. package/jsr.json +1 -1
  2. package/lib/config.d.ts +2 -2
  3. package/lib/config.js +2 -2
  4. package/models/components/reasoningpart.js +1 -1
  5. package/models/operations/createtool.js +4 -4
  6. package/models/operations/getalltools.js +4 -4
  7. package/models/operations/getv2humanevalsets.js +2 -2
  8. package/models/operations/getv2humanevalsetsid.js +2 -2
  9. package/models/operations/patchv2humanevalsetsid.js +2 -2
  10. package/models/operations/postv2feedbackevaluation.js +4 -4
  11. package/models/operations/postv2humanevalsets.js +2 -2
  12. package/models/operations/retrievetool.js +4 -4
  13. package/models/operations/runagent.js +1 -1
  14. package/models/operations/streamrunagent.js +1 -1
  15. package/models/operations/updatetool.js +4 -4
  16. package/package.json +1 -1
  17. package/packages/orq-rc/src/funcs/agentsExternalCreate.ts +163 -0
  18. package/packages/orq-rc/src/funcs/agentsExternalDelete.ts +169 -0
  19. package/packages/orq-rc/src/funcs/agentsExternalList.ts +172 -0
  20. package/packages/orq-rc/src/funcs/agentsExternalRefreshCard.ts +174 -0
  21. package/packages/orq-rc/src/funcs/agentsExternalRetrieve.ts +168 -0
  22. package/packages/orq-rc/src/funcs/agentsExternalTestConnection.ts +174 -0
  23. package/packages/orq-rc/src/funcs/agentsExternalUpdate.ts +172 -0
  24. package/packages/orq-rc/src/funcs/agentsUpdate.ts +2 -2
  25. package/packages/orq-rc/src/funcs/monitorsCreate.ts +162 -0
  26. package/packages/orq-rc/src/funcs/monitorsDelete.ts +168 -0
  27. package/packages/orq-rc/src/funcs/monitorsGet.ts +168 -0
  28. package/packages/orq-rc/src/funcs/monitorsList.ts +173 -0
  29. package/packages/orq-rc/src/funcs/monitorsListPresets.ts +144 -0
  30. package/packages/orq-rc/src/funcs/monitorsUpdate.ts +171 -0
  31. package/packages/orq-rc/src/funcs/usersCreate.ts +171 -0
  32. package/packages/orq-rc/src/funcs/usersDelete.ts +168 -0
  33. package/packages/orq-rc/src/funcs/usersGet.ts +168 -0
  34. package/packages/orq-rc/src/funcs/usersList.ts +144 -0
  35. package/packages/orq-rc/src/funcs/usersUpdate.ts +169 -0
  36. package/packages/orq-rc/src/lib/config.ts +2 -2
  37. package/packages/orq-rc/src/models/components/autorouterv2config.ts +30 -0
  38. package/packages/orq-rc/src/models/components/autorouterv2creatorconfig.ts +4 -4
  39. package/packages/orq-rc/src/models/components/autorouterv2effortconfig.ts +24 -0
  40. package/packages/orq-rc/src/models/components/createexternalagentrequest.ts +73 -0
  41. package/packages/orq-rc/src/models/components/createexternalagentresponse.ts +32 -0
  42. package/packages/orq-rc/src/models/components/createmonitorrequest.ts +108 -0
  43. package/packages/orq-rc/src/models/components/createmonitorresponse.ts +35 -0
  44. package/packages/orq-rc/src/models/components/createusersrequest.ts +40 -0
  45. package/packages/orq-rc/src/models/components/createusersresponse.ts +32 -0
  46. package/packages/orq-rc/src/models/components/deleteexternalagentresponse.ts +27 -0
  47. package/packages/orq-rc/src/models/components/deletemonitorresponse.ts +27 -0
  48. package/packages/orq-rc/src/models/components/deleteuserresponse.ts +27 -0
  49. package/packages/orq-rc/src/models/components/externalagent.ts +107 -0
  50. package/packages/orq-rc/src/models/components/externalagentheader.ts +55 -0
  51. package/packages/orq-rc/src/models/components/getexternalagentresponse.ts +32 -0
  52. package/packages/orq-rc/src/models/components/getmonitorresponse.ts +35 -0
  53. package/packages/orq-rc/src/models/components/getuserresponse.ts +35 -0
  54. package/packages/orq-rc/src/models/components/index.ts +40 -0
  55. package/packages/orq-rc/src/models/components/listexternalagentsresponse.ts +41 -0
  56. package/packages/orq-rc/src/models/components/listmonitorpresetsresponse.ts +40 -0
  57. package/packages/orq-rc/src/models/components/listmonitorsresponse.ts +53 -0
  58. package/packages/orq-rc/src/models/components/listusersresponse.ts +32 -0
  59. package/packages/orq-rc/src/models/components/monitor.ts +133 -0
  60. package/packages/orq-rc/src/models/components/monitorpreset.ts +120 -0
  61. package/packages/orq-rc/src/models/components/monitortelemetrysource.ts +23 -0
  62. package/packages/orq-rc/src/models/components/monitorwidget.ts +145 -0
  63. package/packages/orq-rc/src/models/components/monitorwidgetcompute.ts +61 -0
  64. package/packages/orq-rc/src/models/components/monitorwidgetdisplay.ts +196 -0
  65. package/packages/orq-rc/src/models/components/monitorwidgetlayout.ts +75 -0
  66. package/packages/orq-rc/src/models/components/monitorwidgetquery.ts +165 -0
  67. package/packages/orq-rc/src/models/components/openaicontextmanagement.ts +43 -0
  68. package/packages/orq-rc/src/models/components/piiredactionconfig.ts +3 -2
  69. package/packages/orq-rc/src/models/components/piiredactionplugin.ts +1 -1
  70. package/packages/orq-rc/src/models/components/reasoningpart.ts +1 -1
  71. package/packages/orq-rc/src/models/components/refreshexternalagentcardrequest.ts +27 -0
  72. package/packages/orq-rc/src/models/components/refreshexternalagentcardresponse.ts +32 -0
  73. package/packages/orq-rc/src/models/components/testexternalagentconnectionrequest.ts +27 -0
  74. package/packages/orq-rc/src/models/components/testexternalagentconnectionresponse.ts +50 -0
  75. package/packages/orq-rc/src/models/components/thinkingparam.ts +112 -0
  76. package/packages/orq-rc/src/models/components/updateexternalagentrequest.ts +74 -0
  77. package/packages/orq-rc/src/models/components/updateexternalagentresponse.ts +32 -0
  78. package/packages/orq-rc/src/models/components/updatemonitorrequest.ts +80 -0
  79. package/packages/orq-rc/src/models/components/updatemonitorresponse.ts +35 -0
  80. package/packages/orq-rc/src/models/components/updateuserrequest.ts +42 -0
  81. package/packages/orq-rc/src/models/components/updateuserresponse.ts +35 -0
  82. package/packages/orq-rc/src/models/components/user.ts +90 -0
  83. package/packages/orq-rc/src/models/components/userinvitationdata.ts +38 -0
  84. package/packages/orq-rc/src/models/operations/createrouterresponse.ts +24 -0
  85. package/packages/orq-rc/src/models/operations/createtool.ts +4 -4
  86. package/packages/orq-rc/src/models/operations/externalagentdelete.ts +36 -0
  87. package/packages/orq-rc/src/models/operations/externalagentget.ts +36 -0
  88. package/packages/orq-rc/src/models/operations/externalagentlist.ts +43 -0
  89. package/packages/orq-rc/src/models/operations/externalagentrefreshcard.ts +45 -0
  90. package/packages/orq-rc/src/models/operations/externalagenttestconnection.ts +46 -0
  91. package/packages/orq-rc/src/models/operations/externalagentupdate.ts +42 -0
  92. package/packages/orq-rc/src/models/operations/getalltools.ts +4 -4
  93. package/packages/orq-rc/src/models/operations/getv2humanevalsets.ts +2 -2
  94. package/packages/orq-rc/src/models/operations/getv2humanevalsetsid.ts +2 -2
  95. package/packages/orq-rc/src/models/operations/index.ts +14 -0
  96. package/packages/orq-rc/src/models/operations/monitordelete.ts +39 -0
  97. package/packages/orq-rc/src/models/operations/monitorget.ts +39 -0
  98. package/packages/orq-rc/src/models/operations/monitorlist.ts +84 -0
  99. package/packages/orq-rc/src/models/operations/monitorupdate.ts +44 -0
  100. package/packages/orq-rc/src/models/operations/patchv2humanevalsetsid.ts +2 -2
  101. package/packages/orq-rc/src/models/operations/postv2feedbackevaluation.ts +4 -4
  102. package/packages/orq-rc/src/models/operations/postv2humanevalsets.ts +2 -2
  103. package/packages/orq-rc/src/models/operations/retrievetool.ts +4 -4
  104. package/packages/orq-rc/src/models/operations/runagent.ts +1 -1
  105. package/packages/orq-rc/src/models/operations/searchweb.ts +1 -1
  106. package/packages/orq-rc/src/models/operations/streamrunagent.ts +1 -1
  107. package/packages/orq-rc/src/models/operations/updateagent.ts +16 -11
  108. package/packages/orq-rc/src/models/operations/updatetool.ts +4 -4
  109. package/packages/orq-rc/src/models/operations/usercreate.ts +44 -0
  110. package/packages/orq-rc/src/models/operations/userdelete.ts +39 -0
  111. package/packages/orq-rc/src/models/operations/userget.ts +35 -0
  112. package/packages/orq-rc/src/models/operations/userupdate.ts +44 -0
  113. package/packages/orq-rc/src/sdk/agents.ts +7 -1
  114. package/packages/orq-rc/src/sdk/external.ts +136 -0
  115. package/packages/orq-rc/src/sdk/monitors.ts +116 -0
  116. package/packages/orq-rc/src/sdk/sdk.ts +12 -0
  117. package/packages/orq-rc/src/sdk/users.ts +98 -0
  118. package/src/lib/config.ts +2 -2
  119. package/src/models/components/reasoningpart.ts +1 -1
  120. package/src/models/operations/createtool.ts +4 -4
  121. package/src/models/operations/getalltools.ts +4 -4
  122. package/src/models/operations/getv2humanevalsets.ts +2 -2
  123. package/src/models/operations/getv2humanevalsetsid.ts +2 -2
  124. package/src/models/operations/patchv2humanevalsetsid.ts +2 -2
  125. package/src/models/operations/postv2feedbackevaluation.ts +4 -4
  126. package/src/models/operations/postv2humanevalsets.ts +2 -2
  127. package/src/models/operations/retrievetool.ts +4 -4
  128. package/src/models/operations/runagent.ts +1 -1
  129. package/src/models/operations/streamrunagent.ts +1 -1
  130. package/src/models/operations/updatetool.ts +4 -4
@@ -0,0 +1,172 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { OrqCore } from "../core.js";
6
+ import { encodeFormQuery } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import * as components from "../models/components/index.js";
15
+ import {
16
+ ConnectionError,
17
+ InvalidRequestError,
18
+ RequestAbortedError,
19
+ RequestTimeoutError,
20
+ UnexpectedClientError,
21
+ } from "../models/errors/httpclienterrors.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
+ * List external agents
31
+ *
32
+ * @remarks
33
+ * Returns the external A2A agents visible to the caller, ordered newest first.
34
+ */
35
+ export function agentsExternalList(
36
+ client: OrqCore,
37
+ request?: operations.ExternalAgentListRequest | undefined,
38
+ options?: RequestOptions,
39
+ ): APIPromise<
40
+ Result<
41
+ components.ListExternalAgentsResponse,
42
+ | OrqError
43
+ | ResponseValidationError
44
+ | ConnectionError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | InvalidRequestError
48
+ | UnexpectedClientError
49
+ | SDKValidationError
50
+ >
51
+ > {
52
+ return new APIPromise($do(
53
+ client,
54
+ request,
55
+ options,
56
+ ));
57
+ }
58
+
59
+ async function $do(
60
+ client: OrqCore,
61
+ request?: operations.ExternalAgentListRequest | undefined,
62
+ options?: RequestOptions,
63
+ ): Promise<
64
+ [
65
+ Result<
66
+ components.ListExternalAgentsResponse,
67
+ | OrqError
68
+ | ResponseValidationError
69
+ | ConnectionError
70
+ | RequestAbortedError
71
+ | RequestTimeoutError
72
+ | InvalidRequestError
73
+ | UnexpectedClientError
74
+ | SDKValidationError
75
+ >,
76
+ APICall,
77
+ ]
78
+ > {
79
+ const parsed = safeParse(
80
+ request,
81
+ (value) =>
82
+ operations.ExternalAgentListRequest$outboundSchema.optional().parse(
83
+ value,
84
+ ),
85
+ "Input validation failed",
86
+ );
87
+ if (!parsed.ok) {
88
+ return [parsed, { status: "invalid" }];
89
+ }
90
+ const payload = parsed.value;
91
+ const body = null;
92
+
93
+ const path = pathToFunc("/v2/agents/external")();
94
+
95
+ const query = encodeFormQuery({
96
+ "ending_before": payload?.ending_before,
97
+ "limit": payload?.limit,
98
+ "starting_after": payload?.starting_after,
99
+ });
100
+
101
+ const headers = new Headers(compactMap({
102
+ Accept: "application/json",
103
+ }));
104
+
105
+ const secConfig = await extractSecurity(client._options.apiKey);
106
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
107
+ const requestSecurity = resolveGlobalSecurity(securityInput);
108
+
109
+ const context = {
110
+ options: client._options,
111
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
112
+ operationID: "ExternalAgentList",
113
+ oAuth2Scopes: null,
114
+
115
+ resolvedSecurity: requestSecurity,
116
+
117
+ securitySource: client._options.apiKey,
118
+ retryConfig: options?.retries
119
+ || client._options.retryConfig
120
+ || { strategy: "none" },
121
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
122
+ };
123
+
124
+ const requestRes = client._createRequest(context, {
125
+ security: requestSecurity,
126
+ method: "GET",
127
+ baseURL: options?.serverURL,
128
+ path: path,
129
+ headers: headers,
130
+ query: query,
131
+ body: body,
132
+ userAgent: client._options.userAgent,
133
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
134
+ }, options);
135
+ if (!requestRes.ok) {
136
+ return [requestRes, { status: "invalid" }];
137
+ }
138
+ const req = requestRes.value;
139
+
140
+ const doResult = await client._do(req, {
141
+ context,
142
+ isErrorStatusCode: (statusCode: number) =>
143
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
144
+ retryConfig: context.retryConfig,
145
+ retryCodes: context.retryCodes,
146
+ });
147
+ if (!doResult.ok) {
148
+ return [doResult, { status: "request-error", request: req }];
149
+ }
150
+ const response = doResult.value;
151
+
152
+ const [result] = await M.match<
153
+ components.ListExternalAgentsResponse,
154
+ | OrqError
155
+ | ResponseValidationError
156
+ | ConnectionError
157
+ | RequestAbortedError
158
+ | RequestTimeoutError
159
+ | InvalidRequestError
160
+ | UnexpectedClientError
161
+ | SDKValidationError
162
+ >(
163
+ M.json(200, components.ListExternalAgentsResponse$inboundSchema),
164
+ M.fail("4XX"),
165
+ M.fail("5XX"),
166
+ )(response, req);
167
+ if (!result.ok) {
168
+ return [result, { status: "complete", request: req, response }];
169
+ }
170
+
171
+ return [result, { status: "complete", request: req, response }];
172
+ }
@@ -0,0 +1,174 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { OrqCore } from "../core.js";
6
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import * as components from "../models/components/index.js";
15
+ import {
16
+ ConnectionError,
17
+ InvalidRequestError,
18
+ RequestAbortedError,
19
+ RequestTimeoutError,
20
+ UnexpectedClientError,
21
+ } from "../models/errors/httpclienterrors.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
+ * Refresh external agent card
31
+ *
32
+ * @remarks
33
+ * Securely fetches the current agent card and replaces the cached card metadata.
34
+ */
35
+ export function agentsExternalRefreshCard(
36
+ client: OrqCore,
37
+ request: operations.ExternalAgentRefreshCardRequest,
38
+ options?: RequestOptions,
39
+ ): APIPromise<
40
+ Result<
41
+ components.RefreshExternalAgentCardResponse,
42
+ | OrqError
43
+ | ResponseValidationError
44
+ | ConnectionError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | InvalidRequestError
48
+ | UnexpectedClientError
49
+ | SDKValidationError
50
+ >
51
+ > {
52
+ return new APIPromise($do(
53
+ client,
54
+ request,
55
+ options,
56
+ ));
57
+ }
58
+
59
+ async function $do(
60
+ client: OrqCore,
61
+ request: operations.ExternalAgentRefreshCardRequest,
62
+ options?: RequestOptions,
63
+ ): Promise<
64
+ [
65
+ Result<
66
+ components.RefreshExternalAgentCardResponse,
67
+ | OrqError
68
+ | ResponseValidationError
69
+ | ConnectionError
70
+ | RequestAbortedError
71
+ | RequestTimeoutError
72
+ | InvalidRequestError
73
+ | UnexpectedClientError
74
+ | SDKValidationError
75
+ >,
76
+ APICall,
77
+ ]
78
+ > {
79
+ const parsed = safeParse(
80
+ request,
81
+ (value) =>
82
+ operations.ExternalAgentRefreshCardRequest$outboundSchema.parse(value),
83
+ "Input validation failed",
84
+ );
85
+ if (!parsed.ok) {
86
+ return [parsed, { status: "invalid" }];
87
+ }
88
+ const payload = parsed.value;
89
+ const body = encodeJSON("body", payload.RefreshExternalAgentCardRequest, {
90
+ explode: true,
91
+ });
92
+
93
+ const pathParams = {
94
+ agent_key: encodeSimple("agent_key", payload.agent_key, {
95
+ explode: false,
96
+ charEncoding: "percent",
97
+ }),
98
+ };
99
+ const path = pathToFunc("/v2/agents/external/{agent_key}:refreshCard")(
100
+ pathParams,
101
+ );
102
+
103
+ const headers = new Headers(compactMap({
104
+ "Content-Type": "application/json",
105
+ Accept: "application/json",
106
+ }));
107
+
108
+ const secConfig = await extractSecurity(client._options.apiKey);
109
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
110
+ const requestSecurity = resolveGlobalSecurity(securityInput);
111
+
112
+ const context = {
113
+ options: client._options,
114
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
115
+ operationID: "ExternalAgentRefreshCard",
116
+ oAuth2Scopes: null,
117
+
118
+ resolvedSecurity: requestSecurity,
119
+
120
+ securitySource: client._options.apiKey,
121
+ retryConfig: options?.retries
122
+ || client._options.retryConfig
123
+ || { strategy: "none" },
124
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
125
+ };
126
+
127
+ const requestRes = client._createRequest(context, {
128
+ security: requestSecurity,
129
+ method: "POST",
130
+ baseURL: options?.serverURL,
131
+ path: path,
132
+ headers: headers,
133
+ body: body,
134
+ userAgent: client._options.userAgent,
135
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
136
+ }, options);
137
+ if (!requestRes.ok) {
138
+ return [requestRes, { status: "invalid" }];
139
+ }
140
+ const req = requestRes.value;
141
+
142
+ const doResult = await client._do(req, {
143
+ context,
144
+ isErrorStatusCode: (statusCode: number) =>
145
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
146
+ retryConfig: context.retryConfig,
147
+ retryCodes: context.retryCodes,
148
+ });
149
+ if (!doResult.ok) {
150
+ return [doResult, { status: "request-error", request: req }];
151
+ }
152
+ const response = doResult.value;
153
+
154
+ const [result] = await M.match<
155
+ components.RefreshExternalAgentCardResponse,
156
+ | OrqError
157
+ | ResponseValidationError
158
+ | ConnectionError
159
+ | RequestAbortedError
160
+ | RequestTimeoutError
161
+ | InvalidRequestError
162
+ | UnexpectedClientError
163
+ | SDKValidationError
164
+ >(
165
+ M.json(200, components.RefreshExternalAgentCardResponse$inboundSchema),
166
+ M.fail("4XX"),
167
+ M.fail("5XX"),
168
+ )(response, req);
169
+ if (!result.ok) {
170
+ return [result, { status: "complete", request: req, response }];
171
+ }
172
+
173
+ return [result, { status: "complete", request: req, response }];
174
+ }
@@ -0,0 +1,168 @@
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 { matchStatusCode } from "../lib/http.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import * as components from "../models/components/index.js";
15
+ import {
16
+ ConnectionError,
17
+ InvalidRequestError,
18
+ RequestAbortedError,
19
+ RequestTimeoutError,
20
+ UnexpectedClientError,
21
+ } from "../models/errors/httpclienterrors.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
+ * Retrieve external agent
31
+ *
32
+ * @remarks
33
+ * Retrieves a registered external A2A agent by key or ID. Encrypted header values are always masked.
34
+ */
35
+ export function agentsExternalRetrieve(
36
+ client: OrqCore,
37
+ request: operations.ExternalAgentGetRequest,
38
+ options?: RequestOptions,
39
+ ): APIPromise<
40
+ Result<
41
+ components.GetExternalAgentResponse,
42
+ | OrqError
43
+ | ResponseValidationError
44
+ | ConnectionError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | InvalidRequestError
48
+ | UnexpectedClientError
49
+ | SDKValidationError
50
+ >
51
+ > {
52
+ return new APIPromise($do(
53
+ client,
54
+ request,
55
+ options,
56
+ ));
57
+ }
58
+
59
+ async function $do(
60
+ client: OrqCore,
61
+ request: operations.ExternalAgentGetRequest,
62
+ options?: RequestOptions,
63
+ ): Promise<
64
+ [
65
+ Result<
66
+ components.GetExternalAgentResponse,
67
+ | OrqError
68
+ | ResponseValidationError
69
+ | ConnectionError
70
+ | RequestAbortedError
71
+ | RequestTimeoutError
72
+ | InvalidRequestError
73
+ | UnexpectedClientError
74
+ | SDKValidationError
75
+ >,
76
+ APICall,
77
+ ]
78
+ > {
79
+ const parsed = safeParse(
80
+ request,
81
+ (value) => operations.ExternalAgentGetRequest$outboundSchema.parse(value),
82
+ "Input validation failed",
83
+ );
84
+ if (!parsed.ok) {
85
+ return [parsed, { status: "invalid" }];
86
+ }
87
+ const payload = parsed.value;
88
+ const body = null;
89
+
90
+ const pathParams = {
91
+ agent_key: encodeSimple("agent_key", payload.agent_key, {
92
+ explode: false,
93
+ charEncoding: "percent",
94
+ }),
95
+ };
96
+ const path = pathToFunc("/v2/agents/external/{agent_key}")(pathParams);
97
+
98
+ const headers = new Headers(compactMap({
99
+ Accept: "application/json",
100
+ }));
101
+
102
+ const secConfig = await extractSecurity(client._options.apiKey);
103
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
104
+ const requestSecurity = resolveGlobalSecurity(securityInput);
105
+
106
+ const context = {
107
+ options: client._options,
108
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
109
+ operationID: "ExternalAgentGet",
110
+ oAuth2Scopes: null,
111
+
112
+ resolvedSecurity: requestSecurity,
113
+
114
+ securitySource: client._options.apiKey,
115
+ retryConfig: options?.retries
116
+ || client._options.retryConfig
117
+ || { strategy: "none" },
118
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
119
+ };
120
+
121
+ const requestRes = client._createRequest(context, {
122
+ security: requestSecurity,
123
+ method: "GET",
124
+ baseURL: options?.serverURL,
125
+ path: path,
126
+ headers: headers,
127
+ body: body,
128
+ userAgent: client._options.userAgent,
129
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
130
+ }, options);
131
+ if (!requestRes.ok) {
132
+ return [requestRes, { status: "invalid" }];
133
+ }
134
+ const req = requestRes.value;
135
+
136
+ const doResult = await client._do(req, {
137
+ context,
138
+ isErrorStatusCode: (statusCode: number) =>
139
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
140
+ retryConfig: context.retryConfig,
141
+ retryCodes: context.retryCodes,
142
+ });
143
+ if (!doResult.ok) {
144
+ return [doResult, { status: "request-error", request: req }];
145
+ }
146
+ const response = doResult.value;
147
+
148
+ const [result] = await M.match<
149
+ components.GetExternalAgentResponse,
150
+ | OrqError
151
+ | ResponseValidationError
152
+ | ConnectionError
153
+ | RequestAbortedError
154
+ | RequestTimeoutError
155
+ | InvalidRequestError
156
+ | UnexpectedClientError
157
+ | SDKValidationError
158
+ >(
159
+ M.json(200, components.GetExternalAgentResponse$inboundSchema),
160
+ M.fail("4XX"),
161
+ M.fail("5XX"),
162
+ )(response, req);
163
+ if (!result.ok) {
164
+ return [result, { status: "complete", request: req, response }];
165
+ }
166
+
167
+ return [result, { status: "complete", request: req, response }];
168
+ }
@@ -0,0 +1,174 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { OrqCore } from "../core.js";
6
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import * as components from "../models/components/index.js";
15
+ import {
16
+ ConnectionError,
17
+ InvalidRequestError,
18
+ RequestAbortedError,
19
+ RequestTimeoutError,
20
+ UnexpectedClientError,
21
+ } from "../models/errors/httpclienterrors.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
+ * Test external agent connection
31
+ *
32
+ * @remarks
33
+ * Validates the stored connection configuration and securely fetches the external agent card without persisting changes.
34
+ */
35
+ export function agentsExternalTestConnection(
36
+ client: OrqCore,
37
+ request: operations.ExternalAgentTestConnectionRequest,
38
+ options?: RequestOptions,
39
+ ): APIPromise<
40
+ Result<
41
+ components.TestExternalAgentConnectionResponse,
42
+ | OrqError
43
+ | ResponseValidationError
44
+ | ConnectionError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | InvalidRequestError
48
+ | UnexpectedClientError
49
+ | SDKValidationError
50
+ >
51
+ > {
52
+ return new APIPromise($do(
53
+ client,
54
+ request,
55
+ options,
56
+ ));
57
+ }
58
+
59
+ async function $do(
60
+ client: OrqCore,
61
+ request: operations.ExternalAgentTestConnectionRequest,
62
+ options?: RequestOptions,
63
+ ): Promise<
64
+ [
65
+ Result<
66
+ components.TestExternalAgentConnectionResponse,
67
+ | OrqError
68
+ | ResponseValidationError
69
+ | ConnectionError
70
+ | RequestAbortedError
71
+ | RequestTimeoutError
72
+ | InvalidRequestError
73
+ | UnexpectedClientError
74
+ | SDKValidationError
75
+ >,
76
+ APICall,
77
+ ]
78
+ > {
79
+ const parsed = safeParse(
80
+ request,
81
+ (value) =>
82
+ operations.ExternalAgentTestConnectionRequest$outboundSchema.parse(value),
83
+ "Input validation failed",
84
+ );
85
+ if (!parsed.ok) {
86
+ return [parsed, { status: "invalid" }];
87
+ }
88
+ const payload = parsed.value;
89
+ const body = encodeJSON("body", payload.TestExternalAgentConnectionRequest, {
90
+ explode: true,
91
+ });
92
+
93
+ const pathParams = {
94
+ agent_key: encodeSimple("agent_key", payload.agent_key, {
95
+ explode: false,
96
+ charEncoding: "percent",
97
+ }),
98
+ };
99
+ const path = pathToFunc("/v2/agents/external/{agent_key}:testConnection")(
100
+ pathParams,
101
+ );
102
+
103
+ const headers = new Headers(compactMap({
104
+ "Content-Type": "application/json",
105
+ Accept: "application/json",
106
+ }));
107
+
108
+ const secConfig = await extractSecurity(client._options.apiKey);
109
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
110
+ const requestSecurity = resolveGlobalSecurity(securityInput);
111
+
112
+ const context = {
113
+ options: client._options,
114
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
115
+ operationID: "ExternalAgentTestConnection",
116
+ oAuth2Scopes: null,
117
+
118
+ resolvedSecurity: requestSecurity,
119
+
120
+ securitySource: client._options.apiKey,
121
+ retryConfig: options?.retries
122
+ || client._options.retryConfig
123
+ || { strategy: "none" },
124
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
125
+ };
126
+
127
+ const requestRes = client._createRequest(context, {
128
+ security: requestSecurity,
129
+ method: "POST",
130
+ baseURL: options?.serverURL,
131
+ path: path,
132
+ headers: headers,
133
+ body: body,
134
+ userAgent: client._options.userAgent,
135
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
136
+ }, options);
137
+ if (!requestRes.ok) {
138
+ return [requestRes, { status: "invalid" }];
139
+ }
140
+ const req = requestRes.value;
141
+
142
+ const doResult = await client._do(req, {
143
+ context,
144
+ isErrorStatusCode: (statusCode: number) =>
145
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
146
+ retryConfig: context.retryConfig,
147
+ retryCodes: context.retryCodes,
148
+ });
149
+ if (!doResult.ok) {
150
+ return [doResult, { status: "request-error", request: req }];
151
+ }
152
+ const response = doResult.value;
153
+
154
+ const [result] = await M.match<
155
+ components.TestExternalAgentConnectionResponse,
156
+ | OrqError
157
+ | ResponseValidationError
158
+ | ConnectionError
159
+ | RequestAbortedError
160
+ | RequestTimeoutError
161
+ | InvalidRequestError
162
+ | UnexpectedClientError
163
+ | SDKValidationError
164
+ >(
165
+ M.json(200, components.TestExternalAgentConnectionResponse$inboundSchema),
166
+ M.fail("4XX"),
167
+ M.fail("5XX"),
168
+ )(response, req);
169
+ if (!result.ok) {
170
+ return [result, { status: "complete", request: req, response }];
171
+ }
172
+
173
+ return [result, { status: "complete", request: req, response }];
174
+ }