@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,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
+ }
@@ -0,0 +1,236 @@
1
+ /**
2
+ * Budgets Module - Cost Control
3
+ *
4
+ * // MOCK - This module contains mock implementations for future features
5
+ *
6
+ * Provides budget management, cost estimation, and spending limits.
7
+ * Critical for CFO happiness and auto-protection.
8
+ */
9
+
10
+ import type { RawClient, APIResponse } from "../client/raw.js";
11
+
12
+ // ============================================================================
13
+ // Types
14
+ // ============================================================================
15
+
16
+ export type BudgetPeriod = "hourly" | "daily" | "weekly" | "monthly" | "total";
17
+ export type BudgetScope = "tenant" | "workspace" | "agent" | "environment";
18
+
19
+ export interface Budget {
20
+ id: string;
21
+ name: string;
22
+ scope: BudgetScope;
23
+ scope_id: string;
24
+ period: BudgetPeriod;
25
+ limit_amount: number;
26
+ currency: string;
27
+ current_usage: number;
28
+ usage_percentage: number;
29
+ alert_thresholds: number[]; // e.g., [50, 80, 90]
30
+ hard_limit: boolean; // If true, blocks execution when exceeded
31
+ created_at: string;
32
+ updated_at: string;
33
+ }
34
+
35
+ export interface BudgetUsage {
36
+ budget_id: string;
37
+ period_start: string;
38
+ period_end: string;
39
+ total_cost: number;
40
+ breakdown: BudgetBreakdown[];
41
+ }
42
+
43
+ export interface BudgetBreakdown {
44
+ category: string;
45
+ amount: number;
46
+ percentage: number;
47
+ run_count: number;
48
+ }
49
+
50
+ export interface CostEstimate {
51
+ estimated_min: number;
52
+ estimated_max: number;
53
+ estimated_avg: number;
54
+ currency: string;
55
+ breakdown: {
56
+ input_tokens: number;
57
+ output_tokens: number;
58
+ tool_calls: number;
59
+ model_cost: number;
60
+ };
61
+ warnings: string[];
62
+ }
63
+
64
+ export interface BudgetListResponse {
65
+ items: Budget[];
66
+ total: number;
67
+ }
68
+
69
+ // ============================================================================
70
+ // Module
71
+ // ============================================================================
72
+
73
+ export class BudgetsModule {
74
+ constructor(private client: RawClient, private headers: () => Record<string, string>) { }
75
+
76
+ // MOCK - Simulated list
77
+ /**
78
+ * List all budgets.
79
+ */
80
+ async list(params?: { scope?: BudgetScope }): Promise<APIResponse<BudgetListResponse>> {
81
+ // MOCK - Returns simulated data
82
+ const mockBudgets: BudgetListResponse = {
83
+ items: [
84
+ {
85
+ id: "budget_tenant",
86
+ name: "Monthly Tenant Budget",
87
+ scope: "tenant",
88
+ scope_id: "tenant_123",
89
+ period: "monthly",
90
+ limit_amount: 5000,
91
+ currency: "USD",
92
+ current_usage: 1250.50,
93
+ usage_percentage: 25.01,
94
+ alert_thresholds: [50, 80, 90],
95
+ hard_limit: false,
96
+ created_at: new Date(Date.now() - 2592000000).toISOString(),
97
+ updated_at: new Date().toISOString(),
98
+ },
99
+ {
100
+ id: "budget_agent_1",
101
+ name: "Agent Daily Budget",
102
+ scope: "agent",
103
+ scope_id: "agent_support",
104
+ period: "daily",
105
+ limit_amount: 50,
106
+ currency: "USD",
107
+ current_usage: 12.30,
108
+ usage_percentage: 24.6,
109
+ alert_thresholds: [80, 95],
110
+ hard_limit: true,
111
+ created_at: new Date(Date.now() - 86400000).toISOString(),
112
+ updated_at: new Date().toISOString(),
113
+ },
114
+ ],
115
+ total: 2,
116
+ };
117
+ return { data: mockBudgets, error: undefined, response: new Response() };
118
+ }
119
+
120
+ // MOCK - Simulated get
121
+ /**
122
+ * Get a budget by ID.
123
+ */
124
+ async get(budgetId: string): Promise<APIResponse<Budget>> {
125
+ // MOCK - Returns simulated data
126
+ const mockBudget: Budget = {
127
+ id: budgetId,
128
+ name: "Monthly Tenant Budget",
129
+ scope: "tenant",
130
+ scope_id: "tenant_123",
131
+ period: "monthly",
132
+ limit_amount: 5000,
133
+ currency: "USD",
134
+ current_usage: 1250.50,
135
+ usage_percentage: 25.01,
136
+ alert_thresholds: [50, 80, 90],
137
+ hard_limit: false,
138
+ created_at: new Date(Date.now() - 2592000000).toISOString(),
139
+ updated_at: new Date().toISOString(),
140
+ };
141
+ return { data: mockBudget, error: undefined, response: new Response() };
142
+ }
143
+
144
+ // MOCK - Simulated set
145
+ /**
146
+ * Create or update a budget.
147
+ */
148
+ async set(body: {
149
+ name: string;
150
+ scope: BudgetScope;
151
+ scope_id: string;
152
+ period: BudgetPeriod;
153
+ limit_amount: number;
154
+ currency?: string;
155
+ alert_thresholds?: number[];
156
+ hard_limit?: boolean;
157
+ }): Promise<APIResponse<Budget>> {
158
+ // MOCK - Returns simulated data
159
+ const mockBudget: Budget = {
160
+ id: `budget_${Date.now()}`,
161
+ name: body.name,
162
+ scope: body.scope,
163
+ scope_id: body.scope_id,
164
+ period: body.period,
165
+ limit_amount: body.limit_amount,
166
+ currency: body.currency || "USD",
167
+ current_usage: 0,
168
+ usage_percentage: 0,
169
+ alert_thresholds: body.alert_thresholds || [80, 90],
170
+ hard_limit: body.hard_limit ?? false,
171
+ created_at: new Date().toISOString(),
172
+ updated_at: new Date().toISOString(),
173
+ };
174
+ return { data: mockBudget, error: undefined, response: new Response() };
175
+ }
176
+
177
+ // MOCK - Simulated getUsage
178
+ /**
179
+ * Get budget usage details.
180
+ */
181
+ async getUsage(budgetId: string): Promise<APIResponse<BudgetUsage>> {
182
+ // MOCK - Returns simulated data
183
+ const mockUsage: BudgetUsage = {
184
+ budget_id: budgetId,
185
+ period_start: new Date(Date.now() - 2592000000).toISOString(),
186
+ period_end: new Date().toISOString(),
187
+ total_cost: 1250.50,
188
+ breakdown: [
189
+ { category: "GPT-4", amount: 800.00, percentage: 63.97, run_count: 450 },
190
+ { category: "Claude", amount: 300.50, percentage: 24.03, run_count: 200 },
191
+ { category: "Embeddings", amount: 100.00, percentage: 8.00, run_count: 1000 },
192
+ { category: "Tools", amount: 50.00, percentage: 4.00, run_count: 300 },
193
+ ],
194
+ };
195
+ return { data: mockUsage, error: undefined, response: new Response() };
196
+ }
197
+
198
+ // MOCK - Simulated estimateCost
199
+ /**
200
+ * Estimate cost for a run before execution.
201
+ */
202
+ async estimateCost(params: {
203
+ agent_id: string;
204
+ input?: Record<string, unknown>;
205
+ max_iterations?: number;
206
+ }): Promise<APIResponse<CostEstimate>> {
207
+ // MOCK - Returns simulated estimate
208
+ const mockEstimate: CostEstimate = {
209
+ estimated_min: 0.05,
210
+ estimated_max: 0.25,
211
+ estimated_avg: 0.12,
212
+ currency: "USD",
213
+ breakdown: {
214
+ input_tokens: 2000,
215
+ output_tokens: 3000,
216
+ tool_calls: 5,
217
+ model_cost: 0.10,
218
+ },
219
+ warnings: [],
220
+ };
221
+ return { data: mockEstimate, error: undefined, response: new Response() };
222
+ }
223
+
224
+ // MOCK - Simulated setBudgetForRun
225
+ /**
226
+ * Set a hard budget cap for a specific run.
227
+ */
228
+ async setBudgetForRun(runId: string, limit: number): Promise<APIResponse<{ run_id: string; limit: number }>> {
229
+ // MOCK - Returns simulated data
230
+ return {
231
+ data: { run_id: runId, limit },
232
+ error: undefined,
233
+ response: new Response()
234
+ };
235
+ }
236
+ }
@@ -36,7 +36,7 @@ export type BuilderChatResponse = {
36
36
 
37
37
  export class BuilderModule {
38
38
  constructor(
39
- private kernelBaseUrl: string,
39
+ private baseUrl: string,
40
40
  private headers: () => Record<string, string>
41
41
  ) { }
42
42
 
@@ -49,7 +49,7 @@ export class BuilderModule {
49
49
  request: BuilderChatRequest,
50
50
  options?: SSEOptions
51
51
  ): AsyncGenerator<BuilderStreamEvent> {
52
- const url = `${this.kernelBaseUrl}/v1/internal/builder/${agentId}/chat`;
52
+ const url = `${this.baseUrl}/v1/internal/builder/${agentId}/chat`;
53
53
 
54
54
  const response = await fetch(url, {
55
55
  method: "POST",
@@ -117,7 +117,7 @@ export class BuilderModule {
117
117
  agentId: string,
118
118
  request: BuilderChatRequest
119
119
  ): Promise<BuilderChatResponse> {
120
- const url = `${this.kernelBaseUrl}/v1/internal/builder/${agentId}/chat/sync`;
120
+ const url = `${this.baseUrl}/v1/internal/builder/${agentId}/chat/sync`;
121
121
 
122
122
  const response = await fetch(url, {
123
123
  method: "POST",