@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/index.ts
CHANGED
|
@@ -38,7 +38,19 @@
|
|
|
38
38
|
// ============================================================================
|
|
39
39
|
// Main Client
|
|
40
40
|
// ============================================================================
|
|
41
|
-
export { AgentOsClient, type AgentOsClientOptions } from "./client/AgentOsClient.js";
|
|
41
|
+
export { AgentOsClient, type AgentOsClientOptions, type AgentOsClientOptionsLegacy, type AuthProvider } from "./client/AgentOsClient.js";
|
|
42
|
+
|
|
43
|
+
// Auth Provider Types
|
|
44
|
+
export {
|
|
45
|
+
type ApiTokenAuth,
|
|
46
|
+
type JwtAuth,
|
|
47
|
+
isApiTokenAuth,
|
|
48
|
+
isJwtAuth,
|
|
49
|
+
isNewAuthOptions,
|
|
50
|
+
isBrowser,
|
|
51
|
+
isApiToken,
|
|
52
|
+
isJwtToken,
|
|
53
|
+
} from "./client/auth.js";
|
|
42
54
|
|
|
43
55
|
// ============================================================================
|
|
44
56
|
// Helpers & Utilities
|
|
@@ -74,7 +86,7 @@ export type { paths, components } from "./client/raw.js";
|
|
|
74
86
|
|
|
75
87
|
// Core modules
|
|
76
88
|
export { AgentsModule, type Agent, type AgentVersion, type AgentListResponse, type AgentGraphResponse } from "./modules/agents.js";
|
|
77
|
-
export { RunsModule, type Run, type RunEvent, type RunListResponse, type RunEventsResponse, type CreateRunResponse } from "./modules/runs.js";
|
|
89
|
+
export { RunsModule, type Run, type RunStatus, type RunEvent, type RunListResponse, type RunEventsResponse, type CreateRunResponse, type RunEventsPollResponse, type RunEventDto } from "./modules/runs.js";
|
|
78
90
|
export { ThreadsModule, type Thread, type ThreadState, type ThreadMessage, type ThreadRun, type ThreadListResponse, type ThreadMessagesResponse } from "./modules/threads.js";
|
|
79
91
|
export { ToolsModule, type Tool, type ToolListResponse } from "./modules/tools.js";
|
|
80
92
|
export { KnowledgeModule, type KnowledgeDataset, type KnowledgeSearchResponse } from "./modules/knowledge.js";
|
|
@@ -105,16 +117,16 @@ export { InfoModule, type ServerInfo } from "./modules/info.js";
|
|
|
105
117
|
export { MetricsModule, type MetricsResponse } from "./modules/metrics.js";
|
|
106
118
|
export { GraphsModule, type GraphValidationResult, type GraphIntrospectionResult } from "./modules/graphs.js";
|
|
107
119
|
|
|
108
|
-
//
|
|
120
|
+
// FUTURE modules - All return 501 Not Implemented. When backend is ready, implement real calls.
|
|
109
121
|
export { HandoffModule, type HandoffOptions, type HandoffResult, type ForkOptions, type ForkResult, type RunChain, type RunChainNode, type HandoffMode, type HandoffConstraints } from "./modules/handoff.js";
|
|
110
122
|
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
|
|
112
|
-
export { PoliciesModule, type Policy, type
|
|
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
|
|
115
|
-
export { DeploymentsModule, type Environment, type
|
|
116
|
-
export { IncidentsModule, type Incident, type IncidentSeverity, type IncidentStatus, type
|
|
117
|
-
export { ArtifactsModule, type Artifact, type ArtifactType, type
|
|
123
|
+
export { CapabilitiesModule, type Capability, type CapabilityType, type CapabilityTest, type CapabilityMatrix } from "./modules/capabilities.js";
|
|
124
|
+
export { PoliciesModule, type Policy, type PolicyScope, type PolicyEnforcement, type PolicyRule, type PolicyEvaluation, type PolicyEvaluationResult } from "./modules/policies.js";
|
|
125
|
+
export { ApprovalsModule, type Approval, type ApprovalStatus, type ApprovalRequest, type ApprovalDecision, type ApprovalListResponse } from "./modules/approvals.js";
|
|
126
|
+
export { BudgetsModule, type Budget, type BudgetPeriod, type BudgetScope, type BudgetResourceType, type BudgetUsage, type BudgetAlert, type BudgetBreakdownItem } from "./modules/budgets.js";
|
|
127
|
+
export { DeploymentsModule, type Environment, type Deployment, type DeploymentStatus, type DeploymentConfig, type DeploymentHealth } from "./modules/deployments.js";
|
|
128
|
+
export { IncidentsModule, type Incident, type IncidentSeverity, type IncidentStatus, type IncidentUpdate, type IncidentMetrics } from "./modules/incidents.js";
|
|
129
|
+
export { ArtifactsModule, type Artifact, type ArtifactType, type ArtifactUploadUrl } from "./modules/artifacts.js";
|
|
118
130
|
|
|
119
131
|
// ============================================================================
|
|
120
132
|
// SSE Streaming
|
package/src/modules/approvals.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Approvals Module - Human-in-the-Loop Native
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* Provides native support for approval workflows.
|
|
7
|
-
* Critical for production deployments with dangerous actions.
|
|
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";
|
|
@@ -27,7 +25,7 @@ export interface Approval {
|
|
|
27
25
|
responded_at?: string;
|
|
28
26
|
responded_by?: string;
|
|
29
27
|
expires_at?: string;
|
|
30
|
-
auto_approve_after?: number;
|
|
28
|
+
auto_approve_after?: number;
|
|
31
29
|
}
|
|
32
30
|
|
|
33
31
|
export interface ApprovalRequest {
|
|
@@ -52,6 +50,21 @@ export interface ApprovalDecision {
|
|
|
52
50
|
modified_payload?: Record<string, unknown>;
|
|
53
51
|
}
|
|
54
52
|
|
|
53
|
+
// ============================================================================
|
|
54
|
+
// Helper for 501 responses
|
|
55
|
+
// ============================================================================
|
|
56
|
+
|
|
57
|
+
function notImplemented<T>(method: string): APIResponse<T> {
|
|
58
|
+
return {
|
|
59
|
+
data: undefined,
|
|
60
|
+
error: {
|
|
61
|
+
code: "NOT_IMPLEMENTED",
|
|
62
|
+
message: `ApprovalsModule.${method}() is not implemented. Backend endpoint not available.`,
|
|
63
|
+
},
|
|
64
|
+
response: new Response(null, { status: 501, statusText: "Not Implemented" }),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
55
68
|
// ============================================================================
|
|
56
69
|
// Module
|
|
57
70
|
// ============================================================================
|
|
@@ -59,152 +72,38 @@ export interface ApprovalDecision {
|
|
|
59
72
|
export class ApprovalsModule {
|
|
60
73
|
constructor(private client: RawClient, private headers: () => Record<string, string>) { }
|
|
61
74
|
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* List all approvals.
|
|
65
|
-
*/
|
|
75
|
+
/** @returns 501 Not Implemented */
|
|
66
76
|
async list(params?: {
|
|
67
77
|
status?: ApprovalStatus;
|
|
68
78
|
run_id?: string;
|
|
69
79
|
limit?: number;
|
|
70
80
|
offset?: number;
|
|
71
81
|
}): Promise<APIResponse<ApprovalListResponse>> {
|
|
72
|
-
|
|
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() };
|
|
82
|
+
return notImplemented<ApprovalListResponse>("list");
|
|
107
83
|
}
|
|
108
84
|
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Get an approval by ID.
|
|
112
|
-
*/
|
|
85
|
+
/** @returns 501 Not Implemented */
|
|
113
86
|
async get(approvalId: string): Promise<APIResponse<Approval>> {
|
|
114
|
-
|
|
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() };
|
|
87
|
+
return notImplemented<Approval>("get");
|
|
128
88
|
}
|
|
129
89
|
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Create a new approval request.
|
|
133
|
-
*/
|
|
90
|
+
/** @returns 501 Not Implemented */
|
|
134
91
|
async create(request: ApprovalRequest): Promise<APIResponse<Approval>> {
|
|
135
|
-
|
|
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() };
|
|
92
|
+
return notImplemented<Approval>("create");
|
|
149
93
|
}
|
|
150
94
|
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Approve an action.
|
|
154
|
-
*/
|
|
95
|
+
/** @returns 501 Not Implemented */
|
|
155
96
|
async approve(approvalId: string, reason?: string): Promise<APIResponse<Approval>> {
|
|
156
|
-
|
|
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() };
|
|
97
|
+
return notImplemented<Approval>("approve");
|
|
169
98
|
}
|
|
170
99
|
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Reject an action.
|
|
174
|
-
*/
|
|
100
|
+
/** @returns 501 Not Implemented */
|
|
175
101
|
async reject(approvalId: string, reason?: string): Promise<APIResponse<Approval>> {
|
|
176
|
-
|
|
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() };
|
|
102
|
+
return notImplemented<Approval>("reject");
|
|
189
103
|
}
|
|
190
104
|
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Wait for approval on a run (blocks until resolved or timeout).
|
|
194
|
-
*/
|
|
105
|
+
/** @returns 501 Not Implemented */
|
|
195
106
|
async awaitApproval(runId: string, timeoutSeconds?: number): Promise<APIResponse<Approval>> {
|
|
196
|
-
|
|
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() };
|
|
107
|
+
return notImplemented<Approval>("awaitApproval");
|
|
209
108
|
}
|
|
210
109
|
}
|
package/src/modules/artifacts.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Artifacts Module - Output Management
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* Manages artifacts as first-class outputs with integrity,
|
|
7
|
-
* lineage tracking, and signatures.
|
|
2
|
+
* Artifacts Module - Run Output 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,50 +11,42 @@ import type { RawClient, APIResponse } from "../client/raw.js";
|
|
|
13
11
|
// Types
|
|
14
12
|
// ============================================================================
|
|
15
13
|
|
|
16
|
-
export type ArtifactType = "file" | "image" | "
|
|
14
|
+
export type ArtifactType = "file" | "image" | "json" | "text" | "log" | "report";
|
|
17
15
|
|
|
18
16
|
export interface Artifact {
|
|
19
17
|
id: string;
|
|
18
|
+
run_id: string;
|
|
20
19
|
name: string;
|
|
21
20
|
type: ArtifactType;
|
|
22
|
-
mime_type
|
|
21
|
+
mime_type?: string;
|
|
23
22
|
size_bytes: number;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
metadata: Record<string, unknown>;
|
|
29
|
-
signed: boolean;
|
|
30
|
-
signature?: string;
|
|
23
|
+
checksum?: string;
|
|
24
|
+
download_url?: string;
|
|
25
|
+
preview_url?: string;
|
|
26
|
+
metadata?: Record<string, unknown>;
|
|
31
27
|
created_at: string;
|
|
32
|
-
|
|
28
|
+
expires_at?: string;
|
|
33
29
|
}
|
|
34
30
|
|
|
35
|
-
export interface
|
|
31
|
+
export interface ArtifactUploadUrl {
|
|
32
|
+
upload_url: string;
|
|
36
33
|
artifact_id: string;
|
|
37
|
-
|
|
38
|
-
transformations: LineageTransformation[];
|
|
39
|
-
dependencies: string[];
|
|
34
|
+
expires_at: string;
|
|
40
35
|
}
|
|
41
36
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
}
|
|
37
|
+
// ============================================================================
|
|
38
|
+
// Helper for 501 responses
|
|
39
|
+
// ============================================================================
|
|
56
40
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
41
|
+
function notImplemented<T>(method: string): APIResponse<T> {
|
|
42
|
+
return {
|
|
43
|
+
data: undefined,
|
|
44
|
+
error: {
|
|
45
|
+
code: "NOT_IMPLEMENTED",
|
|
46
|
+
message: `ArtifactsModule.${method}() is not implemented. Backend endpoint not available.`,
|
|
47
|
+
},
|
|
48
|
+
response: new Response(null, { status: 501, statusText: "Not Implemented" }),
|
|
49
|
+
};
|
|
60
50
|
}
|
|
61
51
|
|
|
62
52
|
// ============================================================================
|
|
@@ -66,222 +56,28 @@ export interface ArtifactListResponse {
|
|
|
66
56
|
export class ArtifactsModule {
|
|
67
57
|
constructor(private client: RawClient, private headers: () => Record<string, string>) { }
|
|
68
58
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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() };
|
|
59
|
+
/** @returns 501 Not Implemented */
|
|
60
|
+
async list(runId: string): Promise<APIResponse<{ items: Artifact[]; total: number }>> {
|
|
61
|
+
return notImplemented<{ items: Artifact[]; total: number }>("list");
|
|
115
62
|
}
|
|
116
63
|
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Get an artifact by ID.
|
|
120
|
-
*/
|
|
64
|
+
/** @returns 501 Not Implemented */
|
|
121
65
|
async get(artifactId: string): Promise<APIResponse<Artifact>> {
|
|
122
|
-
|
|
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() };
|
|
66
|
+
return notImplemented<Artifact>("get");
|
|
139
67
|
}
|
|
140
68
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
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() };
|
|
69
|
+
/** @returns 501 Not Implemented */
|
|
70
|
+
async getDownloadUrl(artifactId: string): Promise<APIResponse<{ url: string; expires_at: string }>> {
|
|
71
|
+
return notImplemented<{ url: string; expires_at: string }>("getDownloadUrl");
|
|
171
72
|
}
|
|
172
73
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
*/
|
|
177
|
-
async delete(artifactId: string): Promise<APIResponse<void>> {
|
|
178
|
-
// MOCK - Returns success
|
|
179
|
-
return { data: undefined, error: undefined, response: new Response() };
|
|
74
|
+
/** @returns 501 Not Implemented */
|
|
75
|
+
async createUploadUrl(runId: string, name: string, type: ArtifactType): Promise<APIResponse<ArtifactUploadUrl>> {
|
|
76
|
+
return notImplemented<ArtifactUploadUrl>("createUploadUrl");
|
|
180
77
|
}
|
|
181
78
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
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() };
|
|
79
|
+
/** @returns 501 Not Implemented */
|
|
80
|
+
async delete(artifactId: string): Promise<APIResponse<void>> {
|
|
81
|
+
return notImplemented<void>("delete");
|
|
286
82
|
}
|
|
287
83
|
}
|