@agent-os-sdk/client 0.3.14 → 0.4.0
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.
- package/dist/client/AgentOsClient.d.ts.map +1 -1
- package/dist/client/AgentOsClient.js +4 -5
- package/dist/client/config.d.ts +49 -0
- package/dist/client/config.d.ts.map +1 -0
- package/dist/client/config.js +62 -0
- package/dist/client/pagination.d.ts +105 -0
- package/dist/client/pagination.d.ts.map +1 -0
- package/dist/client/pagination.js +117 -0
- package/dist/client/raw.d.ts +65 -0
- package/dist/client/raw.d.ts.map +1 -1
- package/dist/client/raw.js +78 -17
- package/dist/client/retry.d.ts +37 -0
- package/dist/client/retry.d.ts.map +1 -0
- package/dist/client/retry.js +108 -0
- package/dist/client/timeout.d.ts +26 -0
- package/dist/client/timeout.d.ts.map +1 -0
- package/dist/client/timeout.js +51 -0
- package/dist/errors/factory.d.ts +20 -0
- package/dist/errors/factory.d.ts.map +1 -0
- package/dist/errors/factory.js +97 -0
- package/dist/errors/index.d.ts +210 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +283 -0
- package/dist/index.d.ts +11 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -0
- package/dist/modules/audit.d.ts +27 -4
- package/dist/modules/audit.d.ts.map +1 -1
- package/dist/modules/audit.js +58 -2
- package/dist/modules/catalog.d.ts +28 -4
- package/dist/modules/catalog.d.ts.map +1 -1
- package/dist/modules/catalog.js +15 -1
- package/dist/modules/checkpoints.d.ts +1 -1
- package/dist/modules/checkpoints.d.ts.map +1 -1
- package/dist/modules/info.d.ts +49 -0
- package/dist/modules/info.d.ts.map +1 -1
- package/dist/modules/info.js +66 -0
- package/dist/modules/runs.d.ts +103 -0
- package/dist/modules/runs.d.ts.map +1 -1
- package/dist/modules/runs.js +258 -0
- package/dist/modules/tenants.d.ts +4 -1
- package/dist/modules/tenants.d.ts.map +1 -1
- package/dist/modules/tenants.js +3 -0
- package/dist/modules/threads.d.ts +24 -0
- package/dist/modules/threads.d.ts.map +1 -1
- package/dist/modules/threads.js +48 -1
- package/dist/sse/client.d.ts.map +1 -1
- package/dist/sse/client.js +17 -5
- package/package.json +1 -1
- package/src/client/AgentOsClient.ts +4 -7
- package/src/client/config.ts +100 -0
- package/src/client/pagination.ts +218 -0
- package/src/client/raw.ts +138 -17
- package/src/client/retry.ts +150 -0
- package/src/client/timeout.ts +59 -0
- package/src/errors/factory.ts +135 -0
- package/src/errors/index.ts +365 -0
- package/src/index.ts +72 -2
- package/src/modules/audit.ts +77 -6
- package/src/modules/catalog.ts +38 -5
- package/src/modules/checkpoints.ts +1 -1
- package/src/modules/info.ts +108 -0
- package/src/modules/runs.ts +333 -0
- package/src/modules/tenants.ts +5 -2
- package/src/modules/threads.ts +57 -1
- package/src/sse/client.ts +21 -5
|
@@ -0,0 +1,283 @@
|
|
|
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
|
+
* Base class for all Agent OS SDK errors.
|
|
9
|
+
* Provides consistent structure for error handling and classification.
|
|
10
|
+
*/
|
|
11
|
+
export class AgentOsError extends Error {
|
|
12
|
+
/** Request ID from x-request-id header */
|
|
13
|
+
requestId;
|
|
14
|
+
/** Original error code from backend (preserves backend semantics) */
|
|
15
|
+
backendCode;
|
|
16
|
+
/** Raw details object from backend response */
|
|
17
|
+
details;
|
|
18
|
+
/** Timestamp when error occurred */
|
|
19
|
+
timestamp = new Date().toISOString();
|
|
20
|
+
constructor(message, options) {
|
|
21
|
+
super(message);
|
|
22
|
+
this.name = this.constructor.name;
|
|
23
|
+
this.requestId = options?.requestId;
|
|
24
|
+
this.backendCode = options?.backendCode;
|
|
25
|
+
this.details = options?.details;
|
|
26
|
+
// Maintains proper stack trace (V8 engines only)
|
|
27
|
+
if ("captureStackTrace" in Error && typeof Error.captureStackTrace === "function") {
|
|
28
|
+
Error.captureStackTrace(this, this.constructor);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Whether this error is retryable with the same request.
|
|
33
|
+
* Override in subclasses for specific behavior.
|
|
34
|
+
*/
|
|
35
|
+
isRetryable() {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
/** Convert to JSON for logging/serialization */
|
|
39
|
+
toJSON() {
|
|
40
|
+
return {
|
|
41
|
+
name: this.name,
|
|
42
|
+
code: this.code,
|
|
43
|
+
status: this.status,
|
|
44
|
+
message: this.message,
|
|
45
|
+
requestId: this.requestId,
|
|
46
|
+
backendCode: this.backendCode,
|
|
47
|
+
details: this.details,
|
|
48
|
+
timestamp: this.timestamp,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// ============================================================================
|
|
53
|
+
// Authentication & Authorization Errors
|
|
54
|
+
// ============================================================================
|
|
55
|
+
/**
|
|
56
|
+
* 401 Unauthorized - Invalid or missing authentication.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* if (error instanceof UnauthorizedError) {
|
|
60
|
+
* // Redirect to login
|
|
61
|
+
* }
|
|
62
|
+
*/
|
|
63
|
+
export class UnauthorizedError extends AgentOsError {
|
|
64
|
+
code = "UNAUTHORIZED";
|
|
65
|
+
status = 401;
|
|
66
|
+
constructor(message = "Authentication required", options) {
|
|
67
|
+
super(message, options);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* 403 Forbidden - Valid auth but insufficient permissions.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* if (error instanceof ForbiddenError) {
|
|
75
|
+
* showToast("You don't have permission to perform this action");
|
|
76
|
+
* }
|
|
77
|
+
*/
|
|
78
|
+
export class ForbiddenError extends AgentOsError {
|
|
79
|
+
code = "FORBIDDEN";
|
|
80
|
+
status = 403;
|
|
81
|
+
constructor(message = "Access denied", options) {
|
|
82
|
+
super(message, options);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
// ============================================================================
|
|
86
|
+
// Resource Errors
|
|
87
|
+
// ============================================================================
|
|
88
|
+
/**
|
|
89
|
+
* 404 Not Found - Resource does not exist.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* if (error instanceof NotFoundError) {
|
|
93
|
+
* console.log(`Not found at: ${error.path}`);
|
|
94
|
+
* }
|
|
95
|
+
*/
|
|
96
|
+
export class NotFoundError extends AgentOsError {
|
|
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) {
|
|
103
|
+
super(message, options);
|
|
104
|
+
this.path = path;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* 409 Conflict - Resource already exists or state conflict.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* if (error instanceof ConflictError) {
|
|
112
|
+
* // Handle duplicate or version mismatch
|
|
113
|
+
* }
|
|
114
|
+
*/
|
|
115
|
+
export class ConflictError extends AgentOsError {
|
|
116
|
+
code = "CONFLICT";
|
|
117
|
+
status = 409;
|
|
118
|
+
constructor(message = "Resource conflict", options) {
|
|
119
|
+
super(message, options);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* 400/422 Validation Error - Invalid request data.
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* if (error instanceof ValidationError) {
|
|
127
|
+
* error.fieldErrors?.forEach(fe => {
|
|
128
|
+
* showFieldError(fe.field, fe.message);
|
|
129
|
+
* });
|
|
130
|
+
* }
|
|
131
|
+
*/
|
|
132
|
+
export class ValidationError extends AgentOsError {
|
|
133
|
+
fieldErrors;
|
|
134
|
+
code = "VALIDATION_ERROR";
|
|
135
|
+
status;
|
|
136
|
+
constructor(message = "Validation failed", status = 400, fieldErrors, options) {
|
|
137
|
+
super(message, options);
|
|
138
|
+
this.fieldErrors = fieldErrors;
|
|
139
|
+
this.status = status;
|
|
140
|
+
}
|
|
141
|
+
/** Get error message for a specific field */
|
|
142
|
+
getFieldError(field) {
|
|
143
|
+
return this.fieldErrors?.find(fe => fe.field === field)?.message;
|
|
144
|
+
}
|
|
145
|
+
/** Check if a specific field has an error */
|
|
146
|
+
hasFieldError(field) {
|
|
147
|
+
return this.fieldErrors?.some(fe => fe.field === field) ?? false;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
// ============================================================================
|
|
151
|
+
// Rate Limiting
|
|
152
|
+
// ============================================================================
|
|
153
|
+
/**
|
|
154
|
+
* 429 Too Many Requests - Rate limit exceeded.
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* if (error instanceof RateLimitError) {
|
|
158
|
+
* if (error.retryAfterMs) {
|
|
159
|
+
* await sleep(error.retryAfterMs);
|
|
160
|
+
* // Retry request
|
|
161
|
+
* }
|
|
162
|
+
* }
|
|
163
|
+
*/
|
|
164
|
+
export class RateLimitError extends AgentOsError {
|
|
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) {
|
|
171
|
+
super(message, options);
|
|
172
|
+
this.retryAfterMs = retryAfterMs;
|
|
173
|
+
}
|
|
174
|
+
isRetryable() {
|
|
175
|
+
return true;
|
|
176
|
+
}
|
|
177
|
+
/** Get retry delay or default */
|
|
178
|
+
getRetryDelay(defaultMs = 1000) {
|
|
179
|
+
return this.retryAfterMs ?? defaultMs;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
// ============================================================================
|
|
183
|
+
// Server Errors
|
|
184
|
+
// ============================================================================
|
|
185
|
+
/**
|
|
186
|
+
* 5xx Server Error - Backend failure.
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* if (error instanceof ServerError) {
|
|
190
|
+
* if (error.isRetryable()) {
|
|
191
|
+
* // Retry with backoff
|
|
192
|
+
* }
|
|
193
|
+
* }
|
|
194
|
+
*/
|
|
195
|
+
export class ServerError extends AgentOsError {
|
|
196
|
+
status;
|
|
197
|
+
code = "SERVER_ERROR";
|
|
198
|
+
constructor(message = "Internal server error", status = 500, options) {
|
|
199
|
+
super(message, options);
|
|
200
|
+
this.status = status;
|
|
201
|
+
}
|
|
202
|
+
isRetryable() {
|
|
203
|
+
// 500, 502, 503, 504 are typically retryable
|
|
204
|
+
return [500, 502, 503, 504].includes(this.status);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
// ============================================================================
|
|
208
|
+
// Network & Timeout Errors
|
|
209
|
+
// ============================================================================
|
|
210
|
+
/**
|
|
211
|
+
* Network Error - Fetch failed (no response received).
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* if (error instanceof NetworkError) {
|
|
215
|
+
* showToast("Network connection failed. Check your internet.");
|
|
216
|
+
* }
|
|
217
|
+
*/
|
|
218
|
+
export class NetworkError extends AgentOsError {
|
|
219
|
+
cause;
|
|
220
|
+
code = "NETWORK_ERROR";
|
|
221
|
+
status = 0;
|
|
222
|
+
constructor(message = "Network request failed", cause) {
|
|
223
|
+
super(message);
|
|
224
|
+
this.cause = cause;
|
|
225
|
+
}
|
|
226
|
+
isRetryable() {
|
|
227
|
+
return true;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Timeout Error - Request exceeded time limit.
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* if (error instanceof TimeoutError) {
|
|
235
|
+
* console.log(`Request timed out after ${error.timeoutMs}ms`);
|
|
236
|
+
* }
|
|
237
|
+
*/
|
|
238
|
+
export class TimeoutError extends AgentOsError {
|
|
239
|
+
timeoutMs;
|
|
240
|
+
code = "TIMEOUT";
|
|
241
|
+
status = 0;
|
|
242
|
+
constructor(
|
|
243
|
+
/** Timeout duration in milliseconds */
|
|
244
|
+
timeoutMs) {
|
|
245
|
+
super(`Request timed out after ${timeoutMs}ms`);
|
|
246
|
+
this.timeoutMs = timeoutMs;
|
|
247
|
+
}
|
|
248
|
+
isRetryable() {
|
|
249
|
+
return true;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
// ============================================================================
|
|
253
|
+
// Error Type Guards
|
|
254
|
+
// ============================================================================
|
|
255
|
+
/** Check if error is any Agent OS SDK error */
|
|
256
|
+
export function isAgentOsError(error) {
|
|
257
|
+
return error instanceof AgentOsError;
|
|
258
|
+
}
|
|
259
|
+
/** Check if error is retryable */
|
|
260
|
+
export function isRetryableError(error) {
|
|
261
|
+
if (error instanceof AgentOsError) {
|
|
262
|
+
return error.isRetryable();
|
|
263
|
+
}
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
/** Check if error is an auth error (401 or 403) */
|
|
267
|
+
export function isAuthError(error) {
|
|
268
|
+
return error instanceof UnauthorizedError || error instanceof ForbiddenError;
|
|
269
|
+
}
|
|
270
|
+
/** Check if error is a client error (4xx) */
|
|
271
|
+
export function isClientError(error) {
|
|
272
|
+
if (error instanceof AgentOsError) {
|
|
273
|
+
return error.status >= 400 && error.status < 500;
|
|
274
|
+
}
|
|
275
|
+
return false;
|
|
276
|
+
}
|
|
277
|
+
/** Check if error is a server error (5xx) */
|
|
278
|
+
export function isServerError(error) {
|
|
279
|
+
if (error instanceof AgentOsError) {
|
|
280
|
+
return error.status >= 500 && error.status < 600;
|
|
281
|
+
}
|
|
282
|
+
return false;
|
|
283
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -37,10 +37,16 @@
|
|
|
37
37
|
export { AgentOsClient, type AgentOsClientOptions, type AuthProvider } from "./client/AgentOsClient.js";
|
|
38
38
|
export { type ApiTokenAuth, type JwtAuth, isApiTokenAuth, isJwtAuth, isBrowser, isApiToken, isJwtToken, } from "./client/auth.js";
|
|
39
39
|
export { unwrap, toResult, SDKError, type PaginationParams, type PaginatedResponse, type Result, type Unwrapped, } from "./client/helpers.js";
|
|
40
|
-
export {
|
|
40
|
+
export { AgentOsError, type ErrorOptions, UnauthorizedError, ForbiddenError, NotFoundError, ConflictError, ValidationError, RateLimitError, ServerError, NetworkError, TimeoutError, type FieldError, isAgentOsError, isRetryableError, isAuthError, isClientError, isServerError, } from "./errors/index.js";
|
|
41
|
+
export { createErrorFromResponse } from "./errors/factory.js";
|
|
42
|
+
export { type RetryConfig, type NetworkConfig, DEFAULT_NETWORK_CONFIG, INTERACTIVE_NETWORK_CONFIG, BACKGROUND_NETWORK_CONFIG, mergeNetworkConfig, } from "./client/config.js";
|
|
43
|
+
export { withRetry, type RetryContext, sleep } from "./client/retry.js";
|
|
44
|
+
export { withTimeout, createTimeoutController } from "./client/timeout.js";
|
|
45
|
+
export { paginate, collectAll, getFirst, type OffsetPaginatedResponse, type CursorPaginatedResponse, type OffsetParams, type CursorParams, type PaginateOptions, } from "./client/pagination.js";
|
|
46
|
+
export { createRawClient, createTypedClient, type RawClient, type TypedClient, type ClientOptions, type APIResponse, type SDKHooks, type HookRequestContext, type HookResponseContext, type HookErrorContext, } from "./client/raw.js";
|
|
41
47
|
export type { paths, components } from "./client/raw.js";
|
|
42
48
|
export { AgentsModule, type Agent, type AgentVersion, type AgentListResponse, type AgentGraphResponse } from "./modules/agents.js";
|
|
43
|
-
export { RunsModule, type Run, type RunStatus, type RunEvent, type RunListResponse, type RunEventsResponse, type CreateRunResponse, type RunEventsPollResponse, type RunEventDto } from "./modules/runs.js";
|
|
49
|
+
export { RunsModule, type Run, type RunStatus, type RunEvent, type RunListResponse, type RunEventsResponse, type CreateRunResponse, type RunEventsPollResponse, type RunEventDto, type FollowOptions, type FollowEvent } from "./modules/runs.js";
|
|
44
50
|
export { ThreadsModule, type Thread, type ThreadState, type ThreadMessage, type ThreadRun, type ThreadListResponse, type ThreadMessagesResponse } from "./modules/threads.js";
|
|
45
51
|
export { ToolsModule, type Tool, type ToolListResponse } from "./modules/tools.js";
|
|
46
52
|
export { KnowledgeModule, type KnowledgeDataset, type KnowledgeSearchResponse } from "./modules/knowledge.js";
|
|
@@ -65,11 +71,13 @@ export { UsageModule, type UsageResponse, type UsageQuota } from "./modules/usag
|
|
|
65
71
|
export { McpModule, type McpServer } from "./modules/mcp.js";
|
|
66
72
|
export { A2aModule, type JsonRpcRequest, type JsonRpcResponse, type A2aAgentCard } from "./modules/a2a.js";
|
|
67
73
|
export { MeModule, type MeResponse } from "./modules/me.js";
|
|
68
|
-
export { InfoModule, type ServerInfo } from "./modules/info.js";
|
|
74
|
+
export { InfoModule, type ServerInfo, type ServerCapabilities } from "./modules/info.js";
|
|
69
75
|
export { MetricsModule, type MetricsResponse } from "./modules/metrics.js";
|
|
70
76
|
export { GraphsModule, type GraphValidationResult, type GraphIntrospectionResult } from "./modules/graphs.js";
|
|
71
77
|
export { CatalogModule, type CatalogVersions, type NodeCatalogResponse, type ToolCatalogResponse, type TriggerCatalogResponse, type NodeDefinition, type ToolDefinition, type TriggerTemplate } from "./modules/catalog.js";
|
|
72
78
|
export { ApprovalsModule, type Approval, type ApprovalStatus, type ApprovalDecision, type ApprovalListResponse, type ApprovalStatusResponse } from "./modules/approvals.js";
|
|
79
|
+
export { ApiTokensModule, type ApiToken, type ApiTokenSecret, type CreateTokenRequest, type RotateTokenResponse } from "./modules/apiTokens.js";
|
|
80
|
+
export { MembershipsModule, type MembershipResponse, type EnsureMembershipRequest } from "./modules/memberships.js";
|
|
73
81
|
export { streamSSE, parseSSE, type SSEEvent, type SSEOptions, type RunStreamEvent, type RunSSEEvent, type RunEventDto as SSERunEventDto } from "./sse/client.js";
|
|
74
82
|
export type { Agent as AgentSchema, CreateAgentRequest, UpdateAgentRequest, AgentBundle, CreateAgentVersionRequest, RunResponse, RunDetailResponse, WaitRunResponse, BatchRunResponse, CancelRunResponse, ReplayRequest, ThreadRequest, ThreadSearchRequest, AddMessageRequest, CheckpointDetail, CheckpointListResponse, CreateCredentialRequest, UpdateCredentialRequest, CreateCronJobRequest, UpdateCronJobRequest, InviteMemberRequest, UpdateMemberRequest, CreatePromptRequest, CreatePromptVersionRequest, CreatePresignedUploadRequest, PresignedUploadResponse, VectorStoreResponse, VectorQueryRequest, VectorQueryResponse, CreateDatasetRequest, CreateExperimentRequest, ProblemDetails, } from "./client/raw.js";
|
|
75
83
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAKH,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGxG,OAAO,EACH,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,cAAc,EACd,SAAS,EACT,SAAS,EACT,UAAU,EACV,UAAU,GACb,MAAM,kBAAkB,CAAC;AAK1B,OAAO,EACH,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,MAAM,EACX,KAAK,SAAS,GACjB,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EACH,eAAe,EACf,iBAAiB,EACjB,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAKH,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGxG,OAAO,EACH,KAAK,YAAY,EACjB,KAAK,O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I,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAKjK,YAAY,EAER,KAAK,IAAI,WAAW,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,yBAAyB,EAEzB,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EAEb,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EAEjB,gBAAgB,EAChB,sBAAsB,EAEtB,uBAAuB,EACvB,uBAAuB,EAEvB,oBAAoB,EACpB,oBAAoB,EAEpB,mBAAmB,EACnB,mBAAmB,EAEnB,mBAAmB,EACnB,0BAA0B,EAE1B,4BAA4B,EAC5B,uBAAuB,EAEvB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EAEnB,oBAAoB,EACpB,uBAAuB,EAEvB,cAAc,GACjB,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -45,6 +45,30 @@ export { isApiTokenAuth, isJwtAuth, isBrowser, isApiToken, isJwtToken, } from ".
|
|
|
45
45
|
// ============================================================================
|
|
46
46
|
export { unwrap, toResult, SDKError, } from "./client/helpers.js";
|
|
47
47
|
// ============================================================================
|
|
48
|
+
// Typed Errors (Enterprise)
|
|
49
|
+
// ============================================================================
|
|
50
|
+
export {
|
|
51
|
+
// Base class
|
|
52
|
+
AgentOsError,
|
|
53
|
+
// Error classes
|
|
54
|
+
UnauthorizedError, ForbiddenError, NotFoundError, ConflictError, ValidationError, RateLimitError, ServerError, NetworkError, TimeoutError,
|
|
55
|
+
// Type guards
|
|
56
|
+
isAgentOsError, isRetryableError, isAuthError, isClientError, isServerError, } from "./errors/index.js";
|
|
57
|
+
export { createErrorFromResponse } from "./errors/factory.js";
|
|
58
|
+
// ============================================================================
|
|
59
|
+
// Network Configuration
|
|
60
|
+
// ============================================================================
|
|
61
|
+
export { DEFAULT_NETWORK_CONFIG, INTERACTIVE_NETWORK_CONFIG, BACKGROUND_NETWORK_CONFIG, mergeNetworkConfig, } from "./client/config.js";
|
|
62
|
+
// ============================================================================
|
|
63
|
+
// Retry & Timeout Utilities
|
|
64
|
+
// ============================================================================
|
|
65
|
+
export { withRetry, sleep } from "./client/retry.js";
|
|
66
|
+
export { withTimeout, createTimeoutController } from "./client/timeout.js";
|
|
67
|
+
// ============================================================================
|
|
68
|
+
// Pagination Utilities
|
|
69
|
+
// ============================================================================
|
|
70
|
+
export { paginate, collectAll, getFirst, } from "./client/pagination.js";
|
|
71
|
+
// ============================================================================
|
|
48
72
|
// Raw Client & Core Types
|
|
49
73
|
// ============================================================================
|
|
50
74
|
export { createRawClient, createTypedClient, } from "./client/raw.js";
|
|
@@ -85,6 +109,8 @@ export { GraphsModule } from "./modules/graphs.js";
|
|
|
85
109
|
export { CatalogModule } from "./modules/catalog.js";
|
|
86
110
|
// Approvals is real (has backend implementation)
|
|
87
111
|
export { ApprovalsModule } from "./modules/approvals.js";
|
|
112
|
+
export { ApiTokensModule } from "./modules/apiTokens.js";
|
|
113
|
+
export { MembershipsModule } from "./modules/memberships.js";
|
|
88
114
|
// ============================================================================
|
|
89
115
|
// SSE Streaming
|
|
90
116
|
// ============================================================================
|
package/dist/modules/audit.d.ts
CHANGED
|
@@ -34,8 +34,8 @@ export declare class AuditModule {
|
|
|
34
34
|
workspace_id?: string;
|
|
35
35
|
from?: string;
|
|
36
36
|
to?: string;
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
limit?: number;
|
|
38
|
+
offset?: number;
|
|
39
39
|
}): Promise<APIResponse<AuditListResponse>>;
|
|
40
40
|
/**
|
|
41
41
|
* Get a specific audit log entry.
|
|
@@ -48,8 +48,31 @@ export declare class AuditModule {
|
|
|
48
48
|
query?: string;
|
|
49
49
|
from?: string;
|
|
50
50
|
to?: string;
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
limit?: number;
|
|
52
|
+
offset?: number;
|
|
53
53
|
}): Promise<APIResponse<AuditListResponse>>;
|
|
54
|
+
/**
|
|
55
|
+
* Iterate through all audit logs with automatic pagination.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* // Get all audit logs for a specific action
|
|
60
|
+
* for await (const entry of client.audit.iterate({ action: "agent.created" })) {
|
|
61
|
+
* console.log(entry.actor, entry.action);
|
|
62
|
+
* }
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
iterate(filters?: {
|
|
66
|
+
actor?: string;
|
|
67
|
+
action?: string;
|
|
68
|
+
resource?: string;
|
|
69
|
+
workspace_id?: string;
|
|
70
|
+
from?: string;
|
|
71
|
+
to?: string;
|
|
72
|
+
}, options?: {
|
|
73
|
+
pageSize?: number;
|
|
74
|
+
maxItems?: number;
|
|
75
|
+
signal?: AbortSignal;
|
|
76
|
+
}): AsyncGenerator<AuditLogEntry, void, unknown>;
|
|
54
77
|
}
|
|
55
78
|
//# sourceMappingURL=audit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../src/modules/audit.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/D,MAAM,WAAW,aAAa;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,WAAW,CAAC;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW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,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GACzE,cAAc,CAAC,aAAa,EAAE,IAAI,EAAE,OAAO,CAAC;CA6BlD"}
|
package/dist/modules/audit.js
CHANGED
|
@@ -12,8 +12,17 @@ export class AuditModule {
|
|
|
12
12
|
* List audit log entries.
|
|
13
13
|
*/
|
|
14
14
|
async list(params) {
|
|
15
|
+
const queryParams = { ...params };
|
|
16
|
+
if (params?.limit !== undefined) {
|
|
17
|
+
queryParams.take = params.limit;
|
|
18
|
+
delete queryParams.limit;
|
|
19
|
+
}
|
|
20
|
+
if (params?.offset !== undefined) {
|
|
21
|
+
queryParams.skip = params.offset;
|
|
22
|
+
delete queryParams.offset;
|
|
23
|
+
}
|
|
15
24
|
return this.client.GET("/v1/api/audit", {
|
|
16
|
-
params: { query:
|
|
25
|
+
params: { query: queryParams },
|
|
17
26
|
headers: this.headers(),
|
|
18
27
|
});
|
|
19
28
|
}
|
|
@@ -30,9 +39,56 @@ export class AuditModule {
|
|
|
30
39
|
* Search audit logs by action pattern.
|
|
31
40
|
*/
|
|
32
41
|
async search(params) {
|
|
42
|
+
const queryParams = { ...params };
|
|
43
|
+
if (params?.limit !== undefined) {
|
|
44
|
+
queryParams.take = params.limit;
|
|
45
|
+
delete queryParams.limit;
|
|
46
|
+
}
|
|
47
|
+
if (params?.offset !== undefined) {
|
|
48
|
+
queryParams.skip = params.offset;
|
|
49
|
+
delete queryParams.offset;
|
|
50
|
+
}
|
|
33
51
|
return this.client.GET("/v1/api/audit/search", {
|
|
34
|
-
params: { query:
|
|
52
|
+
params: { query: queryParams },
|
|
35
53
|
headers: this.headers(),
|
|
36
54
|
});
|
|
37
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Iterate through all audit logs with automatic pagination.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* // Get all audit logs for a specific action
|
|
62
|
+
* for await (const entry of client.audit.iterate({ action: "agent.created" })) {
|
|
63
|
+
* console.log(entry.actor, entry.action);
|
|
64
|
+
* }
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
async *iterate(filters, options) {
|
|
68
|
+
const pageSize = options?.pageSize ?? 100;
|
|
69
|
+
const maxItems = options?.maxItems ?? Infinity;
|
|
70
|
+
let offset = 0;
|
|
71
|
+
let yielded = 0;
|
|
72
|
+
let hasMore = true;
|
|
73
|
+
while (hasMore && yielded < maxItems) {
|
|
74
|
+
if (options?.signal?.aborted)
|
|
75
|
+
return;
|
|
76
|
+
const response = await this.list({
|
|
77
|
+
...filters,
|
|
78
|
+
limit: Math.min(pageSize, maxItems - yielded),
|
|
79
|
+
offset,
|
|
80
|
+
});
|
|
81
|
+
if (response.error)
|
|
82
|
+
throw response.error;
|
|
83
|
+
const data = response.data;
|
|
84
|
+
for (const entry of data.items) {
|
|
85
|
+
if (yielded >= maxItems)
|
|
86
|
+
return;
|
|
87
|
+
yield entry;
|
|
88
|
+
yielded++;
|
|
89
|
+
}
|
|
90
|
+
offset += data.items.length;
|
|
91
|
+
hasMore = offset < data.total && data.items.length > 0;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
38
94
|
}
|
|
@@ -35,13 +35,19 @@ export interface CatalogMetadata {
|
|
|
35
35
|
contentHash?: string;
|
|
36
36
|
}
|
|
37
37
|
export interface NodeCatalogResponse extends CatalogMetadata {
|
|
38
|
-
nodes:
|
|
38
|
+
nodes: NodeDefinition[];
|
|
39
39
|
}
|
|
40
40
|
export interface NodeDefinition {
|
|
41
|
-
|
|
41
|
+
id: string;
|
|
42
|
+
title: string;
|
|
42
43
|
category: string;
|
|
43
|
-
description
|
|
44
|
+
description?: string;
|
|
45
|
+
ports?: {
|
|
46
|
+
inputs?: string[];
|
|
47
|
+
outputs?: string[];
|
|
48
|
+
};
|
|
44
49
|
config_schema?: Record<string, unknown>;
|
|
50
|
+
default_config?: Record<string, unknown>;
|
|
45
51
|
}
|
|
46
52
|
export interface ToolCatalogResponse extends CatalogMetadata {
|
|
47
53
|
tools: ToolDefinition[];
|
|
@@ -57,7 +63,7 @@ export interface ToolDefinition {
|
|
|
57
63
|
credential_requirements?: unknown[];
|
|
58
64
|
}
|
|
59
65
|
export interface TriggerCatalogResponse extends CatalogMetadata {
|
|
60
|
-
|
|
66
|
+
templates: TriggerTemplate[];
|
|
61
67
|
}
|
|
62
68
|
export interface TriggerTemplate {
|
|
63
69
|
slug: string;
|
|
@@ -65,6 +71,18 @@ export interface TriggerTemplate {
|
|
|
65
71
|
description?: string;
|
|
66
72
|
run_input_schema?: Record<string, unknown>;
|
|
67
73
|
}
|
|
74
|
+
export interface PresetCatalogResponse extends CatalogMetadata {
|
|
75
|
+
presets: PresetDefinition[];
|
|
76
|
+
}
|
|
77
|
+
export interface PresetDefinition {
|
|
78
|
+
preset_slug: string;
|
|
79
|
+
base_node_slug: string;
|
|
80
|
+
title: string;
|
|
81
|
+
description?: string;
|
|
82
|
+
default_config?: Record<string, unknown>;
|
|
83
|
+
locked_fields?: string[];
|
|
84
|
+
ui_variant?: string;
|
|
85
|
+
}
|
|
68
86
|
export declare class CatalogModule {
|
|
69
87
|
private client;
|
|
70
88
|
constructor(client: RawClient);
|
|
@@ -83,6 +101,11 @@ export declare class CatalogModule {
|
|
|
83
101
|
* Returns trigger configurations and input schemas.
|
|
84
102
|
*/
|
|
85
103
|
getTriggers(version?: string): Promise<APIResponse<TriggerCatalogResponse>>;
|
|
104
|
+
/**
|
|
105
|
+
* Get the Node Presets Catalog.
|
|
106
|
+
* Returns pre-configured node variants with locked fields.
|
|
107
|
+
*/
|
|
108
|
+
getPresets(version?: string): Promise<APIResponse<PresetCatalogResponse>>;
|
|
86
109
|
/**
|
|
87
110
|
* Get all catalogs at once for convenience.
|
|
88
111
|
* Returns combined catalog data with versions.
|
|
@@ -92,6 +115,7 @@ export declare class CatalogModule {
|
|
|
92
115
|
nodes: NodeCatalogResponse;
|
|
93
116
|
tools: ToolCatalogResponse;
|
|
94
117
|
triggers: TriggerCatalogResponse;
|
|
118
|
+
presets: PresetCatalogResponse;
|
|
95
119
|
catalog_versions: CatalogVersions;
|
|
96
120
|
};
|
|
97
121
|
error?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/modules/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/D,MAAM,WAAW,eAAe;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,mBAAoB,SAAQ,eAAe;IACxD,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/modules/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/D,MAAM,WAAW,eAAe;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,mBAAoB,SAAQ,eAAe;IACxD,KAAK,EAAE,cAAc,EAAE,CAAC;CAC3B;AAED,MAA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
|
|
|
59
59
|
});
|
|
60
60
|
return response;
|
|
61
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Get the Node Presets Catalog.
|
|
64
|
+
* Returns pre-configured node variants with locked fields.
|
|
65
|
+
*/
|
|
66
|
+
async getPresets(version = "1") {
|
|
67
|
+
const response = await this.client.GET("/v1/api/catalog/presets", {
|
|
68
|
+
params: { query: { version } },
|
|
69
|
+
});
|
|
70
|
+
return response;
|
|
71
|
+
}
|
|
62
72
|
/**
|
|
63
73
|
* Get all catalogs at once for convenience.
|
|
64
74
|
* Returns combined catalog data with versions.
|
|
65
75
|
*/
|
|
66
76
|
async getAll(version = "1") {
|
|
67
|
-
const [nodesRes, toolsRes, triggersRes] = await Promise.all([
|
|
77
|
+
const [nodesRes, toolsRes, triggersRes, presetsRes] = await Promise.all([
|
|
68
78
|
this.getNodes(version),
|
|
69
79
|
this.getTools(version),
|
|
70
80
|
this.getTriggers(version),
|
|
81
|
+
this.getPresets(version),
|
|
71
82
|
]);
|
|
72
83
|
if (nodesRes.error)
|
|
73
84
|
return { data: undefined, error: nodesRes.error };
|
|
@@ -75,11 +86,14 @@ export class CatalogModule {
|
|
|
75
86
|
return { data: undefined, error: toolsRes.error };
|
|
76
87
|
if (triggersRes.error)
|
|
77
88
|
return { data: undefined, error: triggersRes.error };
|
|
89
|
+
if (presetsRes.error)
|
|
90
|
+
return { data: undefined, error: presetsRes.error };
|
|
78
91
|
return {
|
|
79
92
|
data: {
|
|
80
93
|
nodes: nodesRes.data,
|
|
81
94
|
tools: toolsRes.data,
|
|
82
95
|
triggers: triggersRes.data,
|
|
96
|
+
presets: presetsRes.data,
|
|
83
97
|
catalog_versions: {
|
|
84
98
|
nodes: version,
|
|
85
99
|
tools: version,
|
|
@@ -46,7 +46,7 @@ export declare class CheckpointsModule {
|
|
|
46
46
|
* Replay from a checkpoint.
|
|
47
47
|
*/
|
|
48
48
|
replay(checkpointId: string, options?: {
|
|
49
|
-
mode?: "best_effort" | "
|
|
49
|
+
mode?: "best_effort" | "strict";
|
|
50
50
|
modified_state?: unknown;
|
|
51
51
|
}): Promise<APIResponse<ReplayResponse>>;
|
|
52
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkpoints.d.ts","sourceRoot":"","sources":["../../src/modules/checkpoints.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAc,MAAM,kBAAkB,CAAC;AAK3E,MAAM,WAAW,UAAU;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,mBAAmB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,cAAc,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,cAAc;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,2BAA2B,EAAE,MAAM,CAAC;CACvC;AAED,qBAAa,iBAAiB;IACd,OAAO,CAAC,MAAM;IAAa,OAAO,CAAC,OAAO;gBAAlC,MAAM,EAAE,SAAS,EAAU,OAAO,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAEpF;;OAEG;IACG,IA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