@pedyc/harness-core 1.0.1 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +55 -48
- package/dist/adapters/provider-runner.d.ts +18 -0
- package/dist/adapters/provider-runner.d.ts.map +1 -0
- package/dist/adapters/provider-runner.js +45 -0
- package/dist/adapters/provider-runner.js.map +1 -0
- package/dist/contracts/agent.d.ts +79 -0
- package/dist/contracts/agent.d.ts.map +1 -0
- package/dist/contracts/agent.js +2 -0
- package/dist/contracts/agent.js.map +1 -0
- package/dist/contracts/index.d.ts +7 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +2 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/contracts/policy.d.ts +30 -0
- package/dist/contracts/policy.d.ts.map +1 -0
- package/dist/contracts/policy.js +2 -0
- package/dist/contracts/policy.js.map +1 -0
- package/dist/contracts/preset.d.ts +27 -0
- package/dist/contracts/preset.d.ts.map +1 -0
- package/dist/contracts/preset.js +2 -0
- package/dist/contracts/preset.js.map +1 -0
- package/dist/contracts/run.d.ts +41 -0
- package/dist/contracts/run.d.ts.map +1 -0
- package/dist/contracts/run.js +2 -0
- package/dist/contracts/run.js.map +1 -0
- package/dist/contracts/task.d.ts +35 -0
- package/dist/contracts/task.d.ts.map +1 -0
- package/dist/contracts/task.js +2 -0
- package/dist/contracts/task.js.map +1 -0
- package/dist/contracts/validation.d.ts +7 -0
- package/dist/contracts/validation.d.ts.map +1 -0
- package/dist/contracts/validation.js +2 -0
- package/dist/contracts/validation.js.map +1 -0
- package/dist/core/agent.d.ts +22 -0
- package/dist/core/agent.d.ts.map +1 -0
- package/dist/core/agent.js +47 -0
- package/dist/core/agent.js.map +1 -0
- package/dist/core/approval-gate.d.ts +17 -0
- package/dist/core/approval-gate.d.ts.map +1 -0
- package/dist/core/approval-gate.js +18 -0
- package/dist/core/approval-gate.js.map +1 -0
- package/dist/core/command.d.ts +14 -0
- package/dist/core/command.d.ts.map +1 -0
- package/dist/core/command.js +33 -0
- package/dist/core/command.js.map +1 -0
- package/dist/core/diff-inspector.d.ts +7 -0
- package/dist/core/diff-inspector.d.ts.map +1 -0
- package/dist/core/diff-inspector.js +27 -0
- package/dist/core/diff-inspector.js.map +1 -0
- package/dist/core/executor.d.ts +21 -0
- package/dist/core/executor.d.ts.map +1 -0
- package/dist/core/executor.js +142 -0
- package/dist/core/executor.js.map +1 -0
- package/dist/core/intake.d.ts +11 -0
- package/dist/core/intake.d.ts.map +1 -0
- package/dist/core/intake.js +33 -0
- package/dist/core/intake.js.map +1 -0
- package/dist/core/package-manager.d.ts +14 -0
- package/dist/core/package-manager.d.ts.map +1 -0
- package/dist/core/package-manager.js +20 -0
- package/dist/core/package-manager.js.map +1 -0
- package/dist/core/policy-engine.d.ts +14 -0
- package/dist/core/policy-engine.d.ts.map +1 -0
- package/dist/core/policy-engine.js +29 -0
- package/dist/core/policy-engine.js.map +1 -0
- package/dist/core/validator.d.ts +25 -0
- package/dist/core/validator.d.ts.map +1 -0
- package/dist/core/validator.js +24 -0
- package/dist/core/validator.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/package.json +50 -13
- package/src/agent.mjs +0 -27
- package/src/command.mjs +0 -28
- package/src/index.mjs +0 -11
- package/src/intake.mjs +0 -23
- package/src/orchestrator.mjs +0 -119
- package/src/package-manager.mjs +0 -17
- package/src/policy.mjs +0 -19
- package/src/provider.mjs +0 -32
- package/src/schema.mjs +0 -24
- package/src/snapshots.mjs +0 -20
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Pedyc
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Pedyc
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,48 +1,55 @@
|
|
|
1
|
-
# @pedyc/harness-core
|
|
2
|
-
|
|
3
|
-
Technology-stack agnostic runtime primitives for Pedyc Harness. The package has no
|
|
4
|
-
dependency on Vue or on any project layout, and is used by `pedyc-harness`.
|
|
5
|
-
|
|
6
|
-
## API
|
|
7
|
-
|
|
8
|
-
```js
|
|
9
|
-
import {
|
|
10
|
-
detectPackageManager,
|
|
11
|
-
packageScriptCommand,
|
|
12
|
-
normalizeTask,
|
|
13
|
-
readTaskFile,
|
|
14
|
-
runCommand,
|
|
15
|
-
changedFiles,
|
|
16
|
-
snapshotFiles,
|
|
17
|
-
loadSchemas,
|
|
18
|
-
createValidators,
|
|
19
|
-
validationDetails,
|
|
20
|
-
parseAgentResponse,
|
|
21
|
-
validateStageResponse,
|
|
22
|
-
validatePolicy,
|
|
23
|
-
findOutOfScopeChanges,
|
|
24
|
-
isCommandAllowed,
|
|
25
|
-
createProviderRunner,
|
|
26
|
-
runOrchestrator,
|
|
27
|
-
} from '@pedyc/harness-core'
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
Individual modules are also exported for narrower imports:
|
|
31
|
-
|
|
32
|
-
```js
|
|
33
|
-
import { detectPackageManager } from '@pedyc/harness-core/package-manager'
|
|
34
|
-
import { runOrchestrator } from '@pedyc/harness-core/orchestrator'
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
- `package-manager` / `command` — lockfile detection and command execution.
|
|
38
|
-
- `intake` / `schema` / `agent` — task normalization, Ajv validation and Agent
|
|
39
|
-
response parsing.
|
|
40
|
-
- `policy` / `provider` / `orchestrator` — path policy, Provider routing and the
|
|
41
|
-
four-phase execution loop.
|
|
42
|
-
|
|
43
|
-
`runOrchestrator({ dryRun: true })` skips every Agent Provider and verification gate
|
|
44
|
-
and returns a structured passing result.
|
|
45
|
-
|
|
46
|
-
##
|
|
47
|
-
|
|
48
|
-
|
|
1
|
+
# @pedyc/harness-core
|
|
2
|
+
|
|
3
|
+
Technology-stack agnostic runtime primitives for Pedyc Harness. The package has no
|
|
4
|
+
dependency on Vue or on any project layout, and is used by `pedyc-harness`.
|
|
5
|
+
|
|
6
|
+
## API
|
|
7
|
+
|
|
8
|
+
```js
|
|
9
|
+
import {
|
|
10
|
+
detectPackageManager,
|
|
11
|
+
packageScriptCommand,
|
|
12
|
+
normalizeTask,
|
|
13
|
+
readTaskFile,
|
|
14
|
+
runCommand,
|
|
15
|
+
changedFiles,
|
|
16
|
+
snapshotFiles,
|
|
17
|
+
loadSchemas,
|
|
18
|
+
createValidators,
|
|
19
|
+
validationDetails,
|
|
20
|
+
parseAgentResponse,
|
|
21
|
+
validateStageResponse,
|
|
22
|
+
validatePolicy,
|
|
23
|
+
findOutOfScopeChanges,
|
|
24
|
+
isCommandAllowed,
|
|
25
|
+
createProviderRunner,
|
|
26
|
+
runOrchestrator,
|
|
27
|
+
} from '@pedyc/harness-core'
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Individual modules are also exported for narrower imports:
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
import { detectPackageManager } from '@pedyc/harness-core/package-manager'
|
|
34
|
+
import { runOrchestrator } from '@pedyc/harness-core/orchestrator'
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
- `package-manager` / `command` — lockfile detection and command execution.
|
|
38
|
+
- `intake` / `schema` / `agent` — task normalization, Ajv validation and Agent
|
|
39
|
+
response parsing.
|
|
40
|
+
- `policy` / `provider` / `orchestrator` — path policy, Provider routing and the
|
|
41
|
+
four-phase execution loop.
|
|
42
|
+
|
|
43
|
+
`runOrchestrator({ dryRun: true })` skips every Agent Provider and verification gate
|
|
44
|
+
and returns a structured passing result.
|
|
45
|
+
|
|
46
|
+
## Changelog
|
|
47
|
+
|
|
48
|
+
All four Harness packages share one version number and are released together, so
|
|
49
|
+
release notes for this package live in the repository changelog:
|
|
50
|
+
|
|
51
|
+
https://github.com/pedyc/pedyc-harness/blob/main/CHANGELOG.md
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
MIT
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AgentCallResult, AgentRole, AgentsConfig, CommandPolicy, StageRequest } from '../contracts/index.js';
|
|
2
|
+
import type { ResponseValidator, SchemaErrorFormatter } from '../core/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/adapters/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,sBAAsB,CAAA;AAEnF,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 '../core/agent.js';
|
|
2
|
+
import { runCommand } from '../core/command.js';
|
|
3
|
+
import { isCommandAllowed } from '../core/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/adapters/provider-runner.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAW3D;;;;;;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,UA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CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,qBAAqB,MAAM,CAAC,IAAI,GAAG;YAC3E,OAAO,EAAE,EAAE;SACZ,CAAA;IACH,CAAC;IAED,MAAM,QAAQ,GAAG,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,CAAC,CAAA;IACxE,IAAI,CAAC,QAAQ,CAAC,EAAE;QAAE,OAAO,QAAQ,CAAA;IAEjC,MAAM,UAAU,GAAG,qBAAqB,CAAC,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;IAChE,OAAO,UAAU;QACf,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE;QAC/D,CAAC,CAAC,QAAQ,CAAA;AACd,CAAC,CAAA"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { AgentMode, AgentRole } from './policy.js';
|
|
2
|
+
import type { FileChange } from './run.js';
|
|
3
|
+
import type { NormalizedTask } from './task.js';
|
|
4
|
+
import type { VerificationCheck } from './validation.js';
|
|
5
|
+
/** A provider entry from `.harness/agents.json`. */
|
|
6
|
+
export interface ProviderConfig {
|
|
7
|
+
command: string;
|
|
8
|
+
args: string[];
|
|
9
|
+
}
|
|
10
|
+
/** How one stage is routed. `provider` is only meaningful for external mode. */
|
|
11
|
+
export interface AgentRoleConfig {
|
|
12
|
+
mode: AgentMode;
|
|
13
|
+
provider?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface AgentsConfig {
|
|
16
|
+
providers?: Record<string, ProviderConfig>;
|
|
17
|
+
planner?: AgentRoleConfig;
|
|
18
|
+
coder?: AgentRoleConfig;
|
|
19
|
+
tester?: AgentRoleConfig;
|
|
20
|
+
reviewer?: AgentRoleConfig;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A provider's decoded stdout.
|
|
24
|
+
*
|
|
25
|
+
* This is untrusted JSON, so every field is optional: `validateStageResponse`
|
|
26
|
+
* is the runtime gate that decides whether a stage may proceed. The type
|
|
27
|
+
* describes the wire shape; it does not promise that a field is present.
|
|
28
|
+
*/
|
|
29
|
+
export interface AgentPayload {
|
|
30
|
+
details?: string;
|
|
31
|
+
approved?: boolean;
|
|
32
|
+
implementationPlan?: string[];
|
|
33
|
+
evidence?: VerificationCheck[];
|
|
34
|
+
issues?: string[];
|
|
35
|
+
changedFiles?: string[];
|
|
36
|
+
}
|
|
37
|
+
/** The outcome of running one stage. `payload` stays empty for built-in stages. */
|
|
38
|
+
export interface AgentCallResult {
|
|
39
|
+
ok: boolean;
|
|
40
|
+
details: string;
|
|
41
|
+
payload: AgentPayload;
|
|
42
|
+
}
|
|
43
|
+
interface StageRequestBase {
|
|
44
|
+
input: NormalizedTask;
|
|
45
|
+
implementationPlan: string[];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* What each stage receives. The shape is per-phase so a provider adapter can
|
|
49
|
+
* rely on the fields its own phase needs.
|
|
50
|
+
*/
|
|
51
|
+
export interface PlannerRequest extends StageRequestBase {
|
|
52
|
+
phase: 'planner';
|
|
53
|
+
}
|
|
54
|
+
export interface CoderRequest extends StageRequestBase {
|
|
55
|
+
phase: 'coder';
|
|
56
|
+
iteration: number;
|
|
57
|
+
previousVerification: VerificationCheck[];
|
|
58
|
+
}
|
|
59
|
+
export interface TesterRequest extends StageRequestBase {
|
|
60
|
+
phase: 'tester';
|
|
61
|
+
iteration: number;
|
|
62
|
+
verification: VerificationCheck[];
|
|
63
|
+
}
|
|
64
|
+
export interface ReviewerRequest extends StageRequestBase {
|
|
65
|
+
phase: 'reviewer';
|
|
66
|
+
iteration: number;
|
|
67
|
+
verification: VerificationCheck[];
|
|
68
|
+
fileChanges: FileChange[];
|
|
69
|
+
}
|
|
70
|
+
export type StageRequest = PlannerRequest | CoderRequest | TesterRequest | ReviewerRequest;
|
|
71
|
+
/**
|
|
72
|
+
* Runs one stage of the pipeline.
|
|
73
|
+
*
|
|
74
|
+
* The request is serialized to JSON and handed to the provider over stdin, so
|
|
75
|
+
* this signature is the whole adapter protocol.
|
|
76
|
+
*/
|
|
77
|
+
export type RunAgent = (name: AgentRole, request: StageRequest) => Promise<AgentCallResult>;
|
|
78
|
+
export {};
|
|
79
|
+
//# sourceMappingURL=agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/contracts/agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAExD,oDAAoD;AACpD,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,EAAE,CAAA;CACf;AAED,gFAAgF;AAChF,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,SAAS,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;IAC1C,OAAO,CAAC,EAAE,eAAe,CAAA;IACzB,KAAK,CAAC,EAAE,eAAe,CAAA;IACvB,MAAM,CAAC,EAAE,eAAe,CAAA;IACxB,QAAQ,CAAC,EAAE,eAAe,CAAA;CAC3B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC7B,QAAQ,CAAC,EAAE,iBAAiB,E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|
1
|
+
export type { AgentMode, AgentRole, CommandPolicy, Policy } from './policy.js';
|
|
2
|
+
export type { VerificationCheck } from './validation.js';
|
|
3
|
+
export type { IntakeResult, NormalizedTask, RawTaskInput } from './task.js';
|
|
4
|
+
export type { Preset, PresetDetection } from './preset.js';
|
|
5
|
+
export type { FileChange, OrchestrationResult, PhaseRecord, PhaseStatus, RunResult, RunStatus } from './run.js';
|
|
6
|
+
export type { AgentCallResult, AgentPayload, AgentRoleConfig, AgentsConfig, CoderRequest, PlannerRequest, ProviderConfig, ReviewerRequest, RunAgent, StageRequest, TesterRequest, } from './agent.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAC9E,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACxD,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAC3E,YAAY,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC1D,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAC/G,YAAY,EACV,eAAe,EACf,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,cAAc,EACd,eAAe,EACf,QAAQ,EACR,YAAY,EACZ,aAAa,GACd,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** How a stage runs: by the built-in stage or by an external provider. */
|
|
2
|
+
export type AgentMode = 'internal' | 'external';
|
|
3
|
+
/** The four stages of the fixed Planner → Coder → Tester → Reviewer pipeline. */
|
|
4
|
+
export type AgentRole = 'planner' | 'coder' | 'tester' | 'reviewer';
|
|
5
|
+
/**
|
|
6
|
+
* The part of the policy that bounds which commands an agent may run.
|
|
7
|
+
*
|
|
8
|
+
* The provider runner consults nothing else, so it accepts this narrower type
|
|
9
|
+
* rather than a whole policy.
|
|
10
|
+
*/
|
|
11
|
+
export interface CommandPolicy {
|
|
12
|
+
allowedAgentCommands?: string[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A project's `.harness/policy.json`.
|
|
16
|
+
*
|
|
17
|
+
* Only `allowedProductPaths` is required: `validatePolicy` rejects a policy
|
|
18
|
+
* without it, and out-of-scope detection dereferences it directly. Every other
|
|
19
|
+
* field stays optional because the document is untrusted JSON and callers fall
|
|
20
|
+
* back to defaults.
|
|
21
|
+
*/
|
|
22
|
+
export interface Policy extends CommandPolicy {
|
|
23
|
+
allowedProductPaths: string[];
|
|
24
|
+
maxIterations?: number;
|
|
25
|
+
protectedPaths?: string[];
|
|
26
|
+
requiredChecks?: string[];
|
|
27
|
+
forbiddenCommands?: string[];
|
|
28
|
+
agentTimeoutMs?: number;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/contracts/policy.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,UAAU,CAAA;AAE/C,iFAAiF;AACjF,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,UAAU,CAAA;AAEnE;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAA;CAChC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,MAAO,SAAQ,aAAa;IAC3C,mBAAmB,EAAE,MAAM,EAAE,CAAA;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;IACzB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;IACzB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy.js","sourceRoot":"","sources":["../../src/contracts/policy.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,27 @@
|
|
|
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[];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A project preset: the files `pedyc-harness init` writes into a target project
|
|
10
|
+
* and the defaults it derives from them.
|
|
11
|
+
*
|
|
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.
|
|
15
|
+
*/
|
|
16
|
+
export interface Preset {
|
|
17
|
+
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;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=preset.d.ts.map
|
|
@@ -0,0 +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,eAAe;IAC9B,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,oBAAoB,EAAE,MAAM,EAAE,CAAA;CAC/B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,eAAe,CAAA;IAC1B,mBAAmB,EAAE,MAAM,EAAE,CAAA;IAC7B,mBAAmB,EAAE,MAAM,EAAE,CAAA;IAC7B,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,YAAY,CAAA;IACpB,mDAAmD;IACnD,WAAW,EAAE,MAAM,CAAA;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preset.js","sourceRoot":"","sources":["../../src/contracts/preset.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { VerificationCheck } from './validation.js';
|
|
2
|
+
export type RunStatus = 'passed' | 'failed';
|
|
3
|
+
export type PhaseStatus = 'running' | 'passed' | 'failed';
|
|
4
|
+
export interface PhaseRecord {
|
|
5
|
+
name: string;
|
|
6
|
+
status: PhaseStatus;
|
|
7
|
+
details: string;
|
|
8
|
+
iteration?: number;
|
|
9
|
+
}
|
|
10
|
+
/** A file whose contents changed while the coder ran. */
|
|
11
|
+
export interface FileChange {
|
|
12
|
+
file: string;
|
|
13
|
+
change: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* What `runOrchestrator` reports. It carries no `status` or `summary` because
|
|
17
|
+
* only the caller knows how to phrase those; `runHarness` turns this into a
|
|
18
|
+
* `RunResult`.
|
|
19
|
+
*/
|
|
20
|
+
export interface OrchestrationResult {
|
|
21
|
+
completed: boolean;
|
|
22
|
+
implementationPlan: string[];
|
|
23
|
+
fileChanges: FileChange[];
|
|
24
|
+
verification: VerificationCheck[];
|
|
25
|
+
issues: string[];
|
|
26
|
+
phases: PhaseRecord[];
|
|
27
|
+
iterations: number;
|
|
28
|
+
}
|
|
29
|
+
/** The document written to `output.json`; matches `output.schema.json`. */
|
|
30
|
+
export interface RunResult {
|
|
31
|
+
status: RunStatus;
|
|
32
|
+
summary: string;
|
|
33
|
+
implementationPlan: string[];
|
|
34
|
+
fileChanges: FileChange[];
|
|
35
|
+
verification: VerificationCheck[];
|
|
36
|
+
issues: string[];
|
|
37
|
+
phases: PhaseRecord[];
|
|
38
|
+
iterations: number;
|
|
39
|
+
dryRun: boolean;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/contracts/run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAExD,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAE3C,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAEzD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,WAAW,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,yDAAyD;AACzD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,OAAO,CAAA;IAClB,kBAAkB,EAAE,MAAM,EAAE,CAAA;IAC5B,WAAW,EAAE,UAAU,EAAE,CAAA;IACzB,YAAY,EAAE,iBAAiB,EAAE,CAAA;IACjC,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,MAAM,EAAE,WAAW,EAAE,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,2EAA2E;AAC3E,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,SAAS,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,kBAAkB,EAAE,MAAM,EAAE,CAAA;IAC5B,WAAW,EAAE,UAAU,EAAE,CAAA;IACzB,YAAY,EAAE,iBAAiB,EAAE,CAAA;IACjC,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,MAAM,EAAE,WAAW,EAAE,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,OAAO,CAAA;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/contracts/run.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** The normalized task every stage receives; matches `input.schema.json`. */
|
|
2
|
+
export interface NormalizedTask {
|
|
3
|
+
feature: string;
|
|
4
|
+
objective: string;
|
|
5
|
+
constraints: string[];
|
|
6
|
+
acceptanceCriteria: string[];
|
|
7
|
+
testHints: string[];
|
|
8
|
+
maxIterations: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The three input layers accept different field names for the same concept.
|
|
12
|
+
* Only `normalizeTask` sees this raw shape.
|
|
13
|
+
*/
|
|
14
|
+
export interface RawTaskInput {
|
|
15
|
+
task?: string;
|
|
16
|
+
feature?: string;
|
|
17
|
+
goal?: string;
|
|
18
|
+
objective?: string;
|
|
19
|
+
specialConstraints?: string[];
|
|
20
|
+
constraints?: string[];
|
|
21
|
+
acceptance?: string[];
|
|
22
|
+
acceptanceCriteria?: string[];
|
|
23
|
+
testHints?: string[];
|
|
24
|
+
maxIterations?: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The result of intake. `needs_input` lists the questions a human still has to
|
|
28
|
+
* answer; `ready` carries a task that can go straight to the planner.
|
|
29
|
+
*/
|
|
30
|
+
export interface IntakeResult {
|
|
31
|
+
status: 'ready' | 'needs_input';
|
|
32
|
+
questions: string[];
|
|
33
|
+
normalizedTask: NormalizedTask;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=task.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task.d.ts","sourceRoot":"","sources":["../../src/contracts/task.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,kBAAkB,EAAE,MAAM,EAAE,CAAA;IAC5B,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC7B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC7B,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,OAAO,GAAG,aAAa,CAAA;IAC/B,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,cAAc,EAAE,cAAc,CAAA;CAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task.js","sourceRoot":"","sources":["../../src/contracts/task.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/contracts/validation.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,OAAO,EAAE,MAAM,CAAA;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/contracts/validation.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AgentPayload, AgentRole } from '../contracts/index.js';
|
|
2
|
+
import type { ResponseValidator, SchemaErrorFormatter } from './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/core/agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAE7E,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/core/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,OAAO,EAAE,GAAG,IAAI,kCAAkC,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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
|