@agent-os-sdk/client 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/AgentOsClient.d.ts +28 -4
- package/dist/client/AgentOsClient.d.ts.map +1 -1
- package/dist/client/AgentOsClient.js +40 -3
- package/dist/generated/openapi.d.ts +104 -2
- package/dist/generated/openapi.d.ts.map +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/modules/approvals.d.ts +78 -0
- package/dist/modules/approvals.d.ts.map +1 -0
- package/dist/modules/approvals.js +157 -0
- package/dist/modules/artifacts.d.ts +100 -0
- package/dist/modules/artifacts.d.ts.map +1 -0
- package/dist/modules/artifacts.js +217 -0
- package/dist/modules/budgets.d.ts +104 -0
- package/dist/modules/budgets.d.ts.map +1 -0
- package/dist/modules/budgets.js +161 -0
- package/dist/modules/builder.d.ts +2 -2
- package/dist/modules/builder.d.ts.map +1 -1
- package/dist/modules/builder.js +5 -5
- package/dist/modules/capabilities.d.ts +68 -0
- package/dist/modules/capabilities.d.ts.map +1 -0
- package/dist/modules/capabilities.js +113 -0
- package/dist/modules/deployments.d.ts +110 -0
- package/dist/modules/deployments.d.ts.map +1 -0
- package/dist/modules/deployments.js +230 -0
- package/dist/modules/flows.d.ts +104 -0
- package/dist/modules/flows.d.ts.map +1 -0
- package/dist/modules/flows.js +190 -0
- package/dist/modules/handoff.d.ts +88 -0
- package/dist/modules/handoff.d.ts.map +1 -0
- package/dist/modules/handoff.js +128 -0
- package/dist/modules/incidents.d.ts +133 -0
- package/dist/modules/incidents.d.ts.map +1 -0
- package/dist/modules/incidents.js +231 -0
- package/dist/modules/members.d.ts +5 -0
- package/dist/modules/members.d.ts.map +1 -1
- package/dist/modules/members.js +10 -0
- package/dist/modules/policies.d.ts +103 -0
- package/dist/modules/policies.d.ts.map +1 -0
- package/dist/modules/policies.js +180 -0
- package/dist/modules/runs.d.ts.map +1 -1
- package/dist/modules/tenants.d.ts +4 -0
- package/dist/modules/tenants.d.ts.map +1 -1
- package/dist/modules/tenants.js +8 -0
- package/package.json +2 -2
- package/src/client/AgentOsClient.ts +45 -7
- package/src/generated/openapi.ts +104 -2
- package/src/generated/swagger.json +116 -10
- package/src/index.ts +11 -0
- package/src/modules/approvals.ts +210 -0
- package/src/modules/artifacts.ts +287 -0
- package/src/modules/budgets.ts +236 -0
- package/src/modules/builder.ts +3 -3
- package/src/modules/capabilities.ts +176 -0
- package/src/modules/deployments.ts +315 -0
- package/src/modules/flows.ts +259 -0
- package/src/modules/handoff.ts +204 -0
- package/src/modules/incidents.ts +339 -0
- package/src/modules/members.ts +11 -0
- package/src/modules/policies.ts +258 -0
- package/src/modules/tenants.ts +9 -0
|
@@ -177,6 +177,7 @@
|
|
|
177
177
|
"tags": [
|
|
178
178
|
"Agents"
|
|
179
179
|
],
|
|
180
|
+
"summary": "Get agent by ID with tenant isolation (IDOR protected)",
|
|
180
181
|
"parameters": [
|
|
181
182
|
{
|
|
182
183
|
"name": "id",
|
|
@@ -198,6 +199,7 @@
|
|
|
198
199
|
"tags": [
|
|
199
200
|
"Agents"
|
|
200
201
|
],
|
|
202
|
+
"summary": "Update agent by ID with tenant isolation (IDOR protected)",
|
|
201
203
|
"parameters": [
|
|
202
204
|
{
|
|
203
205
|
"name": "id",
|
|
@@ -238,6 +240,7 @@
|
|
|
238
240
|
"tags": [
|
|
239
241
|
"Agents"
|
|
240
242
|
],
|
|
243
|
+
"summary": "Delete agent by ID with tenant isolation (IDOR protected)",
|
|
241
244
|
"parameters": [
|
|
242
245
|
{
|
|
243
246
|
"name": "id",
|
|
@@ -359,6 +362,7 @@
|
|
|
359
362
|
"tags": [
|
|
360
363
|
"AgentVersions"
|
|
361
364
|
],
|
|
365
|
+
"summary": "Create agent version with tenant isolation (IDOR protected)",
|
|
362
366
|
"parameters": [
|
|
363
367
|
{
|
|
364
368
|
"name": "agentId",
|
|
@@ -399,6 +403,7 @@
|
|
|
399
403
|
"tags": [
|
|
400
404
|
"AgentVersions"
|
|
401
405
|
],
|
|
406
|
+
"summary": "List agent versions with tenant isolation (IDOR protected)",
|
|
402
407
|
"parameters": [
|
|
403
408
|
{
|
|
404
409
|
"name": "agentId",
|
|
@@ -422,6 +427,7 @@
|
|
|
422
427
|
"tags": [
|
|
423
428
|
"AgentVersions"
|
|
424
429
|
],
|
|
430
|
+
"summary": "Get specific version with tenant isolation (IDOR protected)",
|
|
425
431
|
"parameters": [
|
|
426
432
|
{
|
|
427
433
|
"name": "agentId",
|
|
@@ -718,6 +724,92 @@
|
|
|
718
724
|
}
|
|
719
725
|
}
|
|
720
726
|
},
|
|
727
|
+
"/v1/api/builder/{agentId}/chat": {
|
|
728
|
+
"post": {
|
|
729
|
+
"tags": [
|
|
730
|
+
"Builder"
|
|
731
|
+
],
|
|
732
|
+
"summary": "Chat with the Meta-Agent to modify an agent's graph.\nReturns SSE stream: message, graph_update, done events.",
|
|
733
|
+
"parameters": [
|
|
734
|
+
{
|
|
735
|
+
"name": "agentId",
|
|
736
|
+
"in": "path",
|
|
737
|
+
"required": true,
|
|
738
|
+
"schema": {
|
|
739
|
+
"type": "string",
|
|
740
|
+
"format": "uuid"
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
],
|
|
744
|
+
"requestBody": {
|
|
745
|
+
"content": {
|
|
746
|
+
"application/json": {
|
|
747
|
+
"schema": {
|
|
748
|
+
"$ref": "#/components/schemas/BuilderChatRequest"
|
|
749
|
+
}
|
|
750
|
+
},
|
|
751
|
+
"text/json": {
|
|
752
|
+
"schema": {
|
|
753
|
+
"$ref": "#/components/schemas/BuilderChatRequest"
|
|
754
|
+
}
|
|
755
|
+
},
|
|
756
|
+
"application/*+json": {
|
|
757
|
+
"schema": {
|
|
758
|
+
"$ref": "#/components/schemas/BuilderChatRequest"
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
},
|
|
763
|
+
"responses": {
|
|
764
|
+
"200": {
|
|
765
|
+
"description": "OK"
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
},
|
|
770
|
+
"/v1/api/builder/{agentId}/chat/sync": {
|
|
771
|
+
"post": {
|
|
772
|
+
"tags": [
|
|
773
|
+
"Builder"
|
|
774
|
+
],
|
|
775
|
+
"summary": "Synchronous version of builder chat (for testing).",
|
|
776
|
+
"parameters": [
|
|
777
|
+
{
|
|
778
|
+
"name": "agentId",
|
|
779
|
+
"in": "path",
|
|
780
|
+
"required": true,
|
|
781
|
+
"schema": {
|
|
782
|
+
"type": "string",
|
|
783
|
+
"format": "uuid"
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
],
|
|
787
|
+
"requestBody": {
|
|
788
|
+
"content": {
|
|
789
|
+
"application/json": {
|
|
790
|
+
"schema": {
|
|
791
|
+
"$ref": "#/components/schemas/BuilderChatRequest"
|
|
792
|
+
}
|
|
793
|
+
},
|
|
794
|
+
"text/json": {
|
|
795
|
+
"schema": {
|
|
796
|
+
"$ref": "#/components/schemas/BuilderChatRequest"
|
|
797
|
+
}
|
|
798
|
+
},
|
|
799
|
+
"application/*+json": {
|
|
800
|
+
"schema": {
|
|
801
|
+
"$ref": "#/components/schemas/BuilderChatRequest"
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
},
|
|
806
|
+
"responses": {
|
|
807
|
+
"200": {
|
|
808
|
+
"description": "OK"
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
},
|
|
721
813
|
"/v1/api/workspaces/{workspaceId}/runs/{runId}/checkpoints": {
|
|
722
814
|
"get": {
|
|
723
815
|
"tags": [
|
|
@@ -1073,14 +1165,6 @@
|
|
|
1073
1165
|
"type": "string",
|
|
1074
1166
|
"format": "uuid"
|
|
1075
1167
|
}
|
|
1076
|
-
},
|
|
1077
|
-
{
|
|
1078
|
-
"name": "X-Tenant-Id",
|
|
1079
|
-
"in": "header",
|
|
1080
|
-
"schema": {
|
|
1081
|
-
"type": "string",
|
|
1082
|
-
"format": "uuid"
|
|
1083
|
-
}
|
|
1084
1168
|
}
|
|
1085
1169
|
],
|
|
1086
1170
|
"requestBody": {
|
|
@@ -3436,7 +3520,7 @@
|
|
|
3436
3520
|
"tags": [
|
|
3437
3521
|
"Runs"
|
|
3438
3522
|
],
|
|
3439
|
-
"summary": "Retrieves the status and details of a specific run.",
|
|
3523
|
+
"summary": "Retrieves the status and details of a specific run with tenant isolation (IDOR protected).",
|
|
3440
3524
|
"parameters": [
|
|
3441
3525
|
{
|
|
3442
3526
|
"name": "runId",
|
|
@@ -6561,6 +6645,24 @@
|
|
|
6561
6645
|
},
|
|
6562
6646
|
"additionalProperties": false
|
|
6563
6647
|
},
|
|
6648
|
+
"BuilderChatRequest": {
|
|
6649
|
+
"type": "object",
|
|
6650
|
+
"properties": {
|
|
6651
|
+
"message": {
|
|
6652
|
+
"type": "string",
|
|
6653
|
+
"nullable": true
|
|
6654
|
+
},
|
|
6655
|
+
"current_graph_spec": {
|
|
6656
|
+
"nullable": true
|
|
6657
|
+
},
|
|
6658
|
+
"thread_id": {
|
|
6659
|
+
"type": "string",
|
|
6660
|
+
"nullable": true
|
|
6661
|
+
}
|
|
6662
|
+
},
|
|
6663
|
+
"additionalProperties": false,
|
|
6664
|
+
"description": "Request DTO for builder chat."
|
|
6665
|
+
},
|
|
6564
6666
|
"CancelRequest": {
|
|
6565
6667
|
"type": "object",
|
|
6566
6668
|
"properties": {
|
|
@@ -7444,7 +7546,8 @@
|
|
|
7444
7546
|
"nullable": true
|
|
7445
7547
|
}
|
|
7446
7548
|
},
|
|
7447
|
-
"additionalProperties": false
|
|
7549
|
+
"additionalProperties": false,
|
|
7550
|
+
"description": "Playground request - note: TenantId/WorkspaceId from body are IGNORED,\nwe use IRequestContext for security."
|
|
7448
7551
|
},
|
|
7449
7552
|
"PresignedDownloadResponse": {
|
|
7450
7553
|
"type": "object",
|
|
@@ -8470,6 +8573,9 @@
|
|
|
8470
8573
|
{
|
|
8471
8574
|
"name": "Audit"
|
|
8472
8575
|
},
|
|
8576
|
+
{
|
|
8577
|
+
"name": "Builder"
|
|
8578
|
+
},
|
|
8473
8579
|
{
|
|
8474
8580
|
"name": "Checkpoints"
|
|
8475
8581
|
},
|
package/src/index.ts
CHANGED
|
@@ -105,6 +105,17 @@ export { InfoModule, type ServerInfo } from "./modules/info.js";
|
|
|
105
105
|
export { MetricsModule, type MetricsResponse } from "./modules/metrics.js";
|
|
106
106
|
export { GraphsModule, type GraphValidationResult, type GraphIntrospectionResult } from "./modules/graphs.js";
|
|
107
107
|
|
|
108
|
+
// MOCK - Future modules (marked for replacement when backend is ready)
|
|
109
|
+
export { HandoffModule, type HandoffOptions, type HandoffResult, type ForkOptions, type ForkResult, type RunChain, type RunChainNode, type HandoffMode, type HandoffConstraints } from "./modules/handoff.js";
|
|
110
|
+
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 CapabilityConfig, type CapabilitySet, type CapabilityOverride } from "./modules/capabilities.js";
|
|
112
|
+
export { PoliciesModule, type Policy, type PolicyType, type PolicyScope, type PolicyCondition, type PolicyAction, type PolicyEvaluationInput, type PolicyEvaluationResult, type PolicyListResponse } from "./modules/policies.js";
|
|
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 BudgetUsage, type BudgetBreakdown, type CostEstimate, type BudgetListResponse } from "./modules/budgets.js";
|
|
115
|
+
export { DeploymentsModule, type Environment, type EnvironmentType, type Deployment, type DeploymentStatus, type DeploymentDiff, type EnvironmentListResponse, type DeploymentListResponse } from "./modules/deployments.js";
|
|
116
|
+
export { IncidentsModule, type Incident, type IncidentSeverity, type IncidentStatus, type SLO, type Postmortem, type PostmortemEvent, type ActionItem, type IncidentListResponse, type SLOListResponse } from "./modules/incidents.js";
|
|
117
|
+
export { ArtifactsModule, type Artifact, type ArtifactType, type ArtifactLineage, type LineageSource, type LineageTransformation, type ArtifactListResponse } from "./modules/artifacts.js";
|
|
118
|
+
|
|
108
119
|
// ============================================================================
|
|
109
120
|
// SSE Streaming
|
|
110
121
|
// ============================================================================
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Approvals Module - Human-in-the-Loop Native
|
|
3
|
+
*
|
|
4
|
+
* // MOCK - This module contains mock implementations for future features
|
|
5
|
+
*
|
|
6
|
+
* Provides native support for approval workflows.
|
|
7
|
+
* Critical for production deployments with dangerous actions.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { RawClient, APIResponse } from "../client/raw.js";
|
|
11
|
+
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// Types
|
|
14
|
+
// ============================================================================
|
|
15
|
+
|
|
16
|
+
export type ApprovalStatus = "pending" | "approved" | "rejected" | "expired" | "auto_approved";
|
|
17
|
+
|
|
18
|
+
export interface Approval {
|
|
19
|
+
id: string;
|
|
20
|
+
run_id: string;
|
|
21
|
+
thread_id?: string;
|
|
22
|
+
action: string;
|
|
23
|
+
payload: Record<string, unknown>;
|
|
24
|
+
status: ApprovalStatus;
|
|
25
|
+
reason?: string;
|
|
26
|
+
requested_at: string;
|
|
27
|
+
responded_at?: string;
|
|
28
|
+
responded_by?: string;
|
|
29
|
+
expires_at?: string;
|
|
30
|
+
auto_approve_after?: number; // seconds
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface ApprovalRequest {
|
|
34
|
+
run_id: string;
|
|
35
|
+
action: string;
|
|
36
|
+
payload: Record<string, unknown>;
|
|
37
|
+
expires_in_seconds?: number;
|
|
38
|
+
auto_approve_after_seconds?: number;
|
|
39
|
+
notify_channels?: string[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface ApprovalListResponse {
|
|
43
|
+
items: Approval[];
|
|
44
|
+
total: number;
|
|
45
|
+
pending_count: number;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface ApprovalDecision {
|
|
49
|
+
approval_id: string;
|
|
50
|
+
decision: "approve" | "reject";
|
|
51
|
+
reason?: string;
|
|
52
|
+
modified_payload?: Record<string, unknown>;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// ============================================================================
|
|
56
|
+
// Module
|
|
57
|
+
// ============================================================================
|
|
58
|
+
|
|
59
|
+
export class ApprovalsModule {
|
|
60
|
+
constructor(private client: RawClient, private headers: () => Record<string, string>) { }
|
|
61
|
+
|
|
62
|
+
// MOCK - Simulated list
|
|
63
|
+
/**
|
|
64
|
+
* List all approvals.
|
|
65
|
+
*/
|
|
66
|
+
async list(params?: {
|
|
67
|
+
status?: ApprovalStatus;
|
|
68
|
+
run_id?: string;
|
|
69
|
+
limit?: number;
|
|
70
|
+
offset?: number;
|
|
71
|
+
}): Promise<APIResponse<ApprovalListResponse>> {
|
|
72
|
+
// MOCK - Returns simulated data
|
|
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() };
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// MOCK - Simulated get
|
|
110
|
+
/**
|
|
111
|
+
* Get an approval by ID.
|
|
112
|
+
*/
|
|
113
|
+
async get(approvalId: string): Promise<APIResponse<Approval>> {
|
|
114
|
+
// MOCK - Returns simulated data
|
|
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() };
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// MOCK - Simulated create
|
|
131
|
+
/**
|
|
132
|
+
* Create a new approval request.
|
|
133
|
+
*/
|
|
134
|
+
async create(request: ApprovalRequest): Promise<APIResponse<Approval>> {
|
|
135
|
+
// MOCK - Returns simulated data
|
|
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() };
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// MOCK - Simulated approve
|
|
152
|
+
/**
|
|
153
|
+
* Approve an action.
|
|
154
|
+
*/
|
|
155
|
+
async approve(approvalId: string, reason?: string): Promise<APIResponse<Approval>> {
|
|
156
|
+
// MOCK - Returns simulated data
|
|
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() };
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// MOCK - Simulated reject
|
|
172
|
+
/**
|
|
173
|
+
* Reject an action.
|
|
174
|
+
*/
|
|
175
|
+
async reject(approvalId: string, reason?: string): Promise<APIResponse<Approval>> {
|
|
176
|
+
// MOCK - Returns simulated data
|
|
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() };
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// MOCK - Simulated await
|
|
192
|
+
/**
|
|
193
|
+
* Wait for approval on a run (blocks until resolved or timeout).
|
|
194
|
+
*/
|
|
195
|
+
async awaitApproval(runId: string, timeoutSeconds?: number): Promise<APIResponse<Approval>> {
|
|
196
|
+
// MOCK - Returns simulated pending approval
|
|
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() };
|
|
209
|
+
}
|
|
210
|
+
}
|