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