@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/dist/modules/handoff.js
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Handoff Module - Multi-Agent Delegation
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* Provides first-class support for agent handoffs, delegation,
|
|
7
|
-
* thread forking, and run chain management.
|
|
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: `HandoffModule.${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 HandoffModule {
|
|
@@ -16,113 +27,39 @@ export class HandoffModule {
|
|
|
16
27
|
this.client = client;
|
|
17
28
|
this.headers = headers;
|
|
18
29
|
}
|
|
19
|
-
// MOCK - Simulated handoff
|
|
20
30
|
/**
|
|
21
31
|
* Hand off current run to another agent.
|
|
32
|
+
* @returns 501 Not Implemented - Backend not available
|
|
22
33
|
*/
|
|
23
34
|
async handoff(runId, toAgentId, options) {
|
|
24
|
-
|
|
25
|
-
const mockResult = {
|
|
26
|
-
run_id: `run_handoff_${Date.now()}`,
|
|
27
|
-
parent_run_id: runId,
|
|
28
|
-
to_agent_id: toAgentId,
|
|
29
|
-
mode: options?.mode || "subthread",
|
|
30
|
-
thread_id: `thread_${Date.now()}`,
|
|
31
|
-
status: "pending",
|
|
32
|
-
created_at: new Date().toISOString(),
|
|
33
|
-
};
|
|
34
|
-
return { data: mockResult, error: undefined, response: new Response() };
|
|
35
|
+
return notImplemented("handoff");
|
|
35
36
|
}
|
|
36
|
-
// MOCK - Simulated fork
|
|
37
37
|
/**
|
|
38
38
|
* Fork a thread into a new conversation branch.
|
|
39
|
+
* @returns 501 Not Implemented - Backend not available
|
|
39
40
|
*/
|
|
40
41
|
async fork(threadId, options) {
|
|
41
|
-
|
|
42
|
-
const mockResult = {
|
|
43
|
-
original_thread_id: threadId,
|
|
44
|
-
forked_thread_id: `thread_fork_${Date.now()}`,
|
|
45
|
-
checkpoint_id: options?.checkpoint_id,
|
|
46
|
-
created_at: new Date().toISOString(),
|
|
47
|
-
};
|
|
48
|
-
return { data: mockResult, error: undefined, response: new Response() };
|
|
42
|
+
return notImplemented("fork");
|
|
49
43
|
}
|
|
50
|
-
// MOCK - Simulated chain
|
|
51
44
|
/**
|
|
52
45
|
* Get the full run chain (delegation tree).
|
|
46
|
+
* @returns 501 Not Implemented - Backend not available
|
|
53
47
|
*/
|
|
54
48
|
async getChain(runId) {
|
|
55
|
-
|
|
56
|
-
const mockChain = {
|
|
57
|
-
root_run_id: runId,
|
|
58
|
-
total_runs: 3,
|
|
59
|
-
max_depth: 2,
|
|
60
|
-
nodes: [
|
|
61
|
-
{
|
|
62
|
-
run_id: runId,
|
|
63
|
-
agent_id: "agent_1",
|
|
64
|
-
agent_name: "Main Agent",
|
|
65
|
-
status: "completed",
|
|
66
|
-
depth: 0,
|
|
67
|
-
started_at: new Date(Date.now() - 60000).toISOString(),
|
|
68
|
-
completed_at: new Date().toISOString(),
|
|
69
|
-
children: [
|
|
70
|
-
{
|
|
71
|
-
run_id: `${runId}_child_1`,
|
|
72
|
-
agent_id: "agent_2",
|
|
73
|
-
agent_name: "Research Agent",
|
|
74
|
-
status: "completed",
|
|
75
|
-
parent_run_id: runId,
|
|
76
|
-
depth: 1,
|
|
77
|
-
started_at: new Date(Date.now() - 30000).toISOString(),
|
|
78
|
-
completed_at: new Date().toISOString(),
|
|
79
|
-
children: [],
|
|
80
|
-
},
|
|
81
|
-
],
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
};
|
|
85
|
-
return { data: mockChain, error: undefined, response: new Response() };
|
|
49
|
+
return notImplemented("getChain");
|
|
86
50
|
}
|
|
87
|
-
// MOCK - Simulated parents
|
|
88
51
|
/**
|
|
89
52
|
* Get parent runs in the chain.
|
|
53
|
+
* @returns 501 Not Implemented - Backend not available
|
|
90
54
|
*/
|
|
91
55
|
async getParents(runId) {
|
|
92
|
-
|
|
93
|
-
const mockParents = [
|
|
94
|
-
{
|
|
95
|
-
run_id: `parent_${runId}`,
|
|
96
|
-
agent_id: "agent_parent",
|
|
97
|
-
agent_name: "Parent Agent",
|
|
98
|
-
status: "completed",
|
|
99
|
-
depth: 0,
|
|
100
|
-
started_at: new Date(Date.now() - 120000).toISOString(),
|
|
101
|
-
completed_at: new Date(Date.now() - 60000).toISOString(),
|
|
102
|
-
children: [],
|
|
103
|
-
},
|
|
104
|
-
];
|
|
105
|
-
return { data: mockParents, error: undefined, response: new Response() };
|
|
56
|
+
return notImplemented("getParents");
|
|
106
57
|
}
|
|
107
|
-
// MOCK - Simulated children
|
|
108
58
|
/**
|
|
109
59
|
* Get child runs in the chain.
|
|
60
|
+
* @returns 501 Not Implemented - Backend not available
|
|
110
61
|
*/
|
|
111
62
|
async getChildren(runId) {
|
|
112
|
-
|
|
113
|
-
const mockChildren = [
|
|
114
|
-
{
|
|
115
|
-
run_id: `child_1_${runId}`,
|
|
116
|
-
agent_id: "agent_child_1",
|
|
117
|
-
agent_name: "Child Agent 1",
|
|
118
|
-
status: "completed",
|
|
119
|
-
parent_run_id: runId,
|
|
120
|
-
depth: 1,
|
|
121
|
-
started_at: new Date(Date.now() - 30000).toISOString(),
|
|
122
|
-
completed_at: new Date().toISOString(),
|
|
123
|
-
children: [],
|
|
124
|
-
},
|
|
125
|
-
];
|
|
126
|
-
return { data: mockChildren, error: undefined, response: new Response() };
|
|
63
|
+
return notImplemented("getChildren");
|
|
127
64
|
}
|
|
128
65
|
}
|
|
@@ -1,133 +1,72 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Incidents Module -
|
|
2
|
+
* Incidents Module - Error & Alert Management
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* Provides incident management, SLO tracking, and postmortem creation.
|
|
7
|
-
* Brings Datadog vibes to agent operations.
|
|
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 IncidentSeverity = "
|
|
11
|
-
export type IncidentStatus = "open" | "investigating" | "identified" | "monitoring" | "resolved";
|
|
8
|
+
export type IncidentSeverity = "low" | "medium" | "high" | "critical";
|
|
9
|
+
export type IncidentStatus = "open" | "investigating" | "identified" | "monitoring" | "resolved" | "closed";
|
|
12
10
|
export interface Incident {
|
|
13
11
|
id: string;
|
|
14
12
|
title: string;
|
|
15
|
-
description
|
|
13
|
+
description?: string;
|
|
16
14
|
severity: IncidentSeverity;
|
|
17
15
|
status: IncidentStatus;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
agent_id?: string;
|
|
17
|
+
run_id?: string;
|
|
18
|
+
error_type?: string;
|
|
19
|
+
error_message?: string;
|
|
20
|
+
stack_trace?: string;
|
|
21
|
+
affected_users?: number;
|
|
22
22
|
created_at: string;
|
|
23
23
|
updated_at: string;
|
|
24
24
|
resolved_at?: string;
|
|
25
|
-
created_by: string;
|
|
26
25
|
}
|
|
27
|
-
export interface
|
|
28
|
-
id: string;
|
|
29
|
-
name: string;
|
|
30
|
-
description?: string;
|
|
31
|
-
target_percentage: number;
|
|
32
|
-
current_percentage: number;
|
|
33
|
-
metric_type: "availability" | "latency" | "error_rate" | "success_rate";
|
|
34
|
-
threshold?: number;
|
|
35
|
-
window_days: number;
|
|
36
|
-
status: "healthy" | "at_risk" | "breached";
|
|
37
|
-
budget_remaining: number;
|
|
38
|
-
created_at: string;
|
|
39
|
-
}
|
|
40
|
-
export interface Postmortem {
|
|
26
|
+
export interface IncidentUpdate {
|
|
41
27
|
id: string;
|
|
42
28
|
incident_id: string;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
timeline: PostmortemEvent[];
|
|
46
|
-
root_cause_analysis: string;
|
|
47
|
-
impact: string;
|
|
48
|
-
action_items: ActionItem[];
|
|
49
|
-
lessons_learned: string[];
|
|
50
|
-
created_at: string;
|
|
29
|
+
message: string;
|
|
30
|
+
status_change?: IncidentStatus;
|
|
51
31
|
created_by: string;
|
|
32
|
+
created_at: string;
|
|
52
33
|
}
|
|
53
|
-
export interface
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
export interface ActionItem {
|
|
59
|
-
id: string;
|
|
60
|
-
description: string;
|
|
61
|
-
owner: string;
|
|
62
|
-
due_date?: string;
|
|
63
|
-
status: "open" | "in_progress" | "completed";
|
|
64
|
-
}
|
|
65
|
-
export interface IncidentListResponse {
|
|
66
|
-
items: Incident[];
|
|
67
|
-
total: number;
|
|
68
|
-
open_count: number;
|
|
69
|
-
}
|
|
70
|
-
export interface SLOListResponse {
|
|
71
|
-
items: SLO[];
|
|
72
|
-
total: number;
|
|
34
|
+
export interface IncidentMetrics {
|
|
35
|
+
total_open: number;
|
|
36
|
+
by_severity: Record<IncidentSeverity, number>;
|
|
37
|
+
mttr_seconds: number;
|
|
38
|
+
trend_last_7_days: number[];
|
|
73
39
|
}
|
|
74
40
|
export declare class IncidentsModule {
|
|
75
41
|
private client;
|
|
76
42
|
private headers;
|
|
77
43
|
constructor(client: RawClient, headers: () => Record<string, string>);
|
|
78
|
-
/**
|
|
79
|
-
* List all incidents.
|
|
80
|
-
*/
|
|
44
|
+
/** @returns 501 Not Implemented */
|
|
81
45
|
list(params?: {
|
|
82
46
|
status?: IncidentStatus;
|
|
83
47
|
severity?: IncidentSeverity;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
48
|
+
agent_id?: string;
|
|
49
|
+
limit?: number;
|
|
50
|
+
offset?: number;
|
|
51
|
+
}): Promise<APIResponse<{
|
|
52
|
+
items: Incident[];
|
|
53
|
+
total: number;
|
|
54
|
+
}>>;
|
|
55
|
+
/** @returns 501 Not Implemented */
|
|
88
56
|
get(incidentId: string): Promise<APIResponse<Incident>>;
|
|
89
|
-
/**
|
|
90
|
-
* Create a new incident.
|
|
91
|
-
*/
|
|
57
|
+
/** @returns 501 Not Implemented */
|
|
92
58
|
create(body: {
|
|
93
59
|
title: string;
|
|
94
|
-
description
|
|
60
|
+
description?: string;
|
|
95
61
|
severity: IncidentSeverity;
|
|
96
|
-
|
|
62
|
+
agent_id?: string;
|
|
63
|
+
run_id?: string;
|
|
97
64
|
}): Promise<APIResponse<Incident>>;
|
|
98
|
-
/**
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
resolve(incidentId: string,
|
|
102
|
-
/**
|
|
103
|
-
|
|
104
|
-
*/
|
|
105
|
-
linkRuns(incidentId: string, runIds: string[]): Promise<APIResponse<Incident>>;
|
|
106
|
-
/**
|
|
107
|
-
* List all SLOs.
|
|
108
|
-
*/
|
|
109
|
-
listSLOs(): Promise<APIResponse<SLOListResponse>>;
|
|
110
|
-
/**
|
|
111
|
-
* Create or update an SLO.
|
|
112
|
-
*/
|
|
113
|
-
setSLO(body: {
|
|
114
|
-
name: string;
|
|
115
|
-
description?: string;
|
|
116
|
-
target_percentage: number;
|
|
117
|
-
metric_type: SLO["metric_type"];
|
|
118
|
-
threshold?: number;
|
|
119
|
-
window_days: number;
|
|
120
|
-
}): Promise<APIResponse<SLO>>;
|
|
121
|
-
/**
|
|
122
|
-
* Create a postmortem for an incident.
|
|
123
|
-
*/
|
|
124
|
-
createPostmortem(incidentId: string, body: {
|
|
125
|
-
title: string;
|
|
126
|
-
summary: string;
|
|
127
|
-
root_cause_analysis: string;
|
|
128
|
-
impact: string;
|
|
129
|
-
lessons_learned: string[];
|
|
130
|
-
action_items: Omit<ActionItem, "id" | "status">[];
|
|
131
|
-
}): Promise<APIResponse<Postmortem>>;
|
|
65
|
+
/** @returns 501 Not Implemented */
|
|
66
|
+
update(incidentId: string, status: IncidentStatus, message?: string): Promise<APIResponse<IncidentUpdate>>;
|
|
67
|
+
/** @returns 501 Not Implemented */
|
|
68
|
+
resolve(incidentId: string, message?: string): Promise<APIResponse<Incident>>;
|
|
69
|
+
/** @returns 501 Not Implemented */
|
|
70
|
+
getMetrics(): Promise<APIResponse<IncidentMetrics>>;
|
|
132
71
|
}
|
|
133
72
|
//# sourceMappingURL=incidents.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"incidents.d.ts","sourceRoot":"","sources":["../../src/modules/incidents.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"incidents.d.ts","sourceRoot":"","sources":["../../src/modules/incidents.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAM/D,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,C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em creation.
|
|
7
|
-
* Brings Datadog vibes to agent operations.
|
|
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: `IncidentsModule.${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 IncidentsModule {
|
|
@@ -16,216 +27,28 @@ export class IncidentsModule {
|
|
|
16
27
|
this.client = client;
|
|
17
28
|
this.headers = headers;
|
|
18
29
|
}
|
|
19
|
-
|
|
20
|
-
// MOCK - Simulated list
|
|
21
|
-
/**
|
|
22
|
-
* List all incidents.
|
|
23
|
-
*/
|
|
30
|
+
/** @returns 501 Not Implemented */
|
|
24
31
|
async list(params) {
|
|
25
|
-
|
|
26
|
-
const mockIncidents = {
|
|
27
|
-
items: [
|
|
28
|
-
{
|
|
29
|
-
id: "inc_1",
|
|
30
|
-
title: "High error rate on Support Agent",
|
|
31
|
-
description: "Error rate exceeded 5% threshold",
|
|
32
|
-
severity: "major",
|
|
33
|
-
status: "investigating",
|
|
34
|
-
affected_agents: ["agent_support"],
|
|
35
|
-
affected_runs: ["run_123", "run_124", "run_125"],
|
|
36
|
-
created_at: new Date(Date.now() - 3600000).toISOString(),
|
|
37
|
-
updated_at: new Date().toISOString(),
|
|
38
|
-
created_by: "system",
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
total: 1,
|
|
42
|
-
open_count: 1,
|
|
43
|
-
};
|
|
44
|
-
return { data: mockIncidents, error: undefined, response: new Response() };
|
|
32
|
+
return notImplemented("list");
|
|
45
33
|
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Get an incident by ID.
|
|
49
|
-
*/
|
|
34
|
+
/** @returns 501 Not Implemented */
|
|
50
35
|
async get(incidentId) {
|
|
51
|
-
|
|
52
|
-
const mockIncident = {
|
|
53
|
-
id: incidentId,
|
|
54
|
-
title: "High error rate on Support Agent",
|
|
55
|
-
description: "Error rate exceeded 5% threshold",
|
|
56
|
-
severity: "major",
|
|
57
|
-
status: "investigating",
|
|
58
|
-
affected_agents: ["agent_support"],
|
|
59
|
-
affected_runs: ["run_123", "run_124", "run_125"],
|
|
60
|
-
created_at: new Date(Date.now() - 3600000).toISOString(),
|
|
61
|
-
updated_at: new Date().toISOString(),
|
|
62
|
-
created_by: "system",
|
|
63
|
-
};
|
|
64
|
-
return { data: mockIncident, error: undefined, response: new Response() };
|
|
36
|
+
return notImplemented("get");
|
|
65
37
|
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Create a new incident.
|
|
69
|
-
*/
|
|
38
|
+
/** @returns 501 Not Implemented */
|
|
70
39
|
async create(body) {
|
|
71
|
-
|
|
72
|
-
const mockIncident = {
|
|
73
|
-
id: `inc_${Date.now()}`,
|
|
74
|
-
title: body.title,
|
|
75
|
-
description: body.description,
|
|
76
|
-
severity: body.severity,
|
|
77
|
-
status: "open",
|
|
78
|
-
affected_agents: body.affected_agents || [],
|
|
79
|
-
affected_runs: [],
|
|
80
|
-
created_at: new Date().toISOString(),
|
|
81
|
-
updated_at: new Date().toISOString(),
|
|
82
|
-
created_by: "user_current",
|
|
83
|
-
};
|
|
84
|
-
return { data: mockIncident, error: undefined, response: new Response() };
|
|
85
|
-
}
|
|
86
|
-
// MOCK - Simulated resolve
|
|
87
|
-
/**
|
|
88
|
-
* Resolve an incident.
|
|
89
|
-
*/
|
|
90
|
-
async resolve(incidentId, resolution) {
|
|
91
|
-
// MOCK - Returns simulated data
|
|
92
|
-
const mockIncident = {
|
|
93
|
-
id: incidentId,
|
|
94
|
-
title: "High error rate on Support Agent",
|
|
95
|
-
description: "Error rate exceeded 5% threshold",
|
|
96
|
-
severity: "major",
|
|
97
|
-
status: "resolved",
|
|
98
|
-
affected_agents: ["agent_support"],
|
|
99
|
-
affected_runs: [],
|
|
100
|
-
root_cause: "Model provider rate limit",
|
|
101
|
-
resolution,
|
|
102
|
-
created_at: new Date(Date.now() - 7200000).toISOString(),
|
|
103
|
-
updated_at: new Date().toISOString(),
|
|
104
|
-
resolved_at: new Date().toISOString(),
|
|
105
|
-
created_by: "system",
|
|
106
|
-
};
|
|
107
|
-
return { data: mockIncident, error: undefined, response: new Response() };
|
|
108
|
-
}
|
|
109
|
-
// MOCK - Simulated linkRuns
|
|
110
|
-
/**
|
|
111
|
-
* Link runs to an incident.
|
|
112
|
-
*/
|
|
113
|
-
async linkRuns(incidentId, runIds) {
|
|
114
|
-
// MOCK - Returns simulated data
|
|
115
|
-
const mockIncident = {
|
|
116
|
-
id: incidentId,
|
|
117
|
-
title: "High error rate on Support Agent",
|
|
118
|
-
description: "Error rate exceeded 5% threshold",
|
|
119
|
-
severity: "major",
|
|
120
|
-
status: "investigating",
|
|
121
|
-
affected_agents: ["agent_support"],
|
|
122
|
-
affected_runs: runIds,
|
|
123
|
-
created_at: new Date(Date.now() - 3600000).toISOString(),
|
|
124
|
-
updated_at: new Date().toISOString(),
|
|
125
|
-
created_by: "system",
|
|
126
|
-
};
|
|
127
|
-
return { data: mockIncident, error: undefined, response: new Response() };
|
|
40
|
+
return notImplemented("create");
|
|
128
41
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
* List all SLOs.
|
|
133
|
-
*/
|
|
134
|
-
async listSLOs() {
|
|
135
|
-
// MOCK - Returns simulated data
|
|
136
|
-
const mockSLOs = {
|
|
137
|
-
items: [
|
|
138
|
-
{
|
|
139
|
-
id: "slo_availability",
|
|
140
|
-
name: "Agent Availability",
|
|
141
|
-
description: "99.9% availability for all agents",
|
|
142
|
-
target_percentage: 99.9,
|
|
143
|
-
current_percentage: 99.95,
|
|
144
|
-
metric_type: "availability",
|
|
145
|
-
window_days: 30,
|
|
146
|
-
status: "healthy",
|
|
147
|
-
budget_remaining: 0.05,
|
|
148
|
-
created_at: new Date(Date.now() - 86400000 * 30).toISOString(),
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
id: "slo_latency",
|
|
152
|
-
name: "Response Latency",
|
|
153
|
-
description: "P95 latency under 2s",
|
|
154
|
-
target_percentage: 95,
|
|
155
|
-
current_percentage: 97.5,
|
|
156
|
-
metric_type: "latency",
|
|
157
|
-
threshold: 2000,
|
|
158
|
-
window_days: 7,
|
|
159
|
-
status: "healthy",
|
|
160
|
-
budget_remaining: 2.5,
|
|
161
|
-
created_at: new Date(Date.now() - 86400000 * 7).toISOString(),
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
id: "slo_errors",
|
|
165
|
-
name: "Error Rate",
|
|
166
|
-
description: "Error rate below 1%",
|
|
167
|
-
target_percentage: 99,
|
|
168
|
-
current_percentage: 98.2,
|
|
169
|
-
metric_type: "error_rate",
|
|
170
|
-
window_days: 7,
|
|
171
|
-
status: "at_risk",
|
|
172
|
-
budget_remaining: -0.8,
|
|
173
|
-
created_at: new Date(Date.now() - 86400000 * 7).toISOString(),
|
|
174
|
-
},
|
|
175
|
-
],
|
|
176
|
-
total: 3,
|
|
177
|
-
};
|
|
178
|
-
return { data: mockSLOs, error: undefined, response: new Response() };
|
|
42
|
+
/** @returns 501 Not Implemented */
|
|
43
|
+
async update(incidentId, status, message) {
|
|
44
|
+
return notImplemented("update");
|
|
179
45
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
*/
|
|
184
|
-
async setSLO(body) {
|
|
185
|
-
// MOCK - Returns simulated data
|
|
186
|
-
const mockSLO = {
|
|
187
|
-
id: `slo_${Date.now()}`,
|
|
188
|
-
name: body.name,
|
|
189
|
-
description: body.description,
|
|
190
|
-
target_percentage: body.target_percentage,
|
|
191
|
-
current_percentage: 100,
|
|
192
|
-
metric_type: body.metric_type,
|
|
193
|
-
threshold: body.threshold,
|
|
194
|
-
window_days: body.window_days,
|
|
195
|
-
status: "healthy",
|
|
196
|
-
budget_remaining: 100 - body.target_percentage,
|
|
197
|
-
created_at: new Date().toISOString(),
|
|
198
|
-
};
|
|
199
|
-
return { data: mockSLO, error: undefined, response: new Response() };
|
|
46
|
+
/** @returns 501 Not Implemented */
|
|
47
|
+
async resolve(incidentId, message) {
|
|
48
|
+
return notImplemented("resolve");
|
|
200
49
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
* Create a postmortem for an incident.
|
|
205
|
-
*/
|
|
206
|
-
async createPostmortem(incidentId, body) {
|
|
207
|
-
// MOCK - Returns simulated data
|
|
208
|
-
const mockPostmortem = {
|
|
209
|
-
id: `pm_${Date.now()}`,
|
|
210
|
-
incident_id: incidentId,
|
|
211
|
-
title: body.title,
|
|
212
|
-
summary: body.summary,
|
|
213
|
-
timeline: [
|
|
214
|
-
{ timestamp: new Date(Date.now() - 7200000).toISOString(), description: "Incident detected" },
|
|
215
|
-
{ timestamp: new Date(Date.now() - 3600000).toISOString(), description: "Root cause identified" },
|
|
216
|
-
{ timestamp: new Date().toISOString(), description: "Incident resolved" },
|
|
217
|
-
],
|
|
218
|
-
root_cause_analysis: body.root_cause_analysis,
|
|
219
|
-
impact: body.impact,
|
|
220
|
-
action_items: body.action_items.map((item, i) => ({
|
|
221
|
-
...item,
|
|
222
|
-
id: `action_${i}`,
|
|
223
|
-
status: "open",
|
|
224
|
-
})),
|
|
225
|
-
lessons_learned: body.lessons_learned,
|
|
226
|
-
created_at: new Date().toISOString(),
|
|
227
|
-
created_by: "user_current",
|
|
228
|
-
};
|
|
229
|
-
return { data: mockPostmortem, error: undefined, response: new Response() };
|
|
50
|
+
/** @returns 501 Not Implemented */
|
|
51
|
+
async getMetrics() {
|
|
52
|
+
return notImplemented("getMetrics");
|
|
230
53
|
}
|
|
231
54
|
}
|