jiva-core 0.3.23 → 0.3.41-dev.fe6fe48

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 (134) hide show
  1. package/README.md +232 -570
  2. package/dist/code/agent.d.ts +105 -0
  3. package/dist/code/agent.d.ts.map +1 -0
  4. package/dist/code/agent.js +837 -0
  5. package/dist/code/agent.js.map +1 -0
  6. package/dist/code/file-lock.d.ts +15 -0
  7. package/dist/code/file-lock.d.ts.map +1 -0
  8. package/dist/code/file-lock.js +36 -0
  9. package/dist/code/file-lock.js.map +1 -0
  10. package/dist/code/lsp/client.d.ts +30 -0
  11. package/dist/code/lsp/client.d.ts.map +1 -0
  12. package/dist/code/lsp/client.js +181 -0
  13. package/dist/code/lsp/client.js.map +1 -0
  14. package/dist/code/lsp/language.d.ts +12 -0
  15. package/dist/code/lsp/language.d.ts.map +1 -0
  16. package/dist/code/lsp/language.js +145 -0
  17. package/dist/code/lsp/language.js.map +1 -0
  18. package/dist/code/lsp/manager.d.ts +39 -0
  19. package/dist/code/lsp/manager.d.ts.map +1 -0
  20. package/dist/code/lsp/manager.js +108 -0
  21. package/dist/code/lsp/manager.js.map +1 -0
  22. package/dist/code/lsp/server.d.ts +15 -0
  23. package/dist/code/lsp/server.d.ts.map +1 -0
  24. package/dist/code/lsp/server.js +78 -0
  25. package/dist/code/lsp/server.js.map +1 -0
  26. package/dist/code/tools/bash.d.ts +3 -0
  27. package/dist/code/tools/bash.d.ts.map +1 -0
  28. package/dist/code/tools/bash.js +110 -0
  29. package/dist/code/tools/bash.js.map +1 -0
  30. package/dist/code/tools/edit.d.ts +11 -0
  31. package/dist/code/tools/edit.d.ts.map +1 -0
  32. package/dist/code/tools/edit.js +459 -0
  33. package/dist/code/tools/edit.js.map +1 -0
  34. package/dist/code/tools/glob.d.ts +3 -0
  35. package/dist/code/tools/glob.d.ts.map +1 -0
  36. package/dist/code/tools/glob.js +62 -0
  37. package/dist/code/tools/glob.js.map +1 -0
  38. package/dist/code/tools/grep.d.ts +3 -0
  39. package/dist/code/tools/grep.d.ts.map +1 -0
  40. package/dist/code/tools/grep.js +147 -0
  41. package/dist/code/tools/grep.js.map +1 -0
  42. package/dist/code/tools/index.d.ts +31 -0
  43. package/dist/code/tools/index.d.ts.map +1 -0
  44. package/dist/code/tools/index.js +9 -0
  45. package/dist/code/tools/index.js.map +1 -0
  46. package/dist/code/tools/read.d.ts +3 -0
  47. package/dist/code/tools/read.d.ts.map +1 -0
  48. package/dist/code/tools/read.js +120 -0
  49. package/dist/code/tools/read.js.map +1 -0
  50. package/dist/code/tools/spawn.d.ts +3 -0
  51. package/dist/code/tools/spawn.d.ts.map +1 -0
  52. package/dist/code/tools/spawn.js +49 -0
  53. package/dist/code/tools/spawn.js.map +1 -0
  54. package/dist/code/tools/write.d.ts +3 -0
  55. package/dist/code/tools/write.d.ts.map +1 -0
  56. package/dist/code/tools/write.js +82 -0
  57. package/dist/code/tools/write.js.map +1 -0
  58. package/dist/core/agent-interface.d.ts +54 -0
  59. package/dist/core/agent-interface.d.ts.map +1 -0
  60. package/dist/core/agent-interface.js +8 -0
  61. package/dist/core/agent-interface.js.map +1 -0
  62. package/dist/core/agent-spawner.d.ts.map +1 -1
  63. package/dist/core/agent-spawner.js +3 -0
  64. package/dist/core/agent-spawner.js.map +1 -1
  65. package/dist/core/client-agent.d.ts +22 -2
  66. package/dist/core/client-agent.d.ts.map +1 -1
  67. package/dist/core/client-agent.js +145 -26
  68. package/dist/core/client-agent.js.map +1 -1
  69. package/dist/core/config.d.ts +144 -17
  70. package/dist/core/config.d.ts.map +1 -1
  71. package/dist/core/config.js +25 -1
  72. package/dist/core/config.js.map +1 -1
  73. package/dist/core/conversation-manager.d.ts +4 -1
  74. package/dist/core/conversation-manager.d.ts.map +1 -1
  75. package/dist/core/conversation-manager.js +47 -17
  76. package/dist/core/conversation-manager.js.map +1 -1
  77. package/dist/core/dual-agent.d.ts +18 -5
  78. package/dist/core/dual-agent.d.ts.map +1 -1
  79. package/dist/core/dual-agent.js +152 -59
  80. package/dist/core/dual-agent.js.map +1 -1
  81. package/dist/core/manager-agent.d.ts +38 -2
  82. package/dist/core/manager-agent.d.ts.map +1 -1
  83. package/dist/core/manager-agent.js +144 -23
  84. package/dist/core/manager-agent.js.map +1 -1
  85. package/dist/core/types/agent-context.d.ts +30 -0
  86. package/dist/core/types/agent-context.d.ts.map +1 -0
  87. package/dist/core/types/agent-context.js +8 -0
  88. package/dist/core/types/agent-context.js.map +1 -0
  89. package/dist/core/types/completion-signal.d.ts +17 -0
  90. package/dist/core/types/completion-signal.d.ts.map +1 -0
  91. package/dist/core/types/completion-signal.js +8 -0
  92. package/dist/core/types/completion-signal.js.map +1 -0
  93. package/dist/core/utils/serialize-agent-context.d.ts +23 -0
  94. package/dist/core/utils/serialize-agent-context.d.ts.map +1 -0
  95. package/dist/core/utils/serialize-agent-context.js +75 -0
  96. package/dist/core/utils/serialize-agent-context.js.map +1 -0
  97. package/dist/core/worker-agent.d.ts +14 -3
  98. package/dist/core/worker-agent.d.ts.map +1 -1
  99. package/dist/core/worker-agent.js +261 -68
  100. package/dist/core/worker-agent.js.map +1 -1
  101. package/dist/index.d.ts +6 -0
  102. package/dist/index.d.ts.map +1 -1
  103. package/dist/index.js +3 -0
  104. package/dist/index.js.map +1 -1
  105. package/dist/interfaces/cli/index.js +146 -25
  106. package/dist/interfaces/cli/index.js.map +1 -1
  107. package/dist/interfaces/cli/repl.d.ts +8 -2
  108. package/dist/interfaces/cli/repl.d.ts.map +1 -1
  109. package/dist/interfaces/cli/repl.js +39 -3
  110. package/dist/interfaces/cli/repl.js.map +1 -1
  111. package/dist/interfaces/cli/setup-wizard.d.ts.map +1 -1
  112. package/dist/interfaces/cli/setup-wizard.js +92 -0
  113. package/dist/interfaces/cli/setup-wizard.js.map +1 -1
  114. package/dist/interfaces/http/routes/chat.js +2 -2
  115. package/dist/interfaces/http/routes/chat.js.map +1 -1
  116. package/dist/interfaces/http/session-manager.d.ts +7 -4
  117. package/dist/interfaces/http/session-manager.d.ts.map +1 -1
  118. package/dist/interfaces/http/session-manager.js +56 -15
  119. package/dist/interfaces/http/session-manager.js.map +1 -1
  120. package/dist/models/base.d.ts +16 -1
  121. package/dist/models/base.d.ts.map +1 -1
  122. package/dist/models/harmony.d.ts +7 -1
  123. package/dist/models/harmony.d.ts.map +1 -1
  124. package/dist/models/harmony.js +21 -3
  125. package/dist/models/harmony.js.map +1 -1
  126. package/dist/models/krutrim.d.ts +31 -1
  127. package/dist/models/krutrim.d.ts.map +1 -1
  128. package/dist/models/krutrim.js +55 -11
  129. package/dist/models/krutrim.js.map +1 -1
  130. package/dist/models/orchestrator.d.ts +24 -0
  131. package/dist/models/orchestrator.d.ts.map +1 -1
  132. package/dist/models/orchestrator.js +40 -6
  133. package/dist/models/orchestrator.js.map +1 -1
  134. package/package.json +8 -6
