@agent-os-sdk/client 0.1.0 → 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 +104 -2
  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 +2 -2
  47. package/src/client/AgentOsClient.ts +45 -7
  48. package/src/generated/openapi.ts +104 -2
  49. package/src/generated/swagger.json +116 -10
  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,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
+ }
@@ -0,0 +1,204 @@
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
+
10
+ import type { RawClient, APIResponse } from "../client/raw.js";
11
+
12
+ // ============================================================================
13
+ // Types
14
+ // ============================================================================
15
+
16
+ export type HandoffMode = "same_thread" | "subthread" | "new_thread";
17
+
18
+ export interface HandoffOptions {
19
+ mode: HandoffMode;
20
+ payload?: Record<string, unknown>;
21
+ constraints?: HandoffConstraints;
22
+ inherit_budget?: boolean;
23
+ inherit_policies?: boolean;
24
+ }
25
+
26
+ export interface HandoffConstraints {
27
+ max_tool_calls?: number;
28
+ max_tokens?: number;
29
+ tool_allowlist?: string[];
30
+ tool_denylist?: string[];
31
+ timeout_seconds?: number;
32
+ }
33
+
34
+ export interface HandoffResult {
35
+ run_id: string;
36
+ parent_run_id: string;
37
+ to_agent_id: string;
38
+ mode: HandoffMode;
39
+ thread_id: string;
40
+ status: "pending" | "running" | "completed" | "failed";
41
+ created_at: string;
42
+ }
43
+
44
+ export interface ForkOptions {
45
+ mode?: HandoffMode;
46
+ checkpoint_id?: string;
47
+ copy_messages?: boolean;
48
+ copy_state?: boolean;
49
+ }
50
+
51
+ export interface ForkResult {
52
+ original_thread_id: string;
53
+ forked_thread_id: string;
54
+ checkpoint_id?: string;
55
+ created_at: string;
56
+ }
57
+
58
+ export interface RunChainNode {
59
+ run_id: string;
60
+ agent_id: string;
61
+ agent_name: string;
62
+ status: string;
63
+ parent_run_id?: string;
64
+ children: RunChainNode[];
65
+ depth: number;
66
+ started_at: string;
67
+ completed_at?: string;
68
+ }
69
+
70
+ export interface RunChain {
71
+ root_run_id: string;
72
+ total_runs: number;
73
+ max_depth: number;
74
+ nodes: RunChainNode[];
75
+ }
76
+
77
+ // ============================================================================
78
+ // Module
79
+ // ============================================================================
80
+
81
+ export class HandoffModule {
82
+ constructor(private client: RawClient, private headers: () => Record<string, string>) { }
83
+
84
+ // MOCK - Simulated handoff
85
+ /**
86
+ * Hand off current run to another agent.
87
+ */
88
+ async handoff(
89
+ runId: string,
90
+ toAgentId: string,
91
+ options?: HandoffOptions
92
+ ): Promise<APIResponse<HandoffResult>> {
93
+ // MOCK - Returns simulated data
94
+ const mockResult: HandoffResult = {
95
+ run_id: `run_handoff_${Date.now()}`,
96
+ parent_run_id: runId,
97
+ to_agent_id: toAgentId,
98
+ mode: options?.mode || "subthread",
99
+ thread_id: `thread_${Date.now()}`,
100
+ status: "pending",
101
+ created_at: new Date().toISOString(),
102
+ };
103
+ return { data: mockResult, error: undefined, response: new Response() };
104
+ }
105
+
106
+ // MOCK - Simulated fork
107
+ /**
108
+ * Fork a thread into a new conversation branch.
109
+ */
110
+ async fork(
111
+ threadId: string,
112
+ options?: ForkOptions
113
+ ): Promise<APIResponse<ForkResult>> {
114
+ // MOCK - Returns simulated data
115
+ const mockResult: ForkResult = {
116
+ original_thread_id: threadId,
117
+ forked_thread_id: `thread_fork_${Date.now()}`,
118
+ checkpoint_id: options?.checkpoint_id,
119
+ created_at: new Date().toISOString(),
120
+ };
121
+ return { data: mockResult, error: undefined, response: new Response() };
122
+ }
123
+
124
+ // MOCK - Simulated chain
125
+ /**
126
+ * Get the full run chain (delegation tree).
127
+ */
128
+ async getChain(runId: string): Promise<APIResponse<RunChain>> {
129
+ // MOCK - Returns simulated data
130
+ const mockChain: RunChain = {
131
+ root_run_id: runId,
132
+ total_runs: 3,
133
+ max_depth: 2,
134
+ nodes: [
135
+ {
136
+ run_id: runId,
137
+ agent_id: "agent_1",
138
+ agent_name: "Main Agent",
139
+ status: "completed",
140
+ depth: 0,
141
+ started_at: new Date(Date.now() - 60000).toISOString(),
142
+ completed_at: new Date().toISOString(),
143
+ children: [
144
+ {
145
+ run_id: `${runId}_child_1`,
146
+ agent_id: "agent_2",
147
+ agent_name: "Research Agent",
148
+ status: "completed",
149
+ parent_run_id: runId,
150
+ depth: 1,
151
+ started_at: new Date(Date.now() - 30000).toISOString(),
152
+ completed_at: new Date().toISOString(),
153
+ children: [],
154
+ },
155
+ ],
156
+ },
157
+ ],
158
+ };
159
+ return { data: mockChain, error: undefined, response: new Response() };
160
+ }
161
+
162
+ // MOCK - Simulated parents
163
+ /**
164
+ * Get parent runs in the chain.
165
+ */
166
+ async getParents(runId: string): Promise<APIResponse<RunChainNode[]>> {
167
+ // MOCK - Returns simulated data
168
+ const mockParents: RunChainNode[] = [
169
+ {
170
+ run_id: `parent_${runId}`,
171
+ agent_id: "agent_parent",
172
+ agent_name: "Parent Agent",
173
+ status: "completed",
174
+ depth: 0,
175
+ started_at: new Date(Date.now() - 120000).toISOString(),
176
+ completed_at: new Date(Date.now() - 60000).toISOString(),
177
+ children: [],
178
+ },
179
+ ];
180
+ return { data: mockParents, error: undefined, response: new Response() };
181
+ }
182
+
183
+ // MOCK - Simulated children
184
+ /**
185
+ * Get child runs in the chain.
186
+ */
187
+ async getChildren(runId: string): Promise<APIResponse<RunChainNode[]>> {
188
+ // MOCK - Returns simulated data
189
+ const mockChildren: RunChainNode[] = [
190
+ {
191
+ run_id: `child_1_${runId}`,
192
+ agent_id: "agent_child_1",
193
+ agent_name: "Child Agent 1",
194
+ status: "completed",
195
+ parent_run_id: runId,
196
+ depth: 1,
197
+ started_at: new Date(Date.now() - 30000).toISOString(),
198
+ completed_at: new Date().toISOString(),
199
+ children: [],
200
+ },
201
+ ];
202
+ return { data: mockChildren, error: undefined, response: new Response() };
203
+ }
204
+ }