@agent-os-sdk/client 0.5.2 → 0.6.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/src/index.ts CHANGED
@@ -1,211 +1,54 @@
1
1
  /**
2
- * Agent OS SDK - Fully Typed
2
+ * Agent OS SDK
3
3
  *
4
- * Internal typed SDK for Agent OS platform.
5
- * All API calls are fully typed from OpenAPI specification.
4
+ * 100% Auto-Generated from OpenAPI Specification.
6
5
  *
7
6
  * @example
8
7
  * ```ts
9
- * import { AgentOsClient, unwrap } from "@agent-os/sdk";
8
+ * import { createClient, type paths, type components, type Schema } from "@agent-os-sdk/client";
10
9
  *
11
- * const api = new AgentOsClient({
12
- * baseUrl: import.meta.env.VITE_API_URL,
13
- * tenantId: auth.tenantId,
14
- * workspaceId: auth.workspaceId,
15
- * token: auth.token,
10
+ * const client = createClient({
11
+ * baseUrl: "https://api.example.com",
12
+ * headers: {
13
+ * Authorization: `Bearer ${token}`,
14
+ * "X-Workspace-Id": workspaceId,
15
+ * }
16
16
  * });
17
17
  *
18
- * // Style 1: Handle response manually
19
- * const { data, error } = await api.agents.list();
20
- * if (data) {
21
- * data.items.forEach(agent => console.log(agent.name));
22
- * }
18
+ * // GET requests
19
+ * const { data: agents } = await client.GET("/v1/api/agents");
20
+ * const { data: agent } = await client.GET("/v1/api/agents/{id}", {
21
+ * params: { path: { id: "uuid" } }
22
+ * });
23
23
  *
24
- * // Style 2: Unwrap (throws on error, returns data directly)
25
- * const agents = await unwrap(api.agents.list());
26
- * agents.items.forEach(agent => console.log(agent.name));
24
+ * // POST requests
25
+ * const { data: result } = await client.POST("/v1/api/graph/commit", {
26
+ * body: {
27
+ * agent_id: "uuid",
28
+ * graph_spec: { nodes: [], edges: [] },
29
+ * expected_revision: "abc123"
30
+ * }
31
+ * });
27
32
  *
28
- * // Streaming
29
- * for await (const event of api.runs.createAndStream({
30
- * agent_id: "...",
31
- * input: { message: "Hello" },
32
- * })) {
33
- * console.log(event);
34
- * }
33
+ * // Use Schema helper for type extraction
34
+ * type Agent = Schema<"AgentResponse">;
35
+ * type GraphSpec = Schema<"CommitGraphSpecRequest">;
35
36
  * ```
36
37
  */
37
38
 
