@ai-dev-orchestrator/governance 0.1.1 → 0.1.2

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 CHANGED
@@ -53,7 +53,8 @@ src/
53
53
 
54
54
  - `DefaultIterationContractRegistry` -- registry of iteration contract definitions
55
55
  - `buildContracts` -- factory for constructing contracts from configuration
56
- - `BUILT_IN_CONTRACTS` -- predefined contracts (plan review, implementation review, clarification, acceptance validation)
56
+ - `BUILT_IN_CONTRACTS` -- predefined contracts (plan review, implementation review, clarification, acceptance validation, decomposition review)
57
+ - `DECOMPOSITION_REVIEW_LOOP` -- task-breakdown review contract, limited to three rounds with abort on exhaustion
57
58
 
58
59
  ### Infrastructure -- Collaboration Model
59
60
 
package/dist/index.d.ts CHANGED
@@ -3,5 +3,5 @@ export type { OwnershipCheckResult } from './domain/governance/index';
3
3
  export { ContractNotFoundError, ContractStateMismatchError, InvalidContractError, } from './domain/iteration-contracts/index';
4
4
  export { DecisionRecorder, DefaultGovernanceEngine, EscalationManager, IterationLimiter, OwnershipEnforcer, QualityGateChecker, } from './infrastructure/governance/index';
5
5
  export type { GovernanceEngineOptions } from './infrastructure/governance/index';
6
- export { ACCEPTANCE_VALIDATION_LOOP, buildContracts, BUILT_IN_CONTRACTS, CLARIFICATION_LOOP, IMPLEMENTATION_REVIEW_LOOP, PLAN_REVIEW_LOOP, DefaultIterationContractRegistry, } from './infrastructure/iteration-contracts/index';
6
+ export { ACCEPTANCE_VALIDATION_LOOP, buildContracts, BUILT_IN_CONTRACTS, CLARIFICATION_LOOP, DECOMPOSITION_REVIEW_LOOP, IMPLEMENTATION_REVIEW_LOOP, PLAN_REVIEW_LOOP, DefaultIterationContractRegistry, } from './infrastructure/iteration-contracts/index';
7
7
  export { DefaultCollaborationModel } from './infrastructure/collaboration-model/index';
package/dist/index.js CHANGED
@@ -5,6 +5,6 @@ export { ContractNotFoundError, ContractStateMismatchError, InvalidContractError
5
5
  // Infrastructure — Governance
6
6
  export { DecisionRecorder, DefaultGovernanceEngine, EscalationManager, IterationLimiter, OwnershipEnforcer, QualityGateChecker, } from './infrastructure/governance/index';
7
7
  // Infrastructure — Iteration Contracts
8
- export { ACCEPTANCE_VALIDATION_LOOP, buildContracts, BUILT_IN_CONTRACTS, CLARIFICATION_LOOP, IMPLEMENTATION_REVIEW_LOOP, PLAN_REVIEW_LOOP, DefaultIterationContractRegistry, } from './infrastructure/iteration-contracts/index';
8
+ export { ACCEPTANCE_VALIDATION_LOOP, buildContracts, BUILT_IN_CONTRACTS, CLARIFICATION_LOOP, DECOMPOSITION_REVIEW_LOOP, IMPLEMENTATION_REVIEW_LOOP, PLAN_REVIEW_LOOP, DefaultIterationContractRegistry, } from './infrastructure/iteration-contracts/index';
9
9
  // Infrastructure — Collaboration Model
10
10
  export { DefaultCollaborationModel } from './infrastructure/collaboration-model/index';
@@ -1,10 +1,11 @@
1
1
  import type { IterationContract, IterationLimitDefaults } from '@ai-dev-orchestrator/schemas';
2
- /** Build all iteration contracts using the provided governance limits. */
2
+ /** Build all iteration contracts using the provided governance limits and fixed task-breakdown limit. */
3
3
  export declare function buildContracts(limits: IterationLimitDefaults): readonly IterationContract[];
4
4
  /** Convenience aliases built with fallback limits — use `buildContracts(limits)` in production. */
5
5
  export declare const PLAN_REVIEW_LOOP: IterationContract;
6
6
  export declare const IMPLEMENTATION_REVIEW_LOOP: IterationContract;
7
7
  export declare const CLARIFICATION_LOOP: IterationContract;
8
8
  export declare const ACCEPTANCE_VALIDATION_LOOP: IterationContract;
9
+ export declare const DECOMPOSITION_REVIEW_LOOP: IterationContract;
9
10
  /** All built-in iteration contracts (with fallback limits). */
10
11
  export declare const BUILT_IN_CONTRACTS: readonly IterationContract[];
@@ -137,13 +137,41 @@ function buildAcceptanceValidationLoop(limits) {
137
137
  completionAgreement: 'verification_agreement',
138
138
  };
139
139
  }
