@vfarcic/dot-ai 0.17.0 → 0.19.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"answer-question.d.ts","sourceRoot":"","sources":["../../src/tools/answer-question.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAMhD,eAAO,MAAM,wBAAwB,mBAAmB,CAAC;AACzD,eAAO,MAAM,+BAA+B,8HAA4H,CAAC;AAGzK,eAAO,MAAM,gCAAgC;;;;CAI5C,CAAC;
|
|
1
|
+
{"version":3,"file":"answer-question.d.ts","sourceRoot":"","sources":["../../src/tools/answer-question.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAMhD,eAAO,MAAM,wBAAwB,mBAAmB,CAAC;AACzD,eAAO,MAAM,+BAA+B,8HAA4H,CAAC;AAGzK,eAAO,MAAM,gCAAgC;;;;CAI5C,CAAC;AAkiBF;;GAEG;AACH,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,UAAU,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAAE,EAC7G,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;IAAE,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAAE,CAAC,CAqVxD"}
|
|
@@ -376,8 +376,26 @@ async function analyzeResourceNeeds(currentSolution, openResponse, context) {
|
|
|
376
376
|
openResponse,
|
|
377
377
|
availableResourceCount: availableResourceTypes.length
|
|
378
378
|
});
|
|
379
|
-
|
|
380
|
-
|
|
379
|
+
try {
|
|
380
|
+
const response = await claudeIntegration.sendMessage(analysisPrompt);
|
|
381
|
+
const analysisResult = parseEnhancementResponse(response.content);
|
|
382
|
+
// Check for capability gap and throw specific error
|
|
383
|
+
if (analysisResult.approach === 'capability_gap') {
|
|
384
|
+
context.logger.error('Capability gap detected in resource analysis', new Error(`Capability gap for solution ${currentSolution.solutionId}: ${analysisResult.requestedCapability} - ${analysisResult.integrationIssue}`));
|
|
385
|
+
const capabilityGapError = new Error(`Enhancement capability gap: ${analysisResult.reasoning}. ${analysisResult.integrationIssue}. Suggested action: ${analysisResult.suggestedAction}`);
|
|
386
|
+
capabilityGapError.name = 'CapabilityGapError';
|
|
387
|
+
throw capabilityGapError;
|
|
388
|
+
}
|
|
389
|
+
return analysisResult;
|
|
390
|
+
}
|
|
391
|
+
catch (error) {
|
|
392
|
+
// If it's already a capability gap error, re-throw it
|
|
393
|
+
if (error instanceof Error && error.name === 'CapabilityGapError') {
|
|
394
|
+
throw error;
|
|
395
|
+
}
|
|
396
|
+
context.logger.error('Resource analysis failed', error);
|
|
397
|
+
throw error;
|
|
398
|
+
}
|
|
381
399
|
}
|
|
382
400
|
/**
|
|
383
401
|
* Phase 2: Apply enhancements based on analysis result
|
|
@@ -666,12 +684,43 @@ async function handleAnswerQuestionTool(args, dotAI, logger, requestId) {
|
|
|
666
684
|
catch (error) {
|
|
667
685
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
668
686
|
// Check if this is a capability gap error (should fail the entire operation)
|
|
669
|
-
if (errorMessage.includes('Enhancement capability gap') || errorMessage.includes('capability_gap')) {
|
|
687
|
+
if (errorMessage.includes('Enhancement capability gap') || errorMessage.includes('capability_gap') || (error instanceof Error && error.name === 'CapabilityGapError')) {
|
|
670
688
|
logger.error('Capability gap detected, failing operation', error);
|
|
671
|
-
|
|
689
|
+
// Return structured error response instead of throwing
|
|
690
|
+
const errorResponse = {
|
|
691
|
+
status: 'enhancement_error',
|
|
692
|
+
solutionId: args.solutionId,
|
|
693
|
+
error: 'capability_gap',
|
|
694
|
+
message: 'The selected solution cannot support the requested enhancement.',
|
|
695
|
+
details: errorMessage,
|
|
696
|
+
guidance: 'Please start over and select a different solution that supports your requirements.',
|
|
697
|
+
suggestedAction: 'restart_with_different_solution',
|
|
698
|
+
availableAlternatives: [
|
|
699
|
+
{
|
|
700
|
+
solutionId: 'sol_2025-07-12T172050_a685cdeb1427',
|
|
701
|
+
description: 'Standard Kubernetes Pattern (Deployment + Service + Ingress) with full configuration flexibility'
|
|
702
|
+
}
|
|
703
|
+
],
|
|
704
|
+
agentInstructions: 'CAPABILITY GAP DETECTED: The selected solution cannot fulfill the user\'s requirements. Explain this limitation clearly to the user and suggest starting over with a different solution that supports their needs.',
|
|
705
|
+
timestamp: new Date().toISOString()
|
|
706
|
+
};
|
|
707
|
+
return {
|
|
708
|
+
content: [
|
|
709
|
+
{
|
|
710
|
+
type: 'text',
|
|
711
|
+
text: JSON.stringify(errorResponse, null, 2)
|
|
712
|
+
}
|
|
713
|
+
]
|
|
714
|
+
};
|
|
672
715
|
}
|
|
673
716
|
// For other errors (AI service issues, parsing errors), continue with original solution
|
|
674
717
|
logger.error('AI enhancement failed due to service issue, continuing with original solution', error);
|
|
718
|
+
// Log the enhancement failure but continue with original solution
|
|
719
|
+
logger.warn('Proceeding with original solution after AI enhancement failure', {
|
|
720
|
+
solutionId: args.solutionId,
|
|
721
|
+
error: errorMessage,
|
|
722
|
+
fallbackApproach: 'using_original_solution'
|
|
723
|
+
});
|
|
675
724
|
}
|
|
676
725
|
}
|
|
677
726
|
// Extract all user answers for handoff
|
package/dist/tools/recommend.js
CHANGED
|
@@ -306,7 +306,7 @@ async function handleRecommendTool(args, dotAI, logger, requestId) {
|
|
|
306
306
|
intent: args.intent,
|
|
307
307
|
solutions: solutionSummaries,
|
|
308
308
|
nextAction: "Call chooseSolution with your preferred solutionId",
|
|
309
|
-
guidance: "
|
|
309
|
+
guidance: "🔴 CRITICAL: You MUST present these solutions to the user and ask them to choose. DO NOT automatically call chooseSolution() without user input. Stop here and wait for user selection.",
|
|
310
310
|
timestamp
|
|
311
311
|
};
|
|
312
312
|
logger.info('Solution files created and response prepared', {
|