38
- // ============================================================================
39
- // Main Client
40
- // ============================================================================
41
- export { AgentOsClient, type AgentOsClientOptions, type AuthProvider } from "./client/AgentOsClient.js";
42
-
43
- // Auth Provider Types
44
- export {
45
- isApiToken, isApiTokenAuth, isBrowser, isJwtAuth, isJwtToken, type ApiTokenAuth,
46
- type JwtAuth
47
- } from "./client/auth.js";
48
-
49
- // ============================================================================
50
- // Helpers & Utilities
51
- // ============================================================================
52
- export {
53
- SDKError, toResult, unwrap, type PaginatedResponse, type PaginationParams, type Result,
54
- type Unwrapped
55
- } from "./client/helpers.js";
56
-
57
- // ============================================================================
58
- // Typed Errors (Enterprise)
59
- // ============================================================================
60
- export {
61
- // Base class
62
- AgentOsError, ConflictError, ForbiddenError, NetworkError, NotFoundError, RateLimitError,
63
- ServerError, TimeoutError,
64
- // Error classes
65
- UnauthorizedError, ValidationError,
66
- // Type guards
67
- isAgentOsError, isAuthError,
68
- isClientError, isRetryableError, isServerError, type ErrorOptions,
69
- // Field errors
70
- type FieldError
71
- } from "./errors/index.js";
72
-
73
- export { createErrorFromResponse } from "./errors/factory.js";
74
-
75
- // ============================================================================
76
- // Network Configuration
77
- // ============================================================================
78
- export {
79
- BACKGROUND_NETWORK_CONFIG, DEFAULT_NETWORK_CONFIG,
80
- INTERACTIVE_NETWORK_CONFIG, mergeNetworkConfig, type NetworkConfig, type RetryConfig
81
- } from "./client/config.js";
82
-
83
- // ============================================================================
84
- // Retry & Timeout Utilities
85
- // ============================================================================
86
- export { sleep, withRetry, type RetryContext } from "./client/retry.js";
87
- export { createTimeoutController, withTimeout } from "./client/timeout.js";
88
-
89
- // ============================================================================
90
- // Pagination Utilities
91
- // ============================================================================
92
- export {
93
- collectAll,
94
- getFirst, paginate, type CursorPaginatedResponse, type CursorParams, type OffsetPaginatedResponse, type OffsetParams, type PaginateOptions
95
- } from "./client/pagination.js";
96
-
97
-
98
- // ============================================================================
99
- // Raw Client & Core Types
100
- // ============================================================================
101
- export {
102
- createRawClient,
103
- createTypedClient, type APIResponse, type ClientOptions, type HookErrorContext, type HookRequestContext,
104
- type HookResponseContext, type RawClient,
105
- // SDK Hooks for observability (OTEL, Sentry, etc.)
106
- type SDKHooks, type TypedClient
107
- } from "./client/raw.js";
108
-
109
- // Export OpenAPI types
110
- export type { components, paths } from "./client/raw.js";
111
-
112
- // ============================================================================
113
- // Module Classes
114
- // ============================================================================
115
-
116
- // Core modules
117
- export { AgentsModule, type Agent, type AgentGraphResponse, type AgentListResponse } from "./modules/agents.js";
118
- export { BuilderModule, type BuilderChatRequest, type BuilderChatResponse, type BuilderStreamEvent, type GraphUpdateAction, type HintModel, type HintTargetModel, type HintDataModel } from "./modules/builder.js";
119
- export { CredentialsModule, type Credential, type CredentialListResponse, type CredentialType } from "./modules/credentials.js";
120
- export { KnowledgeModule, type KnowledgeDataset, type KnowledgeSearchResponse } from "./modules/knowledge.js";
121
- export { MembersModule, type Member, type MemberListResponse, type Role } from "./modules/members.js";
122
- 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";
123
- export { TenantsModule, type Tenant } from "./modules/tenants.js";
124
- export { ThreadsModule, type Thread, type ThreadListResponse, type ThreadMessage, type ThreadMessagesResponse, type ThreadRun, type ThreadState } from "./modules/threads.js";
125
- export { ToolsModule, type Tool, type ToolListResponse } from "./modules/tools.js";
126
- export { TriggersModule, type Trigger, type TriggerListResponse } from "./modules/triggers.js";
127
- export { WorkspacesModule, type Workspace, type WorkspaceListResponse } from "./modules/workspaces.js";
128
-
129
- // Platform modules
130
- export { A2aModule, type A2aAgentCard, type JsonRpcRequest, type JsonRpcResponse } from "./modules/a2a.js";
131
- export { AuditModule, type AuditListResponse, type AuditLogEntry } from "./modules/audit.js";
132
- export { CatalogModule, type CatalogVersions, type NodeCatalogResponse, type NodeDefinition, type ToolCatalogResponse, type ToolDefinition, type TriggerCatalogResponse, type TriggerTemplate } from "./modules/catalog.js";
133
- export { CheckpointsModule, type Checkpoint, type CheckpointsResponse } from "./modules/checkpoints.js";
134
- export { CronsModule, type CronJob, type CronJobListResponse } from "./modules/crons.js";
135
- export { DlqModule, type DlqListResponse, type DlqMessage } from "./modules/dlq.js";
136
- export { EvaluationModule, type EvalDataset, type ExampleData, type Experiment } from "./modules/evaluation.js";
137
- export { FilesModule, type FileListResponse, type PresignedUpload, type StoredFile } from "./modules/files.js";
138
- export {
139
- GraphsModule,
140
- type GraphsGetResponse,
141
- type GraphsCommitRequest,
142
- type GraphsCommitResponse,
143
- type GraphsConflictPayload,
144
- type GraphsRevisionsListResponse,
145
- type GraphsRevisionResponse,
146
- type GraphsValidateRequest,
147
- type GraphsValidateResponse,
148
- type GraphsIntrospectRequest,
149
- type GraphsIntrospectResponse,
150
- type GraphsValidationMessage,
151
- type GraphsValidationResult
152
- } from "./modules/graphs.js";
153
- export { InfoModule, type ServerCapabilities, type ServerInfo } from "./modules/info.js";
154
- export { McpModule, type McpServer } from "./modules/mcp.js";
155
- export { MeModule, type MeResponse } from "./modules/me.js";
156
- export { MetricsModule, type MetricsResponse } from "./modules/metrics.js";
157
- export { PlaygroundModule, type PlaygroundSession } from "./modules/playground.js";
158
- export { PromptsModule, type Prompt, type PromptListResponse, type PromptVersion } from "./modules/prompts.js";
159
- export { StoreModule, type StoreValue } from "./modules/store.js";
160
- export { TracesModule, type FeedbackRequest, type Span, type SpanData, type Trace, type TraceListResponse } from "./modules/traces.js";
161
- export { UsageModule, type UsageQuota, type UsageResponse } from "./modules/usage.js";
162
- export { VectorStoresModule, type VectorQueryResult, type VectorStore, type VectorStoreListResponse } from "./modules/vectorStores.js";
163
-
164
- // Approvals is real (has backend implementation)
165
- export { ApprovalsModule, type Approval, type ApprovalDecision, type ApprovalListResponse, type ApprovalStatus, type ApprovalStatusResponse } from "./modules/approvals.js";
39
+ // ============================================================
40
+ // AUTO-GENERATED CLIENT - The primary export
41
+ // ============================================================
166
42
 