140
- /** Build all iteration contracts using the provided governance limits. */
140
+ function buildDecompositionReviewLoop() {
141
+ return {
142
+ id: 'decomposition_review_loop',
143
+ name: 'Decomposition Review Loop',
144
+ description: 'Review task independence and coverage before specification authoring',
145
+ producer: 'decomposer',
146
+ reviewers: [
147
+ {
148
+ role: 'decomposition_reviewer',
149
+ output: 'decomposition_review',
150
+ inputs: ['task_breakdown'],
151
+ },
152
+ ],
153
+ aggregation: 'all_must_pass',
154
+ producerInputs: ['canonical_specification', 'codebase_context'],
155
+ producerOutput: 'task_breakdown',
156
+ successCondition: { type: 'no_blocking_findings' },
157
+ failureCondition: { type: 'max_iterations_exceeded' },
158
+ maxIterations: 3,
159
+ maxJudgeArbitrations: 0,
160
+ escalationPolicy: {
161
+ action: 'abort',
162
+ produceEscalationArtifact: false,
163
+ includeFullHistory: false,
164
+ },
165
+ };
166
+ }
167
+ /** Build all iteration contracts using the provided governance limits and fixed task-breakdown limit. */
141
168
  export function buildContracts(limits) {
142
169
  return [
143
170
  buildPlanReviewLoop(limits),
144
171
  buildImplementationReviewLoop(limits),
145
172
  buildClarificationLoop(limits),
146
173
  buildAcceptanceValidationLoop(limits),
174
+ buildDecompositionReviewLoop(),
147
175
  ];
148
176
  }
149
177
  /** Convenience aliases built with fallback limits — use `buildContracts(limits)` in production. */
@@ -151,10 +179,12 @@ export const PLAN_REVIEW_LOOP = buildPlanReviewLoop(FALLBACK_LIMITS);
151
179
  export const IMPLEMENTATION_REVIEW_LOOP = buildImplementationReviewLoop(FALLBACK_LIMITS);
152
180
  export const CLARIFICATION_LOOP = buildClarificationLoop(FALLBACK_LIMITS);
153
181
  export const ACCEPTANCE_VALIDATION_LOOP = buildAcceptanceValidationLoop(FALLBACK_LIMITS);
182
+ export const DECOMPOSITION_REVIEW_LOOP = buildDecompositionReviewLoop();
154
183
  /** All built-in iteration contracts (with fallback limits). */
155
184
  export const BUILT_IN_CONTRACTS = [
156
185
  PLAN_REVIEW_LOOP,
157
186
  IMPLEMENTATION_REVIEW_LOOP,
158
187
  CLARIFICATION_LOOP,
159
188
  ACCEPTANCE_VALIDATION_LOOP,
189
+ DECOMPOSITION_REVIEW_LOOP,
160
190
  ];
@@ -1,22 +1,5 @@
1
+ import { ITERATION_STATE_MAPPING } from '@ai-dev-orchestrator/schemas';
1
2
  import { BUILT_IN_CONTRACTS } from './built-in-contracts';
2
- const STATE_TO_CONTRACT = {
3
- PLAN_REVIEW: 'plan_review_loop',
4
- CODE_REVIEW: 'implementation_review_loop',
5
- REVIEW_SYNTHESIS: 'implementation_review_loop',
6
- IMPLEMENTATION: 'implementation_review_loop',
7
- TEST_AUTHORING: 'implementation_review_loop',
8
- JUDGE_REVIEW: 'implementation_review_loop',
9
- REFINEMENT: 'clarification_loop',
10
- WAITING_FOR_HUMAN: 'clarification_loop',
11
- ACCEPTANCE_VALIDATION: 'acceptance_validation_loop',
12
- };
13
- const ROUND_ENTRY_STATES = new Set([
14
- 'PLAN_REVIEW',
15
- 'CODE_REVIEW',
16
- 'REFINEMENT',
17
- 'ACCEPTANCE_VALIDATION',
18
- ]);
19
- const JUDGE_ENTRY_STATES = new Set(['JUDGE_REVIEW']);
20
3
  /** Default registry of iteration contracts with built-in contracts pre-loaded. */
