@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,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",
@@ -0,0 +1,176 @@
1
+ /**
2
+ * Capabilities Module - Agent Permissions System
3
+ *
4
+ * // MOCK - This module contains mock implementations for future features
5
+ *
6
+ * Manages what agents/runs can do. Formal capability system
7
+ * that enables enterprise-grade governance.
8
+ */
9
+
10
+ import type { RawClient, APIResponse } from "../client/raw.js";
11
+
12
+ // ============================================================================
13
+ // Types
14
+ // ============================================================================
15
+
16
+ export interface Capability {
17
+ id: string;
18
+ name: string;
19
+ description?: string;
20
+ type: "tool" | "network" | "file" | "mcp" | "token" | "custom";
21
+ config: CapabilityConfig;
22
+ }
23
+
24
+ export interface CapabilityConfig {
25
+ // Tool capabilities
26
+ tool_allowlist?: string[];
27
+ tool_denylist?: string[];
28
+ max_tool_calls?: number;
29
+
30
+ // Network capabilities
31
+ allowed_domains?: string[];
32
+ blocked_domains?: string[];
33
+ allow_egress?: boolean;
34
+
35
+ // File capabilities
36
+ file_read?: boolean;
37
+ file_write?: boolean;
38
+ allowed_paths?: string[];
39
+
40
+ // MCP capabilities
41
+ mcp_server_allowlist?: string[];
42
+
43
+ // Token/cost capabilities
44
+ max_tokens?: number;
45
+ max_input_tokens?: number;
46
+ max_output_tokens?: number;
47
+
48
+ // Streaming
49
+ streaming_allowed?: boolean;
50
+ }
51
+
52
+ export interface CapabilitySet {
53
+ agent_id?: string;
54
+ run_id?: string;
55
+ capabilities: Capability[];
56
+ inherited_from?: string;
57
+ effective_at: string;
58
+ }
59
+
60
+ export interface CapabilityOverride {
61
+ run_id: string;
62
+ overrides: Partial<CapabilityConfig>;
63
+ reason?: string;
64
+ applied_at: string;
65
+ applied_by: string;
66
+ }
67
+
68
+ // ============================================================================
69
+ // Module
70
+ // ============================================================================
71
+
72
+ export class CapabilitiesModule {
73
+ constructor(private client: RawClient, private headers: () => Record<string, string>) { }
74
+
75
+ // MOCK - Simulated get for agent
76
+ /**
77
+ * Get capabilities for an agent.
78
+ */
79
+ async getForAgent(agentId: string): Promise<APIResponse<CapabilitySet>> {
80
+ // MOCK - Returns simulated data
81
+ const mockCaps: CapabilitySet = {
82
+ agent_id: agentId,
83
+ capabilities: [
84
+ {
85
+ id: "cap_tools",
86
+ name: "Tool Access",
87
+ type: "tool",
88
+ config: {
89
+ tool_allowlist: ["web_search", "calculator", "file_read"],
90
+ max_tool_calls: 50,
91
+ },
92
+ },
93
+ {
94
+ id: "cap_network",
95
+ name: "Network Access",
96
+ type: "network",
97
+ config: {
98
+ allow_egress: true,
99
+ allowed_domains: ["*.google.com", "*.openai.com"],
100
+ },
101
+ },
102
+ {
103
+ id: "cap_tokens",
104
+ name: "Token Limits",
105
+ type: "token",
106
+ config: {
107
+ max_tokens: 100000,
108
+ max_input_tokens: 50000,
109
+ max_output_tokens: 50000,
110
+ },
111
+ },
112
+ ],
113
+ effective_at: new Date().toISOString(),
114
+ };
115
+ return { data: mockCaps, error: undefined, response: new Response() };
116
+ }
117
+
118
+ // MOCK - Simulated set for agent
119
+ /**
120
+ * Set capabilities for an agent.
121
+ */
122
+ async setForAgent(agentId: string, capabilities: Capability[]): Promise<APIResponse<CapabilitySet>> {
123
+ // MOCK - Returns simulated data
124
+ const mockCaps: CapabilitySet = {
125
+ agent_id: agentId,
126
+ capabilities,
127
+ effective_at: new Date().toISOString(),
128
+ };
129
+ return { data: mockCaps, error: undefined, response: new Response() };
130
+ }
131
+
132
+ // MOCK - Simulated get for run
133
+ /**
134
+ * Get effective capabilities for a run.
135
+ */
136
+ async getForRun(runId: string): Promise<APIResponse<CapabilitySet>> {
137
+ // MOCK - Returns simulated data
138
+ const mockCaps: CapabilitySet = {
139
+ run_id: runId,
140
+ capabilities: [
141
+ {
142
+ id: "cap_tools",
143
+ name: "Tool Access",
144
+ type: "tool",
145
+ config: {
146
+ tool_allowlist: ["web_search"],
147
+ max_tool_calls: 10,
148
+ },
149
+ },
150
+ ],
151
+ inherited_from: "agent_123",
152
+ effective_at: new Date().toISOString(),
153
+ };
154
+ return { data: mockCaps, error: undefined, response: new Response() };
155
+ }
156
+
157
+ // MOCK - Simulated override for run
158
+ /**
159
+ * Override capabilities for a specific run.
160
+ */
161
+ async overrideForRun(
162
+ runId: string,
163
+ overrides: Partial<CapabilityConfig>,
164
+ reason?: string
165
+ ): Promise<APIResponse<CapabilityOverride>> {
166
+ // MOCK - Returns simulated data
167
+ const mockOverride: CapabilityOverride = {
168
+ run_id: runId,
169
+ overrides,
170
+ reason,
171
+ applied_at: new Date().toISOString(),
172
+ applied_by: "user_123",
173
+ };
174
+ return { data: mockOverride, error: undefined, response: new Response() };
175
+ }
176
+ }