@agent-os-sdk/client 0.4.0 → 0.4.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"members.d.ts","sourceRoot":"","sources":["../../src/modules/members.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEhF,MAAM,WAAW,MAAM;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAC;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;AAE3D,qBAAa,aAAa;IACV,OAAO,CAAC,MAAM;IAAa,OAAO,CAAC,OAAO;gBAAlC,MAAM,EAAE,SAAS,EAAU,OAAO,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAEpF;;OAEG;IACG,IAAI,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG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AE;QACjC,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;KAC5B,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAQhC;;;OAGG;IACG,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAO1D;;;OAGG;IACH,MAAM,GAAI,UAAU,MAAM,gCAA2B;IAErD;;OAEG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAOhE;;;OAGG;IACG,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAO7D;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,WAAW,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAKlE"}
@@ -31,6 +31,59 @@ export class MembersModule {
31
31
  headers: this.headers(),
32
32
  });
33
33
  }
34
+ /**
35
+ * List all roles in the tenant.
36
+ */
37
+ async listRoles() {
38
+ return this.client.GET("/v1/api/roles", {
39
+ headers: this.headers(),
40
+ });
41
+ }
42
+ /**
43
+ * Get a role by ID.
44
+ */
45
+ async getRole(roleId) {
46
+ return this.client.GET("/v1/api/roles/{id}", {
47
+ params: { path: { id: roleId } },
48
+ headers: this.headers(),
49
+ });
50
+ }
51
+ /**
52
+ * Create a new custom role.
53
+ */
54
+ async createRole(body) {
55
+ return this.client.POST("/v1/api/roles", {
56
+ body,
57
+ headers: this.headers(),
58
+ });
59
+ }
60
+ /**
61
+ * Update a custom role.
62
+ */
63
+ async updateRole(roleId, body) {
64
+ return this.client.PUT("/v1/api/roles/{id}", {
65
+ params: { path: { id: roleId } },
66
+ body,
67
+ headers: this.headers(),
68
+ });
69
+ }
70
+ /**
71
+ * Delete a custom role.
72
+ */
73
+ async deleteRole(roleId) {
74
+ return this.client.DELETE("/v1/api/roles/{id}", {
75
+ params: { path: { id: roleId } },
76
+ headers: this.headers(),
77
+ });
78
+ }
79
+ /**
80
+ * List all available system permissions.
81
+ */
82
+ async listPermissions() {
83
+ return this.client.GET("/v1/api/roles/permissions", {
84
+ headers: this.headers(),
85
+ });
86
+ }
34
87
  /**
35
88
  * Invite a new member.
36
89
  */
@@ -84,4 +137,12 @@ export class MembersModule {
84
137
  headers: this.headers(),
85
138
  });
86
139
  }
140
+ /**
141
+ * Seed default permissions (Dev only)
142
+ */
143
+ async seedDefaults() {
144
+ return this.client.POST("/v1/api/roles/seed-defaults", {
145
+ headers: this.headers(),
146
+ });
147
+ }
87
148
  }
package/package.json CHANGED
@@ -1,51 +1,52 @@
1
1
  {
2
- "name": "@agent-os-sdk/client",
3
- "version": "0.4.0",
4
- "description": "Official TypeScript SDK for Agent OS platform",
5
- "type": "module",
6
- "main": "./dist/index.js",
7
- "module": "./dist/index.js",
8
- "types": "./dist/index.d.ts",
9
- "exports": {
10
- ".": {
11
- "import": "./dist/index.js",
12
- "types": "./dist/index.d.ts"
13
- }
14
- },
15
- "keywords": [
16
- "agent-os",
17
- "sdk",
18
- "ai",
19
- "agents",
20
- "typescript"
21
- ],
22
- "author": "Agent OS Team",
23
- "license": "MIT",
24
- "repository": {
25
- "type": "git",
26
- "url": "https://github.com/yuri12344/agent-os.git"
27
- },
28
- "publishConfig": {
29
- "access": "public"
30
- },
31
- "dependencies": {
32
- "openapi-fetch": "^0.13.0"
33
- },
34
- "devDependencies": {
35
- "openapi-typescript": "^7.4.0",
36
- "tsx": "^4.19.0",
37
- "typescript": "^5.5.0",
38
- "vitest": "^4.0.18"
39
- },
40
- "files": [
41
- "dist",
42
- "src"
43
- ],
44
- "scripts": {
45
- "generate": "tsx scripts/generate.ts",
46
- "build": "tsc",
47
- "dev": "tsc --watch",
48
- "test": "vitest run",
49
- "typecheck": "tsc --noEmit"
50
- }
2
+ "name": "@agent-os-sdk/client",
3
+ "version": "0.4.2",
4
+ "description": "Official TypeScript SDK for Agent OS platform",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
13
+ }
14
+ },
15
+ "scripts": {
16
+ "generate": "tsx scripts/generate.ts",
17
+ "build": "tsc",
18
+ "dev": "tsc --watch",
19
+ "test": "vitest run",
20
+ "typecheck": "tsc --noEmit",
21
+ "prepublishOnly": "pnpm build"
22
+ },
23
+ "keywords": [
24
+ "agent-os",
25
+ "sdk",
26
+ "ai",
27
+ "agents",
28
+ "typescript"
29
+ ],
30
+ "author": "Agent OS Team",
31
+ "license": "MIT",
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "https://github.com/yuri12344/agent-os.git"
35
+ },
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
39
+ "dependencies": {
40
+ "openapi-fetch": "^0.13.0"
41
+ },
42
+ "devDependencies": {
43
+ "openapi-typescript": "^7.4.0",
44
+ "tsx": "^4.19.0",
45
+ "typescript": "^5.5.0",
46
+ "vitest": "^4.0.18"
47
+ },
48
+ "files": [
49
+ "dist",
50
+ "src"
51
+ ]
51
52
  }
