@agent-os-sdk/client 0.1.1 → 0.1.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.
- package/dist/client/AgentOsClient.d.ts +28 -4
- package/dist/client/AgentOsClient.d.ts.map +1 -1
- package/dist/client/AgentOsClient.js +40 -3
- package/dist/generated/openapi.d.ts +93 -0
- package/dist/generated/openapi.d.ts.map +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/modules/approvals.d.ts +78 -0
- package/dist/modules/approvals.d.ts.map +1 -0
- package/dist/modules/approvals.js +157 -0
- package/dist/modules/artifacts.d.ts +100 -0
- package/dist/modules/artifacts.d.ts.map +1 -0
- package/dist/modules/artifacts.js +217 -0
- package/dist/modules/budgets.d.ts +104 -0
- package/dist/modules/budgets.d.ts.map +1 -0
- package/dist/modules/budgets.js +161 -0
- package/dist/modules/builder.d.ts +2 -2
- package/dist/modules/builder.d.ts.map +1 -1
- package/dist/modules/builder.js +5 -5
- package/dist/modules/capabilities.d.ts +68 -0
- package/dist/modules/capabilities.d.ts.map +1 -0
- package/dist/modules/capabilities.js +113 -0
- package/dist/modules/deployments.d.ts +110 -0
- package/dist/modules/deployments.d.ts.map +1 -0
- package/dist/modules/deployments.js +230 -0
- package/dist/modules/flows.d.ts +104 -0
- package/dist/modules/flows.d.ts.map +1 -0
- package/dist/modules/flows.js +190 -0
- package/dist/modules/handoff.d.ts +88 -0
- package/dist/modules/handoff.d.ts.map +1 -0
- package/dist/modules/handoff.js +128 -0
- package/dist/modules/incidents.d.ts +133 -0
- package/dist/modules/incidents.d.ts.map +1 -0
- package/dist/modules/incidents.js +231 -0
- package/dist/modules/members.d.ts +5 -0
- package/dist/modules/members.d.ts.map +1 -1
- package/dist/modules/members.js +10 -0
- package/dist/modules/policies.d.ts +103 -0
- package/dist/modules/policies.d.ts.map +1 -0
- package/dist/modules/policies.js +180 -0
- package/dist/modules/runs.d.ts.map +1 -1
- package/dist/modules/tenants.d.ts +4 -0
- package/dist/modules/tenants.d.ts.map +1 -1
- package/dist/modules/tenants.js +8 -0
- package/package.json +49 -48
- package/src/client/AgentOsClient.ts +45 -7
- package/src/generated/openapi.ts +93 -0
- package/src/generated/swagger.json +107 -0
- package/src/index.ts +11 -0
- package/src/modules/approvals.ts +210 -0
- package/src/modules/artifacts.ts +287 -0
- package/src/modules/budgets.ts +236 -0
- package/src/modules/builder.ts +3 -3
- package/src/modules/capabilities.ts +176 -0
- package/src/modules/deployments.ts +315 -0
- package/src/modules/flows.ts +259 -0
- package/src/modules/handoff.ts +204 -0
- package/src/modules/incidents.ts +339 -0
- package/src/modules/members.ts +11 -0
- package/src/modules/policies.ts +258 -0
- package/src/modules/tenants.ts +9 -0
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deployments Module - Release Management
|
|
3
|
+
*
|
|
4
|
+
* // MOCK - This module contains mock implementations for future features
|
|
5
|
+
*
|
|
6
|
+
* Provides deployment management, environment promotion,
|
|
7
|
+
* rollback, canary releases, and change freezes.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { RawClient, APIResponse } from "../client/raw.js";
|
|
11
|
+
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// Types
|
|
14
|
+
// ============================================================================
|
|
15
|
+
|
|
16
|
+
export type DeploymentStatus = "pending" | "deploying" | "active" | "rolling_back" | "rolled_back" | "failed";
|
|
17
|
+
export type EnvironmentType = "development" | "staging" | "production" | "custom";
|
|
18
|
+
|
|
19
|
+
export interface Environment {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
type: EnvironmentType;
|
|
23
|
+
description?: string;
|
|
24
|
+
is_frozen: boolean;
|
|
25
|
+
frozen_until?: string;
|
|
26
|
+
frozen_reason?: string;
|
|
27
|
+
config: Record<string, unknown>;
|
|
28
|
+
created_at: string;
|
|
29
|
+
updated_at: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface Deployment {
|
|
33
|
+
id: string;
|
|
34
|
+
agent_id: string;
|
|
35
|
+
agent_version_id: string;
|
|
36
|
+
environment_id: string;
|
|
37
|
+
environment_name: string;
|
|
38
|
+
status: DeploymentStatus;
|
|
39
|
+
promoted_by: string;
|
|
40
|
+
promoted_at: string;
|
|
41
|
+
completed_at?: string;
|
|
42
|
+
rollback_version_id?: string;
|
|
43
|
+
canary_percent?: number;
|
|
44
|
+
notes?: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface DeploymentDiff {
|
|
48
|
+
from_version: string;
|
|
49
|
+
to_version: string;
|
|
50
|
+
changes: {
|
|
51
|
+
category: string;
|
|
52
|
+
field: string;
|
|
53
|
+
old_value: unknown;
|
|
54
|
+
new_value: unknown;
|
|
55
|
+
}[];
|
|
56
|
+
config_changes: number;
|
|
57
|
+
prompt_changes: number;
|
|
58
|
+
graph_changes: number;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface EnvironmentListResponse {
|
|
62
|
+
items: Environment[];
|
|
63
|
+
total: number;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface DeploymentListResponse {
|
|
67
|
+
items: Deployment[];
|
|
68
|
+
total: number;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// ============================================================================
|
|
72
|
+
// Module
|
|
73
|
+
// ============================================================================
|
|
74
|
+
|
|
75
|
+
export class DeploymentsModule {
|
|
76
|
+
constructor(private client: RawClient, private headers: () => Record<string, string>) { }
|
|
77
|
+
|
|
78
|
+
// ========== Environments ==========
|
|
79
|
+
|
|
80
|
+
// MOCK - Simulated listEnvironments
|
|
81
|
+
/**
|
|
82
|
+
* List all environments.
|
|
83
|
+
*/
|
|
84
|
+
async listEnvironments(): Promise<APIResponse<EnvironmentListResponse>> {
|
|
85
|
+
// MOCK - Returns simulated data
|
|
86
|
+
const mockEnvs: EnvironmentListResponse = {
|
|
87
|
+
items: [
|
|
88
|
+
{
|
|
89
|
+
id: "env_dev",
|
|
90
|
+
name: "Development",
|
|
91
|
+
type: "development",
|
|
92
|
+
description: "Development environment for testing",
|
|
93
|
+
is_frozen: false,
|
|
94
|
+
config: { logging_level: "debug" },
|
|
95
|
+
created_at: new Date(Date.now() - 86400000 * 30).toISOString(),
|
|
96
|
+
updated_at: new Date().toISOString(),
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: "env_staging",
|
|
100
|
+
name: "Staging",
|
|
101
|
+
type: "staging",
|
|
102
|
+
description: "Pre-production testing",
|
|
103
|
+
is_frozen: false,
|
|
104
|
+
config: { logging_level: "info" },
|
|
105
|
+
created_at: new Date(Date.now() - 86400000 * 30).toISOString(),
|
|
106
|
+
updated_at: new Date().toISOString(),
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
id: "env_prod",
|
|
110
|
+
name: "Production",
|
|
111
|
+
type: "production",
|
|
112
|
+
description: "Live production environment",
|
|
113
|
+
is_frozen: false,
|
|
114
|
+
config: { logging_level: "warning" },
|
|
115
|
+
created_at: new Date(Date.now() - 86400000 * 30).toISOString(),
|
|
116
|
+
updated_at: new Date().toISOString(),
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
total: 3,
|
|
120
|
+
};
|
|
121
|
+
return { data: mockEnvs, error: undefined, response: new Response() };
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// MOCK - Simulated createEnvironment
|
|
125
|
+
/**
|
|
126
|
+
* Create a new environment.
|
|
127
|
+
*/
|
|
128
|
+
async createEnvironment(body: {
|
|
129
|
+
name: string;
|
|
130
|
+
type: EnvironmentType;
|
|
131
|
+
description?: string;
|
|
132
|
+
config?: Record<string, unknown>;
|
|
133
|
+
}): Promise<APIResponse<Environment>> {
|
|
134
|
+
// MOCK - Returns simulated data
|
|
135
|
+
const mockEnv: Environment = {
|
|
136
|
+
id: `env_${Date.now()}`,
|
|
137
|
+
name: body.name,
|
|
138
|
+
type: body.type,
|
|
139
|
+
description: body.description,
|
|
140
|
+
is_frozen: false,
|
|
141
|
+
config: body.config || {},
|
|
142
|
+
created_at: new Date().toISOString(),
|
|
143
|
+
updated_at: new Date().toISOString(),
|
|
144
|
+
};
|
|
145
|
+
return { data: mockEnv, error: undefined, response: new Response() };
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// ========== Deployments ==========
|
|
149
|
+
|
|
150
|
+
// MOCK - Simulated history
|
|
151
|
+
/**
|
|
152
|
+
* Get deployment history for an environment.
|
|
153
|
+
*/
|
|
154
|
+
async history(environmentId: string): Promise<APIResponse<DeploymentListResponse>> {
|
|
155
|
+
// MOCK - Returns simulated data
|
|
156
|
+
const mockHistory: DeploymentListResponse = {
|
|
157
|
+
items: [
|
|
158
|
+
{
|
|
159
|
+
id: "deploy_3",
|
|
160
|
+
agent_id: "agent_support",
|
|
161
|
+
agent_version_id: "v3",
|
|
162
|
+
environment_id: environmentId,
|
|
163
|
+
environment_name: "Production",
|
|
164
|
+
status: "active",
|
|
165
|
+
promoted_by: "user_admin",
|
|
166
|
+
promoted_at: new Date(Date.now() - 3600000).toISOString(),
|
|
167
|
+
completed_at: new Date(Date.now() - 3500000).toISOString(),
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
id: "deploy_2",
|
|
171
|
+
agent_id: "agent_support",
|
|
172
|
+
agent_version_id: "v2",
|
|
173
|
+
environment_id: environmentId,
|
|
174
|
+
environment_name: "Production",
|
|
175
|
+
status: "rolled_back",
|
|
176
|
+
promoted_by: "user_admin",
|
|
177
|
+
promoted_at: new Date(Date.now() - 86400000).toISOString(),
|
|
178
|
+
completed_at: new Date(Date.now() - 86000000).toISOString(),
|
|
179
|
+
rollback_version_id: "v1",
|
|
180
|
+
},
|
|
181
|
+
],
|
|
182
|
+
total: 2,
|
|
183
|
+
};
|
|
184
|
+
return { data: mockHistory, error: undefined, response: new Response() };
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// MOCK - Simulated promote
|
|
188
|
+
/**
|
|
189
|
+
* Promote an agent version to an environment.
|
|
190
|
+
*/
|
|
191
|
+
async promote(
|
|
192
|
+
agentVersionId: string,
|
|
193
|
+
environmentId: string,
|
|
194
|
+
options?: { notes?: string }
|
|
195
|
+
): Promise<APIResponse<Deployment>> {
|
|
196
|
+
// MOCK - Returns simulated data
|
|
197
|
+
const mockDeploy: Deployment = {
|
|
198
|
+
id: `deploy_${Date.now()}`,
|
|
199
|
+
agent_id: "agent_123",
|
|
200
|
+
agent_version_id: agentVersionId,
|
|
201
|
+
environment_id: environmentId,
|
|
202
|
+
environment_name: "Production",
|
|
203
|
+
status: "deploying",
|
|
204
|
+
promoted_by: "user_current",
|
|
205
|
+
promoted_at: new Date().toISOString(),
|
|
206
|
+
notes: options?.notes,
|
|
207
|
+
};
|
|
208
|
+
return { data: mockDeploy, error: undefined, response: new Response() };
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// MOCK - Simulated rollback
|
|
212
|
+
/**
|
|
213
|
+
* Rollback an environment to a previous version.
|
|
214
|
+
*/
|
|
215
|
+
async rollback(environmentId: string, toVersionId?: string): Promise<APIResponse<Deployment>> {
|
|
216
|
+
// MOCK - Returns simulated data
|
|
217
|
+
const mockDeploy: Deployment = {
|
|
218
|
+
id: `deploy_rollback_${Date.now()}`,
|
|
219
|
+
agent_id: "agent_123",
|
|
220
|
+
agent_version_id: toVersionId || "v2",
|
|
221
|
+
environment_id: environmentId,
|
|
222
|
+
environment_name: "Production",
|
|
223
|
+
status: "rolling_back",
|
|
224
|
+
promoted_by: "user_current",
|
|
225
|
+
promoted_at: new Date().toISOString(),
|
|
226
|
+
rollback_version_id: "v3",
|
|
227
|
+
};
|
|
228
|
+
return { data: mockDeploy, error: undefined, response: new Response() };
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// MOCK - Simulated canary
|
|
232
|
+
/**
|
|
233
|
+
* Start a canary deployment.
|
|
234
|
+
*/
|
|
235
|
+
async canary(
|
|
236
|
+
environmentId: string,
|
|
237
|
+
agentVersionId: string,
|
|
238
|
+
percent: number
|
|
239
|
+
): Promise<APIResponse<Deployment>> {
|
|
240
|
+
// MOCK - Returns simulated data
|
|
241
|
+
const mockDeploy: Deployment = {
|
|
242
|
+
id: `deploy_canary_${Date.now()}`,
|
|
243
|
+
agent_id: "agent_123",
|
|
244
|
+
agent_version_id: agentVersionId,
|
|
245
|
+
environment_id: environmentId,
|
|
246
|
+
environment_name: "Production",
|
|
247
|
+
status: "deploying",
|
|
248
|
+
promoted_by: "user_current",
|
|
249
|
+
promoted_at: new Date().toISOString(),
|
|
250
|
+
canary_percent: percent,
|
|
251
|
+
};
|
|
252
|
+
return { data: mockDeploy, error: undefined, response: new Response() };
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// MOCK - Simulated freeze
|
|
256
|
+
/**
|
|
257
|
+
* Freeze an environment (change freeze).
|
|
258
|
+
*/
|
|
259
|
+
async freeze(
|
|
260
|
+
environmentId: string,
|
|
261
|
+
options?: { until?: string; reason?: string }
|
|
262
|
+
): Promise<APIResponse<Environment>> {
|
|
263
|
+
// MOCK - Returns simulated data
|
|
264
|
+
const mockEnv: Environment = {
|
|
265
|
+
id: environmentId,
|
|
266
|
+
name: "Production",
|
|
267
|
+
type: "production",
|
|
268
|
+
is_frozen: true,
|
|
269
|
+
frozen_until: options?.until,
|
|
270
|
+
frozen_reason: options?.reason || "Change freeze in effect",
|
|
271
|
+
config: {},
|
|
272
|
+
created_at: new Date(Date.now() - 86400000 * 30).toISOString(),
|
|
273
|
+
updated_at: new Date().toISOString(),
|
|
274
|
+
};
|
|
275
|
+
return { data: mockEnv, error: undefined, response: new Response() };
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// MOCK - Simulated unfreeze
|
|
279
|
+
/**
|
|
280
|
+
* Unfreeze an environment.
|
|
281
|
+
*/
|
|
282
|
+
async unfreeze(environmentId: string): Promise<APIResponse<Environment>> {
|
|
283
|
+
// MOCK - Returns simulated data
|
|
284
|
+
const mockEnv: Environment = {
|
|
285
|
+
id: environmentId,
|
|
286
|
+
name: "Production",
|
|
287
|
+
type: "production",
|
|
288
|
+
is_frozen: false,
|
|
289
|
+
config: {},
|
|
290
|
+
created_at: new Date(Date.now() - 86400000 * 30).toISOString(),
|
|
291
|
+
updated_at: new Date().toISOString(),
|
|
292
|
+
};
|
|
293
|
+
return { data: mockEnv, error: undefined, response: new Response() };
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// MOCK - Simulated diff
|
|
297
|
+
/**
|
|
298
|
+
* Get diff between two versions.
|
|
299
|
+
*/
|
|
300
|
+
async diff(fromVersionId: string, toVersionId: string): Promise<APIResponse<DeploymentDiff>> {
|
|
301
|
+
// MOCK - Returns simulated diff
|
|
302
|
+
const mockDiff: DeploymentDiff = {
|
|
303
|
+
from_version: fromVersionId,
|
|
304
|
+
to_version: toVersionId,
|
|
305
|
+
changes: [
|
|
306
|
+
{ category: "config", field: "max_tokens", old_value: 4000, new_value: 8000 },
|
|
307
|
+
{ category: "prompt", field: "system_prompt", old_value: "You are a helpful assistant", new_value: "You are an expert assistant" },
|
|
308
|
+
],
|
|
309
|
+
config_changes: 1,
|
|
310
|
+
prompt_changes: 1,
|
|
311
|
+
graph_changes: 0,
|
|
312
|
+
};
|
|
313
|
+
return { data: mockDiff, error: undefined, response: new Response() };
|
|
314
|
+
}
|
|
315
|
+
}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flows Module - Workflow Orchestration
|
|
3
|
+
*
|
|
4
|
+
* // MOCK - This module contains mock implementations for future features
|
|
5
|
+
*
|
|
6
|
+
* Provides lightweight workflow/orchestration between agents.
|
|
7
|
+
* "Graphs between agents" - the control plane of agents.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { RawClient, APIResponse } from "../client/raw.js";
|
|
11
|
+
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// Types
|
|
14
|
+
// ============================================================================
|
|
15
|
+
|
|
16
|
+
export type FlowStatus = "draft" | "active" | "paused" | "completed" | "failed" | "cancelled";
|
|
17
|
+
|
|
18
|
+
export interface FlowStep {
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
agent_id: string;
|
|
22
|
+
type: "agent" | "condition" | "parallel" | "wait" | "human_approval";
|
|
23
|
+
config?: Record<string, unknown>;
|
|
24
|
+
next_steps?: string[];
|
|
25
|
+
on_error?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface Flow {
|
|
29
|
+
id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
steps: FlowStep[];
|
|
33
|
+
status: FlowStatus;
|
|
34
|
+
version: number;
|
|
35
|
+
created_at: string;
|
|
36
|
+
updated_at: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface FlowRun {
|
|
40
|
+
id: string;
|
|
41
|
+
flow_id: string;
|
|
42
|
+
status: FlowStatus;
|
|
43
|
+
current_step_id?: string;
|
|
44
|
+
completed_steps: string[];
|
|
45
|
+
failed_steps: string[];
|
|
46
|
+
context: Record<string, unknown>;
|
|
47
|
+
started_at: string;
|
|
48
|
+
completed_at?: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface FlowVisualization {
|
|
52
|
+
mermaid: string;
|
|
53
|
+
svg?: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface FlowSimulationResult {
|
|
57
|
+
success: boolean;
|
|
58
|
+
steps_executed: string[];
|
|
59
|
+
estimated_duration_seconds: number;
|
|
60
|
+
estimated_cost: number;
|
|
61
|
+
potential_issues: string[];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface FlowListResponse {
|
|
65
|
+
items: Flow[];
|
|
66
|
+
total: number;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// ============================================================================
|
|
70
|
+
// Module
|
|
71
|
+
// ============================================================================
|
|
72
|
+
|
|
73
|
+
export class FlowsModule {
|
|
74
|
+
constructor(private client: RawClient, private headers: () => Record<string, string>) { }
|
|
75
|
+
|
|
76
|
+
// MOCK - Simulated list
|
|
77
|
+
/**
|
|
78
|
+
* List all flows.
|
|
79
|
+
*/
|
|
80
|
+
async list(params?: { limit?: number; offset?: number }): Promise<APIResponse<FlowListResponse>> {
|
|
81
|
+
// MOCK - Returns simulated data
|
|
82
|
+
const mockFlows: FlowListResponse = {
|
|
83
|
+
items: [
|
|
84
|
+
{
|
|
85
|
+
id: "flow_1",
|
|
86
|
+
name: "Customer Onboarding",
|
|
87
|
+
description: "Multi-step customer onboarding workflow",
|
|
88
|
+
steps: [
|
|
89
|
+
{ id: "step_1", name: "Collect Info", agent_id: "agent_intake", type: "agent", next_steps: ["step_2"] },
|
|
90
|
+
{ id: "step_2", name: "Verify Identity", agent_id: "agent_kyc", type: "agent", next_steps: ["step_3"] },
|
|
91
|
+
{ id: "step_3", name: "Create Account", agent_id: "agent_account", type: "agent" },
|
|
92
|
+
],
|
|
93
|
+
status: "active",
|
|
94
|
+
version: 1,
|
|
95
|
+
created_at: new Date(Date.now() - 86400000).toISOString(),
|
|
96
|
+
updated_at: new Date().toISOString(),
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
total: 1,
|
|
100
|
+
};
|
|
101
|
+
return { data: mockFlows, error: undefined, response: new Response() };
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// MOCK - Simulated get
|
|
105
|
+
/**
|
|
106
|
+
* Get a flow by ID.
|
|
107
|
+
*/
|
|
108
|
+
async get(flowId: string): Promise<APIResponse<Flow>> {
|
|
109
|
+
// MOCK - Returns simulated data
|
|
110
|
+
const mockFlow: Flow = {
|
|
111
|
+
id: flowId,
|
|
112
|
+
name: "Customer Onboarding",
|
|
113
|
+
description: "Multi-step customer onboarding workflow",
|
|
114
|
+
steps: [
|
|
115
|
+
{ id: "step_1", name: "Collect Info", agent_id: "agent_intake", type: "agent", next_steps: ["step_2"] },
|
|
116
|
+
{ id: "step_2", name: "Verify Identity", agent_id: "agent_kyc", type: "agent", next_steps: ["step_3"] },
|
|
117
|
+
{ id: "step_3", name: "Approve", agent_id: "", type: "human_approval", next_steps: ["step_4"] },
|
|
118
|
+
{ id: "step_4", name: "Create Account", agent_id: "agent_account", type: "agent" },
|
|
119
|
+
],
|
|
120
|
+
status: "active",
|
|
121
|
+
version: 1,
|
|
122
|
+
created_at: new Date(Date.now() - 86400000).toISOString(),
|
|
123
|
+
updated_at: new Date().toISOString(),
|
|
124
|
+
};
|
|
125
|
+
return { data: mockFlow, error: undefined, response: new Response() };
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// MOCK - Simulated create
|
|
129
|
+
/**
|
|
130
|
+
* Create a new flow.
|
|
131
|
+
*/
|
|
132
|
+
async create(body: {
|
|
133
|
+
name: string;
|
|
134
|
+
description?: string;
|
|
135
|
+
steps: FlowStep[];
|
|
136
|
+
}): Promise<APIResponse<Flow>> {
|
|
137
|
+
// MOCK - Returns simulated data
|
|
138
|
+
const mockFlow: Flow = {
|
|
139
|
+
id: `flow_${Date.now()}`,
|
|
140
|
+
name: body.name,
|
|
141
|
+
description: body.description,
|
|
142
|
+
steps: body.steps,
|
|
143
|
+
status: "draft",
|
|
144
|
+
version: 1,
|
|
145
|
+
created_at: new Date().toISOString(),
|
|
146
|
+
updated_at: new Date().toISOString(),
|
|
147
|
+
};
|
|
148
|
+
return { data: mockFlow, error: undefined, response: new Response() };
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// MOCK - Simulated run
|
|
152
|
+
/**
|
|
153
|
+
* Start a flow run.
|
|
154
|
+
*/
|
|
155
|
+
async run(flowId: string, input?: Record<string, unknown>): Promise<APIResponse<FlowRun>> {
|
|
156
|
+
// MOCK - Returns simulated data
|
|
157
|
+
const mockRun: FlowRun = {
|
|
158
|
+
id: `flowrun_${Date.now()}`,
|
|
159
|
+
flow_id: flowId,
|
|
160
|
+
status: "active",
|
|
161
|
+
current_step_id: "step_1",
|
|
162
|
+
completed_steps: [],
|
|
163
|
+
failed_steps: [],
|
|
164
|
+
context: input || {},
|
|
165
|
+
started_at: new Date().toISOString(),
|
|
166
|
+
};
|
|
167
|
+
return { data: mockRun, error: undefined, response: new Response() };
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// MOCK - Simulated pause
|
|
171
|
+
/**
|
|
172
|
+
* Pause a running flow.
|
|
173
|
+
*/
|
|
174
|
+
async pause(flowRunId: string): Promise<APIResponse<FlowRun>> {
|
|
175
|
+
// MOCK - Returns simulated data
|
|
176
|
+
const mockRun: FlowRun = {
|
|
177
|
+
id: flowRunId,
|
|
178
|
+
flow_id: "flow_1",
|
|
179
|
+
status: "paused",
|
|
180
|
+
current_step_id: "step_2",
|
|
181
|
+
completed_steps: ["step_1"],
|
|
182
|
+
failed_steps: [],
|
|
183
|
+
context: {},
|
|
184
|
+
started_at: new Date(Date.now() - 30000).toISOString(),
|
|
185
|
+
};
|
|
186
|
+
return { data: mockRun, error: undefined, response: new Response() };
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// MOCK - Simulated resume
|
|
190
|
+
/**
|
|
191
|
+
* Resume a paused flow.
|
|
192
|
+
*/
|
|
193
|
+
async resume(flowRunId: string): Promise<APIResponse<FlowRun>> {
|
|
194
|
+
// MOCK - Returns simulated data
|
|
195
|
+
const mockRun: FlowRun = {
|
|
196
|
+
id: flowRunId,
|
|
197
|
+
flow_id: "flow_1",
|
|
198
|
+
status: "active",
|
|
199
|
+
current_step_id: "step_2",
|
|
200
|
+
completed_steps: ["step_1"],
|
|
201
|
+
failed_steps: [],
|
|
202
|
+
context: {},
|
|
203
|
+
started_at: new Date(Date.now() - 30000).toISOString(),
|
|
204
|
+
};
|
|
205
|
+
return { data: mockRun, error: undefined, response: new Response() };
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// MOCK - Simulated cancel
|
|
209
|
+
/**
|
|
210
|
+
* Cancel a flow run.
|
|
211
|
+
*/
|
|
212
|
+
async cancel(flowRunId: string): Promise<APIResponse<FlowRun>> {
|
|
213
|
+
// MOCK - Returns simulated data
|
|
214
|
+
const mockRun: FlowRun = {
|
|
215
|
+
id: flowRunId,
|
|
216
|
+
flow_id: "flow_1",
|
|
217
|
+
status: "cancelled",
|
|
218
|
+
current_step_id: "step_2",
|
|
219
|
+
completed_steps: ["step_1"],
|
|
220
|
+
failed_steps: [],
|
|
221
|
+
context: {},
|
|
222
|
+
started_at: new Date(Date.now() - 30000).toISOString(),
|
|
223
|
+
completed_at: new Date().toISOString(),
|
|
224
|
+
};
|
|
225
|
+
return { data: mockRun, error: undefined, response: new Response() };
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// MOCK - Simulated visualize
|
|
229
|
+
/**
|
|
230
|
+
* Get flow visualization (Mermaid diagram).
|
|
231
|
+
*/
|
|
232
|
+
async visualize(flowId: string): Promise<APIResponse<FlowVisualization>> {
|
|
233
|
+
// MOCK - Returns simulated mermaid
|
|
234
|
+
const mockViz: FlowVisualization = {
|
|
235
|
+
mermaid: `graph TD
|
|
236
|
+
A[Collect Info] --> B[Verify Identity]
|
|
237
|
+
B --> C{Approve?}
|
|
238
|
+
C -->|Yes| D[Create Account]
|
|
239
|
+
C -->|No| E[Reject]`,
|
|
240
|
+
};
|
|
241
|
+
return { data: mockViz, error: undefined, response: new Response() };
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// MOCK - Simulated simulate
|
|
245
|
+
/**
|
|
246
|
+
* Simulate a flow run (dry run).
|
|
247
|
+
*/
|
|
248
|
+
async simulate(flowId: string, input?: Record<string, unknown>): Promise<APIResponse<FlowSimulationResult>> {
|
|
249
|
+
// MOCK - Returns simulated result
|
|
250
|
+
const mockResult: FlowSimulationResult = {
|
|
251
|
+
success: true,
|
|
252
|
+
steps_executed: ["step_1", "step_2", "step_3", "step_4"],
|
|
253
|
+
estimated_duration_seconds: 120,
|
|
254
|
+
estimated_cost: 0.15,
|
|
255
|
+
potential_issues: [],
|
|
256
|
+
};
|
|
257
|
+
return { data: mockResult, error: undefined, response: new Response() };
|
|
258
|
+
}
|
|
259
|
+
}
|