@pedyc/harness-core 1.1.0 → 1.2.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 (100) hide show
  1. package/README.md +41 -0
  2. package/dist/config/agents.d.ts +14 -0
  3. package/dist/config/agents.d.ts.map +1 -0
  4. package/dist/config/agents.js +39 -0
  5. package/dist/config/agents.js.map +1 -0
  6. package/dist/config/bundled.d.ts +14 -0
  7. package/dist/config/bundled.d.ts.map +1 -0
  8. package/dist/config/bundled.js +38 -0
  9. package/dist/config/bundled.js.map +1 -0
  10. package/dist/config/defaults.d.ts +19 -0
  11. package/dist/config/defaults.d.ts.map +1 -0
  12. package/dist/config/defaults.js +32 -0
  13. package/dist/config/defaults.js.map +1 -0
  14. package/dist/config/errors.d.ts +12 -0
  15. package/dist/config/errors.d.ts.map +1 -0
  16. package/dist/config/errors.js +11 -0
  17. package/dist/config/errors.js.map +1 -0
  18. package/dist/config/index.d.ts +15 -0
  19. package/dist/config/index.d.ts.map +1 -0
  20. package/dist/config/index.js +18 -0
  21. package/dist/config/index.js.map +1 -0
  22. package/dist/config/json.d.ts +14 -0
  23. package/dist/config/json.d.ts.map +1 -0
  24. package/dist/config/json.js +5 -0
  25. package/dist/config/json.js.map +1 -0
  26. package/dist/config/loader.d.ts +16 -0
  27. package/dist/config/loader.d.ts.map +1 -0
  28. package/dist/config/loader.js +221 -0
  29. package/dist/config/loader.js.map +1 -0
  30. package/dist/config/manifest.d.ts +22 -0
  31. package/dist/config/manifest.d.ts.map +1 -0
  32. package/dist/config/manifest.js +56 -0
  33. package/dist/config/manifest.js.map +1 -0
  34. package/dist/config/policy.d.ts +14 -0
  35. package/dist/config/policy.d.ts.map +1 -0
  36. package/dist/config/policy.js +35 -0
  37. package/dist/config/policy.js.map +1 -0
  38. package/dist/config/presets.d.ts +35 -0
  39. package/dist/config/presets.d.ts.map +1 -0
  40. package/dist/config/presets.js +187 -0
  41. package/dist/config/presets.js.map +1 -0
  42. package/dist/config/schema.d.ts +16 -0
  43. package/dist/config/schema.d.ts.map +1 -0
  44. package/dist/config/schema.js +24 -0
  45. package/dist/config/schema.js.map +1 -0
  46. package/dist/contracts/harness.d.ts +86 -0
  47. package/dist/contracts/harness.d.ts.map +1 -0
  48. package/dist/contracts/harness.js +2 -0
  49. package/dist/contracts/harness.js.map +1 -0
  50. package/dist/contracts/index.d.ts +3 -1
  51. package/dist/contracts/index.d.ts.map +1 -1
  52. package/dist/contracts/preset.d.ts +54 -20
  53. package/dist/contracts/preset.d.ts.map +1 -1
  54. package/dist/contracts/validator.d.ts +33 -0
  55. package/dist/contracts/validator.d.ts.map +1 -0
  56. package/dist/contracts/validator.js +23 -0
  57. package/dist/contracts/validator.js.map +1 -0
  58. package/dist/index.d.ts +18 -17
  59. package/dist/index.d.ts.map +1 -1
  60. package/dist/index.js +10 -10
  61. package/dist/index.js.map +1 -1
  62. package/dist/runtime/agent.d.ts +22 -0
  63. package/dist/runtime/agent.d.ts.map +1 -0
  64. package/dist/runtime/agent.js +47 -0
  65. package/dist/runtime/agent.js.map +1 -0
  66. package/dist/runtime/approval-gate.d.ts +17 -0
  67. package/dist/runtime/approval-gate.d.ts.map +1 -0
  68. package/dist/runtime/approval-gate.js +18 -0
  69. package/dist/runtime/approval-gate.js.map +1 -0
  70. package/dist/runtime/command.d.ts +14 -0
  71. package/dist/runtime/command.d.ts.map +1 -0
  72. package/dist/runtime/command.js +33 -0
  73. package/dist/runtime/command.js.map +1 -0
  74. package/dist/runtime/diff-inspector.d.ts +7 -0
  75. package/dist/runtime/diff-inspector.d.ts.map +1 -0
  76. package/dist/runtime/diff-inspector.js +24 -0
  77. package/dist/runtime/diff-inspector.js.map +1 -0
  78. package/dist/runtime/executor.d.ts +21 -0
  79. package/dist/runtime/executor.d.ts.map +1 -0
  80. package/dist/runtime/executor.js +142 -0
  81. package/dist/runtime/executor.js.map +1 -0
  82. package/dist/runtime/intake.d.ts +11 -0
  83. package/dist/runtime/intake.d.ts.map +1 -0
  84. package/dist/runtime/intake.js +33 -0
  85. package/dist/runtime/intake.js.map +1 -0
  86. package/dist/runtime/package-manager.d.ts +14 -0
  87. package/dist/runtime/package-manager.d.ts.map +1 -0
  88. package/dist/runtime/package-manager.js +20 -0
  89. package/dist/runtime/package-manager.js.map +1 -0
  90. package/dist/runtime/policy-engine.d.ts +7 -0
  91. package/dist/runtime/policy-engine.d.ts.map +1 -0
  92. package/dist/runtime/policy-engine.js +8 -0
  93. package/dist/runtime/policy-engine.js.map +1 -0
  94. package/dist/runtime/provider-runner.d.ts +18 -0
  95. package/dist/runtime/provider-runner.d.ts.map +1 -0
  96. package/dist/runtime/provider-runner.js +45 -0
  97. package/dist/runtime/provider-runner.js.map +1 -0
  98. package/package.json +24 -19
  99. package/schemas/harness.schema.json +41 -0
  100. package/schemas/preset.schema.json +62 -0
