@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
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capabilities Module - Agent Permissions System
|
|
3
|
+
*
|
|
4
|
+
* // MOCK - This module contains mock implementations for future features
|
|
5
|
+
*
|
|
6
|
+
* Manages what agents/runs can do. Formal capability system
|
|
7
|
+
* that enables enterprise-grade governance.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { RawClient, APIResponse } from "../client/raw.js";
|
|
11
|
+
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// Types
|
|
14
|
+
// ============================================================================
|
|
15
|
+
|
|
16
|
+
export interface Capability {
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
type: "tool" | "network" | "file" | "mcp" | "token" | "custom";
|
|
21
|
+
config: CapabilityConfig;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface CapabilityConfig {
|
|
25
|
+
// Tool capabilities
|
|
26
|
+
tool_allowlist?: string[];
|
|
27
|
+
tool_denylist?: string[];
|
|
28
|
+
max_tool_calls?: number;
|
|
29
|
+
|
|
30
|
+
// Network capabilities
|
|
31
|
+
allowed_domains?: string[];
|
|
32
|
+
blocked_domains?: string[];
|
|
33
|
+
allow_egress?: boolean;
|
|
34
|
+
|
|
35
|
+
// File capabilities
|
|
36
|
+
file_read?: boolean;
|
|
37
|
+
file_write?: boolean;
|
|
38
|
+
allowed_paths?: string[];
|
|
39
|
+
|
|
40
|
+
// MCP capabilities
|
|
41
|
+
mcp_server_allowlist?: string[];
|
|
42
|
+
|
|
43
|
+
// Token/cost capabilities
|
|
44
|
+
max_tokens?: number;
|
|
45
|
+
max_input_tokens?: number;
|
|
46
|
+
max_output_tokens?: number;
|
|
47
|
+
|
|
48
|
+
// Streaming
|
|
49
|
+
streaming_allowed?: boolean;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface CapabilitySet {
|
|
53
|
+
agent_id?: string;
|
|
54
|
+
run_id?: string;
|
|
55
|
+
capabilities: Capability[];
|
|
56
|
+
inherited_from?: string;
|
|
57
|
+
effective_at: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface CapabilityOverride {
|
|
61
|
+
run_id: string;
|
|
62
|
+
overrides: Partial<CapabilityConfig>;
|
|
63
|
+
reason?: string;
|
|
64
|
+
applied_at: string;
|
|
65
|
+
applied_by: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// ============================================================================
|
|
69
|
+
// Module
|
|
70
|
+
// ============================================================================
|
|
71
|
+
|
|
72
|
+
export class CapabilitiesModule {
|
|
73
|
+
constructor(private client: RawClient, private headers: () => Record<string, string>) { }
|
|
74
|
+
|
|
75
|
+
// MOCK - Simulated get for agent
|
|
76
|
+
/**
|
|
77
|
+
* Get capabilities for an agent.
|
|
78
|
+
*/
|
|
79
|
+
async getForAgent(agentId: string): Promise<APIResponse<CapabilitySet>> {
|
|
80
|
+
// MOCK - Returns simulated data
|
|
81
|
+
const mockCaps: CapabilitySet = {
|
|
82
|
+
agent_id: agentId,
|
|
83
|
+
capabilities: [
|
|
84
|
+
{
|
|
85
|
+
id: "cap_tools",
|
|
86
|
+
name: "Tool Access",
|
|
87
|
+
type: "tool",
|
|
88
|
+
config: {
|
|
89
|
+
tool_allowlist: ["web_search", "calculator", "file_read"],
|
|
90
|
+
max_tool_calls: 50,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
id: "cap_network",
|
|
95
|
+
name: "Network Access",
|
|
96
|
+
type: "network",
|
|
97
|
+
config: {
|
|
98
|
+
allow_egress: true,
|
|
99
|
+
allowed_domains: ["*.google.com", "*.openai.com"],
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
id: "cap_tokens",
|
|
104
|
+
name: "Token Limits",
|
|
105
|
+
type: "token",
|
|
106
|
+
config: {
|
|
107
|
+
max_tokens: 100000,
|
|
108
|
+
max_input_tokens: 50000,
|
|
109
|
+
max_output_tokens: 50000,
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
effective_at: new Date().toISOString(),
|
|
114
|
+
};
|
|
115
|
+
return { data: mockCaps, error: undefined, response: new Response() };
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// MOCK - Simulated set for agent
|
|
119
|
+
/**
|
|
120
|
+
* Set capabilities for an agent.
|
|
121
|
+
*/
|
|
122
|
+
async setForAgent(agentId: string, capabilities: Capability[]): Promise<APIResponse<CapabilitySet>> {
|
|
123
|
+
// MOCK - Returns simulated data
|
|
124
|
+
const mockCaps: CapabilitySet = {
|
|
125
|
+
agent_id: agentId,
|
|
126
|
+
capabilities,
|
|
127
|
+
effective_at: new Date().toISOString(),
|
|
128
|
+
};
|
|
129
|
+
return { data: mockCaps, error: undefined, response: new Response() };
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// MOCK - Simulated get for run
|
|
133
|
+
/**
|
|
134
|
+
* Get effective capabilities for a run.
|
|
135
|
+
*/
|
|
136
|
+
async getForRun(runId: string): Promise<APIResponse<CapabilitySet>> {
|
|
137
|
+
// MOCK - Returns simulated data
|
|
138
|
+
const mockCaps: CapabilitySet = {
|
|
139
|
+
run_id: runId,
|
|
140
|
+
capabilities: [
|
|
141
|
+
{
|
|
142
|
+
id: "cap_tools",
|
|
143
|
+
name: "Tool Access",
|
|
144
|
+
type: "tool",
|
|
145
|
+
config: {
|
|
146
|
+
tool_allowlist: ["web_search"],
|
|
147
|
+
max_tool_calls: 10,
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
inherited_from: "agent_123",
|
|
152
|
+
effective_at: new Date().toISOString(),
|
|
153
|
+
};
|
|
154
|
+
return { data: mockCaps, error: undefined, response: new Response() };
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// MOCK - Simulated override for run
|
|
158
|
+
/**
|
|
159
|
+
* Override capabilities for a specific run.
|
|
160
|
+
*/
|
|
161
|
+
async overrideForRun(
|
|
162
|
+
runId: string,
|
|
163
|
+
overrides: Partial<CapabilityConfig>,
|
|
164
|
+
reason?: string
|
|
165
|
+
): Promise<APIResponse<CapabilityOverride>> {
|
|
166
|
+
// MOCK - Returns simulated data
|
|
167
|
+
const mockOverride: CapabilityOverride = {
|
|
168
|
+
run_id: runId,
|
|
169
|
+
overrides,
|
|
170
|
+
reason,
|
|
171
|
+
applied_at: new Date().toISOString(),
|
|
172
|
+
applied_by: "user_123",
|
|
173
|
+
};
|
|
174
|
+
return { data: mockOverride, error: undefined, response: new Response() };
|
|
175
|
+
}
|
|
176
|
+
}
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deployments Module - Release Management
|
|
3
|
+
*
|
|
4
|
+
* // MOCK - This module contains mock implementations for future features
|
|
5
|
+
*
|
|
6
|
+
* Provides deployment management, environment promotion,
|
|
7
|
+
* rollback, canary releases, and change freezes.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { RawClient, APIResponse } from "../client/raw.js";
|
|
11
|
+
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// Types
|
|
14
|
+
// ============================================================================
|
|
15
|
+
|
|
16
|
+
export type DeploymentStatus = "pending" | "deploying" | "active" | "rolling_back" | "rolled_back" | "failed";
|
|
17
|
+
export type EnvironmentType = "development" | "staging" | "production" | "custom";
|
|
18
|
+
|
|
19
|
+
export interface Environment {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
type: EnvironmentType;
|
|
23
|
+
description?: string;
|
|
24
|
+
is_frozen: boolean;
|
|
25
|
+
frozen_until?: string;
|
|
26
|
+
frozen_reason?: string;
|
|
27
|
+
config: Record<string, unknown>;
|
|
28
|
+
created_at: string;
|
|
29
|
+
updated_at: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface Deployment {
|
|
33
|
+
id: string;
|
|
34
|
+
agent_id: string;
|
|
35
|
+
agent_version_id: string;
|
|
36
|
+
environment_id: string;
|
|
37
|
+
environment_name: string;
|
|
38
|
+
status: DeploymentStatus;
|
|
39
|
+
promoted_by: string;
|
|
40
|
+
promoted_at: string;
|
|
41
|
+
completed_at?: string;
|
|
42
|
+
rollback_version_id?: string;
|
|
43
|
+
canary_percent?: number;
|
|
44
|
+
notes?: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface DeploymentDiff {
|
|
48
|
+
from_version: string;
|
|
49
|
+
to_version: string;
|
|
50
|
+
changes: {
|
|
51
|
+
category: string;
|
|
52
|
+
field: string;
|
|
53
|
+
old_value: unknown;
|
|
54
|
+
new_value: unknown;
|
|
55
|
+
}[];
|
|
56
|
+
config_changes: number;
|
|
57
|
+
prompt_changes: number;
|
|
58
|
+
graph_changes: number;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface EnvironmentListResponse {
|
|
62
|
+
items: Environment[];
|
|
63
|
+
total: number;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface DeploymentListResponse {
|
|
67
|
+
items: Deployment[];
|
|
68
|
+
total: number;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// ============================================================================
|
|
72
|
+
// Module
|
|
73
|
+
// ============================================================================
|
|
74
|
+
|
|
75
|
+
export class DeploymentsModule {
|
|
76
|
+
constructor(private client: RawClient, private headers: () => Record<string, string>) { }
|
|
77
|
+
|
|
78
|
+
// ========== Environments ==========
|
|
79
|
+
|
|
80
|
+
// MOCK - Simulated listEnvironments
|
|
81
|
+
/**
|
|
82
|
+
* List all environments.
|
|
83
|
+
*/
|
|
84
|
+
async listEnvironments(): Promise<APIResponse<EnvironmentListResponse>> {
|
|
85
|
+
// MOCK - Returns simulated data
|
|
86
|
+
const mockEnvs: EnvironmentListResponse = {
|
|
87
|
+
items: [
|
|
88
|
+
{
|
|
89
|
+
id: "env_dev",
|
|
90
|
+
name: "Development",
|
|
91
|
+
type: "development",
|
|
92
|
+
description: "Development environment for testing",
|
|
93
|
+
is_frozen: false,
|
|
94
|
+
config: { logging_level: "debug" },
|
|
95
|
+
created_at: new Date(Date.now() - 86400000 * 30).toISOString(),
|
|
96
|
+
updated_at: new Date().toISOString(),
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: "env_staging",
|
|
100
|
+
name: "Staging",
|
|
101
|
+
type: "staging",
|
|
102
|
+
description: "Pre-production testing",
|
|
103
|
+
is_frozen: false,
|
|
104
|
+
config: { logging_level: "info" },
|
|
105
|
+
created_at: new Date(Date.now() - 86400000 * 30).toISOString(),
|
|
106
|
+
updated_at: new Date().toISOString(),
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
id: "env_prod",
|
|
110
|
+
name: "Production",
|
|
111
|
+
type: "production",
|
|
112
|
+
description: "Live production environment",
|
|
113
|
+
is_frozen: false,
|
|
114
|
+
config: { logging_level: "warning" },
|
|
115
|
+
created_at: new Date(Date.now() - 86400000 * 30).toISOString(),
|
|
116
|
+
updated_at: new Date().toISOString(),
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
total: 3,
|
|
120
|
+
};
|
|
121
|
+
return { data: mockEnvs, error: undefined, response: new Response() };
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// MOCK - Simulated createEnvironment
|
|
125
|
+
/**
|
|
126
|
+
* Create a new environment.
|
|
127
|
+
*/
|
|
128
|
+
async createEnvironment(body: {
|
|
129
|
+
name: string;
|
|
130
|
+
type: EnvironmentType;
|
|
131
|
+
description?: string;
|
|
132
|
+
config?: Record<string, unknown>;
|
|
133
|
+
}): Promise<APIResponse<Environment>> {
|
|
134
|
+
// MOCK - Returns simulated data
|
|
135
|
+
const mockEnv: Environment = {
|
|
136
|
+
id: `env_${Date.now()}`,
|
|
137
|
+
name: body.name,
|
|
138
|
+
type: body.type,
|
|
139
|
+
description: body.description,
|
|
140
|
+
is_frozen: false,
|
|
141
|
+
config: body.config || {},
|
|
142
|
+
created_at: new Date().toISOString(),
|
|
143
|
+
updated_at: new Date().toISOString(),
|
|
144
|
+
};
|
|
145
|
+
return { data: mockEnv, error: undefined, response: new Response() };
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// ========== Deployments ==========
|
|
149
|
+
|
|
150
|
+
// MOCK - Simulated history
|
|
151
|
+
/**
|
|
152
|
+
* Get deployment history for an environment.
|
|
153
|
+
*/
|
|
154
|
+
async history(environmentId: string): Promise<APIResponse<DeploymentListResponse>> {
|
|
155
|
+
// MOCK - Returns simulated data
|
|
156
|
+
const mockHistory: DeploymentListResponse = {
|
|
157
|
+
items: [
|
|
158
|
+
{
|
|
159
|
+
id: "deploy_3",
|
|
160
|
+
agent_id: "agent_support",
|
|
161
|
+
agent_version_id: "v3",
|
|
162
|
+
environment_id: environmentId,
|
|
163
|
+
environment_name: "Production",
|
|
164
|
+
status: "active",
|
|
165
|
+
promoted_by: "user_admin",
|
|
166
|
+
promoted_at: new Date(Date.now() - 3600000).toISOString(),
|
|
167
|
+
completed_at: new Date(Date.now() - 3500000).toISOString(),
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
id: "deploy_2",
|
|
171
|
+
agent_id: "agent_support",
|
|
172
|
+
agent_version_id: "v2",
|
|
173
|
+
environment_id: environmentId,
|
|
174
|
+
environment_name: "Production",
|
|
175
|
+
status: "rolled_back",
|
|
176
|
+
promoted_by: "user_admin",
|
|
177
|
+
promoted_at: new Date(Date.now() - 86400000).toISOString(),
|
|
178
|
+
completed_at: new Date(Date.now() - 86000000).toISOString(),
|
|
179
|
+
rollback_version_id: "v1",
|
|
180
|
+
},
|
|
181
|
+
],
|
|
182
|
+
total: 2,
|
|
183
|
+
};
|
|
184
|
+
return { data: mockHistory, error: undefined, response: new Response() };
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// MOCK - Simulated promote
|
|
188
|
+
/**
|
|
189
|
+
* Promote an agent version to an environment.
|
|
190
|
+
*/
|
|
191
|
+
async promote(
|
|
192
|
+
agentVersionId: string,
|
|
193
|
+
environmentId: string,
|
|
194
|
+
options?: { notes?: string }
|
|
195
|
+
): Promise<APIResponse<Deployment>> {
|
|
196
|
+
// MOCK - Returns simulated data
|
|
197
|
+
const mockDeploy: Deployment = {
|
|
198
|
+
id: `deploy_${Date.now()}`,
|
|
199
|
+
agent_id: "agent_123",
|
|
200
|
+
agent_version_id: agentVersionId,
|
|
201
|
+
environment_id: environmentId,
|
|
202
|
+
environment_name: "Production",
|
|
203
|
+
status: "deploying",
|
|
204
|
+
promoted_by: "user_current",
|
|
205
|
+
promoted_at: new Date().toISOString(),
|
|
206
|
+
notes: options?.notes,
|
|
207
|
+
};
|
|
208
|
+
return { data: mockDeploy, error: undefined, response: new Response() };
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// MOCK - Simulated rollback
|
|
212
|
+
/**
|
|
213
|
+
* Rollback an environment to a previous version.
|
|
214
|
+
*/
|
|
215
|
+
async rollback(environmentId: string, toVersionId?: string): Promise<APIResponse<Deployment>> {
|
|
216
|
+
// MOCK - Returns simulated data
|
|
217
|
+
const mockDeploy: Deployment = {
|
|
218
|
+
id: `deploy_rollback_${Date.now()}`,
|
|
219
|
+
agent_id: "agent_123",
|
|
220
|
+
agent_version_id: toVersionId || "v2",
|
|
221
|
+
environment_id: environmentId,
|
|
222
|
+
environment_name: "Production",
|
|
223
|
+
status: "rolling_back",
|
|
224
|
+
promoted_by: "user_current",
|
|
225
|
+
promoted_at: new Date().toISOString(),
|
|
226
|
+
rollback_version_id: "v3",
|
|
227
|
+
};
|
|
228
|
+
return { data: mockDeploy, error: undefined, response: new Response() };
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// MOCK - Simulated canary
|
|
232
|
+
/**
|
|
233
|
+
* Start a canary deployment.
|
|
234
|
+
*/
|
|
235
|
+
async canary(
|
|
236
|
+
environmentId: string,
|
|
237
|
+
agentVersionId: string,
|
|
238
|
+
percent: number
|
|
239
|
+
): Promise<APIResponse<Deployment>> {
|
|
240
|
+
// MOCK - Returns simulated data
|
|
241
|
+
const mockDeploy: Deployment = {
|
|
242
|
+
id: `deploy_canary_${Date.now()}`,
|
|
243
|
+
agent_id: "agent_123",
|
|
244
|
+
agent_version_id: agentVersionId,
|
|
245
|
+
environment_id: environmentId,
|
|
246
|
+
environment_name: "Production",
|
|
247
|
+
status: "deploying",
|
|
248
|
+
promoted_by: "user_current",
|
|
249
|
+
promoted_at: new Date().toISOString(),
|
|
250
|
+
canary_percent: percent,
|
|
251
|
+
};
|
|
252
|
+
return { data: mockDeploy, error: undefined, response: new Response() };
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// MOCK - Simulated freeze
|
|
256
|
+
/**
|
|
257
|
+
* Freeze an environment (change freeze).
|
|
258
|
+
*/
|
|
259
|
+
async freeze(
|
|
260
|
+
environmentId: string,
|
|
261
|
+
options?: { until?: string; reason?: string }
|
|
262
|
+
): Promise<APIResponse<Environment>> {
|
|
263
|
+
// MOCK - Returns simulated data
|
|
264
|
+
const mockEnv: Environment = {
|
|
265
|
+
id: environmentId,
|
|
266
|
+
name: "Production",
|
|
267
|
+
type: "production",
|
|
268
|
+
is_frozen: true,
|
|
269
|
+
frozen_until: options?.until,
|
|
270
|
+
frozen_reason: options?.reason || "Change freeze in effect",
|
|
271
|
+
config: {},
|
|
272
|
+
created_at: new Date(Date.now() - 86400000 * 30).toISOString(),
|
|
273
|
+
updated_at: new Date().toISOString(),
|
|
274
|
+
};
|
|
275
|
+
return { data: mockEnv, error: undefined, response: new Response() };
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// MOCK - Simulated unfreeze
|
|
279
|
+
/**
|
|
280
|
+
* Unfreeze an environment.
|
|
281
|
+
*/
|
|
282
|
+
async unfreeze(environmentId: string): Promise<APIResponse<Environment>> {
|
|
283
|
+
// MOCK - Returns simulated data
|
|
284
|
+
const mockEnv: Environment = {
|
|
285
|
+
id: environmentId,
|
|
286
|
+
name: "Production",
|
|
287
|
+
type: "production",
|
|
288
|
+
is_frozen: false,
|
|
289
|
+
config: {},
|
|
290
|
+
created_at: new Date(Date.now() - 86400000 * 30).toISOString(),
|
|
291
|
+
updated_at: new Date().toISOString(),
|
|
292
|
+
};
|
|
293
|
+
return { data: mockEnv, error: undefined, response: new Response() };
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// MOCK - Simulated diff
|
|
297
|
+
/**
|
|
298
|
+
* Get diff between two versions.
|
|
299
|
+
*/
|
|
300
|
+
async diff(fromVersionId: string, toVersionId: string): Promise<APIResponse<DeploymentDiff>> {
|
|
301
|
+
// MOCK - Returns simulated diff
|
|
302
|
+
const mockDiff: DeploymentDiff = {
|
|
303
|
+
from_version: fromVersionId,
|
|
304
|
+
to_version: toVersionId,
|
|
305
|
+
changes: [
|
|
306
|
+
{ category: "config", field: "max_tokens", old_value: 4000, new_value: 8000 },
|
|
307
|
+
{ category: "prompt", field: "system_prompt", old_value: "You are a helpful assistant", new_value: "You are an expert assistant" },
|
|
308
|
+
],
|
|
309
|
+
config_changes: 1,
|
|
310
|
+
prompt_changes: 1,
|
|
311
|
+
graph_changes: 0,
|
|
312
|
+
};
|
|
313
|
+
return { data: mockDiff, error: undefined, response: new Response() };
|
|
314
|
+
}
|
|
315
|
+
}
|