triagent 0.1.0-alpha2 → 0.1.0-alpha4
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 +65 -7
- package/bunfig.toml +4 -0
- package/package.json +1 -1
- package/src/cli/config.ts +1 -0
- package/src/config.ts +2 -0
- package/src/index.ts +3 -0
- package/src/mastra/agents/debugger.ts +6 -3
package/README.md
CHANGED
|
@@ -5,7 +5,17 @@ AI-powered Kubernetes debugging agent with terminal UI.
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
bun
|
|
8
|
+
# bun
|
|
9
|
+
bun install -g triagent
|
|
10
|
+
|
|
11
|
+
# npm
|
|
12
|
+
npm install -g triagent
|
|
13
|
+
|
|
14
|
+
# yarn
|
|
15
|
+
yarn global add triagent
|
|
16
|
+
|
|
17
|
+
# pnpm
|
|
18
|
+
pnpm add -g triagent
|
|
9
19
|
```
|
|
10
20
|
|
|
11
21
|
## Usage
|
|
@@ -20,14 +30,62 @@ triagent --webhook-only
|
|
|
20
30
|
|
|
21
31
|
## Configuration
|
|
22
32
|
|
|
23
|
-
|
|
33
|
+
Configuration can be set via CLI commands or environment variables. CLI config takes precedence over environment variables.
|
|
34
|
+
|
|
35
|
+
### CLI Config
|
|
24
36
|
|
|
25
37
|
```bash
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
#
|
|
30
|
-
|
|
38
|
+
# Set configuration values
|
|
39
|
+
triagent config set <key> <value>
|
|
40
|
+
|
|
41
|
+
# Get a configuration value
|
|
42
|
+
triagent config get <key>
|
|
43
|
+
|
|
44
|
+
# List all configuration values
|
|
45
|
+
triagent config list
|
|
46
|
+
|
|
47
|
+
# Show config file path
|
|
48
|
+
triagent config path
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Config Keys
|
|
52
|
+
|
|
53
|
+
| Key | Description | Default |
|
|
54
|
+
|-----|-------------|---------|
|
|
55
|
+
| `aiProvider` | AI provider (`openai`, `anthropic`, `google`) | `anthropic` |
|
|
56
|
+
| `aiModel` | Model ID (e.g., `gpt-4o`, `claude-sonnet-4-20250514`) | Provider default |
|
|
57
|
+
| `apiKey` | API key for the provider | - |
|
|
58
|
+
| `baseUrl` | Custom API base URL (for proxies or local models) | - |
|
|
59
|
+
| `webhookPort` | Webhook server port | `3000` |
|
|
60
|
+
| `codebasePath` | Path to codebase | `./` |
|
|
61
|
+
| `kubeConfigPath` | Kubernetes config path | `~/.kube` |
|
|
62
|
+
|
|
63
|
+
### Environment Variables
|
|
64
|
+
|
|
65
|
+
| Variable | Description |
|
|
66
|
+
|----------|-------------|
|
|
67
|
+
| `AI_PROVIDER` | AI provider (`openai`, `anthropic`, `google`) |
|
|
68
|
+
| `AI_MODEL` | Model ID |
|
|
69
|
+
| `AI_BASE_URL` | Custom API base URL |
|
|
70
|
+
| `OPENAI_API_KEY` | OpenAI API key |
|
|
71
|
+
| `ANTHROPIC_API_KEY` | Anthropic API key |
|
|
72
|
+
| `GOOGLE_GENERATIVE_AI_API_KEY` | Google AI API key |
|
|
73
|
+
| `WEBHOOK_PORT` | Webhook server port |
|
|
74
|
+
| `CODEBASE_PATH` | Path to codebase |
|
|
75
|
+
| `KUBE_CONFIG_PATH` | Kubernetes config path |
|
|
76
|
+
|
|
77
|
+
### Examples
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Configure with Anthropic (default)
|
|
81
|
+
triagent config set apiKey sk-ant-...
|
|
82
|
+
|
|
83
|
+
# Configure with OpenAI
|
|
84
|
+
triagent config set aiProvider openai
|
|
85
|
+
triagent config set apiKey sk-proj-...
|
|
86
|
+
|
|
87
|
+
# Use a custom API endpoint (e.g., proxy or local model)
|
|
88
|
+
triagent config set baseUrl https://your-proxy.example.com/v1
|
|
31
89
|
```
|
|
32
90
|
|
|
33
91
|
## Development
|
package/bunfig.toml
CHANGED
package/package.json
CHANGED
package/src/cli/config.ts
CHANGED
package/src/config.ts
CHANGED
|
@@ -10,6 +10,7 @@ const ConfigSchema = z.object({
|
|
|
10
10
|
aiProvider: AIProviderSchema,
|
|
11
11
|
aiModel: z.string().min(1),
|
|
12
12
|
apiKey: z.string().min(1),
|
|
13
|
+
baseUrl: z.string().url().optional(),
|
|
13
14
|
webhookPort: z.number().int().positive().default(3000),
|
|
14
15
|
codebasePath: z.string().min(1).default("./"),
|
|
15
16
|
kubeConfigPath: z.string().min(1).default("~/.kube"),
|
|
@@ -47,6 +48,7 @@ export async function loadConfig(): Promise<Config> {
|
|
|
47
48
|
aiProvider: provider,
|
|
48
49
|
aiModel: process.env.AI_MODEL || stored.aiModel || getDefaultModel(provider),
|
|
49
50
|
apiKey: getApiKey(provider, stored),
|
|
51
|
+
baseUrl: process.env.AI_BASE_URL || stored.baseUrl || undefined,
|
|
50
52
|
webhookPort: parseInt(process.env.WEBHOOK_PORT || String(stored.webhookPort || 3000), 10),
|
|
51
53
|
codebasePath: expandPath(process.env.CODEBASE_PATH || stored.codebasePath || "./"),
|
|
52
54
|
kubeConfigPath: expandPath(process.env.KUBE_CONFIG_PATH || stored.kubeConfigPath || "~/.kube"),
|
package/src/index.ts
CHANGED
|
@@ -84,6 +84,7 @@ CONFIG KEYS:
|
|
|
84
84
|
aiProvider - AI provider (openai, anthropic, google)
|
|
85
85
|
aiModel - Model ID (e.g., gpt-4o, claude-sonnet-4-20250514)
|
|
86
86
|
apiKey - API key for the provider
|
|
87
|
+
baseUrl - Custom API base URL (for proxies or local models)
|
|
87
88
|
webhookPort - Webhook server port (default: 3000)
|
|
88
89
|
codebasePath - Path to codebase (default: ./)
|
|
89
90
|
kubeConfigPath - Kubernetes config path (default: ~/.kube)
|
|
@@ -109,6 +110,7 @@ MODES:
|
|
|
109
110
|
ENVIRONMENT VARIABLES:
|
|
110
111
|
AI_PROVIDER - AI provider (openai, anthropic, google)
|
|
111
112
|
AI_MODEL - Model ID (e.g., gpt-4o, claude-3-5-sonnet)
|
|
113
|
+
AI_BASE_URL - Custom API base URL (for proxies or local models)
|
|
112
114
|
OPENAI_API_KEY - OpenAI API key
|
|
113
115
|
ANTHROPIC_API_KEY - Anthropic API key
|
|
114
116
|
GOOGLE_GENERATIVE_AI_API_KEY - Google AI API key
|
|
@@ -179,6 +181,7 @@ async function handleConfigCommand(args: CliArgs): Promise<void> {
|
|
|
179
181
|
"aiProvider",
|
|
180
182
|
"aiModel",
|
|
181
183
|
"apiKey",
|
|
184
|
+
"baseUrl",
|
|
182
185
|
"webhookPort",
|
|
183
186
|
"codebasePath",
|
|
184
187
|
"kubeConfigPath",
|
|
@@ -163,14 +163,17 @@ export const InvestigationResultSchema = z.object({
|
|
|
163
163
|
export type InvestigationResult = z.infer<typeof InvestigationResultSchema>;
|
|
164
164
|
|
|
165
165
|
export function createDebuggerAgent(config: Config) {
|
|
166
|
-
// Construct model
|
|
167
|
-
const
|
|
166
|
+
// Construct model config - use OpenAICompatibleConfig if baseUrl is set
|
|
167
|
+
const modelId = `${config.aiProvider}/${config.aiModel}` as const;
|
|
168
|
+
const modelConfig = config.baseUrl
|
|
169
|
+
? { id: modelId, url: config.baseUrl }
|
|
170
|
+
: modelId;
|
|
168
171
|
|
|
169
172
|
return new Agent({
|
|
170
173
|
id: "kubernetes-debugger",
|
|
171
174
|
name: "Kubernetes Debugger",
|
|
172
175
|
instructions: DEBUGGER_INSTRUCTIONS,
|
|
173
|
-
model:
|
|
176
|
+
model: modelConfig as any, // Mastra handles model routing
|
|
174
177
|
tools: {
|
|
175
178
|
cli: cliTool,
|
|
176
179
|
git: gitTool,
|