@agent-os-sdk/client 0.9.25 → 0.9.27

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 (65) hide show
  1. package/dist/generated/openapi.d.ts +82 -0
  2. package/dist/generated/openapi.d.ts.map +1 -1
  3. package/dist/modules/runs.d.ts.map +1 -1
  4. package/dist/modules/templates.d.ts +23 -0
  5. package/dist/modules/templates.d.ts.map +1 -1
  6. package/dist/modules/templates.js +7 -0
  7. package/package.json +2 -2
  8. package/src/client/AgentOsClient.ts +0 -294
  9. package/src/client/HttpRequestBuilder.ts +0 -115
  10. package/src/client/OperationContext.ts +0 -22
  11. package/src/client/OperationContextProvider.ts +0 -89
  12. package/src/client/auth.ts +0 -136
  13. package/src/client/config.ts +0 -100
  14. package/src/client/helpers.ts +0 -98
  15. package/src/client/pagination.ts +0 -218
  16. package/src/client/raw.ts +0 -609
  17. package/src/client/retry.ts +0 -150
  18. package/src/client/sanitize.ts +0 -31
  19. package/src/client/timeout.ts +0 -59
  20. package/src/errors/factory.ts +0 -140
  21. package/src/errors/index.ts +0 -365
  22. package/src/generated/client.ts +0 -32
  23. package/src/generated/index.ts +0 -2
  24. package/src/generated/openapi.ts +0 -12302
  25. package/src/generated/swagger.json +0 -16851
  26. package/src/index.ts +0 -131
  27. package/src/modules/a2a.ts +0 -64
  28. package/src/modules/agents.ts +0 -604
  29. package/src/modules/apiTokens.ts +0 -101
  30. package/src/modules/approvals.ts +0 -151
  31. package/src/modules/audit.ts +0 -145
  32. package/src/modules/auth.ts +0 -33
  33. package/src/modules/catalog.ts +0 -241
  34. package/src/modules/chatwoot.ts +0 -242
  35. package/src/modules/checkpoints.ts +0 -87
  36. package/src/modules/contracts.ts +0 -80
  37. package/src/modules/credentials.ts +0 -216
  38. package/src/modules/crons.ts +0 -115
  39. package/src/modules/datasets.ts +0 -142
  40. package/src/modules/evaluation.ts +0 -269
  41. package/src/modules/files.ts +0 -208
  42. package/src/modules/improvements.ts +0 -71
  43. package/src/modules/info.ts +0 -143
  44. package/src/modules/me.ts +0 -74
  45. package/src/modules/members.ts +0 -199
  46. package/src/modules/memberships.ts +0 -42
  47. package/src/modules/metaAgent.ts +0 -131
  48. package/src/modules/metrics.ts +0 -34
  49. package/src/modules/observability.ts +0 -28
  50. package/src/modules/playground.ts +0 -68
  51. package/src/modules/presets.ts +0 -246
  52. package/src/modules/prompts.ts +0 -147
  53. package/src/modules/roles.ts +0 -112
  54. package/src/modules/runs.ts +0 -878
  55. package/src/modules/store.ts +0 -65
  56. package/src/modules/templates.ts +0 -40
  57. package/src/modules/tenants.ts +0 -79
  58. package/src/modules/threads.ts +0 -343
  59. package/src/modules/tools.ts +0 -91
  60. package/src/modules/traces.ts +0 -133
  61. package/src/modules/triggers.ts +0 -357
  62. package/src/modules/usage.ts +0 -117
  63. package/src/modules/vectorStores.ts +0 -257
  64. package/src/modules/workspaces.ts +0 -216
  65. package/src/sse/client.ts +0 -179
