@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
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Artifacts Module - Output Management
|
|
2
|
+
* Artifacts Module - Run Output Management
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* Manages artifacts as first-class outputs with integrity,
|
|
7
|
-
* lineage tracking, and signatures.
|
|
4
|
+
* NOT IMPLEMENTED - Backend endpoint not available.
|
|
5
|
+
* All methods return 501 NotImplemented.
|
|
8
6
|
*/
|
|
9
7
|
// ============================================================================
|
|
8
|
+
// Helper for 501 responses
|
|
9
|
+
// ============================================================================
|
|
10
|
+
function notImplemented(method) {
|
|
11
|
+
return {
|
|
12
|
+
data: undefined,
|
|
13
|
+
error: {
|
|
14
|
+
code: "NOT_IMPLEMENTED",
|
|
15
|
+
message: `ArtifactsModule.${method}() is not implemented. Backend endpoint not available.`,
|
|
16
|
+
},
|
|
17
|
+
response: new Response(null, { status: 501, statusText: "Not Implemented" }),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
// ============================================================================
|
|
10
21
|
// Module
|
|
11
22
|
// ============================================================================
|
|
12
23
|
export class ArtifactsModule {
|
|
@@ -16,202 +27,24 @@ export class ArtifactsModule {
|
|
|
16
27
|
this.client = client;
|
|
17
28
|
this.headers = headers;
|
|
18
29
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
*/
|
|
23
|
-
async list(params) {
|
|
24
|
-
// MOCK - Returns simulated data
|
|
25
|
-
const mockArtifacts = {
|
|
26
|
-
items: [
|
|
27
|
-
{
|
|
28
|
-
id: "artifact_1",
|
|
29
|
-
name: "report.pdf",
|
|
30
|
-
type: "document",
|
|
31
|
-
mime_type: "application/pdf",
|
|
32
|
-
size_bytes: 245000,
|
|
33
|
-
sha256: "abc123def456...",
|
|
34
|
-
url: "https://storage.example.com/artifacts/report.pdf",
|
|
35
|
-
run_id: "run_123",
|
|
36
|
-
thread_id: "thread_456",
|
|
37
|
-
metadata: { pages: 12, author: "Agent Support" },
|
|
38
|
-
signed: true,
|
|
39
|
-
signature: "sig_abc123",
|
|
40
|
-
created_at: new Date(Date.now() - 3600000).toISOString(),
|
|
41
|
-
created_by: "agent_support",
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
id: "artifact_2",
|
|
45
|
-
name: "analysis.json",
|
|
46
|
-
type: "data",
|
|
47
|
-
mime_type: "application/json",
|
|
48
|
-
size_bytes: 15000,
|
|
49
|
-
sha256: "xyz789ghi012...",
|
|
50
|
-
url: "https://storage.example.com/artifacts/analysis.json",
|
|
51
|
-
run_id: "run_124",
|
|
52
|
-
metadata: { records: 500 },
|
|
53
|
-
signed: false,
|
|
54
|
-
created_at: new Date(Date.now() - 7200000).toISOString(),
|
|
55
|
-
created_by: "agent_analyzer",
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
total: 2,
|
|
59
|
-
};
|
|
60
|
-
return { data: mockArtifacts, error: undefined, response: new Response() };
|
|
30
|
+
/** @returns 501 Not Implemented */
|
|
31
|
+
async list(runId) {
|
|
32
|
+
return notImplemented("list");
|
|
61
33
|
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Get an artifact by ID.
|
|
65
|
-
*/
|
|
34
|
+
/** @returns 501 Not Implemented */
|
|
66
35
|
async get(artifactId) {
|
|
67
|
-
|
|
68
|
-
const mockArtifact = {
|
|
69
|
-
id: artifactId,
|
|
70
|
-
name: "report.pdf",
|
|
71
|
-
type: "document",
|
|
72
|
-
mime_type: "application/pdf",
|
|
73
|
-
size_bytes: 245000,
|
|
74
|
-
sha256: "abc123def456...",
|
|
75
|
-
url: "https://storage.example.com/artifacts/report.pdf",
|
|
76
|
-
run_id: "run_123",
|
|
77
|
-
metadata: { pages: 12 },
|
|
78
|
-
signed: true,
|
|
79
|
-
signature: "sig_abc123",
|
|
80
|
-
created_at: new Date(Date.now() - 3600000).toISOString(),
|
|
81
|
-
created_by: "agent_support",
|
|
82
|
-
};
|
|
83
|
-
return { data: mockArtifact, error: undefined, response: new Response() };
|
|
36
|
+
return notImplemented("get");
|
|
84
37
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
*/
|
|
89
|
-
async create(body) {
|
|
90
|
-
// MOCK - Returns simulated data
|
|
91
|
-
const mockArtifact = {
|
|
92
|
-
id: `artifact_${Date.now()}`,
|
|
93
|
-
name: body.name,
|
|
94
|
-
type: body.type,
|
|
95
|
-
mime_type: body.mime_type,
|
|
96
|
-
size_bytes: body.size_bytes,
|
|
97
|
-
sha256: body.sha256,
|
|
98
|
-
run_id: body.run_id,
|
|
99
|
-
thread_id: body.thread_id,
|
|
100
|
-
metadata: body.metadata || {},
|
|
101
|
-
signed: false,
|
|
102
|
-
created_at: new Date().toISOString(),
|
|
103
|
-
created_by: "user_current",
|
|
104
|
-
};
|
|
105
|
-
return { data: mockArtifact, error: undefined, response: new Response() };
|
|
38
|
+
/** @returns 501 Not Implemented */
|
|
39
|
+
async getDownloadUrl(artifactId) {
|
|
40
|
+
return notImplemented("getDownloadUrl");
|
|
106
41
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
*/
|
|
111
|
-
async delete(artifactId) {
|
|
112
|
-
// MOCK - Returns success
|
|
113
|
-
return { data: undefined, error: undefined, response: new Response() };
|
|
42
|
+
/** @returns 501 Not Implemented */
|
|
43
|
+
async createUploadUrl(runId, name, type) {
|
|
44
|
+
return notImplemented("createUploadUrl");
|
|
114
45
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
*/
|
|
119
|
-
async sign(artifactId) {
|
|
120
|
-
// MOCK - Returns simulated signed artifact
|
|
121
|
-
const mockArtifact = {
|
|
122
|
-
id: artifactId,
|
|
123
|
-
name: "report.pdf",
|
|
124
|
-
type: "document",
|
|
125
|
-
mime_type: "application/pdf",
|
|
126
|
-
size_bytes: 245000,
|
|
127
|
-
sha256: "abc123def456...",
|
|
128
|
-
metadata: {},
|
|
129
|
-
signed: true,
|
|
130
|
-
signature: `sig_${Date.now()}`,
|
|
131
|
-
created_at: new Date(Date.now() - 3600000).toISOString(),
|
|
132
|
-
created_by: "agent_support",
|
|
133
|
-
};
|
|
134
|
-
return { data: mockArtifact, error: undefined, response: new Response() };
|
|
135
|
-
}
|
|
136
|
-
// MOCK - Simulated lineage
|
|
137
|
-
/**
|
|
138
|
-
* Get artifact lineage (provenance tracking).
|
|
139
|
-
*/
|
|
140
|
-
async lineage(artifactId) {
|
|
141
|
-
// MOCK - Returns simulated lineage
|
|
142
|
-
const mockLineage = {
|
|
143
|
-
artifact_id: artifactId,
|
|
144
|
-
source: {
|
|
145
|
-
type: "run",
|
|
146
|
-
id: "run_123",
|
|
147
|
-
name: "Support Agent Run",
|
|
148
|
-
timestamp: new Date(Date.now() - 3600000).toISOString(),
|
|
149
|
-
},
|
|
150
|
-
transformations: [
|
|
151
|
-
{
|
|
152
|
-
step: 1,
|
|
153
|
-
operation: "generate",
|
|
154
|
-
run_id: "run_123",
|
|
155
|
-
tool_name: "document_generator",
|
|
156
|
-
timestamp: new Date(Date.now() - 3500000).toISOString(),
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
step: 2,
|
|
160
|
-
operation: "format",
|
|
161
|
-
run_id: "run_123",
|
|
162
|
-
tool_name: "pdf_formatter",
|
|
163
|
-
timestamp: new Date(Date.now() - 3400000).toISOString(),
|
|
164
|
-
},
|
|
165
|
-
],
|
|
166
|
-
dependencies: ["artifact_raw_data", "artifact_template"],
|
|
167
|
-
};
|
|
168
|
-
return { data: mockLineage, error: undefined, response: new Response() };
|
|
169
|
-
}
|
|
170
|
-
// MOCK - Simulated getForRun
|
|
171
|
-
/**
|
|
172
|
-
* Get all artifacts produced by a run.
|
|
173
|
-
*/
|
|
174
|
-
async getForRun(runId) {
|
|
175
|
-
// MOCK - Returns simulated data
|
|
176
|
-
const mockArtifacts = {
|
|
177
|
-
items: [
|
|
178
|
-
{
|
|
179
|
-
id: "artifact_run_1",
|
|
180
|
-
name: "output.json",
|
|
181
|
-
type: "data",
|
|
182
|
-
mime_type: "application/json",
|
|
183
|
-
size_bytes: 5000,
|
|
184
|
-
sha256: "run_output_hash",
|
|
185
|
-
run_id: runId,
|
|
186
|
-
metadata: {},
|
|
187
|
-
signed: false,
|
|
188
|
-
created_at: new Date().toISOString(),
|
|
189
|
-
created_by: "agent",
|
|
190
|
-
},
|
|
191
|
-
],
|
|
192
|
-
total: 1,
|
|
193
|
-
};
|
|
194
|
-
return { data: mockArtifacts, error: undefined, response: new Response() };
|
|
195
|
-
}
|
|
196
|
-
// MOCK - Simulated attachToThread
|
|
197
|
-
/**
|
|
198
|
-
* Attach an artifact to a thread.
|
|
199
|
-
*/
|
|
200
|
-
async attachToThread(threadId, artifactId) {
|
|
201
|
-
// MOCK - Returns simulated data
|
|
202
|
-
const mockArtifact = {
|
|
203
|
-
id: artifactId,
|
|
204
|
-
name: "attached_file.pdf",
|
|
205
|
-
type: "document",
|
|
206
|
-
mime_type: "application/pdf",
|
|
207
|
-
size_bytes: 100000,
|
|
208
|
-
sha256: "attached_hash",
|
|
209
|
-
thread_id: threadId,
|
|
210
|
-
metadata: {},
|
|
211
|
-
signed: false,
|
|
212
|
-
created_at: new Date().toISOString(),
|
|
213
|
-
created_by: "user",
|
|
214
|
-
};
|
|
215
|
-
return { data: mockArtifact, error: undefined, response: new Response() };
|
|
46
|
+
/** @returns 501 Not Implemented */
|
|
47
|
+
async delete(artifactId) {
|
|
48
|
+
return notImplemented("delete");
|
|
216
49
|
}
|
|
217
50
|
}
|
|
@@ -1,104 +1,81 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Budgets Module - Cost
|
|
2
|
+
* Budgets Module - Cost & Token Management
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* Provides budget management, cost estimation, and spending limits.
|
|
7
|
-
* Critical for CFO happiness and auto-protection.
|
|
4
|
+
* NOT IMPLEMENTED - Backend endpoint not available.
|
|
5
|
+
* All methods return 501 NotImplemented.
|
|
8
6
|
*/
|
|
9
7
|
import type { RawClient, APIResponse } from "../client/raw.js";
|
|
10
|
-
export type
|
|
11
|
-
export type
|
|
8
|
+
export type BudgetScope = "agent" | "workspace" | "tenant" | "user";
|
|
9
|
+
export type BudgetPeriod = "daily" | "weekly" | "monthly" | "total";
|
|
10
|
+
export type BudgetResourceType = "tokens" | "cost" | "api_calls";
|
|
12
11
|
export interface Budget {
|
|
13
12
|
id: string;
|
|
14
13
|
name: string;
|
|
15
14
|
scope: BudgetScope;
|
|
16
15
|
scope_id: string;
|
|
16
|
+
resource_type: BudgetResourceType;
|
|
17
|
+
limit_value: number;
|
|
18
|
+
current_value: number;
|
|
17
19
|
period: BudgetPeriod;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
usage_percentage: number;
|
|
22
|
-
alert_thresholds: number[];
|
|
23
|
-
hard_limit: boolean;
|
|
20
|
+
period_start: string;
|
|
21
|
+
period_end: string;
|
|
22
|
+
alert_threshold_percent?: number;
|
|
24
23
|
created_at: string;
|
|
25
|
-
updated_at: string;
|
|
26
24
|
}
|
|
27
25
|
export interface BudgetUsage {
|
|
28
26
|
budget_id: string;
|
|
27
|
+
current_value: number;
|
|
28
|
+
limit_value: number;
|
|
29
|
+
percent_used: number;
|
|
30
|
+
remaining: number;
|
|
29
31
|
period_start: string;
|
|
30
32
|
period_end: string;
|
|
31
|
-
|
|
32
|
-
breakdown: BudgetBreakdown[];
|
|
33
|
-
}
|
|
34
|
-
export interface BudgetBreakdown {
|
|
35
|
-
category: string;
|
|
36
|
-
amount: number;
|
|
37
|
-
percentage: number;
|
|
38
|
-
run_count: number;
|
|
33
|
+
breakdown: BudgetBreakdownItem[];
|
|
39
34
|
}
|
|
40
|
-
export interface
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
input_tokens: number;
|
|
47
|
-
output_tokens: number;
|
|
48
|
-
tool_calls: number;
|
|
49
|
-
model_cost: number;
|
|
50
|
-
};
|
|
51
|
-
warnings: string[];
|
|
35
|
+
export interface BudgetBreakdownItem {
|
|
36
|
+
agent_id?: string;
|
|
37
|
+
agent_name?: string;
|
|
38
|
+
model?: string;
|
|
39
|
+
value: number;
|
|
40
|
+
percent_of_total: number;
|
|
52
41
|
}
|
|
53
|
-
export interface
|
|
54
|
-
|
|
55
|
-
|
|
42
|
+
export interface BudgetAlert {
|
|
43
|
+
id: string;
|
|
44
|
+
budget_id: string;
|
|
45
|
+
type: "threshold_warning" | "limit_reached" | "limit_exceeded";
|
|
46
|
+
message: string;
|
|
47
|
+
triggered_at: string;
|
|
48
|
+
acknowledged: boolean;
|
|
56
49
|
}
|
|
57
50
|
export declare class BudgetsModule {
|
|
58
51
|
private client;
|
|
59
52
|
private headers;
|
|
60
53
|
constructor(client: RawClient, headers: () => Record<string, string>);
|
|
61
|
-
/**
|
|
62
|
-
* List all budgets.
|
|
63
|
-
*/
|
|
54
|
+
/** @returns 501 Not Implemented */
|
|
64
55
|
list(params?: {
|
|
65
56
|
scope?: BudgetScope;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
57
|
+
scope_id?: string;
|
|
58
|
+
limit?: number;
|
|
59
|
+
offset?: number;
|
|
60
|
+
}): Promise<APIResponse<{
|
|
61
|
+
items: Budget[];
|
|
62
|
+
total: number;
|
|
63
|
+
}>>;
|
|
64
|
+
/** @returns 501 Not Implemented */
|
|
70
65
|
get(budgetId: string): Promise<APIResponse<Budget>>;
|
|
71
|
-
/**
|
|
72
|
-
|
|
73
|
-
*/
|
|
74
|
-
set(body: {
|
|
66
|
+
/** @returns 501 Not Implemented */
|
|
67
|
+
create(body: {
|
|
75
68
|
name: string;
|
|
76
69
|
scope: BudgetScope;
|
|
77
70
|
scope_id: string;
|
|
71
|
+
resource_type: BudgetResourceType;
|
|
72
|
+
limit_value: number;
|
|
78
73
|
period: BudgetPeriod;
|
|
79
|
-
|
|
80
|
-
currency?: string;
|
|
81
|
-
alert_thresholds?: number[];
|
|
82
|
-
hard_limit?: boolean;
|
|
74
|
+
alert_threshold_percent?: number;
|
|
83
75
|
}): Promise<APIResponse<Budget>>;
|
|
84
|
-
/**
|
|
85
|
-
* Get budget usage details.
|
|
86
|
-
*/
|
|
76
|
+
/** @returns 501 Not Implemented */
|
|
87
77
|
getUsage(budgetId: string): Promise<APIResponse<BudgetUsage>>;
|
|
88
|
-
/**
|
|
89
|
-
|
|
90
|
-
*/
|
|
91
|
-
estimateCost(params: {
|
|
92
|
-
agent_id: string;
|
|
93
|
-
input?: Record<string, unknown>;
|
|
94
|
-
max_iterations?: number;
|
|
95
|
-
}): Promise<APIResponse<CostEstimate>>;
|
|
96
|
-
/**
|
|
97
|
-
* Set a hard budget cap for a specific run.
|
|
98
|
-
*/
|
|
99
|
-
setBudgetForRun(runId: string, limit: number): Promise<APIResponse<{
|
|
100
|
-
run_id: string;
|
|
101
|
-
limit: number;
|
|
102
|
-
}>>;
|
|
78
|
+
/** @returns 501 Not Implemented */
|
|
79
|
+
getAlerts(budgetId: string): Promise<APIResponse<BudgetAlert[]>>;
|
|
103
80
|
}
|
|
104
81
|
//# sourceMappingURL=budgets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"budgets.d.ts","sourceRoot":"","sources":["../../src/modules/budgets.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"budgets.d.ts","sourceRoot":"","sources":["../../src/modules/budgets.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAM/D,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,WAAW,GAAG,QAAQ,GAAG,MAAM,CAAC;AACpE,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;AACpE,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;AAEjE,MAAM,WAAW,MAAM;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,WAAW,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,kBAAkB,CAAC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,YAAY,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,mBAAmB,EAAE,CAAC;CACpC;AAED,MAAM,WAAW,mBAAmB;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAA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,WAAW,CAAC,MAAM,CAAC,CAAC;IAIhC,mCAAmC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAInE,mCAAmC;IAC7B,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,CAAC;CAGzE"}
|
package/dist/modules/budgets.js
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Budgets Module - Cost
|
|
2
|
+
* Budgets Module - Cost & Token Management
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* Provides budget management, cost estimation, and spending limits.
|
|
7
|
-
* Critical for CFO happiness and auto-protection.
|
|
4
|
+
* NOT IMPLEMENTED - Backend endpoint not available.
|
|
5
|
+
* All methods return 501 NotImplemented.
|
|
8
6
|
*/
|
|
9
7
|
// ============================================================================
|
|
8
|
+
// Helper for 501 responses
|
|
9
|
+
// ============================================================================
|
|
10
|
+
function notImplemented(method) {
|
|
11
|
+
return {
|
|
12
|
+
data: undefined,
|
|
13
|
+
error: {
|
|
14
|
+
code: "NOT_IMPLEMENTED",
|
|
15
|
+
message: `BudgetsModule.${method}() is not implemented. Backend endpoint not available.`,
|
|
16
|
+
},
|
|
17
|
+
response: new Response(null, { status: 501, statusText: "Not Implemented" }),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
// ============================================================================
|
|
10
21
|
// Module
|
|
11
22
|
// ============================================================================
|
|
12
23
|
export class BudgetsModule {
|
|
@@ -16,146 +27,24 @@ export class BudgetsModule {
|
|
|
16
27
|
this.client = client;
|
|
17
28
|
this.headers = headers;
|
|
18
29
|
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* List all budgets.
|
|
22
|
-
*/
|
|
30
|
+
/** @returns 501 Not Implemented */
|
|
23
31
|
async list(params) {
|
|
24
|
-
|
|
25
|
-
const mockBudgets = {
|
|
26
|
-
items: [
|
|
27
|
-
{
|
|
28
|
-
id: "budget_tenant",
|
|
29
|
-
name: "Monthly Tenant Budget",
|
|
30
|
-
scope: "tenant",
|
|
31
|
-
scope_id: "tenant_123",
|
|
32
|
-
period: "monthly",
|
|
33
|
-
limit_amount: 5000,
|
|
34
|
-
currency: "USD",
|
|
35
|
-
current_usage: 1250.50,
|
|
36
|
-
usage_percentage: 25.01,
|
|
37
|
-
alert_thresholds: [50, 80, 90],
|
|
38
|
-
hard_limit: false,
|
|
39
|
-
created_at: new Date(Date.now() - 2592000000).toISOString(),
|
|
40
|
-
updated_at: new Date().toISOString(),
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
id: "budget_agent_1",
|
|
44
|
-
name: "Agent Daily Budget",
|
|
45
|
-
scope: "agent",
|
|
46
|
-
scope_id: "agent_support",
|
|
47
|
-
period: "daily",
|
|
48
|
-
limit_amount: 50,
|
|
49
|
-
currency: "USD",
|
|
50
|
-
current_usage: 12.30,
|
|
51
|
-
usage_percentage: 24.6,
|
|
52
|
-
alert_thresholds: [80, 95],
|
|
53
|
-
hard_limit: true,
|
|
54
|
-
created_at: new Date(Date.now() - 86400000).toISOString(),
|
|
55
|
-
updated_at: new Date().toISOString(),
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
total: 2,
|
|
59
|
-
};
|
|
60
|
-
return { data: mockBudgets, error: undefined, response: new Response() };
|
|
32
|
+
return notImplemented("list");
|
|
61
33
|
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Get a budget by ID.
|
|
65
|
-
*/
|
|
34
|
+
/** @returns 501 Not Implemented */
|
|
66
35
|
async get(budgetId) {
|
|
67
|
-
|
|
68
|
-
const mockBudget = {
|
|
69
|
-
id: budgetId,
|
|
70
|
-
name: "Monthly Tenant Budget",
|
|
71
|
-
scope: "tenant",
|
|
72
|
-
scope_id: "tenant_123",
|
|
73
|
-
period: "monthly",
|
|
74
|
-
limit_amount: 5000,
|
|
75
|
-
currency: "USD",
|
|
76
|
-
current_usage: 1250.50,
|
|
77
|
-
usage_percentage: 25.01,
|
|
78
|
-
alert_thresholds: [50, 80, 90],
|
|
79
|
-
hard_limit: false,
|
|
80
|
-
created_at: new Date(Date.now() - 2592000000).toISOString(),
|
|
81
|
-
updated_at: new Date().toISOString(),
|
|
82
|
-
};
|
|
83
|
-
return { data: mockBudget, error: undefined, response: new Response() };
|
|
36
|
+
return notImplemented("get");
|
|
84
37
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
*/
|
|
89
|
-
async set(body) {
|
|
90
|
-
// MOCK - Returns simulated data
|
|
91
|
-
const mockBudget = {
|
|
92
|
-
id: `budget_${Date.now()}`,
|
|
93
|
-
name: body.name,
|
|
94
|
-
scope: body.scope,
|
|
95
|
-
scope_id: body.scope_id,
|
|
96
|
-
period: body.period,
|
|
97
|
-
limit_amount: body.limit_amount,
|
|
98
|
-
currency: body.currency || "USD",
|
|
99
|
-
current_usage: 0,
|
|
100
|
-
usage_percentage: 0,
|
|
101
|
-
alert_thresholds: body.alert_thresholds || [80, 90],
|
|
102
|
-
hard_limit: body.hard_limit ?? false,
|
|
103
|
-
created_at: new Date().toISOString(),
|
|
104
|
-
updated_at: new Date().toISOString(),
|
|
105
|
-
};
|
|
106
|
-
return { data: mockBudget, error: undefined, response: new Response() };
|
|
38
|
+
/** @returns 501 Not Implemented */
|
|
39
|
+
async create(body) {
|
|
40
|
+
return notImplemented("create");
|
|
107
41
|
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Get budget usage details.
|
|
111
|
-
*/
|
|
42
|
+
/** @returns 501 Not Implemented */
|
|
112
43
|
async getUsage(budgetId) {
|
|
113
|
-
|
|
114
|
-
const mockUsage = {
|
|
115
|
-
budget_id: budgetId,
|
|
116
|
-
period_start: new Date(Date.now() - 2592000000).toISOString(),
|
|
117
|
-
period_end: new Date().toISOString(),
|
|
118
|
-
total_cost: 1250.50,
|
|
119
|
-
breakdown: [
|
|
120
|
-
{ category: "GPT-4", amount: 800.00, percentage: 63.97, run_count: 450 },
|
|
121
|
-
{ category: "Claude", amount: 300.50, percentage: 24.03, run_count: 200 },
|
|
122
|
-
{ category: "Embeddings", amount: 100.00, percentage: 8.00, run_count: 1000 },
|
|
123
|
-
{ category: "Tools", amount: 50.00, percentage: 4.00, run_count: 300 },
|
|
124
|
-
],
|
|
125
|
-
};
|
|
126
|
-
return { data: mockUsage, error: undefined, response: new Response() };
|
|
127
|
-
}
|
|
128
|
-
// MOCK - Simulated estimateCost
|
|
129
|
-
/**
|
|
130
|
-
* Estimate cost for a run before execution.
|
|
131
|
-
*/
|
|
132
|
-
async estimateCost(params) {
|
|
133
|
-
// MOCK - Returns simulated estimate
|
|
134
|
-
const mockEstimate = {
|
|
135
|
-
estimated_min: 0.05,
|
|
136
|
-
estimated_max: 0.25,
|
|
137
|
-
estimated_avg: 0.12,
|
|
138
|
-
currency: "USD",
|
|
139
|
-
breakdown: {
|
|
140
|
-
input_tokens: 2000,
|
|
141
|
-
output_tokens: 3000,
|
|
142
|
-
tool_calls: 5,
|
|
143
|
-
model_cost: 0.10,
|
|
144
|
-
},
|
|
145
|
-
warnings: [],
|
|
146
|
-
};
|
|
147
|
-
return { data: mockEstimate, error: undefined, response: new Response() };
|
|
44
|
+
return notImplemented("getUsage");
|
|
148
45
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
*/
|
|
153
|
-
async setBudgetForRun(runId, limit) {
|
|
154
|
-
// MOCK - Returns simulated data
|
|
155
|
-
return {
|
|
156
|
-
data: { run_id: runId, limit },
|
|
157
|
-
error: undefined,
|
|
158
|
-
response: new Response()
|
|
159
|
-
};
|
|
46
|
+
/** @returns 501 Not Implemented */
|
|
47
|
+
async getAlerts(budgetId) {
|
|
48
|
+
return notImplemented("getAlerts");
|
|
160
49
|
}
|
|
161
50
|
}
|
|
@@ -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
|
import { type SSEOptions } from "../sse/client.js";
|
|
8
28
|
export type BuilderChatRequest = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/modules/builder.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/modules/builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAA4B,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE7E,MAAM,MAAM,kBAAkB,GAAG;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE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