@@ -1,15 +1,14 @@
1
1
  /**
2
- * Dual Agent System - Coordinates Manager, Worker, and Client agents
2
+ * Dual Agent System - Coordinates Manager and Worker agents
3
3
  *
4
- * Three-agent architecture:
5
- * - Manager: High-level planning and coordination
4
+ * Two-agent architecture:
5
+ * - Manager: High-level planning, review, and synthesis
6
6
  * - Worker: Task execution with tools
7
- * - Client: Adaptive validation and quality control
8
7
  */
9
8
  import { AgentSpawner } from './agent-spawner.js';
10
9
  import { ManagerAgent } from './manager-agent.js';
11
10
  import { WorkerAgent } from './worker-agent.js';
12
- import { ClientAgent } from './client-agent.js';
11
+ import { serializeAgentContext } from './utils/serialize-agent-context.js';
13
12
  import { logger } from '../utils/logger.js';
14
13
  import { orchestrationLogger } from '../utils/orchestration-logger.js';
15
14
  export class DualAgent {
@@ -21,7 +20,6 @@ export class DualAgent {
21
20
  agentSpawner = null;
22
21
  manager;
23
22
  worker;
24
- client;
25
23
  maxSubtasks;
26
24
  maxIterations;
27
25
  maxAgentDepth;
@@ -35,14 +33,13 @@ export class DualAgent {
35
33
  this.conversationManager = config.conversationManager || null;
36
34
  this.personaManager = config.personaManager || null;
37
35
  this.maxSubtasks = config.maxSubtasks || 10;
38
- this.maxIterations = config.maxIterations || 10;
36
+ this.maxIterations = config.maxIterations || 20;
39
37
  this.maxAgentDepth = config.maxAgentDepth ?? 1; // Default: only Manager can spawn
40
38
  this.autoSave = config.autoSave !== false;
41
39
  this.condensingThreshold = config.condensingThreshold || 30;
42
- // Initialize agents (three-agent architecture)
40
+ // Initialize agents (Manager + Worker architecture)
43
41
  this.manager = new ManagerAgent(this.orchestrator, this.workspace, this.personaManager || undefined);
44
42
  this.worker = new WorkerAgent(this.orchestrator, this.mcpManager, this.workspace, this.maxIterations, this.personaManager || undefined);
45
- this.client = new ClientAgent(this.orchestrator, this.mcpManager);
46
43
  // Initialize AgentSpawner - always available as a baseline tool
47
44
  // Create a PersonaManager if one wasn't provided
48
45
  let spawnerPersonaManager = this.personaManager;
@@ -58,7 +55,7 @@ export class DualAgent {
58
55
  currentDepth: 0,
59
56
  });
60
57
  this.worker.setAgentSpawner(this.agentSpawner);
61
- logger.info('[*] Three-agent system initialized (Manager + Worker + Client)');
58
+ logger.info('[*] Two-agent system initialized (Manager + Worker)');
62
59
  logger.info(`[*] Agent spawn depth limit: ${this.maxAgentDepth} (${this.maxAgentDepth === 1 ? 'only Manager can spawn' : `${this.maxAgentDepth} levels deep`})`);
63
60
  if (this.personaManager) {
64
61
  const activePersona = this.personaManager.getActivePersona();
@@ -67,6 +64,85 @@ export class DualAgent {
67
64
  }
68
65
  }
69
66
  }
67
+ /**
68
+ * Build a shared AgentContext for the current turn.
69
+ * Single source of truth: all three agents receive the same context object.
70
+ *
71
+ * Strategy:
72
+ * - Option A (primary): If ConversationManager is available, condense + last N messages.
73
+ * - Option B (fallback): Keep last N messages of all roles when ConversationManager is null.
74
+ */
75
+ buildAgentContext() {
76
+ // Fresh directive each turn
77
+ const directive = this.workspace.getDirectivePrompt() || undefined;
78
+ // Conversation history: include user + assistant + tool roles
79
+ const allRoleMessages = this.userConversationHistory.filter(m => m.role === 'user' || m.role === 'assistant' || m.role === 'tool');
80
+ // Option A uses summary from condensed history; Option B uses raw tail.
81
+ // After condensing (which happens before this call in chat()), the first
82
+ // system-role entry starting with "[Previous conversation summary]" serves
83
+ // as the summary.
84
+ let summary;
85
+ if (this.conversationManager) {
86
+ const summaryMsg = this.userConversationHistory.find(m => m.role === 'system' && typeof m.content === 'string' && m.content.startsWith('[Previous conversation summary]'));
87
+ if (summaryMsg && typeof summaryMsg.content === 'string') {
88
+ summary = summaryMsg.content;
89
+ }
90
+ }
91
+ // Pass the full conversation history — the conversation manager already
92
+ // condenses history (at condensingThreshold) before this is called, so
93
+ // no artificial slice is needed here. The 128k context window handles the rest.
94
+ const recentMessages = allRoleMessages;
95
+ // Persona context
96
+ let persona;
97
+ if (this.personaManager) {
98
+ const activePersona = this.personaManager.getActivePersona();
99
+ if (activePersona) {
100
+ persona = {
101
+ name: activePersona.manifest.name,
102
+ systemPromptAddition: this.personaManager.getSystemPromptAddition(),
103
+ validationContext: this.buildValidationContext(),
104
+ };
105
+ }
106
+ }
107
+ return {
108
+ workspaceDir: this.workspace.getWorkspaceDir(),
109
+ directive,
110
+ conversation: {
111
+ summary,
112
+ recentMessages,
113
+ },
114
+ persona,
115
+ };
116
+ }
117
+ /**
118
+ * Build validation-specific persona context for Client.
119
+ * Contains persona name/description + skill names + constraints but NOT
120
+ * the full execution persona block (avoids Client trying to direct execution).
121
+ */
122
+ buildValidationContext() {
123
+ if (!this.personaManager)
124
+ return undefined;
125
+ const activePersona = this.personaManager.getActivePersona();
126
+ if (!activePersona)
127
+ return undefined;
128
+ const skills = this.personaManager.getActiveSkills();
129
+ const skillLines = skills.map(s => {
130
+ let line = `- ${s.metadata.name}: ${s.metadata.description}`;
131
+ if (s.metadata.allowedTools && s.metadata.allowedTools.length > 0) {
132
+ line += `\n Allowed tools: ${s.metadata.allowedTools.join(', ')}`;
133
+ }
134
+ return line;
135
+ }).join('\n');
136
+ return `ACTIVE PERSONA: ${activePersona.manifest.name} — ${activePersona.manifest.description}
137
+
138
+ SKILLS AVAILABLE TO WORKER:
139
+ ${skillLines || '(no skills registered)'}
140
+
141
+ VALIDATION GUIDANCE:
142
+ - Worker is expected to use skills above when relevant to the user's request.
143
+ - Validate that Worker's tool usage is consistent with the skills it was expected to apply.
144
+ - Validate that any mandatory steps or safety constraints defined above were followed.`;
145
+ }
70
146
  /**
71
147
  * Process user message using dual-agent architecture
72
148
  */
@@ -85,6 +161,8 @@ export class DualAgent {
85
161
  role: 'user',
86
162
  content: userMessage,
87
163
  });
