hanseol 3.3.6 → 4.0.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.
Files changed (159) hide show
  1. package/dist/agents/planner/index.d.ts +5 -1
  2. package/dist/agents/planner/index.d.ts.map +1 -1
  3. package/dist/agents/planner/index.js +161 -95
  4. package/dist/agents/planner/index.js.map +1 -1
  5. package/dist/constants.d.ts +1 -1
  6. package/dist/constants.js +1 -1
  7. package/dist/prompts/agents/planning.d.ts.map +1 -1
  8. package/dist/prompts/agents/planning.js +117 -57
  9. package/dist/prompts/agents/planning.js.map +1 -1
  10. package/dist/prompts/system/plan-execute.d.ts.map +1 -1
  11. package/dist/prompts/system/plan-execute.js +40 -4
  12. package/dist/prompts/system/plan-execute.js.map +1 -1
  13. package/dist/tools/browser/browser-client.d.ts +13 -1
  14. package/dist/tools/browser/browser-client.d.ts.map +1 -1
  15. package/dist/tools/browser/browser-client.js +106 -7
  16. package/dist/tools/browser/browser-client.js.map +1 -1
  17. package/dist/tools/browser/browser-tools.d.ts +8 -2
  18. package/dist/tools/browser/browser-tools.d.ts.map +1 -1
  19. package/dist/tools/browser/browser-tools.js +428 -53
  20. package/dist/tools/browser/browser-tools.js.map +1 -1
  21. package/dist/tools/browser/index.d.ts +1 -1
  22. package/dist/tools/browser/index.d.ts.map +1 -1
  23. package/dist/tools/browser/index.js +1 -1
  24. package/dist/tools/browser/index.js.map +1 -1
  25. package/dist/tools/llm/simple/planning-tools.d.ts +1 -0
  26. package/dist/tools/llm/simple/planning-tools.d.ts.map +1 -1
  27. package/dist/tools/llm/simple/planning-tools.js +80 -26
  28. package/dist/tools/llm/simple/planning-tools.js.map +1 -1
  29. package/dist/tools/office/excel-client.d.ts +89 -0
  30. package/dist/tools/office/excel-client.d.ts.map +1 -1
  31. package/dist/tools/office/excel-client.js +1205 -0
  32. package/dist/tools/office/excel-client.js.map +1 -1
  33. package/dist/tools/office/excel-tools/advanced.d.ts +13 -0
  34. package/dist/tools/office/excel-tools/advanced.d.ts.map +1 -0
  35. package/dist/tools/office/excel-tools/advanced.js +364 -0
  36. package/dist/tools/office/excel-tools/advanced.js.map +1 -0
  37. package/dist/tools/office/excel-tools/cells.js +1 -1
  38. package/dist/tools/office/excel-tools/cells.js.map +1 -1
  39. package/dist/tools/office/excel-tools/charts.d.ts +6 -0
  40. package/dist/tools/office/excel-tools/charts.d.ts.map +1 -1
  41. package/dist/tools/office/excel-tools/charts.js +250 -1
  42. package/dist/tools/office/excel-tools/charts.js.map +1 -1
  43. package/dist/tools/office/excel-tools/comments.d.ts +1 -0
  44. package/dist/tools/office/excel-tools/comments.d.ts.map +1 -1
  45. package/dist/tools/office/excel-tools/comments.js +36 -0
  46. package/dist/tools/office/excel-tools/comments.js.map +1 -1
  47. package/dist/tools/office/excel-tools/data-ops.d.ts +4 -0
  48. package/dist/tools/office/excel-tools/data-ops.d.ts.map +1 -1
  49. package/dist/tools/office/excel-tools/data-ops.js +155 -1
  50. package/dist/tools/office/excel-tools/data-ops.js.map +1 -1
  51. package/dist/tools/office/excel-tools/export.d.ts +3 -0
  52. package/dist/tools/office/excel-tools/export.d.ts.map +1 -1
  53. package/dist/tools/office/excel-tools/export.js +117 -1
  54. package/dist/tools/office/excel-tools/export.js.map +1 -1
  55. package/dist/tools/office/excel-tools/formatting.d.ts +2 -0
  56. package/dist/tools/office/excel-tools/formatting.d.ts.map +1 -1
  57. package/dist/tools/office/excel-tools/formatting.js +74 -0
  58. package/dist/tools/office/excel-tools/formatting.js.map +1 -1
  59. package/dist/tools/office/excel-tools/formulas.d.ts +11 -0
  60. package/dist/tools/office/excel-tools/formulas.d.ts.map +1 -0
  61. package/dist/tools/office/excel-tools/formulas.js +313 -0
  62. package/dist/tools/office/excel-tools/formulas.js.map +1 -0
  63. package/dist/tools/office/excel-tools/index.d.ts +5 -0
  64. package/dist/tools/office/excel-tools/index.d.ts.map +1 -1
  65. package/dist/tools/office/excel-tools/index.js +15 -0
  66. package/dist/tools/office/excel-tools/index.js.map +1 -1
  67. package/dist/tools/office/excel-tools/media.d.ts +5 -0
  68. package/dist/tools/office/excel-tools/media.d.ts.map +1 -1
  69. package/dist/tools/office/excel-tools/media.js +176 -0
  70. package/dist/tools/office/excel-tools/media.js.map +1 -1
  71. package/dist/tools/office/excel-tools/page-setup.d.ts +6 -0
  72. package/dist/tools/office/excel-tools/page-setup.d.ts.map +1 -0
  73. package/dist/tools/office/excel-tools/page-setup.js +144 -0
  74. package/dist/tools/office/excel-tools/page-setup.js.map +1 -0
  75. package/dist/tools/office/excel-tools/pivot-table.d.ts +7 -0
  76. package/dist/tools/office/excel-tools/pivot-table.d.ts.map +1 -0
  77. package/dist/tools/office/excel-tools/pivot-table.js +151 -0
  78. package/dist/tools/office/excel-tools/pivot-table.js.map +1 -0
  79. package/dist/tools/office/excel-tools/rows-columns.d.ts +4 -0
  80. package/dist/tools/office/excel-tools/rows-columns.d.ts.map +1 -1
  81. package/dist/tools/office/excel-tools/rows-columns.js +149 -2
  82. package/dist/tools/office/excel-tools/rows-columns.js.map +1 -1
  83. package/dist/tools/office/excel-tools/sheets.d.ts +8 -0
  84. package/dist/tools/office/excel-tools/sheets.d.ts.map +1 -1
  85. package/dist/tools/office/excel-tools/sheets.js +288 -0
  86. package/dist/tools/office/excel-tools/sheets.js.map +1 -1
  87. package/dist/tools/office/excel-tools/tables.d.ts +7 -0
  88. package/dist/tools/office/excel-tools/tables.d.ts.map +1 -0
  89. package/dist/tools/office/excel-tools/tables.js +151 -0
  90. package/dist/tools/office/excel-tools/tables.js.map +1 -0
  91. package/dist/tools/office/powerpoint-client.d.ts +20 -0
  92. package/dist/tools/office/powerpoint-client.d.ts.map +1 -1
  93. package/dist/tools/office/powerpoint-client.js +223 -0
  94. package/dist/tools/office/powerpoint-client.js.map +1 -1
  95. package/dist/tools/office/powerpoint-tools/effects.d.ts.map +1 -1
  96. package/dist/tools/office/powerpoint-tools/effects.js +55 -42
  97. package/dist/tools/office/powerpoint-tools/effects.js.map +1 -1
  98. package/dist/tools/office/powerpoint-tools/export.d.ts +1 -0
  99. package/dist/tools/office/powerpoint-tools/export.d.ts.map +1 -1
  100. package/dist/tools/office/powerpoint-tools/export.js +44 -1
  101. package/dist/tools/office/powerpoint-tools/export.js.map +1 -1
  102. package/dist/tools/office/powerpoint-tools/media.d.ts.map +1 -1
  103. package/dist/tools/office/powerpoint-tools/media.js +25 -15
  104. package/dist/tools/office/powerpoint-tools/media.js.map +1 -1
  105. package/dist/tools/office/powerpoint-tools/notes.d.ts.map +1 -1
  106. package/dist/tools/office/powerpoint-tools/notes.js +20 -10
  107. package/dist/tools/office/powerpoint-tools/notes.js.map +1 -1
  108. package/dist/tools/office/powerpoint-tools/sections.d.ts.map +1 -1
  109. package/dist/tools/office/powerpoint-tools/sections.js +13 -6
  110. package/dist/tools/office/powerpoint-tools/sections.js.map +1 -1
  111. package/dist/tools/office/powerpoint-tools/shapes.d.ts +2 -0
  112. package/dist/tools/office/powerpoint-tools/shapes.d.ts.map +1 -1
  113. package/dist/tools/office/powerpoint-tools/shapes.js +181 -45
  114. package/dist/tools/office/powerpoint-tools/shapes.js.map +1 -1
  115. package/dist/tools/office/powerpoint-tools/slides.d.ts +4 -0
  116. package/dist/tools/office/powerpoint-tools/slides.d.ts.map +1 -1
  117. package/dist/tools/office/powerpoint-tools/slides.js +179 -15
  118. package/dist/tools/office/powerpoint-tools/slides.js.map +1 -1
  119. package/dist/tools/office/powerpoint-tools/tables.d.ts +6 -0
  120. package/dist/tools/office/powerpoint-tools/tables.d.ts.map +1 -1
  121. package/dist/tools/office/powerpoint-tools/tables.js +239 -9
  122. package/dist/tools/office/powerpoint-tools/tables.js.map +1 -1
  123. package/dist/tools/office/powerpoint-tools/text.d.ts +1 -0
  124. package/dist/tools/office/powerpoint-tools/text.d.ts.map +1 -1
  125. package/dist/tools/office/powerpoint-tools/text.js +98 -36
  126. package/dist/tools/office/powerpoint-tools/text.js.map +1 -1
  127. package/dist/tools/office/word-client.d.ts +36 -0
  128. package/dist/tools/office/word-client.d.ts.map +1 -1
  129. package/dist/tools/office/word-client.js +340 -0
  130. package/dist/tools/office/word-client.js.map +1 -1
  131. package/dist/tools/office/word-tools/find.d.ts +5 -0
  132. package/dist/tools/office/word-tools/find.d.ts.map +1 -0
  133. package/dist/tools/office/word-tools/find.js +106 -0
  134. package/dist/tools/office/word-tools/find.js.map +1 -0
  135. package/dist/tools/office/word-tools/footnotes.d.ts +9 -0
  136. package/dist/tools/office/word-tools/footnotes.d.ts.map +1 -0
  137. package/dist/tools/office/word-tools/footnotes.js +227 -0
  138. package/dist/tools/office/word-tools/footnotes.js.map +1 -0
  139. package/dist/tools/office/word-tools/index.d.ts +6 -0
  140. package/dist/tools/office/word-tools/index.d.ts.map +1 -1
  141. package/dist/tools/office/word-tools/index.js +18 -0
  142. package/dist/tools/office/word-tools/index.js.map +1 -1
  143. package/dist/tools/office/word-tools/selection.d.ts +8 -0
  144. package/dist/tools/office/word-tools/selection.d.ts.map +1 -0
  145. package/dist/tools/office/word-tools/selection.js +193 -0
  146. package/dist/tools/office/word-tools/selection.js.map +1 -0
  147. package/dist/tools/office/word-tools/tables-advanced.d.ts +8 -0
  148. package/dist/tools/office/word-tools/tables-advanced.d.ts.map +1 -0
  149. package/dist/tools/office/word-tools/tables-advanced.js +190 -0
  150. package/dist/tools/office/word-tools/tables-advanced.js.map +1 -0
  151. package/dist/tools/office/word-tools/toc.d.ts +6 -0
  152. package/dist/tools/office/word-tools/toc.d.ts.map +1 -0
  153. package/dist/tools/office/word-tools/toc.js +114 -0
  154. package/dist/tools/office/word-tools/toc.js.map +1 -0
  155. package/dist/tools/office/word-tools/track-changes.d.ts +8 -0
  156. package/dist/tools/office/word-tools/track-changes.d.ts.map +1 -0
  157. package/dist/tools/office/word-tools/track-changes.js +195 -0
  158. package/dist/tools/office/word-tools/track-changes.js.map +1 -0
  159. package/package.json +1 -1
