@mikode13/harness 0.1.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 (55) hide show
  1. package/LICENSE +44 -0
  2. package/README.md +170 -0
  3. package/dist/agent/domain/agent.d.ts +63 -0
  4. package/dist/agent/domain/agent.d.ts.map +1 -0
  5. package/dist/agent/domain/agent.js +2 -0
  6. package/dist/agent/domain/agent.js.map +1 -0
  7. package/dist/agent/domain/errors.d.ts +13 -0
  8. package/dist/agent/domain/errors.d.ts.map +1 -0
  9. package/dist/agent/domain/errors.js +15 -0
  10. package/dist/agent/domain/errors.js.map +1 -0
  11. package/dist/agent/domain/providerFailure.d.ts +20 -0
  12. package/dist/agent/domain/providerFailure.d.ts.map +1 -0
  13. package/dist/agent/domain/providerFailure.js +84 -0
  14. package/dist/agent/domain/providerFailure.js.map +1 -0
  15. package/dist/engines/claude/infrastructure/model/claudeAgent.d.ts +17 -0
  16. package/dist/engines/claude/infrastructure/model/claudeAgent.d.ts.map +1 -0
  17. package/dist/engines/claude/infrastructure/model/claudeAgent.js +225 -0
  18. package/dist/engines/claude/infrastructure/model/claudeAgent.js.map +1 -0
  19. package/dist/engines/codex/infrastructure/model/codexAgent.d.ts +19 -0
  20. package/dist/engines/codex/infrastructure/model/codexAgent.d.ts.map +1 -0
  21. package/dist/engines/codex/infrastructure/model/codexAgent.js +119 -0
  22. package/dist/engines/codex/infrastructure/model/codexAgent.js.map +1 -0
  23. package/dist/index.d.ts +12 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +9 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/orchestration/domain/interface/validator.d.ts +4 -0
  28. package/dist/orchestration/domain/interface/validator.d.ts.map +1 -0
  29. package/dist/orchestration/domain/interface/validator.js +2 -0
  30. package/dist/orchestration/domain/interface/validator.js.map +1 -0
  31. package/dist/orchestration/domain/model/orchestratorAgent.d.ts +14 -0
  32. package/dist/orchestration/domain/model/orchestratorAgent.d.ts.map +1 -0
  33. package/dist/orchestration/domain/model/orchestratorAgent.js +157 -0
  34. package/dist/orchestration/domain/model/orchestratorAgent.js.map +1 -0
  35. package/dist/orchestration/domain/model/reviewerDecision.d.ts +7 -0
  36. package/dist/orchestration/domain/model/reviewerDecision.d.ts.map +1 -0
  37. package/dist/orchestration/domain/model/reviewerDecision.js +2 -0
  38. package/dist/orchestration/domain/model/reviewerDecision.js.map +1 -0
  39. package/dist/orchestration/infrastructure/model/reviewerDecisionValidator.d.ts +6 -0
  40. package/dist/orchestration/infrastructure/model/reviewerDecisionValidator.d.ts.map +1 -0
  41. package/dist/orchestration/infrastructure/model/reviewerDecisionValidator.js +12 -0
  42. package/dist/orchestration/infrastructure/model/reviewerDecisionValidator.js.map +1 -0
  43. package/dist/retry/domain/model/retryingAgent.d.ts +8 -0
  44. package/dist/retry/domain/model/retryingAgent.d.ts.map +1 -0
  45. package/dist/retry/domain/model/retryingAgent.js +38 -0
  46. package/dist/retry/domain/model/retryingAgent.js.map +1 -0
  47. package/dist/shared/domain/isAbortError.d.ts +2 -0
  48. package/dist/shared/domain/isAbortError.d.ts.map +1 -0
  49. package/dist/shared/domain/isAbortError.js +4 -0
  50. package/dist/shared/domain/isAbortError.js.map +1 -0
  51. package/dist/shared/domain/logger.d.ts +6 -0
  52. package/dist/shared/domain/logger.d.ts.map +1 -0
  53. package/dist/shared/domain/logger.js +2 -0
  54. package/dist/shared/domain/logger.js.map +1 -0
  55. package/package.json +58 -0
