aspectcode 0.3.5 → 0.4.1
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 +13 -0
- package/dist/cli.d.ts +10 -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 +16 -19
- 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 +91 -108
- package/dist/optimize.js.map +1 -1
- package/dist/pipeline.d.ts +14 -8
- package/dist/pipeline.d.ts.map +1 -1
- package/dist/pipeline.js +113 -34
- 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 +59 -29
- 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/dist/ui/theme.d.ts.map +1 -1
- package/dist/ui/theme.js +1 -0
- package/dist/ui/theme.js.map +1 -1
- package/node_modules/@aspectcode/emitters/dist/index.d.ts +1 -1
- package/node_modules/@aspectcode/emitters/dist/index.d.ts.map +1 -1
- package/node_modules/@aspectcode/emitters/dist/index.js +2 -1
- package/node_modules/@aspectcode/emitters/dist/index.js.map +1 -1
- package/node_modules/@aspectcode/emitters/dist/instructions/content.d.ts +11 -0
- package/node_modules/@aspectcode/emitters/dist/instructions/content.d.ts.map +1 -1
- package/node_modules/@aspectcode/emitters/dist/instructions/content.js +213 -1
- package/node_modules/@aspectcode/emitters/dist/instructions/content.js.map +1 -1
- package/node_modules/@aspectcode/emitters/package.json +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/probes.d.ts +21 -3
- package/node_modules/@aspectcode/evaluator/dist/probes.d.ts.map +1 -1
- package/node_modules/@aspectcode/evaluator/dist/probes.js +91 -17
- package/node_modules/@aspectcode/evaluator/dist/probes.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 +4 -4
|
@@ -28,13 +28,33 @@ function extractSection(kb, heading) {
|
|
|
28
28
|
const sepIdx = kb.indexOf('\n---\n', start);
|
|
29
29
|
return sepIdx > 0 ? kb.slice(start, sepIdx).trim() : kb.slice(start).trim();
|
|
30
30
|
}
|
|
31
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* Parse "High-Risk Architectural Hubs" table rows.
|
|
33
|
+
*
|
|
34
|
+
* Handles two formats:
|
|
35
|
+
* - Legacy 3-col: | File | In | Out |
|
|
36
|
+
* - Emitter 5-col: | Rank | File | Imports | Imported By | Risk |
|
|
37
|
+
*/
|
|
32
38
|
function parseHubs(architecture) {
|
|
33
39
|
const hubs = [];
|
|
34
|
-
const tableRegex = /\|\s*`?([^`|]+?)`?\s*\|\s*(\d+)\s*\|\s*(\d+)\s*\|/g;
|
|
35
40
|
const section = extractSubSection(architecture, 'High-Risk Architectural Hubs');
|
|
41
|
+
if (!section)
|
|
42
|
+
return hubs;
|
|
43
|
+
// Try 5-col emitter format first: | Rank | `file` | Imports | Imported By | Risk |
|
|
44
|
+
const fiveCol = /\|\s*\d+\s*\|\s*`([^`]+)`\s*\|\s*(\d+)\s*\|\s*(\d+)\s*\|/g;
|
|
36
45
|
let match;
|
|
37
|
-
while ((match =
|
|
46
|
+
while ((match = fiveCol.exec(section)) !== null) {
|
|
47
|
+
hubs.push({
|
|
48
|
+
file: match[1].trim(),
|
|
49
|
+
outDegree: parseInt(match[2], 10), // "Imports"
|
|
50
|
+
inDegree: parseInt(match[3], 10), // "Imported By"
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
if (hubs.length > 0)
|
|
54
|
+
return hubs;
|
|
55
|
+
// Fallback: 3-col legacy format | File | In | Out |
|
|
56
|
+
const threeCol = /\|\s*`?([^`|]+?)`?\s*\|\s*(\d+)\s*\|\s*(\d+)\s*\|/g;
|
|
57
|
+
while ((match = threeCol.exec(section)) !== null) {
|
|
38
58
|
hubs.push({
|
|
39
59
|
file: match[1].trim(),
|
|
40
60
|
inDegree: parseInt(match[2], 10),
|
|
@@ -43,13 +63,29 @@ function parseHubs(architecture) {
|
|
|
43
63
|
}
|
|
44
64
|
return hubs;
|
|
45
65
|
}
|
|
46
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* Parse "Entry Points" from architecture section.
|
|
68
|
+
*
|
|
69
|
+
* Handles two formats:
|
|
70
|
+
* - Legacy table: | File | Kind |
|
|
71
|
+
* - Emitter bullet: - 🟢 `path`: reason (under ### Runtime / Tooling sub-headings)
|
|
72
|
+
*/
|
|
47
73
|
function parseEntryPoints(architecture) {
|
|
48
74
|
const entries = [];
|
|
49
75
|
const section = extractSubSection(architecture, 'Entry Points');
|
|
50
|
-
|
|
76
|
+
if (!section)
|
|
77
|
+
return entries;
|
|
78
|
+
// Try bullet-list format first: - <emoji> `path`: reason
|
|
79
|
+
const bulletRegex = /^-\s*(?:[^`]*?)\s*`([^`]+)`\s*:\s*(.+)$/gm;
|
|
51
80
|
let match;
|
|
52
|
-
while ((match =
|
|
81
|
+
while ((match = bulletRegex.exec(section)) !== null) {
|
|
82
|
+
entries.push({ file: match[1].trim(), kind: match[2].trim() });
|
|
83
|
+
}
|
|
84
|
+
if (entries.length > 0)
|
|
85
|
+
return entries;
|
|
86
|
+
// Fallback: table format | File | Kind |
|
|
87
|
+
const tableRegex = /\|\s*`?([^`|]+?)`?\s*\|\s*([^|]+?)\s*\|/g;
|
|
88
|
+
while ((match = tableRegex.exec(section)) !== null) {
|
|
53
89
|
const file = match[1].trim();
|
|
54
90
|
const kind = match[2].trim();
|
|
55
91
|
if (file && !file.includes('---') && kind !== 'Kind') {
|
|
@@ -58,25 +94,63 @@ function parseEntryPoints(architecture) {
|
|
|
58
94
|
}
|
|
59
95
|
return entries;
|
|
60
96
|
}
|
|
61
|
-
/**
|
|
97
|
+
/**
|
|
98
|
+
* Parse naming conventions from the map section.
|
|
99
|
+
*
|
|
100
|
+
* Handles both simple bullet lists and the structured emitter output
|
|
101
|
+
* (tables for file naming, bullets for function naming / framework patterns).
|
|
102
|
+
* Extracts a flat list of convention strings for probe generation.
|
|
103
|
+
*/
|
|
62
104
|
function parseConventions(mapSection) {
|
|
63
105
|
const section = extractSubSection(mapSection, 'Conventions');
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
106
|
+
if (!section)
|
|
107
|
+
return [];
|
|
108
|
+
const conventions = [];
|
|
109
|
+
// Pick up plain bullet items (- text or * text)
|
|
110
|
+
for (const line of section.split('\n')) {
|
|
111
|
+
const trimmed = line.trim();
|
|
112
|
+
if (/^[-*]\s+/.test(trimmed)) {
|
|
113
|
+
conventions.push(trimmed.replace(/^[-*]\s*/, '').trim());
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
// Pick up table rows (| Pattern | Example | Count |)
|
|
117
|
+
const tableRegex = /\|\s*([^|]+?)\s*\|\s*`([^`]+)`\s*\|\s*\d+\s*\|/g;
|
|
118
|
+
let match;
|
|
119
|
+
while ((match = tableRegex.exec(section)) !== null) {
|
|
120
|
+
const pattern = match[1].trim();
|
|
121
|
+
const example = match[2].trim();
|
|
122
|
+
if (pattern && !pattern.includes('---') && pattern !== 'Pattern') {
|
|
123
|
+
conventions.push(`${pattern} (e.g. ${example})`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// Pick up bold directives like **Use:** kebab-case for new files.
|
|
127
|
+
const boldRegex = /\*\*Use:\*\*\s*(.+)/g;
|
|
128
|
+
while ((match = boldRegex.exec(section)) !== null) {
|
|
129
|
+
conventions.push(match[1].trim());
|
|
130
|
+
}
|
|
131
|
+
return conventions.filter(Boolean);
|
|
69
132
|
}
|
|
70
|
-
/**
|
|
133
|
+
/**
|
|
134
|
+
* Extract a sub-section within a larger section by heading.
|
|
135
|
+
*
|
|
136
|
+
* Tolerates emoji prefixes (e.g. "⚠️ High-Risk Architectural Hubs")
|
|
137
|
+
* by allowing optional non-word chars before the heading text.
|
|
138
|
+
* Only stops at headings of the **same or higher** level (fewer #'s).
|
|
139
|
+
*/
|
|
71
140
|
function extractSubSection(section, heading) {
|
|
72
|
-
const
|
|
141
|
+
const escaped = heading.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
142
|
+
// Allow optional emoji / symbol chars between the # and the heading text
|
|
143
|
+
const regex = new RegExp(`(#{1,6})\\s*(?:[^\\w\\s]*\\s*)?${escaped}`, 'i');
|
|
73
144
|
const match = regex.exec(section);
|
|
74
145
|
if (!match)
|
|
75
146
|
return '';
|
|
147
|
+
const headingLevel = match[1].length; // number of # chars
|
|
76
148
|
const start = match.index + match[0].length;
|
|
77
|
-
// Find next heading of same or higher level
|
|
78
|
-
const
|
|
79
|
-
|
|
149
|
+
// Find next heading of same or higher (shallower) level
|
|
150
|
+
const rest = section.slice(start);
|
|
151
|
+
const endPattern = new RegExp(`\\n#{1,${headingLevel}}\\s`);
|
|
152
|
+
const nextHeading = rest.search(endPattern);
|
|
153
|
+
return nextHeading > 0 ? rest.slice(0, nextHeading).trim() : rest.trim();
|
|
80
154
|
}
|
|
81
155
|
/** Parse file paths mentioned in a diff string. */
|
|
82
156
|
function parseDiffFiles(diff) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"probes.js","sourceRoot":"","sources":["../src/probes.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;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B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,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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CACxB,QAAQ,EAAE,MAAM,EAChB,iBAAiB,EAAE,MAAM,EAAE,GAC1B;IAAE,OAAO,EAAE,cAAc,EAAE,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAkBnD;AAkGD,0EAA0E;AAC1E,MAAM,WAAW,qBAAqB;IACpC,CAAC,IAAI,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;CACpH;AAED;;;;;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,EACpB,eAAe,CAAC,EAAE,qBAAqB,GACtC,OAAO,CAAC,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,CAAC;IAEtG,IAAI,YAAY,IAAI,KAAK,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClD,IAAI,YAAY,GAAG,CAAC,CAAC;QACrB,MAAM,YAAY,GAAa,EAAE,CAAC;QAElC,KAAK,MAAM,QAAQ,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC;YAC1C,MAAM,OAAO,GAAG,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAC3C,IAAI,CAAC,OAAO;gBAAE,SAAS;YACvB,IAAI,YAAY,GAAG,OAAO,CAAC,MAAM,GAAG,iBAAiB;gBAAE,MAAM;YAC7D,YAAY,CAAC,IAAI,CAAC,OAAO,QAAQ,aAAa,OAAO,UAAU,CAAC,CAAC;YACjE,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC;QACjC,CAAC;QAED,IAAI,YA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M,GAAG,MAAM,cAAc,CACjC,KAAK,EACL,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,GAAG,EACH,MAAM,CACP,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAErB,eAAe,EAAE,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QACtH,GAAG,EAAE,IAAI,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aspectcode/evaluator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "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,CAAC;QACnC,OAAO;YACL,qBAAqB,EAAE,QAAQ;YAC/B,SAAS,EAAE,CAAC,mBAAmB,CAAC;SACjC,CAAC;IACJ,CAAC;IAED,MAAM,YAAY,GAAG,IAAA,2BAAiB,EAAC,EAAE,EAAE,YAAY,EAAE,gBAAgB,CAAC,CAAC;IAE3E,iEAAiE;IACjE,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,uBAAuB,EAAE,CAAC,CAAC;IACtE,GAAG,EAAE,IAAI,CAAC,4CAA4C,CAAC,CAAC;IAExD,MAAM,gBAAgB,GAAkB;QACtC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE;QACzC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAA,6BAAmB,EAAC,MAAM,CAAC,EAAE;KACvD,C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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"}
|