package/src/client/raw.ts CHANGED
@@ -5,11 +5,11 @@
5
5
  * All types are automatically inferred from the backend Swagger specification.
6
6
  */
7
7
 
8
- import createClient, { type Client, type FetchOptions } from "openapi-fetch";
9
- import type { paths, components } from "../generated/openapi.js";
8
+ import createClient, { type Client } from "openapi-fetch";
9
+ import type { components, paths } from "../generated/openapi.js";
10
10
 
11
11
  // Re-export types for external use
12
- export type { paths, components };
12
+ export type { components, paths };
13
13
 
14
14
  export type ClientOptions = {
15
15
  baseUrl: string;
@@ -202,7 +202,7 @@ export function createRawClient(options: ClientOptions) {
202
202
  code: "NETWORK_ERROR",
203
203
  message: fetchError instanceof Error ? fetchError.message : "Network request failed"
204
204
  },
205
- response: new Response(null, { status: 0 })
205
+ response: new Response(null, { status: 503, statusText: "Network Error" })
206
206
  };
207
207
  }
208
208
 
package/src/index.ts CHANGED
@@ -42,26 +42,16 @@ export { AgentOsClient, type AgentOsClientOptions, type AuthProvider } from "./c
42
42
 
43
43
  // Auth Provider Types
44
44
  export {
45
- type ApiTokenAuth,
46
- type JwtAuth,
47
- isApiTokenAuth,
48
- isJwtAuth,
49
- isBrowser,
50
- isApiToken,
51
- isJwtToken,
45
+ isApiToken, isApiTokenAuth, isBrowser, isJwtAuth, isJwtToken, type ApiTokenAuth,
46
+ type JwtAuth
52
47
  } from "./client/auth.js";
53
48
 
54
49
  // ============================================================================
55
50
  // Helpers & Utilities
56
51
  // ============================================================================
57
52
  export {
58
- unwrap,
59
- toResult,
60
- SDKError,
61
- type PaginationParams,
62
- type PaginatedResponse,
63
- type Result,
64
- type Unwrapped,
53
+ SDKError, toResult, unwrap, type PaginatedResponse, type PaginationParams, type Result,
54
+ type Unwrapped
65
55
  } from "./client/helpers.js";
66
56
 
67
57
  // ============================================================================
