cast-code 1.0.6 → 1.0.8
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/common/services/multi-llm.service.js +19 -0
- package/dist/common/services/multi-llm.service.js.map +1 -1
- package/dist/modules/config/services/config-commands.service.js +86 -6
- package/dist/modules/config/services/config-commands.service.js.map +1 -1
- package/dist/modules/config/types/config.types.js +5 -0
- package/dist/modules/config/types/config.types.js.map +1 -1
- package/dist/modules/config/types/config.types.spec.js +60 -0
- package/dist/modules/config/types/config.types.spec.js.map +1 -0
- package/dist/modules/core/services/deep-agent.service.js +46 -5
- package/dist/modules/core/services/deep-agent.service.js.map +1 -1
- package/dist/modules/git/git.module.js +5 -2
- package/dist/modules/git/git.module.js.map +1 -1
- package/dist/modules/git/git.module.spec.js +54 -0
- package/dist/modules/git/git.module.spec.js.map +1 -0
- package/dist/modules/git/services/unit-test-generator.service.js +557 -0
- package/dist/modules/git/services/unit-test-generator.service.js.map +1 -0
- package/dist/modules/git/services/unit-test-generator.service.spec.js +119 -0
- package/dist/modules/git/services/unit-test-generator.service.spec.js.map +1 -0
- package/dist/modules/repl/services/commands/git-commands.service.js +97 -2
- package/dist/modules/repl/services/commands/git-commands.service.js.map +1 -1
- package/dist/modules/repl/services/commands/repl-commands.service.js +1 -0
- package/dist/modules/repl/services/commands/repl-commands.service.js.map +1 -1
- package/dist/modules/repl/services/commands/repl-commands.service.spec.js +69 -0
- package/dist/modules/repl/services/commands/repl-commands.service.spec.js.map +1 -0
- package/dist/modules/repl/services/repl.service.js +11 -1
- package/dist/modules/repl/services/repl.service.js.map +1 -1
- package/dist/modules/repl/services/repl.service.spec.js +137 -0
- package/dist/modules/repl/services/repl.service.spec.js.map +1 -0
- package/dist/modules/tasks/services/plan-mode.service.js +33 -25
- package/dist/modules/tasks/services/plan-mode.service.js.map +1 -1
- package/dist/modules/tasks/services/task-tools.service.js +3 -3
- package/dist/modules/tasks/services/task-tools.service.js.map +1 -1
- package/package.json +1 -1
|
@@ -31,8 +31,13 @@ let PlanModeService = class PlanModeService {
|
|
|
31
31
|
if (this.inPlanMode) {
|
|
32
32
|
throw new Error('Already in plan mode');
|
|
33
33
|
}
|
|
34
|
+
if (this.taskService.getExecutionContext()) {
|
|
35
|
+
throw new Error('Cannot enter plan mode while executing an approved plan');
|
|
36
|
+
}
|
|
34
37
|
this.inPlanMode = true;
|
|
35
38
|
this.planContext.clear();
|
|
39
|
+
this.planContext.set('title', title);
|
|
40
|
+
this.planContext.set('description', description);
|
|
36
41
|
console.log('');
|
|
37
42
|
console.log('━'.repeat(60));
|
|
38
43
|
this.promptService.info('📋 Entering PLAN MODE');
|
|
@@ -48,33 +53,36 @@ let PlanModeService = class PlanModeService {
|
|
|
48
53
|
if (!this.inPlanMode) {
|
|
49
54
|
throw new Error('Not in plan mode');
|
|
50
55
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
56
|
+
try {
|
|
57
|
+
console.log('');
|
|
58
|
+
console.log('━'.repeat(60));
|
|
59
|
+
this.promptService.info('📋 Saindo do MODO PLANEJAMENTO - Apresentando Plano');
|
|
60
|
+
console.log('━'.repeat(60));
|
|
61
|
+
console.log('');
|
|
62
|
+
const planTitle = this.planContext.get('title') || 'Plano de Execução';
|
|
63
|
+
const planDescription = this.planContext.get('description') || '';
|
|
64
|
+
const plan = this.taskService.createPlan(planTitle, planDescription, tasks);
|
|
65
|
+
this.currentPlan = plan;
|
|
66
|
+
const result = await this.taskService.approvePlan(plan.id);
|
|
67
|
+
if (result.approved) {
|
|
68
|
+
// Configurar contexto de execução
|
|
69
|
+
this.taskService.setExecutionContext({
|
|
70
|
+
planId: plan.id,
|
|
71
|
+
autoApprove: result.autoApprove,
|
|
72
|
+
currentTaskIndex: 0,
|
|
73
|
+
startedAt: Date.now()
|
|
74
|
+
});
|
|
75
|
+
// Executar plano usando PlanExecutorService
|
|
76
|
+
await this.planExecutor.executePlan(plan.id, result.autoApprove);
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
approved: result.approved,
|
|
65
80
|
autoApprove: result.autoApprove,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
await this.planExecutor.executePlan(plan.id, result.autoApprove);
|
|
81
|
+
modification: result.modificationRequested
|
|
82
|
+
};
|
|
83
|
+
} finally{
|
|
84
|
+
this.inPlanMode = false;
|
|
71
85
|
}
|
|
72
|
-
this.inPlanMode = false;
|
|
73
|
-
return {
|
|
74
|
-
approved: result.approved,
|
|
75
|
-
autoApprove: result.autoApprove,
|
|
76
|
-
modification: result.modificationRequested
|
|
77
|
-
};
|
|
78
86
|
}
|
|
79
87
|
isInPlanMode() {
|
|
80
88
|
return this.inPlanMode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/tasks/services/plan-mode.service.ts"],"sourcesContent":["import { Injectable, forwardRef, Inject } from '@nestjs/common';\nimport { TaskManagementService } from './task-management.service';\nimport { PlanExecutorService } from './plan-executor.service';\nimport { PromptService } from '../../permissions/services/prompt.service';\nimport { CreateTaskOptions, TaskPlan } from '../types/task.types';\n\n@Injectable()\nexport class PlanModeService {\n private inPlanMode = false;\n private currentPlan: TaskPlan | null = null;\n private planContext: Map<string, any> = new Map();\n\n constructor(\n private taskService: TaskManagementService,\n @Inject(forwardRef(() => PlanExecutorService))\n private planExecutor: PlanExecutorService,\n private promptService: PromptService,\n ) {}\n\n async enterPlanMode(title: string, description: string): Promise<void> {\n if (this.inPlanMode) {\n throw new Error('Already in plan mode');\n }\n\n this.inPlanMode = true;\n this.planContext.clear();\n\n console.log('');\n console.log('━'.repeat(60));\n this.promptService.info('📋 Entering PLAN MODE');\n console.log('━'.repeat(60));\n console.log('');\n console.log(`Planning: ${title}`);\n console.log(description);\n console.log('');\n this.promptService.info('I will ask you some questions and create an execution plan.');\n console.log('');\n }\n\n async exitPlanMode(tasks: CreateTaskOptions[]): Promise<{ approved: boolean; autoApprove: boolean; modification?: string }> {\n if (!this.inPlanMode) {\n throw new Error('Not in plan mode');\n }\n\n console.log('');\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/tasks/services/plan-mode.service.ts"],"sourcesContent":["import { Injectable, forwardRef, Inject } from '@nestjs/common';\nimport { TaskManagementService } from './task-management.service';\nimport { PlanExecutorService } from './plan-executor.service';\nimport { PromptService } from '../../permissions/services/prompt.service';\nimport { CreateTaskOptions, TaskPlan } from '../types/task.types';\n\n@Injectable()\nexport class PlanModeService {\n private inPlanMode = false;\n private currentPlan: TaskPlan | null = null;\n private planContext: Map<string, any> = new Map();\n\n constructor(\n private taskService: TaskManagementService,\n @Inject(forwardRef(() => PlanExecutorService))\n private planExecutor: PlanExecutorService,\n private promptService: PromptService,\n ) {}\n\n async enterPlanMode(title: string, description: string): Promise<void> {\n if (this.inPlanMode) {\n throw new Error('Already in plan mode');\n }\n\n if (this.taskService.getExecutionContext()) {\n throw new Error('Cannot enter plan mode while executing an approved plan');\n }\n\n this.inPlanMode = true;\n this.planContext.clear();\n this.planContext.set('title', title);\n this.planContext.set('description', description);\n\n console.log('');\n console.log('━'.repeat(60));\n this.promptService.info('📋 Entering PLAN MODE');\n console.log('━'.repeat(60));\n console.log('');\n console.log(`Planning: ${title}`);\n console.log(description);\n console.log('');\n this.promptService.info('I will ask you some questions and create an execution plan.');\n console.log('');\n }\n\n async exitPlanMode(tasks: CreateTaskOptions[]): Promise<{ approved: boolean; autoApprove: boolean; modification?: string }> {\n if (!this.inPlanMode) {\n throw new Error('Not in plan mode');\n }\n\n try {\n console.log('');\n console.log('━'.repeat(60));\n this.promptService.info('📋 Saindo do MODO PLANEJAMENTO - Apresentando Plano');\n console.log('━'.repeat(60));\n console.log('');\n\n const planTitle = this.planContext.get('title') || 'Plano de Execução';\n const planDescription = this.planContext.get('description') || '';\n\n const plan = this.taskService.createPlan(planTitle, planDescription, tasks);\n this.currentPlan = plan;\n\n const result = await this.taskService.approvePlan(plan.id);\n\n if (result.approved) {\n // Configurar contexto de execução\n this.taskService.setExecutionContext({\n planId: plan.id,\n autoApprove: result.autoApprove,\n currentTaskIndex: 0,\n startedAt: Date.now(),\n });\n\n // Executar plano usando PlanExecutorService\n await this.planExecutor.executePlan(plan.id, result.autoApprove);\n }\n\n return {\n approved: result.approved,\n autoApprove: result.autoApprove,\n modification: result.modificationRequested,\n };\n } finally {\n this.inPlanMode = false;\n }\n }\n\n isInPlanMode(): boolean {\n return this.inPlanMode;\n }\n\n setPlanContext(key: string, value: any): void {\n this.planContext.set(key, value);\n }\n\n getPlanContext(key: string): any {\n return this.planContext.get(key);\n }\n\n cancelPlanMode(): void {\n if (!this.inPlanMode) return;\n\n this.promptService.warn('Plan mode cancelled');\n this.inPlanMode = false;\n this.currentPlan = null;\n this.planContext.clear();\n }\n\n getCurrentPlan(): TaskPlan | null {\n return this.currentPlan;\n }\n}\n"],"names":["PlanModeService","enterPlanMode","title","description","inPlanMode","Error","taskService","getExecutionContext","planContext","clear","set","console","log","repeat","promptService","info","exitPlanMode","tasks","planTitle","get","planDescription","plan","createPlan","currentPlan","result","approvePlan","id","approved","setExecutionContext","planId","autoApprove","currentTaskIndex","startedAt","Date","now","planExecutor","executePlan","modification","modificationRequested","isInPlanMode","setPlanContext","key","value","getPlanContext","cancelPlanMode","warn","getCurrentPlan","Map","PlanExecutorService"],"mappings":";;;;+BAOaA;;;eAAAA;;;wBAPkC;uCACT;qCACF;+BACN;;;;;;;;;;;;;;;AAIvB,IAAA,AAAMA,kBAAN,MAAMA;IAYX,MAAMC,cAAcC,KAAa,EAAEC,WAAmB,EAAiB;QACrE,IAAI,IAAI,CAACC,UAAU,EAAE;YACnB,MAAM,IAAIC,MAAM;QAClB;QAEA,IAAI,IAAI,CAACC,WAAW,CAACC,mBAAmB,IAA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
222
222
|
return (0, _tools.tool)(async ({ tasks })=>{
|
|
223
223
|
try {
|
|
224
|
-
const
|
|
224
|
+
const approval = await this.planModeService.exitPlanMode(tasks.map((t)=>({
|
|
225
225
|
subject: t.subject,
|
|
226
226
|
description: t.description,
|
|
227
227
|
activeForm: t.activeForm,
|
|
@@ -229,8 +229,8 @@ let TaskToolsService = class TaskToolsService {
|
|
|
229
229
|
})));
|
|
230
230
|
return JSON.stringify({
|
|
231
231
|
success: true,
|
|
232
|
-
approved,
|
|
233
|
-
message: approved ? 'Plan approved! You can now execute the tasks.' : 'Plan was not approved. Ask the user what they want to change.'
|
|
232
|
+
approved: approval,
|
|
233
|
+
message: approval.approved ? 'Plan approved! You can now execute the tasks.' : 'Plan was not approved. Ask the user what they want to change.'
|
|
234
234
|
});
|
|
235
235
|
} catch (error) {
|
|
236
236
|
return JSON.stringify({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/tasks/services/task-tools.service.ts"],"sourcesContent":["import { Injectable } from '@nestjs/common';\nimport { tool } from '@langchain/core/tools';\nimport { z } from 'zod';\nimport { TaskManagementService } from './task-management.service';\nimport { PlanModeService } from './plan-mode.service';\nimport { TaskStatus } from '../types/task.types';\nimport { PromptService } from '../../permissions/services/prompt.service';\n\n@Injectable()\nexport class TaskToolsService {\n constructor(\n private taskService: TaskManagementService,\n private planModeService: PlanModeService,\n private promptService: PromptService,\n ) {}\n\n getTools() {\n return [\n this.createTaskCreateTool(),\n this.createTaskUpdateTool(),\n this.createTaskListTool(),\n this.createTaskGetTool(),\n this.createAskUserQuestionTool(),\n this.createEnterPlanModeTool(),\n this.createExitPlanModeTool(),\n ];\n }\n\n private createTaskCreateTool() {\n return tool(\n async ({ subject, description, activeForm, dependencies, metadata }) => {\n const task = this.taskService.createTask({\n subject,\n description,\n activeForm,\n dependencies: dependencies || [],\n metadata: metadata || {},\n });\n\n return JSON.stringify({\n success: true,\n taskId: task.id,\n task: {\n id: task.id,\n subject: task.subject,\n status: task.status,\n },\n });\n },\n {\n name: 'task_create',\n description:\n 'Create a new task. Use this when breaking down complex work into trackable subtasks. The task will be shown to the user for approval.',\n schema: z.object({\n subject: z.string().describe('Brief task title (e.g., \"Implement login endpoint\")'),\n description: z\n .string()\n .describe('Detailed description of what needs to be done and why'),\n activeForm: z\n .string()\n .optional()\n .describe(\n 'Present continuous form shown when in_progress (e.g., \"Implementing login\")',\n ),\n dependencies: z\n .array(z.string())\n .optional()\n .describe('Array of task IDs that must complete before this one'),\n metadata: z.record(z.any()).optional().describe('Additional metadata'),\n }),\n },\n );\n }\n\n private createTaskUpdateTool() {\n return tool(\n async ({ taskId, status, subject, description, activeForm, addDependencies, metadata }) => {\n const task = this.taskService.updateTask(taskId, {\n status: status as TaskStatus,\n subject,\n description,\n activeForm,\n addDependencies,\n metadata,\n });\n\n if (!task) {\n return JSON.stringify({ success: false, error: 'Task not found' });\n }\n\n return JSON.stringify({\n success: true,\n task: {\n id: task.id,\n subject: task.subject,\n status: task.status,\n },\n });\n },\n {\n name: 'task_update',\n description:\n 'Update an existing task. Use to change status, modify details, or add dependencies.',\n schema: z.object({\n taskId: z.string().describe('ID of the task to update'),\n status: z\n .enum(['pending', 'in_progress', 'completed', 'failed', 'blocked', 'cancelled'])\n .optional()\n .describe('New status for the task'),\n subject: z.string().optional().describe('New subject'),\n description: z.string().optional().describe('New description'),\n activeForm: z.string().optional().describe('New active form'),\n addDependencies: z\n .array(z.string())\n .optional()\n .describe('Task IDs to add as dependencies'),\n metadata: z.record(z.any()).optional().describe('Metadata to merge'),\n }),\n },\n );\n }\n\n private createTaskListTool() {\n return tool(\n async () => {\n const tasks = this.taskService.listTasks();\n const pending = this.taskService.listPendingTasks();\n\n return JSON.stringify({\n total: tasks.length,\n pending: pending.length,\n tasks: tasks.map((t) => ({\n id: t.id,\n subject: t.subject,\n status: t.status,\n dependencies: t.dependencies,\n blocks: t.blocks,\n })),\n });\n },\n {\n name: 'task_list',\n description: 'List all tasks with their current status. Shows which tasks are ready to execute.',\n schema: z.object({}),\n },\n );\n }\n\n private createTaskGetTool() {\n return tool(\n async ({ taskId }) => {\n const task = this.taskService.getTask(taskId);\n\n if (!task) {\n return JSON.stringify({ success: false, error: 'Task not found' });\n }\n\n return JSON.stringify({\n success: true,\n task,\n });\n },\n {\n name: 'task_get',\n description: 'Get full details of a specific task including description and metadata.',\n schema: z.object({\n taskId: z.string().describe('ID of the task to retrieve'),\n }),\n },\n );\n }\n\n private createAskUserQuestionTool() {\n return tool(\n async ({ question, type, choices }) => {\n console.log('');\n\n if (type === 'confirm') {\n const answer = await this.promptService.confirm(question);\n return JSON.stringify({ answer });\n }\n\n if (type === 'choice' && choices) {\n const choiceObjects = choices.map((c, i) => ({\n key: String(i),\n label: c,\n }));\n\n const selectedKey = await this.promptService.choice(question, choiceObjects);\n const selectedIndex = parseInt(selectedKey);\n return JSON.stringify({ answer: choices[selectedIndex] });\n }\n\n if (type === 'text') {\n const answer = await this.promptService.question(question);\n return JSON.stringify({ answer });\n }\n\n return JSON.stringify({ error: 'Invalid question type' });\n },\n {\n name: 'ask_user_question',\n description:\n 'Ask the user a question interactively. Use this when you need clarification, preferences, or decisions from the user before proceeding. This is better than guessing!',\n schema: z.object({\n question: z.string().describe('The question to ask the user'),\n type: z\n .enum(['confirm', 'choice', 'text'])\n .describe('Type of question: confirm (yes/no), choice (multiple options), or text (free form)'),\n choices: z\n .array(z.string())\n .optional()\n .describe('Array of choices for type=choice'),\n }),\n },\n );\n }\n\n private createEnterPlanModeTool() {\n return tool(\n async ({ title, description }) => {\n try {\n await this.planModeService.enterPlanMode(title, description);\n return JSON.stringify({\n success: true,\n message: 'Entered plan mode. Explore the codebase, design your approach, then use exit_plan_mode to present the plan for approval.',\n });\n } catch (error) {\n return JSON.stringify({\n success: false,\n error: (error as Error).message,\n });\n }\n },\n {\n name: 'enter_plan_mode',\n description:\n 'Enter planning mode for complex tasks. In plan mode, you should explore the codebase using read_file, glob, and grep to understand the architecture, then create a detailed plan. Use exit_plan_mode when ready to present the plan for user approval.',\n schema: z.object({\n title: z.string().describe('Title of the plan (e.g., \"Implement user authentication\")'),\n description: z\n .string()\n .describe('Brief description of what will be planned'),\n }),\n },\n );\n }\n\n private createExitPlanModeTool() {\n return tool(\n async ({ tasks }) => {\n try {\n const approved = await this.planModeService.exitPlanMode(\n tasks.map((t) => ({\n subject: t.subject,\n description: t.description,\n activeForm: t.activeForm,\n dependencies: t.dependencies,\n })),\n );\n\n return JSON.stringify({\n success: true,\n approved,\n message: approved\n ? 'Plan approved! You can now execute the tasks.'\n : 'Plan was not approved. Ask the user what they want to change.',\n });\n } catch (error) {\n return JSON.stringify({\n success: false,\n error: (error as Error).message,\n });\n }\n },\n {\n name: 'exit_plan_mode',\n description:\n 'Exit planning mode and present the plan for user approval. The user will see all tasks and can approve, modify, or cancel the plan.',\n schema: z.object({\n tasks: z\n .array(\n z.object({\n subject: z.string().describe('Task title'),\n description: z.string().describe('What this task does'),\n activeForm: z.string().optional().describe('Present continuous form'),\n dependencies: z\n .array(z.string())\n .optional()\n .describe('Task IDs this depends on'),\n }),\n )\n .describe('Array of tasks that make up the plan'),\n }),\n },\n );\n }\n}\n"],"names":["TaskToolsService","getTools","createTaskCreateTool","createTaskUpdateTool","createTaskListTool","createTaskGetTool","createAskUserQuestionTool","createEnterPlanModeTool","createExitPlanModeTool","tool","subject","description","activeForm","dependencies","metadata","task","taskService","createTask","JSON","stringify","success","taskId","id","status","name","schema","z","object","string","describe","optional","array","record","any","addDependencies","updateTask","error","enum","tasks","listTasks","pending","listPendingTasks","total","length","map","t","blocks","getTask","question","type","choices","console","log","answer","promptService","confirm","choiceObjects","c","i","key","String","label","selectedKey","choice","selectedIndex","parseInt","title","planModeService","enterPlanMode","message","approved","exitPlanMode"],"mappings":";;;;+BASaA;;;eAAAA;;;wBATc;uBACN;qBACH;uCACoB;iCACN;+BAEF;;;;;;;;;;AAGvB,IAAA,AAAMA,mBAAN,MAAMA;IAOXC,WAAW;QACT,OA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asks/services/task-tools.service.ts"],"sourcesContent":["import { Injectable } from '@nestjs/common';\nimport { tool } from '@langchain/core/tools';\nimport { z } from 'zod';\nimport { TaskManagementService } from './task-management.service';\nimport { PlanModeService } from './plan-mode.service';\nimport { TaskStatus } from '../types/task.types';\nimport { PromptService } from '../../permissions/services/prompt.service';\n\n@Injectable()\nexport class TaskToolsService {\n constructor(\n private taskService: TaskManagementService,\n private planModeService: PlanModeService,\n private promptService: PromptService,\n ) {}\n\n getTools() {\n return [\n this.createTaskCreateTool(),\n this.createTaskUpdateTool(),\n this.createTaskListTool(),\n this.createTaskGetTool(),\n this.createAskUserQuestionTool(),\n this.createEnterPlanModeTool(),\n this.createExitPlanModeTool(),\n ];\n }\n\n private createTaskCreateTool() {\n return tool(\n async ({ subject, description, activeForm, dependencies, metadata }) => {\n const task = this.taskService.createTask({\n subject,\n description,\n activeForm,\n dependencies: dependencies || [],\n metadata: metadata || {},\n });\n\n return JSON.stringify({\n success: true,\n taskId: task.id,\n task: {\n id: task.id,\n subject: task.subject,\n status: task.status,\n },\n });\n },\n {\n name: 'task_create',\n description:\n 'Create a new task. Use this when breaking down complex work into trackable subtasks. The task will be shown to the user for approval.',\n schema: z.object({\n subject: z.string().describe('Brief task title (e.g., \"Implement login endpoint\")'),\n description: z\n .string()\n .describe('Detailed description of what needs to be done and why'),\n activeForm: z\n .string()\n .optional()\n .describe(\n 'Present continuous form shown when in_progress (e.g., \"Implementing login\")',\n ),\n dependencies: z\n .array(z.string())\n .optional()\n .describe('Array of task IDs that must complete before this one'),\n metadata: z.record(z.any()).optional().describe('Additional metadata'),\n }),\n },\n );\n }\n\n private createTaskUpdateTool() {\n return tool(\n async ({ taskId, status, subject, description, activeForm, addDependencies, metadata }) => {\n const task = this.taskService.updateTask(taskId, {\n status: status as TaskStatus,\n subject,\n description,\n activeForm,\n addDependencies,\n metadata,\n });\n\n if (!task) {\n return JSON.stringify({ success: false, error: 'Task not found' });\n }\n\n return JSON.stringify({\n success: true,\n task: {\n id: task.id,\n subject: task.subject,\n status: task.status,\n },\n });\n },\n {\n name: 'task_update',\n description:\n 'Update an existing task. Use to change status, modify details, or add dependencies.',\n schema: z.object({\n taskId: z.string().describe('ID of the task to update'),\n status: z\n .enum(['pending', 'in_progress', 'completed', 'failed', 'blocked', 'cancelled'])\n .optional()\n .describe('New status for the task'),\n subject: z.string().optional().describe('New subject'),\n description: z.string().optional().describe('New description'),\n activeForm: z.string().optional().describe('New active form'),\n addDependencies: z\n .array(z.string())\n .optional()\n .describe('Task IDs to add as dependencies'),\n metadata: z.record(z.any()).optional().describe('Metadata to merge'),\n }),\n },\n );\n }\n\n private createTaskListTool() {\n return tool(\n async () => {\n const tasks = this.taskService.listTasks();\n const pending = this.taskService.listPendingTasks();\n\n return JSON.stringify({\n total: tasks.length,\n pending: pending.length,\n tasks: tasks.map((t) => ({\n id: t.id,\n subject: t.subject,\n status: t.status,\n dependencies: t.dependencies,\n blocks: t.blocks,\n })),\n });\n },\n {\n name: 'task_list',\n description: 'List all tasks with their current status. Shows which tasks are ready to execute.',\n schema: z.object({}),\n },\n );\n }\n\n private createTaskGetTool() {\n return tool(\n async ({ taskId }) => {\n const task = this.taskService.getTask(taskId);\n\n if (!task) {\n return JSON.stringify({ success: false, error: 'Task not found' });\n }\n\n return JSON.stringify({\n success: true,\n task,\n });\n },\n {\n name: 'task_get',\n description: 'Get full details of a specific task including description and metadata.',\n schema: z.object({\n taskId: z.string().describe('ID of the task to retrieve'),\n }),\n },\n );\n }\n\n private createAskUserQuestionTool() {\n return tool(\n async ({ question, type, choices }) => {\n console.log('');\n\n if (type === 'confirm') {\n const answer = await this.promptService.confirm(question);\n return JSON.stringify({ answer });\n }\n\n if (type === 'choice' && choices) {\n const choiceObjects = choices.map((c, i) => ({\n key: String(i),\n label: c,\n }));\n\n const selectedKey = await this.promptService.choice(question, choiceObjects);\n const selectedIndex = parseInt(selectedKey);\n return JSON.stringify({ answer: choices[selectedIndex] });\n }\n\n if (type === 'text') {\n const answer = await this.promptService.question(question);\n return JSON.stringify({ answer });\n }\n\n return JSON.stringify({ error: 'Invalid question type' });\n },\n {\n name: 'ask_user_question',\n description:\n 'Ask the user a question interactively. Use this when you need clarification, preferences, or decisions from the user before proceeding. This is better than guessing!',\n schema: z.object({\n question: z.string().describe('The question to ask the user'),\n type: z\n .enum(['confirm', 'choice', 'text'])\n .describe('Type of question: confirm (yes/no), choice (multiple options), or text (free form)'),\n choices: z\n .array(z.string())\n .optional()\n .describe('Array of choices for type=choice'),\n }),\n },\n );\n }\n\n private createEnterPlanModeTool() {\n return tool(\n async ({ title, description }) => {\n try {\n await this.planModeService.enterPlanMode(title, description);\n return JSON.stringify({\n success: true,\n message: 'Entered plan mode. Explore the codebase, design your approach, then use exit_plan_mode to present the plan for approval.',\n });\n } catch (error) {\n return JSON.stringify({\n success: false,\n error: (error as Error).message,\n });\n }\n },\n {\n name: 'enter_plan_mode',\n description:\n 'Enter planning mode for complex tasks. In plan mode, you should explore the codebase using read_file, glob, and grep to understand the architecture, then create a detailed plan. Use exit_plan_mode when ready to present the plan for user approval.',\n schema: z.object({\n title: z.string().describe('Title of the plan (e.g., \"Implement user authentication\")'),\n description: z\n .string()\n .describe('Brief description of what will be planned'),\n }),\n },\n );\n }\n\n private createExitPlanModeTool() {\n return tool(\n async ({ tasks }) => {\n try {\n const approval = await this.planModeService.exitPlanMode(\n tasks.map((t) => ({\n subject: t.subject,\n description: t.description,\n activeForm: t.activeForm,\n dependencies: t.dependencies,\n })),\n );\n\n return JSON.stringify({\n success: true,\n approved: approval,\n message: approval.approved\n ? 'Plan approved! You can now execute the tasks.'\n : 'Plan was not approved. Ask the user what they want to change.',\n });\n } catch (error) {\n return JSON.stringify({\n success: false,\n error: (error as Error).message,\n });\n }\n },\n {\n name: 'exit_plan_mode',\n description:\n 'Exit planning mode and present the plan for user approval. The user will see all tasks and can approve, modify, or cancel the plan.',\n schema: z.object({\n tasks: z\n .array(\n z.object({\n subject: z.string().describe('Task title'),\n description: z.string().describe('What this task does'),\n activeForm: z.string().optional().describe('Present continuous form'),\n dependencies: z\n .array(z.string())\n .optional()\n .describe('Task IDs this depends on'),\n }),\n )\n .describe('Array of tasks that make up the plan'),\n }),\n },\n );\n }\n}\n"],"names":["TaskToolsService","getTools","createTaskCreateTool","createTaskUpdateTool","createTaskListTool","createTaskGetTool","createAskUserQuestionTool","createEnterPlanModeTool","createExitPlanModeTool","tool","subject","description","activeForm","dependencies","metadata","task","taskService","createTask","JSON","stringify","success","taskId","id","status","name","schema","z","object","string","describe","optional","array","record","any","addDependencies","updateTask","error","enum","tasks","listTasks","pending","listPendingTasks","total","length","map","t","blocks","getTask","question","type","choices","console","log","answer","promptService","confirm","choiceObjects","c","i","key","String","label","selectedKey","choice","selectedIndex","parseInt","title","planModeService","enterPlanMode","message","approval","exitPlanMode","approved"],"mappings":";;;;+BASaA;;;eAAAA;;;wBATc;uBACN;qBACH;uCACoB;iCACN;+BAEF;;;;;;;;;;AAGvB,IAAA,AAAMA,mBAAN,MAAMA;IAOXC,WAAW;QACT,OAAO;YACL,IAAI,CAACC,oBAAoB;YACzB,IAAI,CAACC,oBAAoB;YACzB,IAAI,CAACC,kBAAkB;YACvB,IAAI,CAACC,iBAAiB;YACtB,IAAI,CAACC,yBAAyB;YAC9B,IAAI,CAACC,uBAAuB;YAC5B,IAAI,CAACC,sBAAsB;SAC5B;IACH;IAEQN,uBAAuB;QAC7B,OAAOO,IAAAA,WAAI,EACT,OAAO,EAAEC,OAAO,EAAEC,WAAW,EAAEC,UAAU,EAAEC,YAAY,EAAEC,QAAQ,EAAE;YACjE,MAAMC,OAAO,IAAI,CAACC,WAAW,CAACC,UAAU,CAAC;gBACvCP;gBACAC;gBACAC;gBACAC,cAAcA,gBAAgB,EAAE;gBAChCC,UAAUA,YAAY,CAAC;YACzB;YAEA,OAAOI,KAAKC,SAAS,CAAC;gBACpBC,SAAS;gBACTC,QAAQN,KAAKO,EAAE;gBACfP,MAAM;oBACJO,IAAIP,KAAKO,EAAE;o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