@agent-os-sdk/client 0.4.1 → 0.4.3
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/README.md +60 -0
- package/dist/client/raw.d.ts +3 -4
- package/dist/client/raw.d.ts.map +1 -1
- package/dist/generated/openapi.d.ts +465 -474
- package/dist/generated/openapi.d.ts.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/modules/builder.d.ts +61 -15
- package/dist/modules/builder.d.ts.map +1 -1
- package/dist/modules/builder.js +20 -3
- package/dist/modules/runs.d.ts.map +1 -1
- package/package.json +51 -50
- package/src/client/raw.ts +3 -4
- package/src/generated/openapi.ts +465 -474
- package/src/generated/swagger.json +708 -701
- package/src/index.ts +3 -3
- package/src/modules/agents.ts +1 -1
- package/src/modules/builder.ts +102 -18
package/src/index.ts
CHANGED
|
@@ -114,8 +114,8 @@ export type { components, paths } from "./client/raw.js";
|
|
|
114
114
|
// ============================================================================
|
|
115
115
|
|
|
116
116
|
// Core modules
|
|
117
|
-
export { AgentsModule, type Agent, type AgentGraphResponse, type AgentListResponse
|
|
118
|
-
export { BuilderModule, type BuilderChatRequest, type BuilderChatResponse, type BuilderStreamEvent, type GraphUpdateAction } from "./modules/builder.js";
|
|
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
119
|
export { CredentialsModule, type Credential, type CredentialListResponse, type CredentialType } from "./modules/credentials.js";
|
|
120
120
|
export { KnowledgeModule, type KnowledgeDataset, type KnowledgeSearchResponse } from "./modules/knowledge.js";
|
|
121
121
|
export { MembersModule, type Member, type MemberListResponse, type Role } from "./modules/members.js";
|
|
@@ -168,7 +168,7 @@ export type {
|
|
|
168
168
|
CancelRunResponse,
|
|
169
169
|
// Checkpoint types
|
|
170
170
|
CheckpointDetail,
|
|
171
|
-
CheckpointListResponse, CreateAgentRequest,
|
|
171
|
+
CheckpointListResponse, CreateAgentRequest,
|
|
172
172
|
// Credential types
|
|
173
173
|
CreateCredentialRequest,
|
|
174
174
|
// Cron types
|
package/src/modules/agents.ts
CHANGED
|
@@ -11,7 +11,7 @@ import type { RawClient, APIResponse, components } from "../client/raw.js";
|
|
|
11
11
|
import type { PaginationParams, PaginatedResponse } from "../client/helpers.js";
|
|
12
12
|
|
|
13
13
|
// Type aliases for this module
|
|
14
|
-
type AgentSchema = components["schemas"]["
|
|
14
|
+
type AgentSchema = components["schemas"]["AgentExportAgent"];
|
|
15
15
|
// Response types
|
|
16
16
|
export interface Agent {
|
|
17
17
|
id: string;
|
package/src/modules/builder.ts
CHANGED
|
@@ -41,37 +41,105 @@ export type ChatHistoryMessage = {
|
|
|
41
41
|
content: string;
|
|
42
42
|
};
|
|
43
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
|
+
*/
|
|
44
52
|
export type BuilderChatRequest = {
|
|
53
|
+
/** Chat message/intention */
|
|
45
54
|
message: string;
|
|
46
|
-
|
|
55
|
+
/** Thread ID for conversation continuity */
|
|
47
56
|
thread_id?: string;
|
|
48
|
-
/**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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;
|
|
54
116
|
};
|
|
55
117
|
|
|
56
118
|
export type GraphUpdateAction = {
|
|
119
|
+
// Legacy support
|
|
57
120
|
action: string;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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;
|
|
63
127
|
};
|
|
64
128
|
|
|
65
129
|
export type BuilderStreamEvent =
|
|
66
130
|
| { type: "message"; data: { text: string } }
|
|
67
|
-
| { type: "
|
|
68
|
-
| { type: "
|
|
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 } }
|
|
69
134
|
| { type: "error"; data: { error: string } };
|
|
70
135
|
|
|
71
136
|
export type BuilderChatResponse = {
|
|
72
137
|
response: string;
|
|
73
|
-
|
|
138
|
+
graph_spec?: Record<string, unknown>;
|
|
139
|
+
valid: boolean;
|
|
140
|
+
errors: any[];
|
|
74
141
|
thread_id: string;
|
|
142
|
+
hints: HintModel[];
|
|
75
143
|
};
|
|
76
144
|
|
|
77
145
|
export class BuilderModule {
|
|
@@ -176,14 +244,27 @@ export class BuilderModule {
|
|
|
176
244
|
request: BuilderChatRequest
|
|
177
245
|
): Promise<BuilderChatResponse> {
|
|
178
246
|
let fullResponse = "";
|
|
179
|
-
|
|
247
|
+
let lastGraphSpec: Record<string, unknown> | undefined;
|
|
248
|
+
let allHints: HintModel[] = [];
|
|
249
|
+
const allErrors: any[] = [];
|
|
180
250
|
let threadId = request.thread_id ?? "";
|
|
251
|
+
let isValid = true;
|
|
181
252
|
|
|
182
253
|
for await (const event of this.chat(agentId, request)) {
|
|
183
254
|
if (event.type === "message") {
|
|
184
255
|
fullResponse += event.data.text;
|
|
185
256
|
} else if (event.type === "graph_update") {
|
|
186
|
-
|
|
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
|
+
}
|
|
187
268
|
} else if (event.type === "done") {
|
|
188
269
|
threadId = event.data.thread_id;
|
|
189
270
|
}
|
|
@@ -191,7 +272,10 @@ export class BuilderModule {
|
|
|
191
272
|
|
|
192
273
|
return {
|
|
193
274
|
response: fullResponse,
|
|
194
|
-
|
|
275
|
+
graph_spec: lastGraphSpec,
|
|
276
|
+
hints: allHints,
|
|
277
|
+
valid: isValid,
|
|
278
|
+
errors: allErrors,
|
|
195
279
|
thread_id: threadId,
|
|
196
280
|
};
|
|
197
281
|
}
|