@agent-os-sdk/client 0.1.2 → 0.2.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.
- package/dist/client/AgentOsClient.d.ts +39 -44
- package/dist/client/AgentOsClient.d.ts.map +1 -1
- package/dist/client/AgentOsClient.js +162 -44
- package/dist/client/auth.d.ts +102 -0
- package/dist/client/auth.d.ts.map +1 -0
- package/dist/client/auth.js +44 -0
- package/dist/generated/openapi.d.ts +914 -202
- package/dist/generated/openapi.d.ts.map +1 -1
- package/dist/index.d.ts +10 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/modules/approvals.d.ts +8 -22
- package/dist/modules/approvals.d.ts.map +1 -1
- package/dist/modules/approvals.js +27 -130
- package/dist/modules/artifacts.d.ts +28 -79
- package/dist/modules/artifacts.d.ts.map +1 -1
- package/dist/modules/artifacts.js +30 -197
- package/dist/modules/budgets.d.ts +47 -70
- package/dist/modules/budgets.d.ts.map +1 -1
- package/dist/modules/budgets.js +28 -139
- package/dist/modules/builder.d.ts +21 -1
- package/dist/modules/builder.d.ts.map +1 -1
- package/dist/modules/builder.js +25 -3
- package/dist/modules/capabilities.d.ts +39 -50
- package/dist/modules/capabilities.d.ts.map +1 -1
- package/dist/modules/capabilities.js +32 -95
- package/dist/modules/deployments.d.ts +49 -92
- package/dist/modules/deployments.d.ts.map +1 -1
- package/dist/modules/deployments.js +37 -209
- package/dist/modules/flows.d.ts +11 -31
- package/dist/modules/flows.d.ts.map +1 -1
- package/dist/modules/flows.js +33 -157
- package/dist/modules/handoff.d.ts +7 -4
- package/dist/modules/handoff.d.ts.map +1 -1
- package/dist/modules/handoff.js +25 -88
- package/dist/modules/incidents.d.ts +40 -101
- package/dist/modules/incidents.d.ts.map +1 -1
- package/dist/modules/incidents.js +31 -208
- package/dist/modules/policies.d.ts +42 -69
- package/dist/modules/policies.d.ts.map +1 -1
- package/dist/modules/policies.js +25 -159
- package/dist/modules/runs.d.ts +89 -3
- package/dist/modules/runs.d.ts.map +1 -1
- package/dist/modules/runs.js +75 -4
- package/package.json +1 -1
- package/src/client/AgentOsClient.ts +185 -67
- package/src/client/auth.ts +148 -0
- package/src/generated/openapi.ts +914 -202
- package/src/generated/swagger.json +770 -630
- package/src/index.ts +22 -10
- package/src/modules/approvals.ts +31 -132
- package/src/modules/artifacts.ts +41 -245
- package/src/modules/budgets.ts +65 -181
- package/src/modules/builder.ts +25 -3
- package/src/modules/capabilities.ts +58 -139
- package/src/modules/deployments.ts +67 -271
- package/src/modules/flows.ts +37 -163
- package/src/modules/handoff.ts +29 -93
- package/src/modules/incidents.ts +56 -282
- package/src/modules/policies.ts +57 -203
- package/src/modules/runs.ts +123 -5
package/src/modules/budgets.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Budgets Module - Cost
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* Provides budget management, cost estimation, and spending limits.
|
|
7
|
-
* Critical for CFO happiness and auto-protection.
|
|
2
|
+
* Budgets Module - Cost & Token Management
|
|
3
|
+
*
|
|
4
|
+
* NOT IMPLEMENTED - Backend endpoint not available.
|
|
5
|
+
* All methods return 501 NotImplemented.
|
|
8
6
|
*/
|
|
9
7
|
|
|
10
8
|
import type { RawClient, APIResponse } from "../client/raw.js";
|
|
@@ -13,57 +11,66 @@ import type { RawClient, APIResponse } from "../client/raw.js";
|
|
|
13
11
|
// Types
|
|
14
12
|
// ============================================================================
|
|
15
13
|
|
|
16
|
-
export type
|
|
17
|
-
export type
|
|
14
|
+
export type BudgetScope = "agent" | "workspace" | "tenant" | "user";
|
|
15
|
+
export type BudgetPeriod = "daily" | "weekly" | "monthly" | "total";
|
|
16
|
+
export type BudgetResourceType = "tokens" | "cost" | "api_calls";
|
|
18
17
|
|
|
19
18
|
export interface Budget {
|
|
20
19
|
id: string;
|
|
21
20
|
name: string;
|
|
22
21
|
scope: BudgetScope;
|
|
23
22
|
scope_id: string;
|
|
23
|
+
resource_type: BudgetResourceType;
|
|
24
|
+
limit_value: number;
|
|
25
|
+
current_value: number;
|
|
24
26
|
period: BudgetPeriod;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
usage_percentage: number;
|
|
29
|
-
alert_thresholds: number[]; // e.g., [50, 80, 90]
|
|
30
|
-
hard_limit: boolean; // If true, blocks execution when exceeded
|
|
27
|
+
period_start: string;
|
|
28
|
+
period_end: string;
|
|
29
|
+
alert_threshold_percent?: number;
|
|
31
30
|
created_at: string;
|
|
32
|
-
updated_at: string;
|
|
33
31
|
}
|
|
34
32
|
|
|
35
33
|
export interface BudgetUsage {
|
|
36
34
|
budget_id: string;
|
|
35
|
+
current_value: number;
|
|
36
|
+
limit_value: number;
|
|
37
|
+
percent_used: number;
|
|
38
|
+
remaining: number;
|
|
37
39
|
period_start: string;
|
|
38
40
|
period_end: string;
|
|
39
|
-
|
|
40
|
-
breakdown: BudgetBreakdown[];
|
|
41
|
+
breakdown: BudgetBreakdownItem[];
|
|
41
42
|
}
|
|
42
43
|
|
|
43
|
-
export interface
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
export interface BudgetBreakdownItem {
|
|
45
|
+
agent_id?: string;
|
|
46
|
+
agent_name?: string;
|
|
47
|
+
model?: string;
|
|
48
|
+
value: number;
|
|
49
|
+
percent_of_total: number;
|
|
48
50
|
}
|
|
49
51
|
|
|
50
|
-
export interface
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
output_tokens: number;
|
|
58
|
-
tool_calls: number;
|
|
59
|
-
model_cost: number;
|
|
60
|
-
};
|
|
61
|
-
warnings: string[];
|
|
52
|
+
export interface BudgetAlert {
|
|
53
|
+
id: string;
|
|
54
|
+
budget_id: string;
|
|
55
|
+
type: "threshold_warning" | "limit_reached" | "limit_exceeded";
|
|
56
|
+
message: string;
|
|
57
|
+
triggered_at: string;
|
|
58
|
+
acknowledged: boolean;
|
|
62
59
|
}
|
|
63
60
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
// ============================================================================
|
|
62
|
+
// Helper for 501 responses
|
|
63
|
+
// ============================================================================
|
|
64
|
+
|
|
65
|
+
function notImplemented<T>(method: string): APIResponse<T> {
|
|
66
|
+
return {
|
|
67
|
+
data: undefined,
|
|
68
|
+
error: {
|
|
69
|
+
code: "NOT_IMPLEMENTED",
|
|
70
|
+
message: `BudgetsModule.${method}() is not implemented. Backend endpoint not available.`,
|
|
71
|
+
},
|
|
72
|
+
response: new Response(null, { status: 501, statusText: "Not Implemented" }),
|
|
73
|
+
};
|
|
67
74
|
}
|
|
68
75
|
|
|
69
76
|
// ============================================================================
|
|
@@ -73,164 +80,41 @@ export interface BudgetListResponse {
|
|
|
73
80
|
export class BudgetsModule {
|
|
74
81
|
constructor(private client: RawClient, private headers: () => Record<string, string>) { }
|
|
75
82
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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() };
|
|
83
|
+
/** @returns 501 Not Implemented */
|
|
84
|
+
async list(params?: {
|
|
85
|
+
scope?: BudgetScope;
|
|
86
|
+
scope_id?: string;
|
|
87
|
+
limit?: number;
|
|
88
|
+
offset?: number;
|
|
89
|
+
}): Promise<APIResponse<{ items: Budget[]; total: number }>> {
|
|
90
|
+
return notImplemented<{ items: Budget[]; total: number }>("list");
|
|
118
91
|
}
|
|
119
92
|
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Get a budget by ID.
|
|
123
|
-
*/
|
|
93
|
+
/** @returns 501 Not Implemented */
|
|
124
94
|
async get(budgetId: string): Promise<APIResponse<Budget>> {
|
|
125
|
-
|
|
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() };
|
|
95
|
+
return notImplemented<Budget>("get");
|
|
142
96
|
}
|
|
143
97
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
* Create or update a budget.
|
|
147
|
-
*/
|
|
148
|
-
async set(body: {
|
|
98
|
+
/** @returns 501 Not Implemented */
|
|
99
|
+
async create(body: {
|
|
149
100
|
name: string;
|
|
150
101
|
scope: BudgetScope;
|
|
151
102
|
scope_id: string;
|
|
103
|
+
resource_type: BudgetResourceType;
|
|
104
|
+
limit_value: number;
|
|
152
105
|
period: BudgetPeriod;
|
|
153
|
-
|
|
154
|
-
currency?: string;
|
|
155
|
-
alert_thresholds?: number[];
|
|
156
|
-
hard_limit?: boolean;
|
|
106
|
+
alert_threshold_percent?: number;
|
|
157
107
|
}): Promise<APIResponse<Budget>> {
|
|
158
|
-
|
|
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() };
|
|
108
|
+
return notImplemented<Budget>("create");
|
|
175
109
|
}
|
|
176
110
|
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Get budget usage details.
|
|
180
|
-
*/
|
|
111
|
+
/** @returns 501 Not Implemented */
|
|
181
112
|
async getUsage(budgetId: string): Promise<APIResponse<BudgetUsage>> {
|
|
182
|
-
|
|
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() };
|
|
113
|
+
return notImplemented<BudgetUsage>("getUsage");
|
|
222
114
|
}
|
|
223
115
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
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
|
-
};
|
|
116
|
+
/** @returns 501 Not Implemented */
|
|
117
|
+
async getAlerts(budgetId: string): Promise<APIResponse<BudgetAlert[]>> {
|
|
118
|
+
return notImplemented<BudgetAlert[]>("getAlerts");
|
|
235
119
|
}
|
|
236
120
|
}
|
package/src/modules/builder.ts
CHANGED
|
@@ -1,8 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Builder Module - Meta-Agent for Agent Building
|
|
3
3
|
*
|
|
4
|
-
* Connects to the
|
|
4
|
+
* Connects to the Control Plane's builder endpoint which proxies to the
|
|
5
|
+
* Data Plane's meta-agent for AI-assisted agent creation.
|
|
5
6
|
* Uses SSE streaming for real-time responses and graph updates.
|
|
7
|
+
*
|
|
8
|
+
* Flow: Frontend → CP:5000/v1/api/builder/{agentId}/chat → DP:8001/v1/internal/builder/{agentId}/chat
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const client = new AgentOsClient({ ... })
|
|
13
|
+
*
|
|
14
|
+
* // SSE streaming chat
|
|
15
|
+
* for await (const event of client.builder.chat(agentId, {
|
|
16
|
+
* message: "Adicione um nó de pesquisa web",
|
|
17
|
+
* current_graph_spec: { nodes: [...], edges: [...] }
|
|
18
|
+
* })) {
|
|
19
|
+
* if (event.type === 'message') console.log(event.data.text)
|
|
20
|
+
* if (event.type === 'graph_update') applyAction(event.data)
|
|
21
|
+
* }
|
|
22
|
+
*
|
|
23
|
+
* // Sync chat (no streaming)
|
|
24
|
+
* const result = await client.builder.chatSync(agentId, { message: "Mude as instruções" })
|
|
25
|
+
* ```
|
|
6
26
|
*/
|
|
7
27
|
|
|
8
28
|
import { streamSSE, type SSEEvent, type SSEOptions } from "../sse/client.js";
|
|
@@ -49,7 +69,8 @@ export class BuilderModule {
|
|
|
49
69
|
request: BuilderChatRequest,
|
|
50
70
|
options?: SSEOptions
|
|
51
71
|
): AsyncGenerator<BuilderStreamEvent> {
|
|
52
|
-
|
|
72
|
+
// Use public API route (CP proxies to DP)
|
|
73
|
+
const url = `${this.baseUrl}/v1/api/builder/${agentId}/chat`;
|
|
53
74
|
|
|
54
75
|
const response = await fetch(url, {
|
|
55
76
|
method: "POST",
|
|
@@ -117,7 +138,8 @@ export class BuilderModule {
|
|
|
117
138
|
agentId: string,
|
|
118
139
|
request: BuilderChatRequest
|
|
119
140
|
): Promise<BuilderChatResponse> {
|
|
120
|
-
|
|
141
|
+
// Use public API route (CP proxies to DP)
|
|
142
|
+
const url = `${this.baseUrl}/v1/api/builder/${agentId}/chat/sync`;
|
|
121
143
|
|
|
122
144
|
const response = await fetch(url, {
|
|
123
145
|
method: "POST",
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Capabilities Module - Agent
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* Manages what agents/runs can do. Formal capability system
|
|
7
|
-
* that enables enterprise-grade governance.
|
|
2
|
+
* Capabilities Module - Agent Capability Discovery
|
|
3
|
+
*
|
|
4
|
+
* NOT IMPLEMENTED - Backend endpoint not available.
|
|
5
|
+
* All methods return 501 NotImplemented.
|
|
8
6
|
*/
|
|
9
7
|
|
|
10
8
|
import type { RawClient, APIResponse } from "../client/raw.js";
|
|
@@ -13,56 +11,49 @@ import type { RawClient, APIResponse } from "../client/raw.js";
|
|
|
13
11
|
// Types
|
|
14
12
|
// ============================================================================
|
|
15
13
|
|
|
14
|
+
export type CapabilityType = "tool" | "skill" | "knowledge" | "integration" | "model_feature";
|
|
15
|
+
|
|
16
16
|
export interface Capability {
|
|
17
17
|
id: string;
|
|
18
18
|
name: string;
|
|
19
|
+
type: CapabilityType;
|
|
19
20
|
description?: string;
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
agent_id?: string;
|
|
22
|
+
is_available: boolean;
|
|
23
|
+
required_credentials?: string[];
|
|
24
|
+
required_permissions?: string[];
|
|
25
|
+
metadata?: Record<string, unknown>;
|
|
22
26
|
}
|
|
23
27
|
|
|
24
|
-
export interface
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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;
|
|
28
|
+
export interface CapabilityTest {
|
|
29
|
+
capability_id: string;
|
|
30
|
+
test_name: string;
|
|
31
|
+
passed: boolean;
|
|
32
|
+
message?: string;
|
|
33
|
+
duration_ms: number;
|
|
50
34
|
}
|
|
51
35
|
|
|
52
|
-
export interface
|
|
53
|
-
agent_id
|
|
54
|
-
run_id?: string;
|
|
36
|
+
export interface CapabilityMatrix {
|
|
37
|
+
agent_id: string;
|
|
55
38
|
capabilities: Capability[];
|
|
56
|
-
|
|
57
|
-
|
|
39
|
+
total: number;
|
|
40
|
+
available: number;
|
|
41
|
+
unavailable: number;
|
|
58
42
|
}
|
|
59
43
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
44
|
+
// ============================================================================
|
|
45
|
+
// Helper for 501 responses
|
|
46
|
+
// ============================================================================
|
|
47
|
+
|
|
48
|
+
function notImplemented<T>(method: string): APIResponse<T> {
|
|
49
|
+
return {
|
|
50
|
+
data: undefined,
|
|
51
|
+
error: {
|
|
52
|
+
code: "NOT_IMPLEMENTED",
|
|
53
|
+
message: `CapabilitiesModule.${method}() is not implemented. Backend endpoint not available.`,
|
|
54
|
+
},
|
|
55
|
+
response: new Response(null, { status: 501, statusText: "Not Implemented" }),
|
|
56
|
+
};
|
|
66
57
|
}
|
|
67
58
|
|
|
68
59
|
// ============================================================================
|
|
@@ -72,105 +63,33 @@ export interface CapabilityOverride {
|
|
|
72
63
|
export class CapabilitiesModule {
|
|
73
64
|
constructor(private client: RawClient, private headers: () => Record<string, string>) { }
|
|
74
65
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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() };
|
|
66
|
+
/** @returns 501 Not Implemented */
|
|
67
|
+
async list(params?: {
|
|
68
|
+
agent_id?: string;
|
|
69
|
+
type?: CapabilityType;
|
|
70
|
+
limit?: number;
|
|
71
|
+
offset?: number;
|
|
72
|
+
}): Promise<APIResponse<{ items: Capability[]; total: number }>> {
|
|
73
|
+
return notImplemented<{ items: Capability[]; total: number }>("list");
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** @returns 501 Not Implemented */
|
|
77
|
+
async get(capabilityId: string): Promise<APIResponse<Capability>> {
|
|
78
|
+
return notImplemented<Capability>("get");
|
|
116
79
|
}
|
|
117
80
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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() };
|
|
81
|
+
/** @returns 501 Not Implemented */
|
|
82
|
+
async getMatrix(agentId: string): Promise<APIResponse<CapabilityMatrix>> {
|
|
83
|
+
return notImplemented<CapabilityMatrix>("getMatrix");
|
|
130
84
|
}
|
|
131
85
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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() };
|
|
86
|
+
/** @returns 501 Not Implemented */
|
|
87
|
+
async test(agentId: string, capabilityId: string): Promise<APIResponse<CapabilityTest>> {
|
|
88
|
+
return notImplemented<CapabilityTest>("test");
|
|
155
89
|
}
|
|
156
90
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
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() };
|
|
91
|
+
/** @returns 501 Not Implemented */
|
|
92
|
+
async testAll(agentId: string): Promise<APIResponse<CapabilityTest[]>> {
|
|
93
|
+
return notImplemented<CapabilityTest[]>("testAll");
|
|
175
94
|
}
|
|
176
95
|
}
|