@@ -69,26 +59,15 @@ export {
69
59
  // ============================================================================
70
60
  export {
71
61
  // Base class
72
- AgentOsError,
73
- type ErrorOptions,
62
+ AgentOsError, ConflictError, ForbiddenError, NetworkError, NotFoundError, RateLimitError,
63
+ ServerError, TimeoutError,
74
64
  // Error classes
75
- UnauthorizedError,
76
- ForbiddenError,
77
- NotFoundError,
78
- ConflictError,
79
- ValidationError,
80
- RateLimitError,
81
- ServerError,
82
- NetworkError,
83
- TimeoutError,
84
- // Field errors
85
- type FieldError,
65
+ UnauthorizedError, ValidationError,
86
66
  // Type guards
87
- isAgentOsError,
88
- isRetryableError,
89
- isAuthError,
90
- isClientError,
91
- isServerError,
67
+ isAgentOsError, isAuthError,
68
+ isClientError, isRetryableError, isServerError, type ErrorOptions,
69
+ // Field errors
70
+ type FieldError
92
71
  } from "./errors/index.js";
93
72
 
94
73
  export { createErrorFromResponse } from "./errors/factory.js";
@@ -97,32 +76,22 @@ export { createErrorFromResponse } from "./errors/factory.js";
97
76
  // Network Configuration
98
77
  // ============================================================================
99
78
  export {
100
- type RetryConfig,
101
- type NetworkConfig,
102
- DEFAULT_NETWORK_CONFIG,
103
- INTERACTIVE_NETWORK_CONFIG,
104
- BACKGROUND_NETWORK_CONFIG,
105
- mergeNetworkConfig,
79
+ BACKGROUND_NETWORK_CONFIG, DEFAULT_NETWORK_CONFIG,
80
+ INTERACTIVE_NETWORK_CONFIG, mergeNetworkConfig, type NetworkConfig, type RetryConfig
106
81
  } from "./client/config.js";
107
82
 
108
83
  // ============================================================================
109
84
  // Retry & Timeout Utilities
110
85
  // ============================================================================
111
- export { withRetry, type RetryContext, sleep } from "./client/retry.js";
112
- export { withTimeout, createTimeoutController } from "./client/timeout.js";
86
+ export { sleep, withRetry, type RetryContext } from "./client/retry.js";
87
+ export { createTimeoutController, withTimeout } from "./client/timeout.js";
113
88
 
114
89
  // ============================================================================
115
90
  // Pagination Utilities
116
91
  // ============================================================================
117
92
  export {
118
- paginate,
119
93
  collectAll,
120
- getFirst,
121
- type OffsetPaginatedResponse,
122
- type CursorPaginatedResponse,
123
- type OffsetParams,
124
- type CursorParams,
125
- type PaginateOptions,
94
+ getFirst, paginate, type CursorPaginatedResponse, type CursorParams, type OffsetPaginatedResponse, type OffsetParams, type PaginateOptions
126
95
  } from "./client/pagination.js";
127
96
 
128
97
 
@@ -131,116 +100,98 @@ export {
131
100
  // ============================================================================
132
101
  export {
133
102
  createRawClient,
134
- createTypedClient,
135
- type RawClient,
136
- type TypedClient,
137
- type ClientOptions,
138
- type APIResponse,
103
+ createTypedClient, type APIResponse, type ClientOptions, type HookErrorContext, type HookRequestContext,
104
+ type HookResponseContext, type RawClient,
139
105
  // SDK Hooks for observability (OTEL, Sentry, etc.)
140
- type SDKHooks,
141
- type HookRequestContext,
142
- type HookResponseContext,
143
- type HookErrorContext,
106
+ type SDKHooks, type TypedClient
144
107
  } from "./client/raw.js";
145
108
 
146
109
  // Export OpenAPI types
147
- export type { paths, components } from "./client/raw.js";
110
+ export type { components, paths } from "./client/raw.js";
148
111
 
149
112
  // ============================================================================
150
113
  // Module Classes
151
114
  // ============================================================================
152
115
 
153
116
  // Core modules
154
- export { AgentsModule, type Agent, type AgentVersion, type AgentListResponse, type AgentGraphResponse } from "./modules/agents.js";
155
- 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";
156
- export { ThreadsModule, type Thread, type ThreadState, type ThreadMessage, type ThreadRun, type ThreadListResponse, type ThreadMessagesResponse } from "./modules/threads.js";
157
- export { ToolsModule, type Tool, type ToolListResponse } from "./modules/tools.js";
158
- export { KnowledgeModule, type KnowledgeDataset, type KnowledgeSearchResponse } from "./modules/knowledge.js";
159
- export { TriggersModule, type Trigger, type TriggerListResponse } from "./modules/triggers.js";
117
+ export { AgentsModule, type Agent, type AgentGraphResponse, type AgentListResponse, type AgentVersion } 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";
160
119
  export { CredentialsModule, type Credential, type CredentialListResponse, type CredentialType } from "./modules/credentials.js";
161
- export { BuilderModule, type BuilderChatRequest, type BuilderChatResponse, type BuilderStreamEvent, type GraphUpdateAction } from "./modules/builder.js";
162
- export { MembersModule, type Member, type MemberListResponse } from "./modules/members.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";
163
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";
164
127
  export { WorkspacesModule, type Workspace, type WorkspaceListResponse } from "./modules/workspaces.js";
165
128
 
166
129
  // Platform modules
167
- export { PromptsModule, type Prompt, type PromptVersion, type PromptListResponse } from "./modules/prompts.js";
168
- export { TracesModule, type Trace, type Span, type TraceListResponse, type SpanData, type FeedbackRequest } from "./modules/traces.js";
169
- export { FilesModule, type StoredFile, type FileListResponse, type PresignedUpload } from "./modules/files.js";
170
- export { VectorStoresModule, type VectorStore, type VectorStoreListResponse, type VectorQueryResult } from "./modules/vectorStores.js";
171
- export { EvaluationModule, type EvalDataset, type Experiment, type ExampleData } from "./modules/evaluation.js";
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";
172
133
  export { CheckpointsModule, type Checkpoint, type CheckpointsResponse } from "./modules/checkpoints.js";
173
- export { PlaygroundModule, type PlaygroundSession } from "./modules/playground.js";
174
134
  export { CronsModule, type CronJob, type CronJobListResponse } from "./modules/crons.js";
175
- export { DlqModule, type DlqMessage, type DlqListResponse } from "./modules/dlq.js";
176
- export { StoreModule, type StoreValue } from "./modules/store.js";
177
- export { AuditModule, type AuditLogEntry, type AuditListResponse } from "./modules/audit.js";
178
- export { UsageModule, type UsageResponse, type UsageQuota } from "./modules/usage.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 { GraphsModule, type GraphIntrospectionResult, type GraphValidationResult } from "./modules/graphs.js";
139
+ export { InfoModule, type ServerCapabilities, type ServerInfo } from "./modules/info.js";
179
140
  export { McpModule, type McpServer } from "./modules/mcp.js";
180
- export { A2aModule, type JsonRpcRequest, type JsonRpcResponse, type A2aAgentCard } from "./modules/a2a.js";
181
141
  export { MeModule, type MeResponse } from "./modules/me.js";
182
- export { InfoModule, type ServerInfo, type ServerCapabilities } from "./modules/info.js";
183
142
  export { MetricsModule, type MetricsResponse } from "./modules/metrics.js";
184
- export { GraphsModule, type GraphValidationResult, type GraphIntrospectionResult } from "./modules/graphs.js";
185
- export { CatalogModule, type CatalogVersions, type NodeCatalogResponse, type ToolCatalogResponse, type TriggerCatalogResponse, type NodeDefinition, type ToolDefinition, type TriggerTemplate } from "./modules/catalog.js";
143
+ export { PlaygroundModule, type PlaygroundSession } from "./modules/playground.js";
144
+ export { PromptsModule, type Prompt, type PromptListResponse, type PromptVersion } from "./modules/prompts.js";
145
+ export { StoreModule, type StoreValue } from "./modules/store.js";
146
+ export { TracesModule, type FeedbackRequest, type Span, type SpanData, type Trace, type TraceListResponse } from "./modules/traces.js";
147
+ export { UsageModule, type UsageQuota, type UsageResponse } from "./modules/usage.js";
148
+ export { VectorStoresModule, type VectorQueryResult, type VectorStore, type VectorStoreListResponse } from "./modules/vectorStores.js";
186
149
 
187
150
  // Approvals is real (has backend implementation)
188
- export { ApprovalsModule, type Approval, type ApprovalStatus, type ApprovalDecision, type ApprovalListResponse, type ApprovalStatusResponse } from "./modules/approvals.js";
151
+ export { ApprovalsModule, type Approval, type ApprovalDecision, type ApprovalListResponse, type ApprovalStatus, type ApprovalStatusResponse } from "./modules/approvals.js";
189
152
 
190
153
  export { ApiTokensModule, type ApiToken, type ApiTokenSecret, type CreateTokenRequest, type RotateTokenResponse } from "./modules/apiTokens.js";
191
- export { MembershipsModule, type MembershipResponse, type EnsureMembershipRequest } from "./modules/memberships.js";
154
+ export { MembershipsModule, type EnsureMembershipRequest, type MembershipResponse } from "./modules/memberships.js";
192
155
 
193
156
  // ============================================================================
194
157
  // SSE Streaming
195
158
  // ============================================================================
196
- export { streamSSE, parseSSE, type SSEEvent, type SSEOptions, type RunStreamEvent, type RunSSEEvent, type RunEventDto as SSERunEventDto } from "./sse/client.js";
159
+ export { parseSSE, streamSSE, type RunSSEEvent, type RunStreamEvent, type SSEEvent, type SSEOptions, type RunEventDto as SSERunEventDto } from "./sse/client.js";
197
160
 
198
161
  // ============================================================================
199
162
  // Convenience Type Re-exports
200
163
  // ============================================================================
201
164
  export type {
165
+ AddMessageRequest, AgentBundle,
202
166
  // Agent types
203
- Agent as AgentSchema,
204
- CreateAgentRequest,
205
- UpdateAgentRequest,
206
- AgentBundle,
207
- CreateAgentVersionRequest,
208
- // Run types
209
- RunResponse,
210
- RunDetailResponse,
211
- WaitRunResponse,
212
- BatchRunResponse,
167
+ Agent as AgentSchema, BatchRunResponse,
213
168
  CancelRunResponse,
214
- ReplayRequest,
215
- // Thread types
216
- ThreadRequest,
217
- ThreadSearchRequest,
218
- AddMessageRequest,
219
169
  // Checkpoint types
220
170
  CheckpointDetail,
221
- CheckpointListResponse,
171
+ CheckpointListResponse, CreateAgentRequest, CreateAgentVersionRequest,
222
172
  // Credential types
223
173
  CreateCredentialRequest,
224
- UpdateCredentialRequest,
225
174
  // Cron types
226
175
  CreateCronJobRequest,
227
- UpdateCronJobRequest,
228
- // Member types
229
- InviteMemberRequest,
230
- UpdateMemberRequest,
231
- // Prompt types
232
- CreatePromptRequest,
233
- CreatePromptVersionRequest,
234
- // File types
235
- CreatePresignedUploadRequest,
236
- PresignedUploadResponse,
237
- // Vector Store types
238
- VectorStoreResponse,
239
- VectorQueryRequest,
240
- VectorQueryResponse,
241
176
  // Evaluation types
242
177
  CreateDatasetRequest,
243
178
  CreateExperimentRequest,
179
+ // File types
180
+ CreatePresignedUploadRequest,
181
+ // Prompt types
182
+ CreatePromptRequest,
183
+ CreatePromptVersionRequest,
184
+ // Member types
185
+ InviteMemberRequest, PresignedUploadResponse,
244
186
  // Error types
245
- ProblemDetails,
187
+ ProblemDetails, ReplayRequest, RunDetailResponse,
188
+ // Run types
189
+ RunResponse,
190
+ // Thread types
191
+ ThreadRequest,
192
+ ThreadSearchRequest, UpdateAgentRequest, UpdateCredentialRequest, UpdateCronJobRequest, UpdateMemberRequest, VectorQueryRequest,
193
+ VectorQueryResponse,
194
+ // Vector Store types
195
+ VectorStoreResponse, WaitRunResponse
246
196
  } from "./client/raw.js";
197
+
@@ -36,35 +36,110 @@ export type CatalogVersions = {
36
36
  triggers: string;
37
37
  };
38
38
 
39
+ export type ChatHistoryMessage = {
40
+ role: 'user' | 'assistant';
41
+ content: string;
42
+ };
43
+
44
+ /**
45
+ * Builder chat request.
46
+ *
47
+ * KERNEL-FIRST: Frontend sends INTENTION only.
48
+ * - Graph spec is loaded from artifact storage by CP
49
+ * - Catalogs are loaded from DB by CP
50
+ * - Frontend should NOT send graph_spec or catalogs
51
+ */
39
52
  export type BuilderChatRequest = {
53
+ /** Chat message/intention */
40
54
  message: string;
41
- current_graph_spec?: Record<string, unknown>;
55
+ /** Thread ID for conversation continuity */
42
56
  thread_id?: string;
43
- /** Catalog versions to use for validation */
44
- catalog_versions?: CatalogVersions;
45
- /** Combined hash of all catalogs for integrity */
46
- catalog_ref?: string;
57
+ /** Optional ETag for concurrency control */
58
+ base_graph_etag?: string;
59
+ };
60
+
61
+ export type HintTargetModel = {
62
+ node_id?: string;
63
+ edge_id?: string;
64
+ panel?: "credentials" | "triggers" | "logs" | "validation" | "deploy" | string;
65
+ action?: "create_credential" | "save_draft" | "publish_version" | string;
66
+ };
67
+
68
+ export type HintDataModel = {
69
+ // Credential hints
70
+ credential_slug?: string;
71
+ reason?: string;
72
+
73
+ // Config hints
74
+ fields?: string[];
75
+
76
+ // Error/validation hints
77
+ code?: string;
78
+ path?: string;
79
+
80
+ // Run/execution hints
81
+ run_id?: string;
82
+ error_code?: string;
83
+
84
+ // Cost/performance hints
85
+ tokens_in?: number;
86
+ tokens_out?: number;
87
+ usd_estimate?: number;
88
+
89
+ // Action hints
90
+ action_id?: string;
91
+ params?: Record<string, any>;
92
+ };
93
+
94
+ export type HintModel = {
95
+ id?: string;
96
+ scope: "graph" | "thread" | "run" | string;
97
+ type:
98
+ | "highlight_node"
99
+ | "needs_credential"
100
+ | "missing_config"
101
+ | "error_marker"
102
+ | "warning_marker"
103
+ | "toast"
104
+ | "run_started"
105
+ | "node_running"
106
+ | "node_failed"
107
+ | "rate_limited"
108
+ | "cost_estimate"
109
+ | "action_suggested"
110
+ | string;
111
+ severity: "info" | "warn" | "error" | "success";
112
+ target?: HintTargetModel;
113
+ message?: string;
114
+ ttl_ms?: number;
115
+ data?: HintDataModel;
47
116
  };
48
117
 
49
118
  export type GraphUpdateAction = {
119
+ // Legacy support
50
120
  action: string;
51
- node_name?: string;
52
- node_type?: string;
53
- properties?: Record<string, unknown>;
54
- edge_from?: string;
55
- edge_to?: string;
121
+ // ... legacy fields omitted for brevity, keeping strict new protocol
122
+ } | {
123
+ // New protocol (WAVE-3)
124
+ graph_spec: Record<string, unknown>;
125
+ hints?: HintModel[];
126
+ has_errors?: boolean;
56
127
  };
57
128
 
58
129
  export type BuilderStreamEvent =
59
130
  | { type: "message"; data: { text: string } }
60
- | { type: "graph_update"; data: GraphUpdateAction }
61
- | { type: "done"; data: { response: string; actions: GraphUpdateAction[]; thread_id: string } }
131
+ | { type: "validation"; data: { valid: boolean; errors: any[] } }
132
+ | { type: "graph_update"; data: { graph_spec: Record<string, unknown>; hints: HintModel[]; has_errors?: boolean } }
133
+ | { type: "done"; data: { response: string; thread_id: string } }
62
134
  | { type: "error"; data: { error: string } };
63
135
 
64
136
  export type BuilderChatResponse = {
65
137
  response: string;
66
- actions: GraphUpdateAction[];
138
+ graph_spec?: Record<string, unknown>;
139
+ valid: boolean;
140
+ errors: any[];
67
141
  thread_id: string;
142
+ hints: HintModel[];
68
143
  };
69
144
 
70
145
  export class BuilderModule {
@@ -169,14 +244,27 @@ export class BuilderModule {
169
244
  request: BuilderChatRequest
170
245
  ): Promise<BuilderChatResponse> {
171
246
  let fullResponse = "";
172
- const allActions: GraphUpdateAction[] = [];
247
+ let lastGraphSpec: Record<string, unknown> | undefined;
248
+ let allHints: HintModel[] = [];
249
+ const allErrors: any[] = [];
173
250
  let threadId = request.thread_id ?? "";
251
+ let isValid = true;
174
252
 
175
253
  for await (const event of this.chat(agentId, request)) {
176
254
  if (event.type === "message") {
177
255
  fullResponse += event.data.text;
178
256
  } else if (event.type === "graph_update") {
179
- allActions.push(event.data);
257
+ if ('graph_spec' in event.data) {
258
+ lastGraphSpec = event.data.graph_spec;
259
+ if (event.data.hints) {
260
+ allHints.push(...event.data.hints);
261
+ }
262
+ }
263
+ } else if (event.type === "validation") {
264
+ isValid = event.data.valid;
265
+ if (event.data.errors) {
266
+ allErrors.push(...event.data.errors);
267
+ }
180
268
  } else if (event.type === "done") {
181
269
  threadId = event.data.thread_id;
182
270
  }
@@ -184,7 +272,10 @@ export class BuilderModule {
184
272
 
185
273
  return {
186
274
  response: fullResponse,
187
- actions: allActions,
275
+ graph_spec: lastGraphSpec,
276
+ hints: allHints,
277
+ valid: isValid,
278
+ errors: allErrors,
188
279
  thread_id: threadId,
189
280
  };
190
281
  }