fix: include tagInfo in AI service responses for MCP tools
- Update all core functions that call AI services to extract and return tagInfo - Update all direct functions to include tagInfo in MCP response data - Fixes issue where add_task, expand_task, and other AI commands were not including current tag and available tags information - tagInfo includes currentTag from state.json and availableTags list - Ensures tagged task lists system information is properly propagated through the full chain: AI service -> core function -> direct function -> MCP client
This commit is contained in:
@@ -624,7 +624,8 @@ async function addTask(
|
||||
);
|
||||
return {
|
||||
newTaskId: newTaskId,
|
||||
telemetryData: aiServiceResponse ? aiServiceResponse.telemetryData : null
|
||||
telemetryData: aiServiceResponse ? aiServiceResponse.telemetryData : null,
|
||||
tagInfo: aiServiceResponse ? aiServiceResponse.tagInfo : null
|
||||
};
|
||||
} catch (error) {
|
||||
// Stop any loading indicator on error
|
||||
|
||||
@@ -644,7 +644,8 @@ async function analyzeTaskComplexity(options, context = {}) {
|
||||
|
||||
return {
|
||||
report: report,
|
||||
telemetryData: aiServiceResponse?.telemetryData
|
||||
telemetryData: aiServiceResponse?.telemetryData,
|
||||
tagInfo: aiServiceResponse?.tagInfo
|
||||
};
|
||||
} catch (aiError) {
|
||||
if (loadingIndicator) stopLoadingIndicator(loadingIndicator);
|
||||
|
||||
@@ -686,7 +686,8 @@ async function expandTask(
|
||||
// Return the updated task object AND telemetry data
|
||||
return {
|
||||
task,
|
||||
telemetryData: aiServiceResponse?.telemetryData
|
||||
telemetryData: aiServiceResponse?.telemetryData,
|
||||
tagInfo: aiServiceResponse?.tagInfo
|
||||
};
|
||||
} catch (error) {
|
||||
// Catches errors from file reading, parsing, AI call etc.
|
||||
|
||||
@@ -359,7 +359,8 @@ Guidelines:
|
||||
return {
|
||||
success: true,
|
||||
tasksPath,
|
||||
telemetryData: aiServiceResponse?.telemetryData
|
||||
telemetryData: aiServiceResponse?.telemetryData,
|
||||
tagInfo: aiServiceResponse?.tagInfo
|
||||
};
|
||||
} catch (error) {
|
||||
report(`Error parsing PRD: ${error.message}`, 'error');
|
||||
|
||||
@@ -244,6 +244,7 @@ async function performResearch(
|
||||
|
||||
const researchResult = aiResult.mainResult;
|
||||
const telemetryData = aiResult.telemetryData;
|
||||
const tagInfo = aiResult.tagInfo;
|
||||
|
||||
// Format and display results
|
||||
if (outputFormat === 'text') {
|
||||
@@ -285,7 +286,8 @@ async function performResearch(
|
||||
userPromptTokens,
|
||||
totalInputTokens,
|
||||
detailLevel,
|
||||
telemetryData
|
||||
telemetryData,
|
||||
tagInfo
|
||||
};
|
||||
} catch (error) {
|
||||
logFn.error(`Research query failed: ${error.message}`);
|
||||
|
||||
@@ -366,7 +366,8 @@ Output Requirements:
|
||||
|
||||
return {
|
||||
updatedSubtask: updatedSubtask,
|
||||
telemetryData: aiServiceResponse.telemetryData
|
||||
telemetryData: aiServiceResponse.telemetryData,
|
||||
tagInfo: aiServiceResponse.tagInfo
|
||||
};
|
||||
} catch (error) {
|
||||
if (outputFormat === 'text' && loadingIndicator) {
|
||||
|
||||
@@ -535,7 +535,8 @@ The changes described in the prompt should be thoughtfully applied to make the t
|
||||
// --- Return Success with Telemetry ---
|
||||
return {
|
||||
updatedTask: updatedTask, // Return the updated task object
|
||||
telemetryData: aiServiceResponse.telemetryData // <<< ADD telemetryData
|
||||
telemetryData: aiServiceResponse.telemetryData, // <<< ADD telemetryData
|
||||
tagInfo: aiServiceResponse.tagInfo
|
||||
};
|
||||
} catch (error) {
|
||||
// Catch errors from generateTextService
|
||||
|
||||
@@ -486,7 +486,8 @@ The changes described in the prompt should be applied to ALL tasks in the list.`
|
||||
return {
|
||||
success: true,
|
||||
updatedTasks: parsedUpdatedTasks,
|
||||
telemetryData: aiServiceResponse.telemetryData
|
||||
telemetryData: aiServiceResponse.telemetryData,
|
||||
tagInfo: aiServiceResponse.tagInfo
|
||||
};
|
||||
} catch (error) {
|
||||
if (loadingIndicator) stopLoadingIndicator(loadingIndicator);
|
||||
|
||||
Reference in New Issue
Block a user