@agent-os-sdk/client 0.1.2 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/AgentOsClient.d.ts +39 -44
- package/dist/client/AgentOsClient.d.ts.map +1 -1
- package/dist/client/AgentOsClient.js +162 -44
- package/dist/client/auth.d.ts +102 -0
- package/dist/client/auth.d.ts.map +1 -0
- package/dist/client/auth.js +44 -0
- package/dist/generated/openapi.d.ts +914 -202
- package/dist/generated/openapi.d.ts.map +1 -1
- package/dist/index.d.ts +10 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/modules/approvals.d.ts +8 -22
- package/dist/modules/approvals.d.ts.map +1 -1
- package/dist/modules/approvals.js +27 -130
- package/dist/modules/artifacts.d.ts +28 -79
- package/dist/modules/artifacts.d.ts.map +1 -1
- package/dist/modules/artifacts.js +30 -197
- package/dist/modules/budgets.d.ts +47 -70
- package/dist/modules/budgets.d.ts.map +1 -1
- package/dist/modules/budgets.js +28 -139
- package/dist/modules/builder.d.ts +21 -1
- package/dist/modules/builder.d.ts.map +1 -1
- package/dist/modules/builder.js +25 -3
- package/dist/modules/capabilities.d.ts +39 -50
- package/dist/modules/capabilities.d.ts.map +1 -1
- package/dist/modules/capabilities.js +32 -95
- package/dist/modules/deployments.d.ts +49 -92
- package/dist/modules/deployments.d.ts.map +1 -1
- package/dist/modules/deployments.js +37 -209
- package/dist/modules/flows.d.ts +11 -31
- package/dist/modules/flows.d.ts.map +1 -1
- package/dist/modules/flows.js +33 -157
- package/dist/modules/handoff.d.ts +7 -4
- package/dist/modules/handoff.d.ts.map +1 -1
- package/dist/modules/handoff.js +25 -88
- package/dist/modules/incidents.d.ts +40 -101
- package/dist/modules/incidents.d.ts.map +1 -1
- package/dist/modules/incidents.js +31 -208
- package/dist/modules/policies.d.ts +42 -69
- package/dist/modules/policies.d.ts.map +1 -1
- package/dist/modules/policies.js +25 -159
- package/dist/modules/runs.d.ts +89 -3
- package/dist/modules/runs.d.ts.map +1 -1
- package/dist/modules/runs.js +75 -4
- package/package.json +1 -1
- package/src/client/AgentOsClient.ts +185 -67
- package/src/client/auth.ts +148 -0
- package/src/generated/openapi.ts +914 -202
- package/src/generated/swagger.json +770 -630
- package/src/index.ts +22 -10
- package/src/modules/approvals.ts +31 -132
- package/src/modules/artifacts.ts +41 -245
- package/src/modules/budgets.ts +65 -181
- package/src/modules/builder.ts +25 -3
- package/src/modules/capabilities.ts +58 -139
- package/src/modules/deployments.ts +67 -271
- package/src/modules/flows.ts +37 -163
- package/src/modules/handoff.ts +29 -93
- package/src/modules/incidents.ts +56 -282
- package/src/modules/policies.ts +57 -203
- package/src/modules/runs.ts +123 -5
package/src/modules/handoff.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Handoff Module - Multi-Agent Delegation
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* Provides first-class support for agent handoffs, delegation,
|
|
7
|
-
* thread forking, and run chain 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";
|
|
@@ -74,6 +72,21 @@ export interface RunChain {
|
|
|
74
72
|
nodes: RunChainNode[];
|
|
75
73
|
}
|
|
76
74
|
|
|
75
|
+
// ============================================================================
|
|
76
|
+
// Helper for 501 responses
|
|
77
|
+
// ============================================================================
|
|
78
|
+
|
|
79
|
+
function notImplemented<T>(method: string): APIResponse<T> {
|
|
80
|
+
return {
|
|
81
|
+
data: undefined,
|
|
82
|
+
error: {
|
|
83
|
+
code: "NOT_IMPLEMENTED",
|
|
84
|
+
message: `HandoffModule.${method}() is not implemented. Backend endpoint not available.`,
|
|
85
|
+
},
|
|
86
|
+
response: new Response(null, { status: 501, statusText: "Not Implemented" }),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
77
90
|
// ============================================================================
|
|
78
91
|
// Module
|
|
79
92
|
// ============================================================================
|
|
@@ -81,124 +94,47 @@ export interface RunChain {
|
|
|
81
94
|
export class HandoffModule {
|
|
82
95
|
constructor(private client: RawClient, private headers: () => Record<string, string>) { }
|
|
83
96
|
|
|
84
|
-
// MOCK - Simulated handoff
|
|
85
97
|
/**
|
|
86
98
|
* Hand off current run to another agent.
|
|
99
|
+
* @returns 501 Not Implemented - Backend not available
|
|
87
100
|
*/
|
|
88
101
|
async handoff(
|
|
89
102
|
runId: string,
|
|
90
103
|
toAgentId: string,
|
|
91
104
|
options?: HandoffOptions
|
|
92
105
|
): Promise<APIResponse<HandoffResult>> {
|
|
93
|
-
|
|
94
|
-
const mockResult: HandoffResult = {
|
|
95
|
-
run_id: `run_handoff_${Date.now()}`,
|
|
96
|
-
parent_run_id: runId,
|
|
97
|
-
to_agent_id: toAgentId,
|
|
98
|
-
mode: options?.mode || "subthread",
|
|
99
|
-
thread_id: `thread_${Date.now()}`,
|
|
100
|
-
status: "pending",
|
|
101
|
-
created_at: new Date().toISOString(),
|
|
102
|
-
};
|
|
103
|
-
return { data: mockResult, error: undefined, response: new Response() };
|
|
106
|
+
return notImplemented<HandoffResult>("handoff");
|
|
104
107
|
}
|
|
105
108
|
|
|
106
|
-
// MOCK - Simulated fork
|
|
107
109
|
/**
|
|
108
110
|
* Fork a thread into a new conversation branch.
|
|
111
|
+
* @returns 501 Not Implemented - Backend not available
|
|
109
112
|
*/
|
|
110
|
-
async fork(
|
|
111
|
-
|
|
112
|
-
options?: ForkOptions
|
|
113
|
-
): Promise<APIResponse<ForkResult>> {
|
|
114
|
-
// MOCK - Returns simulated data
|
|
115
|
-
const mockResult: ForkResult = {
|
|
116
|
-
original_thread_id: threadId,
|
|
117
|
-
forked_thread_id: `thread_fork_${Date.now()}`,
|
|
118
|
-
checkpoint_id: options?.checkpoint_id,
|
|
119
|
-
created_at: new Date().toISOString(),
|
|
120
|
-
};
|
|
121
|
-
return { data: mockResult, error: undefined, response: new Response() };
|
|
113
|
+
async fork(threadId: string, options?: ForkOptions): Promise<APIResponse<ForkResult>> {
|
|
114
|
+
return notImplemented<ForkResult>("fork");
|
|
122
115
|
}
|
|
123
116
|
|
|
124
|
-
// MOCK - Simulated chain
|
|
125
117
|
/**
|
|
126
118
|
* Get the full run chain (delegation tree).
|
|
119
|
+
* @returns 501 Not Implemented - Backend not available
|
|
127
120
|
*/
|
|
128
121
|
async getChain(runId: string): Promise<APIResponse<RunChain>> {
|
|
129
|
-
|
|
130
|
-
const mockChain: RunChain = {
|
|
131
|
-
root_run_id: runId,
|
|
132
|
-
total_runs: 3,
|
|
133
|
-
max_depth: 2,
|
|
134
|
-
nodes: [
|
|
135
|
-
{
|
|
136
|
-
run_id: runId,
|
|
137
|
-
agent_id: "agent_1",
|
|
138
|
-
agent_name: "Main Agent",
|
|
139
|
-
status: "completed",
|
|
140
|
-
depth: 0,
|
|
141
|
-
started_at: new Date(Date.now() - 60000).toISOString(),
|
|
142
|
-
completed_at: new Date().toISOString(),
|
|
143
|
-
children: [
|
|
144
|
-
{
|
|
145
|
-
run_id: `${runId}_child_1`,
|
|
146
|
-
agent_id: "agent_2",
|
|
147
|
-
agent_name: "Research Agent",
|
|
148
|
-
status: "completed",
|
|
149
|
-
parent_run_id: runId,
|
|
150
|
-
depth: 1,
|
|
151
|
-
started_at: new Date(Date.now() - 30000).toISOString(),
|
|
152
|
-
completed_at: new Date().toISOString(),
|
|
153
|
-
children: [],
|
|
154
|
-
},
|
|
155
|
-
],
|
|
156
|
-
},
|
|
157
|
-
],
|
|
158
|
-
};
|
|
159
|
-
return { data: mockChain, error: undefined, response: new Response() };
|
|
122
|
+
return notImplemented<RunChain>("getChain");
|
|
160
123
|
}
|
|
161
124
|
|
|
162
|
-
// MOCK - Simulated parents
|
|
163
125
|
/**
|
|
164
126
|
* Get parent runs in the chain.
|
|
127
|
+
* @returns 501 Not Implemented - Backend not available
|
|
165
128
|
*/
|
|
166
129
|
async getParents(runId: string): Promise<APIResponse<RunChainNode[]>> {
|
|
167
|
-
|
|
168
|
-
const mockParents: RunChainNode[] = [
|
|
169
|
-
{
|
|
170
|
-
run_id: `parent_${runId}`,
|
|
171
|
-
agent_id: "agent_parent",
|
|
172
|
-
agent_name: "Parent Agent",
|
|
173
|
-
status: "completed",
|
|
174
|
-
depth: 0,
|
|
175
|
-
started_at: new Date(Date.now() - 120000).toISOString(),
|
|
176
|
-
completed_at: new Date(Date.now() - 60000).toISOString(),
|
|
177
|
-
children: [],
|
|
178
|
-
},
|
|
179
|
-
];
|
|
180
|
-
return { data: mockParents, error: undefined, response: new Response() };
|
|
130
|
+
return notImplemented<RunChainNode[]>("getParents");
|
|
181
131
|
}
|
|
182
132
|
|
|
183
|
-
// MOCK - Simulated children
|
|
184
133
|
/**
|
|
185
134
|
* Get child runs in the chain.
|
|
135
|
+
* @returns 501 Not Implemented - Backend not available
|
|
186
136
|
*/
|
|
187
137
|
async getChildren(runId: string): Promise<APIResponse<RunChainNode[]>> {
|
|
188
|
-
|
|
189
|
-
const mockChildren: RunChainNode[] = [
|
|
190
|
-
{
|
|
191
|
-
run_id: `child_1_${runId}`,
|
|
192
|
-
agent_id: "agent_child_1",
|
|
193
|
-
agent_name: "Child Agent 1",
|
|
194
|
-
status: "completed",
|
|
195
|
-
parent_run_id: runId,
|
|
196
|
-
depth: 1,
|
|
197
|
-
started_at: new Date(Date.now() - 30000).toISOString(),
|
|
198
|
-
completed_at: new Date().toISOString(),
|
|
199
|
-
children: [],
|
|
200
|
-
},
|
|
201
|
-
];
|
|
202
|
-
return { data: mockChildren, error: undefined, response: new Response() };
|
|
138
|
+
return notImplemented<RunChainNode[]>("getChildren");
|
|
203
139
|
}
|
|
204
140
|
}
|
package/src/modules/incidents.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Incidents Module -
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* Provides incident management, SLO tracking, and postmortem creation.
|
|
7
|
-
* Brings Datadog vibes to agent operations.
|
|
2
|
+
* Incidents Module - Error & Alert 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,76 +11,55 @@ import type { RawClient, APIResponse } from "../client/raw.js";
|
|
|
13
11
|
// Types
|
|
14
12
|
// ============================================================================
|
|
15
13
|
|
|
16
|
-
export type IncidentSeverity = "
|
|
17
|
-
export type IncidentStatus = "open" | "investigating" | "identified" | "monitoring" | "resolved";
|
|
14
|
+
export type IncidentSeverity = "low" | "medium" | "high" | "critical";
|
|
15
|
+
export type IncidentStatus = "open" | "investigating" | "identified" | "monitoring" | "resolved" | "closed";
|
|
18
16
|
|
|
19
17
|
export interface Incident {
|
|
20
18
|
id: string;
|
|
21
19
|
title: string;
|
|
22
|
-
description
|
|
20
|
+
description?: string;
|
|
23
21
|
severity: IncidentSeverity;
|
|
24
22
|
status: IncidentStatus;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
agent_id?: string;
|
|
24
|
+
run_id?: string;
|
|
25
|
+
error_type?: string;
|
|
26
|
+
error_message?: string;
|
|
27
|
+
stack_trace?: string;
|
|
28
|
+
affected_users?: number;
|
|
29
29
|
created_at: string;
|
|
30
30
|
updated_at: string;
|
|
31
31
|
resolved_at?: string;
|
|
32
|
-
created_by: string;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface SLO {
|
|
36
|
-
id: string;
|
|
37
|
-
name: string;
|
|
38
|
-
description?: string;
|
|
39
|
-
target_percentage: number;
|
|
40
|
-
current_percentage: number;
|
|
41
|
-
metric_type: "availability" | "latency" | "error_rate" | "success_rate";
|
|
42
|
-
threshold?: number;
|
|
43
|
-
window_days: number;
|
|
44
|
-
status: "healthy" | "at_risk" | "breached";
|
|
45
|
-
budget_remaining: number;
|
|
46
|
-
created_at: string;
|
|
47
32
|
}
|
|
48
33
|
|
|
49
|
-
export interface
|
|
34
|
+
export interface IncidentUpdate {
|
|
50
35
|
id: string;
|
|
51
36
|
incident_id: string;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
timeline: PostmortemEvent[];
|
|
55
|
-
root_cause_analysis: string;
|
|
56
|
-
impact: string;
|
|
57
|
-
action_items: ActionItem[];
|
|
58
|
-
lessons_learned: string[];
|
|
59
|
-
created_at: string;
|
|
37
|
+
message: string;
|
|
38
|
+
status_change?: IncidentStatus;
|
|
60
39
|
created_by: string;
|
|
40
|
+
created_at: string;
|
|
61
41
|
}
|
|
62
42
|
|
|
63
|
-
export interface
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
export interface ActionItem {
|
|
70
|
-
id: string;
|
|
71
|
-
description: string;
|
|
72
|
-
owner: string;
|
|
73
|
-
due_date?: string;
|
|
74
|
-
status: "open" | "in_progress" | "completed";
|
|
43
|
+
export interface IncidentMetrics {
|
|
44
|
+
total_open: number;
|
|
45
|
+
by_severity: Record<IncidentSeverity, number>;
|
|
46
|
+
mttr_seconds: number;
|
|
47
|
+
trend_last_7_days: number[];
|
|
75
48
|
}
|
|
76
49
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
open_count: number;
|
|
81
|
-
}
|
|
50
|
+
// ============================================================================
|
|
51
|
+
// Helper for 501 responses
|
|
52
|
+
// ============================================================================
|
|
82
53
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
54
|
+
function notImplemented<T>(method: string): APIResponse<T> {
|
|
55
|
+
return {
|
|
56
|
+
data: undefined,
|
|
57
|
+
error: {
|
|
58
|
+
code: "NOT_IMPLEMENTED",
|
|
59
|
+
message: `IncidentsModule.${method}() is not implemented. Backend endpoint not available.`,
|
|
60
|
+
},
|
|
61
|
+
response: new Response(null, { status: 501, statusText: "Not Implemented" }),
|
|
62
|
+
};
|
|
86
63
|
}
|
|
87
64
|
|
|
88
65
|
// ============================================================================
|
|
@@ -92,248 +69,45 @@ export interface SLOListResponse {
|
|
|
92
69
|
export class IncidentsModule {
|
|
93
70
|
constructor(private client: RawClient, private headers: () => Record<string, string>) { }
|
|
94
71
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
// MOCK - Simulated list
|
|
98
|
-
/**
|
|
99
|
-
* List all incidents.
|
|
100
|
-
*/
|
|
72
|
+
/** @returns 501 Not Implemented */
|
|
101
73
|
async list(params?: {
|
|
102
74
|
status?: IncidentStatus;
|
|
103
75
|
severity?: IncidentSeverity;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
id: "inc_1",
|
|
110
|
-
title: "High error rate on Support Agent",
|
|
111
|
-
description: "Error rate exceeded 5% threshold",
|
|
112
|
-
severity: "major",
|
|
113
|
-
status: "investigating",
|
|
114
|
-
affected_agents: ["agent_support"],
|
|
115
|
-
affected_runs: ["run_123", "run_124", "run_125"],
|
|
116
|
-
created_at: new Date(Date.now() - 3600000).toISOString(),
|
|
117
|
-
updated_at: new Date().toISOString(),
|
|
118
|
-
created_by: "system",
|
|
119
|
-
},
|
|
120
|
-
],
|
|
121
|
-
total: 1,
|
|
122
|
-
open_count: 1,
|
|
123
|
-
};
|
|
124
|
-
return { data: mockIncidents, error: undefined, response: new Response() };
|
|
76
|
+
agent_id?: string;
|
|
77
|
+
limit?: number;
|
|
78
|
+
offset?: number;
|
|
79
|
+
}): Promise<APIResponse<{ items: Incident[]; total: number }>> {
|
|
80
|
+
return notImplemented<{ items: Incident[]; total: number }>("list");
|
|
125
81
|
}
|
|
126
82
|
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Get an incident by ID.
|
|
130
|
-
*/
|
|
83
|
+
/** @returns 501 Not Implemented */
|
|
131
84
|
async get(incidentId: string): Promise<APIResponse<Incident>> {
|
|
132
|
-
|
|
133
|
-
const mockIncident: Incident = {
|
|
134
|
-
id: incidentId,
|
|
135
|
-
title: "High error rate on Support Agent",
|
|
136
|
-
description: "Error rate exceeded 5% threshold",
|
|
137
|
-
severity: "major",
|
|
138
|
-
status: "investigating",
|
|
139
|
-
affected_agents: ["agent_support"],
|
|
140
|
-
affected_runs: ["run_123", "run_124", "run_125"],
|
|
141
|
-
created_at: new Date(Date.now() - 3600000).toISOString(),
|
|
142
|
-
updated_at: new Date().toISOString(),
|
|
143
|
-
created_by: "system",
|
|
144
|
-
};
|
|
145
|
-
return { data: mockIncident, error: undefined, response: new Response() };
|
|
85
|
+
return notImplemented<Incident>("get");
|
|
146
86
|
}
|
|
147
87
|
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Create a new incident.
|
|
151
|
-
*/
|
|
88
|
+
/** @returns 501 Not Implemented */
|
|
152
89
|
async create(body: {
|
|
153
90
|
title: string;
|
|
154
|
-
description
|
|
91
|
+
description?: string;
|
|
155
92
|
severity: IncidentSeverity;
|
|
156
|
-
|
|
93
|
+
agent_id?: string;
|
|
94
|
+
run_id?: string;
|
|
157
95
|
}): Promise<APIResponse<Incident>> {
|
|
158
|
-
|
|
159
|
-
const mockIncident: Incident = {
|
|
160
|
-
id: `inc_${Date.now()}`,
|
|
161
|
-
title: body.title,
|
|
162
|
-
description: body.description,
|
|
163
|
-
severity: body.severity,
|
|
164
|
-
status: "open",
|
|
165
|
-
affected_agents: body.affected_agents || [],
|
|
166
|
-
affected_runs: [],
|
|
167
|
-
created_at: new Date().toISOString(),
|
|
168
|
-
updated_at: new Date().toISOString(),
|
|
169
|
-
created_by: "user_current",
|
|
170
|
-
};
|
|
171
|
-
return { data: mockIncident, error: undefined, response: new Response() };
|
|
96
|
+
return notImplemented<Incident>("create");
|
|
172
97
|
}
|
|
173
98
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
*/
|
|
178
|
-
async resolve(incidentId: string, resolution: string): Promise<APIResponse<Incident>> {
|
|
179
|
-
// MOCK - Returns simulated data
|
|
180
|
-
const mockIncident: Incident = {
|
|
181
|
-
id: incidentId,
|
|
182
|
-
title: "High error rate on Support Agent",
|
|
183
|
-
description: "Error rate exceeded 5% threshold",
|
|
184
|
-
severity: "major",
|
|
185
|
-
status: "resolved",
|
|
186
|
-
affected_agents: ["agent_support"],
|
|
187
|
-
affected_runs: [],
|
|
188
|
-
root_cause: "Model provider rate limit",
|
|
189
|
-
resolution,
|
|
190
|
-
created_at: new Date(Date.now() - 7200000).toISOString(),
|
|
191
|
-
updated_at: new Date().toISOString(),
|
|
192
|
-
resolved_at: new Date().toISOString(),
|
|
193
|
-
created_by: "system",
|
|
194
|
-
};
|
|
195
|
-
return { data: mockIncident, error: undefined, response: new Response() };
|
|
99
|
+
/** @returns 501 Not Implemented */
|
|
100
|
+
async update(incidentId: string, status: IncidentStatus, message?: string): Promise<APIResponse<IncidentUpdate>> {
|
|
101
|
+
return notImplemented<IncidentUpdate>("update");
|
|
196
102
|
}
|
|
197
103
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
*/
|
|
202
|
-
async linkRuns(incidentId: string, runIds: string[]): Promise<APIResponse<Incident>> {
|
|
203
|
-
// MOCK - Returns simulated data
|
|
204
|
-
const mockIncident: Incident = {
|
|
205
|
-
id: incidentId,
|
|
206
|
-
title: "High error rate on Support Agent",
|
|
207
|
-
description: "Error rate exceeded 5% threshold",
|
|
208
|
-
severity: "major",
|
|
209
|
-
status: "investigating",
|
|
210
|
-
affected_agents: ["agent_support"],
|
|
211
|
-
affected_runs: runIds,
|
|
212
|
-
created_at: new Date(Date.now() - 3600000).toISOString(),
|
|
213
|
-
updated_at: new Date().toISOString(),
|
|
214
|
-
created_by: "system",
|
|
215
|
-
};
|
|
216
|
-
return { data: mockIncident, error: undefined, response: new Response() };
|
|
104
|
+
/** @returns 501 Not Implemented */
|
|
105
|
+
async resolve(incidentId: string, message?: string): Promise<APIResponse<Incident>> {
|
|
106
|
+
return notImplemented<Incident>("resolve");
|
|
217
107
|
}
|
|
218
108
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* List all SLOs.
|
|
224
|
-
*/
|
|
225
|
-
async listSLOs(): Promise<APIResponse<SLOListResponse>> {
|
|
226
|
-
// MOCK - Returns simulated data
|
|
227
|
-
const mockSLOs: SLOListResponse = {
|
|
228
|
-
items: [
|
|
229
|
-
{
|
|
230
|
-
id: "slo_availability",
|
|
231
|
-
name: "Agent Availability",
|
|
232
|
-
description: "99.9% availability for all agents",
|
|
233
|
-
target_percentage: 99.9,
|
|
234
|
-
current_percentage: 99.95,
|
|
235
|
-
metric_type: "availability",
|
|
236
|
-
window_days: 30,
|
|
237
|
-
status: "healthy",
|
|
238
|
-
budget_remaining: 0.05,
|
|
239
|
-
created_at: new Date(Date.now() - 86400000 * 30).toISOString(),
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
id: "slo_latency",
|
|
243
|
-
name: "Response Latency",
|
|
244
|
-
description: "P95 latency under 2s",
|
|
245
|
-
target_percentage: 95,
|
|
246
|
-
current_percentage: 97.5,
|
|
247
|
-
metric_type: "latency",
|
|
248
|
-
threshold: 2000,
|
|
249
|
-
window_days: 7,
|
|
250
|
-
status: "healthy",
|
|
251
|
-
budget_remaining: 2.5,
|
|
252
|
-
created_at: new Date(Date.now() - 86400000 * 7).toISOString(),
|
|
253
|
-
},
|
|
254
|
-
{
|
|
255
|
-
id: "slo_errors",
|
|
256
|
-
name: "Error Rate",
|
|
257
|
-
description: "Error rate below 1%",
|
|
258
|
-
target_percentage: 99,
|
|
259
|
-
current_percentage: 98.2,
|
|
260
|
-
metric_type: "error_rate",
|
|
261
|
-
window_days: 7,
|
|
262
|
-
status: "at_risk",
|
|
263
|
-
budget_remaining: -0.8,
|
|
264
|
-
created_at: new Date(Date.now() - 86400000 * 7).toISOString(),
|
|
265
|
-
},
|
|
266
|
-
],
|
|
267
|
-
total: 3,
|
|
268
|
-
};
|
|
269
|
-
return { data: mockSLOs, error: undefined, response: new Response() };
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
// MOCK - Simulated setSLO
|
|
273
|
-
/**
|
|
274
|
-
* Create or update an SLO.
|
|
275
|
-
*/
|
|
276
|
-
async setSLO(body: {
|
|
277
|
-
name: string;
|
|
278
|
-
description?: string;
|
|
279
|
-
target_percentage: number;
|
|
280
|
-
metric_type: SLO["metric_type"];
|
|
281
|
-
threshold?: number;
|
|
282
|
-
window_days: number;
|
|
283
|
-
}): Promise<APIResponse<SLO>> {
|
|
284
|
-
// MOCK - Returns simulated data
|
|
285
|
-
const mockSLO: SLO = {
|
|
286
|
-
id: `slo_${Date.now()}`,
|
|
287
|
-
name: body.name,
|
|
288
|
-
description: body.description,
|
|
289
|
-
target_percentage: body.target_percentage,
|
|
290
|
-
current_percentage: 100,
|
|
291
|
-
metric_type: body.metric_type,
|
|
292
|
-
threshold: body.threshold,
|
|
293
|
-
window_days: body.window_days,
|
|
294
|
-
status: "healthy",
|
|
295
|
-
budget_remaining: 100 - body.target_percentage,
|
|
296
|
-
created_at: new Date().toISOString(),
|
|
297
|
-
};
|
|
298
|
-
return { data: mockSLO, error: undefined, response: new Response() };
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
// ========== Postmortems ==========
|
|
302
|
-
|
|
303
|
-
// MOCK - Simulated createPostmortem
|
|
304
|
-
/**
|
|
305
|
-
* Create a postmortem for an incident.
|
|
306
|
-
*/
|
|
307
|
-
async createPostmortem(incidentId: string, body: {
|
|
308
|
-
title: string;
|
|
309
|
-
summary: string;
|
|
310
|
-
root_cause_analysis: string;
|
|
311
|
-
impact: string;
|
|
312
|
-
lessons_learned: string[];
|
|
313
|
-
action_items: Omit<ActionItem, "id" | "status">[];
|
|
314
|
-
}): Promise<APIResponse<Postmortem>> {
|
|
315
|
-
// MOCK - Returns simulated data
|
|
316
|
-
const mockPostmortem: Postmortem = {
|
|
317
|
-
id: `pm_${Date.now()}`,
|
|
318
|
-
incident_id: incidentId,
|
|
319
|
-
title: body.title,
|
|
320
|
-
summary: body.summary,
|
|
321
|
-
timeline: [
|
|
322
|
-
{ timestamp: new Date(Date.now() - 7200000).toISOString(), description: "Incident detected" },
|
|
323
|
-
{ timestamp: new Date(Date.now() - 3600000).toISOString(), description: "Root cause identified" },
|
|
324
|
-
{ timestamp: new Date().toISOString(), description: "Incident resolved" },
|
|
325
|
-
],
|
|
326
|
-
root_cause_analysis: body.root_cause_analysis,
|
|
327
|
-
impact: body.impact,
|
|
328
|
-
action_items: body.action_items.map((item, i) => ({
|
|
329
|
-
...item,
|
|
330
|
-
id: `action_${i}`,
|
|
331
|
-
status: "open" as const,
|
|
332
|
-
})),
|
|
333
|
-
lessons_learned: body.lessons_learned,
|
|
334
|
-
created_at: new Date().toISOString(),
|
|
335
|
-
created_by: "user_current",
|
|
336
|
-
};
|
|
337
|
-
return { data: mockPostmortem, error: undefined, response: new Response() };
|
|
109
|
+
/** @returns 501 Not Implemented */
|
|
110
|
+
async getMetrics(): Promise<APIResponse<IncidentMetrics>> {
|
|
111
|
+
return notImplemented<IncidentMetrics>("getMetrics");
|
|
338
112
|
}
|
|
339
113
|
}
|