164
+ // Build shared context ONCE per turn (single source of truth)
165
+ const agentContext = this.buildAgentContext();
88
166
  const allToolsUsed = [];
89
167
  let totalIterations = 0;
90
168
  // PHASE 1: Manager creates plan
@@ -94,52 +172,71 @@ export class DualAgent {
94
172
  orchestrationLogger.logPhaseStart('PLANNING');
95
173
  const plan = await this.manager.createPlan({
96
174
  userRequest: userMessage,
97
- context: this.getRecentContext(),
98
- });
175
+ context: serializeAgentContext(agentContext, 'manager'),
176
+ }, agentContext);
99
177
  orchestrationLogger.logPhaseEnd('PLANNING', Date.now() - phaseStartTime);
100
- // PHASE 2: Execute subtasks
178
+ // Conversational short-circuit: skip execution entirely for greetings, thank-yous, etc.
179
+ if (plan.conversational) {
180
+ logger.info('[DualAgent] Conversational message — returning direct reply');
181
+ const directReply = await this.manager.directReply(this.userConversationHistory, agentContext);
182
+ this.userConversationHistory.push({ role: 'assistant', content: directReply });
183
+ if (this.autoSave && this.conversationManager) {
184
+ await this.conversationManager.autoSave(this.userConversationHistory, this.workspace.getWorkspaceDir(), this.orchestrator);
185
+ }
186
+ logger.info('\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
187
+ logger.info('[+] Complete: 1 iteration, 0 tools used (conversational)');
188
+ logger.info('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n');
189
+ return {
190
+ content: directReply,
191
+ iterations: 1,
192
+ toolsUsed: [],
193
+ plan: { subtasks: [], reasoning: plan.reasoning },
194
+ };
195
+ }
196
+ // PHASE 2: Execute subtasks with per-subtask retry budget
101
197
  logger.info('\n[PHASE 2: Execution]');
102
198
  logger.info('─────────────────────────────────────────');
103
199
  const executionStartTime = Date.now();
104
200
  orchestrationLogger.logPhaseStart('EXECUTION');
105
201
  const results = [];
106
202
  const subtasksToExecute = plan.subtasks.slice(0, this.maxSubtasks);
203
+ // Max 1 retry per original subtask — keyed by original subtask text (not correction text)
204
+ const MAX_RETRIES_PER_SUBTASK = 1;
205
+ const subtaskRetryCounts = new Map();
107
206
  for (let i = 0; i < subtasksToExecute.length; i++) {
108
207
  const subtask = subtasksToExecute[i];
109
208
  logger.info(`\n[Subtask ${i + 1}/${subtasksToExecute.length}] ${subtask}`);
110
- // Worker executes subtask
209
+ // Worker executes subtask with shared context
111
210
  const workerResult = await this.worker.executeSubtask({
112
211
  instruction: subtask,
113
- context: this.getRecentContext(),
114
- });
212
+ context: serializeAgentContext(agentContext, 'worker'),
213
+ }, agentContext);
115
214
  totalIterations += 1;
