@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.
Files changed (62) hide show
  1. package/dist/client/AgentOsClient.d.ts +28 -4
  2. package/dist/client/AgentOsClient.d.ts.map +1 -1
  3. package/dist/client/AgentOsClient.js +40 -3
  4. package/dist/generated/openapi.d.ts +93 -0
  5. package/dist/generated/openapi.d.ts.map +1 -1
  6. package/dist/index.d.ts +9 -0
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +10 -0
  9. package/dist/modules/approvals.d.ts +78 -0
  10. package/dist/modules/approvals.d.ts.map +1 -0
  11. package/dist/modules/approvals.js +157 -0
  12. package/dist/modules/artifacts.d.ts +100 -0
  13. package/dist/modules/artifacts.d.ts.map +1 -0
  14. package/dist/modules/artifacts.js +217 -0
  15. package/dist/modules/budgets.d.ts +104 -0
  16. package/dist/modules/budgets.d.ts.map +1 -0
  17. package/dist/modules/budgets.js +161 -0
  18. package/dist/modules/builder.d.ts +2 -2
  19. package/dist/modules/builder.d.ts.map +1 -1
  20. package/dist/modules/builder.js +5 -5
  21. package/dist/modules/capabilities.d.ts +68 -0
  22. package/dist/modules/capabilities.d.ts.map +1 -0
  23. package/dist/modules/capabilities.js +113 -0
  24. package/dist/modules/deployments.d.ts +110 -0
  25. package/dist/modules/deployments.d.ts.map +1 -0
  26. package/dist/modules/deployments.js +230 -0
  27. package/dist/modules/flows.d.ts +104 -0
  28. package/dist/modules/flows.d.ts.map +1 -0
  29. package/dist/modules/flows.js +190 -0
  30. package/dist/modules/handoff.d.ts +88 -0
  31. package/dist/modules/handoff.d.ts.map +1 -0
  32. package/dist/modules/handoff.js +128 -0
  33. package/dist/modules/incidents.d.ts +133 -0
  34. package/dist/modules/incidents.d.ts.map +1 -0
  35. package/dist/modules/incidents.js +231 -0
  36. package/dist/modules/members.d.ts +5 -0
  37. package/dist/modules/members.d.ts.map +1 -1
  38. package/dist/modules/members.js +10 -0
  39. package/dist/modules/policies.d.ts +103 -0
  40. package/dist/modules/policies.d.ts.map +1 -0
  41. package/dist/modules/policies.js +180 -0
  42. package/dist/modules/runs.d.ts.map +1 -1
  43. package/dist/modules/tenants.d.ts +4 -0
  44. package/dist/modules/tenants.d.ts.map +1 -1
  45. package/dist/modules/tenants.js +8 -0
  46. package/package.json +49 -48
  47. package/src/client/AgentOsClient.ts +45 -7
  48. package/src/generated/openapi.ts +93 -0
  49. package/src/generated/swagger.json +107 -0
  50. package/src/index.ts +11 -0
  51. package/src/modules/approvals.ts +210 -0
  52. package/src/modules/artifacts.ts +287 -0
  53. package/src/modules/budgets.ts +236 -0
  54. package/src/modules/builder.ts +3 -3
  55. package/src/modules/capabilities.ts +176 -0
  56. package/src/modules/deployments.ts +315 -0
  57. package/src/modules/flows.ts +259 -0
  58. package/src/modules/handoff.ts +204 -0
  59. package/src/modules/incidents.ts +339 -0
  60. package/src/modules/members.ts +11 -0
  61. package/src/modules/policies.ts +258 -0
  62. package/src/modules/tenants.ts +9 -0
