@mikode13/harness 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -2
- package/dist/agent/domain/agent.d.ts +13 -4
- package/dist/agent/domain/agent.js.map +1 -1
- package/dist/agent/domain/errors.d.ts +29 -7
- package/dist/agent/domain/errors.js +35 -0
- package/dist/agent/domain/errors.js.map +1 -1
- package/dist/agent/domain/providerFailure.d.ts +0 -1
- package/dist/agent/domain/providerFailure.js.map +1 -1
- package/dist/engines/claude/infrastructure/model/claudeAgent.d.ts +1 -2
- package/dist/engines/claude/infrastructure/model/claudeAgent.js +83 -50
- package/dist/engines/claude/infrastructure/model/claudeAgent.js.map +1 -1
- package/dist/engines/codex/infrastructure/model/codexAgent.d.ts +1 -2
- package/dist/engines/codex/infrastructure/model/codexAgent.js +54 -29
- package/dist/engines/codex/infrastructure/model/codexAgent.js.map +1 -1
- package/dist/engines/domain/model/llmAgent.d.ts +17 -0
- package/dist/engines/domain/model/llmAgent.js +63 -0
- package/dist/engines/domain/model/llmAgent.js.map +1 -0
- package/dist/factory/infrastructure/agentFactory.d.ts +19 -1
- package/dist/factory/infrastructure/agentFactory.js +20 -0
- package/dist/factory/infrastructure/agentFactory.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/llm/domain/conversation.d.ts +20 -0
- package/dist/llm/domain/conversation.js +26 -0
- package/dist/llm/domain/conversation.js.map +1 -0
- package/dist/llm/domain/errors.d.ts +4 -0
- package/dist/llm/domain/errors.js +5 -0
- package/dist/llm/domain/errors.js.map +1 -0
- package/dist/llm/domain/llm.d.ts +18 -0
- package/dist/llm/domain/llm.js +2 -0
- package/dist/llm/domain/llm.js.map +1 -0
- package/dist/llm/domain/message.d.ts +11 -0
- package/dist/llm/domain/message.js +2 -0
- package/dist/llm/domain/message.js.map +1 -0
- package/dist/llm/infrastructure/openAILLMClient.d.ts +22 -0
- package/dist/llm/infrastructure/openAILLMClient.js +172 -0
- package/dist/llm/infrastructure/openAILLMClient.js.map +1 -0
- package/dist/orchestration/domain/interface/validator.d.ts +0 -1
- package/dist/orchestration/domain/interface/validator.js.map +1 -1
- package/dist/orchestration/domain/model/orchestratorAgent.d.ts +2 -2
- package/dist/orchestration/domain/model/orchestratorAgent.js +35 -16
- package/dist/orchestration/domain/model/orchestratorAgent.js.map +1 -1
- package/dist/orchestration/domain/model/reviewerDecision.d.ts +0 -1
- package/dist/orchestration/domain/model/reviewerDecision.js.map +1 -1
- package/dist/orchestration/infrastructure/model/reviewerDecisionValidator.d.ts +0 -1
- package/dist/orchestration/infrastructure/model/reviewerDecisionValidator.js.map +1 -1
- package/dist/retry/domain/model/retryingAgent.d.ts +10 -3
- package/dist/retry/domain/model/retryingAgent.js +40 -10
- package/dist/retry/domain/model/retryingAgent.js.map +1 -1
- package/dist/shared/domain/isAbortError.d.ts +0 -1
- package/dist/shared/domain/isAbortError.js.map +1 -1
- package/dist/shared/domain/isOneOf.d.ts +0 -1
- package/dist/shared/domain/isOneOf.js.map +1 -1
- package/dist/shared/domain/logger.d.ts +0 -1
- package/dist/shared/domain/logger.js.map +1 -1
- package/dist/shared/domain/tokens.d.ts +26 -0
- package/dist/shared/domain/tokens.js +19 -0
- package/dist/shared/domain/tokens.js.map +1 -0
- package/dist/shared/infrastructure/logger.d.ts +0 -1
- package/dist/shared/infrastructure/logger.js.map +1 -1
- package/package.json +4 -2
- package/dist/agent/domain/agent.d.ts.map +0 -1
- package/dist/agent/domain/errors.d.ts.map +0 -1
- package/dist/agent/domain/providerFailure.d.ts.map +0 -1
- package/dist/engines/claude/infrastructure/model/claudeAgent.d.ts.map +0 -1
- package/dist/engines/codex/infrastructure/model/codexAgent.d.ts.map +0 -1
- package/dist/factory/infrastructure/agentFactory.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/orchestration/domain/interface/validator.d.ts.map +0 -1
- package/dist/orchestration/domain/model/orchestratorAgent.d.ts.map +0 -1
- package/dist/orchestration/domain/model/reviewerDecision.d.ts.map +0 -1
- package/dist/orchestration/infrastructure/model/reviewerDecisionValidator.d.ts.map +0 -1
- package/dist/retry/domain/model/retryingAgent.d.ts.map +0 -1
- package/dist/shared/domain/isAbortError.d.ts.map +0 -1
- package/dist/shared/domain/isOneOf.d.ts.map +0 -1
- package/dist/shared/domain/logger.d.ts.map +0 -1
- package/dist/shared/infrastructure/logger.d.ts.map +0 -1
|
@@ -17,8 +17,8 @@ export declare class OrchestratorAgent implements Agent {
|
|
|
17
17
|
maxAttempts?: number;
|
|
18
18
|
logger: ILogger;
|
|
19
19
|
});
|
|
20
|
-
run(prompt: string, signal: AbortSignal, callback: Callback): Promise<AgentResponse
|
|
20
|
+
run(prompt: string, signal: AbortSignal, callback: Callback): Promise<AgentResponse>;
|
|
21
|
+
private runRounds;
|
|
21
22
|
private getReviewerDecision;
|
|
22
23
|
private warn;
|
|
23
24
|
}
|
|
24
|
-
//# sourceMappingURL=orchestratorAgent.d.ts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { addTokens } from "../../../shared/domain/tokens.js";
|
|
2
|
+
import { RecoverableError, UnrecoverableError, withSpentTokens, } from "../../../agent/domain/errors.js";
|
|
2
3
|
import { classifyHostFailure, treatErrors } from "../../../agent/domain/providerFailure.js";
|
|
3
4
|
const getPlannerPrompt = (userPrompt, previousFailureReason) => {
|
|
4
5
|
const feedback = previousFailureReason
|
|
@@ -43,17 +44,22 @@ Executor response (context only; verify it independently):
|
|
|
43
44
|
${executorResult}
|
|
44
45
|
---${retryNotice}`;
|
|
45
46
|
};
|
|
47
|
+
// Every role's response counts, even an empty one that starts another round: it was billed.
|
|
46
48
|
function addToTotals(totals, response) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
totals.
|
|
49
|
+
if (!response.tokens)
|
|
50
|
+
totals.unreported = true;
|
|
51
|
+
totals.tokens = addTokens(totals.tokens, response.tokens);
|
|
52
|
+
}
|
|
53
|
+
/** Unknown rather than partial: a sum missing a billed call must not look complete. */
|
|
54
|
+
function runTokens(totals) {
|
|
55
|
+
return totals.unreported ? undefined : totals.tokens;
|
|
50
56
|
}
|
|
51
57
|
function stripCodeFence(text) {
|
|
52
58
|
const match = /^```(?:json)?\s*([\s\S]*?)\s*```$/.exec(text.trim());
|
|
53
59
|
return match?.[1] ?? text;
|
|
54
60
|
}
|
|
55
61
|
function parseReviewerDecision(response, reviewerDecisionValidator) {
|
|
56
|
-
if (!response
|
|
62
|
+
if (!response.response) {
|
|
57
63
|
throw new RecoverableError("There's no decision from the reviewer, something went wrong", {
|
|
58
64
|
cause: 'Reviewer decision is missing.',
|
|
59
65
|
});
|
|
@@ -94,13 +100,30 @@ export class OrchestratorAgent {
|
|
|
94
100
|
this.logger = logger;
|
|
95
101
|
}
|
|
96
102
|
async run(prompt, signal, callback) {
|
|
103
|
+
const start = Date.now();
|
|
97
104
|
// Per invocation, not per instance: the CLI keeps one orchestrator for a whole session.
|
|
98
|
-
const totals = {
|
|
105
|
+
const totals = { tokens: undefined, unreported: false };
|
|
106
|
+
try {
|
|
107
|
+
await this.runRounds(prompt, signal, callback, totals);
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
// A failing role carries its own tokens; the roles before it are in the totals.
|
|
111
|
+
throw withSpentTokens(error, totals.tokens, totals.unreported);
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
response: 'All job has finished',
|
|
115
|
+
tokens: runTokens(totals),
|
|
116
|
+
// The whole run's wall clock, so it matches what the consumer waited.
|
|
117
|
+
duration: (Date.now() - start) / 1000,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
async runRounds(prompt, signal, callback, totals) {
|
|
99
121
|
let lastFailureReason;
|
|
100
122
|
for (let attempt = 1; attempt <= this.maxAttempts; attempt++) {
|
|
101
123
|
const isLastAttempt = attempt === this.maxAttempts;
|
|
102
124
|
const plannerResponse = await this.plannerAgent.run(getPlannerPrompt(prompt, lastFailureReason), signal, callback);
|
|
103
|
-
|
|
125
|
+
addToTotals(totals, plannerResponse);
|
|
126
|
+
if (!plannerResponse.response) {
|
|
104
127
|
lastFailureReason = 'The planner produced no response.';
|
|
105
128
|
if (isLastAttempt) {
|
|
106
129
|
throw new UnrecoverableError('Max attempts exhausted', { cause: lastFailureReason });
|
|
@@ -108,9 +131,9 @@ export class OrchestratorAgent {
|
|
|
108
131
|
this.warn(`Attempt ${String(attempt)}/${String(this.maxAttempts)}: the planner produced no response; starting another round`);
|
|
109
132
|
continue;
|
|
110
133
|
}
|
|
111
|
-
addToTotals(totals, plannerResponse);
|
|
112
134
|
const executorResponse = await this.executorAgent.run(getExecutorPrompt(prompt, plannerResponse.response), signal, callback);
|
|
113
|
-
|
|
135
|
+
addToTotals(totals, executorResponse);
|
|
136
|
+
if (!executorResponse.response) {
|
|
114
137
|
lastFailureReason = 'The executor produced no response.';
|
|
115
138
|
if (isLastAttempt) {
|
|
116
139
|
throw new UnrecoverableError('Max attempts exhausted', { cause: lastFailureReason });
|
|
@@ -118,11 +141,9 @@ export class OrchestratorAgent {
|
|
|
118
141
|
this.warn(`Attempt ${String(attempt)}/${String(this.maxAttempts)}: the executor produced no response; starting another round`);
|
|
119
142
|
continue;
|
|
120
143
|
}
|
|
121
|
-
addToTotals(totals, executorResponse);
|
|
122
144
|
const reviewerDecision = await this.getReviewerDecision(prompt, plannerResponse.response, executorResponse.response, signal, callback, totals);
|
|
123
|
-
if (reviewerDecision.decision === 'approved')
|
|
124
|
-
return
|
|
125
|
-
}
|
|
145
|
+
if (reviewerDecision.decision === 'approved')
|
|
146
|
+
return;
|
|
126
147
|
lastFailureReason = reviewerDecision.feedback;
|
|
127
148
|
if (isLastAttempt) {
|
|
128
149
|
throw new UnrecoverableError('Max attempts exhausted', { cause: lastFailureReason });
|
|
@@ -140,9 +161,7 @@ export class OrchestratorAgent {
|
|
|
140
161
|
let parseFailureReason;
|
|
141
162
|
for (let attempt = 1; attempt <= this.maxAttempts; attempt++) {
|
|
142
163
|
const reviewerResponse = await this.reviewerAgent.run(getReviewerPrompt(userPrompt, plannerPrompt, executorResult, parseFailureReason), signal, callback);
|
|
143
|
-
|
|
144
|
-
addToTotals(totals, reviewerResponse);
|
|
145
|
-
}
|
|
164
|
+
addToTotals(totals, reviewerResponse);
|
|
146
165
|
try {
|
|
147
166
|
return parseReviewerDecision(reviewerResponse, this.reviewerDecisionValidator);
|
|
148
167
|
}
|
|
@@ -1 +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,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAE5F,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,WAAW,CAAC,MA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wBAAwB,EAAE,EAAE,KAAK,EAAE,kBAAkB,EAAE,CAAC,CAAC;gBACvF,CAAC;gBAED,IAAI,CAAC,IAAI,CACR,qBAAqB,MAAM,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,0CAA0C,EAC1G,kBAAkB,CAClB,CAAC;YACH,CAAC;QACF,CAAC;QAED,MAAM,IAAI,kBAAkB,CAAC,wBAAwB,EAAE;YACtD,KAAK,EAAE,kBAAkB,IAAI,kBAAkB;SAC/C,CAAC,CAAC;IACJ,CAAC;IAEO,IAAI,CAAC,GAAG,IAAe;QAC9B,WAAW,CACV,GAAG,EAAE;YACJ,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;QAC3B,CAAC,EACD,mBAAmB,EACnB,oDAAoD,CACpD,CAAC;IACH,CAAC;CACD"}
|
|
1
|
+
{"version":3,"file":"orchestratorAgent.js","sourceRoot":"","sources":["../../../../src/orchestration/domain/model/orchestratorAgent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAe,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EACN,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,GACf,MAAM,iCAAiC,CAAC;AAIzC,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAE5F,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,CACz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BAAkB;SAC/C,CAAC,CAAC;IACJ,CAAC;IAEO,IAAI,CAAC,GAAG,IAAe;QAC9B,WAAW,CACV,GAAG,EAAE;YACJ,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;QAC3B,CAAC,EACD,mBAAmB,EACnB,oDAAoD,CACpD,CAAC;IACH,CAAC;CACD","sourcesContent":["import type { Agent, AgentResponse, Callback } from '../../../agent/domain/agent.ts';\nimport { addTokens, type Tokens } from '../../../shared/domain/tokens.ts';\nimport {\n\tRecoverableError,\n\tUnrecoverableError,\n\twithSpentTokens,\n} from '../../../agent/domain/errors.ts';\nimport type { ReviewerDecision } from './reviewerDecision.ts';\nimport type { Validator } from '../interface/validator.ts';\nimport type { ILogger } from '../../../shared/domain/logger.ts';\nimport { classifyHostFailure, treatErrors } from '../../../agent/domain/providerFailure.ts';\n\nconst getPlannerPrompt = (userPrompt: string, previousFailureReason?: string) => {\n\tconst feedback = previousFailureReason\n\t\t? `\\n\\nFeedback from the previous attempt:\\n---\\n${previousFailureReason}\\n---`\n\t\t: '';\n\n\treturn `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.\n\nOriginal user request:\n---\n${userPrompt}\n---${feedback}`;\n};\n\nconst getExecutorPrompt = (userPrompt: string, plannerPrompt: string) =>\n\t`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.\n\nOriginal user request:\n---\n${userPrompt}\n---\n\nCurrent implementation plan:\n---\n${plannerPrompt}\n---`;\n\nconst getReviewerPrompt = (\n\tuserPrompt: string,\n\tplannerPrompt: string,\n\texecutorResult: string,\n\tparseFailureReason?: string,\n) => {\n\tconst retryNotice = parseFailureReason\n\t\t? `\\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.`\n\t\t: '';\n\n\treturn `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.\n\nOriginal user request:\n---\n${userPrompt}\n---\n\nPlanner's current plan:\n---\n${plannerPrompt}\n---\n\nExecutor response (context only; verify it independently):\n---\n${executorResult}\n---${retryNotice}`;\n};\n\ninterface RunTotals {\n\ttokens: Tokens | undefined;\n\t/** A role answered without usage, so the run's total cannot be known. */\n\tunreported: boolean;\n}\n\n// Every role's response counts, even an empty one that starts another round: it was billed.\nfunction addToTotals(totals: RunTotals, response: AgentResponse): void {\n\tif (!response.tokens) totals.unreported = true;\n\ttotals.tokens = addTokens(totals.tokens, response.tokens);\n}\n\n/** Unknown rather than partial: a sum missing a billed call must not look complete. */\nfunction runTokens(totals: RunTotals): Tokens | undefined {\n\treturn totals.unreported ? undefined : totals.tokens;\n}\n\nfunction stripCodeFence(text: string): string {\n\tconst match = /^```(?:json)?\\s*([\\s\\S]*?)\\s*```$/.exec(text.trim());\n\treturn match?.[1] ?? text;\n}\n\nfunction parseReviewerDecision(\n\tresponse: AgentResponse,\n\treviewerDecisionValidator: Validator<ReviewerDecision>,\n): ReviewerDecision {\n\tif (!response.response) {\n\t\tthrow new RecoverableError(\"There's no decision from the reviewer, something went wrong\", {\n\t\t\tcause: 'Reviewer decision is missing.',\n\t\t});\n\t}\n\n\tlet parsedResponse: unknown;\n\ttry {\n\t\tparsedResponse = JSON.parse(stripCodeFence(response.response));\n\t} catch {\n\t\tthrow new RecoverableError('Reviewer returned an invalid decision', {\n\t\t\tcause: 'Reviewer response must be valid JSON.',\n\t\t});\n\t}\n\n\tconst decision = reviewerDecisionValidator.validate(parsedResponse);\n\tif (!decision) {\n\t\tthrow new RecoverableError('Reviewer returned an invalid decision', {\n\t\t\tcause: 'Reviewer response did not match the decision schema.',\n\t\t});\n\t}\n\n\treturn decision;\n}\n\nexport class OrchestratorAgent implements Agent {\n\tprivate plannerAgent: Agent;\n\tprivate executorAgent: Agent;\n\tprivate reviewerAgent: Agent;\n\tprivate reviewerDecisionValidator: Validator<ReviewerDecision>;\n\tprivate maxAttempts: number;\n\tprivate logger: ILogger;\n\n\tconstructor({\n\t\tplannerAgent,\n\t\texecutorAgent,\n\t\treviewerAgent,\n\t\treviewerDecisionValidator,\n\t\tmaxAttempts = 3,\n\t\tlogger,\n\t}: {\n\t\tplannerAgent: Agent;\n\t\texecutorAgent: Agent;\n\t\treviewerAgent: Agent;\n\t\treviewerDecisionValidator: Validator<ReviewerDecision>;\n\t\tmaxAttempts?: number;\n\t\tlogger: ILogger;\n\t}) {\n\t\tif (!Number.isInteger(maxAttempts) || maxAttempts < 1) {\n\t\t\tthrow new RangeError('maxAttempts must be a positive integer');\n\t\t}\n\n\t\tthis.plannerAgent = plannerAgent;\n\t\tthis.executorAgent = executorAgent;\n\t\tthis.reviewerAgent = reviewerAgent;\n\t\tthis.reviewerDecisionValidator = reviewerDecisionValidator;\n\t\tthis.maxAttempts = maxAttempts;\n\t\tthis.logger = logger;\n\t}\n\n\tasync run(prompt: string, signal: AbortSignal, callback: Callback): Promise<AgentResponse> {\n\t\tconst start = Date.now();\n\t\t// Per invocation, not per instance: the CLI keeps one orchestrator for a whole session.\n\t\tconst totals: RunTotals = { tokens: undefined, unreported: false };\n\n\t\ttry {\n\t\t\tawait this.runRounds(prompt, signal, callback, totals);\n\t\t} catch (error) {\n\t\t\t// A failing role carries its own tokens; the roles before it are in the totals.\n\t\t\tthrow withSpentTokens(error, totals.tokens, totals.unreported);\n\t\t}\n\n\t\treturn {\n\t\t\tresponse: 'All job has finished',\n\t\t\ttokens: runTokens(totals),\n\t\t\t// The whole run's wall clock, so it matches what the consumer waited.\n\t\t\tduration: (Date.now() - start) / 1000,\n\t\t};\n\t}\n\n\tprivate async runRounds(\n\t\tprompt: string,\n\t\tsignal: AbortSignal,\n\t\tcallback: Callback,\n\t\ttotals: RunTotals,\n\t): Promise<void> {\n\t\tlet lastFailureReason: string | undefined;\n\n\t\tfor (let attempt = 1; attempt <= this.maxAttempts; attempt++) {\n\t\t\tconst isLastAttempt = attempt === this.maxAttempts;\n\n\t\t\tconst plannerResponse = await this.plannerAgent.run(\n\t\t\t\tgetPlannerPrompt(prompt, lastFailureReason),\n\t\t\t\tsignal,\n\t\t\t\tcallback,\n\t\t\t);\n\t\t\taddToTotals(totals, plannerResponse);\n\n\t\t\tif (!plannerResponse.response) {\n\t\t\t\tlastFailureReason = 'The planner produced no response.';\n\t\t\t\tif (isLastAttempt) {\n\t\t\t\t\tthrow new UnrecoverableError('Max attempts exhausted', { cause: lastFailureReason });\n\t\t\t\t}\n\t\t\t\tthis.warn(\n\t\t\t\t\t`Attempt ${String(attempt)}/${String(this.maxAttempts)}: the planner produced no response; starting another round`,\n\t\t\t\t);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst executorResponse = await this.executorAgent.run(\n\t\t\t\tgetExecutorPrompt(prompt, plannerResponse.response),\n\t\t\t\tsignal,\n\t\t\t\tcallback,\n\t\t\t);\n\t\t\taddToTotals(totals, executorResponse);\n\n\t\t\tif (!executorResponse.response) {\n\t\t\t\tlastFailureReason = 'The executor produced no response.';\n\t\t\t\tif (isLastAttempt) {\n\t\t\t\t\tthrow new UnrecoverableError('Max attempts exhausted', { cause: lastFailureReason });\n\t\t\t\t}\n\n\t\t\t\tthis.warn(\n\t\t\t\t\t`Attempt ${String(attempt)}/${String(this.maxAttempts)}: the executor produced no response; starting another round`,\n\t\t\t\t);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst reviewerDecision = await this.getReviewerDecision(\n\t\t\t\tprompt,\n\t\t\t\tplannerResponse.response,\n\t\t\t\texecutorResponse.response,\n\t\t\t\tsignal,\n\t\t\t\tcallback,\n\t\t\t\ttotals,\n\t\t\t);\n\n\t\t\tif (reviewerDecision.decision === 'approved') return;\n\n\t\t\tlastFailureReason = reviewerDecision.feedback;\n\t\t\tif (isLastAttempt) {\n\t\t\t\tthrow new UnrecoverableError('Max attempts exhausted', { cause: lastFailureReason });\n\t\t\t}\n\n\t\t\tthis.warn(\n\t\t\t\t`Attempt ${String(attempt)}/${String(this.maxAttempts)}: the reviewer rejected the round; starting another with its feedback`,\n\t\t\t\tlastFailureReason,\n\t\t\t);\n\t\t}\n\n\t\tthrow new UnrecoverableError('Max attempts exhausted', {\n\t\t\tcause: lastFailureReason ?? 'Unknown failure.',\n\t\t});\n\t}\n\n\t// Retries only the reviewer call on a malformed decision, instead of redoing\n\t// planning/execution — a bad or unparsable reviewer response is not evidence\n\t// the plan or the implementation were wrong.\n\tprivate async getReviewerDecision(\n\t\tuserPrompt: string,\n\t\tplannerPrompt: string,\n\t\texecutorResult: string,\n\t\tsignal: AbortSignal,\n\t\tcallback: Callback,\n\t\ttotals: RunTotals,\n\t): Promise<ReviewerDecision> {\n\t\tlet parseFailureReason: string | undefined;\n\n\t\tfor (let attempt = 1; attempt <= this.maxAttempts; attempt++) {\n\t\t\tconst reviewerResponse = await this.reviewerAgent.run(\n\t\t\t\tgetReviewerPrompt(userPrompt, plannerPrompt, executorResult, parseFailureReason),\n\t\t\t\tsignal,\n\t\t\t\tcallback,\n\t\t\t);\n\n\t\t\taddToTotals(totals, reviewerResponse);\n\n\t\t\ttry {\n\t\t\t\treturn parseReviewerDecision(reviewerResponse, this.reviewerDecisionValidator);\n\t\t\t} catch (error) {\n\t\t\t\tif (!(error instanceof RecoverableError)) throw error;\n\n\t\t\t\tparseFailureReason = error.cause;\n\t\t\t\tif (attempt === this.maxAttempts) {\n\t\t\t\t\tthrow new UnrecoverableError('Max attempts exhausted', { cause: parseFailureReason });\n\t\t\t\t}\n\n\t\t\t\tthis.warn(\n\t\t\t\t\t`Reviewer decision ${String(attempt)}/${String(this.maxAttempts)} was unusable; asking the reviewer again`,\n\t\t\t\t\tparseFailureReason,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tthrow new UnrecoverableError('Max attempts exhausted', {\n\t\t\tcause: parseFailureReason ?? 'Unknown failure.',\n\t\t});\n\t}\n\n\tprivate warn(...args: unknown[]): void {\n\t\ttreatErrors(\n\t\t\t() => {\n\t\t\t\tthis.logger.warn(...args);\n\t\t\t},\n\t\t\tclassifyHostFailure,\n\t\t\t'Orchestrator logger failed while reporting a retry',\n\t\t);\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reviewerDecision.js","sourceRoot":"","sources":["../../../../src/orchestration/domain/model/reviewerDecision.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"reviewerDecision.js","sourceRoot":"","sources":["../../../../src/orchestration/domain/model/reviewerDecision.ts"],"names":[],"mappings":"","sourcesContent":["export type ReviewerDecision =\n\t{ decision: 'approved' } | { decision: 'rejected'; feedback: string };\n"]}
|
|
@@ -3,4 +3,3 @@ import type { ReviewerDecision } from '../../domain/model/reviewerDecision.ts';
|
|
|
3
3
|
export declare class ReviewerDecisionValidator implements Validator<ReviewerDecision> {
|
|
4
4
|
validate(input: unknown): ReviewerDecision | undefined;
|
|
5
5
|
}
|
|
6
|
-
//# sourceMappingURL=reviewerDecisionValidator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reviewerDecisionValidator.js","sourceRoot":"","sources":["../../../../src/orchestration/infrastructure/model/reviewerDecisionValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,sBAAsB,GAAG,CAAC,CAAC,kBAAkB,CAAC,UAAU,EAAE;IAC/D,CAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;IAC7C,CAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;CACjF,CAAC,CAAC;AAEH,MAAM,OAAO,yBAAyB;IACrC,QAAQ,CAAC,KAAc;QACtB,MAAM,MAAM,GAAG,sBAAsB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACvD,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IACjD,CAAC;CACD"}
|
|
1
|
+
{"version":3,"file":"reviewerDecisionValidator.js","sourceRoot":"","sources":["../../../../src/orchestration/infrastructure/model/reviewerDecisionValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,sBAAsB,GAAG,CAAC,CAAC,kBAAkB,CAAC,UAAU,EAAE;IAC/D,CAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;IAC7C,CAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;CACjF,CAAC,CAAC;AAEH,MAAM,OAAO,yBAAyB;IACrC,QAAQ,CAAC,KAAc;QACtB,MAAM,MAAM,GAAG,sBAAsB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACvD,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IACjD,CAAC;CACD","sourcesContent":["import { z } from 'zod';\nimport type { Validator } from '../../domain/interface/validator.ts';\nimport type { ReviewerDecision } from '../../domain/model/reviewerDecision.ts';\n\nconst reviewerDecisionSchema = z.discriminatedUnion('decision', [\n\tz.object({ decision: z.literal('approved') }),\n\tz.object({ decision: z.literal('rejected'), feedback: z.string().trim().min(1) }),\n]);\n\nexport class ReviewerDecisionValidator implements Validator<ReviewerDecision> {\n\tvalidate(input: unknown): ReviewerDecision | undefined {\n\t\tconst result = reviewerDecisionSchema.safeParse(input);\n\t\treturn result.success ? result.data : undefined;\n\t}\n}\n"]}
|
|
@@ -4,11 +4,18 @@ export declare class RetryingAgent implements Agent {
|
|
|
4
4
|
private inner;
|
|
5
5
|
private maxAttempts;
|
|
6
6
|
private logger;
|
|
7
|
-
|
|
7
|
+
private noteFailures;
|
|
8
|
+
constructor({ inner, maxAttempts, logger, noteFailures, }: {
|
|
8
9
|
inner: Agent;
|
|
9
10
|
maxAttempts?: number;
|
|
10
11
|
logger: ILogger;
|
|
12
|
+
/**
|
|
13
|
+
* Appends the previous failure to the retried prompt, so a provider session that may
|
|
14
|
+
* remember the failed turn is told what happened. Off for an agent that records nothing
|
|
15
|
+
* from a failed call, such as `LLMAgent`: there the note would become a permanent user
|
|
16
|
+
* message resent on every later turn.
|
|
17
|
+
*/
|
|
18
|
+
noteFailures?: boolean;
|
|
11
19
|
});
|
|
12
|
-
run(prompt: string, signal: AbortSignal, callback: Callback): Promise<AgentResponse
|
|
20
|
+
run(prompt: string, signal: AbortSignal, callback: Callback): Promise<AgentResponse>;
|
|
13
21
|
}
|
|
14
|
-
//# sourceMappingURL=retryingAgent.d.ts.map
|
|
@@ -1,48 +1,78 @@
|
|
|
1
|
-
import { RecoverableError, UnrecoverableError } from "../../../agent/domain/errors.js";
|
|
1
|
+
import { RecoverableError, UnrecoverableError, withSpentTokens, } from "../../../agent/domain/errors.js";
|
|
2
2
|
import { classifyHostFailure, describeFailure, treatErrors, } from "../../../agent/domain/providerFailure.js";
|
|
3
3
|
import { isAbortError } from "../../../shared/domain/isAbortError.js";
|
|
4
|
+
import { addTokens } from "../../../shared/domain/tokens.js";
|
|
4
5
|
export class RetryingAgent {
|
|
5
6
|
inner;
|
|
6
7
|
maxAttempts;
|
|
7
8
|
logger;
|
|
8
|
-
|
|
9
|
+
noteFailures;
|
|
10
|
+
constructor({ inner, maxAttempts = 3, logger, noteFailures = true, }) {
|
|
9
11
|
if (!Number.isInteger(maxAttempts) || maxAttempts < 1) {
|
|
10
12
|
throw new RangeError('maxAttempts must be a positive integer');
|
|
11
13
|
}
|
|
12
14
|
this.inner = inner;
|
|
13
15
|
this.maxAttempts = maxAttempts;
|
|
14
16
|
this.logger = logger;
|
|
17
|
+
this.noteFailures = noteFailures;
|
|
15
18
|
}
|
|
16
19
|
async run(prompt, signal, callback) {
|
|
20
|
+
const start = Date.now();
|
|
17
21
|
let lastPrompt = null;
|
|
18
|
-
|
|
22
|
+
// Failed attempts were billed too, so they travel with whichever way the run ends.
|
|
23
|
+
let spent;
|
|
24
|
+
// An attempt was answered without usage, so `spent` is only a subtotal.
|
|
25
|
+
let unreported = false;
|
|
26
|
+
for (let attempt = 1;; attempt++) {
|
|
19
27
|
try {
|
|
20
28
|
const promptToSend = lastPrompt ?? prompt;
|
|
21
|
-
|
|
29
|
+
const response = await this.inner.run(promptToSend, signal, callback);
|
|
30
|
+
return {
|
|
31
|
+
...response,
|
|
32
|
+
// Any call answered without usage makes the whole count unknown, not partial.
|
|
33
|
+
tokens: unreported ? undefined : response.tokens && addTokens(spent, response.tokens),
|
|
34
|
+
// Every attempt was waited for, not only the last one.
|
|
35
|
+
duration: (Date.now() - start) / 1000,
|
|
36
|
+
};
|
|
22
37
|
}
|
|
23
38
|
catch (e) {
|
|
24
|
-
if (isAbortError(e)
|
|
39
|
+
if (isAbortError(e))
|
|
25
40
|
throw e;
|
|
41
|
+
if (e instanceof UnrecoverableError)
|
|
42
|
+
throw withSpentTokens(e, spent, unreported);
|
|
26
43
|
// Only a failure the agent classified as recoverable earns another call. An
|
|
27
44
|
// unclassified one breaks the `Agent` contract, so nothing here knows whether
|
|
28
45
|
// replaying it is safe — it may already have written files or run commands.
|
|
29
46
|
if (!(e instanceof RecoverableError))
|
|
30
47
|
throw new UnrecoverableError('The agent failed without classifying the failure', {
|
|
31
48
|
cause: describeFailure(e),
|
|
49
|
+
tokens: spent,
|
|
50
|
+
usageUnreported: unreported,
|
|
32
51
|
});
|
|
52
|
+
spent = addTokens(spent, e.tokens);
|
|
53
|
+
unreported ||= e.usageUnreported;
|
|
33
54
|
if (attempt === this.maxAttempts)
|
|
34
55
|
throw new UnrecoverableError('Max attempts exhausted', {
|
|
35
56
|
cause: `Gave up after ${String(this.maxAttempts)} attempts. Last failure: ${e.cause}`,
|
|
57
|
+
tokens: spent,
|
|
58
|
+
usageUnreported: unreported,
|
|
36
59
|
});
|
|
37
60
|
// Keeps the original request: an attempt that failed before the provider registered
|
|
38
61
|
// the turn left no session that remembers it.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
62
|
+
if (this.noteFailures) {
|
|
63
|
+
lastPrompt = `${prompt}\n\nThe previous attempt failed for the following reason: ${e.cause}`;
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
treatErrors(() => {
|
|
67
|
+
this.logger.warn(`Attempt ${String(attempt)}/${String(this.maxAttempts)} failed; retrying`, e);
|
|
68
|
+
}, classifyHostFailure, 'RetryingAgent logger failed while reporting a retry');
|
|
69
|
+
}
|
|
70
|
+
catch (logFailure) {
|
|
71
|
+
// The attempts already spent their tokens, whatever the logger did.
|
|
72
|
+
throw withSpentTokens(logFailure, spent, unreported);
|
|
73
|
+
}
|
|
43
74
|
}
|
|
44
75
|
}
|
|
45
|
-
return undefined;
|
|
46
76
|
}
|
|
47
77
|
}
|
|
48
78
|
//# sourceMappingURL=retryingAgent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retryingAgent.js","sourceRoot":"","sources":["../../../../src/retry/domain/model/retryingAgent.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"retryingAgent.js","sourceRoot":"","sources":["../../../../src/retry/domain/model/retryingAgent.ts"],"names":[],"mappings":"AACA,OAAO,EACN,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,GACf,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACN,mBAAmB,EACnB,eAAe,EACf,WAAW,GACX,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE,OAAO,EAAE,SAAS,EAAe,MAAM,kCAAkC,CAAC;AAE1E,MAAM,OAAO,aAAa;IACjB,KAAK,CAAQ;IACb,WAAW,CAAS;IACpB,MAAM,CAAU;IAChB,YAAY,CAAU;IAE9B,YAAY,EACX,KAAK,EACL,WAAW,GAAG,CAAC,EACf,MAAM,EACN,YAAY,GAAG,IAAI,GAYnB;QACA,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,WAAW,GAAG,CAAC,EAAE,CAAC;YACvD,MAAM,IAAI,UAAU,CAAC,wCAAwC,CAAC,CAAC;QAChE,CAAC;QAED,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,MAAc,EAAE,MAAmB,EAAE,QAAkB;QAChE,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACzB,IAAI,UAAU,GAAkB,IAAI,CAAC;QACrC,mFAAmF;QACnF,IAAI,KAAyB,CAAC;QAC9B,wEAAwE;QACxE,IAAI,UAAU,GAAG,KAAK,C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E;wBACtD,KAAK,EAAE,iBAAiB,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,4BAA4B,CAAC,CAAC,KAAK,EAAE;wBACrF,MAAM,EAAE,KAAK;wBACb,eAAe,EAAE,UAAU;qBAC3B,CAAC,CAAC;gBAEJ,oFAAoF;gBACpF,8CAA8C;gBAC9C,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;oBACvB,UAAU,GAAG,GAAG,MAAM,6DAA6D,CAAC,CAAC,KAAK,EAAE,CAAC;gBAC9F,CAAC;gBACD,IAAI,CAAC;oBACJ,WAAW,CACV,GAAG,EAAE;wBACJ,IAAI,CAAC,MAAM,CAAC,IAAI,CACf,WAAW,MAAM,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,mBAAmB,EACzE,CAAC,CACD,CAAC;oBACH,CAAC,EACD,mBAAmB,EACnB,qDAAqD,CACrD,CAAC;gBACH,CAAC;gBAAC,OAAO,UAAU,EAAE,CAAC;oBACrB,oEAAoE;oBACpE,MAAM,eAAe,CAAC,UAAU,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;gBACtD,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;CACD","sourcesContent":["import type { Agent, AgentResponse, Callback } from '../../../agent/domain/agent.ts';\nimport {\n\tRecoverableError,\n\tUnrecoverableError,\n\twithSpentTokens,\n} from '../../../agent/domain/errors.ts';\nimport {\n\tclassifyHostFailure,\n\tdescribeFailure,\n\ttreatErrors,\n} from '../../../agent/domain/providerFailure.ts';\nimport { isAbortError } from '../../../shared/domain/isAbortError.ts';\nimport type { ILogger } from '../../../shared/domain/logger.ts';\nimport { addTokens, type Tokens } from '../../../shared/domain/tokens.ts';\n\nexport class RetryingAgent implements Agent {\n\tprivate inner: Agent;\n\tprivate maxAttempts: number;\n\tprivate logger: ILogger;\n\tprivate noteFailures: boolean;\n\n\tconstructor({\n\t\tinner,\n\t\tmaxAttempts = 3,\n\t\tlogger,\n\t\tnoteFailures = true,\n\t}: {\n\t\tinner: Agent;\n\t\tmaxAttempts?: number;\n\t\tlogger: ILogger;\n\t\t/**\n\t\t * Appends the previous failure to the retried prompt, so a provider session that may\n\t\t * remember the failed turn is told what happened. Off for an agent that records nothing\n\t\t * from a failed call, such as `LLMAgent`: there the note would become a permanent user\n\t\t * message resent on every later turn.\n\t\t */\n\t\tnoteFailures?: boolean;\n\t}) {\n\t\tif (!Number.isInteger(maxAttempts) || maxAttempts < 1) {\n\t\t\tthrow new RangeError('maxAttempts must be a positive integer');\n\t\t}\n\n\t\tthis.inner = inner;\n\t\tthis.maxAttempts = maxAttempts;\n\t\tthis.logger = logger;\n\t\tthis.noteFailures = noteFailures;\n\t}\n\n\tasync run(prompt: string, signal: AbortSignal, callback: Callback): Promise<AgentResponse> {\n\t\tconst start = Date.now();\n\t\tlet lastPrompt: string | null = null;\n\t\t// Failed attempts were billed too, so they travel with whichever way the run ends.\n\t\tlet spent: Tokens | undefined;\n\t\t// An attempt was answered without usage, so `spent` is only a subtotal.\n\t\tlet unreported = false;\n\n\t\tfor (let attempt = 1; ; attempt++) {\n\t\t\ttry {\n\t\t\t\tconst promptToSend = lastPrompt ?? prompt;\n\t\t\t\tconst response = await this.inner.run(promptToSend, signal, callback);\n\t\t\t\treturn {\n\t\t\t\t\t...response,\n\t\t\t\t\t// Any call answered without usage makes the whole count unknown, not partial.\n\t\t\t\t\ttokens: unreported ? undefined : response.tokens && addTokens(spent, response.tokens),\n\t\t\t\t\t// Every attempt was waited for, not only the last one.\n\t\t\t\t\tduration: (Date.now() - start) / 1000,\n\t\t\t\t};\n\t\t\t} catch (e) {\n\t\t\t\tif (isAbortError(e)) throw e;\n\t\t\t\tif (e instanceof UnrecoverableError) throw withSpentTokens(e, spent, unreported);\n\n\t\t\t\t// Only a failure the agent classified as recoverable earns another call. An\n\t\t\t\t// unclassified one breaks the `Agent` contract, so nothing here knows whether\n\t\t\t\t// replaying it is safe — it may already have written files or run commands.\n\t\t\t\tif (!(e instanceof RecoverableError))\n\t\t\t\t\tthrow new UnrecoverableError('The agent failed without classifying the failure', {\n\t\t\t\t\t\tcause: describeFailure(e),\n\t\t\t\t\t\ttokens: spent,\n\t\t\t\t\t\tusageUnreported: unreported,\n\t\t\t\t\t});\n\n\t\t\t\tspent = addTokens(spent, e.tokens);\n\t\t\t\tunreported ||= e.usageUnreported;\n\n\t\t\t\tif (attempt === this.maxAttempts)\n\t\t\t\t\tthrow new UnrecoverableError('Max attempts exhausted', {\n\t\t\t\t\t\tcause: `Gave up after ${String(this.maxAttempts)} attempts. Last failure: ${e.cause}`,\n\t\t\t\t\t\ttokens: spent,\n\t\t\t\t\t\tusageUnreported: unreported,\n\t\t\t\t\t});\n\n\t\t\t\t// Keeps the original request: an attempt that failed before the provider registered\n\t\t\t\t// the turn left no session that remembers it.\n\t\t\t\tif (this.noteFailures) {\n\t\t\t\t\tlastPrompt = `${prompt}\\n\\nThe previous attempt failed for the following reason: ${e.cause}`;\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\ttreatErrors(\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\tthis.logger.warn(\n\t\t\t\t\t\t\t\t`Attempt ${String(attempt)}/${String(this.maxAttempts)} failed; retrying`,\n\t\t\t\t\t\t\t\te,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tclassifyHostFailure,\n\t\t\t\t\t\t'RetryingAgent logger failed while reporting a retry',\n\t\t\t\t\t);\n\t\t\t\t} catch (logFailure) {\n\t\t\t\t\t// The attempts already spent their tokens, whatever the logger did.\n\t\t\t\t\tthrow withSpentTokens(logFailure, spent, unreported);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isAbortError.js","sourceRoot":"","sources":["../../../src/shared/domain/isAbortError.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,YAAY,CAAC,CAAU;IACtC,OAAO,CAAC,YAAY,KAAK,IAAI,CAAC,CAAC,IAAI,KAAK,YAAY,CAAC;AACtD,CAAC"}
|
|
1
|
+
{"version":3,"file":"isAbortError.js","sourceRoot":"","sources":["../../../src/shared/domain/isAbortError.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,YAAY,CAAC,CAAU;IACtC,OAAO,CAAC,YAAY,KAAK,IAAI,CAAC,CAAC,IAAI,KAAK,YAAY,CAAC;AACtD,CAAC","sourcesContent":["export function isAbortError(e: unknown): e is Error {\n\treturn e instanceof Error && e.name === 'AbortError';\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isOneOf.js","sourceRoot":"","sources":["../../../src/shared/domain/isOneOf.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,MAAM,UAAU,OAAO,CAAmB,MAAoB,EAAE,KAAa;IAC5E,OAAQ,MAA4B,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACtD,CAAC"}
|
|
1
|
+
{"version":3,"file":"isOneOf.js","sourceRoot":"","sources":["../../../src/shared/domain/isOneOf.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,MAAM,UAAU,OAAO,CAAmB,MAAoB,EAAE,KAAa;IAC5E,OAAQ,MAA4B,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACtD,CAAC","sourcesContent":["/** Narrows untyped input, such as a CLI flag, to one of a fixed set of string literals. */\nexport function isOneOf<T extends string>(values: readonly T[], value: string): value is T {\n\treturn (values as readonly string[]).includes(value);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/shared/domain/logger.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/shared/domain/logger.ts"],"names":[],"mappings":"","sourcesContent":["export interface ILogger {\n\twarn: (...args: unknown[]) => void;\n}\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token counts split into the categories providers bill separately. The fields never
|
|
3
|
+
* overlap: the prompt the model read is `inputTokens + readCacheTokens + writtenCacheTokens`.
|
|
4
|
+
* Each engine converts its provider's counters to this meaning, because providers disagree
|
|
5
|
+
* on whether cached tokens are part of their own input count.
|
|
6
|
+
*
|
|
7
|
+
* These are counts, not a cost. Pricing is out of scope: a run's tokens are not attributed
|
|
8
|
+
* to the model that spent them, and cache writes with different lifetimes share one field.
|
|
9
|
+
*/
|
|
10
|
+
export interface Tokens {
|
|
11
|
+
/** Prompt tokens neither read from nor written to the cache. */
|
|
12
|
+
inputTokens: number;
|
|
13
|
+
/** Prompt tokens read from the provider's prompt cache. */
|
|
14
|
+
readCacheTokens: number;
|
|
15
|
+
/** Prompt tokens written to the prompt cache by this call. */
|
|
16
|
+
writtenCacheTokens: number;
|
|
17
|
+
/** Every generated token, reasoning included. */
|
|
18
|
+
outputTokens: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Sums two counts where a missing side adds nothing, as for a failure that never got an
|
|
22
|
+
* answer. A call the provider answered without usage is different: it was billed, so the
|
|
23
|
+
* layers that accumulate track it apart (`usageUnreported` on an error, missing `tokens` on a
|
|
24
|
+
* response) and report the whole total as unknown, never as this partial sum.
|
|
25
|
+
*/
|
|
26
|
+
export declare function addTokens(a: Tokens | undefined, b: Tokens | undefined): Tokens | undefined;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sums two counts where a missing side adds nothing, as for a failure that never got an
|
|
3
|
+
* answer. A call the provider answered without usage is different: it was billed, so the
|
|
4
|
+
* layers that accumulate track it apart (`usageUnreported` on an error, missing `tokens` on a
|
|
5
|
+
* response) and report the whole total as unknown, never as this partial sum.
|
|
6
|
+
*/
|
|
7
|
+
export function addTokens(a, b) {
|
|
8
|
+
if (!a)
|
|
9
|
+
return b;
|
|
10
|
+
if (!b)
|
|
11
|
+
return a;
|
|
12
|
+
return {
|
|
13
|
+
inputTokens: a.inputTokens + b.inputTokens,
|
|
14
|
+
readCacheTokens: a.readCacheTokens + b.readCacheTokens,
|
|
15
|
+
writtenCacheTokens: a.writtenCacheTokens + b.writtenCacheTokens,
|
|
16
|
+
outputTokens: a.outputTokens + b.outputTokens,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../src/shared/domain/tokens.ts"],"names":[],"mappings":"AAoBA;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,CAAqB,EAAE,CAAqB;IACrE,IAAI,CAAC,CAAC;QAAE,OAAO,CAAC,CAAC;IACjB,IAAI,CAAC,CAAC;QAAE,OAAO,CAAC,CAAC;IAEjB,OAAO;QACN,WAAW,EAAE,CAAC,CAAC,WAAW,GAAG,CAAC,CAAC,WAAW;QAC1C,eAAe,EAAE,CAAC,CAAC,eAAe,GAAG,CAAC,CAAC,eAAe;QACtD,kBAAkB,EAAE,CAAC,CAAC,kBAAkB,GAAG,CAAC,CAAC,kBAAkB;QAC/D,YAAY,EAAE,CAAC,CAAC,YAAY,GAAG,CAAC,CAAC,YAAY;KAC7C,CAAC;AACH,CAAC","sourcesContent":["/**\n * Token counts split into the categories providers bill separately. The fields never\n * overlap: the prompt the model read is `inputTokens + readCacheTokens + writtenCacheTokens`.\n * Each engine converts its provider's counters to this meaning, because providers disagree\n * on whether cached tokens are part of their own input count.\n *\n * These are counts, not a cost. Pricing is out of scope: a run's tokens are not attributed\n * to the model that spent them, and cache writes with different lifetimes share one field.\n */\nexport interface Tokens {\n\t/** Prompt tokens neither read from nor written to the cache. */\n\tinputTokens: number;\n\t/** Prompt tokens read from the provider's prompt cache. */\n\treadCacheTokens: number;\n\t/** Prompt tokens written to the prompt cache by this call. */\n\twrittenCacheTokens: number;\n\t/** Every generated token, reasoning included. */\n\toutputTokens: number;\n}\n\n/**\n * Sums two counts where a missing side adds nothing, as for a failure that never got an\n * answer. A call the provider answered without usage is different: it was billed, so the\n * layers that accumulate track it apart (`usageUnreported` on an error, missing `tokens` on a\n * response) and report the whole total as unknown, never as this partial sum.\n */\nexport function addTokens(a: Tokens | undefined, b: Tokens | undefined): Tokens | undefined {\n\tif (!a) return b;\n\tif (!b) return a;\n\n\treturn {\n\t\tinputTokens: a.inputTokens + b.inputTokens,\n\t\treadCacheTokens: a.readCacheTokens + b.readCacheTokens,\n\t\twrittenCacheTokens: a.writtenCacheTokens + b.writtenCacheTokens,\n\t\toutputTokens: a.outputTokens + b.outputTokens,\n\t};\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/shared/infrastructure/logger.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,MAAM;IAClB,IAAI,CAAC,GAAG,IAAe;QACtB,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IACvB,CAAC;CACD"}
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/shared/infrastructure/logger.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,MAAM;IAClB,IAAI,CAAC,GAAG,IAAe;QACtB,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IACvB,CAAC;CACD","sourcesContent":["import type { ILogger } from '../domain/logger.ts';\n\nexport class Logger implements ILogger {\n\twarn(...args: unknown[]): void {\n\t\tconsole.warn(...args);\n\t}\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikode13/harness",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Test/agent harness utility",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -41,9 +41,10 @@
|
|
|
41
41
|
"check": "pnpm run format:check && pnpm run lint && pnpm run typecheck"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
+
"@anthropic-ai/sdk": "^0.115.0",
|
|
44
45
|
"@mikode13/code-quality": "1.0.0",
|
|
45
|
-
"@mikode13/cross-platform": "1.0.0",
|
|
46
46
|
"@mikode13/code-style": "1.0.0",
|
|
47
|
+
"@mikode13/cross-platform": "1.1.0",
|
|
47
48
|
"@mikode13/git-hooks": "1.0.0",
|
|
48
49
|
"@mikode13/tsconfig": "1.0.0",
|
|
49
50
|
"@types/node": "^26.1.2",
|
|
@@ -56,6 +57,7 @@
|
|
|
56
57
|
"dependencies": {
|
|
57
58
|
"@anthropic-ai/claude-agent-sdk": "^0.3.220",
|
|
58
59
|
"@openai/codex-sdk": "^0.154.0",
|
|
60
|
+
"openai": "^7.23.0",
|
|
59
61
|
"zod": "^4.4.3"
|
|
60
62
|
}
|
|
61
63
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../src/agent/domain/agent.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,aAAa;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IAErB,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;AAErD;;;;GAIG;AACH,MAAM,MAAM,aAAa,GACtB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GACvD;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACtC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,OAAO,EAAE;QA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|
1
|
-
{"version":3,"file":"providerFailure.d.ts","sourceRoot":"","sources":["../../../src/agent/domain/providerFailure.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,CAK9E;AAED,uGAAuG;AACvG,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,CAK1E;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC5B,SAAS,EAAE,MAAM,CAAC,EAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,KAAK,EACpD,OAAO,EAAE,MAAM,GACb,CAAC,CAMH;AAED,uFAAuF;AACvF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,CAK3E;AAED,oGAAoG;AACpG,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAMtD;AAED;;;;;GAKG;AACH,wBAAuB,wBAAwB,CAAC,CAAC,EAChD,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,EACxB,OAAO,EAAE,MAAM,GACb,cAAc,CAAC,CAAC,CAAC,CAsCnB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"claudeAgent.d.ts","sourceRoot":"","sources":["../../../../../src/engines/claude/infrastructure/model/claudeAgent.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACX,KAAK,EACL,aAAa,EACb,QAAQ,EAER,MAAM,mCAAmC,CAAC;AAS3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAInE,eAAO,MAAM,YAAY,+CAAgD,CAAC;AAC1E,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAExD,eAAO,MAAM,sB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G,KAAK,IAAI,aAAa,CAErE;AAED,MAAM,WAAW,kBAAkB;IAClC,mEAAmE;IACnE,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,4BAA4B;IAC5B,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,0EAA0E;IAC1E,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,sCAAsC;IACtC,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB;AAOD;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAC1B,QAAQ,EAAE,aAAa,EACvB,EAAE,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAqB,EAAE,GAAE,kBAAuB,GACrF,KAAK,CA8BP;AAED,MAAM,WAAW,yBAAyB;IACzC;;;OAGG;IACH,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,2EAA2E;IAC3E,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,sCAAsC;IACtC,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB;AA8BD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,EAClC,QAAQ,EACR,WAAW,EACX,MAAqB,GACrB,GAAE,yBAA8B,GAAG,KAAK,CAkBxC"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EACN,cAAc,EACd,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,eAAe,GACpB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EACN,KAAK,KAAK,EACV,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,aAAa,GAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,GAClB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
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;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAuGhE,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;IAC5B,OAAO,CAAC,MAAM,CAAU;gBAEZ,EACX,YAAY,EACZ,aAAa,EACb,aAAa,EACb,yBAAyB,EACzB,WAAe,EACf,MAAM,GACN,EAAE;QACF,YAAY,EAAE,KAAK,CAAC;QACpB,aAAa,EAAE,KAAK,CAAC;QACrB,aAAa,EAAE,KAAK,CAAC;QACrB,yBAAyB,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAC;QACvD,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,MAAM,EAAE,OAAO,CAAC;KAChB;IAaK,GAAG,CACR,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,QAAQ,GAChB,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;YA+EvB,mBAAmB;IA2CjC,OAAO,CAAC,IAAI;CASZ"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reviewerDecisionValidator.d.ts","sourceRoot":"","sources":["../../../../src/orchestration/infrastructure/model/reviewerDecisionValidator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAO/E,qBAAa,yBAA0B,YAAW,SAAS,CAAC,gBAAgB,CAAC;IAC5E,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,GAAG,SAAS;CAItD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"retryingAgent.d.ts","sourceRoot":"","sources":["../../../../src/retry/domain/model/retryingAgent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAQrF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAEhE,qBAAa,aAAc,YAAW,KAAK;IAC1C,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,MAAM,CAAU;gBAEZ,EACX,KAAK,EACL,WAAe,EACf,MAAM,GACN,EAAE;QACF,KAAK,EAAE,KAAK,CAAC;QACb,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,MAAM,EAAE,OAAO,CAAC;KAChB;IAUK,GAAG,CACR,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,QAAQ,GAChB,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CAuCrC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isAbortError.d.ts","sourceRoot":"","sources":["../../../src/shared/domain/isAbortError.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,KAAK,CAEnD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isOneOf.d.ts","sourceRoot":"","sources":["../../../src/shared/domain/isOneOf.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,CAAC,CAEzF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/shared/domain/logger.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACvB,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;CACnC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/shared/infrastructure/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,qBAAa,MAAO,YAAW,OAAO;IACrC,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;CAG9B"}
|