116
215
  allToolsUsed.push(...workerResult.toolsUsed);
216
+ // Manager reviews Worker's result — fast-path for common cases, LLM only for edge cases
217
+ const review = await this.manager.reviewSubtaskResult(subtask, workerResult, userMessage);
117
218
  results.push({
118
219
  subtask,
119
220
  result: workerResult.result,
221
+ accepted: review.accepted,
120
222
  });
121
- // Client validates Worker's result (adaptive involvement)
122
- const validation = await this.client.validate(userMessage, plan.subtasks, workerResult);
123
- if (!validation.approved && validation.nextAction) {
124
- logger.info(`[Client] Validation failed: ${validation.issues.join(', ')}`);
125
- logger.info(`[Client] Requesting correction: ${validation.nextAction}`);
126
- // Deduplicate correction subtasks - don't add the same correction twice
127
- const normalizedCorrection = validation.nextAction.toLowerCase().trim();
128
- const isDuplicate = subtasksToExecute.some(existing => existing.toLowerCase().trim() === normalizedCorrection) || results.some(r => r.subtask.toLowerCase().trim() === normalizedCorrection);
129
- // Add correction subtask (but don't exceed maxSubtasks and avoid duplicates)
130
- if (isDuplicate) {
131
- logger.warn(`[Client] Skipping duplicate correction subtask`);
132
- }
133
- else if (subtasksToExecute.length < this.maxSubtasks) {
134
- subtasksToExecute.push(validation.nextAction);
135
- logger.info(`[Client] Added correction subtask (${subtasksToExecute.length} total)`);
223
+ if (!review.accepted && review.specificCorrection) {
224
+ // Determine the original subtask key for retry counting.
225
+ // Correction subtasks always start fresh — map them back to the original via
226
+ // their position in the queue vs the original plan length.
227
+ const originalSubtask = plan.subtasks[Math.min(i, plan.subtasks.length - 1)] || subtask;
228
+ const retryCount = subtaskRetryCounts.get(originalSubtask) || 0;
229
+ if (retryCount < MAX_RETRIES_PER_SUBTASK && subtasksToExecute.length < this.maxSubtasks) {
230
+ subtasksToExecute.splice(i + 1, 0, review.specificCorrection);
231
+ subtaskRetryCounts.set(originalSubtask, retryCount + 1);
232
+ logger.info(`[DualAgent] Inserted targeted retry at position ${i + 2} (retry ${retryCount + 1}/${MAX_RETRIES_PER_SUBTASK})`);
136
233
  }
137
234
  else {
138
- logger.warn(`[Client] Cannot add correction - maxSubtasks (${this.maxSubtasks}) reached`);
235
+ logger.warn(`[DualAgent] Retry budget exhausted or queue full — accepting partial result`);
139
236
  }
140
237
  }
141
- else if (validation.approved) {
142
- logger.info(`[Client] Validation passed (${validation.involvementLevel} level)`);
238
+ else {
239
+ logger.info(`[Manager] Subtask accepted`);
143
240
  }
144
241
  }
145
242
  orchestrationLogger.logPhaseEnd('EXECUTION', Date.now() - executionStartTime);
@@ -148,7 +245,7 @@ export class DualAgent {
148
245
  logger.info('─────────────────────────────────────────');
149
246
  const synthesisStartTime = Date.now();
150
247
  orchestrationLogger.logPhaseStart('SYNTHESIS');
151
- const finalResponse = await this.synthesizeResponse(plan, results);
248
+ const finalResponse = await this.synthesizeResponse(plan, results, agentContext);
152
249
  totalIterations += 1;
153
250
  orchestrationLogger.logPhaseEnd('SYNTHESIS', Date.now() - synthesisStartTime);
154
251
  // Add assistant response to user conversation history
@@ -174,33 +271,26 @@ export class DualAgent {
174
271
  },
175
272
  };
176
273
  }
177
- async synthesizeResponse(plan, results) {
178
- // If only one subtask and it's a short success message, return directly
179
- // But ALWAYS synthesize if result indicates failure or incomplete work
180
- if (results.length === 1 && results[0].result.length < 500) {
181
- const result = results[0].result;
182
- // Check if this is a failure/incomplete message
183
- const isFailure = result.includes('could not be completed') ||
184
- result.includes('failed') ||
185
- result.includes('error') ||
186
- result.toLowerCase().includes('unable to');
187
- // If it's a failure, always let Manager synthesize to provide proper context
188
- if (isFailure) {
189
- logger.info('[DualAgent] Result indicates failure, invoking Manager synthesis');
190
- return await this.manager.synthesizeResponse(results);
191
- }
192
- // Otherwise, short successful result can be returned directly
193
- return result;
194
- }
195
- // Multiple subtasks or long result - ask Manager to synthesize
196
- return await this.manager.synthesizeResponse(results);
274
+ async synthesizeResponse(plan, results, agentContext) {
275
+ // Always have the Manager synthesize a final response.
276
+ //
277
+ // The previous short-circuit (returning Worker's raw result when it was a
278
+ // single short subtask) caused the user to see Worker-internal operational
279
+ // strings like "Task work completed (1 operations performed). Max iterations
280
+ // reached but all tool operations succeeded." as their final answer. The
281
+ // Manager synthesis step is cheap (one LLM call) and guarantees the user
282
+ // always receives a properly formatted, contextually accurate response.
283
+ return await this.manager.synthesizeResponse(results, agentContext);
197
284
  }
198
285
  getRecentContext() {
199
- // Get last few user messages for context
286
+ // Include user + assistant + tool messages for full context
200
287
  const recent = this.userConversationHistory
201
- .filter(m => m.role === 'user')
202
- .slice(-3)
203
- .map(m => m.content)
288
+ .filter(m => m.role === 'user' || m.role === 'assistant' || m.role === 'tool')
289
+ .slice(-6)
290
+ .map(m => {
291
+ const content = typeof m.content === 'string' ? m.content : JSON.stringify(m.content);
292
+ return `[${m.role.toUpperCase()}]: ${content}`;
293
+ })
204
294
  .join('\n');
205
295
  return recent || '';
206
296
  }
@@ -216,6 +306,9 @@ export class DualAgent {
216
306
  resetConversation() {
217
307
  this.userConversationHistory = [];
218
308
  this.manager.resetConversation();
309
+ // Null out the conversation ID so the next autoSave generates a fresh file
310
+ // rather than continuing to append to the previous conversation's storage entry.
311
+ this.conversationManager?.setCurrentConversationId(null);
219
312
  logger.info('[*] Conversation reset');
220
313
  }
221
314
  getConversationHistory() {
@@ -1 +1 @@
1
- {"version":3,"file":"dual-agent.js","sourceRoot":"","sources":["../../src/core/dual-agent.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AA0BvE,MAAM,OAAO,SAAS;IACZ,YAAY,CAAoB;IAChC,UAAU,CAAmB;IAC7B,SAAS,CAAmB;IAC5B,mBAAmB,CAA6B;IAChD,cAAc,CAAwB;IACtC,YAAY,GAAwB,IAAI,CAAC;IAEzC,OAAO,CAAe;IACtB,MAAM,CAAc;IACpB,MAAM,CAAc;IAEpB,WAAW,CAAS;IACpB,aAAa,CAAS;IACtB,aAAa,CAAS;IACtB,QAAQ,CAAU;IAClB,mBAAmB,CAAS;IAE5B,uBAAuB,GAAc,EAAE,CAAC;IAEhD,YAAY,MAAuB;QACjC,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;QACxC,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;QACpC,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QAClC,IAAI,CAAC,mBAAmB,GAAG,MAAM,CAAC,mBAAmB,IAAI,IAAI,CAAC;QAC9D,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,IAAI,IAAI,CAAC;QAEpD,IAAI,CAAC,WAAW,G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C,iBAAiB;QACrB,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;QAC1D,CAAC;QAED,OAAO,MAAM,IAAI,CAAC,mBAAmB,CAAC,iBAAiB,EAAE,CAAC;IAC5D,CAAC;CACF"}
@@ -12,6 +12,8 @@
12
12
  import { ModelOrchestrator } from '../models/orchestrator.js';
13
13
  import { WorkspaceManager } from './workspace.js';
14
14
  import { PersonaManager } from '../personas/persona-manager.js';
15
+ import { AgentContext } from './types/agent-context.js';
16
+ import { WorkerResult } from './worker-agent.js';
15
17
  import { Message } from '../models/base.js';
16
18
  export interface ManagerTask {
17
19
  userRequest: string;
@@ -20,6 +22,8 @@ export interface ManagerTask {
20
22
  export interface ManagerPlan {
21
23
  subtasks: string[];
22
24
  reasoning: string;
25
+ /** True when the user's message is purely conversational — no task execution needed. */
26
+ conversational?: boolean;
23
27
  }
24
28
  export interface ManagerDecision {
25
29
  isComplete: boolean;
@@ -33,21 +37,51 @@ export declare class ManagerAgent {
33
37
  private conversationHistory;
34
38
  constructor(orchestrator: ModelOrchestrator, workspace: WorkspaceManager, personaManager?: PersonaManager);
35
39
  private initializeSystemPrompt;
40
+ /**
41
+ * Get system messages with fresh directive + optional AgentContext.
42
+ * Follows the per-call directive injection pattern from JivaAgent.getSystemMessages().
43
+ */
44
+ private getSystemMessages;
36
45
  /**
37
46
  * Create a plan for handling the user's request
38
47
  */
39
- createPlan(task: ManagerTask): Promise<ManagerPlan>;
48
+ createPlan(task: ManagerTask, agentContext?: AgentContext): Promise<ManagerPlan>;
40
49
  /**
41
50
  * Review Worker's results and decide next action
42
51
  */
43
52
  reviewResults(subtask: string, workerResult: string): Promise<ManagerDecision>;
53
+ /**
54
+ * Review a Worker's subtask result and decide whether to accept it or request a retry.
55
+ *
56
+ * Rules (fast-path first — avoids an LLM call for the common case):
57
+ * - AUTO-ACCEPT: tools were used AND the result is substantive (>100 chars)
58
+ * - AUTO-REJECT: no tools were used at all (pure hallucination / text-only response)
59
+ * - LLM REVIEW: tools were used but result is suspiciously short (<100 chars)
60
+ *
61
+ * Returns { accepted: true } or { accepted: false, specificCorrection: "…" }.
62
+ * The specificCorrection is a clean, targeted instruction — NOT a stacked prefix.
63
+ */
64
+ reviewSubtaskResult(subtask: string, workerResult: WorkerResult, originalRequest: string): Promise<{
65
+ accepted: boolean;
66
+ specificCorrection?: string;
67
+ }>;
44
68
  /**
45
69
  * Create final response for user
46
70
  */
47
71
  synthesizeResponse(allResults: {
48
72
  subtask: string;
49
73
  result: string;
50
- }[]): Promise<string>;
74
+ accepted?: boolean;
75
+ }[], agentContext?: AgentContext): Promise<string>;
76
+ /**
77
+ * Respond directly to a conversational message — no planning or tool execution.
78
+ * Used when `createPlan()` signals `conversational: true`.
79
+ *
80
+ * @param userConversationHistory - The full user-facing conversation so far
81
+ * (already includes the current user message at the tail).
82
+ * @param agentContext - Current agent context for directive injection.
83
+ */
84
+ directReply(userConversationHistory: Message[], agentContext?: AgentContext): Promise<string>;
51
85
  /**
52
86
  * Parse a JSON plan from LLM output. Extracts the first JSON object found.
53
87
  */
@@ -59,6 +93,8 @@ export declare class ManagerAgent {
59
93
  /**
60
94
  * Validate that each subtask is a reasonable, actionable instruction.
61
95
  * Removes garbage entries like separators, prose fragments, or empty strings.
96
+ *
97
+ * @param isConversational - When true, allow an empty list (no min-1 enforcement).
62
98
  */
63
99
  private validateSubtasks;
64
100
  private extractSection;
@@ -1 +1 @@
1
- {"version":3,"file":"manager-agent.d.ts","sourceRoot":"","sources":["../../src/core/manager-agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAm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