@@ -1,365 +0,0 @@
1
- /**
2
- * Agent OS SDK - Typed Errors
3
- *
4
- * Enterprise-grade error classification for predictable error handling.
5
- * All errors extend AgentOsError and include semantic information.
6
- */
7
-
8
- /**
9
- * Options for constructing typed errors
10
- */
11
- export interface ErrorOptions {
12
- /** Request ID from x-request-id header */
13
- requestId?: string;
14
- /** Original error code from backend (preserves backend semantics) */
15
- backendCode?: string;
16
- /** Raw details object from backend response */
17
- details?: unknown;
18
- }
19
-
20
- /**
21
- * Base class for all Agent OS SDK errors.
22
- * Provides consistent structure for error handling and classification.
23
- */
24
- export abstract class AgentOsError extends Error {
25
- /** Error code for programmatic handling */
26
- abstract readonly code: string;
27
-
28
- /** HTTP status code (0 for network/timeout errors) */
29
- abstract readonly status: number;
30
-
31
- /** Request ID from x-request-id header */
32
- readonly requestId?: string;
33
-
34
- /** Original error code from backend (preserves backend semantics) */
35
- readonly backendCode?: string;
36
-
37
- /** Raw details object from backend response */
38
- readonly details?: unknown;
39
-
40
- /** Timestamp when error occurred */
41
- readonly timestamp: string = new Date().toISOString();
42
-
43
- constructor(message: string, options?: ErrorOptions) {
44
- super(message);
45
- this.name = this.constructor.name;
46
- this.requestId = options?.requestId;
47
- this.backendCode = options?.backendCode;
48
- this.details = options?.details;
49
-
50
- // Maintains proper stack trace (V8 engines only)
51
- if ("captureStackTrace" in Error && typeof Error.captureStackTrace === "function") {
52
- Error.captureStackTrace(this, this.constructor);
53
- }
54
- }
55
-
56
- /**
57
- * Whether this error is retryable with the same request.
58
- * Override in subclasses for specific behavior.
59
- */
60
- isRetryable(): boolean {
61
- return false;
62
- }
63
-
64
- /** Convert to JSON for logging/serialization */
65
- toJSON(): Record<string, unknown> {
66
- return {
67
- name: this.name,
68
- code: this.code,
69
- status: this.status,
70
- message: this.message,
71
- requestId: this.requestId,
72
- backendCode: this.backendCode,
73
- details: this.details,
74
- timestamp: this.timestamp,
75
- };
76
- }
77
- }
78
-
79
- // ============================================================================
80
- // Authentication & Authorization Errors
81
- // ============================================================================
82
-
83
- /**
84
- * 401 Unauthorized - Invalid or missing authentication.
85
- *
86
- * @example
87
- * if (error instanceof UnauthorizedError) {
88
- * // Redirect to login
89
- * }
90
- */
91
- export class UnauthorizedError extends AgentOsError {
92
- readonly code = "UNAUTHORIZED";
93
- readonly status = 401;
94
-
95
- constructor(message = "Authentication required", options?: ErrorOptions) {
96
- super(message, options);
97
- }
98
- }
99
-
100
- /**
101
- * 403 Forbidden - Valid auth but insufficient permissions.
102
- *
103
- * @example
104
- * if (error instanceof ForbiddenError) {
105
- * showToast("You don't have permission to perform this action");
106
- * }
107
- */
108
- export class ForbiddenError extends AgentOsError {
109
- readonly code = "FORBIDDEN";
110
- readonly status = 403;
111
-
112
- constructor(message = "Access denied", options?: ErrorOptions) {
113
- super(message, options);
114
- }
115
- }
116
-
117
- // ============================================================================
118
- // Resource Errors
119
- // ============================================================================
120
-
121
- /**
122
- * 404 Not Found - Resource does not exist.
123
- *
124
- * @example
125
- * if (error instanceof NotFoundError) {
126
- * console.log(`Not found at: ${error.path}`);
127
- * }
128
- */
129
- export class NotFoundError extends AgentOsError {
130
- readonly code = "NOT_FOUND";
131
- readonly status = 404;
132
-
133
- constructor(
134
- message = "Resource not found",
135
- /** The request path that returned 404 */
136
- readonly path?: string,
137
- options?: ErrorOptions
138
- ) {
139
- super(message, options);
140
- }
141
- }
142
-
143
- /**
144
- * 409 Conflict - Resource already exists or state conflict.
145
- *
146
- * @example
147
- * if (error instanceof ConflictError) {
148
- * // Handle duplicate or version mismatch
149
- * }
150
- */
151
- export class ConflictError extends AgentOsError {
152
- readonly code = "CONFLICT";
153
- readonly status = 409;
154
-
155
- constructor(message = "Resource conflict", options?: ErrorOptions) {
156
- super(message, options);
157
- }
158
- }
159
-
160
- // ============================================================================
161
- // Validation Errors
162
- // ============================================================================
163
-
164
- /**
165
- * Field-level validation error detail.
166
- */
167
- export interface FieldError {
168
- field: string;
169
- message: string;
170
- code?: string;
171
- }
172
-
173
- /**
174
- * 400/422 Validation Error - Invalid request data.
175
- *
176
- * @example
177
- * if (error instanceof ValidationError) {
178
- * error.fieldErrors?.forEach(fe => {
179
- * showFieldError(fe.field, fe.message);
180
- * });
181
- * }
182
- */
183
- export class ValidationError extends AgentOsError {
184
- readonly code = "VALIDATION_ERROR";
185
- readonly status: 400 | 422;
186
-
187
- constructor(
188
- message = "Validation failed",
189
- status: 400 | 422 = 400,
190
- readonly fieldErrors?: FieldError[],
191
- options?: ErrorOptions
192
- ) {
193
- super(message, options);
194
- this.status = status;
195
- }
196
-
197
- /** Get error message for a specific field */
198
- getFieldError(field: string): string | undefined {
199
- return this.fieldErrors?.find(fe => fe.field === field)?.message;
200
- }
201
-
202
- /** Check if a specific field has an error */
203
- hasFieldError(field: string): boolean {
204
- return this.fieldErrors?.some(fe => fe.field === field) ?? false;
205
- }
206
- }
207
-
208
- // ============================================================================
209
- // Rate Limiting
210
- // ============================================================================
211
-
212
- /**
213
- * 429 Too Many Requests - Rate limit exceeded.
214
- *
215
- * @example
216
- * if (error instanceof RateLimitError) {
217
- * if (error.retryAfterMs) {
218
- * await sleep(error.retryAfterMs);
219
- * // Retry request
220
- * }
221
- * }
222
- */
223
- export class RateLimitError extends AgentOsError {
224
- readonly code = "RATE_LIMITED";
225
- readonly status = 429;
226
-
227
- constructor(
228
- message = "Rate limit exceeded",
229
- /** Time to wait before retrying (milliseconds) */
230
- readonly retryAfterMs?: number,
231
- options?: ErrorOptions
232
- ) {
233
- super(message, options);
234
- }
235
-
236
- isRetryable(): boolean {
237
- return true;
238
- }
239
-
240
- /** Get retry delay or default */
241
- getRetryDelay(defaultMs = 1000): number {
242
- return this.retryAfterMs ?? defaultMs;
243
- }
244
- }
245
-
246
- // ============================================================================
247
- // Server Errors
248
- // ============================================================================
249
-
250
- /**
251
- * 5xx Server Error - Backend failure.
252
- *
253
- * @example
254
- * if (error instanceof ServerError) {
255
- * if (error.isRetryable()) {
256
- * // Retry with backoff
257
- * }
258
- * }
259
- */
260
- export class ServerError extends AgentOsError {
261
- readonly code = "SERVER_ERROR";
262
-
263
- constructor(
264
- message = "Internal server error",
265
- readonly status: number = 500,
266
- options?: ErrorOptions
267
- ) {
268
- super(message, options);
269
- }
270
-
271
- isRetryable(): boolean {
272
- // 500, 502, 503, 504 are typically retryable
273
- return [500, 502, 503, 504].includes(this.status);
274
- }
275
- }
276
-
277
- // ============================================================================
278
- // Network & Timeout Errors
279
- // ============================================================================
280
-
281
- /**
282
- * Network Error - Fetch failed (no response received).
283
- *
284
- * @example
285
- * if (error instanceof NetworkError) {
286
- * showToast("Network connection failed. Check your internet.");
287
- * }
288
- */
289
- export class NetworkError extends AgentOsError {
290
- readonly code = "NETWORK_ERROR";
291
- readonly status = 0;
292
-
293
- constructor(
294
- message = "Network request failed",
295
- readonly cause?: Error
296
- ) {
297
- super(message);
298
- }
299
-
300
- isRetryable(): boolean {
301
- return true;
302
- }
303
- }
304
-
305
- /**
306
- * Timeout Error - Request exceeded time limit.
307
- *
308
- * @example
309
- * if (error instanceof TimeoutError) {
310
- * console.log(`Request timed out after ${error.timeoutMs}ms`);
311
- * }
312
- */
313
- export class TimeoutError extends AgentOsError {
314
- readonly code = "TIMEOUT";
315
- readonly status = 0;
316
-
317
- constructor(
318
- /** Timeout duration in milliseconds */
319
- readonly timeoutMs: number
320
- ) {
321
- super(`Request timed out after ${timeoutMs}ms`);
322
- }
323
-
324
- isRetryable(): boolean {
325
- return true;
326
- }
327
- }
328
-
329
- // ============================================================================
330
- // Error Type Guards
331
- // ============================================================================
332
-
333
- /** Check if error is any Agent OS SDK error */
334
- export function isAgentOsError(error: unknown): error is AgentOsError {
335
- return error instanceof AgentOsError;
336
- }
337
-
338
- /** Check if error is retryable */
339
- export function isRetryableError(error: unknown): boolean {
340
- if (error instanceof AgentOsError) {
341
- return error.isRetryable();
342
- }
343
- return false;
344
- }
345
-
346
- /** Check if error is an auth error (401 or 403) */
347
- export function isAuthError(error: unknown): error is UnauthorizedError | ForbiddenError {
348
- return error instanceof UnauthorizedError || error instanceof ForbiddenError;
349
- }
350
-
351
- /** Check if error is a client error (4xx) */
352
- export function isClientError(error: unknown): boolean {
353
- if (error instanceof AgentOsError) {
354
- return error.status >= 400 && error.status < 500;
355
- }
356
- return false;
357
- }
358
-
359
- /** Check if error is a server error (5xx) */
360
- export function isServerError(error: unknown): boolean {
361
- if (error instanceof AgentOsError) {
362
- return error.status >= 500 && error.status < 600;
363
- }
364
- return false;
365
- }
@@ -1,32 +0,0 @@
1
- /**
2
- * Agent OS SDK - 100% Auto-Generated Client
3
- *
4
- * This client is fully generated from the OpenAPI specification.
5
- * NO manual types, NO manual endpoints - everything comes from swagger.json.
6
- */
7
-
8
- // Re-export the generated types
9
- export type { paths, components } from "./openapi.js";
10
-
11
- // Re-export openapi-fetch createClient
12
- import _createClient, { type ClientOptions as OpenapiClientOptions } from "openapi-fetch";
13
- import type { paths } from "./openapi.js";
14
-
15
- export type ClientOptions = OpenapiClientOptions & {
16
- baseUrl: string;
17
- };
18
-
19
- /**
20
- * Create a fully typed API client.
21
- * All endpoints and types are auto-generated from OpenAPI spec.
22
- */
23
- export function createClient(options: ClientOptions) {
24
- return _createClient<paths>(options);
25
- }
26
-
27
- // Type alias for the generated client
28
- export type AgentOsClient = ReturnType<typeof createClient>;
29
-
30
- // Convenience type for extracting schema types
31
- export type Schema<T extends keyof import("./openapi.js").components["schemas"]> =
32
- import("./openapi.js").components["schemas"][T];
@@ -1,2 +0,0 @@
1
- // Auto-generated - do not edit
2
- export type * from "./openapi.js";