21
4
  export class DefaultIterationContractRegistry {
22
5
  contracts = new Map();
@@ -41,7 +24,7 @@ export class DefaultIterationContractRegistry {
41
24
  }
42
25
  /** @inheritdoc */
43
26
  getContractForState(stateId) {
44
- const contractId = STATE_TO_CONTRACT[stateId];
27
+ const contractId = ITERATION_STATE_MAPPING[stateId]?.contractId;
45
28
  if (!contractId) {
46
29
  return null;
47
30
  }
@@ -53,12 +36,12 @@ export class DefaultIterationContractRegistry {
53
36
  if (!contract) {
54
37
  return;
55
38
  }
56
- if (JUDGE_ENTRY_STATES.has(stateId)) {
39
+ if (ITERATION_STATE_MAPPING[stateId]?.counter === 'judge') {
57
40
  const current = this.judgeArbitrationCounts.get(contract.id) ?? 0;
58
41
  this.judgeArbitrationCounts.set(contract.id, current + 1);
59
42
  return;
60
43
  }
61
- if (!ROUND_ENTRY_STATES.has(stateId)) {
44
+ if (ITERATION_STATE_MAPPING[stateId]?.counter !== 'iteration') {
62
45
  return;
63
46
  }
64
47
  const current = this.iterationCounts.get(contract.id) ?? 0;
@@ -1,2 +1,2 @@
1
- export { ACCEPTANCE_VALIDATION_LOOP, buildContracts, BUILT_IN_CONTRACTS, CLARIFICATION_LOOP, IMPLEMENTATION_REVIEW_LOOP, PLAN_REVIEW_LOOP, } from './built-in-contracts';
1
+ export { ACCEPTANCE_VALIDATION_LOOP, buildContracts, BUILT_IN_CONTRACTS, CLARIFICATION_LOOP, DECOMPOSITION_REVIEW_LOOP, IMPLEMENTATION_REVIEW_LOOP, PLAN_REVIEW_LOOP, } from './built-in-contracts';
2
2
  export { DefaultIterationContractRegistry } from './contract-registry';
@@ -1,2 +1,2 @@
1
- export { ACCEPTANCE_VALIDATION_LOOP, buildContracts, BUILT_IN_CONTRACTS, CLARIFICATION_LOOP, IMPLEMENTATION_REVIEW_LOOP, PLAN_REVIEW_LOOP, } from './built-in-contracts';
1
+ export { ACCEPTANCE_VALIDATION_LOOP, buildContracts, BUILT_IN_CONTRACTS, CLARIFICATION_LOOP, DECOMPOSITION_REVIEW_LOOP, IMPLEMENTATION_REVIEW_LOOP, PLAN_REVIEW_LOOP, } from './built-in-contracts';
2
2
  export { DefaultIterationContractRegistry } from './contract-registry';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-dev-orchestrator/governance",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,14 +21,14 @@
21
21
  "dist"
22
22
  ],
23
23
  "dependencies": {
24
- "@ai-dev-orchestrator/ports": "0.1.1",
25
- "@ai-dev-orchestrator/schemas": "0.1.1"
24
+ "@ai-dev-orchestrator/ports": "0.1.2",
25
+ "@ai-dev-orchestrator/schemas": "0.1.4"
26
26
  },
27
27
  "devDependencies": {
28
- "@types/node": "^26.4.0",
28
+ "@types/node": "^26.6.5",
29
29
  "vitest": "^4.1.11",
30
- "@ai-dev-orchestrator/artifacts": "0.1.1",
31
- "@ai-dev-orchestrator/role-system": "0.1.1",
30
+ "@ai-dev-orchestrator/artifacts": "0.1.2",
31
+ "@ai-dev-orchestrator/role-system": "0.1.2",
32
32
  "@ai-dev-orchestrator/build-config": "0.1.1",
33
33
  "@ai-dev-orchestrator/test-utils": "0.1.1"
34
34
  },