@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
package/src/index.ts CHANGED
@@ -105,6 +105,17 @@ export { InfoModule, type ServerInfo } from "./modules/info.js";
105
105
  export { MetricsModule, type MetricsResponse } from "./modules/metrics.js";
106
106
  export { GraphsModule, type GraphValidationResult, type GraphIntrospectionResult } from "./modules/graphs.js";
107
107
 
108
+ // MOCK - Future modules (marked for replacement when backend is ready)
109
+ export { HandoffModule, type HandoffOptions, type HandoffResult, type ForkOptions, type ForkResult, type RunChain, type RunChainNode, type HandoffMode, type HandoffConstraints } from "./modules/handoff.js";
110
+ export { FlowsModule, type Flow, type FlowStep, type FlowRun, type FlowVisualization, type FlowSimulationResult, type FlowStatus, type FlowListResponse } from "./modules/flows.js";
111
+ export { CapabilitiesModule, type Capability, type CapabilityConfig, type CapabilitySet, type CapabilityOverride } from "./modules/capabilities.js";
112
+ export { PoliciesModule, type Policy, type PolicyType, type PolicyScope, type PolicyCondition, type PolicyAction, type PolicyEvaluationInput, type PolicyEvaluationResult, type PolicyListResponse } from "./modules/policies.js";
113
+ export { ApprovalsModule, type Approval, type ApprovalStatus, type ApprovalRequest, type ApprovalListResponse } from "./modules/approvals.js";
114
+ export { BudgetsModule, type Budget, type BudgetPeriod, type BudgetScope, type BudgetUsage, type BudgetBreakdown, type CostEstimate, type BudgetListResponse } from "./modules/budgets.js";
115
+ export { DeploymentsModule, type Environment, type EnvironmentType, type Deployment, type DeploymentStatus, type DeploymentDiff, type EnvironmentListResponse, type DeploymentListResponse } from "./modules/deployments.js";
116
+ export { IncidentsModule, type Incident, type IncidentSeverity, type IncidentStatus, type SLO, type Postmortem, type PostmortemEvent, type ActionItem, type IncidentListResponse, type SLOListResponse } from "./modules/incidents.js";
117
+ export { ArtifactsModule, type Artifact, type ArtifactType, type ArtifactLineage, type LineageSource, type LineageTransformation, type ArtifactListResponse } from "./modules/artifacts.js";
118
+
108
119
  // ============================================================================
109
120
  // SSE Streaming
110
121
  // ============================================================================