167
- export { ApiTokensModule, type ApiToken, type ApiTokenSecret, type CreateTokenRequest, type RotateTokenResponse } from "./modules/apiTokens.js";
168
- export { MembershipsModule, type EnsureMembershipRequest, type MembershipResponse } from "./modules/memberships.js";
43
+ export { createClient, type AgentOsClient, type ClientOptions, type Schema } from "./generated/client.js";
44
+ export type { paths, components } from "./generated/openapi.js";
169
45
 
170
- // ============================================================================
171
- // SSE Streaming
172
- // ============================================================================
173
- export { parseSSE, streamSSE, type RunSSEEvent, type RunStreamEvent, type SSEEvent, type SSEOptions, type RunEventDto as SSERunEventDto } from "./sse/client.js";
46
+ // ============================================================
47
+ // LEGACY EXPORTS - For backwards compatibility during migration
48
+ // ============================================================
174
49
 
175
- // ============================================================================
176
- // Convenience Type Re-exports
177
- // ============================================================================
178
- export type {
179
- AddMessageRequest, AgentBundle,
180
- // Agent types
181
- Agent as AgentSchema, BatchRunResponse,
182
- CancelRunResponse,
183
- // Checkpoint types
184
- CheckpointDetail,
185
- CheckpointListResponse, CreateAgentRequest,
186
- // Credential types
187
- CreateCredentialRequest,
188
- // Cron types
189
- CreateCronJobRequest,
190
- // Evaluation types
191
- CreateDatasetRequest,
192
- CreateExperimentRequest,
193
- // File types
194
- CreatePresignedUploadRequest,
195
- // Prompt types
196
- CreatePromptRequest,
197
- CreatePromptVersionRequest,
198
- // Member types
199
- InviteMemberRequest, PresignedUploadResponse,
200
- // Error types
201
- ProblemDetails, ReplayRequest, RunDetailResponse,
202
- // Run types
203
- RunResponse,
204
- // Thread types
205
- ThreadRequest,
206
- ThreadSearchRequest, UpdateAgentRequest, UpdateCredentialRequest, UpdateCronJobRequest, UpdateMemberRequest, VectorQueryRequest,
207
- VectorQueryResponse,
208
- // Vector Store types
209
- VectorStoreResponse, WaitRunResponse
210
- } from "./client/raw.js";
50
+ // Legacy client (deprecated - use createClient instead)
51
+ export { AgentOsClient as LegacyAgentOsClient } from "./client/AgentOsClient.js";
211
52
 
