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
@@ -18,7 +18,7 @@ export class WorkerAgent {
18
18
  agentSpawner;
19
19
  maxIterations;
20
20
  contextMemory;
21
- constructor(orchestrator, mcpManager, workspace, maxIterations = 5, personaManager) {
21
+ constructor(orchestrator, mcpManager, workspace, maxIterations = 20, personaManager) {
22
22
  this.orchestrator = orchestrator;
23
23
  this.mcpManager = mcpManager;
24
24
  this.workspace = workspace;
@@ -45,7 +45,7 @@ export class WorkerAgent {
45
45
  /**
46
46
  * Execute a subtask assigned by Manager
47
47
  */
48
- async executeSubtask(subtask) {
48
+ async executeSubtask(subtask, agentContext) {
49
49
  logger.info(`[Worker] Starting: "${subtask.instruction}"`);
50
50
  orchestrationLogger.logWorkerStart(subtask.instruction, subtask.context || '');
51
51
  // Reset context memory for new subtask
@@ -55,7 +55,41 @@ export class WorkerAgent {
55
55
  };
56
56
  const conversationHistory = [];
57
57
  const toolsUsed = [];
58
+ // Tracks every exact tool-call signature (toolName + serialized args) executed
59
+ // during this subtask. Used to prevent the same call from being repeated in a
60
+ // later iteration — e.g. reading the same file twice in consecutive turns.
61
+ const executedToolSignatures = new Set();
62
+ // Tracks consecutive failures per (toolName:args) signature.
63
+ // Drives the per-tool circuit breaker: warn at 2, hard-stop at 3.
64
+ const toolFailureCounts = new Map();
58
65
  let iterationCount = 0;
66
+ // ── 2+2 API-level JSON parse failure strategy ─────────────────────────────
67
+ // Priority: if a dedicated tool-calling LLM is configured, use it from the
68
+ // very first iteration (it reliably serialises tool args as standard JSON).
69
+ // The reasoning model then serves as the phase-2 fallback.
70
+ // If no tool-calling model is configured the roles are reversed: reasoning
71
+ // model is phase 1 and there is no phase-2 fallback.
72
+ //
73
+ // Flow when tool-calling model IS configured:
74
+ // Phase 1 – tool-calling model (up to API_PARSE_FAIL_THRESHOLD=2 failures)
75
+ // Phase 2 – reasoning model (up to SECONDARY_MODEL_ATTEMPTS=2 failures)
76
+ // → hard-stop after 4 total failures; failedTools is non-empty so the
77
+ // Client's data-driven CompletionSignal fires (prevents infinite retries)
78
+ //
79
+ // Flow when NO tool-calling model is configured:
80
+ // Phase 1 – reasoning model (up to API_PARSE_FAIL_THRESHOLD=2 failures)
81
+ // → hard-stop immediately (no secondary model available)
82
+ const API_PARSE_FAIL_THRESHOLD = 2; // phase-1 failures before switching phases
83
+ const SECONDARY_MODEL_ATTEMPTS = 2; // extra attempts on the phase-2 model
84
+ let apiJsonParseFailures = 0; // total JSON-parse failures so far
85
+ // toolCallingIsMain: true when the tool-calling model is the primary model for this run
86
+ const toolCallingIsMain = this.orchestrator.hasToolCallingModel();
87
+ // useToolCallingFallback: flag passed to orchestrator.chatWithFallback()
88
+ // true → use the tool-calling model
89
+ // false → use the reasoning model
90
+ let useToolCallingFallback = toolCallingIsMain; // start with tool-calling model if available
91
+ let phaseSwitched = false; // true once we have swapped phases
92
+ const API_JSON_PARSE_FAILURE_SIG = 'api_json_parse:{}'; // key in toolFailureCounts
59
93
  // Build system prompt for Worker
60
94
  const personaPrompt = this.personaManager?.getSystemPromptAddition() || '';
61
95
  let systemContent = `You are the Worker Agent in a two-agent system.
@@ -114,12 +148,18 @@ Available tools: ${this.mcpManager.getClient().getAllTools().map(t => t.name).jo
114
148
  * persona (required): Persona name - ${availablePersonas.join(', ')}
115
149
  * task (required): Specific task for the sub-agent
116
150
  * context (optional): Additional domain-specific context (workspace path is automatically included)
151
+ - IMPORTANT: When spawning a sub-agent, include relevant directive constraints and a brief conversation summary in the context parameter so the sub-agent has sufficient background.
117
152
  - Example: spawn_agent({ persona: "code-reviewer", task: "Review the authentication code in src/auth/", context: "Focus on security vulnerabilities and best practices" })
118
153
  - The sub-agent will complete the task and return results to you`;
119
154
  }
120
155
  if (personaPrompt) {
121
156
  systemContent += `\n\n${personaPrompt}`;
122
157
  }
158
+ // Inject directive into Worker prompt (fixes bug: Worker previously had no directive)
159
+ const directivePrompt = agentContext?.directive || this.workspace.getDirectivePrompt() || '';
160
+ if (directivePrompt) {
161
+ systemContent += `\n\n${directivePrompt}`;
162
+ }
123
163
  // System prompt for Worker
124
164
  // Use 'developer' role for Harmony format compatibility (will be converted to 'system' by model)
125
165
  conversationHistory.push({
@@ -184,23 +224,114 @@ Please complete this subtask and report your findings.`,
184
224
  }
185
225
  let response;
186
226
  try {
187
- response = await this.orchestrator.chat({
227
+ response = await this.orchestrator.chatWithFallback({
188
228
  messages: conversationHistory,
189
229
  tools: tools.length > 0 ? tools : undefined,
190
230
  temperature: 0.1, // Low temperature for deterministic tool execution
191
- });
231
+ }, useToolCallingFallback);
192
232
  }
193
233
  catch (error) {
194
234
  // API error (e.g., invalid tool call parameters)
195
235
  const errorMsg = error instanceof Error ? error.message : String(error);
196
236
  logger.warn(` [Worker] API error - ${errorMsg.substring(0, 100)}...`);
197
- // Check if we've used up our retries
237
+ // Detect the specific "Failed to parse tool call arguments as JSON" pattern.
238
+ // These 400 errors originate from the model generating malformed JSON for
239
+ // tool call arguments (e.g. large content with special Unicode characters).
240
+ // A generic "retry with error feedback" loop cannot fix this — the same model
241
+ // will keep producing the same malformed output. We need a different approach.
242
+ const isJsonParseError = errorMsg.includes('Failed to parse tool call arguments as JSON') ||
243
+ errorMsg.includes('tool_use_failed');
244
+ if (isJsonParseError) {
245
+ apiJsonParseFailures++;
246
+ // Record in toolFailureCounts so failedTools is always non-empty on exit.
247
+ // This ensures the Client's data-driven CompletionSignal fires (strategy=escalate)
248
+ // rather than the LLM-based path that would return strategy=retry, causing an
249
+ // infinite correction-subtask loop.
250
+ toolFailureCounts.set(API_JSON_PARSE_FAILURE_SIG, {
251
+ count: apiJsonParseFailures,
252
+ lastError: errorMsg,
253
+ });
254
+ const totalBudget = API_PARSE_FAIL_THRESHOLD + SECONDARY_MODEL_ATTEMPTS;
255
+ if (!phaseSwitched && apiJsonParseFailures >= API_PARSE_FAIL_THRESHOLD) {
256
+ // Phase 1 exhausted — attempt a phase switch
257
+ phaseSwitched = true;
258
+ if (toolCallingIsMain) {
259
+ // Tool-calling model (primary) failed → fall back to reasoning model
260
+ useToolCallingFallback = false;
261
+ logger.warn(` [Worker] Tool-calling model failed JSON tool-call serialisation ` +
262
+ `${apiJsonParseFailures} time(s) — switching to reasoning model for ` +
263
+ `up to ${SECONDARY_MODEL_ATTEMPTS} more attempt(s)`);
264
+ conversationHistory.push({
265
+ role: 'user',
266
+ content: `NOTE: The previous model had trouble formatting its tool call as valid JSON. ` +
267
+ `A different model is now being used. Please re-attempt the task — ` +
268
+ `use the same tools but ensure all argument values are valid JSON ` +
269
+ `(avoid raw special characters inside string values; escape them if needed).`,
270
+ });
271
+ continue; // retry with reasoning model
272
+ }
273
+ else if (this.orchestrator.hasToolCallingModel()) {
274
+ // Reasoning model (primary) failed → switch to tool-calling model
275
+ useToolCallingFallback = true;
276
+ logger.warn(` [Worker] Reasoning model failed JSON tool-call serialisation ` +
277
+ `${apiJsonParseFailures} time(s) — switching to tool-calling LLM for ` +
278
+ `up to ${SECONDARY_MODEL_ATTEMPTS} more attempt(s)`);
279
+ conversationHistory.push({
280
+ role: 'user',
281
+ content: `NOTE: The previous model had trouble formatting its tool call as valid JSON. ` +
282
+ `A different model is now being used. Please re-attempt the task — ` +
283
+ `use the same tools but ensure all argument values are valid JSON ` +
284
+ `(avoid raw special characters inside string values; escape them if needed).`,
285
+ });
286
+ continue; // retry with fallback model active
287
+ }
288
+ else {
289
+ // No secondary model configured — hard-stop immediately
290
+ logger.error(` [Worker] JSON serialisation failure — no secondary model configured. ` +
291
+ `Hard-stopping after ${apiJsonParseFailures} attempt(s).`);
292
+ finalResult =
293
+ `Task failed: The reasoning model could not generate valid tool-call JSON ` +
294
+ `after ${apiJsonParseFailures} attempt(s). ` +
295
+ `Error: ${errorMsg}. ` +
296
+ `Tip: configure a tool-calling LLM in Jiva settings to enable automatic fallback.`;
297
+ break;
298
+ }
299
+ }
300
+ else if (apiJsonParseFailures >= totalBudget) {
301
+ // Phase 2 also exhausted — hard-stop
302
+ const primaryLabel = toolCallingIsMain ? 'tool-calling' : 'reasoning';
303
+ const secondaryLabel = toolCallingIsMain ? 'reasoning' : 'tool-calling';
304
+ logger.error(` [Worker] Both ${primaryLabel} and ${secondaryLabel} models failed JSON serialisation. ` +
305
+ `Hard-stopping after ${apiJsonParseFailures} total attempt(s).`);
306
+ finalResult =
307
+ `Task failed: Both the ${primaryLabel} model and the ${secondaryLabel} fallback model ` +
308
+ `could not generate valid tool-call JSON after ${apiJsonParseFailures} total attempt(s). ` +
309
+ `Error: ${errorMsg}.`;
310
+ break;
311
+ }
312
+ // Still within budget — add informative error and let the (possibly switched) model retry
313
+ logger.info(` [Worker] JSON parse failure ${apiJsonParseFailures}/${totalBudget} — ` +
314
+ `retrying with ${useToolCallingFallback ? 'tool-calling model' : 'reasoning model'} ` +
315
+ `(attempt ${iteration + 2}/${this.maxIterations})`);
316
+ conversationHistory.push({
317
+ role: 'user',
318
+ content: `ERROR: The model produced a tool call with invalid JSON arguments.\n` +
319
+ `Specific error: ${errorMsg}\n\n` +
320
+ `This usually happens with large file content containing special characters. ` +
321
+ `To fix this:\n` +
322
+ `1. Escape all special characters in string values (\\n, \\t, \\\\, etc.)\n` +
323
+ `2. Wrap Unicode symbols as plain ASCII equivalents (e.g. use [ ] instead of ☐)\n` +
324
+ `3. If the content is very long, write it to the file in smaller chunks\n` +
325
+ `Please retry the tool call with corrected arguments.`,
326
+ });
327
+ continue;
328
+ }
329
+ // Non-JSON-parse API error — regular retry with error feedback
198
330
  if (iteration >= this.maxIterations - 1) {
199
331
  logger.error(` [Worker] Max retries reached after API errors`);
200
332
  finalResult = `Failed to complete subtask due to repeated errors: ${errorMsg}`;
201
333
  break;
202
334
  }
203
- // Add error feedback to conversation so Worker can correct itself
204
335
  logger.info(` [Worker] Retrying with error feedback (attempt ${iteration + 2}/${this.maxIterations})`);
205
336
  conversationHistory.push({
206
337
  role: 'user',
@@ -215,37 +346,41 @@ Please complete this subtask and report your findings.`,
215
346
  // Check for tool calls
216
347
  if (response.toolCalls && response.toolCalls.length > 0) {
217
348
  logger.info(` [Worker] Using ${response.toolCalls.length} tool(s)`);
218
- // Detect repetitive tool calls BEFORE executing
349
+ // Detect repetitive tool calls BEFORE executing.
350
+ // Only block exact-same (tool + args) duplicates — calling the same tool
351
+ // with DIFFERENT arguments (e.g. yfinance_get_ticker_info for MSFT then NVDA)
352
+ // is intentional and must NOT be blocked.
219
353
  const proposedTools = response.toolCalls.map(tc => {
220
354
  const args = JSON.parse(tc.function.arguments);
221
355
  return `${tc.function.name}:${JSON.stringify(args)}`;
222
356
  });
223
- // Check if we're about to repeat the same tool call
224
- const lastToolCalls = toolsUsed.slice(-2);
225
- const isRepetitive = proposedTools.some(proposed => {
226
- const toolName = proposed.split(':')[0];
227
- return lastToolCalls.filter(t => t === toolName).length >= 2;
228
- });
229
- if (isRepetitive && iteration >= 2) {
357
+ const exactDuplicate = proposedTools.some(sig => executedToolSignatures.has(sig));
358
+ if (exactDuplicate) {
359
+ const dupSig = proposedTools.find(sig => executedToolSignatures.has(sig)) || '';
360
+ const dupToolName = dupSig.split(':')[0];
230
361
  logger.warn(` [Worker] Detected repetitive tool usage - interrupting loop`);
231
362
  conversationHistory.push({
232
363
  role: 'user',
233
- content: `STOP: You are repeating the same action multiple times. This tool has already succeeded.
234
-
235
- For browser tasks:
236
- 1. You already created a new tab - do NOT create another one
237
- 2. Now use playwright__browser_navigate to go to the actual URL
238
- 3. If navigation is already done, the task is COMPLETE - just provide your summary
364
+ content: `STOP: You already called \`${dupToolName}\` with these exact arguments in a previous step. Do NOT repeat the same call.
239
365
 
240
- Do NOT call the same tool again. Either move to the NEXT required step, or if the task is complete, provide your final summary WITHOUT any tool calls.`,
366
+ You have two choices:
367
+ 1. If more work remains (e.g. other symbols, other queries), call the tool with DIFFERENT arguments now.
368
+ 2. If all required work is genuinely complete, respond with a thorough description of everything accomplished — do NOT call any more tools.`,
241
369
  });
242
370
  continue; // Skip executing the repetitive tools, let model reconsider
243
371
  }
244
372
  for (const toolCall of response.toolCalls) {
245
373
  const toolName = toolCall.function.name;
246
374
  logger.info(` [Worker] Tool: ${toolName}`);
375
+ // Parse args outside the try block so the catch block can reference
376
+ // them for the failure signature (circuit breaker key).
377
+ let args = {};
378
+ try {
379
+ args = JSON.parse(toolCall.function.arguments);
380
+ }
381
+ catch { /* use empty */ }
382
+ const failureSig = `${toolName}:${JSON.stringify(args)}`;
247
383
  try {
248
- const args = JSON.parse(toolCall.function.arguments);
249
384
  orchestrationLogger.logWorkerToolCall(toolName, args);
250
385
  // Handle spawn_agent specially
251
386
  if (toolName === 'spawn_agent') {
@@ -260,6 +395,7 @@ Do NOT call the same tool again. Either move to the NEXT required step, or if th
260
395
  maxIterations: args.maxIterations,
261
396
  });
262
397
  toolsUsed.push(toolName);
398
+ executedToolSignatures.add(`${toolName}:${JSON.stringify(args)}`);
263
399
  const resultText = `Sub-agent spawned with persona '${spawnResult.persona}' completed the task.
264
400
 
265
401
  RESULT:
@@ -276,6 +412,7 @@ Tools used: ${spawnResult.toolsUsed.join(', ')}`;
276
412
  // Regular MCP tool execution
277
413
  const result = await this.mcpManager.getClient().executeTool(toolName, args);
278
414
  toolsUsed.push(toolName);
415
+ executedToolSignatures.add(`${toolName}:${JSON.stringify(args)}`);
279
416
  // Check if tool returned images (multimodal support)
280
417
  let toolResultText;
281
418
  let hasImages = false;
@@ -297,14 +434,38 @@ Tools used: ${spawnResult.toolsUsed.join(', ')}`;
297
434
  logger.debug(` ✓ [Worker] Tool ${toolName} completed`);
298
435
  }
299
436
  catch (error) {
437
+ const errorMsg = error instanceof Error ? error.message : String(error);
300
438
  logger.error(` ✗ [Worker] Tool ${toolName} failed:`, error);
301
439
  orchestrationLogger.logWorkerToolResult(toolName, false, false);
440
+ // Always push the raw tool error so the LLM sees what happened
302
441
  conversationHistory.push({
303
442
  role: 'tool',
304
443
  name: toolName,
305
444
  tool_call_id: toolCall.id,
306
- content: `Error: ${error instanceof Error ? error.message : String(error)}`,
445
+ content: `Error: ${errorMsg}`,
307
446
  });
447
+ // Per-tool circuit breaker: track failure count by exact (tool, args) signature
448
+ const prev = toolFailureCounts.get(failureSig) || { count: 0, lastError: '' };
449
+ const newCount = prev.count + 1;
450
+ toolFailureCounts.set(failureSig, { count: newCount, lastError: errorMsg });
451
+ if (newCount === 2) {
452
+ // Second failure: explicit warning to the LLM to change approach
453
+ conversationHistory.push({
454
+ role: 'user',
455
+ content: `WARNING: Tool \`${toolName}\` has now failed twice with the same arguments.\nError: ${errorMsg}\n\nDo NOT call this tool with the same arguments again. Try a different approach, different arguments, or a completely different tool to achieve the same goal.`,
456
+ });
457
+ logger.warn(` [Worker] Tool ${toolName} has failed twice — warning injected`);
458
+ }
459
+ else if (newCount >= 3) {
460
+ // Third failure: hard stop — block the tool and force honest exit
461
+ // Add to executedToolSignatures so the exact-dedup guard prevents further calls
462
+ executedToolSignatures.add(failureSig);
463
+ conversationHistory.push({
464
+ role: 'user',
465
+ content: `HARD STOP: Tool \`${toolName}\` has failed ${newCount} times and will NOT succeed with these arguments.\nFinal error: ${errorMsg}\n\nYou MUST stop attempting this tool. Respond now with an honest report of what you tried and why it failed. Do not call any more tools — just describe the failure clearly so the user can be informed.`,
466
+ });
467
+ logger.warn(` [Worker] Tool ${toolName} circuit breaker triggered after ${newCount} failures`);
468
+ }
308
469
  }
309
470
  }
310
471
  // If images are pending, attach them to next model call
@@ -331,12 +492,19 @@ Tools used: ${spawnResult.toolsUsed.join(', ')}`;
331
492
  }
332
493
  // After processing tool calls, check if we should prompt for completion
333
494
  // This helps Worker recognize when task is done instead of over-iterating
334
- const shouldPromptCompletion = this.shouldPromptForCompletion(subtask.instruction, toolsUsed, iteration);
495
+ const shouldPromptCompletion = this.shouldPromptForCompletion(toolsUsed, iteration);
335
496
  if (shouldPromptCompletion) {
336
497
  logger.debug(` [Worker] Prompting for task completion check`);
337
498
  conversationHistory.push({
338
499
  role: 'user',
339
- content: `You have successfully executed the required tools. Please confirm if the subtask is now complete and provide a summary of what was accomplished. If complete, do not call any more tools - just respond with your summary.`,
500
+ content: `Your most recent tools have run. Review the subtask instruction and the tool results above.
501
+
502
+ Is the subtask fully complete?
503
+
504
+ - If YES (all required work is done): respond with a thorough, detailed account of exactly what was accomplished — include file paths, content written, commands run, outputs observed, and any other relevant facts. Do NOT call any more tools.
505
+ - If NO (more work remains): continue immediately with the next required tool call. Do not stop early.
506
+
507
+ IMPORTANT: Do not claim completion unless the core deliverable (e.g. the file written, the data fetched, the action performed) is confirmed done. A directory being created is NOT the same as the file inside it being written.`,
340
508
  });
341
509
  }
342
510
  // Continue to process tool results
@@ -360,28 +528,75 @@ Tools used: ${spawnResult.toolsUsed.join(', ')}`;
360
528
  return false;
361
529
  });
362
530
  if (hasSuccessfulTools && !hasToolFailures) {
363
- // Tools executed successfully, just model didn't stop naturally
364
- finalResult = `Task work completed (${toolsUsed.length} operations performed). Max iterations reached but all tool operations succeeded.`;
365
- logger.info(`[Worker] Max iterations reached, but ${toolsUsed.length} tools executed successfully`);
531
+ // Tools ran successfully but the model never produced a conclusive text
532
+ // response. All the gathered data is in conversationHistory make one
533
+ // final LLM call with NO tools so the model is forced to synthesise a
534
+ // text answer from what it already has rather than calling more tools.
535
+ logger.warn(`[Worker] Max iterations reached after ${toolsUsed.length} tool(s) — forcing synthesis response`);
536
+ try {
537
+ conversationHistory.push({
538
+ role: 'user',
539
+ content: 'You have already gathered all the data above. ' +
540
+ 'NOW write your final comprehensive response using ONLY what you have already collected — ' +
541
+ 'do not call any more tools. Summarise all findings clearly and completely.',
542
+ });
543
+ const synthResponse = await this.orchestrator.chatWithFallback({ messages: conversationHistory }, // no `tools` field → forces text-only reply
544
+ useToolCallingFallback);
545
+ finalResult =
546
+ synthResponse.content ||
547
+ `Max iterations reached. Tools executed (${toolsUsed.length}): ${toolsUsed.join(', ')}.`;
548
+ logger.info(`[Worker] Forced synthesis produced ${finalResult.length} chars`);
549
+ }
550
+ catch (synthError) {
551
+ const errMsg = synthError instanceof Error ? synthError.message : String(synthError);
552
+ logger.warn(`[Worker] Forced synthesis failed: ${errMsg}`);
553
+ finalResult = `Max iterations reached. Tools executed (${toolsUsed.length}): ${toolsUsed.join(', ')}.`;
554
+ }
366
555
  }
367
556
  else if (hasToolFailures) {
368
- finalResult = 'Subtask encountered errors and could not be completed within iteration limit.';
369
- logger.warn(`[Worker] Max iterations reached with tool failures`);
557
+ // Build a specific failure summary from the circuit breaker data
558
+ const failureSummary = [...toolFailureCounts.entries()]
559
+ .filter(([, v]) => v.count > 0)
560
+ .map(([sig, v]) => {
561
+ const name = sig.split(':')[0];
562
+ return `${name} (${v.count} attempt${v.count > 1 ? 's' : ''}) — ${v.lastError}`;
563
+ })
564
+ .join('; ');
565
+ finalResult = `Subtask could not be completed. Tool failures: ${failureSummary || 'see errors above'}.`;
566
+ logger.warn(`[Worker] Max iterations reached with tool failures: ${failureSummary}`);
370
567
  }
371
568
  else {
372
569
  finalResult = 'Subtask could not be completed within iteration limit.';
373
570
  logger.warn(`[Worker] Max iterations reached with no work done`);
374
571
  }
375
572
  }
376
- // Determine success: true if we got a result and it doesn't indicate failure
573
+ // Build structured failedTools list from the circuit breaker map.
574
+ // Include all failures (count >= 1) so even a single failed attempt is
575
+ // visible to Client and synthesis — not just those that hit the 3-attempt cap.
576
+ const failedTools = [...toolFailureCounts.entries()].map(([sig, v]) => {
577
+ const colonIdx = sig.indexOf(':');
578
+ const tName = sig.substring(0, colonIdx);
579
+ let tArgs = {};
580
+ try {
581
+ tArgs = JSON.parse(sig.substring(colonIdx + 1));
582
+ }
583
+ catch { /* ignore */ }
584
+ return { toolName: tName, args: tArgs, lastError: v.lastError, attempts: v.count };
585
+ });
586
+ // Determine success: only true when the model produced a natural conclusive
587
+ // response (broke out of the loop normally). The max-iterations fallback
588
+ // paths are all treated as non-success so the Client validates properly.
377
589
  const success = !!finalResult &&
378
590
  !finalResult.includes('could not be completed') &&
379
- !finalResult.includes('encountered errors');
591
+ !finalResult.includes('encountered errors') &&
592
+ !finalResult.includes('Max iterations reached') &&
593
+ !finalResult.includes('Validation required');
380
594
  orchestrationLogger.logWorkerComplete(success, toolsUsed, iterationCount);
381
595
  return {
382
596
  success,
383
597
  result: finalResult,
384
598
  toolsUsed,
599
+ failedTools,
385
600
  reasoning: reasoning || 'Task executed',
386
601
  };
387
602
  }
@@ -391,48 +606,26 @@ Tools used: ${spawnResult.toolsUsed.join(', ')}`;
391
606
  return reasoningMatch ? reasoningMatch[1].trim() : '';
392
607
  }
393
608
  /**
394
- * Determine if we should prompt Worker to check for completion
395
- * This helps prevent over-iteration by asking Worker to confirm task is done
609
+ * Determine if we should prompt Worker to check for completion.
610
+ * Fires every 3 successful tool calls (regardless of tool type) so research
611
+ * tasks (yfinance, brave-search, etc.) get a "are you done?" nudge just like
612
+ * file-operation tasks do. Also fires when we are approaching the iteration
613
+ * cap so the model has a chance to synthesise before hitting the hard limit.
396
614
  */
397
- shouldPromptForCompletion(instruction, toolsUsed, currentIteration) {
398
- // Don't prompt on first iteration - let Worker do initial work
615
+ shouldPromptForCompletion(toolsUsed, currentIteration) {
616
+ // Don't prompt on the very first iteration let Worker do initial work first.
399
617
  if (currentIteration === 0) {
400
618
  return false;
401
619
  }
402
- // Immediate prompt after browser navigation - that's usually the end of the task
403
- const hasBrowserNavigation = toolsUsed.some(tool => tool.includes('browser_navigate'));
404
- if (hasBrowserNavigation) {
620
+ // Approaching the iteration limit give the model one last chance to wrap up.
621
+ const nearIterationLimit = this.maxIterations > 0 &&
622
+ currentIteration >= Math.floor(this.maxIterations * 0.7);
623
+ if (nearIterationLimit) {
405
624
  return true;
406
625
  }
407
- // Detect repetitive tool usage - sign of stuck loop
408
- const lastThreeTools = toolsUsed.slice(-3);
409
- if (lastThreeTools.length === 3 &&
410
- lastThreeTools[0] === lastThreeTools[1] &&
411
- lastThreeTools[1] === lastThreeTools[2]) {
412
- return true; // Same tool called 3 times in a row - prompt for completion
413
- }
414
- // Don't prompt too frequently - only every 2 iterations after first
415
- if (currentIteration % 2 !== 0) {
416
- return false;
417
- }
418
- // Check if this looks like a completion-oriented task
419
- const completionIndicators = [
420
- 'create', 'write', 'generate', 'build', 'make',
421
- 'read', 'list', 'find', 'search', 'get',
422
- 'update', 'modify', 'edit', 'change',
423
- 'delete', 'remove', 'open', 'navigate', 'browse',
424
- ];
425
- const instructionLower = instruction.toLowerCase();
426
- const hasCompletionIndicator = completionIndicators.some(indicator => instructionLower.includes(indicator));
427
- // Prompt if we've seen successful file/content or browser operations
428
- const hasSignificantOperations = toolsUsed.some(tool => tool.includes('write') ||
429
- tool.includes('create') ||
430
- tool.includes('edit') ||
431
- tool.includes('read') ||
432
- tool.includes('browser') ||
433
- tool.includes('navigate'));
434
- // Prompt if we have completion indicators and significant operations
435
- return hasCompletionIndicator && hasSignificantOperations && toolsUsed.length >= 2;
626
+ // Fire every 3 successful tool calls for any tool type
627
+ // (at 3, 6, 9, 12 … tools accumulated).
628
+ return toolsUsed.length >= 3 && toolsUsed.length % 3 === 0;
436
629
  }
437
630
  }
438
631
  //# sourceMappingURL=worker-agent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"worker-agent.js","sourceRoot":"","sources":["../../src/core/worker-agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,OAAO,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;QACtC,iDAAiD;QACjD,MAAM,cAAc,GAAG,OAAO,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;QACtF,OAAO,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACxD,CAAC;IAED;;;;;;OAMG;IACK,yBAAyB,CAC/B,SAAmB,EACnB,gBAAwB;QAExB,+EAA+E;QAC/E,IAAI,gBAAgB,KAAK,CAAC,EAAE,CAAC;YAC3B,OAAO,KAAK,CAAC;QACf,CAAC;QAED,+EAA+E;QAC/E,MAAM,kBAAkB,GACtB,IAAI,CAAC,aAAa,GAAG,CAAC;YACtB,gBAAgB,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,GAAG,GAAG,CAAC,CAAC;QAC3D,IAAI,kBAAkB,EAAE,CAAC;YACvB,OAAO,IAAI,CAAC;QACd,CAAC;QAED,uDAAuD;QACvD,wCAAwC;QACxC,OAAO,SAAS,CAAC,MAAM,IAAI,CAAC,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC;IAC7D,CAAC;CACF"}
package/dist/index.d.ts CHANGED
@@ -5,10 +5,13 @@
5
5
  */
6
6
  export { JivaAgent } from './core/agent.js';
7
7
  export { DualAgent } from './core/dual-agent.js';
8
+ export { CodeAgent } from './code/agent.js';
9
+ export { LspManager } from './code/lsp/manager.js';
8
10
  export { ManagerAgent } from './core/manager-agent.js';
9
11
  export { WorkerAgent } from './core/worker-agent.js';
10
12
  export { ClientAgent } from './core/client-agent.js';
11
13
  export { configManager, ConfigManager } from './core/config.js';
14
+ export type { IAgent, AgentChatResponse } from './core/agent-interface.js';
12
15
  export { WorkspaceManager } from './core/workspace.js';
13
16
  export { ConversationManager } from './core/conversation-manager.js';
14
17
  export { KrutrimModel, createKrutrimModel } from './models/krutrim.js';
@@ -20,4 +23,7 @@ export { logger, LogLevel } from './utils/logger.js';
20
23
  export * from './utils/errors.js';
21
24
  export * from './models/base.js';
22
25
  export * from './models/harmony.js';
26
+ export type { AgentContext } from './core/types/agent-context.js';
27
+ export type { CompletionSignal } from './core/types/completion-signal.js';
28
+ export { serializeAgentContext } from './core/utils/serialize-agent-context.js';
23
29
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAErE,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG3D,cAAc,oBAAoB,CAAC;AAEnC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAErD,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAChE,YAAY,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAErE,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG3D,cAAc,oBAAoB,CAAC;AAEnC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAErD,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AAGpC,YAAY,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC"}
package/dist/index.js CHANGED
@@ -5,6 +5,8 @@
5
5
  */
6
6
  export { JivaAgent } from './core/agent.js';
7
7
  export { DualAgent } from './core/dual-agent.js';
8
+ export { CodeAgent } from './code/agent.js';
9
+ export { LspManager } from './code/lsp/manager.js';
8
10
  export { ManagerAgent } from './core/manager-agent.js';
9
11
  export { WorkerAgent } from './core/worker-agent.js';
10
12
  export { ClientAgent } from './core/client-agent.js';
@@ -21,4 +23,5 @@ export { logger, LogLevel } from './utils/logger.js';
21
23
  export * from './utils/errors.js';
22
24
  export * from './models/base.js';
23
25
  export * from './models/harmony.js';
26
+ export { serializeAgentContext } from './core/utils/serialize-agent-context.js';
24
27
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAErE,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,mDAAmD;AACnD,cAAc,oBAAoB,CAAC;AAEnC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAErD,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,c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