@agent-os-sdk/client 0.9.24 → 0.9.26

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 (185) hide show
  1. package/package.json +15 -8
  2. package/src/generated/openapi.ts +90 -0
  3. package/src/generated/swagger.json +181 -0
  4. package/src/modules/runs.ts +64 -0
  5. package/src/modules/templates.ts +35 -0
  6. package/dist/client/AgentOsClient.d.ts +0 -141
  7. package/dist/client/AgentOsClient.d.ts.map +0 -1
  8. package/dist/client/AgentOsClient.js +0 -250
  9. package/dist/client/HttpRequestBuilder.d.ts +0 -50
  10. package/dist/client/HttpRequestBuilder.d.ts.map +0 -1
  11. package/dist/client/HttpRequestBuilder.js +0 -83
  12. package/dist/client/OperationContext.d.ts +0 -19
  13. package/dist/client/OperationContext.d.ts.map +0 -1
  14. package/dist/client/OperationContext.js +0 -13
  15. package/dist/client/OperationContextProvider.d.ts +0 -54
  16. package/dist/client/OperationContextProvider.d.ts.map +0 -1
  17. package/dist/client/OperationContextProvider.js +0 -71
  18. package/dist/client/auth.d.ts +0 -100
  19. package/dist/client/auth.d.ts.map +0 -1
  20. package/dist/client/auth.js +0 -38
  21. package/dist/client/config.d.ts +0 -49
  22. package/dist/client/config.d.ts.map +0 -1
  23. package/dist/client/config.js +0 -62
  24. package/dist/client/helpers.d.ts +0 -63
  25. package/dist/client/helpers.d.ts.map +0 -1
  26. package/dist/client/helpers.js +0 -55
  27. package/dist/client/pagination.d.ts +0 -105
  28. package/dist/client/pagination.d.ts.map +0 -1
  29. package/dist/client/pagination.js +0 -117
  30. package/dist/client/raw.d.ts +0 -277
  31. package/dist/client/raw.d.ts.map +0 -1
  32. package/dist/client/raw.js +0 -337
  33. package/dist/client/retry.d.ts +0 -37
  34. package/dist/client/retry.d.ts.map +0 -1
  35. package/dist/client/retry.js +0 -108
  36. package/dist/client/sanitize.d.ts +0 -19
  37. package/dist/client/sanitize.d.ts.map +0 -1
  38. package/dist/client/sanitize.js +0 -28
  39. package/dist/client/timeout.d.ts +0 -26
  40. package/dist/client/timeout.d.ts.map +0 -1
  41. package/dist/client/timeout.js +0 -51
  42. package/dist/errors/factory.d.ts +0 -22
  43. package/dist/errors/factory.d.ts.map +0 -1
  44. package/dist/errors/factory.js +0 -101
  45. package/dist/errors/index.d.ts +0 -210
  46. package/dist/errors/index.d.ts.map +0 -1
  47. package/dist/errors/index.js +0 -283
  48. package/dist/generated/client.d.ts +0 -20
  49. package/dist/generated/client.d.ts.map +0 -1
  50. package/dist/generated/client.js +0 -15
  51. package/dist/generated/index.d.ts +0 -2
  52. package/dist/generated/index.d.ts.map +0 -1
  53. package/dist/generated/index.js +0 -1
  54. package/dist/generated/openapi.d.ts +0 -12294
  55. package/dist/generated/openapi.d.ts.map +0 -1
  56. package/dist/generated/openapi.js +0 -5
  57. package/dist/index.d.ts +0 -69
  58. package/dist/index.d.ts.map +0 -1
  59. package/dist/index.js +0 -81
  60. package/dist/modules/a2a.d.ts +0 -48
  61. package/dist/modules/a2a.d.ts.map +0 -1
  62. package/dist/modules/a2a.js +0 -37
  63. package/dist/modules/agents.d.ts +0 -346
  64. package/dist/modules/agents.d.ts.map +0 -1
  65. package/dist/modules/agents.js +0 -296
  66. package/dist/modules/apiTokens.d.ts +0 -62
  67. package/dist/modules/apiTokens.d.ts.map +0 -1
  68. package/dist/modules/apiTokens.js +0 -56
  69. package/dist/modules/approvals.d.ts +0 -75
  70. package/dist/modules/approvals.d.ts.map +0 -1
  71. package/dist/modules/approvals.js +0 -91
  72. package/dist/modules/audit.d.ts +0 -78
  73. package/dist/modules/audit.d.ts.map +0 -1
  74. package/dist/modules/audit.js +0 -94
  75. package/dist/modules/auth.d.ts +0 -28
  76. package/dist/modules/auth.d.ts.map +0 -1
  77. package/dist/modules/auth.js +0 -22
  78. package/dist/modules/builder.d.ts +0 -242
  79. package/dist/modules/builder.d.ts.map +0 -1
  80. package/dist/modules/builder.js +0 -248
  81. package/dist/modules/catalog.d.ts +0 -142
  82. package/dist/modules/catalog.d.ts.map +0 -1
  83. package/dist/modules/catalog.js +0 -136
  84. package/dist/modules/chatwoot.d.ts +0 -59
  85. package/dist/modules/chatwoot.d.ts.map +0 -1
  86. package/dist/modules/chatwoot.js +0 -200
  87. package/dist/modules/checkpoints.d.ts +0 -62
  88. package/dist/modules/checkpoints.d.ts.map +0 -1
  89. package/dist/modules/checkpoints.js +0 -48
  90. package/dist/modules/contracts.d.ts +0 -48
  91. package/dist/modules/contracts.d.ts.map +0 -1
  92. package/dist/modules/contracts.js +0 -25
  93. package/dist/modules/credentials.d.ts +0 -105
  94. package/dist/modules/credentials.d.ts.map +0 -1
  95. package/dist/modules/credentials.js +0 -135
  96. package/dist/modules/crons.d.ts +0 -73
  97. package/dist/modules/crons.d.ts.map +0 -1
  98. package/dist/modules/crons.js +0 -67
  99. package/dist/modules/datasets.d.ts +0 -80
  100. package/dist/modules/datasets.d.ts.map +0 -1
  101. package/dist/modules/datasets.js +0 -91
  102. package/dist/modules/evaluation.d.ts +0 -183
  103. package/dist/modules/evaluation.d.ts.map +0 -1
  104. package/dist/modules/evaluation.js +0 -108
  105. package/dist/modules/files.d.ts +0 -89
  106. package/dist/modules/files.d.ts.map +0 -1
  107. package/dist/modules/files.js +0 -133
  108. package/dist/modules/graphs.d.ts +0 -120
  109. package/dist/modules/graphs.d.ts.map +0 -1
  110. package/dist/modules/graphs.js +0 -69
  111. package/dist/modules/improvements.d.ts +0 -52
  112. package/dist/modules/improvements.d.ts.map +0 -1
  113. package/dist/modules/improvements.js +0 -27
  114. package/dist/modules/info.d.ts +0 -76
  115. package/dist/modules/info.d.ts.map +0 -1
  116. package/dist/modules/info.js +0 -93
  117. package/dist/modules/knowledge.d.ts +0 -91
  118. package/dist/modules/knowledge.d.ts.map +0 -1
  119. package/dist/modules/knowledge.js +0 -80
  120. package/dist/modules/me.d.ts +0 -58
  121. package/dist/modules/me.d.ts.map +0 -1
  122. package/dist/modules/me.js +0 -28
  123. package/dist/modules/members.d.ts +0 -124
  124. package/dist/modules/members.d.ts.map +0 -1
  125. package/dist/modules/members.js +0 -142
  126. package/dist/modules/memberships.d.ts +0 -25
  127. package/dist/modules/memberships.d.ts.map +0 -1
  128. package/dist/modules/memberships.js +0 -20
  129. package/dist/modules/metaAgent.d.ts +0 -95
  130. package/dist/modules/metaAgent.d.ts.map +0 -1
  131. package/dist/modules/metaAgent.js +0 -32
  132. package/dist/modules/metrics.d.ts +0 -20
  133. package/dist/modules/metrics.d.ts.map +0 -1
  134. package/dist/modules/metrics.js +0 -27
  135. package/dist/modules/observability.d.ts +0 -19
  136. package/dist/modules/observability.d.ts.map +0 -1
  137. package/dist/modules/observability.js +0 -14
  138. package/dist/modules/playground.d.ts +0 -42
  139. package/dist/modules/playground.d.ts.map +0 -1
  140. package/dist/modules/playground.js +0 -48
  141. package/dist/modules/presets.d.ts +0 -32
  142. package/dist/modules/presets.d.ts.map +0 -1
  143. package/dist/modules/presets.js +0 -199
  144. package/dist/modules/prompts.d.ts +0 -87
  145. package/dist/modules/prompts.d.ts.map +0 -1
  146. package/dist/modules/prompts.js +0 -87
  147. package/dist/modules/roles.d.ts +0 -64
  148. package/dist/modules/roles.d.ts.map +0 -1
  149. package/dist/modules/roles.js +0 -79
  150. package/dist/modules/runs.d.ts +0 -400
  151. package/dist/modules/runs.d.ts.map +0 -1
  152. package/dist/modules/runs.js +0 -526
  153. package/dist/modules/store.d.ts +0 -37
  154. package/dist/modules/store.d.ts.map +0 -1
  155. package/dist/modules/store.js +0 -48
  156. package/dist/modules/templates.d.ts +0 -28
  157. package/dist/modules/templates.d.ts.map +0 -1
  158. package/dist/modules/templates.js +0 -19
  159. package/dist/modules/tenants.d.ts +0 -49
  160. package/dist/modules/tenants.d.ts.map +0 -1
  161. package/dist/modules/tenants.js +0 -56
  162. package/dist/modules/threads.d.ts +0 -205
  163. package/dist/modules/threads.d.ts.map +0 -1
  164. package/dist/modules/threads.js +0 -225
  165. package/dist/modules/tools.d.ts +0 -62
  166. package/dist/modules/tools.d.ts.map +0 -1
  167. package/dist/modules/tools.js +0 -45
  168. package/dist/modules/traces.d.ts +0 -89
  169. package/dist/modules/traces.d.ts.map +0 -1
  170. package/dist/modules/traces.js +0 -65
  171. package/dist/modules/triggers.d.ts +0 -228
  172. package/dist/modules/triggers.d.ts.map +0 -1
  173. package/dist/modules/triggers.js +0 -176
  174. package/dist/modules/usage.d.ts +0 -85
  175. package/dist/modules/usage.d.ts.map +0 -1
  176. package/dist/modules/usage.js +0 -43
  177. package/dist/modules/vectorStores.d.ts +0 -100
  178. package/dist/modules/vectorStores.d.ts.map +0 -1
  179. package/dist/modules/vectorStores.js +0 -159
  180. package/dist/modules/workspaces.d.ts +0 -138
  181. package/dist/modules/workspaces.d.ts.map +0 -1
  182. package/dist/modules/workspaces.js +0 -121
  183. package/dist/sse/client.d.ts +0 -140
  184. package/dist/sse/client.d.ts.map +0 -1
  185. package/dist/sse/client.js +0 -103