@@ -0,0 +1,210 @@
1
+ /**
2
+ * Approvals Module - Human-in-the-Loop Native
3
+ *
4
+ * // MOCK - This module contains mock implementations for future features
5
+ *
6
+ * Provides native support for approval workflows.
7
+ * Critical for production deployments with dangerous actions.
8
+ */
9
+
10
+ import type { RawClient, APIResponse } from "../client/raw.js";
11
+
12
+ // ============================================================================
13
+ // Types
14
+ // ============================================================================
15
+
16
+ export type ApprovalStatus = "pending" | "approved" | "rejected" | "expired" | "auto_approved";
17
+
18
+ export interface Approval {
19
+ id: string;
20
+ run_id: string;
21
+ thread_id?: string;
22
+ action: string;
23
+ payload: Record<string, unknown>;
24
+ status: ApprovalStatus;
25
+ reason?: string;
26
+ requested_at: string;
27
+ responded_at?: string;
28
+ responded_by?: string;
29
+ expires_at?: string;
30
+ auto_approve_after?: number; // seconds
31
+ }
32
+
33
+ export interface ApprovalRequest {
34
+ run_id: string;
35
+ action: string;
36
+ payload: Record<string, unknown>;
37
+ expires_in_seconds?: number;
38
+ auto_approve_after_seconds?: number;
39
+ notify_channels?: string[];
40
+ }
41
+
42
+ export interface ApprovalListResponse {
43
+ items: Approval[];
44
+ total: number;
45
+ pending_count: number;
46
+ }
47
+
48
+ export interface ApprovalDecision {
49
+ approval_id: string;
50
+ decision: "approve" | "reject";
51
+ reason?: string;
52
+ modified_payload?: Record<string, unknown>;
53
+ }
54
+
55
+ // ============================================================================
56
+ // Module
57
+ // ============================================================================
58
+
59
+ export class ApprovalsModule {
60
+ constructor(private client: RawClient, private headers: () => Record<string, string>) { }
61
+
62
+ // MOCK - Simulated list
63
+ /**
64
+ * List all approvals.
65
+ */
66
+ async list(params?: {
67
+ status?: ApprovalStatus;
68
+ run_id?: string;
69
+ limit?: number;
70
+ offset?: number;
71
+ }): Promise<APIResponse<ApprovalListResponse>> {
72
+ // MOCK - Returns simulated data
73
+ const mockApprovals: ApprovalListResponse = {
74
+ items: [
75
+ {
76
+ id: "approval_1",
77
+ run_id: "run_123",
78
+ thread_id: "thread_456",
79
+ action: "send_email",
80
+ payload: {
81
+ to: "external@gmail.com",
82
+ subject: "Important Update",
83
+ body: "Hello, this is an important message...",
84
+ },
85
+ status: "pending",
86
+ requested_at: new Date(Date.now() - 300000).toISOString(),
87
+ expires_at: new Date(Date.now() + 3600000).toISOString(),
88
+ },
89
+ {
90
+ id: "approval_2",
91
+ run_id: "run_124",
92
+ action: "execute_payment",
93
+ payload: {
94
+ amount: 1500.00,
95
+ currency: "USD",
96
+ recipient: "vendor@company.com",
97
+ },
98
+ status: "pending",
99
+ requested_at: new Date(Date.now() - 600000).toISOString(),
100
+ expires_at: new Date(Date.now() + 7200000).toISOString(),
101
+ },
102
+ ],
103
+ total: 2,
104
+ pending_count: 2,
105
+ };
106
+ return { data: mockApprovals, error: undefined, response: new Response() };
107
+ }
108
+
109
+ // MOCK - Simulated get
110
+ /**
111
+ * Get an approval by ID.
112
+ */
113
+ async get(approvalId: string): Promise<APIResponse<Approval>> {
114
+ // MOCK - Returns simulated data
115
+ const mockApproval: Approval = {
116
+ id: approvalId,
117
+ run_id: "run_123",
118
+ action: "send_email",
119
+ payload: {
120
+ to: "external@gmail.com",
121
+ subject: "Important Update",
122
+ },
123
+ status: "pending",
124
+ requested_at: new Date(Date.now() - 300000).toISOString(),
125
+ expires_at: new Date(Date.now() + 3600000).toISOString(),
126
+ };
127
+ return { data: mockApproval, error: undefined, response: new Response() };
128
+ }
129
+
130
+ // MOCK - Simulated create
131
+ /**
132
+ * Create a new approval request.
133
+ */
134
+ async create(request: ApprovalRequest): Promise<APIResponse<Approval>> {
135
+ // MOCK - Returns simulated data
136
+ const mockApproval: Approval = {
137
+ id: `approval_${Date.now()}`,
138
+ run_id: request.run_id,
139
+ action: request.action,
140
+ payload: request.payload,
141
+ status: "pending",
142
+ requested_at: new Date().toISOString(),
143
+ expires_at: request.expires_in_seconds
144
+ ? new Date(Date.now() + request.expires_in_seconds * 1000).toISOString()
145
+ : undefined,
146
+ auto_approve_after: request.auto_approve_after_seconds,
147
+ };
148
+ return { data: mockApproval, error: undefined, response: new Response() };
149
+ }
150
+
151
+ // MOCK - Simulated approve
152
+ /**
153
+ * Approve an action.
154
+ */
155
+ async approve(approvalId: string, reason?: string): Promise<APIResponse<Approval>> {
156
+ // MOCK - Returns simulated data
157
+ const mockApproval: Approval = {
158
+ id: approvalId,
159
+ run_id: "run_123",
160
+ action: "send_email",
161
+ payload: {},
162
+ status: "approved",
163
+ reason,
164
+ requested_at: new Date(Date.now() - 300000).toISOString(),
165
+ responded_at: new Date().toISOString(),
166
+ responded_by: "user_admin",
167
+ };
168
+ return { data: mockApproval, error: undefined, response: new Response() };
169
+ }
170
+
171
+ // MOCK - Simulated reject
172
+ /**
173
+ * Reject an action.
174
+ */
175
+ async reject(approvalId: string, reason?: string): Promise<APIResponse<Approval>> {
176
+ // MOCK - Returns simulated data
177
+ const mockApproval: Approval = {
178
+ id: approvalId,
179
+ run_id: "run_123",
180
+ action: "send_email",
181
+ payload: {},
182
+ status: "rejected",
183
+ reason: reason || "Action not permitted",
184
+ requested_at: new Date(Date.now() - 300000).toISOString(),
185
+ responded_at: new Date().toISOString(),
186
+ responded_by: "user_admin",
187
+ };
188
+ return { data: mockApproval, error: undefined, response: new Response() };
189
+ }
190
+
191
+ // MOCK - Simulated await
192
+ /**
193
+ * Wait for approval on a run (blocks until resolved or timeout).
194
+ */
195
+ async awaitApproval(runId: string, timeoutSeconds?: number): Promise<APIResponse<Approval>> {
196
+ // MOCK - Returns simulated pending approval
197
+ const mockApproval: Approval = {
198
+ id: `approval_await_${runId}`,
199
+ run_id: runId,
200
+ action: "awaiting_action",
201
+ payload: {},
202
+ status: "pending",
203
+ requested_at: new Date().toISOString(),
204
+ expires_at: timeoutSeconds
205
+ ? new Date(Date.now() + timeoutSeconds * 1000).toISOString()
206
+ : undefined,
207
+ };
208
+ return { data: mockApproval, error: undefined, response: new Response() };
209
+ }
210
+ }
@@ -0,0 +1,287 @@
1
+ /**
2
+ * Artifacts Module - Output Management
3
+ *
4
+ * // MOCK - This module contains mock implementations for future features
5
+ *
6
+ * Manages artifacts as first-class outputs with integrity,
7
+ * lineage tracking, and signatures.
8
+ */
9
+
10
+ import type { RawClient, APIResponse } from "../client/raw.js";
11
+
12
+ // ============================================================================
13
+ // Types
14
+ // ============================================================================
15
+
16
+ export type ArtifactType = "file" | "image" | "document" | "code" | "data" | "other";
17
+
18
+ export interface Artifact {
19
+ id: string;
20
+ name: string;
21
+ type: ArtifactType;
22
+ mime_type: string;
23
+ size_bytes: number;
24
+ sha256: string;
25
+ url?: string;
26
+ run_id?: string;
27
+ thread_id?: string;
28
+ metadata: Record<string, unknown>;
29
+ signed: boolean;
30
+ signature?: string;
31
+ created_at: string;
32
+ created_by: string;
33
+ }
34
+
35
+ export interface ArtifactLineage {
36
+ artifact_id: string;
37
+ source: LineageSource;
38
+ transformations: LineageTransformation[];
39
+ dependencies: string[];
40
+ }
41
+
42
+ export interface LineageSource {
43
+ type: "run" | "upload" | "tool" | "agent";
44
+ id: string;
45
+ name: string;
46
+ timestamp: string;
47
+ }
48
+
49
+ export interface LineageTransformation {
50
+ step: number;
51
+ operation: string;
52
+ run_id?: string;
53
+ tool_name?: string;
54
+ timestamp: string;
55
+ }
56
+
57
+ export interface ArtifactListResponse {
58
+ items: Artifact[];
59
+ total: number;
60
+ }
61
+
62
+ // ============================================================================
63
+ // Module
64
+ // ============================================================================
65
+
66
+ export class ArtifactsModule {
67
+ constructor(private client: RawClient, private headers: () => Record<string, string>) { }
68
+
69
+ // MOCK - Simulated list
70
+ /**
71
+ * List all artifacts.
72
+ */
73
+ async list(params?: {
74
+ run_id?: string;
75
+ thread_id?: string;
76
+ type?: ArtifactType;
77
+ }): Promise<APIResponse<ArtifactListResponse>> {
78
+ // MOCK - Returns simulated data
79
+ const mockArtifacts: ArtifactListResponse = {
80
+ items: [
81
+ {
82
+ id: "artifact_1",
83
+ name: "report.pdf",
84
+ type: "document",
85
+ mime_type: "application/pdf",
86
+ size_bytes: 245000,
87
+ sha256: "abc123def456...",
88
+ url: "https://storage.example.com/artifacts/report.pdf",
89
+ run_id: "run_123",
90
+ thread_id: "thread_456",
91
+ metadata: { pages: 12, author: "Agent Support" },
92
+ signed: true,
93
+ signature: "sig_abc123",
94
+ created_at: new Date(Date.now() - 3600000).toISOString(),
95
+ created_by: "agent_support",
96
+ },
97
+ {
98
+ id: "artifact_2",
99
+ name: "analysis.json",
100
+ type: "data",
101
+ mime_type: "application/json",
102
+ size_bytes: 15000,
103
+ sha256: "xyz789ghi012...",
104
+ url: "https://storage.example.com/artifacts/analysis.json",
105
+ run_id: "run_124",
106
+ metadata: { records: 500 },
107
+ signed: false,
108
+ created_at: new Date(Date.now() - 7200000).toISOString(),
109
+ created_by: "agent_analyzer",
110
+ },
111
+ ],
112
+ total: 2,
113
+ };
114
+ return { data: mockArtifacts, error: undefined, response: new Response() };
115
+ }
116
+
117
+ // MOCK - Simulated get
118
+ /**
119
+ * Get an artifact by ID.
120
+ */
121
+ async get(artifactId: string): Promise<APIResponse<Artifact>> {
122
+ // MOCK - Returns simulated data
123
+ const mockArtifact: Artifact = {
124
+ id: artifactId,
125
+ name: "report.pdf",
126
+ type: "document",
127
+ mime_type: "application/pdf",
128
+ size_bytes: 245000,
129
+ sha256: "abc123def456...",
130
+ url: "https://storage.example.com/artifacts/report.pdf",
131
+ run_id: "run_123",
132
+ metadata: { pages: 12 },
133
+ signed: true,
134
+ signature: "sig_abc123",
135
+ created_at: new Date(Date.now() - 3600000).toISOString(),
136
+ created_by: "agent_support",
137
+ };
138
+ return { data: mockArtifact, error: undefined, response: new Response() };
139
+ }
140
+
141
+ // MOCK - Simulated create
142
+ /**
143
+ * Create a new artifact reference.
144
+ */
145
+ async create(body: {
146
+ name: string;
147
+ type: ArtifactType;
148
+ mime_type: string;
149
+ size_bytes: number;
150
+ sha256: string;
151
+ run_id?: string;
152
+ thread_id?: string;
153
+ metadata?: Record<string, unknown>;
154
+ }): Promise<APIResponse<Artifact>> {
155
+ // MOCK - Returns simulated data
156
+ const mockArtifact: Artifact = {
157
+ id: `artifact_${Date.now()}`,
158
+ name: body.name,
159
+ type: body.type,
160
+ mime_type: body.mime_type,
161
+ size_bytes: body.size_bytes,
162
+ sha256: body.sha256,
163
+ run_id: body.run_id,
164
+ thread_id: body.thread_id,
165
+ metadata: body.metadata || {},
166
+ signed: false,
167
+ created_at: new Date().toISOString(),
168
+ created_by: "user_current",
169
+ };
170
+ return { data: mockArtifact, error: undefined, response: new Response() };
171
+ }
172
+
173
+ // MOCK - Simulated delete
174
+ /**
175
+ * Delete an artifact.
176
+ */
177
+ async delete(artifactId: string): Promise<APIResponse<void>> {
178
+ // MOCK - Returns success
179
+ return { data: undefined, error: undefined, response: new Response() };
180
+ }
181
+
182
+ // MOCK - Simulated sign
183
+ /**
184
+ * Sign an artifact for integrity verification.
185
+ */
186
+ async sign(artifactId: string): Promise<APIResponse<Artifact>> {
187
+ // MOCK - Returns simulated signed artifact
188
+ const mockArtifact: Artifact = {
189
+ id: artifactId,
190
+ name: "report.pdf",
191
+ type: "document",
192
+ mime_type: "application/pdf",
193
+ size_bytes: 245000,
194
+ sha256: "abc123def456...",
195
+ metadata: {},
196
+ signed: true,
197
+ signature: `sig_${Date.now()}`,
198
+ created_at: new Date(Date.now() - 3600000).toISOString(),
199
+ created_by: "agent_support",
200
+ };
201
+ return { data: mockArtifact, error: undefined, response: new Response() };
202
+ }
203
+
204
+ // MOCK - Simulated lineage
205
+ /**
206
+ * Get artifact lineage (provenance tracking).
207
+ */
208
+ async lineage(artifactId: string): Promise<APIResponse<ArtifactLineage>> {
209
+ // MOCK - Returns simulated lineage
210
+ const mockLineage: ArtifactLineage = {
211
+ artifact_id: artifactId,
212
+ source: {
213
+ type: "run",
214
+ id: "run_123",
215
+ name: "Support Agent Run",
216
+ timestamp: new Date(Date.now() - 3600000).toISOString(),
217
+ },
218
+ transformations: [
219
+ {
220
+ step: 1,
221
+ operation: "generate",
222
+ run_id: "run_123",
223
+ tool_name: "document_generator",
224
+ timestamp: new Date(Date.now() - 3500000).toISOString(),
225
+ },
226
+ {
227
+ step: 2,
228
+ operation: "format",
229
+ run_id: "run_123",
230
+ tool_name: "pdf_formatter",
231
+ timestamp: new Date(Date.now() - 3400000).toISOString(),
232
+ },
233
+ ],
234
+ dependencies: ["artifact_raw_data", "artifact_template"],
235
+ };
236
+ return { data: mockLineage, error: undefined, response: new Response() };
237
+ }
238
+
239
+ // MOCK - Simulated getForRun
240
+ /**
241
+ * Get all artifacts produced by a run.
242
+ */
243
+ async getForRun(runId: string): Promise<APIResponse<ArtifactListResponse>> {
244
+ // MOCK - Returns simulated data
245
+ const mockArtifacts: ArtifactListResponse = {
246
+ items: [
247
+ {
248
+ id: "artifact_run_1",
249
+ name: "output.json",
250
+ type: "data",
251
+ mime_type: "application/json",
252
+ size_bytes: 5000,
253
+ sha256: "run_output_hash",
254
+ run_id: runId,
255
+ metadata: {},
256
+ signed: false,
257
+ created_at: new Date().toISOString(),
258
+ created_by: "agent",
259
+ },
260
+ ],
261
+ total: 1,
262
+ };
263
+ return { data: mockArtifacts, error: undefined, response: new Response() };
264
+ }
265
+
266
+ // MOCK - Simulated attachToThread
267
+ /**
268
+ * Attach an artifact to a thread.
269
+ */
270
+ async attachToThread(threadId: string, artifactId: string): Promise<APIResponse<Artifact>> {
271
+ // MOCK - Returns simulated data
272
+ const mockArtifact: Artifact = {
273
+ id: artifactId,
274
+ name: "attached_file.pdf",
275
+ type: "document",
276
+ mime_type: "application/pdf",
277
+ size_bytes: 100000,
278
+ sha256: "attached_hash",
279
+ thread_id: threadId,
280
+ metadata: {},
281
+ signed: false,
282
+ created_at: new Date().toISOString(),
283
+ created_by: "user",
284
+ };
285
+ return { data: mockArtifact, error: undefined, response: new Response() };
286
+ }
287
+ }