@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.
- package/README.md +41 -0
- package/dist/config/agents.d.ts +14 -0
- package/dist/config/agents.d.ts.map +1 -0
- package/dist/config/agents.js +39 -0
- package/dist/config/agents.js.map +1 -0
- package/dist/config/bundled.d.ts +14 -0
- package/dist/config/bundled.d.ts.map +1 -0
- package/dist/config/bundled.js +38 -0
- package/dist/config/bundled.js.map +1 -0
- package/dist/config/defaults.d.ts +19 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +32 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/errors.d.ts +12 -0
- package/dist/config/errors.d.ts.map +1 -0
- package/dist/config/errors.js +11 -0
- package/dist/config/errors.js.map +1 -0
- package/dist/config/index.d.ts +15 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +18 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/json.d.ts +14 -0
- package/dist/config/json.d.ts.map +1 -0
- package/dist/config/json.js +5 -0
- package/dist/config/json.js.map +1 -0
- package/dist/config/loader.d.ts +16 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +221 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/manifest.d.ts +22 -0
- package/dist/config/manifest.d.ts.map +1 -0
- package/dist/config/manifest.js +56 -0
- package/dist/config/manifest.js.map +1 -0
- package/dist/config/policy.d.ts +14 -0
- package/dist/config/policy.d.ts.map +1 -0
- package/dist/config/policy.js +35 -0
- package/dist/config/policy.js.map +1 -0
- package/dist/config/presets.d.ts +35 -0
- package/dist/config/presets.d.ts.map +1 -0
- package/dist/config/presets.js +187 -0
- package/dist/config/presets.js.map +1 -0
- package/dist/config/schema.d.ts +16 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +24 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/contracts/harness.d.ts +86 -0
- package/dist/contracts/harness.d.ts.map +1 -0
- package/dist/contracts/harness.js +2 -0
- package/dist/contracts/harness.js.map +1 -0
- package/dist/contracts/index.d.ts +3 -1
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/preset.d.ts +54 -20
- package/dist/contracts/preset.d.ts.map +1 -1
- package/dist/contracts/validator.d.ts +33 -0
- package/dist/contracts/validator.d.ts.map +1 -0
- package/dist/contracts/validator.js +23 -0
- package/dist/contracts/validator.js.map +1 -0
- package/dist/index.d.ts +18 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -10
- package/dist/index.js.map +1 -1
- package/dist/runtime/agent.d.ts +22 -0
- package/dist/runtime/agent.d.ts.map +1 -0
- package/dist/runtime/agent.js +47 -0
- package/dist/runtime/agent.js.map +1 -0
- package/dist/runtime/approval-gate.d.ts +17 -0
- package/dist/runtime/approval-gate.d.ts.map +1 -0
- package/dist/runtime/approval-gate.js +18 -0
- package/dist/runtime/approval-gate.js.map +1 -0
- package/dist/runtime/command.d.ts +14 -0
- package/dist/runtime/command.d.ts.map +1 -0
- package/dist/runtime/command.js +33 -0
- package/dist/runtime/command.js.map +1 -0
- package/dist/runtime/diff-inspector.d.ts +7 -0
- package/dist/runtime/diff-inspector.d.ts.map +1 -0
- package/dist/runtime/diff-inspector.js +24 -0
- package/dist/runtime/diff-inspector.js.map +1 -0
- package/dist/runtime/executor.d.ts +21 -0
- package/dist/runtime/executor.d.ts.map +1 -0
- package/dist/runtime/executor.js +142 -0
- package/dist/runtime/executor.js.map +1 -0
- package/dist/runtime/intake.d.ts +11 -0
- package/dist/runtime/intake.d.ts.map +1 -0
- package/dist/runtime/intake.js +33 -0
- package/dist/runtime/intake.js.map +1 -0
- package/dist/runtime/package-manager.d.ts +14 -0
- package/dist/runtime/package-manager.d.ts.map +1 -0
- package/dist/runtime/package-manager.js +20 -0
- package/dist/runtime/package-manager.js.map +1 -0
- package/dist/runtime/policy-engine.d.ts +7 -0
- package/dist/runtime/policy-engine.d.ts.map +1 -0
- package/dist/runtime/policy-engine.js +8 -0
- package/dist/runtime/policy-engine.js.map +1 -0
- package/dist/runtime/provider-runner.d.ts +18 -0
- package/dist/runtime/provider-runner.d.ts.map +1 -0
- package/dist/runtime/provider-runner.js +45 -0
- package/dist/runtime/provider-runner.js.map +1 -0
- package/package.json +24 -19
- package/schemas/harness.schema.json +41 -0
- package/schemas/preset.schema.json +62 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { reviewerApproved, testerApproved } from './approval-gate.js';
|
|
2
|
+
import { findOutOfScopeChanges } from './policy-engine.js';
|
|
3
|
+
/**
|
|
4
|
+
* Runs the fixed Planner → Coder → Tester → Reviewer pipeline.
|
|
5
|
+
*
|
|
6
|
+
* The loop retries the coder only while the tester has not approved and the
|
|
7
|
+
* iteration budget allows it; a planner, coder or reviewer failure stops the
|
|
8
|
+
* run outright.
|
|
9
|
+
*/
|
|
10
|
+
export const runOrchestrator = async ({ input, policy, dryRun, snapshot, changedFiles, runAgent, runVerification, writeVerification = () => { }, }) => {
|
|
11
|
+
const maxIterations = Math.min(Math.max(Number(input.maxIterations ?? policy.maxIterations ?? 3), 1), policy.maxIterations ?? 3);
|
|
12
|
+
const phases = [];
|
|
13
|
+
const issues = [];
|
|
14
|
+
const fileChanges = [];
|
|
15
|
+
const implementationPlan = [
|
|
16
|
+
`Analyze the requested feature: ${input.feature.trim()}.`,
|
|
17
|
+
`Implement the objective while satisfying ${input.acceptanceCriteria.length} acceptance criteria.`,
|
|
18
|
+
'Run configured verification gates and review the result before reporting completion.',
|
|
19
|
+
];
|
|
20
|
+
if (dryRun) {
|
|
21
|
+
// A dry run is a safe preview: no Agent Provider is invoked, no verification
|
|
22
|
+
// gate is executed, and no product file can change. Report the same four
|
|
23
|
+
// phases so callers can consume the result with the regular output contract.
|
|
24
|
+
for (const [name, details] of [
|
|
25
|
+
['planner', 'Dry run: planner execution skipped; no agent provider was invoked.'],
|
|
26
|
+
['coder', 'Dry run: coder execution skipped; no product files were changed.'],
|
|
27
|
+
['tester', 'Dry run: tester execution skipped; no verification gates were executed.'],
|
|
28
|
+
['reviewer', 'Dry run: reviewer execution skipped; no product files were changed.'],
|
|
29
|
+
]) {
|
|
30
|
+
phases.push({ name, iteration: 1, status: 'passed', details });
|
|
31
|
+
}
|
|
32
|
+
return { completed: true, implementationPlan, fileChanges, verification: [], issues, phases, iterations: 1 };
|
|
33
|
+
}
|
|
34
|
+
const recordPhase = (name, status, details, iteration) => {
|
|
35
|
+
const phase = { name, status, details };
|
|
36
|
+
if (iteration)
|
|
37
|
+
phase.iteration = iteration;
|
|
38
|
+
phases.push(phase);
|
|
39
|
+
return phase;
|
|
40
|
+
};
|
|
41
|
+
recordPhase('planner', 'running', 'Validating task input and preparing an implementation plan.');
|
|
42
|
+
const plan = await runAgent('planner', { phase: 'planner', input, implementationPlan });
|
|
43
|
+
phases[phases.length - 1] = { name: 'planner', status: plan.ok ? 'passed' : 'failed', details: plan.details };
|
|
44
|
+
if (plan.payload.implementationPlan?.length) {
|
|
45
|
+
implementationPlan.splice(0, implementationPlan.length, ...plan.payload.implementationPlan);
|
|
46
|
+
}
|
|
47
|
+
if (!plan.ok)
|
|
48
|
+
issues.push(plan.details);
|
|
49
|
+
let lastVerification = [];
|
|
50
|
+
let completed = false;
|
|
51
|
+
for (let iteration = 1; iteration <= maxIterations && issues.length === 0; iteration += 1) {
|
|
52
|
+
const before = snapshot();
|
|
53
|
+
recordPhase('coder', 'running', 'Applying the approved implementation plan.', iteration);
|
|
54
|
+
const coder = await runAgent('coder', {
|
|
55
|
+
phase: 'coder',
|
|
56
|
+
input,
|
|
57
|
+
implementationPlan,
|
|
58
|
+
iteration,
|
|
59
|
+
previousVerification: lastVerification,
|
|
60
|
+
});
|
|
61
|
+
phases[phases.length - 1] = {
|
|
62
|
+
name: 'coder',
|
|
63
|
+
iteration,
|
|
64
|
+
status: coder.ok ? 'passed' : 'failed',
|
|
65
|
+
details: coder.details,
|
|
66
|
+
};
|
|
67
|
+
for (const file of changedFiles(before, snapshot())) {
|
|
68
|
+
fileChanges.push({ file, change: `Changed during coder iteration ${iteration}.` });
|
|
69
|
+
}
|
|
70
|
+
if (!coder.ok) {
|
|
71
|
+
issues.push(coder.details);
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
recordPhase('tester', 'running', 'Running required verification gates.', iteration);
|
|
75
|
+
const verification = await runVerification();
|
|
76
|
+
const externalTest = await runAgent('tester', {
|
|
77
|
+
phase: 'tester',
|
|
78
|
+
input,
|
|
79
|
+
implementationPlan,
|
|
80
|
+
verification,
|
|
81
|
+
iteration,
|
|
82
|
+
});
|
|
83
|
+
if (!externalTest.ok) {
|
|
84
|
+
verification.push({ command: 'external tester', result: 'fail', details: externalTest.details });
|
|
85
|
+
}
|
|
86
|
+
lastVerification = verification;
|
|
87
|
+
const testerOk = testerApproved(verification, externalTest);
|
|
88
|
+
phases[phases.length - 1] = {
|
|
89
|
+
name: 'tester',
|
|
90
|
+
iteration,
|
|
91
|
+
status: testerOk ? 'passed' : 'failed',
|
|
92
|
+
details: testerOk
|
|
93
|
+
? 'All required gates passed and tester approved the evidence.'
|
|
94
|
+
: externalTest.ok
|
|
95
|
+
? 'At least one required gate failed or tester rejected the evidence.'
|
|
96
|
+
: externalTest.details,
|
|
97
|
+
};
|
|
98
|
+
writeVerification(iteration, verification);
|
|
99
|
+
if (!testerOk && iteration === maxIterations) {
|
|
100
|
+
issues.push('Verification did not pass before maxIterations was reached.');
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
if (!testerOk)
|
|
104
|
+
continue;
|
|
105
|
+
recordPhase('reviewer', 'running', 'Checking scope, output contract, and acceptance criteria.', iteration);
|
|
106
|
+
const outOfScopeChanges = findOutOfScopeChanges(fileChanges.map(({ file }) => file), policy);
|
|
107
|
+
const reviewer = await runAgent('reviewer', {
|
|
108
|
+
phase: 'reviewer',
|
|
109
|
+
input,
|
|
110
|
+
implementationPlan,
|
|
111
|
+
verification,
|
|
112
|
+
fileChanges,
|
|
113
|
+
iteration,
|
|
114
|
+
});
|
|
115
|
+
const reviewerOk = reviewerApproved(reviewer, outOfScopeChanges);
|
|
116
|
+
const reviewerDetails = outOfScopeChanges.length
|
|
117
|
+
? `Out-of-scope files changed: ${outOfScopeChanges.join(', ')}`
|
|
118
|
+
: reviewer.details;
|
|
119
|
+
phases[phases.length - 1] = {
|
|
120
|
+
name: 'reviewer',
|
|
121
|
+
iteration,
|
|
122
|
+
status: reviewerOk ? 'passed' : 'failed',
|
|
123
|
+
details: reviewerDetails,
|
|
124
|
+
};
|
|
125
|
+
if (!reviewerOk) {
|
|
126
|
+
issues.push(reviewerDetails);
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
completed = true;
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
return {
|
|
133
|
+
completed,
|
|
134
|
+
implementationPlan,
|
|
135
|
+
fileChanges,
|
|
136
|
+
verification: lastVerification,
|
|
137
|
+
issues,
|
|
138
|
+
phases,
|
|
139
|
+
iterations: phases.filter((phase) => phase.name === 'coder').length,
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../src/runtime/executor.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAErE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAa1D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAAE,EACpC,KAAK,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,eAAe,EACf,iBAAiB,GAAG,GAAS,EAAE,GAAE,CAAC,GACd,EAAgC,EAAE;IACtD,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAC5B,IAAI,CAAC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,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ;YACxC,OAAO,EAAE,eAAe;SACzB,CAAA;QACD,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;YAC5B,MAAK;QACP,CAAC;QAED,SAAS,GAAG,IAAI,CAAA;QAChB,MAAK;IACP,CAAC;IAED,OAAO;QACL,SAAS;QACT,kBAAkB;QAClB,WAAW;QACX,YAAY,EAAE,gBAAgB;QAC9B,MAAM;QACN,MAAM;QACN,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,MAAM;KACpE,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IntakeResult, RawTaskInput } from '../contracts/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Folds any of the three input layers into the normalized task contract.
|
|
4
|
+
*
|
|
5
|
+
* Missing key information is reported as questions instead of an error, so the
|
|
6
|
+
* caller can ask a human rather than fail the run.
|
|
7
|
+
*/
|
|
8
|
+
export declare const normalizeTask: (task: RawTaskInput) => IntakeResult;
|
|
9
|
+
/** Reads a human task file and normalizes it. */
|
|
10
|
+
export declare const readTaskFile: (path: string) => IntakeResult;
|
|
11
|
+
//# sourceMappingURL=intake.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intake.d.ts","sourceRoot":"","sources":["../../src/runtime/intake.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAkB,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAIvF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,YAAY,KAAG,YAoBlD,CAAA;AAED,iDAAiD;AACjD,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,KAAG,YAC2B,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
const defaultChecks = ['pnpm run harness:verify', 'pnpm run type-check', 'pnpm run test:unit', 'pnpm run build'];
|
|
3
|
+
/**
|
|
4
|
+
* Folds any of the three input layers into the normalized task contract.
|
|
5
|
+
*
|
|
6
|
+
* Missing key information is reported as questions instead of an error, so the
|
|
7
|
+
* caller can ask a human rather than fail the run.
|
|
8
|
+
*/
|
|
9
|
+
export const normalizeTask = (task) => {
|
|
10
|
+
const normalized = {
|
|
11
|
+
feature: task.task?.trim() || task.feature?.trim() || '',
|
|
12
|
+
objective: task.goal?.trim() || task.objective?.trim() || '',
|
|
13
|
+
constraints: task.specialConstraints ?? task.constraints ?? [],
|
|
14
|
+
acceptanceCriteria: task.acceptance ?? task.acceptanceCriteria ?? [],
|
|
15
|
+
testHints: task.testHints ?? defaultChecks,
|
|
16
|
+
maxIterations: task.maxIterations ?? 3,
|
|
17
|
+
};
|
|
18
|
+
const questions = [];
|
|
19
|
+
if (!normalized.feature)
|
|
20
|
+
questions.push('要实现的任务或功能是什么?');
|
|
21
|
+
if (!normalized.objective)
|
|
22
|
+
questions.push('任务的目标是什么?');
|
|
23
|
+
if (!normalized.acceptanceCriteria.length)
|
|
24
|
+
questions.push('完成任务的验收标准是什么?');
|
|
25
|
+
return {
|
|
26
|
+
status: questions.length > 0 ? 'needs_input' : 'ready',
|
|
27
|
+
questions,
|
|
28
|
+
normalizedTask: normalized,
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
/** Reads a human task file and normalizes it. */
|
|
32
|
+
export const readTaskFile = (path) => normalizeTask(JSON.parse(readFileSync(path, 'utf8')));
|
|
33
|
+
//# sourceMappingURL=intake.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intake.js","sourceRoot":"","sources":["../../src/runtime/intake.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;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ACzD,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAiB,CAAC,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface PackageManager {
|
|
2
|
+
name: 'pnpm' | 'yarn' | 'npm';
|
|
3
|
+
command: string;
|
|
4
|
+
args: string[];
|
|
5
|
+
}
|
|
6
|
+
export interface PackageScriptCommand extends PackageManager {
|
|
7
|
+
/** The command as a human would type it, for evidence output. */
|
|
8
|
+
display: string;
|
|
9
|
+
}
|
|
10
|
+
/** Picks the package manager from the lockfile a project committed. */
|
|
11
|
+
export declare const detectPackageManager: (root: string) => PackageManager;
|
|
12
|
+
/** Builds the invocation that runs one package script in `root`. */
|
|
13
|
+
export declare const packageScriptCommand: (root: string, script: string) => PackageScriptCommand;
|
|
14
|
+
//# sourceMappingURL=package-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-manager.d.ts","sourceRoot":"","sources":["../../src/runtime/package-manager.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAA;IAC7B,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,EAAE,CAAA;CACf;AAED,MAAM,WAAW,oBAAqB,SAAQ,cAAc;IAC1D,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,uEAAuE;AACvE,eAAO,MAAM,oBAAoB,GAAI,MAAM,MAAM,KAAG,cAInD,CAAA;AAED,oEAAoE;AACpE,eAAO,MAAM,oBAAoB,GAAI,MAAM,MAAM,EAAE,QAAQ,MAAM,KAAG,oBAOnE,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
/** Picks the package manager from the lockfile a project committed. */
|
|
4
|
+
export const detectPackageManager = (root) => {
|
|
5
|
+
if (existsSync(join(root, 'pnpm-lock.yaml')))
|
|
6
|
+
return { name: 'pnpm', command: 'pnpm', args: ['run'] };
|
|
7
|
+
if (existsSync(join(root, 'yarn.lock')))
|
|
8
|
+
return { name: 'yarn', command: 'yarn', args: [] };
|
|
9
|
+
return { name: 'npm', command: 'npm', args: ['run'] };
|
|
10
|
+
};
|
|
11
|
+
/** Builds the invocation that runs one package script in `root`. */
|
|
12
|
+
export const packageScriptCommand = (root, script) => {
|
|
13
|
+
const manager = detectPackageManager(root);
|
|
14
|
+
return {
|
|
15
|
+
...manager,
|
|
16
|
+
args: [...manager.args, script],
|
|
17
|
+
display: `${manager.command} ${[...manager.args, script].join(' ')}`,
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=package-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-manager.js","sourceRoot":"","sources":["../../src/runtime/package-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAahC,uEAAuE;AACvE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,IAAY,EAAkB,EAAE;IACnE,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,KAAK,CAAC,EAAE,CAAA;IACrG,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,CAAA;IAC3F,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,KAAK,CAAC,EAAE,CAAA;AACvD,CAAC,CAAA;AAED,oEAAoE;AACpE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,IAAY,EAAE,MAAc,EAAwB,EAAE;IACzF,MAAM,OAAO,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAA;IAC1C,OAAO;QACL,GAAG,OAAO;QACV,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;QAC/B,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;KACrE,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CommandPolicy, Policy } from '../contracts/index.js';
|
|
2
|
+
export { validatePolicy } from '../config/policy.js';
|
|
3
|
+
/** Names the files the coder touched that the policy does not allow. */
|
|
4
|
+
export declare const findOutOfScopeChanges: (files: string[], policy: Policy) => string[];
|
|
5
|
+
/** Whether an agent may run a command. An empty allow list means "no restriction". */
|
|
6
|
+
export declare const isCommandAllowed: (command: string, policy: CommandPolicy) => boolean;
|
|
7
|
+
//# sourceMappingURL=policy-engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy-engine.d.ts","sourceRoot":"","sources":["../../src/runtime/policy-engine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAIlE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD,wEAAwE;AACxE,eAAO,MAAM,qBAAqB,GAAI,OAAO,MAAM,EAAE,EAAE,QAAQ,MAAM,KAAG,MAAM,EAG3E,CAAA;AAEH,sFAAsF;AACtF,eAAO,MAAM,gBAAgB,GAAI,SAAS,MAAM,EAAE,QAAQ,aAAa,KAAG,OACa,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Deciding whether a document is acceptable configuration moved to the config
|
|
2
|
+
// layer, but `./policy` is a published subpath, so the name stays exported here.
|
|
3
|
+
export { validatePolicy } from '../config/policy.js';
|
|
4
|
+
/** Names the files the coder touched that the policy does not allow. */
|
|
5
|
+
export const findOutOfScopeChanges = (files, policy) => files.filter((file) => !policy.allowedProductPaths.some((allowedPath) => file.startsWith(allowedPath)));
|
|
6
|
+
/** Whether an agent may run a command. An empty allow list means "no restriction". */
|
|
7
|
+
export const isCommandAllowed = (command, policy) => !policy.allowedAgentCommands?.length || policy.allowedAgentCommands.includes(command);
|
|
8
|
+
//# sourceMappingURL=policy-engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy-engine.js","sourceRoot":"","sources":["../../src/runtime/policy-engine.ts"],"names":[],"mappings":"AAEA,8EAA8E;AAC9E,iFAAiF;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD,wEAAwE;AACxE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,KAAe,EAAE,MAAc,EAAY,EAAE,CACjF,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CACpB,CAAC,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAChF,CAAA;AAEH,sFAAsF;AACtF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAAe,EAAE,MAAqB,EAAW,EAAE,CAClF,CAAC,MAAM,CAAC,oBAAoB,EAAE,MAAM,IAAI,MAAM,CAAC,oBAAoB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AgentCallResult, AgentRole, AgentsConfig, CommandPolicy, StageRequest } from '../contracts/index.js';
|
|
2
|
+
import type { ResponseValidator, SchemaErrorFormatter } from '../contracts/validator.js';
|
|
3
|
+
export interface ProviderRunnerOptions {
|
|
4
|
+
root: string;
|
|
5
|
+
agents: AgentsConfig;
|
|
6
|
+
policy: CommandPolicy;
|
|
7
|
+
validator: ResponseValidator;
|
|
8
|
+
ajv: SchemaErrorFormatter;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Builds the function that runs one pipeline stage.
|
|
12
|
+
*
|
|
13
|
+
* A stage configured as `internal` is a no-op that passes: the built-in
|
|
14
|
+
* pipeline has nothing to delegate. An `external` stage is spawned as a child
|
|
15
|
+
* process and must speak the stdin/stdout JSON protocol.
|
|
16
|
+
*/
|
|
17
|
+
export declare const createProviderRunner: ({ root, agents, policy, validator, ajv }: ProviderRunnerOptions) => (name: AgentRole, payload: StageRequest) => Promise<AgentCallResult>;
|
|
18
|
+
//# sourceMappingURL=provider-runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-runner.d.ts","sourceRoot":"","sources":["../../src/runtime/provider-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,SAAS,EACT,YAAY,EACZ,aAAa,EACb,YAAY,EACb,MAAM,uBAAuB,CAAA;AAI9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAExF,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,YAAY,CAAA;IACpB,MAAM,EAAE,aAAa,CAAA;IACrB,SAAS,EAAE,iBAAiB,CAAA;IAC5B,GAAG,EAAE,oBAAoB,CAAA;CAC1B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAAI,0CAA0C,qBAAqB,MAC3F,MAAM,SAAS,EAAE,SAAS,YAAY,KAAG,OAAO,CAAC,eAAe,CAmCtE,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { parseAgentResponse, validateStageResponse } from './agent.js';
|
|
2
|
+
import { runCommand } from './command.js';
|
|
3
|
+
import { isCommandAllowed } from './policy-engine.js';
|
|
4
|
+
/**
|
|
5
|
+
* Builds the function that runs one pipeline stage.
|
|
6
|
+
*
|
|
7
|
+
* A stage configured as `internal` is a no-op that passes: the built-in
|
|
8
|
+
* pipeline has nothing to delegate. An `external` stage is spawned as a child
|
|
9
|
+
* process and must speak the stdin/stdout JSON protocol.
|
|
10
|
+
*/
|
|
11
|
+
export const createProviderRunner = ({ root, agents, policy, validator, ajv }) => async (name, payload) => {
|
|
12
|
+
const config = agents[name];
|
|
13
|
+
if (!config || config.mode === 'internal') {
|
|
14
|
+
return { ok: true, details: `${name} completed using the built-in stage.`, payload: {} };
|
|
15
|
+
}
|
|
16
|
+
if (config.mode !== 'external' || typeof config.provider !== 'string') {
|
|
17
|
+
return { ok: false, details: `${name} requires a configured provider in .harness/agents.json.`, payload: {} };
|
|
18
|
+
}
|
|
19
|
+
const provider = agents.providers?.[config.provider];
|
|
20
|
+
if (!provider || typeof provider.command !== 'string' || !Array.isArray(provider.args)) {
|
|
21
|
+
return { ok: false, details: `${name} provider '${config.provider}' is not configured.`, payload: {} };
|
|
22
|
+
}
|
|
23
|
+
if (!isCommandAllowed(provider.command, policy)) {
|
|
24
|
+
return { ok: false, details: `${name} provider command is not in policy.allowedAgentCommands.`, payload: {} };
|
|
25
|
+
}
|
|
26
|
+
const result = await runCommand(root, provider.command, provider.args, {
|
|
27
|
+
...payload,
|
|
28
|
+
provider: config.provider,
|
|
29
|
+
});
|
|
30
|
+
if (result.code !== 0) {
|
|
31
|
+
return {
|
|
32
|
+
ok: false,
|
|
33
|
+
details: result.stderr.trim() || `${name} exited with code ${result.code}.`,
|
|
34
|
+
payload: {},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const response = parseAgentResponse(name, result.stdout, validator, ajv);
|
|
38
|
+
if (!response.ok)
|
|
39
|
+
return response;
|
|
40
|
+
const stageError = validateStageResponse(name, response.payload);
|
|
41
|
+
return stageError
|
|
42
|
+
? { ok: false, details: stageError, payload: response.payload }
|
|
43
|
+
: response;
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=provider-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-runner.js","sourceRoot":"","sources":["../../src/runtime/provider-runner.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAWrD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAyB,EAAE,EAAE,CACtG,KAAK,EAAE,IAAe,EAAE,OAAqB,EAA4B,EAAE;IACzE,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;IAC3B,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QAC1C,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,sCAAsC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAA;IAC1F,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,KAAK,UAAU,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACtE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,IAAI,0DAA0D,EAAE,OAAO,EAAE,EAAE,EAAE,CAAA;IAC/G,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;IACpD,IAAI,CAAC,QAAQ,IAAI,OAAO,QAAQ,CAAC,OAAO,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,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,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pedyc/harness-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Runtime primitives for Pedyc Harness",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -10,44 +10,48 @@
|
|
|
10
10
|
"default": "./dist/index.js"
|
|
11
11
|
},
|
|
12
12
|
"./package-manager": {
|
|
13
|
-
"types": "./dist/
|
|
14
|
-
"default": "./dist/
|
|
13
|
+
"types": "./dist/runtime/package-manager.d.ts",
|
|
14
|
+
"default": "./dist/runtime/package-manager.js"
|
|
15
15
|
},
|
|
16
16
|
"./intake": {
|
|
17
|
-
"types": "./dist/
|
|
18
|
-
"default": "./dist/
|
|
17
|
+
"types": "./dist/runtime/intake.d.ts",
|
|
18
|
+
"default": "./dist/runtime/intake.js"
|
|
19
19
|
},
|
|
20
20
|
"./command": {
|
|
21
|
-
"types": "./dist/
|
|
22
|
-
"default": "./dist/
|
|
21
|
+
"types": "./dist/runtime/command.d.ts",
|
|
22
|
+
"default": "./dist/runtime/command.js"
|
|
23
23
|
},
|
|
24
24
|
"./snapshots": {
|
|
25
|
-
"types": "./dist/
|
|
26
|
-
"default": "./dist/
|
|
25
|
+
"types": "./dist/runtime/diff-inspector.d.ts",
|
|
26
|
+
"default": "./dist/runtime/diff-inspector.js"
|
|
27
27
|
},
|
|
28
28
|
"./schema": {
|
|
29
|
-
"types": "./dist/
|
|
30
|
-
"default": "./dist/
|
|
29
|
+
"types": "./dist/config/schema.d.ts",
|
|
30
|
+
"default": "./dist/config/schema.js"
|
|
31
31
|
},
|
|
32
32
|
"./agent": {
|
|
33
|
-
"types": "./dist/
|
|
34
|
-
"default": "./dist/
|
|
33
|
+
"types": "./dist/runtime/agent.d.ts",
|
|
34
|
+
"default": "./dist/runtime/agent.js"
|
|
35
35
|
},
|
|
36
36
|
"./policy": {
|
|
37
|
-
"types": "./dist/
|
|
38
|
-
"default": "./dist/
|
|
37
|
+
"types": "./dist/runtime/policy-engine.d.ts",
|
|
38
|
+
"default": "./dist/runtime/policy-engine.js"
|
|
39
39
|
},
|
|
40
40
|
"./provider": {
|
|
41
|
-
"types": "./dist/
|
|
42
|
-
"default": "./dist/
|
|
41
|
+
"types": "./dist/runtime/provider-runner.d.ts",
|
|
42
|
+
"default": "./dist/runtime/provider-runner.js"
|
|
43
43
|
},
|
|
44
44
|
"./orchestrator": {
|
|
45
|
-
"types": "./dist/
|
|
46
|
-
"default": "./dist/
|
|
45
|
+
"types": "./dist/runtime/executor.d.ts",
|
|
46
|
+
"default": "./dist/runtime/executor.js"
|
|
47
47
|
},
|
|
48
48
|
"./contracts": {
|
|
49
49
|
"types": "./dist/contracts/index.d.ts",
|
|
50
50
|
"default": "./dist/contracts/index.js"
|
|
51
|
+
},
|
|
52
|
+
"./config": {
|
|
53
|
+
"types": "./dist/config/index.d.ts",
|
|
54
|
+
"default": "./dist/config/index.js"
|
|
51
55
|
}
|
|
52
56
|
},
|
|
53
57
|
"repository": {
|
|
@@ -76,6 +80,7 @@
|
|
|
76
80
|
},
|
|
77
81
|
"files": [
|
|
78
82
|
"dist",
|
|
83
|
+
"schemas",
|
|
79
84
|
"README.md"
|
|
80
85
|
],
|
|
81
86
|
"scripts": {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://pedyc.dev/schema/harness.json",
|
|
4
|
+
"title": "Harness manifest",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["version"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"$schema": { "type": "string", "minLength": 1 },
|
|
10
|
+
"version": { "type": "integer", "const": 1, "default": 1 },
|
|
11
|
+
"presets": {
|
|
12
|
+
"type": "array",
|
|
13
|
+
"items": { "type": "string", "minLength": 1 },
|
|
14
|
+
"default": []
|
|
15
|
+
},
|
|
16
|
+
"policy": {
|
|
17
|
+
"description": "Inline policy, or a path to one relative to .harness/.",
|
|
18
|
+
"oneOf": [
|
|
19
|
+
{ "type": "string", "minLength": 1 },
|
|
20
|
+
{ "type": "object" }
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
"agents": {
|
|
24
|
+
"description": "Inline agent configuration, or a path to one relative to .harness/.",
|
|
25
|
+
"oneOf": [
|
|
26
|
+
{ "type": "string", "minLength": 1 },
|
|
27
|
+
{ "type": "object" }
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
"verification": {
|
|
31
|
+
"description": "Declared for forward compatibility; no runtime consumes it yet.",
|
|
32
|
+
"type": "string",
|
|
33
|
+
"minLength": 1
|
|
34
|
+
},
|
|
35
|
+
"rules": {
|
|
36
|
+
"description": "Declared for forward compatibility; no runtime consumes it yet.",
|
|
37
|
+
"type": "array",
|
|
38
|
+
"items": { "type": "string", "minLength": 1 }
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://pedyc.dev/schema/preset.json",
|
|
4
|
+
"title": "Harness preset manifest",
|
|
5
|
+
"description": "Describes what a preset package inherits and what it provides. A preset is a governance specification: it declares paths to documents inside its own package, and `entry` declares the module through which a preset that also ships code registers its extensions.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["name"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"$schema": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"minLength": 1
|
|
13
|
+
},
|
|
14
|
+
"name": {
|
|
15
|
+
"description": "The package name. It must match the package the manifest was resolved from, otherwise two presets could claim one identity.",
|
|
16
|
+
"type": "string",
|
|
17
|
+
"minLength": 1
|
|
18
|
+
},
|
|
19
|
+
"extends": {
|
|
20
|
+
"description": "Package names this preset inherits from. Names only, never versions: versions belong to package.json and the lockfile.",
|
|
21
|
+
"type": "array",
|
|
22
|
+
"items": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"minLength": 1
|
|
25
|
+
},
|
|
26
|
+
"default": []
|
|
27
|
+
},
|
|
28
|
+
"policy": {
|
|
29
|
+
"description": "Path to a policy document inside this package.",
|
|
30
|
+
"type": "string",
|
|
31
|
+
"minLength": 1
|
|
32
|
+
},
|
|
33
|
+
"agents": {
|
|
34
|
+
"description": "Path to an agent configuration document inside this package.",
|
|
35
|
+
"type": "string",
|
|
36
|
+
"minLength": 1
|
|
37
|
+
},
|
|
38
|
+
"instruction": {
|
|
39
|
+
"description": "Path to a markdown document used to seed the target project's AGENTS.md.",
|
|
40
|
+
"type": "string",
|
|
41
|
+
"minLength": 1
|
|
42
|
+
},
|
|
43
|
+
"entry": {
|
|
44
|
+
"description": "Path to the module that registers this preset's extensions (evidence providers, reviewer definitions). Declared for forward compatibility: the resolver checks only that the path stays inside the package and exists, and no runtime loads it yet (M21).",
|
|
45
|
+
"type": "string",
|
|
46
|
+
"minLength": 1
|
|
47
|
+
},
|
|
48
|
+
"verification": {
|
|
49
|
+
"description": "Declared for forward compatibility; no runtime consumes it yet.",
|
|
50
|
+
"type": "string",
|
|
51
|
+
"minLength": 1
|
|
52
|
+
},
|
|
53
|
+
"rules": {
|
|
54
|
+
"description": "Declared for forward compatibility; no runtime consumes it yet.",
|
|
55
|
+
"type": "array",
|
|
56
|
+
"items": {
|
|
57
|
+
"type": "string",
|
|
58
|
+
"minLength": 1
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|