@@ -1,12 +1,16 @@
1
1
  import { LLMClient } from '../../core/llm/llm-client.js';
2
2
  import { Message, PlanningResult } from '../../types/index.js';
3
+ import { AskUserCallback } from '../../tools/llm/simple/user-interaction-tools.js';
3
4
  export interface PlanningWithDocsResult extends PlanningResult {
4
5
  docsSearchNeeded: boolean;
5
6
  }
6
7
  export declare class PlanningLLM {
7
8
  private llmClient;
9
+ private askUserCallback;
8
10
  constructor(llmClient: LLMClient);
9
- generateTODOList(userRequest: string, contextMessages?: Message[]): Promise<PlanningResult>;
11
+ setAskUserCallback(callback: AskUserCallback): void;
12
+ clearAskUserCallback(): void;
13
+ generateTODOList(userRequest: string, contextMessages?: Message[], onMessagesUpdate?: (messages: Message[]) => void): Promise<PlanningResult>;
10
14
  generateTODOListWithDocsDecision(userRequest: string, contextMessages?: Message[]): Promise<PlanningWithDocsResult>;
11
15
  private shouldSearchDocs;
12
16
  private getDocsFolderStructure;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agents/planner/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,OAAO,EAAY,cAAc,EAAc,MAAM,sBAAsB,CAAC;AAarF,MAAM,WAAW,sBAAuB,SAAQ,cAAc;IAC5D,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAMD,qBAAa,WAAW;IACtB,OAAO,CAAC,SAAS,CAAY;gBAEjB,SAAS,EAAE,SAAS;IAU1B,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC;IAsM3F,gCAAgC,CACpC,WAAW,EAAE,MAAM,EACnB,eAAe,CAAC,EAAE,OAAO,EAAE,GAC1B,OAAO,CAAC,sBAAsB,CAAC;YA+CpB,gBAAgB;YA+DhB,sBAAsB;CA2CrC;AAED,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agents/planner/index.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,OAAO,EAAY,cAAc,EAAc,MAAM,sBAAsB,CAAC;AASrF,OAAO,EAEL,eAAe,EAChB,MAAM,kDAAkD,CAAC;AAK1D,MAAM,WAAW,sBAAuB,SAAQ,cAAc;IAC5D,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAOD,qBAAa,WAAW;IACtB,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,eAAe,CAAgC;gBAE3C,SAAS,EAAE,SAAS;IAQhC,kBAAkB,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;IAQnD,oBAAoB,IAAI,IAAI;IAatB,gBAAgB,CACpB,WAAW,EAAE,MAAM,EACnB,eAAe,CAAC,EAAE,OAAO,EAAE,EAC3B,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,IAAI,GAC/C,OAAO,CAAC,cAAc,CAAC;IA2RpB,gCAAgC,CACpC,WAAW,EAAE,MAAM,EACnB,eAAe,CAAC,EAAE,OAAO,EAAE,GAC1B,OAAO,CAAC,sBAAsB,CAAC;YA+CpB,gBAAgB;YA+DhB,sBAAsB;CA2CrC;AAED,eAAe,WAAW,CAAC"}
@@ -7,10 +7,19 @@ import { toolRegistry } from '../../tools/registry.js';
7
7
  import { buildDocsSearchDecisionPrompt, parseDocsSearchDecision, DOCS_SEARCH_DECISION_RETRY_PROMPT, } from '../../prompts/agents/docs-search-decision.js';
8
8
  export class PlanningLLM {
9
9
  llmClient;
10
+ askUserCallback = null;
10
11
  constructor(llmClient) {
11
12
  this.llmClient = llmClient;
12
13
  }
13
- async generateTODOList(userRequest, contextMessages) {
14
+ setAskUserCallback(callback) {
15
+ logger.flow('Setting ask-user callback for Planning LLM');
16
+ this.askUserCallback = callback;
17
+ }
18
+ clearAskUserCallback() {
19
+ logger.flow('Clearing ask-user callback for Planning LLM');
20
+ this.askUserCallback = null;
21
+ }
22
+ async generateTODOList(userRequest, contextMessages, onMessagesUpdate) {
14
23
  const toolSummary = toolRegistry.getToolSummaryForPlanning();
15
24
  const optionalToolsInfo = toolRegistry.getEnabledOptionalToolsInfo();
16
25
  const systemPrompt = buildPlanningSystemPrompt(toolSummary, optionalToolsInfo);
@@ -34,119 +43,176 @@ export class PlanningLLM {
34
43
  const planningTools = toolRegistry.getLLMPlanningToolDefinitions();
35
44
  const MAX_RETRIES = 3;
36
45
  let lastError = null;
37
- for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
38
- try {
39
- if (attempt > 1) {
40
- messages.push({
41
- role: 'user',
42
- content: `[RETRY ${attempt}/${MAX_RETRIES}] ⚠️ CRITICAL: You are the PLANNING LLM, not the Execution LLM.
46
+ while (true) {
47
+ let shouldContinueMainLoop = false;
48
+ for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
49
+ try {
50
+ if (attempt > 1) {
51
+ messages.push({
52
+ role: 'user',
53
+ content: `[RETRY ${attempt}/${MAX_RETRIES}] ⚠️ CRITICAL: You are the PLANNING LLM, not the Execution LLM.
43
54
 
44
- You have ONLY 2 tools available:
45
- 1. 'create_todos' - For ANY action/implementation request
46
- 2. 'respond_to_user' - For questions/greetings only
55
+ You have ONLY 3 tools available:
56
+ 1. 'ask_to_user' - To clarify ambiguous requirements (use FIRST if unclear)
57
+ 2. 'create_todos' - For ANY action/implementation request
58
+ 3. 'respond_to_user' - For pure knowledge questions/greetings only
47
59
 
48
60
  ❌ DO NOT use tools like 'write_todos', 'read_file', 'bash', etc. Those are for Execution LLM, NOT you.
49
61
  ❌ You saw those tools in conversation history, but they are NOT available to you.
50
62
 
51
63
  Previous error: ${lastError?.message || 'Invalid response'}
52
64
 
53
- Choose either 'create_todos' or 'respond_to_user' now.`,
54
- });
55
- logger.warn(`Planning LLM retry attempt ${attempt}/${MAX_RETRIES}`, { lastError: lastError?.message });
56
- }
57
- const response = await this.llmClient.chatCompletion({
58
- messages,
59
- tools: planningTools,
60
- tool_choice: 'required',
61
- temperature: 0.7,
62
- max_tokens: 2000,
63
- });
64
- const choicesCount = response.choices?.length ?? 0;
65
- const message = response.choices?.[0]?.message;
66
- const toolCalls = message?.tool_calls;
67
- const finishReason = response.choices?.[0]?.finish_reason;
68
- logger.debug('Planning LLM response', {
69
- choicesCount,
70
- hasMessage: !!message,
71
- hasToolCalls: !!(toolCalls && toolCalls.length > 0),
72
- hasContent: !!message?.content,
73
- contentLength: message?.content?.length ?? 0,
74
- finishReason,
75
- toolCallsCount: toolCalls?.length ?? 0,
76
- });
77
- if (toolCalls && toolCalls.length > 0) {
78
- const toolCall = toolCalls[0];
79
- const toolName = toolCall.function?.name;
80
- let toolArgs;
81
- try {
82
- toolArgs = JSON.parse(toolCall.function?.arguments || '{}');
83
- }
84
- catch (error) {
85
- logger.warn('Failed to parse tool arguments', { args: toolCall.function?.arguments, error });
86
- lastError = error;
87
- continue;
65
+ Choose one of your 3 tools now.`,
66
+ });
67
+ logger.warn(`Planning LLM retry attempt ${attempt}/${MAX_RETRIES}`, { lastError: lastError?.message });
88
68
  }
89
- if (toolName === 'create_todos') {
90
- logger.flow('TODO list created via create_todos tool');
91
- let rawTodos = toolArgs.todos;
92
- if (typeof rawTodos === 'string') {
69
+ const response = await this.llmClient.chatCompletion({
70
+ messages,
71
+ tools: planningTools,
72
+ tool_choice: 'required',
73
+ temperature: 0.7,
74
+ max_tokens: 2000,
75
+ });
76
+ const choicesCount = response.choices?.length ?? 0;
77
+ const message = response.choices?.[0]?.message;
78
+ const toolCalls = message?.tool_calls;
79
+ const finishReason = response.choices?.[0]?.finish_reason;
80
+ logger.debug('Planning LLM response', {
81
+ choicesCount,
82
+ hasMessage: !!message,
83
+ hasToolCalls: !!(toolCalls && toolCalls.length > 0),
84
+ hasContent: !!message?.content,
85
+ contentLength: message?.content?.length ?? 0,
86
+ finishReason,
87
+ toolCallsCount: toolCalls?.length ?? 0,
88
+ });
89
+ if (toolCalls && toolCalls.length > 0) {
90
+ const toolCall = toolCalls[0];
91
+ const toolName = toolCall.function?.name;
92
+ let toolArgs;
93
+ try {
94
+ toolArgs = JSON.parse(toolCall.function?.arguments || '{}');
95
+ }
96
+ catch (error) {
97
+ logger.warn('Failed to parse tool arguments', { args: toolCall.function?.arguments, error });
98
+ lastError = error;
99
+ continue;
100
+ }
101
+ if (toolName === 'ask_to_user') {
102
+ logger.flow('Planning LLM asking user for clarification');
103
+ const question = toolArgs.question;
104
+ const options = toolArgs.options;
105
+ if (!question || !Array.isArray(options) || options.length < 2) {
106
+ logger.warn('ask_to_user called with invalid parameters', { toolArgs });
107
+ lastError = new Error('ask_to_user requires a question and 2-4 options');
108
+ continue;
109
+ }
110
+ if (!this.askUserCallback) {
111
+ logger.warn('ask_to_user called but no callback is set, skipping to create_todos');
112
+ messages.push({
113
+ role: 'assistant',
114
+ content: `[Planning LLM attempted to ask: "${question}" but user interaction is not available. Proceeding with best judgment.]`,
115
+ });
116
+ shouldContinueMainLoop = true;
117
+ break;
118
+ }
93
119
  try {
94
- rawTodos = JSON.parse(rawTodos);
95
- logger.debug('Parsed string-wrapped todos array');
120
+ messages.push({
121
+ role: 'assistant',
122
+ content: `[Clarification needed] ${question}\nOptions: ${options.join(', ')}`,
123
+ });
124
+ const userResponse = await this.askUserCallback({ question, options });
125
+ const userAnswerText = userResponse.isOther && userResponse.customText
126
+ ? userResponse.customText
127
+ : userResponse.selectedOption;
128
+ messages.push({
129
+ role: 'user',
130
+ content: `[User's answer] ${userAnswerText}`,
131
+ });
132
+ logger.flow('User responded to clarification question', {
133
+ question,
134
+ answer: userAnswerText,
135
+ isCustom: userResponse.isOther,
136
+ });
137
+ if (onMessagesUpdate) {
138
+ const historyMessages = messages.filter(m => m.role !== 'system');
139
+ onMessagesUpdate(historyMessages);
140
+ }
141
+ shouldContinueMainLoop = true;
142
+ break;
96
143
  }
97
- catch {
98
- logger.warn('Failed to parse string todos as JSON', { todos: rawTodos });
144
+ catch (error) {
145
+ logger.error('Error during ask_to_user', error);
146
+ lastError = error;
147
+ continue;
99
148
  }
100
149
  }
101
- if (!Array.isArray(rawTodos)) {
102
- logger.warn('create_todos called with non-array todos', { toolArgs });
103
- lastError = new Error('Planning LLM returned invalid todos format (expected array).');
104
- continue;
150
+ if (toolName === 'create_todos') {
151
+ logger.flow('TODO list created via create_todos tool');
152
+ let rawTodos = toolArgs.todos;
153
+ if (typeof rawTodos === 'string') {
154
+ try {
155
+ rawTodos = JSON.parse(rawTodos);
156
+ logger.debug('Parsed string-wrapped todos array');
157
+ }
158
+ catch {
159
+ logger.warn('Failed to parse string todos as JSON', { todos: rawTodos });
160
+ }
161
+ }
162
+ if (!Array.isArray(rawTodos)) {
163
+ logger.warn('create_todos called with non-array todos', { toolArgs });
164
+ lastError = new Error('Planning LLM returned invalid todos format (expected array).');
165
+ continue;
166
+ }
167
+ const todos = rawTodos.map((todo, index) => ({
168
+ id: todo.id || `todo-${Date.now()}-${index}`,
169
+ title: todo.title || 'Untitled task',
170
+ status: (index === 0 ? 'in_progress' : 'pending'),
171
+ }));
172
+ return {
173
+ todos,
174
+ complexity: toolArgs.complexity || 'moderate',
175
+ };
105
176
  }
106
- const todos = rawTodos.map((todo, index) => ({
107
- id: todo.id || `todo-${Date.now()}-${index}`,
108
- title: todo.title || 'Untitled task',
109
- status: (index === 0 ? 'in_progress' : 'pending'),
110
- }));
111
- return {
112
- todos,
113
- complexity: toolArgs.complexity || 'moderate',
114
- };
115
- }
116
- if (toolName === 'respond_to_user') {
117
- logger.flow('Direct response via respond_to_user tool');
118
- const response = toolArgs.response || '';
119
- if (!response) {
120
- logger.warn('respond_to_user called with empty response');
121
- lastError = new Error('Planning LLM returned empty response.');
122
- continue;
177
+ if (toolName === 'respond_to_user') {
178
+ logger.flow('Direct response via respond_to_user tool');
179
+ const responseText = toolArgs.response || '';
180
+ if (!responseText) {
181
+ logger.warn('respond_to_user called with empty response');
182
+ lastError = new Error('Planning LLM returned empty response.');
183
+ continue;
184
+ }
185
+ return {
186
+ todos: [],
187
+ complexity: 'simple',
188
+ directResponse: responseText,
189
+ };
123
190
  }
124
- return {
125
- todos: [],
126
- complexity: 'simple',
127
- directResponse: response,
128
- };
191
+ logger.warn(`Unknown tool called: ${toolName}`);
192
+ lastError = new Error(`Invalid tool "${toolName}". You only have 3 tools: ask_to_user, create_todos, or respond_to_user. Tools like write_todos are for Execution LLM, not Planning LLM.`);
193
+ continue;
194
+ }
195
+ const contentOnly = message?.content;
196
+ if (contentOnly) {
197
+ logger.warn(`Planning LLM returned content without tool call (attempt ${attempt}/${MAX_RETRIES})`, {
198
+ contentPreview: contentOnly.substring(0, 100),
199
+ });
200
+ lastError = new Error('You MUST call one of your tools: ask_to_user, create_todos, or respond_to_user. Do NOT respond with plain text.');
201
+ }
202
+ else {
203
+ logger.warn(`Planning LLM returned no tool call and no content (attempt ${attempt}/${MAX_RETRIES})`);
204
+ lastError = new Error('Planning LLM must use one of: ask_to_user, create_todos, or respond_to_user');
129
205
  }
130
- logger.warn(`Unknown tool called: ${toolName}`);
131
- lastError = new Error(`Invalid tool "${toolName}". You only have 2 tools: create_todos or respond_to_user. Tools like write_todos are for Execution LLM, not Planning LLM.`);
132
- continue;
133
- }
134
- const contentOnly = message?.content;
135
- if (contentOnly) {
136
- logger.warn(`Planning LLM returned content without tool call (attempt ${attempt}/${MAX_RETRIES})`, {
137
- contentPreview: contentOnly.substring(0, 100),
138
- });
139
- lastError = new Error('You MUST call either create_todos or respond_to_user tool. Do NOT respond with plain text. Use the tools provided.');
140
206
  }
141
- else {
142
- logger.warn(`Planning LLM returned no tool call and no content (attempt ${attempt}/${MAX_RETRIES})`);
143
- lastError = new Error('Planning LLM must use either create_todos or respond_to_user tool');
207
+ catch (error) {
208
+ logger.warn(`Planning LLM error (attempt ${attempt}/${MAX_RETRIES}):`, error);
209
+ lastError = error;
144
210
  }
145
211
  }
146
- catch (error) {
147
- logger.warn(`Planning LLM error (attempt ${attempt}/${MAX_RETRIES}):`, error);
148
- lastError = error;
212
+ if (shouldContinueMainLoop) {
213
+ continue;
149
214
  }
215
+ break;
150
216
  }
151
217
  logger.warn('All planning retries exhausted, using fallback TODO', { lastError: lastError?.message });
152
218
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/agents/planner/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAGzB,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EACL,6BAA6B,EAC7B,uBAAuB,EACvB,iCAAiC,GAClC,MAAM,8CAA8C,CAAC;AAatD,MAAM,OAAO,WAAW;IACd,SAAS,CAAY;IAE7B,YAAY,SAAoB;QAC9B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAQD,KAAK,CAAC,gBAAgB,CAAC,WAAmB,EAAE,eAA2B;QAErE,MAAM,WAAW,GAAG,YAAY,CAAC,yBAAyB,EAAE,CAAC;QAC7D,MAAM,iBAAiB,GAAG,YAAY,CAAC,2BAA2B,EAAE,CAAC;QACrE,MAAM,YAAY,GAAG,yBAAyB,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC;QAE/E,MAAM,QAAQ,GAAc;YAC1B;gBACE,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,YAAY;aACtB;SACF,CAAC;QAIF,IAAI,eAAe,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAClD,MAAM,gBAAgB,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;YAC1E,QAAQ,CAAC,IAAI,CAAC,GAAG,gBAAgB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,EAAE,CAAC;gBACvB,OAAO,sCAAsC,CAAC;YAChD,CAAC;YAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,GAAG,GAAG,KAA8B,CAAC;YAC3C,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC1B,OAAO,iCAAiC,CAAC;YAC3C,CAAC;YACD,OAAO,gCAAgC,CAAC;QAC1C,CAAC;IACH,CAAC;CACF;AAED,eAAe,WAAW,CAAC"}
@@ -4,5 +4,5 @@ export declare const CONFIG_FILE_PATH: string;
4
4
  export declare const DOCS_DIR: string;
5
5
  export declare const BACKUPS_DIR: string;
6
6
  export declare const PROJECTS_DIR: string;
7
- export declare const APP_VERSION = "3.3.6";
7
+ export declare const APP_VERSION = "4.0.0";
8
8
  //# sourceMappingURL=constants.d.ts.map
package/dist/constants.js CHANGED
@@ -6,5 +6,5 @@ export const CONFIG_FILE_PATH = path.join(LOCAL_HOME_DIR, 'config.json');
6
6
  export const DOCS_DIR = path.join(LOCAL_HOME_DIR, 'docs');
7
7
  export const BACKUPS_DIR = path.join(LOCAL_HOME_DIR, 'backups');
8
8
  export const PROJECTS_DIR = path.join(LOCAL_HOME_DIR, 'projects');
9
- export const APP_VERSION = '3.3.6';
9
+ export const APP_VERSION = '4.0.0';
10
10
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"planning.d.ts","sourceRoot":"","sources":["../../../src/prompts/agents/planning.ts"],"names":[],"mappings":"AAmHA,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,MAAM,EAAE,iBAAiB,GAAE,MAAW,GAAG,MAAM,CAWrG;AAMD,eAAO,MAAM,sBAAsB,QAQlC,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
1
+ {"version":3,"file":"planning.d.ts","sourceRoot":"","sources":["../../../src/prompts/agents/planning.ts"],"names":[],"mappings":"AA2KA,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,MAAM,EAAE,iBAAiB,GAAE,MAAW,GAAG,MAAM,CAarG;AAMD,eAAO,MAAM,sBAAsB,QAWlC,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
@@ -1,21 +1,54 @@
1
1
  import { LANGUAGE_PRIORITY_SHORT } from '../shared/language-rules.js';
2
- const PLANNING_BASE_PROMPT = `You are a task planning assistant. Your job is to create TODO lists for an Execution LLM that has powerful tools.
2
+ const PLANNING_BASE_PROMPT = `You are a **Planning Agent** that creates task lists for a powerful Execution Agent.
3
3
 
4
4
  ${LANGUAGE_PRIORITY_SHORT}
5
5
 
6
- ## IMPORTANT: Your Role
6
+ ## YOUR ROLE
7
7
 
8
- You are the PLANNER, not the executor. After you create a TODO list, an **Execution LLM** will take over.
9
- The Execution LLM can do almost anything a developer can do. Your job is to break down the user's request into high-level tasks.
8
+ You are the **planner**, NOT the executor. Your job is to:
9
+ - **Understand** the user's requirements precisely
10
+ - **Clarify** ambiguous requests before planning
11
+ - **Create** a comprehensive TODO list for the Execution Agent
10
12
 
11
- ## Your Tools
13
+ The **Execution Agent** (not you) has powerful capabilities:
14
+ - Execute ANY bash command (git, npm, python, docker, etc.)
15
+ - Read, create, edit, delete ANY files on the system
16
+ - Run builds, tests, deployments, and any workflow
17
+ - Browser automation, office document editing (if enabled)
18
+ - Access and control applications just like the user can
12
19
 
13
- You have exactly TWO tools available, and you MUST use one of them:
20
+ Since the Execution Agent can do almost anything a computer user can do, your job is to plan tasks that fully utilize its capabilities.
21
+
22
+ ## YOUR MISSION
23
+
24
+ **Plan tasks so the Execution Agent can DO THE USER'S ENTIRE JOB, not just provide guidance or examples.**
25
+
26
+ - The user is using this system to get REAL WORK done
27
+ - Understand the user's actual working environment and context
28
+ - Create TODO lists that COMPLETE the work, not demonstrate how to do it
29
+ - Never plan for POC, examples, or partial solutions unless explicitly requested
30
+
31
+ ## YOUR TOOLS
32
+
33
+ You have exactly THREE tools available:
14
34
 
15
35
  ⚠️ **CRITICAL**: You may see other tools (like 'write_todos', 'read_file', 'bash') in conversation history.
16
- Those are for the **Execution LLM**, NOT for you. DO NOT attempt to use them. You only have the 2 tools below.
36
+ Those are for the **Execution LLM**, NOT for you. You only have the 3 tools below.
37
+
38
+ ### 1. ask_to_user (CLARIFICATION - USE FIRST IF NEEDED)
39
+ **Use this BEFORE creating TODOs when requirements are unclear.**
40
+
41
+ When to use:
42
+ - The request is vague or ambiguous
43
+ - Multiple interpretations are possible
44
+ - Critical decisions need user input (e.g., which approach to take)
45
+ - You need to understand the user's environment or constraints
46
+ - Missing information that affects how tasks should be done
47
+
48
+ You can call ask_to_user MULTIPLE TIMES to gather all necessary information.
49
+ **It's better to ask 3 questions and do it right than to guess and do it wrong.**
17
50
 
18
- ### 1. create_todos
51
+ ### 2. create_todos (PLANNING)
19
52
  Use this when the request involves ANY action or implementation:
20
53
  - Code implementation, modification, or refactoring
21
54
  - Bug fixes or debugging
@@ -24,76 +57,98 @@ Use this when the request involves ANY action or implementation:
24
57
  - Git operations (commit, push, branch, merge)
25
58
  - Exploring or searching codebase
26
59
  - Any task that requires ACTION, not just explanation
27
- - Complex questions that require investigation or research
28
60
 
29
- ### 2. respond_to_user
61
+ ### 3. respond_to_user (DIRECT RESPONSE)
30
62
  Use this ONLY for pure questions that need NO action:
31
- - Pure knowledge questions (e.g., "What is a React hook?", "Explain async/await")
63
+ - Pure knowledge questions (e.g., "What is a React hook?")
32
64
  - Simple greetings or casual conversation
33
- - Questions about concepts that don't require looking at code
34
- - The user is clearly just asking for an explanation, not an action
65
+ - Conceptual explanations that don't require code/files
35
66
 
36
- ⚠️ **When in doubt, USE create_todos.** The Execution LLM is capable and will handle the details.
67
+ ⚠️ **When in doubt between ask_to_user and create_todos, USE ask_to_user first.**
68
+ ⚠️ **When in doubt between create_todos and respond_to_user, USE create_todos.**
37
69
 
38
70
  ## CRITICAL RULES
39
71
 
40
- 1. **You MUST use one of your tools** - Either create_todos OR respond_to_user. Never return without using a tool.
72
+ ### Rule 1: CLARIFY BEFORE PLANNING
73
+ If the user's request has ANY ambiguity:
74
+ - Use ask_to_user to clarify requirements
75
+ - Ask about the user's environment, constraints, or preferences
76
+ - Don't assume - ASK
41
77
 
42
- 2. **create_todos for ANY action** - If the user's request requires ANY action (not just explanation), you MUST use create_todos.
43
- Even if it's a single simple task like "run tests" or "check the build", create a TODO for it.
44
- Only use respond_to_user for pure knowledge questions that require zero action.
78
+ Examples of ambiguity that REQUIRE clarification:
79
+ - "Add authentication" What type? OAuth? JWT? Session-based?
80
+ - "Fix the bug" Which bug? What's the expected behavior?
81
+ - "Deploy the app" → Where? AWS? Vercel? Docker?
82
+ - "Make it faster" → Which part? What's the current bottleneck?
45
83
 
46
- 3. **[NEW REQUEST] marker** - When you see "[NEW REQUEST]" in the user message, this is a completely NEW task.
47
- Ignore any previous TODO completions in the conversation. The user wants something NEW done.
48
- You MUST create new TODOs (via create_todos) or provide a direct response (via respond_to_user) for this new request.
84
+ ### Rule 2: COMPLETE THE JOB, NOT A DEMO
85
+ **NEVER respond with POC, examples, or "here's how you could do it" unless explicitly asked.**
49
86
 
50
- 4. **Even if similar work was done before** - If the user asks for an action (even if similar to completed TODOs), you MUST create NEW TODOs.
51
- Previous completion does NOT mean the new request should be ignored.
87
+ WRONG: "Here's an example of how to implement login..."
88
+ RIGHT: Create TODOs to actually implement login in the user's project
52
89
 
53
- ## Guidelines
90
+ WRONG: "You could use this approach for deployment..."
91
+ ✅ RIGHT: Create TODOs to actually deploy the user's application
92
+
93
+ ### Rule 3: UNDERSTAND THE CONTEXT
94
+ Before creating TODOs, consider:
95
+ - What is the user's actual project/environment?
96
+ - What files and structure already exist?
97
+ - What is the end goal the user is trying to achieve?
98
+ - What would a human colleague do to complete this job?
99
+
100
+ ### Rule 4: NEW REQUEST HANDLING
101
+ When you see "[NEW REQUEST]" in the user message:
102
+ - This is a completely NEW task
103
+ - Ignore previous TODO completions
104
+ - Create fresh TODOs for this new request
105
+
106
+ ## GUIDELINES
107
+
108
+ ### For ask_to_user:
109
+ 1. **Ask specific questions** - Not "what do you want?" but "Which database: PostgreSQL or MongoDB?"
110
+ 2. **Provide clear options** - 2-4 distinct choices
111
+ 3. **Ask one thing at a time** - Multiple calls are fine
112
+ 4. **User's language** - Ask in the same language as the user
54
113
 
55
114
  ### For create_todos:
56
- 1. **1-5 high-level TODOs** - Even 1 TODO is fine! Don't be too granular, let Execution LLM handle details
57
- 2. **Actionable titles** - Clear what needs to be done
58
- 3. **Sequential order** - Execution order matters
59
- 4. **User's language** - Write titles in the same language as the user
115
+ 1. **1-5 high-level TODOs** - Let Execution LLM handle details
116
+ 2. **Complete the job** - Not POC or examples
117
+ 3. **Actionable titles** - Clear what needs to be done
118
+ 4. **Sequential order** - Execution order matters
119
+ 5. **User's language** - Write titles in the user's language
60
120
 
61
121
  ### For respond_to_user:
62
- 1. **Clear and helpful** - Answer the question directly
63
- 2. **User's language** - Write response in the same language as the user
64
- 3. **Concise but complete** - Provide enough information without being verbose
65
- 4. **Use examples** - If helpful for understanding
122
+ 1. **Only for pure knowledge** - No action required
123
+ 2. **User's language** - Respond in user's language
124
+ 3. **Concise but complete** - Don't be verbose
66
125
 
67
- ## Examples
126
+ ## EXAMPLES
68
127
 
69
- **respond_to_user (pure knowledge question):**
70
- User: "React hook이 뭐야?"
71
- → Use respond_to_user tool with response explaining React hooks (no action needed)
128
+ **ask_to_user (ambiguous request):**
129
+ User: "Add authentication"
130
+ → Use ask_to_user: "What type of authentication do you want?" with options: ["JWT token-based", "Session-based", "OAuth (Google/GitHub)", "Other"]
72
131
 
73
- **respond_to_user (greeting):**
74
- User: "안녕하세요!"
75
- → Use respond_to_user tool with a friendly greeting response
132
+ **ask_to_user (missing context):**
133
+ User: "Deploy this app"
134
+ → Use ask_to_user: "Where should I deploy?" with options: ["AWS EC2", "Vercel", "Docker container", "Other"]
76
135
 
77
- **create_todos (implementation task):**
78
- User: "로그인 기능 추가해줘"
79
- → Use create_todos: ["사용자 인증 컴포넌트 구현", "로그인 API 엔드포인트 연동", "세션 관리 로직 추가", "로그인 UI 테스트"]
136
+ **create_todos (clear request):**
137
+ User: "Add a forgot password link to the login page"
138
+ → Use create_todos: ["Find login page component", "Add forgot password link UI", "Connect to password reset page route"]
80
139
 
81
- **create_todos (debugging/investigation):**
82
- User: "왜 빌드가 실패하는지 확인해줘"
83
- → Use create_todos: ["빌드 에러 로그 확인", "문제 원인 분석 수정", "빌드 성공 확인"]
140
+ **create_todos (after clarification):**
141
+ User asked for auth → You clarified → User chose "JWT"
142
+ → Use create_todos: ["Implement JWT authentication middleware", "Create login/signup API endpoints", "Add token storage and refresh logic", "Apply middleware to protected routes"]
84
143
 
85
- **create_todos (exploration/research):**
86
- User: " 프로젝트 구조가 어떻게 되어있어?"
87
- → Use create_todos: ["프로젝트 폴더 구조 탐색", "주요 파일 및 모듈 분석", "구조 설명 작성"]
144
+ **respond_to_user (pure knowledge):**
145
+ User: "What's the difference between JWT and session authentication?"
146
+ → Use respond_to_user with explanation (no action needed)
88
147
 
89
- **create_todos (command execution):**
90
- User: "테스트 돌려봐"
91
- Use create_todos: ["테스트 실행", "실패한 테스트 확인 수정 (있을 경우)"]
92
-
93
- **create_todos (even after similar completion):**
94
- User: [Previous TODO: "build project" - completed]
95
- User: "branching.md에 따라 build하고 push"
96
- → Use create_todos: NEW tasks for this NEW request, don't assume already done
148
+ **WRONG vs RIGHT:**
149
+ User: "Write test code for this"
150
+ WRONG: respond_to_user with "Here's an example of how to write tests..."
151
+ ✅ RIGHT: ask_to_user "Which part should I write tests for?" or create_todos if context is clear
97
152
  `;
98
153
  export function buildPlanningSystemPrompt(toolSummary, optionalToolsInfo = '') {
99
154
  const toolSection = `
@@ -103,6 +158,8 @@ The Execution LLM has access to the following tools:
103
158
 
104
159
  ${toolSummary}
105
160
  ${optionalToolsInfo}
161
+
162
+ **Plan tasks that fully leverage these tools to deliver the most complete and professional results possible.**
106
163
  `;
107
164
  return PLANNING_BASE_PROMPT + toolSection;
108
165
  }
@@ -110,10 +167,13 @@ export const PLANNING_SYSTEM_PROMPT = PLANNING_BASE_PROMPT + `
110
167
  ## Available Tools for Execution LLM
111
168
 
112
169
  The Execution LLM has access to powerful tools including:
113
- - \`bash\` - Run any shell command (git, npm, python, curl, etc.)
170
+ - \`bash\` - Run ANY shell command (git, npm, python, docker, curl, etc.)
114
171
  - \`read_file\` / \`create_file\` / \`edit_file\` - Full file system access
115
172
  - \`list_files\` / \`find_files\` - Search and explore codebase
173
+ - \`tell_to_user\` - Communicate with user during execution
116
174
  - And more...
175
+
176
+ The Execution LLM can do almost anything a computer user can do on this system.
117
177
  `;
118
178
  export default PLANNING_SYSTEM_PROMPT;
119
179
  //# sourceMappingURL=planning.js.map