@@ -0,0 +1,230 @@
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
+ // Module
11
+ // ============================================================================
12
+ export class DeploymentsModule {
13
+ client;
14
+ headers;
15
+ constructor(client, headers) {
16
+ this.client = client;
17
+ this.headers = headers;
18
+ }
19
+ // ========== Environments ==========
20
+ // MOCK - Simulated listEnvironments
21
+ /**
22
+ * List all environments.
23
+ */
24
+ async listEnvironments() {
25
+ // MOCK - Returns simulated data
26
+ const mockEnvs = {
27
+ items: [
28
+ {
29
+ id: "env_dev",
30
+ name: "Development",
31
+ type: "development",
32
+ description: "Development environment for testing",
33
+ is_frozen: false,
34
+ config: { logging_level: "debug" },
35
+ created_at: new Date(Date.now() - 86400000 * 30).toISOString(),
36
+ updated_at: new Date().toISOString(),
37
+ },
38
+ {
39
+ id: "env_staging",
40
+ name: "Staging",
41
+ type: "staging",
42
+ description: "Pre-production testing",
43
+ is_frozen: false,
44
+ config: { logging_level: "info" },
45
+ created_at: new Date(Date.now() - 86400000 * 30).toISOString(),
46
+ updated_at: new Date().toISOString(),
47
+ },
48
+ {
49
+ id: "env_prod",
50
+ name: "Production",
51
+ type: "production",
52
+ description: "Live production environment",
53
+ is_frozen: false,
54
+ config: { logging_level: "warning" },
55
+ created_at: new Date(Date.now() - 86400000 * 30).toISOString(),
56
+ updated_at: new Date().toISOString(),
57
+ },
58
+ ],
59
+ total: 3,
60
+ };
61
+ return { data: mockEnvs, error: undefined, response: new Response() };
62
+ }
63
+ // MOCK - Simulated createEnvironment
64
+ /**
65
+ * Create a new environment.
66
+ */
67
+ async createEnvironment(body) {
68
+ // MOCK - Returns simulated data
69
+ const mockEnv = {
70
+ id: `env_${Date.now()}`,
71
+ name: body.name,
72
+ type: body.type,
73
+ description: body.description,
74
+ is_frozen: false,
75
+ config: body.config || {},
76
+ created_at: new Date().toISOString(),
77
+ updated_at: new Date().toISOString(),
78
+ };
79
+ return { data: mockEnv, error: undefined, response: new Response() };
80
+ }
81
+ // ========== Deployments ==========
82
+ // MOCK - Simulated history
83
+ /**
84
+ * Get deployment history for an environment.
85
+ */
86
+ async history(environmentId) {
87
+ // MOCK - Returns simulated data
88
+ const mockHistory = {
89
+ items: [
90
+ {
91
+ id: "deploy_3",
92
+ agent_id: "agent_support",
93
+ agent_version_id: "v3",
94
+ environment_id: environmentId,
95
+ environment_name: "Production",
96
+ status: "active",
97
+ promoted_by: "user_admin",
98
+ promoted_at: new Date(Date.now() - 3600000).toISOString(),
99
+ completed_at: new Date(Date.now() - 3500000).toISOString(),
100
+ },
101
+ {
102
+ id: "deploy_2",
103
+ agent_id: "agent_support",
104
+ agent_version_id: "v2",
105
+ environment_id: environmentId,
106
+ environment_name: "Production",
107
+ status: "rolled_back",
108
+ promoted_by: "user_admin",
109
+ promoted_at: new Date(Date.now() - 86400000).toISOString(),
110
+ completed_at: new Date(Date.now() - 86000000).toISOString(),
111
+ rollback_version_id: "v1",
112
+ },
113
+ ],
114
+ total: 2,
115
+ };
116
+ return { data: mockHistory, error: undefined, response: new Response() };
117
+ }
118
+ // MOCK - Simulated promote
119
+ /**
120
+ * Promote an agent version to an environment.
121
+ */
122
+ async promote(agentVersionId, environmentId, options) {
123
+ // MOCK - Returns simulated data
124
+ const mockDeploy = {
125
+ id: `deploy_${Date.now()}`,
126
+ agent_id: "agent_123",
127
+ agent_version_id: agentVersionId,
128
+ environment_id: environmentId,
129
+ environment_name: "Production",
130
+ status: "deploying",
131
+ promoted_by: "user_current",
132
+ promoted_at: new Date().toISOString(),
133
+ notes: options?.notes,
134
+ };
135
+ return { data: mockDeploy, error: undefined, response: new Response() };
136
+ }
137
+ // MOCK - Simulated rollback
138
+ /**
139
+ * Rollback an environment to a previous version.
140
+ */
141
+ async rollback(environmentId, toVersionId) {
142
+ // MOCK - Returns simulated data
143
+ const mockDeploy = {
144
+ id: `deploy_rollback_${Date.now()}`,
145
+ agent_id: "agent_123",
146
+ agent_version_id: toVersionId || "v2",
147
+ environment_id: environmentId,
148
+ environment_name: "Production",
149
+ status: "rolling_back",
150
+ promoted_by: "user_current",
151
+ promoted_at: new Date().toISOString(),
152
+ rollback_version_id: "v3",
153
+ };
154
+ return { data: mockDeploy, error: undefined, response: new Response() };
155
+ }
156
+ // MOCK - Simulated canary
157
+ /**
158
+ * Start a canary deployment.
159
+ */
160
+ async canary(environmentId, agentVersionId, percent) {
161
+ // MOCK - Returns simulated data
162
+ const mockDeploy = {
163
+ id: `deploy_canary_${Date.now()}`,
164
+ agent_id: "agent_123",
165
+ agent_version_id: agentVersionId,
166
+ environment_id: environmentId,
167
+ environment_name: "Production",
168
+ status: "deploying",
169
+ promoted_by: "user_current",
170
+ promoted_at: new Date().toISOString(),
171
+ canary_percent: percent,
172
+ };
173
+ return { data: mockDeploy, error: undefined, response: new Response() };
174
+ }
175
+ // MOCK - Simulated freeze
176
+ /**
177
+ * Freeze an environment (change freeze).
178
+ */
179
+ async freeze(environmentId, options) {
180
+ // MOCK - Returns simulated data
181
+ const mockEnv = {
182
+ id: environmentId,
183
+ name: "Production",
184
+ type: "production",
185
+ is_frozen: true,
186
+ frozen_until: options?.until,
187
+ frozen_reason: options?.reason || "Change freeze in effect",
188
+ config: {},
189
+ created_at: new Date(Date.now() - 86400000 * 30).toISOString(),
190
+ updated_at: new Date().toISOString(),
191
+ };
192
+ return { data: mockEnv, error: undefined, response: new Response() };
193
+ }
194
+ // MOCK - Simulated unfreeze
195
+ /**
196
+ * Unfreeze an environment.
197
+ */
198
+ async unfreeze(environmentId) {
199
+ // MOCK - Returns simulated data
200
+ const mockEnv = {
201
+ id: environmentId,
202
+ name: "Production",
203
+ type: "production",
204
+ is_frozen: false,
205
+ config: {},
206
+ created_at: new Date(Date.now() - 86400000 * 30).toISOString(),
207
+ updated_at: new Date().toISOString(),
208
+ };
209
+ return { data: mockEnv, error: undefined, response: new Response() };
210
+ }
211
+ // MOCK - Simulated diff
212
+ /**
213
+ * Get diff between two versions.
214
+ */
215
+ async diff(fromVersionId, toVersionId) {
216
+ // MOCK - Returns simulated diff
217
+ const mockDiff = {
218
+ from_version: fromVersionId,
219
+ to_version: toVersionId,
220
+ changes: [
221
+ { category: "config", field: "max_tokens", old_value: 4000, new_value: 8000 },
222
+ { category: "prompt", field: "system_prompt", old_value: "You are a helpful assistant", new_value: "You are an expert assistant" },
223
+ ],
224
+ config_changes: 1,
225
+ prompt_changes: 1,
226
+ graph_changes: 0,
227
+ };
228
+ return { data: mockDiff, error: undefined, response: new Response() };
229
+ }
230
+ }
@@ -0,0 +1,104 @@
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
+ import type { RawClient, APIResponse } from "../client/raw.js";
10
+ export type FlowStatus = "draft" | "active" | "paused" | "completed" | "failed" | "cancelled";
11
+ export interface FlowStep {
12
+ id: string;
13
+ name: string;
14
+ agent_id: string;
15
+ type: "agent" | "condition" | "parallel" | "wait" | "human_approval";
16
+ config?: Record<string, unknown>;
17
+ next_steps?: string[];
18
+ on_error?: string;
19
+ }
20
+ export interface Flow {
21
+ id: string;
22
+ name: string;
23
+ description?: string;
24
+ steps: FlowStep[];
25
+ status: FlowStatus;
26
+ version: number;
27
+ created_at: string;
28
+ updated_at: string;
29
+ }
30
+ export interface FlowRun {
31
+ id: string;
32
+ flow_id: string;
33
+ status: FlowStatus;
34
+ current_step_id?: string;
35
+ completed_steps: string[];
36
+ failed_steps: string[];
37
+ context: Record<string, unknown>;
38
+ started_at: string;
39
+ completed_at?: string;
40
+ }
41
+ export interface FlowVisualization {
42
+ mermaid: string;
43
+ svg?: string;
44
+ }
45
+ export interface FlowSimulationResult {
46
+ success: boolean;
47
+ steps_executed: string[];
48
+ estimated_duration_seconds: number;
49
+ estimated_cost: number;
50
+ potential_issues: string[];
51
+ }
52
+ export interface FlowListResponse {
53
+ items: Flow[];
54
+ total: number;
55
+ }
56
+ export declare class FlowsModule {
57
+ private client;
58
+ private headers;
59
+ constructor(client: RawClient, headers: () => Record<string, string>);
60
+ /**
61
+ * List all flows.
62
+ */
63
+ list(params?: {
64
+ limit?: number;
65
+ offset?: number;
66
+ }): Promise<APIResponse<FlowListResponse>>;
67
+ /**
68
+ * Get a flow by ID.
69
+ */
70
+ get(flowId: string): Promise<APIResponse<Flow>>;
71
+ /**
72
+ * Create a new flow.
73
+ */
74
+ create(body: {
75
+ name: string;
76
+ description?: string;
77
+ steps: FlowStep[];
78
+ }): Promise<APIResponse<Flow>>;
79
+ /**
80
+ * Start a flow run.
81
+ */
82
+ run(flowId: string, input?: Record<string, unknown>): Promise<APIResponse<FlowRun>>;
83
+ /**
84
+ * Pause a running flow.
85
+ */
86
+ pause(flowRunId: string): Promise<APIResponse<FlowRun>>;
87
+ /**
88
+ * Resume a paused flow.
89
+ */
90
+ resume(flowRunId: string): Promise<APIResponse<FlowRun>>;
91
+ /**
92
+ * Cancel a flow run.
93
+ */
94
+ cancel(flowRunId: string): Promise<APIResponse<FlowRun>>;
95
+ /**
96
+ * Get flow visualization (Mermaid diagram).
97
+ */
98
+ visualize(flowId: string): Promise<APIResponse<FlowVisualization>>;
99
+ /**
100
+ * Simulate a flow run (dry run).
101
+ */
102
+ simulate(flowId: string, input?: Record<string, unknown>): Promise<APIResponse<FlowSimulationResult>>;
103
+ }
104
+ //# sourceMappingURL=flows.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flows.d.ts","sourceRoot":"","sources":["../../src/modules/flows.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAM/D,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;AAE9F,MAAM,WAAW,QAAQ;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,GAAG,gBAAgB,CAAC;IACrE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,IAAI;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB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C,CAAC;IAqBrD;;OAEG;IACG,MAAM,CAAC,IAAI,EAAE;QACf,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,KAAK,EAAE,QAAQ,EAAE,CAAC;KACrB,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAgB9B;;OAEG;IACG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAgBzF;;OAEG;IACG,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAgB7D;;OAEG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAgB9D;;OAEG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAiB9D;;OAEG;IACG,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAaxE;;OAEG;IACG,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC;CAW9G"}
@@ -0,0 +1,190 @@
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
+ // Module
11
+ // ============================================================================
12
+ export class FlowsModule {
13
+ client;
14
+ headers;
15
+ constructor(client, headers) {
16
+ this.client = client;
17
+ this.headers = headers;
18
+ }
19
+ // MOCK - Simulated list
20
+ /**
21
+ * List all flows.
22
+ */
23
+ async list(params) {
24
+ // MOCK - Returns simulated data
25
+ const mockFlows = {
26
+ items: [
27
+ {
28
+ id: "flow_1",
29
+ name: "Customer Onboarding",
30
+ description: "Multi-step customer onboarding workflow",
31
+ steps: [
32
+ { id: "step_1", name: "Collect Info", agent_id: "agent_intake", type: "agent", next_steps: ["step_2"] },
33
+ { id: "step_2", name: "Verify Identity", agent_id: "agent_kyc", type: "agent", next_steps: ["step_3"] },
34
+ { id: "step_3", name: "Create Account", agent_id: "agent_account", type: "agent" },
35
+ ],
36
+ status: "active",
37
+ version: 1,
38
+ created_at: new Date(Date.now() - 86400000).toISOString(),
39
+ updated_at: new Date().toISOString(),
40
+ },
41
+ ],
42
+ total: 1,
43
+ };
44
+ return { data: mockFlows, error: undefined, response: new Response() };
45
+ }
46
+ // MOCK - Simulated get
47
+ /**
48
+ * Get a flow by ID.
49
+ */
50
+ async get(flowId) {
51
+ // MOCK - Returns simulated data
52
+ const mockFlow = {
53
+ id: flowId,
54
+ name: "Customer Onboarding",
55
+ description: "Multi-step customer onboarding workflow",
56
+ steps: [
57
+ { id: "step_1", name: "Collect Info", agent_id: "agent_intake", type: "agent", next_steps: ["step_2"] },
58
+ { id: "step_2", name: "Verify Identity", agent_id: "agent_kyc", type: "agent", next_steps: ["step_3"] },
59
+ { id: "step_3", name: "Approve", agent_id: "", type: "human_approval", next_steps: ["step_4"] },
60
+ { id: "step_4", name: "Create Account", agent_id: "agent_account", type: "agent" },
61
+ ],
62
+ status: "active",
63
+ version: 1,
64
+ created_at: new Date(Date.now() - 86400000).toISOString(),
65
+ updated_at: new Date().toISOString(),
66
+ };
67
+ return { data: mockFlow, error: undefined, response: new Response() };
68
+ }
69
+ // MOCK - Simulated create
70
+ /**
71
+ * Create a new flow.
72
+ */
73
+ async create(body) {
74
+ // MOCK - Returns simulated data
75
+ const mockFlow = {
76
+ id: `flow_${Date.now()}`,
77
+ name: body.name,
78
+ description: body.description,
79
+ steps: body.steps,
80
+ status: "draft",
81
+ version: 1,
82
+ created_at: new Date().toISOString(),
83
+ updated_at: new Date().toISOString(),
84
+ };
85
+ return { data: mockFlow, error: undefined, response: new Response() };
86
+ }
87
+ // MOCK - Simulated run
88
+ /**
89
+ * Start a flow run.
90
+ */
91
+ async run(flowId, input) {
92
+ // MOCK - Returns simulated data
93
+ const mockRun = {
94
+ id: `flowrun_${Date.now()}`,
95
+ flow_id: flowId,
96
+ status: "active",
97
+ current_step_id: "step_1",
98
+ completed_steps: [],
99
+ failed_steps: [],
100
+ context: input || {},
101
+ started_at: new Date().toISOString(),
102
+ };
103
+ return { data: mockRun, error: undefined, response: new Response() };
104
+ }
105
+ // MOCK - Simulated pause
106
+ /**
107
+ * Pause a running flow.
108
+ */
109
+ async pause(flowRunId) {
110
+ // MOCK - Returns simulated data
111
+ const mockRun = {
112
+ id: flowRunId,
113
+ flow_id: "flow_1",
114
+ status: "paused",
115
+ current_step_id: "step_2",
116
+ completed_steps: ["step_1"],
117
+ failed_steps: [],
118
+ context: {},
119
+ started_at: new Date(Date.now() - 30000).toISOString(),
120
+ };
121
+ return { data: mockRun, error: undefined, response: new Response() };
122
+ }
123
+ // MOCK - Simulated resume
124
+ /**
125
+ * Resume a paused flow.
126
+ */
127
+ async resume(flowRunId) {
128
+ // MOCK - Returns simulated data
129
+ const mockRun = {
130
+ id: flowRunId,
131
+ flow_id: "flow_1",
132
+ status: "active",
133
+ current_step_id: "step_2",
134
+ completed_steps: ["step_1"],
135
+ failed_steps: [],
136
+ context: {},
137
+ started_at: new Date(Date.now() - 30000).toISOString(),
138
+ };
139
+ return { data: mockRun, error: undefined, response: new Response() };
140
+ }
141
+ // MOCK - Simulated cancel
142
+ /**
143
+ * Cancel a flow run.
144
+ */
145
+ async cancel(flowRunId) {
146
+ // MOCK - Returns simulated data
147
+ const mockRun = {
148
+ id: flowRunId,
149
+ flow_id: "flow_1",
150
+ status: "cancelled",
151
+ current_step_id: "step_2",
152
+ completed_steps: ["step_1"],
153
+ failed_steps: [],
154
+ context: {},
155
+ started_at: new Date(Date.now() - 30000).toISOString(),
156
+ completed_at: new Date().toISOString(),
157
+ };
158
+ return { data: mockRun, error: undefined, response: new Response() };
159
+ }
160
+ // MOCK - Simulated visualize
161
+ /**
162
+ * Get flow visualization (Mermaid diagram).
163
+ */
164
+ async visualize(flowId) {
165
+ // MOCK - Returns simulated mermaid
166
+ const mockViz = {
167
+ mermaid: `graph TD
168
+ A[Collect Info] --> B[Verify Identity]
169
+ B --> C{Approve?}
170
+ C -->|Yes| D[Create Account]
171
+ C -->|No| E[Reject]`,
172
+ };
173
+ return { data: mockViz, error: undefined, response: new Response() };
174
+ }
175
+ // MOCK - Simulated simulate
176
+ /**
177
+ * Simulate a flow run (dry run).
178
+ */
179
+ async simulate(flowId, input) {
180
+ // MOCK - Returns simulated result
181
+ const mockResult = {
182
+ success: true,
183
+ steps_executed: ["step_1", "step_2", "step_3", "step_4"],
184
+ estimated_duration_seconds: 120,
185
+ estimated_cost: 0.15,
186
+ potential_issues: [],
187
+ };
188
+ return { data: mockResult, error: undefined, response: new Response() };
189
+ }
190
+ }
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Handoff Module - Multi-Agent Delegation
3
+ *
4
+ * // MOCK - This module contains mock implementations for future features
5
+ *
6
+ * Provides first-class support for agent handoffs, delegation,
7
+ * thread forking, and run chain management.
8
+ */
9
+ import type { RawClient, APIResponse } from "../client/raw.js";
10
+ export type HandoffMode = "same_thread" | "subthread" | "new_thread";
11
+ export interface HandoffOptions {
12
+ mode: HandoffMode;
13
+ payload?: Record<string, unknown>;
14
+ constraints?: HandoffConstraints;
15
+ inherit_budget?: boolean;
16
+ inherit_policies?: boolean;
17
+ }
18
+ export interface HandoffConstraints {
19
+ max_tool_calls?: number;
20
+ max_tokens?: number;
21
+ tool_allowlist?: string[];
22
+ tool_denylist?: string[];
23
+ timeout_seconds?: number;
24
+ }
25
+ export interface HandoffResult {
26
+ run_id: string;
27
+ parent_run_id: string;
28
+ to_agent_id: string;
29
+ mode: HandoffMode;
30
+ thread_id: string;
31
+ status: "pending" | "running" | "completed" | "failed";
32
+ created_at: string;
33
+ }
34
+ export interface ForkOptions {
35
+ mode?: HandoffMode;
36
+ checkpoint_id?: string;
37
+ copy_messages?: boolean;
38
+ copy_state?: boolean;
39
+ }
40
+ export interface ForkResult {
41
+ original_thread_id: string;
42
+ forked_thread_id: string;
43
+ checkpoint_id?: string;
44
+ created_at: string;
45
+ }
46
+ export interface RunChainNode {
47
+ run_id: string;
48
+ agent_id: string;
49
+ agent_name: string;
50
+ status: string;
51
+ parent_run_id?: string;
52
+ children: RunChainNode[];
53
+ depth: number;
54
+ started_at: string;
55
+ completed_at?: string;
56
+ }
57
+ export interface RunChain {
58
+ root_run_id: string;
59
+ total_runs: number;
60
+ max_depth: number;
61
+ nodes: RunChainNode[];
62
+ }
63
+ export declare class HandoffModule {
64
+ private client;
65
+ private headers;
66
+ constructor(client: RawClient, headers: () => Record<string, string>);
67
+ /**
68
+ * Hand off current run to another agent.
69
+ */
70
+ handoff(runId: string, toAgentId: string, options?: HandoffOptions): Promise<APIResponse<HandoffResult>>;
71
+ /**
72
+ * Fork a thread into a new conversation branch.
73
+ */
74
+ fork(threadId: string, options?: ForkOptions): Promise<APIResponse<ForkResult>>;
75
+ /**
76
+ * Get the full run chain (delegation tree).
77
+ */
78
+ getChain(runId: string): Promise<APIResponse<RunChain>>;
79
+ /**
80
+ * Get parent runs in the chain.
81
+ */
82
+ getParents(runId: string): Promise<APIResponse<RunChainNode[]>>;
83
+ /**
84
+ * Get child runs in the chain.
85
+ */
86
+ getChildren(runId: string): Promise<APIResponse<RunChainNode[]>>;
87
+ }
88
+ //# sourceMappingURL=handoff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handoff.d.ts","sourceRoot":"","sources":["../../src/modules/handoff.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAA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