@@ -1,277 +0,0 @@
1
- /**
2
- * Agent OS SDK - Raw HTTP Client
3
- *
4
- * Fully typed HTTP client using openapi-fetch with generated OpenAPI types.
5
- * All types are automatically inferred from the backend Swagger specification.
6
- */
7
- import { type Client } from "openapi-fetch";
8
- import type { components, paths } from "../generated/openapi.js";
9
- import type { OperationContext } from "./OperationContext.js";
10
- import type { OperationContextProvider } from "./OperationContextProvider.js";
11
- import { type NetworkConfig } from "./config.js";
12
- export type { components, paths };
13
- export type ClientOptions = {
14
- baseUrl: string;
15
- headers?: Record<string, string>;
16
- headerProvider?: () => Promise<Record<string, string>>;
17
- /** Optional flow context provider (ALS/manual). */
18
- contextProvider?: OperationContextProvider;
19
- /** Network behavior (timeouts/retries). Defaults to DEFAULT_NETWORK_CONFIG. */
20
- network?: Partial<NetworkConfig>;
21
- /** Hooks for observability (OTEL, Sentry, etc.) */
22
- hooks?: SDKHooks;
23
- };
24
- /**
25
- * SDK hooks for external observability tools.
26
- * These are called during the request lifecycle for instrumentation.
27
- */
28
- export interface SDKHooks {
29
- /** Called before each request. Return modified request context or void. */
30
- onRequest?: (context: HookRequestContext) => void | Promise<void>;
31
- /** Called after each successful response */
32
- onResponse?: (context: HookResponseContext) => void | Promise<void>;
33
- /** Called on any error (network, timeout, HTTP error) */
34
- onError?: (context: HookErrorContext) => void | Promise<void>;
35
- /** Optional logger bridge used by SDK internal warnings. */
36
- logger?: {
37
- warn?: (message: string) => void;
38
- };
39
- }
40
- export interface HookRequestContext {
41
- method: string;
42
- url: string;
43
- headers: Record<string, string>;
44
- body?: unknown;
45
- requestId?: string;
46
- }
47
- export interface HookResponseContext {
48
- method: string;
49
- url: string;
50
- status: number;
51
- durationMs: number;
52
- requestId?: string;
53
- }
54
- export interface HookErrorContext {
55
- method: string;
56
- url: string;
57
- error: Error;
58
- durationMs: number;
59
- requestId?: string;
60
- }
61
- /**
62
- * Standard API response wrapper.
63
- * This matches the pattern used by openapi-fetch.
64
- */
65
- export interface APIResponse<T> {
66
- data?: T;
67
- error?: {
68
- code: string;
69
- message: string;
70
- details?: unknown;
71
- };
72
- response: Response;
73
- /** Metadata for observability */
74
- meta?: {
75
- /** Request ID from x-request-id header */
76
- requestId?: string;
77
- };
78
- }
79
- /**
80
- * Typed API client using openapi-fetch.
81
- * All paths and responses are fully typed from OpenAPI spec.
82
- */
83
- export type TypedClient = Client<paths>;
84
- /**
85
- * Creates a typed HTTP client with openapi-fetch.
86
- * This provides full type inference for all API endpoints.
87
- */
88
- export declare function createTypedClient(options: ClientOptions): TypedClient;
89
- /**
90
- * Legacy raw client interface (for backward compatibility).
91
- * Wraps openapi-fetch to provide the old interface while maintaining types.
92
- */
93
- export declare function createRawClient(options: ClientOptions): {
94
- GET: <T>(path: string, opts?: Parameters<(<T_1>(method: string, path: string, opts?: {
95
- params?: {
96
- path?: Record<string, string>;
97
- query?: Record<string, unknown>;
98
- };
99
- body?: unknown;
100
- headers?: Record<string, string>;
101
- signal?: AbortSignal;
102
- /** Set to false to disable retry for this request */
103
- retry?: boolean;
104
- /** Override timeout for this request */
105
- timeoutMs?: number;
106
- /** Operation context for flow tracing */
107
- context?: OperationContext;
108
- /** Idempotency key for POST requests */
109
- idempotencyKey?: string;
110
- /** Require correlation ID (throws if missing) */
111
- requireFlow?: boolean;
112
- }) => Promise<APIResponse<T_1>>)>[2]) => Promise<APIResponse<T>>;
113
- POST: <T>(path: string, opts?: Parameters<(<T_1>(method: string, path: string, opts?: {
114
- params?: {
115
- path?: Record<string, string>;
116
- query?: Record<string, unknown>;
117
- };
118
- body?: unknown;
119
- headers?: Record<string, string>;
120
- signal?: AbortSignal;
121
- /** Set to false to disable retry for this request */
122
- retry?: boolean;
123
- /** Override timeout for this request */
124
- timeoutMs?: number;
125
- /** Operation context for flow tracing */
126
- context?: OperationContext;
127
- /** Idempotency key for POST requests */
128
- idempotencyKey?: string;
129
- /** Require correlation ID (throws if missing) */
130
- requireFlow?: boolean;
131
- }) => Promise<APIResponse<T_1>>)>[2]) => Promise<APIResponse<T>>;
132
- PUT: <T>(path: string, opts?: Parameters<(<T_1>(method: string, path: string, opts?: {
133
- params?: {
134
- path?: Record<string, string>;
135
- query?: Record<string, unknown>;
136
- };
137
- body?: unknown;
138
- headers?: Record<string, string>;
139
- signal?: AbortSignal;
140
- /** Set to false to disable retry for this request */
141
- retry?: boolean;
142
- /** Override timeout for this request */
143
- timeoutMs?: number;
144
- /** Operation context for flow tracing */
145
- context?: OperationContext;
146
- /** Idempotency key for POST requests */
147
- idempotencyKey?: string;
148
- /** Require correlation ID (throws if missing) */
149
- requireFlow?: boolean;
150
- }) => Promise<APIResponse<T_1>>)>[2]) => Promise<APIResponse<T>>;
151
- PATCH: <T>(path: string, opts?: Parameters<(<T_1>(method: string, path: string, opts?: {
152
- params?: {
153
- path?: Record<string, string>;
154
- query?: Record<string, unknown>;
155
- };
156
- body?: unknown;
157
- headers?: Record<string, string>;
158
- signal?: AbortSignal;
159
- /** Set to false to disable retry for this request */
160
- retry?: boolean;
161
- /** Override timeout for this request */
162
- timeoutMs?: number;
163
- /** Operation context for flow tracing */
164
- context?: OperationContext;
165
- /** Idempotency key for POST requests */
166
- idempotencyKey?: string;
167
- /** Require correlation ID (throws if missing) */
168
- requireFlow?: boolean;
169
- }) => Promise<APIResponse<T_1>>)>[2]) => Promise<APIResponse<T>>;
170
- DELETE: <T>(path: string, opts?: Parameters<(<T_1>(method: string, path: string, opts?: {
171
- params?: {
172
- path?: Record<string, string>;
173
- query?: Record<string, unknown>;
174
- };
175
- body?: unknown;
176
- headers?: Record<string, string>;
177
- signal?: AbortSignal;
178
- /** Set to false to disable retry for this request */
179
- retry?: boolean;
180
- /** Override timeout for this request */
181
- timeoutMs?: number;
182
- /** Operation context for flow tracing */
183
- context?: OperationContext;
184
- /** Idempotency key for POST requests */
185
- idempotencyKey?: string;
186
- /** Require correlation ID (throws if missing) */
187
- requireFlow?: boolean;
188
- }) => Promise<APIResponse<T_1>>)>[2]) => Promise<APIResponse<T>>;
189
- /**
190
- * Stream GET request - returns raw Response for SSE consumption.
191
- * Headers are resolved asynchronously (includes Auth + Workspace).
192
- */
193
- streamGet: (path: string, opts?: {
194
- params?: {
195
- path?: Record<string, string>;
196
- query?: Record<string, unknown>;
197
- };
198
- headers?: Record<string, string>;
199
- context?: OperationContext;
200
- requireFlow?: boolean;
201
- signal?: AbortSignal;
202
- }) => Promise<Response>;
203
- /**
204
- * Stream POST request - returns raw Response for SSE consumption.
205
- * Headers are resolved asynchronously (includes Auth + Workspace).
206
- */
207
- streamPost: (path: string, opts?: {
208
- params?: {
209
- path?: Record<string, string>;
210
- };
211
- body?: unknown;
212
- headers?: Record<string, string>;
213
- signal?: AbortSignal;
214
- context?: OperationContext;
215
- idempotencyKey?: string;
216
- requireFlow?: boolean;
217
- }) => Promise<Response>;
218
- /** Base URL for constructing full URLs when needed */
219
- baseUrl: string;
220
- };
221
- export type RawClient = ReturnType<typeof createRawClient>;
222
- export type Agent = components["schemas"]["AgentExportAgent"];
223
- export type CreateAgentRequest = components["schemas"]["CreateAgentRequest"];
224
- export type UpdateAgentRequest = components["schemas"]["UpdateAgentRequest"];
225
- export type AgentBundle = components["schemas"]["AgentExportBundle"];
226
- export type AgentBundleItem = components["schemas"]["AgentBundleItem"];
227
- export type RunResponse = components["schemas"]["RunResponse"];
228
- export type RunDetailResponse = components["schemas"]["RunDetailResponse"];
229
- export type CreateRunRequest = components["schemas"]["CreateRunRequest"];
230
- export type WaitRunRequest = components["schemas"]["WaitRunRequest"];
231
- export type WaitRunResponse = components["schemas"]["WaitRunResponse"];
232
- export type BatchRunRequest = components["schemas"]["BatchRunRequest"];
233
- export type BatchRunResponse = components["schemas"]["BatchRunResponse"];
234
- export type ReplayRequest = components["schemas"]["ReplayRequest"];
235
- export type RunReplayRequest = components["schemas"]["RunReplayRequest"];
236
- export type RunReplayResponse = components["schemas"]["RunReplayResponse"];
237
- export type CancelRequest = components["schemas"]["CancelRequest"];
238
- export type CancelRunResponse = components["schemas"]["CancelRunResponse"];
239
- export type ThreadRequest = components["schemas"]["ThreadRequest"];
240
- export type ThreadSearchRequest = components["schemas"]["ThreadSearchRequest"];
241
- export type ThreadCopyRequest = components["schemas"]["ThreadCopyRequest"];
242
- export type ThreadPruneRequest = components["schemas"]["ThreadPruneRequest"];
243
- export type AddMessageRequest = components["schemas"]["AddMessageRequest"];
244
- export type CheckpointDetail = components["schemas"]["CheckpointDetail"];
245
- export type CheckpointNode = components["schemas"]["CheckpointNode"];
246
- export type CheckpointListResponse = components["schemas"]["CheckpointListResponse"];
247
- export type CheckpointIndexResponse = components["schemas"]["CheckpointIndexResponse"];
248
- export type CreateCheckpointRequest = components["schemas"]["CreateCheckpointRequest"];
249
- export type CreateCredentialRequest = components["schemas"]["CreateCredentialRequest"];
250
- export type UpdateCredentialRequest = components["schemas"]["UpdateCredentialRequest"];
251
- export type CreateDatasetRequest = components["schemas"]["CreateDatasetRequest"];
252
- export type CreateExperimentRequest = components["schemas"]["CreateExperimentRequest"];
253
- export type ExampleData = components["schemas"]["ExampleData"];
254
- export type AddExamplesRequest = components["schemas"]["AddExamplesRequest"];
255
- export type VectorStoreResponse = components["schemas"]["VectorStoreResponse"];
256
- export type VectorQueryRequest = components["schemas"]["VectorQueryRequest"];
257
- export type VectorQueryResponse = components["schemas"]["VectorQueryResponse"];
258
- export type VectorSearchResult = components["schemas"]["VectorSearchResult"];
259
- export type VectorStoreFileResponse = components["schemas"]["VectorStoreFileResponse"];
260
- export type CreateCronJobRequest = components["schemas"]["CreateCronJobRequest"];
261
- export type UpdateCronJobRequest = components["schemas"]["UpdateCronJobRequest"];
262
- export type InviteMemberRequest = components["schemas"]["InviteMemberRequest"];
263
- export type UpdateMemberRequest = components["schemas"]["UpdateMemberRequest"];
264
- export type UpdateTenantRequest = components["schemas"]["UpdateTenantRequest"];
265
- export type UpdateWorkspaceRequest = components["schemas"]["UpdateWorkspaceRequest"];
266
- export type CreatePromptRequest = components["schemas"]["CreatePromptRequest"];
267
- export type CreatePromptVersionRequest = components["schemas"]["CreatePromptVersionRequest"];
268
- export type CreatePresignedUploadRequest = components["schemas"]["CreatePresignedUploadRequest"];
269
- export type PresignedUploadResponse = components["schemas"]["PresignedUploadResponse"];
270
- export type ConfirmUploadRequest = components["schemas"]["ConfirmUploadRequest"];
271
- export type SpanData = components["schemas"]["SpanData"];
272
- export type BatchIngestRequest = components["schemas"]["BatchIngestRequest"];
273
- export type AddFeedbackRequest = components["schemas"]["AddFeedbackRequest"];
274
- export type UpdateTriggerRequest = components["schemas"]["UpdateTriggerRequest"];
275
- export type StoreValueRequest = components["schemas"]["StoreValueRequest"];
276
- export type ProblemDetails = components["schemas"]["ProblemDetails"];
277
- //# sourceMappingURL=raw.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"raw.d.ts","sourceRoot":"","sources":["../../src/client/raw.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAqB,EAAE,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,yBAAyB,CA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AAG7E,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,sBAAsB,CAAC,CAAC;AAGjF,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,mBAAmB,CAAC,CAAC;AAG3E,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,gBAAgB,CAAC,CAAC"}
@@ -1,337 +0,0 @@
1
- /**
2
- * Agent OS SDK - Raw HTTP Client
3
- *
4
- * Fully typed HTTP client using openapi-fetch with generated OpenAPI types.
5
- * All types are automatically inferred from the backend Swagger specification.
6
- */
7
- import createClient, {} from "openapi-fetch";
8
- import { createErrorFromResponse } from "../errors/factory.js";
9
- import { AgentOsError, NetworkError, TimeoutError } from "../errors/index.js";
10
- import { httpRequestBuilder, sanitizeValidCorrelationId } from "./HttpRequestBuilder.js";
11
- import { mergeNetworkConfig } from "./config.js";
12
- import { withRetry } from "./retry.js";
13
- import { withTimeout } from "./timeout.js";
14
- /**
15
- * Creates a typed HTTP client with openapi-fetch.
16
- * This provides full type inference for all API endpoints.
17
- */
18
- export function createTypedClient(options) {
19
- return createClient({
20
- baseUrl: options.baseUrl,
21
- headers: options.headers,
22
- });
23
- }
24
- /**
25
- * Legacy raw client interface (for backward compatibility).
26
- * Wraps openapi-fetch to provide the old interface while maintaining types.
27
- */
28
- export function createRawClient(options) {
29
- const { baseUrl, headers: defaultHeaders = {}, headerProvider, contextProvider } = options;
30
- const networkConfig = mergeNetworkConfig(options.network);
31
- const warn = (message) => {
32
- const hookWarn = options.hooks?.logger?.warn;
33
- if (typeof hookWarn === "function") {
34
- hookWarn(message);
35
- return;
36
- }
37
- if (typeof console !== "undefined" && typeof console.warn === "function") {
38
- console.warn(message);
39
- }
40
- };
41
- // Sticky fallback context for clients that don't provide per-operation context.
42
- const fallbackContext = Object.freeze({
43
- correlationId: crypto.randomUUID(),
44
- });
45
- let warnedStickyFallbackContext = false;
46
- let warnedInvalidContextCorrelation = false;
47
- const resolveEffectiveContext = (optsContext) => {
48
- const providerContext = contextProvider?.get();
49
- const usingStickyFallback = !optsContext && !providerContext;
50
- if (usingStickyFallback && !contextProvider && !warnedStickyFallbackContext) {
51
- warnedStickyFallbackContext = true;
52
- warn("[AgentOS SDK] Using sticky fallback correlation context per client instance. " +
53
- "For long-lived server clients, configure contextProvider (ALS/manual) to scope correlation per request.");
54
- }
55
- const effectiveContext = optsContext ?? providerContext ?? fallbackContext;
56
- const correlationProvidedByCaller = effectiveContext !== fallbackContext
57
- && typeof effectiveContext?.correlationId === "string";
58
- if (correlationProvidedByCaller) {
59
- const validCorrelation = sanitizeValidCorrelationId(effectiveContext.correlationId);
60
- if (!validCorrelation) {
61
- if (!warnedInvalidContextCorrelation) {
62
- warnedInvalidContextCorrelation = true;
63
- warn("[AgentOS SDK] Invalid correlationId in operation context ignored; generated fallback correlation id. " +
64
- "Provide a valid correlationId (8-128 chars: A-Za-z0-9._:-).");
65
- }
66
- // Caller provided invalid flow id: use per-request fallback (not sticky fallback context).
67
- return {
68
- ...effectiveContext,
69
- correlationId: crypto.randomUUID(),
70
- };
71
- }
72
- if (validCorrelation !== effectiveContext.correlationId) {
73
- return {
74
- ...effectiveContext,
75
- correlationId: validCorrelation,
76
- };
77
- }
78
- }
79
- return effectiveContext;
80
- };
81
- async function request(method, path, opts) {
82
- // Replace path params
83
- let url = path;
84
- if (opts?.params?.path) {
85
- for (const [key, value] of Object.entries(opts.params.path)) {
86
- url = url.replace(`{${key}}`, encodeURIComponent(value));
87
- // Also handle {id} pattern common in our API
88
- url = url.replace(`{id}`, encodeURIComponent(value));
89
- }
90
- }
91
- // Build query string
92
- if (opts?.params?.query) {
93
- const query = new URLSearchParams();
94
- for (const [key, value] of Object.entries(opts.params.query)) {
95
- if (value !== undefined && value !== null) {
96
- query.append(key, String(value));
97
- }
98
- }
99
- const queryStr = query.toString();
100
- if (queryStr) {
101
- url += `?${queryStr}`;
102
- }
103
- }
104
- const fullUrl = `${baseUrl}${url}`;
105
- // Resolve dynamic headers (e.g. auth)
106
- const dynamicHeaders = headerProvider ? await headerProvider() : {};
107
- const headers = {
108
- ...defaultHeaders,
109
- ...dynamicHeaders,
110
- ...opts?.headers,
111
- };
112
- if (opts?.body) {
113
- headers["Content-Type"] = "application/json";
114
- }
115
- const effectiveContext = resolveEffectiveContext(opts?.context);
116
- // Build standard headers via HttpRequestBuilder (single source of truth)
117
- const builderHeaders = httpRequestBuilder.build({
118
- context: effectiveContext,
119
- idempotencyKey: opts?.idempotencyKey,
120
- requireFlow: opts?.requireFlow,
121
- });
122
- // Merge builder headers (X-Request-Id, X-Correlation-Id, X-Idempotency-Key, User-Agent)
123
- Object.assign(headers, builderHeaders);
124
- // Use X-Request-Id from builder as client request ID
125
- const clientRequestId = headers["X-Request-Id"];
126
- // Call onRequest hook
127
- const startTime = Date.now();
128
- await options.hooks?.onRequest?.({
129
- method,
130
- url: fullUrl,
131
- headers,
132
- body: opts?.body,
133
- requestId: clientRequestId,
134
- });
135
- // Execute the actual fetch
136
- const doFetch = async (signal) => {
137
- return fetch(fullUrl, {
138
- method,
139
- headers,
140
- body: opts?.body ? JSON.stringify(opts.body) : undefined,
141
- signal,
142
- });
143
- };
144
- let response;
145
- try {
146
- const hasIdempotencyKey = Boolean(opts?.idempotencyKey ||
147
- headers["X-Idempotency-Key"] ||
148
- headers["Idempotency-Key"]);
149
- const executeAttempt = async (signal) => {
150
- const attemptResponse = await withTimeout(async (timeoutSignal) => {
151
- try {
152
- return await doFetch(timeoutSignal);
153
- }
154
- catch (fetchError) {
155
- // Preserve AbortError semantics for caller-provided cancellation.
156
- if (fetchError instanceof Error && fetchError.name === "AbortError") {
157
- throw fetchError;
158
- }
159
- throw new NetworkError(fetchError instanceof Error ? fetchError.message : "Network request failed", fetchError instanceof Error ? fetchError : undefined);
160
- }
161
- }, opts?.timeoutMs ?? networkConfig.timeoutMs, signal);
162
- if (!attemptResponse.ok) {
163
- let errorBody;
164
- try {
165
- errorBody = await attemptResponse.json();
166
- }
167
- catch {
168
- // Ignore JSON parse errors and fallback to status text.
169
- }
170
- const typedError = createErrorFromResponse(attemptResponse, errorBody, path);
171
- typedError.response = attemptResponse;
172
- typedError.payload = errorBody;
173
- throw typedError;
174
- }
175
- return attemptResponse;
176
- };
177
- if (opts?.retry === false) {
178
- response = await executeAttempt(opts?.signal);
179
- }
180
- else {
181
- response = await withRetry((signal) => executeAttempt(signal), networkConfig.retry, { method, hasIdempotencyKey }, opts?.signal);
182
- }
183
- }
184
- catch (requestError) {
185
- const durationMs = Date.now() - startTime;
186
- const error = requestError instanceof Error ? requestError : new Error(String(requestError));
187
- const typedError = requestError instanceof AgentOsError ? requestError : undefined;
188
- const errorResponse = typedError?.response;
189
- const requestId = errorResponse?.headers.get("x-request-id")
190
- ?? typedError?.requestId
191
- ?? clientRequestId;
192
- // Call onError hook
193
- await options.hooks?.onError?.({
194
- method,
195
- url: fullUrl,
196
- error,
197
- durationMs,
198
- requestId,
199
- });
200
- if (typedError && errorResponse) {
201
- return {
202
- error: {
203
- code: typedError.backendCode || typedError.code,
204
- message: typedError.message,
205
- details: typedError.details,
206
- // Include full payload for validation hints and backend-specific fields.
207
- ...typedError.payload,
208
- },
209
- response: errorResponse,
210
- meta: { requestId },
211
- };
212
- }
213
- if (error instanceof TimeoutError) {
214
- return {
215
- error: {
216
- code: error.code,
217
- message: error.message,
218
- },
219
- response: new Response(null, { status: 408, statusText: "Request Timeout" }),
220
- meta: { requestId },
221
- };
222
- }
223
- // Network/abort/unexpected errors - return as standardized transport error.
224
- return {
225
- error: {
226
- code: "NETWORK_ERROR",
227
- message: error.message || "Network request failed"
228
- },
229
- response: new Response(null, { status: 503, statusText: "Network Error" }),
230
- meta: { requestId },
231
- };
232
- }
233
- const durationMs = Date.now() - startTime;
234
- // Extract requestId for tracing (prefer server requestId if available)
235
- const requestId = response.headers.get("x-request-id") ?? clientRequestId;
236
- // Call onResponse hook
237
- await options.hooks?.onResponse?.({
238
- method,
239
- url: fullUrl,
240
- status: response.status,
241
- durationMs,
242
- requestId,
243
- });
244
- // Handle no-content responses
245
- if (response.status === 204) {
246
- return { data: undefined, response, meta: { requestId } };
247
- }
248
- try {
249
- const data = await response.json();
250
- return { data: data, response, meta: { requestId } };
251
- }
252
- catch {
253
- return { data: undefined, response, meta: { requestId } };
254
- }
255
- }
256
- return {
257
- GET: (path, opts) => request("GET", path, opts),
258
- POST: (path, opts) => request("POST", path, opts),
259
- PUT: (path, opts) => request("PUT", path, opts),
260
- PATCH: (path, opts) => request("PATCH", path, opts),
261
- DELETE: (path, opts) => request("DELETE", path, opts),
262
- /**
263
- * Stream GET request - returns raw Response for SSE consumption.
264
- * Headers are resolved asynchronously (includes Auth + Workspace).
265
- */
266
- streamGet: async (path, opts) => {
267
- let url = path;
268
- if (opts?.params?.path) {
269
- for (const [key, value] of Object.entries(opts.params.path)) {
270
- url = url.replace(`{${key}}`, encodeURIComponent(value));
271
- }
272
- }
273
- if (opts?.params?.query) {
274
- const query = new URLSearchParams();
275
- for (const [key, value] of Object.entries(opts.params.query)) {
276
- if (value !== undefined && value !== null) {
277
- query.append(key, String(value));
278
- }
279
- }
280
- const queryStr = query.toString();
281
- if (queryStr)
282
- url += `?${queryStr}`;
283
- }
284
- const fullUrl = `${baseUrl}${url}`;
285
- const dynamicHeaders = headerProvider ? await headerProvider() : {};
286
- const effectiveContext = resolveEffectiveContext(opts?.context);
287
- const builderHeaders = httpRequestBuilder.build({
288
- context: effectiveContext,
289
- requireFlow: opts?.requireFlow,
290
- });
291
- const headers = {
292
- ...defaultHeaders,
293
- ...dynamicHeaders,
294
- ...builderHeaders,
295
- Accept: "text/event-stream",
296
- ...opts?.headers,
297
- };
298
- return fetch(fullUrl, { method: "GET", headers, signal: opts?.signal });
299
- },
300
- /**
301
- * Stream POST request - returns raw Response for SSE consumption.
302
- * Headers are resolved asynchronously (includes Auth + Workspace).
303
- */
304
- streamPost: async (path, opts) => {
305
- let url = path;
306
- if (opts?.params?.path) {
307
- for (const [key, value] of Object.entries(opts.params.path)) {
308
- url = url.replace(`{${key}}`, encodeURIComponent(value));
309
- }
310
- }
311
- const fullUrl = `${baseUrl}${url}`;
312
- const dynamicHeaders = headerProvider ? await headerProvider() : {};
313
- const effectiveContext = resolveEffectiveContext(opts?.context);
314
- const builderHeaders = httpRequestBuilder.build({
315
- context: effectiveContext,
316
- idempotencyKey: opts?.idempotencyKey,
317
- requireFlow: opts?.requireFlow,
318
- });
319
- const headers = {
320
- ...defaultHeaders,
321
- ...dynamicHeaders,
322
- ...builderHeaders,
323
- "Content-Type": "application/json",
324
- Accept: "text/event-stream",
325
- ...opts?.headers,
326
- };
327
- return fetch(fullUrl, {
328
- method: "POST",
329
- headers,
330
- body: opts?.body ? JSON.stringify(opts.body) : undefined,
331
- signal: opts?.signal,
332
- });
333
- },
334
- /** Base URL for constructing full URLs when needed */
335
- baseUrl,
336
- };
337
- }
@@ -1,37 +0,0 @@
1
- /**
2
- * Agent OS SDK - Retry Logic
3
- *
4
- * Enterprise-grade retry with:
5
- * - Exponential backoff with jitter
6
- * - Respect for Retry-After headers
7
- * - Idempotency-aware mutation retries
8
- * - Proper abort signal handling (no listener leaks)
9
- */
10
- import type { RetryConfig } from "./config.js";
11
- /**
12
- * Context for retry decision-making.
13
- */
14
- export interface RetryContext {
15
- /** HTTP method (GET, POST, etc.) */
16
- method: string;
17
- /** Whether the request has an idempotency key */
18
- hasIdempotencyKey: boolean;
19
- }
20
- /**
21
- * Wraps an async function with retry logic.
22
- *
23
- * IMPORTANT: Mutations (POST/PUT/PATCH/DELETE) are only retried if hasIdempotencyKey is true.
24
- * This prevents duplicate side effects.
25
- *
26
- * @param fn - Function to execute (receives an AbortSignal)
27
- * @param config - Retry configuration
28
- * @param context - Request context for retry decisions
29
- * @param parentSignal - Optional parent AbortSignal for cancellation
30
- */
31
- export declare function withRetry<T>(fn: (signal: AbortSignal) => Promise<T>, config: RetryConfig, context: RetryContext, parentSignal?: AbortSignal): Promise<T>;
32
- /**
33
- * Sleep utility.
34
- */
35
- declare function sleep(ms: number): Promise<void>;
36
- export { sleep };
37
- //# sourceMappingURL=retry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../src/client/retry.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB,oCAAoC;IACpC,MAAM,EAAE,MAAM,CAAC;IAEf,iDAAiD;IACjD,iBAAiB,EAAE,OAAO,CAAC;CAC9B;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,SAAS,CAAC,CAAC,EAC7B,EAAE,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,EACvC,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,YAAY,EACrB,YAAY,CAAC,EAAE,WAAW,GAC3B,OAAO,CAAC,CAAC,CAAC,CAmDZ;AAmDD;;GAEG;AACH,iBAAS,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAExC;AAED,OAAO,EAAE,KAAK,EAAE,CAAC"}