@@ -1,27 +1,61 @@
1
- import type { AgentsConfig } from './agent.js';
2
- import type { Policy } from './policy.js';
3
- /** What a preset looks for when deciding whether it applies to a project. */
4
- export interface PresetDetection {
5
- requiredFiles: string[];
6
- requiredDependencies: string[];
1
+ /**
2
+ * The `preset.json` document shipped inside a preset package.
3
+ *
4
+ * A preset is a governance specification. Today it is a data package: it
5
+ * declares what it inherits and where the documents it provides live inside its
6
+ * own package, and no field may point outside the package directory. `entry` is
7
+ * the declared hook for a preset that also ships code; the resolver validates
8
+ * only the path, and no runtime loads it yet (M21).
9
+ */
10
+ export interface PresetManifest {
11
+ /**
12
+ * The package name, e.g. `@pedyc/harness-preset-vue`.
13
+ *
14
+ * It must equal the package the manifest was resolved from. Two packages
15
+ * claiming one identity would make `extends` ambiguous and make a cycle
16
+ * report name a package the reader cannot find.
17
+ */
18
+ name: string;
19
+ /**
20
+ * Package names this preset inherits from, never versions: versions belong to
21
+ * `package.json` and the lockfile, so a project upgrades a preset the same way
22
+ * it upgrades any other dependency.
23
+ */
24
+ extends?: string[];
25
+ /** Path to a policy document inside this package. */
26
+ policy?: string;
27
+ /** Path to an agent configuration document inside this package. */
28
+ agents?: string;
29
+ /** Path to the markdown `init` uses to seed the target project's `AGENTS.md`. */
30
+ instruction?: string;
31
+ /**
32
+ * Path to the module that registers this preset's extensions.
33
+ *
34
+ * Declared for forward compatibility; no runtime loads it yet (M21). The
35
+ * resolver validates only that the path stays inside the package and exists.
36
+ */
37
+ entry?: string;
38
+ /** Declared for forward compatibility; no runtime consumes it yet. */
39
+ verification?: string;
40
+ /** Declared for forward compatibility; no runtime consumes it yet. */
41
+ rules?: string[];
7
42
  }
8
43
  /**
9
- * A project preset: the files `pedyc-harness init` writes into a target project
10
- * and the defaults it derives from them.
44
+ * A preset that has been located and whose inheritance has been resolved.
11
45
  *
12
- * The shape is declared here rather than in the preset packages so the packages
13
- * stay independent of each other. Presets import this as a type only, so nothing
14
- * is coupled at runtime.
46
+ * `ResolvedPreset[]` is ordered dependencies-first, so a later entry is always
47
+ * more specific than the ones it inherits from.
15
48
  */
16
- export interface Preset {
49
+ export interface ResolvedPreset {
50
+ /** The npm package name this preset came from. */
51
+ packageName: string;
52
+ /** The name the preset manifests under. Equal to `packageName`. */
17
53
  name: string;
18
- detection: PresetDetection;
19
- defaultProductPaths: string[];
20
- verificationScripts: string[];
21
- skills: string[];
22
- policy: Policy;
23
- agents: AgentsConfig;
24
- /** Written to the target project's `AGENTS.md`. */
25
- instruction: string;
54
+ /** Absolute path of the package directory. */
55
+ directory: string;
56
+ /** Direct dependencies in declaration order, deduplicated by the resolver. */
57
+ extends: string[];
58
+ /** The validated `preset.json` contents. */
59
+ manifest: PresetManifest;
26
60
  }
27
61
  //# sourceMappingURL=preset.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"preset.d.ts","sourceRoot":"","sources":["../../src/contracts/preset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEzC,6EAA6E;AAC7E,MAAM,WAAW,e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
@@ -0,0 +1,33 @@
1
+ import { Ajv2020 } from 'ajv/dist/2020.js';
2
+ import type { ErrorObject, ValidateFunction } from 'ajv';
3
+ /** The raw JSON Schema documents a project commits under `.harness/`. */
4
+ export interface HarnessSchemas {
5
+ input: object;
6
+ output: object;
7
+ agentResponse: object;
8
+ }
9
+ export interface HarnessValidators {
10
+ ajv: Ajv2020;
11
+ input: ValidateFunction;
12
+ output: ValidateFunction;
13
+ agentResponse: ValidateFunction;
14
+ }
15
+ /** A compiled validator, including the `errors` it records on failure. */
16
+ export interface ResponseValidator {
17
+ (value: unknown): boolean;
18
+ errors?: null | ErrorObject[];
19
+ }
20
+ /** The only Ajv capability the agent-response parser needs. */
21
+ export type SchemaErrorFormatter = Pick<Ajv2020, 'errorsText'>;
22
+ /** Creates an Ajv instance configured the way every Harness schema expects. */
23
+ export declare const createAjv: () => Ajv2020;
24
+ /**
25
+ * Compiles schema documents into validators.
26
+ *
27
+ * This half of the schema boundary is pure: it touches no file system, which is
28
+ * what lets `contracts/` stay free of I/O. Reading the documents off disk is the
29
+ * config layer's job.
30
+ */
31
+ export declare const createValidators: (schemas: HarnessSchemas) => HarnessValidators;
32
+ export declare const validationDetails: (ajv: SchemaErrorFormatter, validator: ResponseValidator) => string;
33
+ //# sourceMappingURL=validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/contracts/validator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAA;AAExD,yEAAyE;AACzE,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,OAAO,CAAA;IACZ,KAAK,EAAE,gBAAgB,CAAA;IACvB,MAAM,EAAE,gBAAgB,CAAA;IACxB,aAAa,EAAE,gBAAgB,CAAA;CAChC;AAED,0EAA0E;AAC1E,MAAM,WAAW,iBAAiB;IAChC,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAA;IACzB,MAAM,CAAC,EAAE,IAAI,GAAG,WAAW,EAAE,CAAA;CAC9B;AAED,+DAA+D;AAC/D,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAA;AAE9D,+EAA+E;AAC/E,eAAO,MAAM,SAAS,QAAO,OAA0D,CAAA;AAEvF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAAI,SAAS,cAAc,KAAG,iBAQ1D,CAAA;AAED,eAAO,MAAM,iBAAiB,GAAI,KAAK,oBAAoB,EAAE,WAAW,iBAAiB,KAAG,MAC1D,CAAA"}
@@ -0,0 +1,23 @@
1
+ // The default export is typed as a namespace under NodeNext; the named export is
2
+ // the class, and ajv ships it on both the ESM and CJS sides.
3
+ import { Ajv2020 } from 'ajv/dist/2020.js';
4
+ /** Creates an Ajv instance configured the way every Harness schema expects. */
5
+ export const createAjv = () => new Ajv2020({ allErrors: true, strict: false });
6
+ /**
7
+ * Compiles schema documents into validators.
8
+ *
9
+ * This half of the schema boundary is pure: it touches no file system, which is
10
+ * what lets `contracts/` stay free of I/O. Reading the documents off disk is the
11
+ * config layer's job.
12
+ */
13
+ export const createValidators = (schemas) => {
14
+ const ajv = createAjv();
15
+ return {
16
+ ajv,
17
+ input: ajv.compile(schemas.input),
18
+ output: ajv.compile(schemas.output),
19
+ agentResponse: ajv.compile(schemas.agentResponse),
20
+ };
21
+ };
22
+ export const validationDetails = (ajv, validator) => ajv.errorsText(validator.errors);
23
+ //# sourceMappingURL=validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.js","sourceRoot":"","sources":["../../src/contracts/validator.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,6DAA6D;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AA0B1C,+EAA+E;AAC/E,MAAM,CAAC,MAAM,SAAS,GAAG,GAAY,EAAE,CAAC,IAAI,OAAO,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAA;AAEvF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAAuB,EAAqB,EAAE;IAC7E,MAAM,GAAG,GAAG,SAAS,EAAE,CAAA;IACvB,OAAO;QACL,GAAG;QACH,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC;QACjC,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC;QACnC,aAAa,EAAE,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC;KAClD,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,GAAyB,EAAE,SAA4B,EAAU,EAAE,CACnG,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA"}
package/dist/index.d.ts CHANGED
@@ -1,20 +1,21 @@
1
1
  export type * from './contracts/index.js';
2
- export { detectPackageManager, packageScriptCommand } from './core/package-manager.js';
3
- export type { PackageManager, PackageScriptCommand } from './core/package-manager.js';
4
- export { normalizeTask, readTaskFile } from './core/intake.js';
5
- export { runCommand } from './core/command.js';
6
- export type { CommandResult } from './core/command.js';
7
- export { changedFiles, snapshotFiles } from './core/diff-inspector.js';
8
- export type { FileSnapshot } from './core/diff-inspector.js';
9
- export { loadSchemas, createValidators, validationDetails } from './core/validator.js';
10
- export type { HarnessSchemas, HarnessValidators, ResponseValidator, SchemaErrorFormatter, } from './core/validator.js';
11
- export { parseAgentResponse, validateStageResponse } from './core/agent.js';
12
- export type { ParsedAgentResponse } from './core/agent.js';
13
- export { validatePolicy, findOutOfScopeChanges, isCommandAllowed } from './core/policy-engine.js';
14
- export { testerApproved, reviewerApproved } from './core/approval-gate.js';
15
- export { createProviderRunner } from './adapters/provider-runner.js';
16
- export type { ProviderRunnerOptions } from './adapters/provider-runner.js';
17
- export { runOrchestrator } from './core/executor.js';
18
- export type { OrchestratorOptions } from './core/executor.js';
2
+ export type { ConfigProblem, ManifestResult } from './config/index.js';
3
+ export { agentProblems, asRecord, compileSchema, configError, createAjv, createValidators, defaultAgents, defaultPolicy, formatConfigError, harnessDirectory, loadHarnessConfig, loadSchemas, manifestFile, manifestPath, policyProblems, presetDocument, presetFile, presetPackageName, presetSchema, readManifest, readSchema, resolvePresets, validateAgents, validatePolicy, validationDetails, } from './config/index.js';
4
+ export type { HarnessSchemas, HarnessValidators, PresetsResult, ResponseValidator, SchemaErrorFormatter, } from './config/index.js';
5
+ export { detectPackageManager, packageScriptCommand } from './runtime/package-manager.js';
6
+ export type { PackageManager, PackageScriptCommand } from './runtime/package-manager.js';
7
+ export { normalizeTask, readTaskFile } from './runtime/intake.js';
8
+ export { runCommand } from './runtime/command.js';
9
+ export type { CommandResult } from './runtime/command.js';
10
+ export { changedFiles, snapshotFiles } from './runtime/diff-inspector.js';
11
+ export type { FileSnapshot } from './runtime/diff-inspector.js';
12
+ export { parseAgentResponse, validateStageResponse } from './runtime/agent.js';
13
+ export type { ParsedAgentResponse } from './runtime/agent.js';
14
+ export { findOutOfScopeChanges, isCommandAllowed } from './runtime/policy-engine.js';
15
+ export { testerApproved, reviewerApproved } from './runtime/approval-gate.js';
16
+ export { createProviderRunner } from './runtime/provider-runner.js';
17
+ export type { ProviderRunnerOptions } from './runtime/provider-runner.js';
18
+ export { runOrchestrator } from './runtime/executor.js';
19
+ export type { OrchestratorOptions } from './runtime/executor.js';
19
20
  export declare const harnessCoreVersion: string;
20
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,mBAAmB,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,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AAEzE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,YAAY,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAIhE,eAAO,MAAM,kBAAkB,EAAE,MAAkE,CAAA"}
package/dist/index.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import { createRequire } from 'node:module';
2
- export { detectPackageManager, packageScriptCommand } from './core/package-manager.js';
3
- export { normalizeTask, readTaskFile } from './core/intake.js';
4
- export { runCommand } from './core/command.js';
5
- export { changedFiles, snapshotFiles } from './core/diff-inspector.js';
6
- export { loadSchemas, createValidators, validationDetails } from './core/validator.js';
7
- export { parseAgentResponse, validateStageResponse } from './core/agent.js';
8
- export { validatePolicy, findOutOfScopeChanges, isCommandAllowed } from './core/policy-engine.js';
9
- export { testerApproved, reviewerApproved } from './core/approval-gate.js';
10
- export { createProviderRunner } from './adapters/provider-runner.js';
11
- export { runOrchestrator } from './core/executor.js';
2
+ export { agentProblems, asRecord, compileSchema, configError, createAjv, createValidators, defaultAgents, defaultPolicy, formatConfigError, harnessDirectory, loadHarnessConfig, loadSchemas, manifestFile, manifestPath, policyProblems, presetDocument, presetFile, presetPackageName, presetSchema, readManifest, readSchema, resolvePresets, validateAgents, validatePolicy, validationDetails, } from './config/index.js';
3
+ export { detectPackageManager, packageScriptCommand } from './runtime/package-manager.js';
4
+ export { normalizeTask, readTaskFile } from './runtime/intake.js';
5
+ export { runCommand } from './runtime/command.js';
6
+ export { changedFiles, snapshotFiles } from './runtime/diff-inspector.js';
7
+ export { parseAgentResponse, validateStageResponse } from './runtime/agent.js';
8
+ export { findOutOfScopeChanges, isCommandAllowed } from './runtime/policy-engine.js';
9
+ export { testerApproved, reviewerApproved } from './runtime/approval-gate.js';
10
+ export { createProviderRunner } from './runtime/provider-runner.js';
11
+ export { runOrchestrator } from './runtime/executor.js';
12
12
  // Read from the manifest rather than repeating the literal here: a hardcoded copy silently
13
13
  // kept reporting the previous release after the version was bumped.
14
14
  export const harnessCoreVersion = createRequire(import.meta.url)('../package.json').version;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAI3C,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAGtF,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAG9C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAGtE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAQtF,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAG3E,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AACjG,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAE1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAA;AAGpE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAGpD,2FAA2F;AAC3F,oEAAoE;AACpE,MAAM,CAAC,MAAM,kBAAkB,GAAW,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAQ3C,OAAO,EACL,aAAa,EACb,QAAQ,EACR,aAAa,EACb,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,cAAc,EACd,cAAc,EACd,cAAc,EACd,iBAAiB,GAClB,MAAM,mBAAmB,CAAA;AAS1B,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AAGzF,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAGjD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAGzE,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAG9E,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AACpF,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAE7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AAGnE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAGvD,2FAA2F;AAC3F,oEAAoE;AACpE,MAAM,CAAC,MAAM,kBAAkB,GAAW,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAA"}
@@ -0,0 +1,22 @@
1
+ import type { AgentPayload, AgentRole } from '../contracts/index.js';
2
+ import type { ResponseValidator, SchemaErrorFormatter } from '../contracts/validator.js';
3
+ export interface ParsedAgentResponse {
4
+ ok: boolean;
5
+ details: string;
6
+ payload: AgentPayload;
7
+ }
8
+ /**
9
+ * Decodes one provider response from stdout.
10
+ *
11
+ * An empty stdout is accepted: a built-in stage legitimately produces no
12
+ * payload. Anything else must be a single JSON object matching the agent
13
+ * response schema.
14
+ */
15
+ export declare const parseAgentResponse: (name: AgentRole, stdout: string, validate: ResponseValidator, ajv: SchemaErrorFormatter) => ParsedAgentResponse;
16
+ /**
17
+ * Applies the stage-specific requirements the response schema cannot express.
18
+ *
19
+ * Returns the problem as a message, or `null` when the stage may proceed.
20
+ */
21
+ export declare const validateStageResponse: (name: AgentRole, payload: AgentPayload) => string | null;
22
+ //# sourceMappingURL=agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/runtime/agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAExF,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,OAAO,CAAA;IACX,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,YAAY,CAAA;CACtB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAC7B,MAAM,SAAS,EACf,QAAQ,MAAM,EACd,UAAU,iBAAiB,EAC3B,KAAK,oBAAoB,KACxB,mBAgBF,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAAI,MAAM,SAAS,EAAE,SAAS,YAAY,KAAG,MAAM,GAAG,IAYvF,CAAA"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Decodes one provider response from stdout.
3
+ *
4
+ * An empty stdout is accepted: a built-in stage legitimately produces no
5
+ * payload. Anything else must be a single JSON object matching the agent
6
+ * response schema.
7
+ */
8
+ export const parseAgentResponse = (name, stdout, validate, ajv) => {
9
+ const trimmed = stdout.trim();
10
+ if (!trimmed)
11
+ return { ok: true, details: `${name} completed without a response payload.`, payload: {} };
12
+ try {
13
+ const payload = JSON.parse(trimmed);
14
+ if (!validate(payload)) {
15
+ return {
16
+ ok: false,
17
+ details: `${name} returned an invalid response: ${ajv.errorsText(validate.errors)}`,
18
+ payload: {},
19
+ };
20
+ }
21
+ return { ok: true, details: payload.details ?? `${name} returned a structured response.`, payload };
22
+ }
23
+ catch {
24
+ return { ok: false, details: `${name} must return one JSON object on stdout.`, payload: {} };
25
+ }
26
+ };
27
+ /**
28
+ * Applies the stage-specific requirements the response schema cannot express.
29
+ *
30
+ * Returns the problem as a message, or `null` when the stage may proceed.
31
+ */
32
+ export const validateStageResponse = (name, payload) => {
33
+ if (name === 'planner' && (!Array.isArray(payload.implementationPlan) || payload.implementationPlan.length === 0)) {
34
+ return 'planner must return a non-empty implementationPlan.';
35
+ }
36
+ if (name === 'tester') {
37
+ if (typeof payload.approved !== 'boolean')
38
+ return 'tester must return a boolean approved field.';
39
+ if (!Array.isArray(payload.evidence) || payload.evidence.length === 0)
40
+ return 'tester must return non-empty evidence.';
41
+ }
42
+ if (name === 'reviewer' && typeof payload.approved !== 'boolean') {
43
+ return 'reviewer must return a boolean approved field.';
44
+ }
45
+ return null;
46
+ };
47
+ //# sourceMappingURL=agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/runtime/agent.ts"],"names":[],"mappings":"AASA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,IAAe,EACf,MAAc,EACd,QAA2B,EAC3B,GAAyB,EACJ,EAAE;IACvB,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,EAAE,CAAA;IAC7B,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,wCAAwC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAA;IACxG,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAiB,CAAA;QACnD,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YACvB,OAAO;gBACL,EAAE,EAAE,KAAK;gBACT,OA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
+ * Whether the tester stage may pass.
4
+ *
5
+ * Two independent conditions: every configured gate actually passed, and the
6
+ * tester agent approved the evidence it was handed. A run never passes on the
7
+ * coder's own claim.
8
+ */
9
+ export declare const testerApproved: (verification: VerificationCheck[], externalTest: AgentCallResult) => boolean;
10
+ /**
11
+ * Whether the reviewer stage may pass.
12
+ *
13
+ * Scope is checked here rather than trusted to the agent: any out-of-scope file
14
+ * rejects the change even when the reviewer approves it.
15
+ */
16
+ export declare const reviewerApproved: (reviewer: AgentCallResult, outOfScopeChanges: string[]) => boolean;
17
+ //# sourceMappingURL=approval-gate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"approval-gate.d.ts","sourceRoot":"","sources":["../../src/runtime/approval-gate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAE/E;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GACzB,cAAc,iBAAiB,EAAE,EACjC,cAAc,eAAe,KAC5B,OAGwC,CAAA;AAE3C;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAC3B,UAAU,eAAe,EACzB,mBAAmB,MAAM,EAAE,KAC1B,OACmF,CAAA"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Whether the tester stage may pass.
3
+ *
4
+ * Two independent conditions: every configured gate actually passed, and the
5
+ * tester agent approved the evidence it was handed. A run never passes on the
6
+ * coder's own claim.
7
+ */
8
+ export const testerApproved = (verification, externalTest) => verification.every((check) => check.result === 'pass')
9
+ && externalTest.ok
10
+ && externalTest.payload.approved === true;
11
+ /**
12
+ * Whether the reviewer stage may pass.
13
+ *
14
+ * Scope is checked here rather than trusted to the agent: any out-of-scope file
15
+ * rejects the change even when the reviewer approves it.
16
+ */
17
+ export const reviewerApproved = (reviewer, outOfScopeChanges) => reviewer.ok && reviewer.payload?.approved === true && outOfScopeChanges.length === 0;
18
+ //# sourceMappingURL=approval-gate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"approval-gate.js","sourceRoot":"","sources":["../../src/runtime/approval-gate.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,YAAiC,EACjC,YAA6B,EACpB,EAAE,CACX,YAAY,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC;OACnD,YAAY,CAAC,EAAE;OACf,YAAY,CAAC,OAAO,CAAC,QAAQ,KAAK,IAAI,CAAA;AAE3C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,QAAyB,EACzB,iBAA2B,EAClB,EAAE,CACX,QAAQ,CAAC,EAAE,IAAI,QAAQ,CAAC,OAAO,EAAE,QAAQ,KAAK,IAAI,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC,CAAA"}
@@ -0,0 +1,14 @@
1
+ /** The outcome of one spawned process. */
2
+ export interface CommandResult {
3
+ code: number;
4
+ stdout: string;
5
+ stderr: string;
6
+ }
7
+ /**
8
+ * Runs a command in `root` and resolves with its exit code and output.
9
+ *
10
+ * Failures resolve rather than reject: a non-zero exit is a normal result that
11
+ * the orchestrator records as evidence.
12
+ */
13
+ export declare const runCommand: (root: string, command: string, args?: string[], stdin?: unknown) => Promise<CommandResult>;
14
+ //# sourceMappingURL=command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/runtime/command.ts"],"names":[],"mappings":"AAEA,0CAA0C;AAC1C,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACf;AAcD;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GACrB,MAAM,MAAM,EACZ,SAAS,MAAM,EACf,OAAM,MAAM,EAAO,EACnB,QAAO,OAAc,KACpB,OAAO,CAAC,aAAa,CActB,CAAA"}
@@ -0,0 +1,33 @@
1
+ import { spawn } from 'node:child_process';
2
+ // Windows resolves these through .cmd shims, which spawn cannot find by bare name.
3
+ const normalizeCommand = (command) => {
4
+ if (process.platform === 'win32'
5
+ && ['npm', 'npx', 'pnpm', 'yarn'].includes(command)
6
+ && !command.endsWith('.cmd')) {
7
+ return `${command}.cmd`;
8
+ }
9
+ return command;
10
+ };
11
+ /**
12
+ * Runs a command in `root` and resolves with its exit code and output.
13
+ *
14
+ * Failures resolve rather than reject: a non-zero exit is a normal result that
15
+ * the orchestrator records as evidence.
16
+ */
17
+ export const runCommand = (root, command, args = [], stdin = null) => new Promise((resolve) => {
18
+ const child = spawn(normalizeCommand(command), args, {
19
+ cwd: root,
20
+ shell: process.platform === 'win32',
21
+ windowsHide: true,
22
+ });
23
+ let stdout = '';
24
+ let stderr = '';
25
+ child.stdout.on('data', (chunk) => { stdout += chunk; });
26
+ child.stderr.on('data', (chunk) => { stderr += chunk; });
27
+ child.on('close', (code) => resolve({ code: code ?? 1, stdout, stderr }));
28
+ child.on('error', (error) => resolve({ code: 1, stdout, stderr: error.message }));
29
+ if (stdin !== null)
30
+ child.stdin.write(`${JSON.stringify(stdin)}\n`);
31
+ child.stdin.end();
32
+ });
33
+ //# sourceMappingURL=command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.js","sourceRoot":"","sources":["../../src/runtime/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAS1C,mFAAmF;AACnF,MAAM,gBAAgB,GAAG,CAAC,OAAe,EAAU,EAAE;IACnD,IACE,OAAO,CAAC,QAAQ,KAAK,OAAO;WACzB,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC;WAChD,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EAC5B,CAAC;QACD,OAAO,GAAG,OAAO,MAAM,CAAA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A;IACnE,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,CAAA;AACnB,CAAC,CAAC,CAAA"}
@@ -0,0 +1,7 @@
1
+ /** File contents keyed by repository-relative POSIX path. */
2
+ export type FileSnapshot = Map<string, string>;
3
+ /** Captures every product file's contents so a later snapshot can be compared. */
4
+ export declare const snapshotFiles: (root: string) => FileSnapshot;
5
+ /** Names the files that were added, removed or modified between two snapshots. */
6
+ export declare const changedFiles: (before: FileSnapshot, after: FileSnapshot) => string[];
7
+ //# sourceMappingURL=diff-inspector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff-inspector.d.ts","sourceRoot":"","sources":["../../src/runtime/diff-inspector.ts"],"names":[],"mappings":"AAGA,6DAA6D;AAC7D,MAAM,MAAM,YAAY,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAgB9C,kFAAkF;AAClF,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,KAAG,YAC2C,CAAA;AAExF,kFAAkF;AAClF,eAAO,MAAM,YAAY,GAAI,QAAQ,YAAY,EAAE,OAAO,YAAY,KAAG,MAAM,EAEqB,CAAA"}
@@ -0,0 +1,24 @@
1
+ import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
2
+ import { join, relative } from 'node:path';
3
+ // Build output and installed dependencies are never part of a product change.
4
+ const ignoredAtRoot = ['node_modules', 'dist', '.git'];
5
+ const listFiles = (root, directory = root, result = []) => {
6
+ if (!existsSync(directory))
7
+ return result;
8
+ for (const entry of readdirSync(directory)) {
9
+ if (directory === root && ignoredAtRoot.includes(entry))
10
+ continue;
11
+ const path = join(directory, entry);
12
+ if (statSync(path).isDirectory())
13
+ listFiles(root, path, result);
14
+ else
15
+ result.push(relative(root, path).replaceAll('\\', '/'));
16
+ }
17
+ return result;
18
+ };
19
+ /** Captures every product file's contents so a later snapshot can be compared. */
20
+ export const snapshotFiles = (root) => new Map(listFiles(root).map((file) => [file, readFileSync(join(root, file), 'utf8')]));
21
+ /** Names the files that were added, removed or modified between two snapshots. */
22
+ export const changedFiles = (before, after) => [...new Set([...before.keys(), ...after.keys()])]
23
+ .filter((file) => !before.has(file) || !after.has(file) || before.get(file) !== after.get(file));
24
+ //# sourceMappingURL=diff-inspector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff-inspector.js","sourceRoot":"","sources":["../../src/runtime/diff-inspector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AACzE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAK1C,8EAA8E;AAC9E,MAAM,aAAa,GAAG,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;AAEtD,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,YAAoB,IAAI,EAAE,SAAmB,EAAE,EAAY,EAAE;IAC5F,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,OAAO,MAAM,CAAA;IACzC,KAAK,MAAM,KAAK,IAAI,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC;QAC3C,IAAI,SAAS,KAAK,IAAI,IAAI,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC;YAAE,SAAQ;QACjE,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA;QACnC,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE;YAAE,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;;YAC1D,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAA;IAC9D,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAED,kFAAkF;AAClF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAY,EAAgB,EAAE,CAC1D,IAAI,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;AAExF,kFAAkF;AAClF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAoB,EAAE,KAAmB,EAAY,EAAE,CAClF,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,EAAE,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;KAC9C,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAA"}
@@ -0,0 +1,21 @@
1
+ import type { NormalizedTask, OrchestrationResult, Policy, RunAgent, VerificationCheck } from '../contracts/index.js';
2
+ import type { FileSnapshot } from './diff-inspector.js';
3
+ export interface OrchestratorOptions {
4
+ input: NormalizedTask;
5
+ policy: Policy;
6
+ dryRun: boolean;
7
+ snapshot: () => FileSnapshot;
8
+ changedFiles: (before: FileSnapshot, after: FileSnapshot) => string[];
9
+ runAgent: RunAgent;
10
+ runVerification: () => Promise<VerificationCheck[]>;
11
+ writeVerification?: (iteration: number, verification: VerificationCheck[]) => void;
12
+ }
13
+ /**
14
+ * Runs the fixed Planner → Coder → Tester → Reviewer pipeline.
15
+ *
16
+ * The loop retries the coder only while the tester has not approved and the
17
+ * iteration budget allows it; a planner, coder or reviewer failure stops the
18
+ * run outright.
19
+ */
20
+ export declare const runOrchestrator: ({ input, policy, dryRun, snapshot, changedFiles, runAgent, runVerification, writeVerification, }: OrchestratorOptions) => Promise<OrchestrationResult>;
21
+ //# sourceMappingURL=executor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../src/runtime/executor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,cAAc,EACd,mBAAmB,EAGnB,MAAM,EACN,QAAQ,EACR,iBAAiB,EAClB,MAAM,uBAAuB,CAAA;AAE9B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAGvD,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,cAAc,CAAA;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,OAAO,CAAA;IACf,QAAQ,EAAE,MAAM,YAAY,CAAA;IAC5B,YAAY,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,KAAK,MAAM,EAAE,CAAA;IACrE,QAAQ,EAAE,QAAQ,CAAA;IAClB,eAAe,EAAE,MAAM,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAA;IACnD,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,iBAAiB,EAAE,KAAK,IAAI,CAAA;CACnF;AAED;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAAU,kGASnC,mBAAmB,KAAG,OAAO,CAAC,mBAAmB,CA8InD,CAAA"}