@galileodev/verify 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/guide/composer.d.ts +10 -0
  2. package/dist/guide/composer.d.ts.map +1 -0
  3. package/dist/guide/composer.js +48 -0
  4. package/dist/guide/composer.js.map +1 -0
  5. package/dist/guide/constraints.d.ts +3 -0
  6. package/dist/guide/constraints.d.ts.map +1 -0
  7. package/dist/guide/constraints.js +12 -0
  8. package/dist/guide/constraints.js.map +1 -0
  9. package/dist/guide/file-tree.d.ts +2 -0
  10. package/dist/guide/file-tree.d.ts.map +1 -0
  11. package/dist/guide/file-tree.js +24 -0
  12. package/dist/guide/file-tree.js.map +1 -0
  13. package/dist/index.d.ts +22 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +25 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/karpathy/loop.d.ts +6 -0
  18. package/dist/karpathy/loop.d.ts.map +1 -0
  19. package/dist/karpathy/loop.js +169 -0
  20. package/dist/karpathy/loop.js.map +1 -0
  21. package/dist/orchestrator/acdc.d.ts +14 -0
  22. package/dist/orchestrator/acdc.d.ts.map +1 -0
  23. package/dist/orchestrator/acdc.js +91 -0
  24. package/dist/orchestrator/acdc.js.map +1 -0
  25. package/dist/solve/agent.d.ts +8 -0
  26. package/dist/solve/agent.d.ts.map +1 -0
  27. package/dist/solve/agent.js +151 -0
  28. package/dist/solve/agent.js.map +1 -0
  29. package/dist/solve/hint-matcher.d.ts +8 -0
  30. package/dist/solve/hint-matcher.d.ts.map +1 -0
  31. package/dist/solve/hint-matcher.js +36 -0
  32. package/dist/solve/hint-matcher.js.map +1 -0
  33. package/dist/solve/staged-pipeline.d.ts +12 -0
  34. package/dist/solve/staged-pipeline.d.ts.map +1 -0
  35. package/dist/solve/staged-pipeline.js +51 -0
  36. package/dist/solve/staged-pipeline.js.map +1 -0
  37. package/dist/trust/trust-evaluator.d.ts +9 -0
  38. package/dist/trust/trust-evaluator.d.ts.map +1 -0
  39. package/dist/trust/trust-evaluator.js +30 -0
  40. package/dist/trust/trust-evaluator.js.map +1 -0
  41. package/dist/trust/trust-store.d.ts +16 -0
  42. package/dist/trust/trust-store.d.ts.map +1 -0
  43. package/dist/trust/trust-store.js +86 -0
  44. package/dist/trust/trust-store.js.map +1 -0
  45. package/dist/trust/types.d.ts +15 -0
  46. package/dist/trust/types.d.ts.map +1 -0
  47. package/dist/trust/types.js +2 -0
  48. package/dist/trust/types.js.map +1 -0
  49. package/dist/types.d.ts +132 -0
  50. package/dist/types.d.ts.map +1 -0
  51. package/dist/types.js +2 -0
  52. package/dist/types.js.map +1 -0
  53. package/dist/utils/secret-strip.d.ts +6 -0
  54. package/dist/utils/secret-strip.d.ts.map +1 -0
  55. package/dist/utils/secret-strip.js +34 -0
  56. package/dist/utils/secret-strip.js.map +1 -0
  57. package/dist/verifier/plugins/eslint.d.ts +9 -0
  58. package/dist/verifier/plugins/eslint.d.ts.map +1 -0
  59. package/dist/verifier/plugins/eslint.js +59 -0
  60. package/dist/verifier/plugins/eslint.js.map +1 -0
  61. package/dist/verifier/plugins/semgrep.d.ts +9 -0
  62. package/dist/verifier/plugins/semgrep.d.ts.map +1 -0
  63. package/dist/verifier/plugins/semgrep.js +46 -0
  64. package/dist/verifier/plugins/semgrep.js.map +1 -0
  65. package/dist/verifier/plugins/test-runner.d.ts +11 -0
  66. package/dist/verifier/plugins/test-runner.d.ts.map +1 -0
  67. package/dist/verifier/plugins/test-runner.js +46 -0
  68. package/dist/verifier/plugins/test-runner.js.map +1 -0
  69. package/dist/verifier/plugins/tsc.d.ts +9 -0
  70. package/dist/verifier/plugins/tsc.d.ts.map +1 -0
  71. package/dist/verifier/plugins/tsc.js +41 -0
  72. package/dist/verifier/plugins/tsc.js.map +1 -0
  73. package/dist/verifier/runner.d.ts +14 -0
  74. package/dist/verifier/runner.d.ts.map +1 -0
  75. package/dist/verifier/runner.js +45 -0
  76. package/dist/verifier/runner.js.map +1 -0
  77. package/package.json +28 -0