@@ -0,0 +1,225 @@
1
+ import { query } from '@anthropic-ai/claude-agent-sdk';
2
+ import { RecoverableError } from "../../../../agent/domain/errors.js";
3
+ import { classifiedProviderStream, classifyHostFailure, classifyLocalFailure, classifyProviderFailure, } from "../../../../agent/domain/providerFailure.js";
4
+ function emitProgress(callback, event) {
5
+ try {
6
+ callback(event);
7
+ }
8
+ catch (error) {
9
+ throw classifyHostFailure(error, 'Claude progress callback failed');
10
+ }
11
+ }
12
+ function asRecord(value) {
13
+ return typeof value === 'object' && value !== null && !Array.isArray(value)
14
+ ? value
15
+ : undefined;
16
+ }
17
+ function stringValue(value) {
18
+ return typeof value === 'string' ? value : undefined;
19
+ }
20
+ function toolResultBlock(value) {
21
+ const block = asRecord(value);
22
+ if (!block || typeof block.type !== 'string' || typeof block.tool_use_id !== 'string') {
23
+ return undefined;
24
+ }
25
+ return block;
26
+ }
27
+ function toolResultId(value) {
28
+ return toolResultBlock(value)?.tool_use_id;
29
+ }
30
+ function fileChange(name, tool, output) {
31
+ const inputPath = stringValue(tool.input.file_path);
32
+ const outputPath = stringValue(asRecord(output)?.filePath);
33
+ const path = outputPath ?? inputPath;
34
+ if (!path)
35
+ return undefined;
36
+ const kind = name === 'Write' && stringValue(asRecord(output)?.type) === 'create' ? 'add' : 'update';
37
+ return { type: 'fileChange', changes: [{ path, kind }] };
38
+ }
39
+ function todoList(tool) {
40
+ if (!Array.isArray(tool.input.todos))
41
+ return undefined;
42
+ const items = tool.input.todos.flatMap(todo => {
43
+ const item = asRecord(todo);
44
+ const text = stringValue(item?.content);
45
+ const status = stringValue(item?.status);
46
+ return text && status ? [{ text, completed: status === 'completed' }] : [];
47
+ });
48
+ return { type: 'todoList', items };
49
+ }
50
+ function mcpTool(tool, result) {
51
+ const server = tool.server;
52
+ const toolName = tool.name.startsWith('mcp__')
53
+ ? tool.name.slice('mcp__'.length).split('__').slice(1).join('__')
54
+ : tool.name;
55
+ if (!server || !toolName)
56
+ return undefined;
57
+ return {
58
+ type: 'mcpTool',
59
+ server,
60
+ tool: toolName,
61
+ status: result.is_error ? 'failed' : 'completed',
62
+ };
63
+ }
64
+ function describeCompletedTool(tool, result, output) {
65
+ if (tool.name === 'Bash') {
66
+ const exitCode = asRecord(output)?.exitCode ?? asRecord(output)?.exit_code;
67
+ return {
68
+ type: 'command',
69
+ command: stringValue(tool.input.command) ?? '',
70
+ ...(typeof exitCode === 'number' ? { exitCode } : {}),
71
+ };
72
+ }
73
+ if (tool.name === 'WebSearch') {
74
+ const query = stringValue(tool.input.query);
75
+ return query ? { type: 'search', query } : undefined;
76
+ }
77
+ if (tool.name === 'Edit' || tool.name === 'Write') {
78
+ return result.is_error ? undefined : fileChange(tool.name, tool, output);
79
+ }
80
+ if (tool.name === 'TodoWrite') {
81
+ return result.is_error ? undefined : todoList(tool);
82
+ }
83
+ if (tool.name.startsWith('mcp__') || tool.server) {
84
+ return mcpTool(tool, result);
85
+ }
86
+ return undefined;
87
+ }
88
+ export class ClaudeAgent {
89
+ model;
90
+ autoApprove;
91
+ reasoningEffort;
92
+ sessionId;
93
+ constructor(model, autoApprove = false, reasoningEffort = 'high') {
94
+ this.model = model;
95
+ this.autoApprove = autoApprove;
96
+ this.reasoningEffort = reasoningEffort;
97
+ }
98
+ async run(prompt, signal, callback) {
99
+ let stream;
100
+ try {
101
+ stream = query({
102
+ prompt,
103
+ options: {
104
+ effort: this.reasoningEffort,
105
+ model: this.model,
106
+ maxTurns: 3,
107
+ cwd: process.cwd(),
108
+ resume: this.sessionId,
109
+ ...(this.autoApprove
110
+ ? {
111
+ permissionMode: 'bypassPermissions',
112
+ allowDangerouslySkipPermissions: true,
113
+ }
114
+ : {}),
115
+ },
116
+ });
117
+ }
118
+ catch (error) {
119
+ throw classifyProviderFailure(error, 'Claude refused the request');
120
+ }
121
+ signal.addEventListener('abort', () => {
122
+ stream.close();
123
+ });
124
+ return await this.parseResponse(stream, callback);
125
+ }
126
+ async parseResponse(stream, callback) {
127
+ const lines = [];
128
+ let resultMessage;
129
+ const pendingTools = new Map();
130
+ const messages = classifiedProviderStream(stream, 'Claude stream ended unexpectedly');
131
+ for await (const message of messages) {
132
+ this.sessionId ??= message.session_id;
133
+ try {
134
+ switch (message.type) {
135
+ case 'assistant':
136
+ this.handleAssistantMessage(message, pendingTools, callback);
137
+ break;
138
+ case 'user':
139
+ this.handleUserMessage(message, pendingTools, callback);
140
+ break;
141
+ case 'result':
142
+ if (message.subtype === 'success') {
143
+ lines.push(message.result);
144
+ resultMessage = message;
145
+ }
146
+ else {
147
+ throw new RecoverableError('Claude sdk error', {
148
+ cause: [message.stop_reason, message.terminal_reason, ...message.errors].join(','),
149
+ });
150
+ }
151
+ break;
152
+ }
153
+ }
154
+ catch (error) {
155
+ throw classifyLocalFailure(error, 'Claude failed while mapping progress');
156
+ }
157
+ }
158
+ if (!lines.length || !resultMessage) {
159
+ return undefined;
160
+ }
161
+ return {
162
+ response: lines.join('\n'),
163
+ inputTokens: resultMessage.usage.input_tokens,
164
+ outputTokens: resultMessage.usage.output_tokens,
165
+ duration: resultMessage.duration_ms / 1000,
166
+ };
167
+ }
168
+ handleAssistantMessage(message, pendingTools, callback) {
169
+ for (const block of message.message.content) {
170
+ if (block.type === 'text') {
171
+ emitProgress(callback, { type: 'agentMessage', message: block.text });
172
+ continue;
173
+ }
174
+ if (block.type === 'thinking') {
175
+ emitProgress(callback, { type: 'reasoning', message: block.thinking });
176
+ continue;
177
+ }
178
+ if (block.type === 'tool_use' ||
179
+ block.type === 'server_tool_use' ||
180
+ block.type === 'mcp_tool_use') {
181
+ const input = asRecord(block.input);
182
+ if (input) {
183
+ pendingTools.set(block.id, {
184
+ name: block.name === 'web_search' ? 'WebSearch' : block.name,
185
+ input,
186
+ ...('server_name' in block && typeof block.server_name === 'string'
187
+ ? { server: block.server_name }
188
+ : parseMcpServer(block.name)),
189
+ });
190
+ }
191
+ continue;
192
+ }
193
+ this.handleCompletedTool(block, pendingTools, callback);
194
+ }
195
+ }
196
+ handleUserMessage(message, pendingTools, callback) {
197
+ if (!Array.isArray(message.message.content))
198
+ return;
199
+ for (const block of message.message.content) {
200
+ this.handleCompletedTool(block, pendingTools, callback, message.tool_use_result);
201
+ }
202
+ }
203
+ handleCompletedTool(block, pendingTools, callback, output) {
204
+ const id = toolResultId(block);
205
+ if (!id)
206
+ return;
207
+ const tool = pendingTools.get(id);
208
+ if (!tool)
209
+ return;
210
+ pendingTools.delete(id);
211
+ const result = toolResultBlock(block);
212
+ if (!result)
213
+ return;
214
+ const description = describeCompletedTool(tool, result, output ?? result.content);
215
+ if (description)
216
+ emitProgress(callback, description);
217
+ }
218
+ }
219
+ function parseMcpServer(name) {
220
+ if (!name.startsWith('mcp__'))
221
+ return undefined;
222
+ const server = name.slice('mcp__'.length).split('__')[0];
223
+ return server ? { server } : undefined;
224
+ }
225
+ //# sourceMappingURL=claudeAgent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claudeAgent.js","sourceRoot":"","sources":["../../../../../src/engines/claude/infrastructure/model/claudeAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAcvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EACN,wBAAwB,EACxB,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,GACvB,MAAM,6CAA6C,CAAC;AAiBrD,SAAS,YAAY,CAAC,QAAkB,EAAE,KAAoB;IAC7D,IAAI,CAAC;QACJ,QAAQ,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,MAAM,mBAAmB,CAAC,KAAK,EAAE,iCAAiC,CAAC,CAAC;IACrE,CAAC;AACF,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAC1E,CAAC,CAAE,KAAiC;QACpC,CAAC,CAAC,SAAS,CAAC;AACd,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IAClC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACtD,CAAC;AAED,SAAS,eAAe,CAAC,KAAc;IACtC,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9B,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,CAAC,IA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AE,CAAC,CAAC,CAAC,SAAS,CAAC;AACxC,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { Codex, ModelReasoningEffort } from '@openai/codex-sdk';
2
+ import { type Agent, type AgentResponse, type Callback } from '../../../../agent/domain/agent.ts';
3
+ import type { ILogger } from '../../../../shared/domain/logger.ts';
4
+ type Model = 'gpt-5.6-sol' | 'gpt-5.6-luna';
5
+ export declare class CodexAgent implements Agent {
6
+ private thread;
7
+ private logger;
8
+ constructor({ sdk, model, logger, autoApprove, reasoningEffort, }: {
9
+ sdk: Codex;
10
+ model: Model;
11
+ logger: ILogger;
12
+ autoApprove?: boolean;
13
+ reasoningEffort?: ModelReasoningEffort;
14
+ });
15
+ run(prompt: string, signal: AbortSignal, callback: Callback): Promise<AgentResponse | undefined>;
16
+ private parseResponse;
17
+ }
18
+ export {};
19
+ //# sourceMappingURL=codexAgent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codexAgent.d.ts","sourceRoot":"","sources":["../../../../../src/engines/codex/infrastructure/model/codexAgent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,KAAK,EACL,oBAAoB,EAKpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,KAAK,KAAK,EACV,KAAK,aAAa,EAClB,KAAK,QAAQ,EAEb,MAAM,mCAAmC,CAAC;AAS3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAEnE,KAAK,KAAK,GAAG,aAAa,GAAG,cAAc,CAAC;AAkD5C,qBAAa,UAAW,YAAW,KAAK;IACvC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAU;gBAEZ,EACX,GAAG,EACH,KAAK,EACL,MAAM,EACN,WAAmB,EACnB,eAAwB,GACxB,EAAE;QACF,GAAG,EAAE,KAAK,CAAC;QACX,KAAK,EAAE,KAAK,CAAC;QACb,MAAM,EAAE,OAAO,CAAC;QAChB,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,eAAe,CAAC,EAAE,oBAAoB,CAAC;KACvC;IAoBK,GAAG,CACR,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,QAAQ,GAChB,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;YAYvB,aAAa;CAgD3B"}
@@ -0,0 +1,119 @@
1
+ import {} from "../../../../agent/domain/agent.js";
2
+ import { RecoverableError, UnrecoverableError } from "../../../../agent/domain/errors.js";
3
+ import { classifiedProviderStream, classifyHostFailure, classifyLocalFailure, classifyProviderFailure, describeFailure, } from "../../../../agent/domain/providerFailure.js";
4
+ function convertEventToItem(event) {
5
+ if (event.type === 'error')
6
+ throw new UnrecoverableError('Codex stream error', { cause: event.message });
7
+ if (event.type === 'turn.failed')
8
+ throw new UnrecoverableError('Turn failed from codex sdk', { cause: event.error.message });
9
+ if (event.type === 'item.completed')
10
+ return event.item;
11
+ return undefined;
12
+ }
13
+ function describeItem(item, logger) {
14
+ switch (item.type) {
15
+ case 'agent_message':
16
+ return { type: 'agentMessage', message: item.text };
17
+ case 'reasoning':
18
+ return { type: 'reasoning', message: item.text };
19
+ case 'command_execution':
20
+ return { type: 'command', command: item.command, exitCode: item.exit_code };
21
+ case 'web_search':
22
+ return { type: 'search', query: item.query };
23
+ case 'file_change':
24
+ return { type: 'fileChange', changes: item.changes };
25
+ case 'mcp_tool_call': {
26
+ if (item.error) {
27
+ throw new RecoverableError('skill failed', { cause: item.error.message });
28
+ }
29
+ return { type: 'mcpTool', server: item.server, tool: item.tool, status: item.status };
30
+ }
31
+ case 'todo_list':
32
+ return { type: 'todoList', items: item.items };
33
+ case 'error':
34
+ throw new RecoverableError('error while using the codex tools', { cause: item.message });
35
+ default:
36
+ try {
37
+ logger.warn(item, 'new type');
38
+ }
39
+ catch (error) {
40
+ throw classifyHostFailure(error, 'Codex logger failed while reporting progress');
41
+ }
42
+ return undefined;
43
+ }
44
+ }
45
+ export class CodexAgent {
46
+ thread;
47
+ logger;
48
+ constructor({ sdk, model, logger, autoApprove = false, reasoningEffort = 'high', }) {
49
+ try {
50
+ this.thread = sdk.startThread({
51
+ model,
52
+ modelReasoningEffort: reasoningEffort,
53
+ ...(autoApprove
54
+ ? { approvalPolicy: 'never', sandboxMode: 'danger-full-access' }
55
+ : {}),
56
+ });
57
+ }
58
+ catch (error) {
59
+ // Not recoverable, unlike a request: a thread the SDK refused to open at all is
60
+ // rejected configuration, and running the same constructor again cannot fix it.
61
+ throw new UnrecoverableError('Codex rejected the thread configuration', {
62
+ cause: describeFailure(error),
63
+ });
64
+ }
65
+ this.logger = logger;
66
+ }
67
+ async run(prompt, signal, callback) {
68
+ let turn;
69
+ try {
70
+ turn = await this.thread.runStreamed(prompt, { signal });
71
+ }
72
+ catch (error) {
73
+ throw classifyProviderFailure(error, 'Codex refused the request');
74
+ }
75
+ return await this.parseResponse(turn, callback);
76
+ }
77
+ async parseResponse(turn, callback) {
78
+ const lines = [];
79
+ const start = Date.now();
80
+ let usage = undefined;
81
+ const events = classifiedProviderStream(turn.events, 'Codex stream ended unexpectedly');
82
+ for await (const event of events) {
83
+ if (event.type === 'turn.completed') {
84
+ usage = event.usage;
85
+ continue;
86
+ }
87
+ const item = convertEventToItem(event);
88
+ if (!item)
89
+ continue;
90
+ let description;
91
+ try {
92
+ description = describeItem(item, this.logger);
93
+ }
94
+ catch (error) {
95
+ throw classifyLocalFailure(error, 'Codex failed while mapping progress');
96
+ }
97
+ if (description) {
98
+ try {
99
+ callback(description);
100
+ }
101
+ catch (error) {
102
+ throw classifyHostFailure(error, 'Codex progress callback failed');
103
+ }
104
+ }
105
+ if (description?.type === 'agentMessage')
106
+ lines.push(description.message);
107
+ }
108
+ if (!lines.length || !usage) {
109
+ return undefined;
110
+ }
111
+ return {
112
+ response: lines.join('\n'),
113
+ inputTokens: usage.input_tokens,
114
+ outputTokens: usage.output_tokens,
115
+ duration: (Date.now() - start) / 1000,
116
+ };
117
+ }
118
+ }
119
+ //# sourceMappingURL=codexAgent.js.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CAAC;gBACrC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;gBACpB,SAAS;YACV,CAAC;YAED,MAAM,IAAI,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;YAEvC,IAAI,CAAC,IAAI;gBAAE,SAAS;YAEpB,IAAI,WAAsC,CAAC;YAC3C,IAAI,CAAC;gBACJ,WAAW,GAAG,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YAC/C,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,MAAM,oBAAoB,CAAC,KAAK,EAAE,qCAAqC,CAAC,CAAC;YAC1E,CAAC;YAED,IAAI,WAAW,EAAE,CAAC;gBACjB,IAAI,CAAC;oBACJ,QAAQ,CAAC,WAAW,CAAC,CAAC;gBACvB,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBAChB,MAAM,mBAAmB,CAAC,KAAK,EAAE,gCAAgC,CAAC,CAAC;gBACpE,CAAC;YACF,CAAC;YACD,IAAI,WAAW,EAAE,IAAI,KAAK,cAAc;gBAAE,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAC3E,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;YAC7B,OAAO,SAAS,CAAC;QAClB,CAAC;QAED,OAAO;YACN,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;YAC1B,WAAW,EAAE,KAAK,CAAC,YAAY;YAC/B,YAAY,EAAE,KAAK,CAAC,aAAa;YACjC,QAAQ,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,GAAG,IAAI;SACrC,CAAC;IACH,CAAC;CACD"}
@@ -0,0 +1,12 @@
1
+ export type { ILogger } from './shared/domain/logger.ts';
2
+ export { CodexAgent } from './engines/codex/infrastructure/model/codexAgent.ts';
3
+ export { ClaudeAgent } from './engines/claude/infrastructure/model/claudeAgent.ts';
4
+ export { RetryingAgent } from './retry/domain/model/retryingAgent.ts';
5
+ export { OrchestratorAgent } from './orchestration/domain/model/orchestratorAgent.ts';
6
+ export { type Agent, type AgentResponse, type Callback, type ProgressEvent, } from './agent/domain/agent.ts';
7
+ export { RecoverableError, UnrecoverableError } from './agent/domain/errors.ts';
8
+ export { isAbortError } from './shared/domain/isAbortError.ts';
9
+ export type { ReviewerDecision } from './orchestration/domain/model/reviewerDecision.ts';
10
+ export type { Validator } from './orchestration/domain/interface/validator.ts';
11
+ export { ReviewerDecisionValidator } from './orchestration/infrastructure/model/reviewerDecisionValidator.ts';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,oDAAoD,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mDAAmD,CAAC;AACtF,OAAO,EACN,KAAK,KAAK,EACV,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,aAAa,GAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,YAAY,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AACzF,YAAY,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAC/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,mEAAmE,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ export { CodexAgent } from "./engines/codex/infrastructure/model/codexAgent.js";
2
+ export { ClaudeAgent } from "./engines/claude/infrastructure/model/claudeAgent.js";
3
+ export { RetryingAgent } from "./retry/domain/model/retryingAgent.js";
4
+ export { OrchestratorAgent } from "./orchestration/domain/model/orchestratorAgent.js";
5
+ export {} from "./agent/domain/agent.js";
6
+ export { RecoverableError, UnrecoverableError } from "./agent/domain/errors.js";
7
+ export { isAbortError } from "./shared/domain/isAbortError.js";
8
+ export { ReviewerDecisionValidator } from "./orchestration/infrastructure/model/reviewerDecisionValidator.js";
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,oDAAoD,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mDAAmD,CAAC;AACtF,OAAO,EAKN,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAG/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,mEAAmE,CAAC"}
@@ -0,0 +1,4 @@
1
+ export interface Validator<T> {
2
+ validate(input: unknown): T | undefined;
3
+ }
4
+ //# sourceMappingURL=validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../../src/orchestration/domain/interface/validator.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS,CAAC,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,CAAC,GAAG,SAAS,CAAC;CACxC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.js","sourceRoot":"","sources":["../../../../src/orchestration/domain/interface/validator.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import type { Agent, AgentResponse, Callback } from '../../../agent/domain/agent.ts';
2
+ import type { ReviewerDecision } from './reviewerDecision.ts';
3
+ import type { Validator } from '../interface/validator.ts';
4
+ export declare class OrchestratorAgent implements Agent {
5
+ private plannerAgent;
6
+ private executorAgent;
7
+ private reviewerAgent;
8
+ private reviewerDecisionValidator;
9
+ private maxAttempts;
10
+ constructor(plannerAgent: Agent, executorAgent: Agent, reviewerAgent: Agent, reviewerDecisionValidator: Validator<ReviewerDecision>, maxAttempts?: number);
11
+ run(prompt: string, signal: AbortSignal, callback: Callback): Promise<AgentResponse | undefined>;
12
+ private getReviewerDecision;
13
+ }
14
+ //# sourceMappingURL=orchestratorAgent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestratorAgent.d.ts","sourceRoot":"","sources":["../../../../src/orchestration/domain/model/orchestratorAgent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAErF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAsG3D,qBAAa,iBAAkB,YAAW,KAAK;IAC9C,OAAO,CAAC,YAAY,CAAQ;IAC5B,OAAO,CAAC,aAAa,CAAQ;IAC7B,OAAO,CAAC,aAAa,CAAQ;IAC7B,OAAO,CAAC,yBAAyB,CAA8B;IAC/D,OAAO,CAAC,WAAW,CAAS;gBAG3B,YAAY,EAAE,KAAK,EACnB,aAAa,EAAE,KAAK,EACpB,aAAa,EAAE,KAAK,EACpB,yBAAyB,EAAE,SAAS,CAAC,gBAAgB,CAAC,EACtD,WAAW,SAAI;IAaV,GAAG,CACR,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,QAAQ,GAChB,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;YAmEvB,mBAAmB;CAqCjC"}
@@ -0,0 +1,157 @@
1
+ import { RecoverableError, UnrecoverableError } from "../../../agent/domain/errors.js";
2
+ const getPlannerPrompt = (userPrompt, previousFailureReason) => {
3
+ const feedback = previousFailureReason
4
+ ? `\n\nFeedback from the previous attempt:\n---\n${previousFailureReason}\n---`
5
+ : '';
6
+ return `You are the planner agent. Read the relevant repository code and create a concise, engineering-grade plan for the executor. Cover the requested behaviour, structural issues, affected files or symbols, API contracts and boundaries, important failure paths, and meaningful tests. Keep the plan focused on the current request and do not require an architecture redesign yet.
7
+
8
+ Original user request:
9
+ ---
10
+ ${userPrompt}
11
+ ---${feedback}`;
12
+ };
13
+ const getExecutorPrompt = (userPrompt, plannerPrompt) => `You are the executor agent. Read the relevant repository code and implement the original user request according to the planner's current plan. Preserve contracts and boundaries, handle important failure paths, keep the change focused, and add or update meaningful tests. Inspect and change the code; do not merely describe what should be done.
14
+
15
+ Original user request:
16
+ ---
17
+ ${userPrompt}
18
+ ---
19
+
20
+ Current implementation plan:
21
+ ---
22
+ ${plannerPrompt}
23
+ ---`;
24
+ const getReviewerPrompt = (userPrompt, plannerPrompt, executorResult, parseFailureReason) => {
25
+ const retryNotice = parseFailureReason
26
+ ? `\n\nYour previous response could not be used: ${parseFailureReason} Respond with JSON only, matching the schema exactly, with no surrounding text and no markdown code fences.`
27
+ : '';
28
+ return `You are the reviewer agent. Independently inspect the repository, the current diff, and relevant surrounding code; do not rely on the executor's narrative. Evaluate the original request first; plan compliance is secondary and provides supporting context. Check correctness and logic errors, important failure paths, unused or artificial abstractions, races or shared state, API contract breaks, boundary violations, regressions, scope, and test quality. If it is correct, respond with JSON only: {"decision":"approved"}. If it is not correct, respond with JSON only: {"decision":"rejected","feedback":"list concrete, prioritized findings and the required direction for each"}. The feedback must contain actionable engineering findings, not a general summary.
29
+
30
+ Original user request:
31
+ ---
32
+ ${userPrompt}
33
+ ---
34
+
35
+ Planner's current plan:
36
+ ---
37
+ ${plannerPrompt}
38
+ ---
39
+
40
+ Executor response (context only; verify it independently):
41
+ ---
42
+ ${executorResult}
43
+ ---${retryNotice}`;
44
+ };
45
+ function addToTotals(totals, response) {
46
+ totals.duration += response.duration;
47
+ totals.inputTokens += response.inputTokens;
48
+ totals.outputTokens += response.outputTokens;
49
+ }
50
+ function stripCodeFence(text) {
51
+ const match = /^```(?:json)?\s*([\s\S]*?)\s*```$/.exec(text.trim());
52
+ return match?.[1] ?? text;
53
+ }
54
+ function parseReviewerDecision(response, reviewerDecisionValidator) {
55
+ if (!response?.response) {
56
+ throw new RecoverableError("There's no decision from the reviewer, something went wrong", {
57
+ cause: 'Reviewer decision is missing.',
58
+ });
59
+ }
60
+ let parsedResponse;
61
+ try {
62
+ parsedResponse = JSON.parse(stripCodeFence(response.response));
63
+ }
64
+ catch {
65
+ throw new RecoverableError('Reviewer returned an invalid decision', {
66
+ cause: 'Reviewer response must be valid JSON.',
67
+ });
68
+ }
69
+ const decision = reviewerDecisionValidator.validate(parsedResponse);
70
+ if (!decision) {
71
+ throw new RecoverableError('Reviewer returned an invalid decision', {
72
+ cause: 'Reviewer response did not match the decision schema.',
73
+ });
74
+ }
75
+ return decision;
76
+ }
77
+ export class OrchestratorAgent {
78
+ plannerAgent;
79
+ executorAgent;
80
+ reviewerAgent;
81
+ reviewerDecisionValidator;
82
+ maxAttempts;
83
+ constructor(plannerAgent, executorAgent, reviewerAgent, reviewerDecisionValidator, maxAttempts = 3) {
84
+ if (!Number.isInteger(maxAttempts) || maxAttempts < 1) {
85
+ throw new RangeError('maxAttempts must be a positive integer');
86
+ }
87
+ this.plannerAgent = plannerAgent;
88
+ this.executorAgent = executorAgent;
89
+ this.reviewerAgent = reviewerAgent;
90
+ this.reviewerDecisionValidator = reviewerDecisionValidator;
91
+ this.maxAttempts = maxAttempts;
92
+ }
93
+ async run(prompt, signal, callback) {
94
+ // Per invocation, not per instance: the CLI keeps one orchestrator for a whole session.
95
+ const totals = { duration: 0, inputTokens: 0, outputTokens: 0 };
96
+ let lastFailureReason;
97
+ for (let attempt = 1; attempt <= this.maxAttempts; attempt++) {
98
+ const isLastAttempt = attempt === this.maxAttempts;
99
+ const plannerResponse = await this.plannerAgent.run(getPlannerPrompt(prompt, lastFailureReason), signal, callback);
100
+ if (!plannerResponse?.response) {
101
+ lastFailureReason = 'The planner produced no response.';
102
+ if (isLastAttempt) {
103
+ throw new UnrecoverableError('Max attempts exhausted', { cause: lastFailureReason });
104
+ }
105
+ continue;
106
+ }
107
+ addToTotals(totals, plannerResponse);
108
+ const executorResponse = await this.executorAgent.run(getExecutorPrompt(prompt, plannerResponse.response), signal, callback);
109
+ if (!executorResponse?.response) {
110
+ lastFailureReason = 'The executor produced no response.';
111
+ if (isLastAttempt) {
112
+ throw new UnrecoverableError('Max attempts exhausted', { cause: lastFailureReason });
113
+ }
114
+ continue;
115
+ }
116
+ addToTotals(totals, executorResponse);
117
+ const reviewerDecision = await this.getReviewerDecision(prompt, plannerResponse.response, executorResponse.response, signal, callback, totals);
118
+ if (reviewerDecision.decision === 'approved') {
119
+ return { response: 'All job has finished', ...totals };
120
+ }
121
+ lastFailureReason = reviewerDecision.feedback;
122
+ if (isLastAttempt) {
123
+ throw new UnrecoverableError('Max attempts exhausted', { cause: lastFailureReason });
124
+ }
125
+ }
126
+ throw new UnrecoverableError('Max attempts exhausted', {
127
+ cause: lastFailureReason ?? 'Unknown failure.',
128
+ });
129
+ }
130
+ // Retries only the reviewer call on a malformed decision, instead of redoing
131
+ // planning/execution — a bad or unparsable reviewer response is not evidence
132
+ // the plan or the implementation were wrong.
133
+ async getReviewerDecision(userPrompt, plannerPrompt, executorResult, signal, callback, totals) {
134
+ let parseFailureReason;
135
+ for (let attempt = 1; attempt <= this.maxAttempts; attempt++) {
136
+ const reviewerResponse = await this.reviewerAgent.run(getReviewerPrompt(userPrompt, plannerPrompt, executorResult, parseFailureReason), signal, callback);
137
+ if (reviewerResponse) {
138
+ addToTotals(totals, reviewerResponse);
139
+ }
140
+ try {
141
+ return parseReviewerDecision(reviewerResponse, this.reviewerDecisionValidator);
142
+ }
143
+ catch (error) {
144
+ if (!(error instanceof RecoverableError))
145
+ throw error;
146
+ parseFailureReason = error.cause;
147
+ if (attempt === this.maxAttempts) {
148
+ throw new UnrecoverableError('Max attempts exhausted', { cause: parseFailureReason });
149
+ }
150
+ }
151
+ }
152
+ throw new UnrecoverableError('Max attempts exhausted', {
153
+ cause: parseFailureReason ?? 'Unknown failure.',
154
+ });
155
+ }
156
+ }
157
+ //# sourceMappingURL=orchestratorAgent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestratorAgent.js","sourceRoot":"","sources":["../../../../src/orchestration/domain/model/orchestratorAgent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAIvF,MAAM,gBAAgB,GAAG,CAAC,UAAkB,EAAE,qBAA8B,EAAE,EAAE;IAC/E,MAAM,QAAQ,GAAG,qBAAqB;QACrC,CAAC,CAAC,iDAAiD,qBAAqB,OAAO;QAC/E,CAAC,CAAC,EAAE,CAAC;IAEN,OAAO;;;;EAIN,UAAU;KACP,QAAQ,EAAE,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,UAAkB,EAAE,aAAqB,EAAE,EAAE,CACvE;;;;EAIC,UAAU;;;;;EAKV,aAAa;IACX,CAAC;AAEL,MAAM,iBAAiB,GAAG,CACzB,UAAkB,EAClB,aAAqB,EACrB,cAAsB,EACtB,kBAA2B,EAC1B,EAAE;IACH,MAAM,WAAW,GAAG,kBAAkB;QACrC,CAAC,CAAC,iDAAiD,kBAAkB,6GAA6G;QAClL,CAAC,CAAC,EAAE,CAAC;IAEN,OAAO;;;;EAIN,UAAU;;;;;EAKV,aAAa;;;;;EAKb,cAAc;KACX,WAAW,EAAE,CAAC;AACnB,CAAC,CAAC;AAQF,SAAS,W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cAAsB,EACtB,MAAmB,EACnB,QAAkB,EAClB,MAAiB;QAEjB,IAAI,kBAAsC,CAAC;QAE3C,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,IAAI,IAAI,CAAC,WAAW,EAAE,OAAO,EAAE,EAAE,CAAC;YAC9D,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,CACpD,iBAAiB,CAAC,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,kBAAkB,CAAC,EAChF,MAAM,EACN,QAAQ,CACR,CAAC;YAEF,IAAI,gBAAgB,EAAE,CAAC;gBACtB,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;YACvC,CAAC;YAED,IAAI,CAAC;gBACJ,OAAO,qBAAqB,CAAC,gBAAgB,EAAE,IAAI,CAAC,yBAAyB,CAAC,CAAC;YAChF,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,CAAC,CAAC,KAAK,YAAY,gBAAgB,CAAC;oBAAE,MAAM,KAAK,CAAC;gBAEtD,kBAAkB,GAAG,KAAK,CAAC,KAAK,CAAC;gBACjC,IAAI,OAAO,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC;oBAClC,MAAM,IAAI,kBAAkB,CAAC,wBAAwB,EAAE,EAAE,KAAK,EAAE,kBAAkB,EAAE,CAAC,CAAC;gBACvF,CAAC;YACF,CAAC;QACF,CAAC;QAED,MAAM,IAAI,kBAAkB,CAAC,wBAAwB,EAAE;YACtD,KAAK,EAAE,kBAAkB,IAAI,kBAAkB;SAC/C,CAAC,CAAC;IACJ,CAAC;CACD"}
@@ -0,0 +1,7 @@
1
+ export type ReviewerDecision = {
2
+ decision: 'approved';
3
+ } | {
4
+ decision: 'rejected';
5
+ feedback: string;
6
+ };
7
+ //# sourceMappingURL=reviewerDecision.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reviewerDecision.d.ts","sourceRoot":"","sources":["../../../../src/orchestration/domain/model/reviewerDecision.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAC3B;IAAE,QAAQ,EAAE,UAAU,CAAA;CAAE,GAAG;IAAE,QAAQ,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC"}