53
+ // Legacy error types
54
+ export { AgentOsError } from "./errors/index.js";
@@ -36,7 +36,7 @@ export interface GraphsGetResponse {
36
36
 
37
37
  export interface GraphsCommitRequest {
38
38
  agent_id: string;
39
- proposed_spec: unknown;
39
+ graph_spec: unknown;
40
40
  expected_revision?: string;
41
41
  source?: string;
42
42
  }
@@ -130,7 +130,7 @@ export class GraphsModule {
130
130
  * @returns 200 with graph spec, or 404 if not initialized
131
131
  */
132
132
  async get(agentId: string): Promise<APIResponse<GraphsGetResponse>> {
133
- return this.client.GET<GraphsGetResponse>(`/v2/api/graph/${agentId}`, {
133
+ return this.client.GET<GraphsGetResponse>(`/v1/api/graph/${agentId}`, {
134
134
  headers: this.headers(),
135
135
  });
136
136
  }
@@ -140,7 +140,7 @@ export class GraphsModule {
140
140
  * @returns 200 (committed/no_change), or 409 on conflict
141
141
  */
142
142
  async commit(request: GraphsCommitRequest): Promise<APIResponse<GraphsCommitResponse>> {
143
- return this.client.POST<GraphsCommitResponse>("/v2/api/graph/commit", {
143
+ return this.client.POST<GraphsCommitResponse>("/v1/api/graph/commit", {
144
144
  body: request,
145
145
  headers: this.headers(),
146
146
  });
@@ -150,7 +150,7 @@ export class GraphsModule {
150
150
  * List revision history for an agent.
151
151
  */
152
152
  async listRevisions(agentId: string): Promise<APIResponse<GraphsRevisionsListResponse>> {
153
- return this.client.GET<GraphsRevisionsListResponse>(`/v2/api/graph/${agentId}/revisions`, {
153
+ return this.client.GET<GraphsRevisionsListResponse>(`/v1/api/graph/${agentId}/revisions`, {
154
154
  headers: this.headers(),
155
155
  });
156
156
  }
@@ -159,7 +159,7 @@ export class GraphsModule {
159
159
  * Get a specific revision.
160
160
  */
161
161
  async getRevision(agentId: string, revision: string): Promise<APIResponse<GraphsRevisionResponse>> {
162
- return this.client.GET<GraphsRevisionResponse>(`/v2/api/graph/${agentId}/revisions/${revision}`, {
162
+ return this.client.GET<GraphsRevisionResponse>(`/v1/api/graph/${agentId}/revisions/${revision}`, {
163
163
  headers: this.headers(),
164
164
  });
165
165
  }
@@ -55,7 +55,7 @@ export class InfoModule {
55
55
  * Get server information.
56
56
  */
57
57
  async get(): Promise<APIResponse<ServerInfo>> {
58
- return this.client.GET<ServerInfo>("/v1/api/info", {
58
+ return this.client.GET<ServerInfo>("/v1/info", {
59
59
  headers: this.headers(),
60
60
  });
61
61
  }