aspectcode 0.3.5 → 0.4.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/dist/cli.d.ts +1 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1 -2
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +0 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/diffSummary.d.ts +17 -0
- package/dist/diffSummary.d.ts.map +1 -0
- package/dist/diffSummary.js +49 -0
- package/dist/diffSummary.js.map +1 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +13 -16
- package/dist/main.js.map +1 -1
- package/dist/optimize.d.ts +6 -3
- package/dist/optimize.d.ts.map +1 -1
- package/dist/optimize.js +85 -102
- package/dist/optimize.js.map +1 -1
- package/dist/pipeline.d.ts +5 -4
- package/dist/pipeline.d.ts.map +1 -1
- package/dist/pipeline.js +45 -10
- package/dist/pipeline.js.map +1 -1
- package/dist/summary.d.ts +15 -0
- package/dist/summary.d.ts.map +1 -0
- package/dist/summary.js +51 -0
- package/dist/summary.js.map +1 -0
- package/dist/ui/Dashboard.d.ts +15 -7
- package/dist/ui/Dashboard.d.ts.map +1 -1
- package/dist/ui/Dashboard.js +55 -24
- package/dist/ui/Dashboard.js.map +1 -1
- package/dist/ui/store.d.ts +33 -0
- package/dist/ui/store.d.ts.map +1 -1
- package/dist/ui/store.js +24 -1
- package/dist/ui/store.js.map +1 -1
- package/node_modules/@aspectcode/evaluator/dist/index.d.ts +1 -0
- package/node_modules/@aspectcode/evaluator/dist/index.d.ts.map +1 -1
- package/node_modules/@aspectcode/evaluator/dist/index.js.map +1 -1
- package/node_modules/@aspectcode/evaluator/dist/runner.d.ts +11 -1
- package/node_modules/@aspectcode/evaluator/dist/runner.d.ts.map +1 -1
- package/node_modules/@aspectcode/evaluator/dist/runner.js +5 -2
- package/node_modules/@aspectcode/evaluator/dist/runner.js.map +1 -1
- package/node_modules/@aspectcode/evaluator/package.json +2 -2
- package/node_modules/@aspectcode/optimizer/dist/agent.d.ts +12 -13
- package/node_modules/@aspectcode/optimizer/dist/agent.d.ts.map +1 -1
- package/node_modules/@aspectcode/optimizer/dist/agent.js +52 -110
- package/node_modules/@aspectcode/optimizer/dist/agent.js.map +1 -1
- package/node_modules/@aspectcode/optimizer/dist/index.d.ts +3 -3
- package/node_modules/@aspectcode/optimizer/dist/index.d.ts.map +1 -1
- package/node_modules/@aspectcode/optimizer/dist/index.js +3 -5
- package/node_modules/@aspectcode/optimizer/dist/index.js.map +1 -1
- package/node_modules/@aspectcode/optimizer/dist/prompts.d.ts +8 -21
- package/node_modules/@aspectcode/optimizer/dist/prompts.d.ts.map +1 -1
- package/node_modules/@aspectcode/optimizer/dist/prompts.js +36 -94
- package/node_modules/@aspectcode/optimizer/dist/prompts.js.map +1 -1
- package/node_modules/@aspectcode/optimizer/dist/providers/anthropic.d.ts.map +1 -1
- package/node_modules/@aspectcode/optimizer/dist/providers/anthropic.js +10 -1
- package/node_modules/@aspectcode/optimizer/dist/providers/anthropic.js.map +1 -1
- package/node_modules/@aspectcode/optimizer/dist/providers/openai.d.ts.map +1 -1
- package/node_modules/@aspectcode/optimizer/dist/providers/openai.js +10 -1
- package/node_modules/@aspectcode/optimizer/dist/providers/openai.js.map +1 -1
- package/node_modules/@aspectcode/optimizer/dist/types.d.ts +33 -24
- package/node_modules/@aspectcode/optimizer/dist/types.d.ts.map +1 -1
- package/node_modules/@aspectcode/optimizer/dist/types.js.map +1 -1
- package/node_modules/@aspectcode/optimizer/package.json +2 -2
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,YAAY,EACV,KAAK,EACL,aAAa,EACb,WAAW,EACX,cAAc,EACd,SAAS,EACT,UAAU,EACV,eAAe,EACf,YAAY,EACZ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AAiC;IACjC,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,cAAc;IACd,GAAG,CAAC,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAC9B,oBAAoB;IACpB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAqC5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAyDH,4BAkDC;AArFD,+DAA+D;AAC/D,mCAA0C;AAAjC,wGAAA,cAAc,OAAA;AAEvB,+DAA+D;AAC/D,mCAAqC;AAA5B,mGAAA,SAAS,OAAA;AAGlB,+DAA+D;AAC/D,yCAA4D;AAAnD,qGAAA,QAAQ,OAAA;AAAE,gHAAA,mBAAmB,OAAA;AAEtC,+DAA+D;AAC/D,yCASyB;AARvB,uGAAA,cAAc,OAAA;AACd,qGAAA,YAAY,OAAA;AACZ,0GAAA,iBAAiB,OAAA;AACjB,qGAAA,YAAY,OAAA;AACZ,2GAAA,kBAAkB,OAAA;AAClB,sGAAA,aAAa,OAAA;AACb,wGAAA,eAAe,OAAA;AACf,sGAAA,aAAa,OAAA;AAMf,qCAA0C;AAC1C,qCAAqC;AACrC,2CAAuC;AAEvC;;;;;GAKG;AACI,KAAK,UAAU,QAAQ,CAAC,OAa9B;IACC,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAErF,0BAA0B;IAC1B,MAAM,MAAM,GAAG,IAAA,uBAAc,EAAC,YAAY,CAAC,CAAC;IAE5C,qBAAqB;IACrB,MAAM,YAAY,GAAG,MAAM,IAAA,kBAAS,EAClC,aAAa,EACb,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,GAAG,EACH,MAAM,CACP,CAAC;IAEF,MAAM,QAAQ,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAEvD,yCAAyC;IACzC,IAAI,SAAS,CAAC;IACd,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,SAAS,GAAG,MAAM,IAAA,oBAAQ,EACxB,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,GAAG,EACH,MAAM,CACP,CAAC;IACJ,CAAC;IAED,OAAO;QACL,YAAY;QACZ,SAAS;QACT,SAAS,EAAE,YAAY,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM;QAChD,SAAS,EAAE,QAAQ,CAAC,MAAM;QAC1B,WAAW,EAAE,YAAY,CAAC,MAAM;KACjC,CAAC;AACJ,CAAC"}
|
|
@@ -23,12 +23,22 @@ declare function parseBehaviorEval(response: string, expectedBehaviors: string[]
|
|
|
23
23
|
results: BehaviorResult[];
|
|
24
24
|
allPassed: boolean;
|
|
25
25
|
};
|
|
26
|
+
/** Callback invoked before/after each probe for live progress updates. */
|
|
27
|
+
export interface ProbeProgressCallback {
|
|
28
|
+
(info: {
|
|
29
|
+
probeIndex: number;
|
|
30
|
+
total: number;
|
|
31
|
+
probeId: string;
|
|
32
|
+
phase: 'starting' | 'done';
|
|
33
|
+
passed?: boolean;
|
|
34
|
+
}): void;
|
|
35
|
+
}
|
|
26
36
|
/**
|
|
27
37
|
* Run all probes against the current AGENTS.md.
|
|
28
38
|
*
|
|
29
39
|
* Each probe is run sequentially (to respect rate limits).
|
|
30
40
|
* Returns results for all probes.
|
|
31
41
|
*/
|
|
32
|
-
export declare function runProbes(agentsContent: string, probes: Probe[], provider: LlmProvider, fileContents?: ReadonlyMap<string, string>, log?: OptLogger, signal?: AbortSignal): Promise<ProbeResult[]>;
|
|
42
|
+
export declare function runProbes(agentsContent: string, probes: Probe[], provider: LlmProvider, fileContents?: ReadonlyMap<string, string>, log?: OptLogger, signal?: AbortSignal, onProbeProgress?: ProbeProgressCallback): Promise<ProbeResult[]>;
|
|
33
43
|
export { buildProbeSystemPrompt, buildBehaviorEvalPrompt, parseBehaviorEval };
|
|
34
44
|
//# sourceMappingURL=runner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAe,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACjF,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAKlE;;;GAGG;AACH,iBAAS,sBAAsB,CAC7B,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,KAAK,EACZ,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACzC,MAAM,CAqBR;AAED;;;GAGG;AACH,iBAAS,uBAAuB,CAC9B,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,MAAM,GACf,MAAM,CA2BR;AAED,0DAA0D;AAC1D,iBAAS,iBAAiB,CACxB,QAAQ,EAAE,MAAM,EAChB,iBAAiB,EAAE,MAAM,EAAE,GAC1B;IAAE,OAAO,EAAE,cAAc,EAAE,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAkBnD;AAkGD;;;;;GAKG;AACH,wBAAsB,SAAS,CAC7B,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,KAAK,EAAE,EACf,QAAQ,EAAE,WAAW,EACrB,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EAC1C,GAAG,CAAC,EAAE,SAAS,EACf,MAAM,CAAC,EAAE,WAAW,
|
|
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AC,WAAW,EAAE,CAAC,CAwBxB;AAGD,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -169,13 +169,16 @@ async function runSingleProbe(probe, agentsContent, provider, fileContents, log,
|
|
|
169
169
|
* Each probe is run sequentially (to respect rate limits).
|
|
170
170
|
* Returns results for all probes.
|
|
171
171
|
*/
|
|
172
|
-
async function runProbes(agentsContent, probes, provider, fileContents, log, signal) {
|
|
172
|
+
async function runProbes(agentsContent, probes, provider, fileContents, log, signal, onProbeProgress) {
|
|
173
173
|
const results = [];
|
|
174
|
-
for (
|
|
174
|
+
for (let idx = 0; idx < probes.length; idx++) {
|
|
175
|
+
const probe = probes[idx];
|
|
175
176
|
if (signal?.aborted)
|
|
176
177
|
break;
|
|
178
|
+
onProbeProgress?.({ probeIndex: idx, total: probes.length, probeId: probe.id, phase: 'starting' });
|
|
177
179
|
const result = await runSingleProbe(probe, agentsContent, provider, fileContents, log, signal);
|
|
178
180
|
results.push(result);
|
|
181
|
+
onProbeProgress?.({ probeIndex: idx, total: probes.length, probeId: probe.id, phase: 'done', passed: result.passed });
|
|
179
182
|
log?.info(` ${result.passed ? '✔' : '✖'} ${probe.id}`);
|
|
180
183
|
}
|
|
181
184
|
return results;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;
|
|
1
|
+
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AA8MH,8BAgCC;AAGQ,wDAAsB;AAAE,0DAAuB;AAAE,8CAAiB;AA5O3E,4DAA4D;AAC5D,MAAM,iBAAiB,GAAG,KAAM,CAAC;AAEjC;;;GAGG;AACH,SAAS,sBAAsB,CAC7B,aAAqB,EACrB,KAAY,EACZ,YAA0C;IAE1C,IAAI,MAAM,GAAG,yEAAyE,aAAa,EAAE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": "Evidence-based evaluation for Aspect Code",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@aspectcode/core": "0.3.1",
|
|
28
|
-
"@aspectcode/optimizer": "0.
|
|
28
|
+
"@aspectcode/optimizer": "0.4.0"
|
|
29
29
|
},
|
|
30
30
|
"optionalDependencies": {
|
|
31
31
|
"better-sqlite3": "^11.0.0"
|
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Generation agent — generates AGENTS.md from scratch using static analysis.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* scoring to iterate. Set `maxIterations > 1` to enable.
|
|
10
|
-
*
|
|
11
|
-
* The recommended workflow is single-pass + evaluator:
|
|
12
|
-
* optimize (1 call) → probe-test → diagnose → apply edits
|
|
4
|
+
* Single-pass: one LLM call produces the instructions content.
|
|
5
|
+
* The KB (static analysis) is provided as context in the system prompt.
|
|
6
|
+
* Quality assessment is handled externally by the evaluator package
|
|
7
|
+
* (@aspectcode/evaluator) via probe-based testing:
|
|
8
|
+
* generate (1 call) → probe-test → diagnose → apply edits
|
|
13
9
|
*/
|
|
14
10
|
import type { OptimizeOptions, OptimizeResult, ComplaintOptions, ComplaintResult } from './types';
|
|
15
11
|
/**
|
|
16
|
-
* Run the
|
|
12
|
+
* Run the generation agent — single-pass LLM generation.
|
|
17
13
|
*
|
|
18
|
-
*
|
|
14
|
+
* Generates AGENTS.md content from scratch using the KB (static analysis)
|
|
15
|
+
* as context. The LLM sees the full knowledge base in the system prompt
|
|
16
|
+
* and produces codebase-specific instructions in one call.
|
|
17
|
+
* The evaluator package handles quality feedback externally.
|
|
19
18
|
*/
|
|
20
|
-
export declare function
|
|
19
|
+
export declare function runGenerateAgent(options: OptimizeOptions): Promise<OptimizeResult>;
|
|
21
20
|
/**
|
|
22
21
|
* Process user complaints by asking the LLM to update AGENTS.md instructions.
|
|
23
22
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAA0B,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAQ1H;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CA8DxF;AAID;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CA0C3F"}
|
|
@@ -1,128 +1,70 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Generation agent — generates AGENTS.md from scratch using static analysis.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* scoring to iterate. Set `maxIterations > 1` to enable.
|
|
11
|
-
*
|
|
12
|
-
* The recommended workflow is single-pass + evaluator:
|
|
13
|
-
* optimize (1 call) → probe-test → diagnose → apply edits
|
|
5
|
+
* Single-pass: one LLM call produces the instructions content.
|
|
6
|
+
* The KB (static analysis) is provided as context in the system prompt.
|
|
7
|
+
* Quality assessment is handled externally by the evaluator package
|
|
8
|
+
* (@aspectcode/evaluator) via probe-based testing:
|
|
9
|
+
* generate (1 call) → probe-test → diagnose → apply edits
|
|
14
10
|
*/
|
|
15
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.
|
|
12
|
+
exports.runGenerateAgent = runGenerateAgent;
|
|
17
13
|
exports.runComplaintAgent = runComplaintAgent;
|
|
18
14
|
const prompts_1 = require("./prompts");
|
|
19
|
-
/** Default minimum eval score to accept a candidate without further iteration. */
|
|
20
|
-
const DEFAULT_ACCEPT_THRESHOLD = 8;
|
|
21
|
-
/** Helper: sleep for `ms` milliseconds. */
|
|
22
|
-
function sleep(ms) {
|
|
23
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
24
|
-
}
|
|
25
15
|
/**
|
|
26
|
-
* Run the
|
|
16
|
+
* Run the generation agent — single-pass LLM generation.
|
|
27
17
|
*
|
|
28
|
-
*
|
|
18
|
+
* Generates AGENTS.md content from scratch using the KB (static analysis)
|
|
19
|
+
* as context. The LLM sees the full knowledge base in the system prompt
|
|
20
|
+
* and produces codebase-specific instructions in one call.
|
|
21
|
+
* The evaluator package handles quality feedback externally.
|
|
29
22
|
*/
|
|
30
|
-
async function
|
|
31
|
-
const { currentInstructions, kb, kbDiff, toolInstructions,
|
|
23
|
+
async function runGenerateAgent(options) {
|
|
24
|
+
const { currentInstructions, kb, kbDiff, toolInstructions, provider, log, signal, kbCharBudget, onProgress, } = options;
|
|
25
|
+
// Fallback content when we can't generate (cancellation / LLM error).
|
|
26
|
+
const fallback = currentInstructions ?? '';
|
|
27
|
+
if (signal?.aborted) {
|
|
28
|
+
log?.info('Generation cancelled.');
|
|
29
|
+
return {
|
|
30
|
+
optimizedInstructions: fallback,
|
|
31
|
+
reasoning: ['Cancelled by user'],
|
|
32
|
+
};
|
|
33
|
+
}
|
|
32
34
|
const systemPrompt = (0, prompts_1.buildSystemPrompt)(kb, kbCharBudget, toolInstructions);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
log?.debug(`Waiting ${iterationDelayMs}ms before next iteration…`);
|
|
48
|
-
await sleep(iterationDelayMs);
|
|
49
|
-
if (signal?.aborted) {
|
|
50
|
-
log?.info('Optimization cancelled during delay.');
|
|
51
|
-
reasoning.push(`Iteration ${i + 1}: cancelled by user`);
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
log?.info(`Optimize iteration ${i + 1}/${maxIterations}…`);
|
|
56
|
-
// ── Step 1: Generate optimized candidate ─────────────
|
|
57
|
-
const optimizeMessages = [
|
|
58
|
-
{ role: 'system', content: systemPrompt },
|
|
59
|
-
{ role: 'user', content: (0, prompts_1.buildOptimizePrompt)(currentInstructions, kbDiff, priorFeedback) },
|
|
60
|
-
];
|
|
61
|
-
let candidate;
|
|
62
|
-
try {
|
|
63
|
-
candidate = await provider.chat(optimizeMessages);
|
|
64
|
-
}
|
|
65
|
-
catch (err) {
|
|
66
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
67
|
-
log?.error(`LLM call failed: ${msg}`);
|
|
68
|
-
reasoning.push(`Iteration ${i + 1}: LLM error — ${msg}`);
|
|
69
|
-
break;
|
|
70
|
-
}
|
|
71
|
-
// ── Step 2: Self-evaluate ────────────────────────────
|
|
72
|
-
if (signal?.aborted) {
|
|
73
|
-
// Accept the candidate we just got since we can't eval
|
|
74
|
-
if (bestScore === 0) {
|
|
75
|
-
bestCandidate = candidate;
|
|
76
|
-
}
|
|
77
|
-
reasoning.push(`Iteration ${i + 1}: cancelled before eval`);
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
log?.debug(`Evaluating candidate (iteration ${i + 1})…`);
|
|
81
|
-
let evalResult;
|
|
82
|
-
try {
|
|
83
|
-
const evalMessages = [
|
|
84
|
-
{ role: 'user', content: (0, prompts_1.buildEvalPrompt)(candidate, kb, kbCharBudget) },
|
|
85
|
-
];
|
|
86
|
-
const evalResponse = await provider.chat(evalMessages);
|
|
87
|
-
evalResult = (0, prompts_1.parseEvalResponse)(evalResponse);
|
|
88
|
-
}
|
|
89
|
-
catch (err) {
|
|
90
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
91
|
-
log?.warn(`Eval call failed: ${msg}. Tracking candidate as best-effort.`);
|
|
92
|
-
reasoning.push(`Iteration ${i + 1}: eval error — ${msg}`);
|
|
93
|
-
// Track as best candidate if nothing better exists, but don't auto-accept
|
|
94
|
-
if (bestScore === 0) {
|
|
95
|
-
bestCandidate = candidate;
|
|
96
|
-
}
|
|
97
|
-
continue;
|
|
98
|
-
}
|
|
99
|
-
reasoning.push(`Iteration ${i + 1}: score=${evalResult.score}/10 — ${evalResult.feedback}`);
|
|
100
|
-
log?.info(` Score: ${evalResult.score}/10`);
|
|
101
|
-
// Track best candidate
|
|
102
|
-
if (evalResult.score > bestScore) {
|
|
103
|
-
bestScore = evalResult.score;
|
|
104
|
-
bestCandidate = candidate;
|
|
35
|
+
// ── Generate instructions from scratch ────────────────────────
|
|
36
|
+
onProgress?.({ kind: 'generating', detail: 'generating AGENTS.md…' });
|
|
37
|
+
log?.info('Generating AGENTS.md from static analysis…');
|
|
38
|
+
const generateMessages = [
|
|
39
|
+
{ role: 'system', content: systemPrompt },
|
|
40
|
+
{ role: 'user', content: (0, prompts_1.buildGeneratePrompt)(kbDiff) },
|
|
41
|
+
];
|
|
42
|
+
let candidate;
|
|
43
|
+
let usage;
|
|
44
|
+
try {
|
|
45
|
+
if (provider.chatWithUsage) {
|
|
46
|
+
const result = await provider.chatWithUsage(generateMessages);
|
|
47
|
+
candidate = result.content;
|
|
48
|
+
usage = result.usage;
|
|
105
49
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
log?.info(` Accepted (score ≥ ${acceptThreshold})`);
|
|
109
|
-
return {
|
|
110
|
-
optimizedInstructions: candidate,
|
|
111
|
-
iterations: i + 1,
|
|
112
|
-
reasoning,
|
|
113
|
-
};
|
|
50
|
+
else {
|
|
51
|
+
candidate = await provider.chat(generateMessages);
|
|
114
52
|
}
|
|
115
|
-
// Build feedback for next iteration
|
|
116
|
-
priorFeedback =
|
|
117
|
-
`Score: ${evalResult.score}/10\n${evalResult.feedback}\n\nSuggestions:\n` +
|
|
118
|
-
evalResult.suggestions.map((s) => `- ${s}`).join('\n');
|
|
119
53
|
}
|
|
120
|
-
|
|
121
|
-
|
|
54
|
+
catch (err) {
|
|
55
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
56
|
+
log?.error(`LLM call failed: ${msg}`);
|
|
57
|
+
return {
|
|
58
|
+
optimizedInstructions: fallback,
|
|
59
|
+
reasoning: [`LLM error — ${msg}`],
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
onProgress?.({ kind: 'done', detail: 'generation complete' });
|
|
63
|
+
log?.info('Generation complete.');
|
|
122
64
|
return {
|
|
123
|
-
optimizedInstructions:
|
|
124
|
-
|
|
125
|
-
|
|
65
|
+
optimizedInstructions: candidate,
|
|
66
|
+
reasoning: ['Single-pass generation from static analysis complete'],
|
|
67
|
+
usage,
|
|
126
68
|
};
|
|
127
69
|
}
|
|
128
70
|
// ── Complaint agent ──────────────────────────────────────────
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAkBH,4CA8DC;AAWD,8CA0CC;AAlID,uCAKmB;AAEnB;;;;;;;GAOG;AACI,KAAK,UAAU,gBAAgB,CAAC,OAAwB;IAC7D,MAAM,EACJ,mBAAmB,EACnB,EAAE,EACF,MAAM,EACN,gBAAgB,EAChB,QAAQ,EACR,GAAG,EACH,MAAM,EACN,YAAY,EACZ,UAAU,GACX,GAAG,OAAO,CAAC;IAEZ,sEAAsE;IACtE,MAAM,QAAQ,GAAG,mBAAmB,IAAI,EAAE,CAAC;IAE3C,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;QACpB,GAAG,EAAE,IAAI,CAAC,uBAAuB,CAAC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AAC,CAAC;IAC3C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC7D,GAAG,EAAE,KAAK,CAAC,8BAA8B,GAAG,EAAE,CAAC,CAAC;QAChD,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,OAAO,EAAE,CAAC,UAAU,GAAG,EAAE,CAAC,EAAE,CAAC;IACpF,CAAC;IAED,MAAM,MAAM,GAAG,IAAA,gCAAsB,EAAC,QAAQ,CAAC,CAAC;IAChD,GAAG,EAAE,IAAI,CAAC,WAAW,MAAM,CAAC,OAAO,CAAC,MAAM,UAAU,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;IAE/F,OAAO;QACL,qBAAqB,EAAE,MAAM,CAAC,YAAY;QAC1C,OAAO,EAAE,MAAM,CAAC,OAAO;KACxB,CAAC;AACJ,CAAC"}
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Re-exports types and provides the top-level `optimizeInstructions` entry point.
|
|
5
5
|
*/
|
|
6
|
-
export type { LlmProvider, ChatMessage, ProviderOptions, OptimizeOptions, OptimizeResult,
|
|
6
|
+
export type { LlmProvider, ChatMessage, ChatUsage, ChatResult, ProviderOptions, OptimizeOptions, OptimizeResult, OptimizeStep, OptLogger, ProviderName, ComplaintOptions, ComplaintResult, } from './types';
|
|
7
7
|
export { PROVIDER_ENV_KEYS, LLM_PROVIDER_ENV, LLM_MODEL_ENV } from './types';
|
|
8
8
|
export { resolveProvider, loadEnvFile, parseDotenv } from './providers/index';
|
|
9
9
|
export { createOpenAiProvider } from './providers/openai';
|
|
10
10
|
export { createAnthropicProvider } from './providers/anthropic';
|
|
11
11
|
export { withRetry } from './providers/retry';
|
|
12
12
|
export type { RetryOptions } from './providers/retry';
|
|
13
|
-
export {
|
|
14
|
-
export { buildSystemPrompt,
|
|
13
|
+
export { runGenerateAgent, runComplaintAgent } from './agent';
|
|
14
|
+
export { buildSystemPrompt, buildGeneratePrompt, truncateKb, buildComplaintPrompt, parseComplaintResponse, } from './prompts';
|
|
15
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EACV,WAAW,EACX,WAAW,EACX,eAAe,EACf,eAAe,EACf,cAAc,EACd,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EACV,WAAW,EACX,WAAW,EACX,SAAS,EACT,UAAU,EACV,eAAe,EACf,eAAe,EACf,cAAc,EACd,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,eAAe,GAChB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7E,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,UAAU,EACV,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,WAAW,CAAC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Re-exports types and provides the top-level `optimizeInstructions` entry point.
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.parseComplaintResponse = exports.buildComplaintPrompt = exports.truncateKb = exports.
|
|
8
|
+
exports.parseComplaintResponse = exports.buildComplaintPrompt = exports.truncateKb = exports.buildGeneratePrompt = exports.buildSystemPrompt = exports.runComplaintAgent = exports.runGenerateAgent = exports.withRetry = exports.createAnthropicProvider = exports.createOpenAiProvider = exports.parseDotenv = exports.loadEnvFile = exports.resolveProvider = exports.LLM_MODEL_ENV = exports.LLM_PROVIDER_ENV = exports.PROVIDER_ENV_KEYS = void 0;
|
|
9
9
|
var types_1 = require("./types");
|
|
10
10
|
Object.defineProperty(exports, "PROVIDER_ENV_KEYS", { enumerable: true, get: function () { return types_1.PROVIDER_ENV_KEYS; } });
|
|
11
11
|
Object.defineProperty(exports, "LLM_PROVIDER_ENV", { enumerable: true, get: function () { return types_1.LLM_PROVIDER_ENV; } });
|
|
@@ -21,13 +21,11 @@ Object.defineProperty(exports, "createAnthropicProvider", { enumerable: true, ge
|
|
|
21
21
|
var retry_1 = require("./providers/retry");
|
|
22
22
|
Object.defineProperty(exports, "withRetry", { enumerable: true, get: function () { return retry_1.withRetry; } });
|
|
23
23
|
var agent_1 = require("./agent");
|
|
24
|
-
Object.defineProperty(exports, "
|
|
24
|
+
Object.defineProperty(exports, "runGenerateAgent", { enumerable: true, get: function () { return agent_1.runGenerateAgent; } });
|
|
25
25
|
Object.defineProperty(exports, "runComplaintAgent", { enumerable: true, get: function () { return agent_1.runComplaintAgent; } });
|
|
26
26
|
var prompts_1 = require("./prompts");
|
|
27
27
|
Object.defineProperty(exports, "buildSystemPrompt", { enumerable: true, get: function () { return prompts_1.buildSystemPrompt; } });
|
|
28
|
-
Object.defineProperty(exports, "
|
|
29
|
-
Object.defineProperty(exports, "buildEvalPrompt", { enumerable: true, get: function () { return prompts_1.buildEvalPrompt; } });
|
|
30
|
-
Object.defineProperty(exports, "parseEvalResponse", { enumerable: true, get: function () { return prompts_1.parseEvalResponse; } });
|
|
28
|
+
Object.defineProperty(exports, "buildGeneratePrompt", { enumerable: true, get: function () { return prompts_1.buildGeneratePrompt; } });
|
|
31
29
|
Object.defineProperty(exports, "truncateKb", { enumerable: true, get: function () { return prompts_1.truncateKb; } });
|
|
32
30
|
Object.defineProperty(exports, "buildComplaintPrompt", { enumerable: true, get: function () { return prompts_1.buildComplaintPrompt; } });
|
|
33
31
|
Object.defineProperty(exports, "parseComplaintResponse", { enumerable: true, get: function () { return prompts_1.parseComplaintResponse; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAgBH,iCAA6E;AAApE,0GAAA,iBAAiB,OAAA;AAAE,yGAAA,gBAAgB,OAAA;AAAE,sGAAA,aAAa,OAAA;AAE3D,2CAA8E;AAArE,wGAAA,eAAe,OAAA;AAAE,oGAAA,WAAW,OAAA;AAAE,oGAAA,WAAW,OAAA;AAClD,6CAA0D;AAAjD,8GAAA,oBAAoB,OAAA;AAC7B,mDAAgE;AAAvD,oHAAA,uBAAuB,OAAA;AAChC,2CAA8C;AAArC,kGAAA,SAAS,OAAA;AAElB,iCAA8D;AAArD,yGAAA,gBAAgB,OAAA;AAAE,0GAAA,iBAAiB,OAAA;AAC5C,qCAMmB;AALjB,4GAAA,iBAAiB,OAAA;AACjB,8GAAA,mBAAmB,OAAA;AACnB,qGAAA,UAAU,OAAA;AACV,+GAAA,oBAAoB,OAAA;AACpB,iHAAA,sBAAsB,OAAA"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Prompt templates for the
|
|
2
|
+
* Prompt templates for the generation agent.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Two prompts:
|
|
5
5
|
* 1. System prompt — sets context with KB content.
|
|
6
|
-
* 2.
|
|
7
|
-
* 3. Eval prompt — asks the LLM to score and critique a candidate.
|
|
6
|
+
* 2. Generate prompt — asks the LLM to generate AGENTS.md from scratch using KB.
|
|
8
7
|
*/
|
|
9
8
|
/**
|
|
10
9
|
* Truncate KB content to fit within the character budget.
|
|
@@ -17,25 +16,13 @@ export declare function truncateKb(kb: string, charBudget?: number): string;
|
|
|
17
16
|
*/
|
|
18
17
|
export declare function buildSystemPrompt(kb: string, kbCharBudget?: number, toolInstructions?: string): string;
|
|
19
18
|
/**
|
|
20
|
-
* Build the user prompt for
|
|
19
|
+
* Build the user prompt for AGENTS.md generation.
|
|
21
20
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
21
|
+
* Asks the LLM to generate AGENTS.md from scratch using the KB
|
|
22
|
+
* (static analysis) provided in the system prompt as context.
|
|
23
|
+
* Optionally includes a KB diff for incremental regeneration.
|
|
24
24
|
*/
|
|
25
|
-
export declare function
|
|
26
|
-
/**
|
|
27
|
-
* Build the evaluation prompt that asks the LLM to score and critique
|
|
28
|
-
* a candidate set of instructions.
|
|
29
|
-
*/
|
|
30
|
-
export declare function buildEvalPrompt(candidateInstructions: string, kb: string, kbCharBudget?: number): string;
|
|
31
|
-
/**
|
|
32
|
-
* Parse the structured evaluation response into an EvalResult.
|
|
33
|
-
*/
|
|
34
|
-
export declare function parseEvalResponse(response: string): {
|
|
35
|
-
score: number;
|
|
36
|
-
feedback: string;
|
|
37
|
-
suggestions: string[];
|
|
38
|
-
};
|
|
25
|
+
export declare function buildGeneratePrompt(kbDiff?: string): string;
|
|
39
26
|
/**
|
|
40
27
|
* Build a prompt that instructs the LLM to address specific user complaints
|
|
41
28
|
* by modifying the AGENTS.md instructions.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,GAAE,MAA+B,GAAG,MAAM,CAe1F;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAuCtG;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,CAAC,EAAE,MAAM,GACd,MAAM,CA2BR;AAID;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,mBAAmB,EAAE,MAAM,EAC3B,UAAU,EAAE,MAAM,EAAE,GACnB,MAAM,CAgCR;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG;IACxD,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB,CAiBA"}
|