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:
@@ -95,6 +95,7 @@ export async function addTaskDirect(args, log, context = {}) {
|
||||
let manualTaskData = null;
|
||||
let newTaskId;
|
||||
let telemetryData;
|
||||
let tagInfo;
|
||||
|
||||
if (isManualCreation) {
|
||||
// Create manual task data object
|
||||
@@ -129,6 +130,7 @@ export async function addTaskDirect(args, log, context = {}) {
|
||||
);
|
||||
newTaskId = result.newTaskId;
|
||||
telemetryData = result.telemetryData;
|
||||
tagInfo = result.tagInfo;
|
||||
} else {
|
||||
// AI-driven task creation
|
||||
log.info(
|
||||
@@ -154,6 +156,7 @@ export async function addTaskDirect(args, log, context = {}) {
|
||||
);
|
||||
newTaskId = result.newTaskId;
|
||||
telemetryData = result.telemetryData;
|
||||
tagInfo = result.tagInfo;
|
||||
}
|
||||
|
||||
// Restore normal logging
|
||||
@@ -164,7 +167,8 @@ export async function addTaskDirect(args, log, context = {}) {
|
||||
data: {
|
||||
taskId: newTaskId,
|
||||
message: `Successfully added new task #${newTaskId}`,
|
||||
telemetryData: telemetryData
|
||||
telemetryData: telemetryData,
|
||||
tagInfo: tagInfo
|
||||
}
|
||||
};
|
||||
} catch (error) {
|
||||
|
||||
@@ -196,7 +196,8 @@ export async function analyzeTaskComplexityDirect(args, log, context = {}) {
|
||||
lowComplexityTasks
|
||||
},
|
||||
fullReport: coreResult.report,
|
||||
telemetryData: coreResult.telemetryData
|
||||
telemetryData: coreResult.telemetryData,
|
||||
tagInfo: coreResult.tagInfo
|
||||
}
|
||||
};
|
||||
} catch (parseError) {
|
||||
|
||||
@@ -225,7 +225,8 @@ export async function expandTaskDirect(args, log, context = {}) {
|
||||
task: coreResult.task,
|
||||
subtasksAdded,
|
||||
hasExistingSubtasks,
|
||||
telemetryData: coreResult.telemetryData
|
||||
telemetryData: coreResult.telemetryData,
|
||||
tagInfo: coreResult.tagInfo
|
||||
}
|
||||
};
|
||||
} catch (error) {
|
||||
|
||||
@@ -170,7 +170,8 @@ export async function parsePRDDirect(args, log, context = {}) {
|
||||
data: {
|
||||
message: successMsg,
|
||||
outputPath: result.tasksPath,
|
||||
telemetryData: result.telemetryData
|
||||
telemetryData: result.telemetryData,
|
||||
tagInfo: result.tagInfo
|
||||
}
|
||||
};
|
||||
} else {
|
||||
|
||||
@@ -140,7 +140,8 @@ export async function researchDirect(args, log, context = {}) {
|
||||
userPromptTokens: result.userPromptTokens,
|
||||
totalInputTokens: result.totalInputTokens,
|
||||
detailLevel: result.detailLevel,
|
||||
telemetryData: result.telemetryData
|
||||
telemetryData: result.telemetryData,
|
||||
tagInfo: result.tagInfo
|
||||
}
|
||||
};
|
||||
} catch (error) {
|
||||
|
||||
@@ -139,7 +139,8 @@ export async function updateSubtaskByIdDirect(args, log, context = {}) {
|
||||
subtask: coreResult.updatedSubtask,
|
||||
tasksPath,
|
||||
useResearch,
|
||||
telemetryData: coreResult.telemetryData
|
||||
telemetryData: coreResult.telemetryData,
|
||||
tagInfo: coreResult.tagInfo
|
||||
}
|
||||
};
|
||||
} catch (error) {
|
||||
|
||||
@@ -76,7 +76,7 @@ export async function updateTaskByIdDirect(args, log, context = {}) {
|
||||
} else {
|
||||
// Parse as integer for main task IDs
|
||||
taskId = parseInt(id, 10);
|
||||
if (isNaN(taskId)) {
|
||||
if (Number.isNaN(taskId)) {
|
||||
const errorMessage = `Invalid task ID: ${id}. Task ID must be a positive integer or subtask ID (e.g., "5.2").`;
|
||||
logWrapper.error(errorMessage);
|
||||
return {
|
||||
@@ -132,7 +132,8 @@ export async function updateTaskByIdDirect(args, log, context = {}) {
|
||||
message: message,
|
||||
taskId: taskId,
|
||||
updated: false,
|
||||
telemetryData: coreResult?.telemetryData
|
||||
telemetryData: coreResult?.telemetryData,
|
||||
tagInfo: coreResult?.tagInfo
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -149,7 +150,8 @@ export async function updateTaskByIdDirect(args, log, context = {}) {
|
||||
useResearch: useResearch,
|
||||
updated: true,
|
||||
updatedTask: coreResult.updatedTask,
|
||||
telemetryData: coreResult.telemetryData
|
||||
telemetryData: coreResult.telemetryData,
|
||||
tagInfo: coreResult.tagInfo
|
||||
}
|
||||
};
|
||||
} catch (error) {
|
||||
|
||||
@@ -90,7 +90,8 @@ export async function updateTasksDirect(args, log, context = {}) {
|
||||
message: `Successfully updated ${result.updatedTasks.length} tasks.`,
|
||||
tasksPath: tasksJsonPath,
|
||||
updatedCount: result.updatedTasks.length,
|
||||
telemetryData: result.telemetryData
|
||||
telemetryData: result.telemetryData,
|
||||
tagInfo: result.tagInfo
|
||||
}
|
||||
};
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user