triagent 0.1.0-alpha9 → 0.1.0-beta2
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/README.md +101 -1
- package/package.json +9 -3
- package/src/cli/config.ts +118 -2
- package/src/config.ts +23 -3
- package/src/index.ts +262 -6
- package/src/integrations/elasticsearch/client.ts +210 -0
- package/src/integrations/grafana/client.ts +186 -0
- package/src/integrations/kubernetes/multi-cluster.ts +199 -0
- package/src/integrations/kubernetes/types.ts +24 -0
- package/src/integrations/loki/client.ts +219 -0
- package/src/integrations/prometheus/client.ts +163 -0
- package/src/integrations/slack/client.ts +265 -0
- package/src/integrations/teams/client.ts +199 -0
- package/src/mastra/agents/debugger.ts +164 -109
- package/src/mastra/index.ts +2 -2
- package/src/mastra/tools/approval-store.ts +180 -0
- package/src/mastra/tools/cli.ts +94 -2
- package/src/mastra/tools/cost.ts +389 -0
- package/src/mastra/tools/logs.ts +210 -0
- package/src/mastra/tools/network.ts +253 -0
- package/src/mastra/tools/prometheus.ts +221 -0
- package/src/mastra/tools/remediation.ts +365 -0
- package/src/mastra/tools/runbook.ts +186 -0
- package/src/sandbox/bashlet.ts +76 -10
- package/src/server/routes/history.ts +207 -0
- package/src/server/routes/notifications.ts +236 -0
- package/src/server/webhook.ts +36 -2
- package/src/storage/index.ts +3 -0
- package/src/storage/investigation-history.ts +277 -0
- package/src/storage/runbook-index.ts +330 -0
- package/src/storage/types.ts +72 -0
- package/src/tui/app.tsx +278 -197
- package/src/tui/components/approval-dialog.tsx +147 -0
- package/src/tui/components/approval-modal.tsx +278 -0
- package/src/tui/components/centered-layout.tsx +33 -0
- package/src/tui/components/editor.tsx +87 -0
- package/src/tui/components/header.tsx +53 -0
- package/src/tui/components/index.ts +55 -0
- package/src/tui/components/message-item.tsx +131 -0
- package/src/tui/components/messages-panel.tsx +71 -0
- package/src/tui/components/status-badge.tsx +20 -0
- package/src/tui/components/status-bar.tsx +39 -0
- package/src/tui/components/styled-span.tsx +24 -0
- package/src/tui/components/timeline.tsx +223 -0
- package/src/tui/components/toast.tsx +104 -0
- package/src/tui/theme/index.ts +21 -0
- package/src/tui/theme/tokens.ts +180 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Design Tokens for Triagent TUI
|
|
3
|
+
* Centralized colors, spacing, and layout constants
|
|
4
|
+
* Inspired by OpenCode's visual style
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { createTextAttributes } from "@opentui/core";
|
|
8
|
+
|
|
9
|
+
// ============================================================================
|
|
10
|
+
// COLORS
|
|
11
|
+
// ============================================================================
|
|
12
|
+
|
|
13
|
+
export const colors = {
|
|
14
|
+
// Primary brand color
|
|
15
|
+
primary: "red",
|
|
16
|
+
primaryHex: "#ef4444",
|
|
17
|
+
|
|
18
|
+
// Semantic colors
|
|
19
|
+
success: "green",
|
|
20
|
+
successHex: "#22c55e",
|
|
21
|
+
warning: "yellow",
|
|
22
|
+
warningHex: "#eab308",
|
|
23
|
+
error: "red",
|
|
24
|
+
errorHex: "#ef4444",
|
|
25
|
+
info: "cyan",
|
|
26
|
+
infoHex: "#06b6d4",
|
|
27
|
+
|
|
28
|
+
// Text colors
|
|
29
|
+
text: {
|
|
30
|
+
primary: "white",
|
|
31
|
+
secondary: "gray",
|
|
32
|
+
muted: "gray",
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
// Background colors
|
|
36
|
+
background: {
|
|
37
|
+
primary: "#1a1a1a",
|
|
38
|
+
secondary: "#2a2a2a",
|
|
39
|
+
elevated: "#333333",
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
// Border colors
|
|
43
|
+
border: {
|
|
44
|
+
default: "gray",
|
|
45
|
+
focused: "cyan",
|
|
46
|
+
active: "red",
|
|
47
|
+
muted: "#444444",
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
// Role-specific colors
|
|
51
|
+
role: {
|
|
52
|
+
user: "cyan",
|
|
53
|
+
assistant: "green",
|
|
54
|
+
tool: "blue",
|
|
55
|
+
system: "magenta",
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
// Risk level colors
|
|
59
|
+
risk: {
|
|
60
|
+
low: "green",
|
|
61
|
+
lowHex: "#22c55e",
|
|
62
|
+
medium: "yellow",
|
|
63
|
+
mediumHex: "#eab308",
|
|
64
|
+
high: "red",
|
|
65
|
+
highHex: "#ef4444",
|
|
66
|
+
critical: "magenta",
|
|
67
|
+
criticalHex: "#ec4899",
|
|
68
|
+
},
|
|
69
|
+
} as const;
|
|
70
|
+
|
|
71
|
+
// ============================================================================
|
|
72
|
+
// SPACING
|
|
73
|
+
// ============================================================================
|
|
74
|
+
|
|
75
|
+
export const spacing = {
|
|
76
|
+
xs: 1,
|
|
77
|
+
sm: 2,
|
|
78
|
+
md: 3,
|
|
79
|
+
lg: 4,
|
|
80
|
+
xl: 6,
|
|
81
|
+
} as const;
|
|
82
|
+
|
|
83
|
+
// ============================================================================
|
|
84
|
+
// LAYOUT
|
|
85
|
+
// ============================================================================
|
|
86
|
+
|
|
87
|
+
export const layout = {
|
|
88
|
+
maxWidth: 100,
|
|
89
|
+
headerHeight: 4,
|
|
90
|
+
footerHeight: 1,
|
|
91
|
+
inputHeight: 3,
|
|
92
|
+
minContentHeight: 10,
|
|
93
|
+
} as const;
|
|
94
|
+
|
|
95
|
+
// ============================================================================
|
|
96
|
+
// TEXT ATTRIBUTES
|
|
97
|
+
// ============================================================================
|
|
98
|
+
|
|
99
|
+
export const ATTR_BOLD = createTextAttributes({ bold: true });
|
|
100
|
+
export const ATTR_DIM = createTextAttributes({ dim: true });
|
|
101
|
+
export const ATTR_ITALIC = createTextAttributes({ italic: true });
|
|
102
|
+
export const ATTR_UNDERLINE = createTextAttributes({ underline: true });
|
|
103
|
+
export const ATTR_BOLD_DIM = createTextAttributes({ bold: true, dim: true });
|
|
104
|
+
|
|
105
|
+
// ============================================================================
|
|
106
|
+
// HELPER FUNCTIONS
|
|
107
|
+
// ============================================================================
|
|
108
|
+
|
|
109
|
+
export type RiskLevel = "low" | "medium" | "high" | "critical";
|
|
110
|
+
|
|
111
|
+
export function getRiskColor(risk: RiskLevel): string {
|
|
112
|
+
switch (risk) {
|
|
113
|
+
case "low":
|
|
114
|
+
return colors.risk.low;
|
|
115
|
+
case "medium":
|
|
116
|
+
return colors.risk.medium;
|
|
117
|
+
case "high":
|
|
118
|
+
return colors.risk.high;
|
|
119
|
+
case "critical":
|
|
120
|
+
return colors.risk.critical;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function getRiskHexColor(risk: RiskLevel): string {
|
|
125
|
+
switch (risk) {
|
|
126
|
+
case "low":
|
|
127
|
+
return colors.risk.lowHex;
|
|
128
|
+
case "medium":
|
|
129
|
+
return colors.risk.mediumHex;
|
|
130
|
+
case "high":
|
|
131
|
+
return colors.risk.highHex;
|
|
132
|
+
case "critical":
|
|
133
|
+
return colors.risk.criticalHex;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function getRiskEmoji(risk: RiskLevel): string {
|
|
138
|
+
switch (risk) {
|
|
139
|
+
case "low":
|
|
140
|
+
return "●";
|
|
141
|
+
case "medium":
|
|
142
|
+
return "●";
|
|
143
|
+
case "high":
|
|
144
|
+
return "●";
|
|
145
|
+
case "critical":
|
|
146
|
+
return "●";
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export type AppStatus = "idle" | "investigating" | "awaiting_approval" | "complete" | "error";
|
|
151
|
+
|
|
152
|
+
export function getStatusColor(status: AppStatus): string {
|
|
153
|
+
switch (status) {
|
|
154
|
+
case "investigating":
|
|
155
|
+
return colors.warning;
|
|
156
|
+
case "awaiting_approval":
|
|
157
|
+
return colors.error;
|
|
158
|
+
case "complete":
|
|
159
|
+
return colors.success;
|
|
160
|
+
case "error":
|
|
161
|
+
return colors.error;
|
|
162
|
+
default:
|
|
163
|
+
return colors.text.secondary;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export function getStatusText(status: AppStatus, currentTool?: string | null): string {
|
|
168
|
+
switch (status) {
|
|
169
|
+
case "investigating":
|
|
170
|
+
return currentTool ? `Running: ${currentTool}` : "Investigating...";
|
|
171
|
+
case "awaiting_approval":
|
|
172
|
+
return "Awaiting Approval";
|
|
173
|
+
case "complete":
|
|
174
|
+
return "Complete";
|
|
175
|
+
case "error":
|
|
176
|
+
return "Error";
|
|
177
|
+
default:
|
|
178
|
+
return "Ready";
|
|
179
|
+
}
|
|
180
|
+
}
|