@agent-os-sdk/client 0.3.15 → 0.4.1
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/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 +67 -2
- 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 +37 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +48 -22
- 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/builder.d.ts +6 -0
- package/dist/modules/builder.d.ts.map +1 -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/members.d.ts +50 -2
- package/dist/modules/members.d.ts.map +1 -1
- package/dist/modules/members.js +61 -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 +49 -50
- package/src/client/config.ts +100 -0
- package/src/client/pagination.ts +218 -0
- package/src/client/raw.ts +141 -20
- 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 +97 -76
- package/src/modules/audit.ts +77 -6
- package/src/modules/builder.ts +7 -0
- package/src/modules/checkpoints.ts +1 -1
- package/src/modules/info.ts +108 -0
- package/src/modules/members.ts +80 -2
- 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
|
@@ -35,41 +35,49 @@
|
|
|
35
35
|
* ```
|
|
36
36
|
*/
|
|
37
37
|
export { AgentOsClient, type AgentOsClientOptions, type AuthProvider } from "./client/AgentOsClient.js";
|
|
38
|
-
export {
|
|
39
|
-
export {
|
|
40
|
-
export {
|
|
41
|
-
export
|
|
42
|
-
export {
|
|
43
|
-
export {
|
|
44
|
-
export {
|
|
45
|
-
export {
|
|
46
|
-
export {
|
|
47
|
-
export {
|
|
48
|
-
export {
|
|
38
|
+
export { isApiToken, isApiTokenAuth, isBrowser, isJwtAuth, isJwtToken, type ApiTokenAuth, type JwtAuth } from "./client/auth.js";
|
|
39
|
+
export { SDKError, toResult, unwrap, type PaginatedResponse, type PaginationParams, type Result, type Unwrapped } from "./client/helpers.js";
|
|
40
|
+
export { AgentOsError, ConflictError, ForbiddenError, NetworkError, NotFoundError, RateLimitError, ServerError, TimeoutError, UnauthorizedError, ValidationError, isAgentOsError, isAuthError, isClientError, isRetryableError, isServerError, type ErrorOptions, type FieldError } from "./errors/index.js";
|
|
41
|
+
export { createErrorFromResponse } from "./errors/factory.js";
|
|
42
|
+
export { BACKGROUND_NETWORK_CONFIG, DEFAULT_NETWORK_CONFIG, INTERACTIVE_NETWORK_CONFIG, mergeNetworkConfig, type NetworkConfig, type RetryConfig } from "./client/config.js";
|
|
43
|
+
export { sleep, withRetry, type RetryContext } from "./client/retry.js";
|
|
44
|
+
export { createTimeoutController, withTimeout } from "./client/timeout.js";
|
|
45
|
+
export { collectAll, getFirst, paginate, type CursorPaginatedResponse, type CursorParams, type OffsetPaginatedResponse, type OffsetParams, type PaginateOptions } from "./client/pagination.js";
|
|
46
|
+
export { createRawClient, createTypedClient, type APIResponse, type ClientOptions, type HookErrorContext, type HookRequestContext, type HookResponseContext, type RawClient, type SDKHooks, type TypedClient } from "./client/raw.js";
|
|
47
|
+
export type { components, paths } from "./client/raw.js";
|
|
48
|
+
export { AgentsModule, type Agent, type AgentGraphResponse, type AgentListResponse, type AgentVersion } from "./modules/agents.js";
|
|
49
49
|
export { BuilderModule, type BuilderChatRequest, type BuilderChatResponse, type BuilderStreamEvent, type GraphUpdateAction } from "./modules/builder.js";
|
|
50
|
-
export {
|
|
50
|
+
export { CredentialsModule, type Credential, type CredentialListResponse, type CredentialType } from "./modules/credentials.js";
|
|
51
|
+
export { KnowledgeModule, type KnowledgeDataset, type KnowledgeSearchResponse } from "./modules/knowledge.js";
|
|
52
|
+
export { MembersModule, type Member, type MemberListResponse, type Role } from "./modules/members.js";
|
|
53
|
+
export { RunsModule, type CreateRunResponse, type FollowEvent, type FollowOptions, type Run, type RunEvent, type RunEventDto, type RunEventsPollResponse, type RunEventsResponse, type RunListResponse, type RunStatus } from "./modules/runs.js";
|
|
51
54
|
export { TenantsModule, type Tenant } from "./modules/tenants.js";
|
|
55
|
+
export { ThreadsModule, type Thread, type ThreadListResponse, type ThreadMessage, type ThreadMessagesResponse, type ThreadRun, type ThreadState } from "./modules/threads.js";
|
|
56
|
+
export { ToolsModule, type Tool, type ToolListResponse } from "./modules/tools.js";
|
|
57
|
+
export { TriggersModule, type Trigger, type TriggerListResponse } from "./modules/triggers.js";
|
|
52
58
|
export { WorkspacesModule, type Workspace, type WorkspaceListResponse } from "./modules/workspaces.js";
|
|
53
|
-
export {
|
|
54
|
-
export {
|
|
55
|
-
export {
|
|
56
|
-
export { VectorStoresModule, type VectorStore, type VectorStoreListResponse, type VectorQueryResult } from "./modules/vectorStores.js";
|
|
57
|
-
export { EvaluationModule, type EvalDataset, type Experiment, type ExampleData } from "./modules/evaluation.js";
|
|
59
|
+
export { A2aModule, type A2aAgentCard, type JsonRpcRequest, type JsonRpcResponse } from "./modules/a2a.js";
|
|
60
|
+
export { AuditModule, type AuditListResponse, type AuditLogEntry } from "./modules/audit.js";
|
|
61
|
+
export { CatalogModule, type CatalogVersions, type NodeCatalogResponse, type NodeDefinition, type ToolCatalogResponse, type ToolDefinition, type TriggerCatalogResponse, type TriggerTemplate } from "./modules/catalog.js";
|
|
58
62
|
export { CheckpointsModule, type Checkpoint, type CheckpointsResponse } from "./modules/checkpoints.js";
|
|
59
|
-
export { PlaygroundModule, type PlaygroundSession } from "./modules/playground.js";
|
|
60
63
|
export { CronsModule, type CronJob, type CronJobListResponse } from "./modules/crons.js";
|
|
61
|
-
export { DlqModule, type
|
|
62
|
-
export {
|
|
63
|
-
export {
|
|
64
|
-
export {
|
|
64
|
+
export { DlqModule, type DlqListResponse, type DlqMessage } from "./modules/dlq.js";
|
|
65
|
+
export { EvaluationModule, type EvalDataset, type ExampleData, type Experiment } from "./modules/evaluation.js";
|
|
66
|
+
export { FilesModule, type FileListResponse, type PresignedUpload, type StoredFile } from "./modules/files.js";
|
|
67
|
+
export { GraphsModule, type GraphIntrospectionResult, type GraphValidationResult } from "./modules/graphs.js";
|
|
68
|
+
export { InfoModule, type ServerCapabilities, type ServerInfo } from "./modules/info.js";
|
|
65
69
|
export { McpModule, type McpServer } from "./modules/mcp.js";
|
|
66
|
-
export { A2aModule, type JsonRpcRequest, type JsonRpcResponse, type A2aAgentCard } from "./modules/a2a.js";
|
|
67
70
|
export { MeModule, type MeResponse } from "./modules/me.js";
|
|
68
|
-
export { InfoModule, type ServerInfo } from "./modules/info.js";
|
|
69
71
|
export { MetricsModule, type MetricsResponse } from "./modules/metrics.js";
|
|
70
|
-
export {
|
|
71
|
-
export {
|
|
72
|
-
export {
|
|
73
|
-
export {
|
|
74
|
-
export
|
|
72
|
+
export { PlaygroundModule, type PlaygroundSession } from "./modules/playground.js";
|
|
73
|
+
export { PromptsModule, type Prompt, type PromptListResponse, type PromptVersion } from "./modules/prompts.js";
|
|
74
|
+
export { StoreModule, type StoreValue } from "./modules/store.js";
|
|
75
|
+
export { TracesModule, type FeedbackRequest, type Span, type SpanData, type Trace, type TraceListResponse } from "./modules/traces.js";
|
|
76
|
+
export { UsageModule, type UsageQuota, type UsageResponse } from "./modules/usage.js";
|
|
77
|
+
export { VectorStoresModule, type VectorQueryResult, type VectorStore, type VectorStoreListResponse } from "./modules/vectorStores.js";
|
|
78
|
+
export { ApprovalsModule, type Approval, type ApprovalDecision, type ApprovalListResponse, type ApprovalStatus, 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 EnsureMembershipRequest, type MembershipResponse } from "./modules/memberships.js";
|
|
81
|
+
export { parseSSE, streamSSE, type RunSSEEvent, type RunStreamEvent, type SSEEvent, type SSEOptions, type RunEventDto as SSERunEventDto } from "./sse/client.js";
|
|
82
|
+
export type { AddMessageRequest, AgentBundle, Agent as AgentSchema, BatchRunResponse, CancelRunResponse, CheckpointDetail, CheckpointListResponse, CreateAgentRequest, CreateAgentVersionRequest, CreateCredentialRequest, CreateCronJobRequest, CreateDatasetRequest, CreateExperimentRequest, CreatePresignedUploadRequest, CreatePromptRequest, CreatePromptVersionRequest, InviteMemberRequest, PresignedUploadResponse, ProblemDetails, ReplayRequest, RunDetailResponse, RunResponse, ThreadRequest, ThreadSearchRequest, UpdateAgentRequest, UpdateCredentialRequest, UpdateCronJobRequest, UpdateMemberRequest, VectorQueryRequest, VectorQueryResponse, VectorStoreResponse, WaitRunResponse } 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,
|
|
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,UAAU,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAA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EAAE,KAAK,WAAW,IAAI,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAKjK,YAAY,EACR,iBAAiB,EAAE,WAAW,EAE9B,KAAK,IAAI,WAAW,EAAE,gBAAgB,EACtC,iBAAiB,EAEjB,gBAAgB,EAChB,sBAAsB,EAAE,kBAAkB,EAAE,yBAAyB,EAErE,uBAAuB,EAEvB,oBAAoB,EAEpB,oBAAoB,EACpB,uBAAuB,EAEvB,4BAA4B,EAE5B,mBAAmB,EACnB,0BAA0B,EAE1B,mBAAmB,EAAE,uBAAuB,EAE5C,cAAc,EAAE,aAAa,EAAE,iBAAiB,EAEhD,WAAW,EAEX,aAAa,EACb,mBAAmB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,kBAAkB,EAC/H,mBAAmB,EAEnB,mBAAmB,EAAE,eAAe,EACvC,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -39,53 +39,79 @@
|
|
|
39
39
|
// ============================================================================
|
|
40
40
|
export { AgentOsClient } from "./client/AgentOsClient.js";
|
|
41
41
|
// Auth Provider Types
|
|
42
|
-
export {
|
|
42
|
+
export { isApiToken, isApiTokenAuth, isBrowser, isJwtAuth, isJwtToken } from "./client/auth.js";
|
|
43
43
|
// ============================================================================
|
|
44
44
|
// Helpers & Utilities
|
|
45
45
|
// ============================================================================
|
|
46
|
-
export {
|
|
46
|
+
export { SDKError, toResult, unwrap } from "./client/helpers.js";
|
|
47
|
+
// ============================================================================
|
|
48
|
+
// Typed Errors (Enterprise)
|
|
49
|
+
// ============================================================================
|
|
50
|
+
export {
|
|
51
|
+
// Base class
|
|
52
|
+
AgentOsError, ConflictError, ForbiddenError, NetworkError, NotFoundError, RateLimitError, ServerError, TimeoutError,
|
|
53
|
+
// Error classes
|
|
54
|
+
UnauthorizedError, ValidationError,
|
|
55
|
+
// Type guards
|
|
56
|
+
isAgentOsError, isAuthError, isClientError, isRetryableError, isServerError } from "./errors/index.js";
|
|
57
|
+
export { createErrorFromResponse } from "./errors/factory.js";
|
|
58
|
+
// ============================================================================
|
|
59
|
+
// Network Configuration
|
|
60
|
+
// ============================================================================
|
|
61
|
+
export { BACKGROUND_NETWORK_CONFIG, DEFAULT_NETWORK_CONFIG, INTERACTIVE_NETWORK_CONFIG, mergeNetworkConfig } from "./client/config.js";
|
|
62
|
+
// ============================================================================
|
|
63
|
+
// Retry & Timeout Utilities
|
|
64
|
+
// ============================================================================
|
|
65
|
+
export { sleep, withRetry } from "./client/retry.js";
|
|
66
|
+
export { createTimeoutController, withTimeout } from "./client/timeout.js";
|
|
67
|
+
// ============================================================================
|
|
68
|
+
// Pagination Utilities
|
|
69
|
+
// ============================================================================
|
|
70
|
+
export { collectAll, getFirst, paginate } from "./client/pagination.js";
|
|
47
71
|
// ============================================================================
|
|
48
72
|
// Raw Client & Core Types
|
|
49
73
|
// ============================================================================
|
|
50
|
-
export { createRawClient, createTypedClient
|
|
74
|
+
export { createRawClient, createTypedClient } from "./client/raw.js";
|
|
51
75
|
// ============================================================================
|
|
52
76
|
// Module Classes
|
|
53
77
|
// ============================================================================
|
|
54
78
|
// Core modules
|
|
55
79
|
export { AgentsModule } from "./modules/agents.js";
|
|
80
|
+
export { BuilderModule } from "./modules/builder.js";
|
|
81
|
+
export { CredentialsModule } from "./modules/credentials.js";
|
|
82
|
+
export { KnowledgeModule } from "./modules/knowledge.js";
|
|
83
|
+
export { MembersModule } from "./modules/members.js";
|
|
56
84
|
export { RunsModule } from "./modules/runs.js";
|
|
85
|
+
export { TenantsModule } from "./modules/tenants.js";
|
|
57
86
|
export { ThreadsModule } from "./modules/threads.js";
|
|
58
87
|
export { ToolsModule } from "./modules/tools.js";
|
|
59
|
-
export { KnowledgeModule } from "./modules/knowledge.js";
|
|
60
88
|
export { TriggersModule } from "./modules/triggers.js";
|
|
61
|
-
export { CredentialsModule } from "./modules/credentials.js";
|
|
62
|
-
export { BuilderModule } from "./modules/builder.js";
|
|
63
|
-
export { MembersModule } from "./modules/members.js";
|
|
64
|
-
export { TenantsModule } from "./modules/tenants.js";
|
|
65
89
|
export { WorkspacesModule } from "./modules/workspaces.js";
|
|
66
90
|
// Platform modules
|
|
67
|
-
export {
|
|
68
|
-
export {
|
|
69
|
-
export {
|
|
70
|
-
export { VectorStoresModule } from "./modules/vectorStores.js";
|
|
71
|
-
export { EvaluationModule } from "./modules/evaluation.js";
|
|
91
|
+
export { A2aModule } from "./modules/a2a.js";
|
|
92
|
+
export { AuditModule } from "./modules/audit.js";
|
|
93
|
+
export { CatalogModule } from "./modules/catalog.js";
|
|
72
94
|
export { CheckpointsModule } from "./modules/checkpoints.js";
|
|
73
|
-
export { PlaygroundModule } from "./modules/playground.js";
|
|
74
95
|
export { CronsModule } from "./modules/crons.js";
|
|
75
96
|
export { DlqModule } from "./modules/dlq.js";
|
|
76
|
-
export {
|
|
77
|
-
export {
|
|
78
|
-
export {
|
|
97
|
+
export { EvaluationModule } from "./modules/evaluation.js";
|
|
98
|
+
export { FilesModule } from "./modules/files.js";
|
|
99
|
+
export { GraphsModule } from "./modules/graphs.js";
|
|
100
|
+
export { InfoModule } from "./modules/info.js";
|
|
79
101
|
export { McpModule } from "./modules/mcp.js";
|
|
80
|
-
export { A2aModule } from "./modules/a2a.js";
|
|
81
102
|
export { MeModule } from "./modules/me.js";
|
|
82
|
-
export { InfoModule } from "./modules/info.js";
|
|
83
103
|
export { MetricsModule } from "./modules/metrics.js";
|
|
84
|
-
export {
|
|
85
|
-
export {
|
|
104
|
+
export { PlaygroundModule } from "./modules/playground.js";
|
|
105
|
+
export { PromptsModule } from "./modules/prompts.js";
|
|
106
|
+
export { StoreModule } from "./modules/store.js";
|
|
107
|
+
export { TracesModule } from "./modules/traces.js";
|
|
108
|
+
export { UsageModule } from "./modules/usage.js";
|
|
109
|
+
export { VectorStoresModule } from "./modules/vectorStores.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
|
// ============================================================================
|
|
91
|
-
export {
|
|
117
|
+
export { parseSSE, streamSSE } from "./sse/client.js";
|
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>;
|
|
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AAG,OAAO,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAiB3C;;OAEG;IACG,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;IAO/D;;OAEG;IACG,MAAM,CAAC,MAAM,CAAC,EAAE;QAClB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAiB3C;;;;;;;;;;OAUG;IACI,OAAO,CACV,OAAO,CAAC,EAAE;QACN,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,EAAE,CAAC,EAAE,MAAM,CAAC;KACf,EACD,OAAO,CAAC,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
|
}
|