@vfarcic/dot-ai 0.108.0 → 0.110.0
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/core/ai-provider.interface.d.ts +11 -16
- package/dist/core/ai-provider.interface.d.ts.map +1 -1
- package/dist/core/kubectl-tools.d.ts +66 -0
- package/dist/core/kubectl-tools.d.ts.map +1 -0
- package/dist/core/kubectl-tools.js +473 -0
- package/dist/core/kubernetes-utils.d.ts +1 -0
- package/dist/core/kubernetes-utils.d.ts.map +1 -1
- package/dist/core/kubernetes-utils.js +30 -0
- package/dist/core/providers/anthropic-provider.d.ts +5 -4
- package/dist/core/providers/anthropic-provider.d.ts.map +1 -1
- package/dist/core/providers/anthropic-provider.js +152 -109
- package/dist/core/providers/provider-debug-utils.d.ts +47 -4
- package/dist/core/providers/provider-debug-utils.d.ts.map +1 -1
- package/dist/core/providers/provider-debug-utils.js +67 -7
- package/dist/core/providers/vercel-provider.d.ts +11 -21
- package/dist/core/providers/vercel-provider.d.ts.map +1 -1
- package/dist/core/providers/vercel-provider.js +285 -25
- package/dist/tools/remediate.d.ts +0 -40
- package/dist/tools/remediate.d.ts.map +1 -1
- package/dist/tools/remediate.js +133 -493
- package/package.json +1 -1
- package/prompts/remediate-system.md +166 -0
- package/prompts/remediate-final-analysis.md +0 -243
- package/prompts/remediate-investigation.md +0 -194
|
@@ -5,6 +5,39 @@
|
|
|
5
5
|
* Implements AIProvider interface using Vercel AI SDK.
|
|
6
6
|
* Supports OpenAI and Google Gemini providers through unified interface.
|
|
7
7
|
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
8
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
42
|
exports.VercelProvider = void 0;
|
|
10
43
|
const ai_1 = require("ai");
|
|
@@ -75,7 +108,7 @@ class VercelProvider {
|
|
|
75
108
|
}
|
|
76
109
|
}
|
|
77
110
|
getProviderType() {
|
|
78
|
-
return
|
|
111
|
+
return 'vercel';
|
|
79
112
|
}
|
|
80
113
|
getDefaultModel() {
|
|
81
114
|
return PROVIDER_MODELS[this.providerType];
|
|
@@ -83,6 +116,21 @@ class VercelProvider {
|
|
|
83
116
|
isInitialized() {
|
|
84
117
|
return this.modelInstance !== undefined;
|
|
85
118
|
}
|
|
119
|
+
logDebugIfEnabled(operation, prompt, response, durationMs) {
|
|
120
|
+
if (!this.debugMode)
|
|
121
|
+
return;
|
|
122
|
+
const debugId = (0, provider_debug_utils_1.generateDebugId)(operation);
|
|
123
|
+
(0, provider_debug_utils_1.debugLogInteraction)(debugId, prompt, response, operation, this.getProviderType(), this.model, this.debugMode);
|
|
124
|
+
// Use logMetrics for sendMessage calls (simple token structure, no extended metrics)
|
|
125
|
+
(0, provider_debug_utils_1.logMetrics)(operation, this.getProviderType(), {
|
|
126
|
+
totalTokens: {
|
|
127
|
+
input: response.usage.input_tokens,
|
|
128
|
+
output: response.usage.output_tokens,
|
|
129
|
+
cacheCreation: response.usage.cache_creation_input_tokens,
|
|
130
|
+
cacheRead: response.usage.cache_read_input_tokens
|
|
131
|
+
}
|
|
132
|
+
}, durationMs, this.debugMode);
|
|
133
|
+
}
|
|
86
134
|
async sendMessage(message, operation = 'generic') {
|
|
87
135
|
if (!this.isInitialized()) {
|
|
88
136
|
throw new Error(`${this.providerType} provider not initialized`);
|
|
@@ -107,7 +155,14 @@ class VercelProvider {
|
|
|
107
155
|
if (this.debugMode) {
|
|
108
156
|
const debugId = (0, provider_debug_utils_1.generateDebugId)(operation);
|
|
109
157
|
(0, provider_debug_utils_1.debugLogInteraction)(debugId, message, response, operation, this.getProviderType(), this.model, this.debugMode);
|
|
110
|
-
(0, provider_debug_utils_1.logMetrics)(operation, this.getProviderType(),
|
|
158
|
+
(0, provider_debug_utils_1.logMetrics)(operation, this.getProviderType(), {
|
|
159
|
+
totalTokens: {
|
|
160
|
+
input: response.usage.input_tokens,
|
|
161
|
+
output: response.usage.output_tokens,
|
|
162
|
+
cacheCreation: response.usage.cache_creation_input_tokens,
|
|
163
|
+
cacheRead: response.usage.cache_read_input_tokens
|
|
164
|
+
}
|
|
165
|
+
}, durationMs, this.debugMode);
|
|
111
166
|
}
|
|
112
167
|
return response;
|
|
113
168
|
}
|
|
@@ -116,37 +171,242 @@ class VercelProvider {
|
|
|
116
171
|
}
|
|
117
172
|
}
|
|
118
173
|
/**
|
|
119
|
-
* Agentic tool loop
|
|
174
|
+
* Agentic tool loop using Vercel AI SDK
|
|
120
175
|
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
* 2. JSON-based agentic loops already provide equivalent functionality
|
|
124
|
-
* 3. No current workflows require SDK-managed tool loops
|
|
176
|
+
* Implements multi-turn tool calling using generateText with maxSteps.
|
|
177
|
+
* The Vercel AI SDK handles the conversation loop automatically.
|
|
125
178
|
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
179
|
+
* Provider-specific caching:
|
|
180
|
+
* - Anthropic: Manual cache control via providerOptions
|
|
181
|
+
* - OpenAI: Automatic caching (no code changes needed)
|
|
182
|
+
* - Google: Check Gemini caching capabilities
|
|
128
183
|
*
|
|
129
|
-
* See
|
|
184
|
+
* See PRD #143 Milestone 2.5 for Vercel provider implementation details.
|
|
130
185
|
*/
|
|
131
|
-
async toolLoop(
|
|
186
|
+
async toolLoop(config) {
|
|
132
187
|
if (!this.isInitialized()) {
|
|
133
188
|
throw new Error(`${this.providerType} provider not initialized`);
|
|
134
189
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
190
|
+
const startTime = Date.now();
|
|
191
|
+
const maxIterations = config.maxIterations || 20;
|
|
192
|
+
const operation = config.operation || 'tool-loop';
|
|
193
|
+
// Convert AITool[] to Vercel AI SDK tool format
|
|
194
|
+
const tools = {};
|
|
195
|
+
for (let i = 0; i < config.tools.length; i++) {
|
|
196
|
+
const aiTool = config.tools[i];
|
|
197
|
+
const isLastTool = i === config.tools.length - 1;
|
|
198
|
+
const toolDef = (0, ai_1.tool)({
|
|
199
|
+
description: aiTool.description,
|
|
200
|
+
inputSchema: (0, ai_1.jsonSchema)(aiTool.inputSchema),
|
|
201
|
+
execute: async (input) => {
|
|
202
|
+
return await config.toolExecutor(aiTool.name, input);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
// Add cache control ONLY to last tool for Anthropic (max 4 cache breakpoints)
|
|
206
|
+
// This caches the system prompt + all tools together
|
|
207
|
+
if (this.providerType === 'anthropic' && isLastTool) {
|
|
208
|
+
toolDef.providerOptions = {
|
|
209
|
+
anthropic: {
|
|
210
|
+
cacheControl: { type: 'ephemeral' }
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
// TODO: Check if Google Gemini supports caching in future SDK versions
|
|
215
|
+
// Google Gemini may have caching capabilities - research providerOptions.google syntax
|
|
216
|
+
// if (this.providerType === 'google' && isLastTool) {
|
|
217
|
+
// (toolDef as any).providerOptions = {
|
|
218
|
+
// google: { /* caching config if available */ }
|
|
219
|
+
// };
|
|
220
|
+
// }
|
|
221
|
+
tools[aiTool.name] = toolDef;
|
|
222
|
+
}
|
|
223
|
+
// Build messages array with system prompt caching for Anthropic
|
|
224
|
+
// Anthropic caching requires system messages in messages array with providerOptions
|
|
225
|
+
const messages = [];
|
|
226
|
+
let systemParam;
|
|
227
|
+
if (this.providerType === 'anthropic') {
|
|
228
|
+
// For Anthropic: Put system in messages array with cacheControl
|
|
229
|
+
messages.push({
|
|
230
|
+
role: 'system',
|
|
231
|
+
content: config.systemPrompt,
|
|
232
|
+
providerOptions: {
|
|
233
|
+
anthropic: {
|
|
234
|
+
cacheControl: { type: 'ephemeral' }
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
// Don't use system parameter for Anthropic when caching
|
|
239
|
+
systemParam = undefined;
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
// For OpenAI/Google: Use system parameter (string)
|
|
243
|
+
systemParam = config.systemPrompt;
|
|
244
|
+
}
|
|
245
|
+
// Add user message
|
|
246
|
+
messages.push({
|
|
247
|
+
role: 'user',
|
|
248
|
+
content: config.userMessage
|
|
249
|
+
});
|
|
250
|
+
// TODO: Check if Google Gemini supports system prompt caching in future SDK versions
|
|
251
|
+
// if (this.providerType === 'google') {
|
|
252
|
+
// messages.unshift({
|
|
253
|
+
// role: 'system',
|
|
254
|
+
// content: config.systemPrompt,
|
|
255
|
+
// providerOptions: {
|
|
256
|
+
// google: { /* caching config if available */ }
|
|
257
|
+
// }
|
|
258
|
+
// });
|
|
259
|
+
// systemParam = undefined;
|
|
260
|
+
// }
|
|
261
|
+
try {
|
|
262
|
+
// Use Vercel AI SDK's generateText with stopWhen for automatic loop
|
|
263
|
+
// Default is stepCountIs(1) - we need to increase for multi-step investigation
|
|
264
|
+
const generateConfig = {
|
|
265
|
+
model: this.modelInstance,
|
|
266
|
+
messages,
|
|
267
|
+
tools,
|
|
268
|
+
stopWhen: (0, ai_1.stepCountIs)(maxIterations)
|
|
269
|
+
};
|
|
270
|
+
// Add system parameter for non-Anthropic providers
|
|
271
|
+
if (systemParam) {
|
|
272
|
+
generateConfig.system = systemParam;
|
|
273
|
+
}
|
|
274
|
+
const result = await (0, ai_1.generateText)(generateConfig);
|
|
275
|
+
// Debug: Log the full cumulative context that was actually sent to the AI
|
|
276
|
+
if (this.debugMode && result.response?.messages) {
|
|
277
|
+
const path = await Promise.resolve().then(() => __importStar(require('path')));
|
|
278
|
+
const debugId = (0, provider_debug_utils_1.generateDebugId)(`${operation}-final-context`);
|
|
279
|
+
const debugDir = path.join(process.cwd(), 'tmp', 'debug-ai');
|
|
280
|
+
const contextFile = path.join(debugDir, `${debugId}_full-context.md`);
|
|
281
|
+
// Build full conversation history representation
|
|
282
|
+
const messages = result.response.messages;
|
|
283
|
+
const contextParts = [`# Full Conversation Context - ${operation}\n`];
|
|
284
|
+
contextParts.push(`\nTimestamp: ${new Date().toISOString()}`);
|
|
285
|
+
contextParts.push(`Provider: ${this.getProviderType()}`);
|
|
286
|
+
contextParts.push(`Model: ${this.model}`);
|
|
287
|
+
contextParts.push(`Total Messages: ${messages.length}`);
|
|
288
|
+
contextParts.push(`Total Steps: ${result.steps?.length || 0}`);
|
|
289
|
+
contextParts.push('\n---\n');
|
|
290
|
+
for (let i = 0; i < messages.length; i++) {
|
|
291
|
+
const msg = messages[i];
|
|
292
|
+
contextParts.push(`\n## Message ${i + 1} - Role: ${msg.role}\n`);
|
|
293
|
+
if (typeof msg.content === 'string') {
|
|
294
|
+
contextParts.push(msg.content);
|
|
295
|
+
}
|
|
296
|
+
else if (Array.isArray(msg.content)) {
|
|
297
|
+
for (const part of msg.content) {
|
|
298
|
+
if (part.type === 'text') {
|
|
299
|
+
contextParts.push(part.text || '');
|
|
300
|
+
}
|
|
301
|
+
else if (part.type === 'tool-call') {
|
|
302
|
+
contextParts.push(`\n[TOOL CALL: ${part.toolName}]`);
|
|
303
|
+
contextParts.push(JSON.stringify(part.args, null, 2));
|
|
304
|
+
}
|
|
305
|
+
else if (part.type === 'tool-result') {
|
|
306
|
+
contextParts.push(`\n[TOOL RESULT: ${part.toolName}]`);
|
|
307
|
+
const resultData = part.output || part.result || part.content || part;
|
|
308
|
+
contextParts.push(JSON.stringify(resultData, null, 2));
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
const fs = await Promise.resolve().then(() => __importStar(require('fs')));
|
|
314
|
+
fs.writeFileSync(contextFile, contextParts.join('\n'));
|
|
315
|
+
console.log(`🐛 DEBUG: Full conversation context logged to ${contextFile}`);
|
|
316
|
+
}
|
|
317
|
+
// Extract tool call history from steps
|
|
318
|
+
const toolCallsExecuted = [];
|
|
319
|
+
for (const step of result.steps || []) {
|
|
320
|
+
for (const toolCall of step.toolCalls || []) {
|
|
321
|
+
const toolResult = step.toolResults?.find((tr) => tr.toolCallId === toolCall.toolCallId);
|
|
322
|
+
toolCallsExecuted.push({
|
|
323
|
+
tool: toolCall.toolName,
|
|
324
|
+
input: toolCall.args,
|
|
325
|
+
output: toolResult?.result
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
// Normalize token metrics across providers
|
|
330
|
+
// NOTE: Vercel AI SDK had token reporting bugs that were fixed in PR #8945 (merged Sept 26, 2025)
|
|
331
|
+
// - GitHub Issue #8349: cache tokens only reflected last step, not summed across all steps
|
|
332
|
+
// - GitHub Issue #8795: Token reporting issues with Anthropic provider (streaming)
|
|
333
|
+
// Our version (5.0.60, released Oct 2, 2025) includes these fixes.
|
|
334
|
+
// However, testing still shows ~70% fewer tokens reported vs Anthropic native SDK.
|
|
335
|
+
// Root cause unknown - may be additional unreported bugs or different calculation methods.
|
|
336
|
+
const usage = result.usage;
|
|
337
|
+
let cacheReadTokens = 0;
|
|
338
|
+
let cacheCreationTokens = 0;
|
|
339
|
+
// Anthropic via Vercel uses cachedInputTokens
|
|
340
|
+
if (usage.cachedInputTokens) {
|
|
341
|
+
cacheReadTokens = usage.cachedInputTokens;
|
|
342
|
+
}
|
|
343
|
+
// OpenAI uses cached_tokens or cachedTokens (automatic caching, no config needed)
|
|
344
|
+
if ('cachedTokens' in usage || usage.cached_tokens) {
|
|
345
|
+
cacheReadTokens = usage.cachedTokens || usage.cached_tokens || 0;
|
|
346
|
+
}
|
|
347
|
+
// Anthropic native SDK uses separate cache_creation and cache_read fields
|
|
348
|
+
if (usage.cache_creation_input_tokens) {
|
|
349
|
+
cacheCreationTokens = usage.cache_creation_input_tokens;
|
|
350
|
+
}
|
|
351
|
+
if (usage.cache_read_input_tokens) {
|
|
352
|
+
cacheReadTokens = usage.cache_read_input_tokens;
|
|
353
|
+
}
|
|
354
|
+
// TODO: Check if Google Gemini reports cache metrics in future SDK versions
|
|
355
|
+
// Google Gemini may return cache-related metrics - check usage object structure
|
|
356
|
+
// Possible fields: cachedTokens, cacheHits, or provider-specific naming
|
|
357
|
+
// Add normalization logic here when Gemini caching is confirmed
|
|
358
|
+
// Extract final text from the last step (result.text might be empty if last step had tool calls)
|
|
359
|
+
let finalText = result.text;
|
|
360
|
+
if (!finalText || finalText.trim().length === 0) {
|
|
361
|
+
// If result.text is empty, find the last text response from steps
|
|
362
|
+
for (let i = (result.steps || []).length - 1; i >= 0; i--) {
|
|
363
|
+
const step = result.steps[i];
|
|
364
|
+
if (step.text && step.text.trim().length > 0) {
|
|
365
|
+
finalText = step.text;
|
|
366
|
+
break;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
return (0, provider_debug_utils_1.createAndLogAgenticResult)({
|
|
371
|
+
finalMessage: finalText || '',
|
|
372
|
+
iterations: result.steps?.length || 1,
|
|
373
|
+
toolCallsExecuted,
|
|
374
|
+
totalTokens: {
|
|
375
|
+
input: usage.inputTokens || 0,
|
|
376
|
+
output: usage.outputTokens || 0,
|
|
377
|
+
cacheCreation: cacheCreationTokens,
|
|
378
|
+
cacheRead: cacheReadTokens
|
|
379
|
+
},
|
|
380
|
+
status: 'success',
|
|
381
|
+
completionReason: 'investigation_complete',
|
|
382
|
+
modelVersion: this.model,
|
|
383
|
+
operation: `${operation}-summary`,
|
|
384
|
+
sdk: this.getProviderType(),
|
|
385
|
+
startTime,
|
|
386
|
+
debugMode: this.debugMode
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
catch (error) {
|
|
390
|
+
// Return error result with extended metrics
|
|
391
|
+
return (0, provider_debug_utils_1.createAndLogAgenticResult)({
|
|
392
|
+
finalMessage: `Error during investigation: ${error instanceof Error ? error.message : String(error)}`,
|
|
393
|
+
iterations: 0,
|
|
394
|
+
toolCallsExecuted: [],
|
|
395
|
+
totalTokens: {
|
|
396
|
+
input: 0,
|
|
397
|
+
output: 0,
|
|
398
|
+
cacheCreation: 0,
|
|
399
|
+
cacheRead: 0
|
|
400
|
+
},
|
|
401
|
+
status: 'failed',
|
|
402
|
+
completionReason: 'error',
|
|
403
|
+
modelVersion: this.model,
|
|
404
|
+
operation: `${operation}-error`,
|
|
405
|
+
sdk: this.getProviderType(),
|
|
406
|
+
startTime,
|
|
407
|
+
debugMode: this.debugMode
|
|
408
|
+
});
|
|
148
409
|
}
|
|
149
|
-
throw new Error(`sendMessageWithTools() not implemented for ${this.providerType} provider. Use AnthropicProvider for tool-based workflows, or use JSON-based approach (recommended).`);
|
|
150
410
|
}
|
|
151
411
|
}
|
|
152
412
|
exports.VercelProvider = VercelProvider;
|
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
export declare const REMEDIATE_TOOL_NAME = "remediate";
|
|
6
6
|
export declare const REMEDIATE_TOOL_DESCRIPTION = "AI-powered Kubernetes issue analysis that provides root cause identification and actionable remediation steps. Unlike basic kubectl commands, this tool performs multi-step investigation, correlates cluster data, and generates intelligent solutions. Use when users want to understand WHY something is broken, not just see raw status. Ideal for: troubleshooting failures, diagnosing performance issues, analyzing pod problems, investigating networking/storage issues, or any \"what's wrong\" questions.";
|
|
7
|
-
export declare const SAFE_OPERATIONS: readonly ["get", "describe", "logs", "events", "top", "explain"];
|
|
8
|
-
export type SafeOperation = typeof SAFE_OPERATIONS[number];
|
|
9
7
|
export declare const REMEDIATE_TOOL_INPUT_SCHEMA: {
|
|
10
8
|
issue: z.ZodOptional<z.ZodString>;
|
|
11
9
|
mode: z.ZodDefault<z.ZodOptional<z.ZodEnum<["manual", "automatic"]>>>;
|
|
@@ -24,28 +22,10 @@ export interface RemediateInput {
|
|
|
24
22
|
sessionId?: string;
|
|
25
23
|
executedCommands?: string[];
|
|
26
24
|
}
|
|
27
|
-
export interface DataRequest {
|
|
28
|
-
type: string;
|
|
29
|
-
resource: string;
|
|
30
|
-
namespace?: string;
|
|
31
|
-
args?: string[];
|
|
32
|
-
rationale: string;
|
|
33
|
-
}
|
|
34
|
-
export interface InvestigationIteration {
|
|
35
|
-
step: number;
|
|
36
|
-
aiAnalysis: string;
|
|
37
|
-
dataRequests: DataRequest[];
|
|
38
|
-
gatheredData: {
|
|
39
|
-
[key: string]: any;
|
|
40
|
-
};
|
|
41
|
-
complete: boolean;
|
|
42
|
-
timestamp: Date;
|
|
43
|
-
}
|
|
44
25
|
export interface RemediateSession {
|
|
45
26
|
sessionId: string;
|
|
46
27
|
issue: string;
|
|
47
28
|
mode: 'manual' | 'automatic';
|
|
48
|
-
iterations: InvestigationIteration[];
|
|
49
29
|
finalAnalysis?: RemediateOutput;
|
|
50
30
|
created: Date;
|
|
51
31
|
updated: Date;
|
|
@@ -99,17 +79,6 @@ export interface RemediateOutput {
|
|
|
99
79
|
fallbackReason?: string;
|
|
100
80
|
mode?: 'manual' | 'automatic';
|
|
101
81
|
}
|
|
102
|
-
/**
|
|
103
|
-
* AI Response interface matching our prompt format
|
|
104
|
-
*/
|
|
105
|
-
interface AIInvestigationResponse {
|
|
106
|
-
analysis: string;
|
|
107
|
-
dataRequests: DataRequest[];
|
|
108
|
-
investigationComplete: boolean;
|
|
109
|
-
confidence: number;
|
|
110
|
-
reasoning: string;
|
|
111
|
-
needsMoreSpecificInfo?: boolean;
|
|
112
|
-
}
|
|
113
82
|
/**
|
|
114
83
|
* AI Final Analysis Response interface matching final analysis prompt format
|
|
115
84
|
*/
|
|
@@ -129,15 +98,6 @@ interface AIFinalAnalysisResponse {
|
|
|
129
98
|
* Parse AI final analysis response
|
|
130
99
|
*/
|
|
131
100
|
export declare function parseAIFinalAnalysis(aiResponse: string): AIFinalAnalysisResponse;
|
|
132
|
-
/**
|
|
133
|
-
* Parse AI response for data requests and investigation status
|
|
134
|
-
*/
|
|
135
|
-
export declare function parseAIResponse(aiResponse: string): {
|
|
136
|
-
dataRequests: DataRequest[];
|
|
137
|
-
isComplete: boolean;
|
|
138
|
-
needsMoreSpecificInfo?: boolean;
|
|
139
|
-
parsedResponse?: AIInvestigationResponse;
|
|
140
|
-
};
|
|
141
101
|
/**
|
|
142
102
|
* Main tool handler for remediate tool
|
|
143
103
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remediate.d.ts","sourceRoot":"","sources":["../../src/tools/remediate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK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