@@ -0,0 +1,10 @@
1
+ import type { PlaybookStore } from '@galileodev/core';
2
+ import type { GuideContext, GuideOptions } from '../types.js';
3
+ export declare class GuideComposer {
4
+ private readonly store;
5
+ private readonly galileoDir;
6
+ private readonly templateRenderer?;
7
+ constructor(store: PlaybookStore, galileoDir: string, templateRenderer?: (() => Promise<string>) | undefined);
8
+ compose(taskId: string, options?: GuideOptions): Promise<GuideContext>;
9
+ }
10
+ //# sourceMappingURL=composer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composer.d.ts","sourceRoot":"","sources":["../../src/guide/composer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAoB,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAuB,MAAM,aAAa,CAAC;AAInF,qBAAa,aAAa;IAEtB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC;gBAFjB,KAAK,EAAE,aAAa,EACpB,UAAU,EAAE,MAAM,EAClB,gBAAgB,CAAC,GAAE,MAAM,OAAO,CAAC,MAAM,CAAC,aAAA;IAGrD,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;CAyC7E"}
@@ -0,0 +1,48 @@
1
+ import { loadConstraints } from './constraints.js';
2
+ import { scanFileTree } from './file-tree.js';
3
+ export class GuideComposer {
4
+ store;
5
+ galileoDir;
6
+ templateRenderer;
7
+ constructor(store, galileoDir, templateRenderer) {
8
+ this.store = store;
9
+ this.galileoDir = galileoDir;
10
+ this.templateRenderer = templateRenderer;
11
+ }
12
+ async compose(taskId, options) {
13
+ const maxEntries = options?.maxPlaybookEntries ?? 20;
14
+ const includeFileTree = options?.includeFileTree ?? true;
15
+ const fileTreeDepth = options?.fileTreeDepth ?? 3;
16
+ const allEntries = await this.store.getActiveEntries();
17
+ const limitedEntries = allEntries.slice(-maxEntries);
18
+ const playbook = {
19
+ entries: limitedEntries,
20
+ takenAt: new Date().toISOString(),
21
+ };
22
+ const template = this.templateRenderer ? await this.templateRenderer() : '';
23
+ const verificationHistory = allEntries
24
+ .filter((e) => e.kind === 'verification-failure')
25
+ .map((e) => ({
26
+ verifierId: e.metadata.verifierId ?? 'unknown',
27
+ severity: e.metadata.severity ?? 'error',
28
+ ruleId: e.metadata.ruleId ?? 'unknown',
29
+ message: e.content,
30
+ file: e.metadata.file ?? 'unknown',
31
+ line: e.metadata.line ?? 0,
32
+ column: e.metadata.column,
33
+ suggestedFix: e.metadata.suggestedFix,
34
+ }));
35
+ const projectConstraints = await loadConstraints(this.galileoDir);
36
+ const fileTree = includeFileTree
37
+ ? await scanFileTree(this.galileoDir, fileTreeDepth)
38
+ : undefined;
39
+ return {
40
+ playbook,
41
+ template,
42
+ verificationHistory,
43
+ projectConstraints,
44
+ fileTree,
45
+ };
46
+ }
47
+ }
48
+ //# sourceMappingURL=composer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composer.js","sourceRoot":"","sources":["../../src/guide/composer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,OAAO,aAAa;IAEL;IACA;IACA;IAHnB,YACmB,KAAoB,EACpB,UAAkB,EAClB,gBAAwC;QAFxC,UAAK,GAAL,KAAK,CAAe;QACpB,eAAU,GAAV,UAAU,CAAQ;QAClB,qBAAgB,GAAhB,gBAAgB,CAAwB;IACxD,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,MAAc,EAAE,OAAsB;QAClD,MAAM,UAAU,GAAG,OAAO,EAAE,kBAAkB,IAAI,EAAE,CAAC;QACrD,MAAM,eAAe,GAAG,OAAO,E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,eAAe;YAC9B,CAAC,CAAC,MAAM,YAAY,CAAC,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC;YACpD,CAAC,CAAC,SAAS,CAAC;QAEd,OAAO;YACL,QAAQ;YACR,QAAQ;YACR,mBAAmB;YACnB,kBAAkB;YAClB,QAAQ;SACT,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,3 @@
1
+ import type { ProjectConstraint } from '../types.js';
2
+ export declare function loadConstraints(galileoDir: string): Promise<ProjectConstraint[]>;
3
+ //# sourceMappingURL=constraints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constraints.d.ts","sourceRoot":"","sources":["../../src/guide/constraints.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,wBAAsB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAOtF"}
@@ -0,0 +1,12 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { existsSync } from 'node:fs';
3
+ import { join } from 'node:path';
4
+ export async function loadConstraints(galileoDir) {
5
+ const constraintsPath = join(galileoDir, 'constraints.json');
6
+ if (!existsSync(constraintsPath)) {
7
+ return [];
8
+ }
9
+ const raw = await readFile(constraintsPath, 'utf-8');
10
+ return JSON.parse(raw);
11
+ }
12
+ //# sourceMappingURL=constraints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constraints.js","sourceRoot":"","sources":["../../src/guide/constraints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,UAAkB;IACtD,MAAM,eAAe,GAAG,IAAI,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAC;IAC7D,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;QACjC,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IACrD,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAwB,CAAC;AAChD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function scanFileTree(rootDir: string, maxDepth?: number): Promise<string[]>;
2
+ //# sourceMappingURL=file-tree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-tree.d.ts","sourceRoot":"","sources":["../../src/guide/file-tree.ts"],"names":[],"mappings":"AAGA,wBAAsB,YAAY,CAChC,OAAO,EAAE,MAAM,EACf,QAAQ,GAAE,MAAU,GACnB,OAAO,CAAC,MAAM,EAAE,CAAC,CAInB"}
@@ -0,0 +1,24 @@
1
+ import { readdir } from 'node:fs/promises';
2
+ import { join, relative } from 'node:path';
3
+ export async function scanFileTree(rootDir, maxDepth = 3) {
4
+ const files = [];
5
+ await walk(rootDir, rootDir, 0, maxDepth, files);
6
+ return files.sort();
7
+ }
8
+ async function walk(rootDir, currentDir, depth, maxDepth, files) {
9
+ if (depth > maxDepth)
10
+ return;
11
+ const entries = await readdir(currentDir, { withFileTypes: true });
12
+ for (const entry of entries) {
13
+ if (entry.name.startsWith('.') || entry.name === 'node_modules' || entry.name === 'dist') {
14
+ continue;
15
+ }
16
+ const fullPath = join(currentDir, entry.name);
17
+ const relPath = relative(rootDir, fullPath);
18
+ files.push(relPath);
19
+ if (entry.isDirectory()) {
20
+ await walk(rootDir, fullPath, depth + 1, maxDepth, files);
21
+ }
22
+ }
23
+ }
24
+ //# sourceMappingURL=file-tree.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-tree.js","sourceRoot":"","sources":["../../src/guide/file-tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,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SolveContext, SolveResult, RemediationAttempt, KarpathyMetric, KarpathyConfig, KarpathyResult, KarpathyExperiment, ACDCInput, ACDCResult, } from './types.js';
2
+ export { GuideComposer } from './guide/composer.js';
3
+ export { loadConstraints } from './guide/constraints.js';
4
+ export { scanFileTree } from './guide/file-tree.js';
5
+ export { VerifierRunner } from './verifier/runner.js';
6
+ export { TscVerifier } from './verifier/plugins/tsc.js';
7
+ export { TestRunnerVerifier } from './verifier/plugins/test-runner.js';
8
+ export { EslintVerifier } from './verifier/plugins/eslint.js';
9
+ export { SemgrepVerifier } from './verifier/plugins/semgrep.js';
10
+ export { SolveAgent } from './solve/agent.js';
11
+ export { KarpathyLoop } from './karpathy/loop.js';
12
+ export { ACDCOrchestrator } from './orchestrator/acdc.js';
13
+ export { TrustStore } from './trust/trust-store.js';
14
+ export { TrustEvaluator } from './trust/trust-evaluator.js';
15
+ export type { TrustEntry, TrustTier, TrustStoreConfig } from './trust/types.js';
16
+ export { StagedPipeline } from './solve/staged-pipeline.js';
17
+ export type { StagedPipelineConfig } from './solve/staged-pipeline.js';
18
+ export { matchHints } from './solve/hint-matcher.js';
19
+ export type { FixHint } from './solve/hint-matcher.js';
20
+ export { stripSecrets } from './utils/secret-strip.js';
21
+ export type { StripResult } from './utils/secret-strip.js';
22
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,SAAS,EACT,UAAU,GACX,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAGhE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGhF,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,YAAY,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,YAAY,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,YAAY,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,25 @@
1
+ // Guide
2
+ export { GuideComposer } from './guide/composer.js';
3
+ export { loadConstraints } from './guide/constraints.js';
4
+ export { scanFileTree } from './guide/file-tree.js';
5
+ // Verifier
6
+ export { VerifierRunner } from './verifier/runner.js';
7
+ export { TscVerifier } from './verifier/plugins/tsc.js';
8
+ export { TestRunnerVerifier } from './verifier/plugins/test-runner.js';
9
+ export { EslintVerifier } from './verifier/plugins/eslint.js';
10
+ export { SemgrepVerifier } from './verifier/plugins/semgrep.js';
11
+ // Solve
12
+ export { SolveAgent } from './solve/agent.js';
13
+ // Karpathy
14
+ export { KarpathyLoop } from './karpathy/loop.js';
15
+ // Orchestrator
16
+ export { ACDCOrchestrator } from './orchestrator/acdc.js';
17
+ // Trust
18
+ export { TrustStore } from './trust/trust-store.js';
19
+ export { TrustEvaluator } from './trust/trust-evaluator.js';
20
+ // Staged Remediation
21
+ export { StagedPipeline } from './solve/staged-pipeline.js';
22
+ export { matchHints } from './solve/hint-matcher.js';
23
+ // Secret Stripping
24
+ export { stripSecrets } from './utils/secret-strip.js';
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAqBA,QAAQ;AACR,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,WAAW;AACX,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,QAAQ;AACR,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,WAAW;AACX,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,eAAe;AACf,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,QAAQ;AACR,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAG5D,qBAAqB;AACrB,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAGrD,mBAAmB;AACnB,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { KarpathyConfig, KarpathyResult } from '../types.js';
2
+ export declare class KarpathyLoop {
3
+ optimize(config: KarpathyConfig): Promise<KarpathyResult>;
4
+ private buildPrompt;
5
+ }
6
+ //# sourceMappingURL=loop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loop.d.ts","sourceRoot":"","sources":["../../src/karpathy/loop.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EAEf,MAAM,aAAa,CAAC;AAErB,qBAAa,YAAY;IACjB,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;IAyK/D,OAAO,CAAC,WAAW;CA8BpB"}
@@ -0,0 +1,169 @@
1
+ import { readFile, writeFile } from 'node:fs/promises';
2
+ import { join } from 'node:path';
3
+ import { execFileSync } from 'node:child_process';
4
+ import { RatchetGuard } from '@galileodev/core';
5
+ export class KarpathyLoop {
6
+ async optimize(config) {
7
+ const { workingDir, targetFiles, metric, llm, sandbox, verifier, budget, maxExperiments, timeBudgetMs, } = config;
8
+ if (!Number.isFinite(maxExperiments) || maxExperiments < 1) {
9
+ throw new Error('maxExperiments must be a finite number >= 1.');
10
+ }
11
+ if (targetFiles.length === 0) {
12
+ throw new Error('targetFiles must contain at least one file.');
13
+ }
14
+ if (timeBudgetMs !== undefined && (!Number.isFinite(timeBudgetMs) || timeBudgetMs <= 0)) {
15
+ throw new Error('timeBudgetMs must be a finite positive number.');
16
+ }
17
+ const guard = new RatchetGuard(workingDir);
18
+ await guard.checkpoint();
19
+ // 1. Establish baseline
20
+ const baselineResult = await sandbox.exec(metric.command.split(' ')[0], metric.command.split(' ').slice(1), { workingDir, timeoutMs: 30000 });
21
+ const baselineScore = metric.parseOutput(baselineResult.stdout);
22
+ if (!Number.isFinite(baselineScore)) {
23
+ throw new Error(`Baseline metric measurement returned non-finite value: ${baselineScore}`);
24
+ }
25
+ const experiments = [];
26
+ let bestScore = baselineScore;
27
+ let tokensUsed = 0;
28
+ const startTime = Date.now();
29
+ const history = [];
30
+ for (let i = 0; i < maxExperiments; i++) {
31
+ if (budget.exhausted())
32
+ break;
33
+ if (timeBudgetMs && Date.now() - startTime >= timeBudgetMs)
34
+ break;
35
+ // Read target files
36
+ const fileContents = {};
37
+ for (const file of targetFiles) {
38
+ try {
39
+ fileContents[file] = await readFile(join(workingDir, file), 'utf-8');
40
+ }
41
+ catch {
42
+ fileContents[file] = '';
43
+ }
44
+ }
45
+ // Ask LLM for improvement
46
+ const prompt = this.buildPrompt(fileContents, metric.name, metric.direction, bestScore, experiments);
47
+ let response;
48
+ try {
49
+ response = await llm.complete(prompt, undefined, history.length > 0 ? history : undefined);
50
+ }
51
+ catch {
52
+ break;
53
+ }
54
+ const responseTokens = response.length;
55
+ try {
56
+ budget.consume(responseTokens);
57
+ }
58
+ catch {
59
+ break;
60
+ }
61
+ tokensUsed += responseTokens;
62
+ // Parse response
63
+ let hypothesis;
64
+ let patch;
65
+ try {
66
+ const parsed = JSON.parse(response);
67
+ hypothesis = parsed.hypothesis ?? '';
68
+ patch = parsed.patch ?? '';
69
+ }
70
+ catch {
71
+ experiments.push({
72
+ id: i + 1, hypothesis: 'Failed to parse response', patch: '',
73
+ score: bestScore, verificationPassed: false, kept: false, tokensUsed: responseTokens,
74
+ });
75
+ continue;
76
+ }
77
+ // Apply patch (assumes single target file for now)
78
+ const targetFile = targetFiles[0];
79
+ const originalContent = fileContents[targetFile];
80
+ if (patch) {
81
+ await writeFile(join(workingDir, targetFile), patch, 'utf-8');
82
+ }
83
+ // Verify — must still pass all checks
84
+ const verifyReport = await verifier.runAll({ workingDir, sandbox });
85
+ if (!verifyReport.passed) {
86
+ await writeFile(join(workingDir, targetFile), originalContent, 'utf-8');
87
+ experiments.push({
88
+ id: i + 1, hypothesis, patch,
89
+ score: bestScore, verificationPassed: false, kept: false, tokensUsed: responseTokens,
90
+ });
91
+ history.push({ role: 'user', content: prompt }, { role: 'assistant', content: response }, { role: 'user', content: `Experiment ${i + 1} failed verification: ${verifyReport.findings.map((f) => f.message).join('; ')}` });
92
+ continue;
93
+ }
94
+ // Measure metric
95
+ const metricResult = await sandbox.exec(metric.command.split(' ')[0], metric.command.split(' ').slice(1), { workingDir, timeoutMs: 30000 });
96
+ const newScore = metric.parseOutput(metricResult.stdout);
97
+ // Non-finite score means measurement failed — treat as failed experiment
98
+ if (!Number.isFinite(newScore)) {
99
+ await writeFile(join(workingDir, targetFile), originalContent, 'utf-8');
100
+ experiments.push({
101
+ id: i + 1, hypothesis, patch,
102
+ score: NaN, verificationPassed: true, kept: false, tokensUsed: responseTokens,
103
+ });
104
+ continue;
105
+ }
106
+ const improved = metric.direction === 'maximize'
107
+ ? newScore > bestScore
108
+ : newScore < bestScore;
109
+ if (improved) {
110
+ try {
111
+ execFileSync('git', ['add', '-A'], { cwd: workingDir });
112
+ execFileSync('git', ['commit', '-m', `karpathy: experiment ${i + 1}`], { cwd: workingDir });
113
+ bestScore = newScore;
114
+ await guard.checkpoint();
115
+ experiments.push({
116
+ id: i + 1, hypothesis, patch,
117
+ score: newScore, verificationPassed: true, kept: true, tokensUsed: responseTokens,
118
+ });
119
+ }
120
+ catch {
121
+ // Git commit failed — revert file and record as not kept
122
+ await writeFile(join(workingDir, targetFile), originalContent, 'utf-8');
123
+ experiments.push({
124
+ id: i + 1, hypothesis, patch,
125
+ score: newScore, verificationPassed: true, kept: false, tokensUsed: responseTokens,
126
+ });
127
+ }
128
+ }
129
+ else {
130
+ await writeFile(join(workingDir, targetFile), originalContent, 'utf-8');
131
+ experiments.push({
132
+ id: i + 1, hypothesis, patch,
133
+ score: newScore, verificationPassed: true, kept: false, tokensUsed: responseTokens,
134
+ });
135
+ }
136
+ history.push({ role: 'user', content: prompt }, { role: 'assistant', content: response }, { role: 'user', content: `Experiment ${i + 1}: score=${newScore}, ${improved ? 'KEPT' : 'reverted'}` });
137
+ }
138
+ return {
139
+ experiments,
140
+ bestScore,
141
+ baselineScore,
142
+ improved: experiments.some((e) => e.kept),
143
+ tokensUsed,
144
+ };
145
+ }
146
+ buildPrompt(files, metricName, direction, currentBest, history) {
147
+ const fileList = Object.entries(files)
148
+ .map(([path, content]) => `### ${path}\n\`\`\`\n${content}\n\`\`\``)
149
+ .join('\n\n');
150
+ const historyList = history.length > 0
151
+ ? history.map((e) => `- Experiment ${e.id}: ${e.hypothesis} → score=${e.score} (${e.kept ? 'kept' : 'reverted'})`).join('\n')
152
+ : 'No previous experiments.';
153
+ return [
154
+ `You are optimizing code to ${direction} the metric "${metricName}".`,
155
+ `Current best score: ${currentBest}`,
156
+ '',
157
+ '## Target Files',
158
+ fileList,
159
+ '',
160
+ '## Previous Experiments',
161
+ historyList,
162
+ '',
163
+ '## Instructions',
164
+ `Propose a change to ${direction} "${metricName}". Respond with JSON:`,
165
+ '{ "hypothesis": "what you think will improve the metric", "patch": "complete file content after your change" }',
166
+ ].join('\n');
167
+ }
168
+ }
169
+ //# sourceMappingURL=loop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loop.js","sourceRoot":"","sources":["../../src/karpathy/loop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAQhD,MAAM,OAAO,YAAY;IACvB,KAAK,CAAC,QAAQ,CAAC,MAAsB;QACnC,MAAM,EACJ,UAAU,EAAE,WA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,EAAE,KAAK,CAAC,CAAC,UAAU,YAAY,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;YAC7H,CAAC,CAAC,0BAA0B,CAAC;QAE/B,OAAO;YACL,8BAA8B,SAAS,gBAAgB,UAAU,IAAI;YACrE,uBAAuB,WAAW,EAAE;YACpC,EAAE;YACF,iBAAiB;YACjB,QAAQ;YACR,EAAE;YACF,yBAAyB;YACzB,WAAW;YACX,EAAE;YACF,iBAAiB;YACjB,uBAAuB,SAAS,KAAK,UAAU,uBAAuB;YACtE,gHAAgH;SACjH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;CACF"}
@@ -0,0 +1,14 @@
1
+ import type { Pipeline } from '@galileodev/core';
2
+ import type { GuideComposer } from '../guide/composer.js';
3
+ import type { VerifierRunner } from '../verifier/runner.js';
4
+ import type { SolveAgent } from '../solve/agent.js';
5
+ import type { ACDCInput, ACDCResult } from '../types.js';
6
+ export declare class ACDCOrchestrator {
7
+ private readonly pipeline;
8
+ private readonly guideComposer;
9
+ private readonly verifier;
10
+ private readonly solveAgent;
11
+ constructor(pipeline: Pipeline, guideComposer: GuideComposer, verifier: VerifierRunner, solveAgent: SolveAgent);
12
+ run(input: ACDCInput): Promise<ACDCResult>;
13
+ }
14
+ //# sourceMappingURL=acdc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acdc.d.ts","sourceRoot":"","sources":["../../src/orchestrator/acdc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAoC,MAAM,kBAAkB,CAAC;AAEnF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAmC,MAAM,aAAa,CAAC;AAE1F,qBAAa,gBAAgB;IAEzB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAHV,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,cAAc,EACxB,UAAU,EAAE,UAAU;IAGnC,GAAG,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC;CAsFjD"}
@@ -0,0 +1,91 @@
1
+ import { ExecutionSandbox } from '@galileodev/core';
2
+ export class ACDCOrchestrator {
3
+ pipeline;
4
+ guideComposer;
5
+ verifier;
6
+ solveAgent;
7
+ constructor(pipeline, guideComposer, verifier, solveAgent) {
8
+ this.pipeline = pipeline;
9
+ this.guideComposer = guideComposer;
10
+ this.verifier = verifier;
11
+ this.solveAgent = solveAgent;
12
+ }
13
+ async run(input) {
14
+ if (!Number.isFinite(input.maxCycles) || input.maxCycles < 1) {
15
+ throw new Error('maxCycles must be a finite number >= 1.');
16
+ }
17
+ const sandbox = new ExecutionSandbox();
18
+ let cycles = 0;
19
+ let generation;
20
+ let verification;
21
+ let remediation;
22
+ let tokensUsed = 0;
23
+ while (cycles < input.maxCycles && !input.budget.exhausted()) {
24
+ cycles++;
25
+ // 1. Guide — assemble context
26
+ const guideContext = await this.guideComposer.compose(input.taskId);
27
+ // 2. Generate — run Level 1 pipeline
28
+ const pipelineResult = await this.pipeline.run({
29
+ taskId: input.taskId,
30
+ instruction: input.instruction,
31
+ });
32
+ generation = pipelineResult.generation;
33
+ // 3. Verify
34
+ verification = await this.verifier.runAll({
35
+ workingDir: input.projectDir,
36
+ sandbox,
37
+ });
38
+ if (verification.passed) {
39
+ return {
40
+ taskId: input.taskId,
41
+ generation,
42
+ verification,
43
+ remediation,
44
+ cycles,
45
+ passed: true,
46
+ tokensUsed,
47
+ };
48
+ }
49
+ // 4. Solve — attempt remediation
50
+ remediation = await this.solveAgent.remediate(verification, {
51
+ workingDir: input.projectDir,
52
+ guideContext,
53
+ llm: input.llm,
54
+ sandbox,
55
+ verifier: this.verifier,
56
+ budget: input.budget,
57
+ maxRetriesPerFinding: 3,
58
+ });
59
+ tokensUsed += remediation.tokensUsed;
60
+ // Re-verify after solve
61
+ if (remediation.unresolved.length === 0) {
62
+ const finalVerification = await this.verifier.runAll({
63
+ workingDir: input.projectDir,
64
+ sandbox,
65
+ });
66
+ if (finalVerification.passed) {
67
+ return {
68
+ taskId: input.taskId,
69
+ generation,
70
+ verification: finalVerification,
71
+ remediation,
72
+ cycles,
73
+ passed: true,
74
+ tokensUsed,
75
+ };
76
+ }
77
+ verification = finalVerification;
78
+ }
79
+ }
80
+ return {
81
+ taskId: input.taskId,
82
+ generation: generation,
83
+ verification: verification,
84
+ remediation,
85
+ cycles,
86
+ passed: false,
87
+ tokensUsed,
88
+ };
89
+ }
90
+ }
91
+ //# sourceMappingURL=acdc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acdc.js","sourceRoot":"","sources":["../../src/orchestrator/acdc.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAMpD,MAAM,OAAO,gBAAgB;IAER;IACA;IACA;IACA;IAJnB,YACmB,QAAkB,EAClB,aAA4B,EAC5B,QAAwB,EACxB,UAAsB;QAHtB,aAAQ,GAAR,QAAQ,CAAU;QAClB,kBAAa,GAAb,aAAa,CAAe;QAC5B,aAAQ,GAAR,QAAQ,CAAgB;QACxB,eAAU,GAAV,UAAU,CAAY;IACtC,CAAC;IAEJ,KAAK,CAAC,GAAG,CAAC,KAAgB;QACxB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,SAAS,G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ACZ,GAAG,EAAE,KAAK,CAAC,GAAG;gBACd,OAAO;gBACP,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,oBAAoB,EAAE,CAAC;aACxB,CAAC,CAAC;YACH,UAAU,IAAI,WAAW,CAAC,UAAU,CAAC;YAErC,wBAAwB;YACxB,IAAI,WAAW,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACxC,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;oBACnD,UAAU,EAAE,KAAK,CAAC,UAAU;oBAC5B,OAAO;iBACR,CAAC,CAAC;gBACH,IAAI,iBAAiB,CAAC,MAAM,EAAE,CAAC;oBAC7B,OAAO;wBACL,MAAM,EAAE,KAAK,CAAC,MAAM;wBACpB,UAAU;wBACV,YAAY,EAAE,iBAAiB;wBAC/B,WAAW;wBACX,MAAM;wBACN,MAAM,EAAE,IAAI;wBACZ,UAAU;qBACX,CAAC;gBACJ,CAAC;gBACD,YAAY,GAAG,iBAAiB,CAAC;YACnC,CAAC;QACH,CAAC;QAED,OAAO;YACL,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,UAAU,EAAE,UAAW;YACvB,YAAY,EAAE,YAAa;YAC3B,WAAW;YACX,MAAM;YACN,MAAM,EAAE,KAAK;YACb,UAAU;SACX,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,8 @@
1
+ import type { VerificationReport, SolveContext, SolveResult } from '../types.js';
2
+ export declare class SolveAgent {
3
+ remediate(report: VerificationReport, context: SolveContext): Promise<SolveResult>;
4
+ private safePath;
5
+ private groupByFile;
6
+ private buildPrompt;
7
+ }
8
+ //# sourceMappingURL=agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/solve/agent.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,kBAAkB,EAElB,YAAY,EACZ,WAAW,EAEZ,MAAM,aAAa,CAAC;AAErB,qBAAa,UAAU;IACf,SAAS,CACb,MAAM,EAAE,kBAAkB,EAC1B,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,WAAW,CAAC;IAyIvB,OAAO,CAAC,QAAQ;IAWhB,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,WAAW;CAYpB"}