erosolar-cli 2.1.177 → 2.1.178

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "erosolar-cli",
3
- "version": "2.1.177",
3
+ "version": "2.1.178",
4
4
  "description": "Unified AI agent framework for the command line - Multi-provider support with schema-driven tools, code intelligence, and transparent reasoning",
5
5
  "main": "dist/bin/erosolar.js",
6
6
  "type": "module",
@@ -1,37 +0,0 @@
1
- import { AgentRuntime } from './agent.js';
2
- export type OrchestratorExitReason = 'complete' | 'max-passes' | 'empty-response';
3
- export interface OrchestratorOptions {
4
- /** Maximum number of passes to attempt before giving up */
5
- maxPasses?: number;
6
- /** Whether to stream provider responses */
7
- streaming?: boolean;
8
- /** Require observable action (tool usage or action language) before stopping */
9
- enforceActions?: boolean;
10
- }
11
- export interface OrchestratorPass {
12
- response: string;
13
- toolsUsed: string[];
14
- planOnly: boolean;
15
- tookAction: boolean;
16
- }
17
- export interface OrchestratorResult {
18
- finalResponse: string;
19
- passes: OrchestratorPass[];
20
- exitReason: OrchestratorExitReason;
21
- }
22
- /**
23
- * Drives an AgentRuntime through multiple passes until the request is actually completed.
24
- * Helps avoid early stops after plan-only replies by forcing follow-up prompts that demand action.
25
- */
26
- export declare class AgentOrchestrator {
27
- private readonly agent;
28
- constructor(agent: AgentRuntime);
29
- runToCompletion(request: string, options?: OrchestratorOptions): Promise<OrchestratorResult>;
30
- private isPlanOnly;
31
- private hasExplicitCompletion;
32
- private hasCompletionContradiction;
33
- private hasActionLanguage;
34
- private wordCount;
35
- private buildFollowUp;
36
- }
37
- //# sourceMappingURL=agentOrchestrator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agentOrchestrator.d.ts","sourceRoot":"","sources":["../../src/core/agentOrchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,MAAM,sBAAsB,GAAG,UAAU,GAAG,YAAY,GAAG,gBAAgB,CAAC;AAElF,MAAM,WAAW,mBAAmB;IAClC,2DAA2D;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gFAAgF;IAChF,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,UAAU,EAAE,sBAAsB,CAAC;CACpC;AAED;;;GAGG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAe;gBAEzB,KAAK,EAAE,YAAY;IAIzB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAwDlG,OAAO,CAAC,UAAU;IAiBlB,OAAO,CAAC,qBAAqB;IAa7B,OAAO,CAAC,0BAA0B;IAelC,OAAO,CAAC,iBAAiB;IAezB,OAAO,CAAC,SAAS;IAKjB,OAAO,CAAC,aAAa;CAoCtB"}
@@ -1,147 +0,0 @@
1
- /**
2
- * Drives an AgentRuntime through multiple passes until the request is actually completed.
3
- * Helps avoid early stops after plan-only replies by forcing follow-up prompts that demand action.
4
- */
5
- export class AgentOrchestrator {
6
- agent;
7
- constructor(agent) {
8
- this.agent = agent;
9
- }
10
- async runToCompletion(request, options) {
11
- const maxPasses = options?.maxPasses ?? 4;
12
- const streaming = options?.streaming ?? true;
13
- const enforceActions = options?.enforceActions ?? true;
14
- const passes = [];
15
- let prompt = request.trim();
16
- let exitReason = null;
17
- for (let pass = 0; pass < maxPasses; pass++) {
18
- const response = (await this.agent.send(prompt, streaming)).trim();
19
- const toolsUsed = this.agent.drainToolExecutions();
20
- const planOnly = this.isPlanOnly(response);
21
- const tookAction = toolsUsed.length > 0 || this.hasActionLanguage(response);
22
- passes.push({ response, toolsUsed, planOnly, tookAction });
23
- if (!response) {
24
- if (pass === maxPasses - 1) {
25
- exitReason = 'empty-response';
26
- break;
27
- }
28
- prompt = this.buildFollowUp(request, response, toolsUsed, 'empty');
29
- continue;
30
- }
31
- const hasCompletionMarker = this.hasExplicitCompletion(response) && !this.hasCompletionContradiction(response);
32
- const tooLight = this.wordCount(response) < 80;
33
- const shouldForceMoreWork = enforceActions && (planOnly || (!tookAction && tooLight));
34
- if (hasCompletionMarker && !shouldForceMoreWork) {
35
- exitReason = 'complete';
36
- break;
37
- }
38
- if (pass === maxPasses - 1) {
39
- exitReason = 'max-passes';
40
- break;
41
- }
42
- const reason = planOnly ? 'plan-only' : 'keep-going';
43
- prompt = this.buildFollowUp(request, response, toolsUsed, reason);
44
- }
45
- if (!exitReason) {
46
- exitReason = 'complete';
47
- }
48
- return {
49
- finalResponse: passes[passes.length - 1]?.response ?? '',
50
- passes,
51
- exitReason,
52
- };
53
- }
54
- isPlanOnly(response) {
55
- if (!response.trim())
56
- return false;
57
- const planIndicators = [
58
- /\bplan\b/i,
59
- /\bapproach\b/i,
60
- /\bsteps?:\b/i,
61
- /\bstep\s+1\b/i,
62
- /\bstart by\b/i,
63
- /\bfirst[, ]/i,
64
- /\bthen\b/i,
65
- /\bnext\b/i,
66
- /\bwe\s+will\b/i,
67
- /\bi\s+will\b/i,
68
- ];
69
- return planIndicators.some((pattern) => pattern.test(response));
70
- }
71
- hasExplicitCompletion(response) {
72
- if (!response.trim())
73
- return false;
74
- if (response.includes('TASK_FULLY_COMPLETE'))
75
- return true;
76
- const completionPatterns = [
77
- /\btask(s)? (is|are)?\s*complete\b/i,
78
- /\ball done\b/i,
79
- /\bcleanup complete\b/i,
80
- /\bnothing (else\s*)?to do\b/i,
81
- /\bno junk (found|remaining)\b/i,
82
- ];
83
- return completionPatterns.some((pattern) => pattern.test(response));
84
- }
85
- hasCompletionContradiction(response) {
86
- const contradictions = [
87
- /not\s+yet\s+(done|complete|finished|integrated|implemented)/i,
88
- /\bstill\s+(need|needs|pending|left)\b/i,
89
- /\bpending\b/i,
90
- /\bremaining\b/i,
91
- /\bnot\s+(working|functional)\b/i,
92
- /\btests?\s+(are\s+)?failing\b/i,
93
- /\bto\s+be\s+(done|completed|fixed|implemented)\b/i,
94
- /\btodo\b/i,
95
- /\bfixme\b/i,
96
- ];
97
- return contradictions.some((pattern) => pattern.test(response));
98
- }
99
- hasActionLanguage(response) {
100
- const actionPatterns = [
101
- /\bremoved\b/i,
102
- /\bdeleted\b/i,
103
- /\bcreated\b/i,
104
- /\badded\b/i,
105
- /\bupdated\b/i,
106
- /\brefactored\b/i,
107
- /\bcommitted\b/i,
108
- /\bran\b.+\btests?\b/i,
109
- /\bcleaned\b/i,
110
- ];
111
- return actionPatterns.some((pattern) => pattern.test(response));
112
- }
113
- wordCount(text) {
114
- if (!text.trim())
115
- return 0;
116
- return text.trim().split(/\s+/).length;
117
- }
118
- buildFollowUp(originalRequest, lastResponse, toolsUsed, reason) {
119
- const toolLine = toolsUsed.length
120
- ? `Tools already used: ${toolsUsed.join(', ')}. Keep using tools for the next actions.`
121
- : 'No tools were used yet. Call the bash/edit/read/git tools to actually perform work.';
122
- const focus = (() => {
123
- switch (reason) {
124
- case 'plan-only':
125
- return 'Stop repeating the plan. Execute the steps you described.';
126
- case 'empty':
127
- return 'Your last reply was empty. Resume the task and perform actions now.';
128
- case 'keep-going':
129
- default:
130
- return 'Continue executing until the request is fully completed.';
131
- }
132
- })();
133
- const lastSnippet = lastResponse.trim()
134
- ? `Your last response:\n${lastResponse.trim().slice(0, 800)}`
135
- : 'No previous response was returned.';
136
- return `${originalRequest}
137
-
138
- ${focus}
139
- ${toolLine}
140
- ${lastSnippet}
141
-
142
- - Use tools to inspect and modify the workspace as needed.
143
- - Report concrete changes and progress after each action.
144
- - Reply with TASK_FULLY_COMPLETE only when the entire request is actually finished.`;
145
- }
146
- }
147
- //# sourceMappingURL=agentOrchestrator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agentOrchestrator.js","sourceRoot":"","sources":["../../src/core/agentOrchestrator.ts"],"names":[],"mappings":"AA0BA;;;GAGG;AACH,MAAM,OAAO,iBAAiB;IACX,KAAK,CAAe;IAErC,YAAY,KAAmB;QAC7B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,OAAe,EAAE,OAA6B;QAClE,MAAM,SAAS,GAAG,OAAO,EAAE,SAAS,IAAI,CAAC,CAAC;QAC1C,MAAM,SAAS,GAAG,OAAO,EAAE,SAAS,IAAI,IAAI,CAAC;QAC7C,MAAM,cAAc,GAAG,OAAO,EAAE,cAAc,IAAI,IAAI,CAAC;QACvD,MAAM,MAAM,GAAuB,EAAE,CAAC;QAEtC,IAAI,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;QAC5B,IAAI,UAAU,GAAkC,IAAI,CAAC;QAErD,KAAK,IAAI,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC;YAC5C,MAAM,QAAQ,GAAG,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YACnE,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,mBAAmB,EAAE,CAAC;YACnD,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YAC3C,MAAM,UAAU,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;YAE5E,MAAM,CAAC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