@ai-sdlc/orchestrator 0.6.0 → 0.9.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/dist/admission-composite.d.ts +67 -0
- package/dist/admission-composite.js +158 -0
- package/dist/admission-enrichment.d.ts +142 -0
- package/dist/admission-enrichment.js +331 -0
- package/dist/admission-hc.d.ts +62 -0
- package/dist/admission-hc.js +83 -0
- package/dist/admission-score.d.ts +95 -5
- package/dist/admission-score.js +84 -11
- package/dist/analysis/analyzer.js +3 -2
- package/dist/analysis/convention-detector.d.ts +85 -2
- package/dist/analysis/convention-detector.js +375 -70
- package/dist/analysis/diff-analyzer.d.ts +33 -0
- package/dist/analysis/diff-analyzer.js +122 -0
- package/dist/analysis/hotspot-analyzer.js +3 -1
- package/dist/analysis/index.d.ts +2 -1
- package/dist/analysis/index.js +2 -1
- package/dist/artifacts/index.d.ts +65 -0
- package/dist/artifacts/index.js +142 -0
- package/dist/backlog-adapter.d.ts +121 -0
- package/dist/backlog-adapter.js +438 -0
- package/dist/calibration.d.ts +43 -0
- package/dist/calibration.js +76 -0
- package/dist/cli/commands/agents.d.ts +24 -0
- package/dist/cli/commands/agents.js +66 -1
- package/dist/cli/commands/git-remote.d.ts +49 -0
- package/dist/cli/commands/git-remote.js +91 -0
- package/dist/cli/commands/health.d.ts +4 -0
- package/dist/cli/commands/health.js +13 -1
- package/dist/cli/commands/init.d.ts +26 -0
- package/dist/cli/commands/init.js +164 -22
- package/dist/cli/commands/mcp-setup.d.ts +31 -0
- package/dist/cli/commands/mcp-setup.js +78 -8
- package/dist/cli/formatters/table.js +15 -2
- package/dist/cli/index.d.ts +14 -1
- package/dist/cli/index.js +81 -20
- package/dist/cli/versions.d.ts +57 -0
- package/dist/cli/versions.js +128 -0
- package/dist/code-area-classifier.d.ts +21 -0
- package/dist/code-area-classifier.js +48 -0
- package/dist/config.d.ts +33 -1
- package/dist/config.js +78 -8
- package/dist/database/adapters/external.d.ts +24 -0
- package/dist/database/adapters/external.js +80 -0
- package/dist/database/adapters/neon.d.ts +41 -0
- package/dist/database/adapters/neon.js +98 -0
- package/dist/database/adapters/pg-snapshot-restore.d.ts +28 -0
- package/dist/database/adapters/pg-snapshot-restore.js +68 -0
- package/dist/database/adapters/sqlite-copy.d.ts +32 -0
- package/dist/database/adapters/sqlite-copy.js +145 -0
- package/dist/database/connection-injection.d.ts +35 -0
- package/dist/database/connection-injection.js +93 -0
- package/dist/database/index.d.ts +12 -0
- package/dist/database/index.js +23 -0
- package/dist/database/registry.d.ts +13 -0
- package/dist/database/registry.js +27 -0
- package/dist/database/topology.d.ts +52 -0
- package/dist/database/topology.js +44 -0
- package/dist/database/types.d.ts +89 -0
- package/dist/database/types.js +26 -0
- package/dist/design-authority.d.ts +40 -0
- package/dist/design-authority.js +71 -0
- package/dist/design-lookahead.d.ts +64 -0
- package/dist/design-lookahead.js +86 -0
- package/dist/design-quality-trend.d.ts +87 -0
- package/dist/design-quality-trend.js +190 -0
- package/dist/design-system-context.d.ts +46 -0
- package/dist/design-system-context.js +80 -0
- package/dist/design-system-correction-loop.d.ts +64 -0
- package/dist/design-system-correction-loop.js +128 -0
- package/dist/design-system-metrics.d.ts +61 -0
- package/dist/design-system-metrics.js +104 -0
- package/dist/design-system-stewardship.d.ts +22 -0
- package/dist/design-system-stewardship.js +85 -0
- package/dist/design-system-validation.d.ts +37 -0
- package/dist/design-system-validation.js +88 -0
- package/dist/dispatch/index.d.ts +4 -0
- package/dist/dispatch/index.js +4 -0
- package/dist/dispatch/merge-gate.d.ts +46 -0
- package/dist/dispatch/merge-gate.js +90 -0
- package/dist/dispatch/requeue.d.ts +57 -0
- package/dist/dispatch/requeue.js +131 -0
- package/dist/dispatch/worker-pool.d.ts +62 -0
- package/dist/dispatch/worker-pool.js +60 -0
- package/dist/execute.d.ts +40 -0
- package/dist/execute.js +185 -15
- package/dist/fix-ci.js +8 -1
- package/dist/fix-review.js +8 -1
- package/dist/harness/adapters/claude-code.d.ts +29 -0
- package/dist/harness/adapters/claude-code.js +191 -0
- package/dist/harness/adapters/codex.d.ts +25 -0
- package/dist/harness/adapters/codex.js +61 -0
- package/dist/harness/independence.d.ts +51 -0
- package/dist/harness/independence.js +67 -0
- package/dist/harness/index.d.ts +14 -0
- package/dist/harness/index.js +20 -0
- package/dist/harness/registry.d.ts +17 -0
- package/dist/harness/registry.js +31 -0
- package/dist/harness/types.d.ts +123 -0
- package/dist/harness/types.js +8 -0
- package/dist/harness/version-probe.d.ts +14 -0
- package/dist/harness/version-probe.js +123 -0
- package/dist/index.d.ts +30 -4
- package/dist/index.js +35 -2
- package/dist/models/classifier.d.ts +76 -0
- package/dist/models/classifier.js +221 -0
- package/dist/models/index.d.ts +3 -0
- package/dist/models/index.js +3 -0
- package/dist/models/registry.d.ts +97 -0
- package/dist/models/registry.js +173 -0
- package/dist/pillar-breakdown.d.ts +63 -0
- package/dist/pillar-breakdown.js +153 -0
- package/dist/priority.d.ts +5 -0
- package/dist/priority.js +18 -5
- package/dist/review-meta.d.ts +65 -0
- package/dist/review-meta.js +149 -0
- package/dist/review.d.ts +4 -0
- package/dist/review.js +12 -2
- package/dist/runners/claude-code-sdk.d.ts +31 -0
- package/dist/runners/claude-code-sdk.js +238 -0
- package/dist/runners/claude-code.d.ts +3 -0
- package/dist/runners/claude-code.js +30 -66
- package/dist/runners/codex.js +4 -1
- package/dist/runners/copilot.js +4 -1
- package/dist/runners/cursor.js +4 -1
- package/dist/runners/git-utils.d.ts +81 -0
- package/dist/runners/git-utils.js +201 -0
- package/dist/runners/index.d.ts +3 -0
- package/dist/runners/index.js +3 -0
- package/dist/runners/review-agent.d.ts +20 -0
- package/dist/runners/review-agent.js +171 -41
- package/dist/runners/runner-registry.js +10 -0
- package/dist/runners/sdk-review-runner.d.ts +65 -0
- package/dist/runners/sdk-review-runner.js +185 -0
- package/dist/runners/security-triage.d.ts +20 -4
- package/dist/runners/security-triage.js +39 -15
- package/dist/runners/types.d.ts +6 -0
- package/dist/runtime/attestations.d.ts +274 -0
- package/dist/runtime/attestations.js +460 -0
- package/dist/runtime/git-env.d.ts +53 -0
- package/dist/runtime/git-env.js +60 -0
- package/dist/runtime/index.d.ts +7 -0
- package/dist/runtime/index.js +7 -0
- package/dist/runtime/parallelism-flag.d.ts +10 -0
- package/dist/runtime/parallelism-flag.js +18 -0
- package/dist/runtime/port-allocator.d.ts +21 -0
- package/dist/runtime/port-allocator.js +66 -0
- package/dist/runtime/worktree-pool.d.ts +86 -0
- package/dist/runtime/worktree-pool.js +204 -0
- package/dist/runtime/worktree.d.ts +25 -0
- package/dist/runtime/worktree.js +111 -0
- package/dist/sa-scoring/auto-calibrate.d.ts +69 -0
- package/dist/sa-scoring/auto-calibrate.js +107 -0
- package/dist/sa-scoring/c1-sa2-computable.d.ts +42 -0
- package/dist/sa-scoring/c1-sa2-computable.js +59 -0
- package/dist/sa-scoring/composite.d.ts +107 -0
- package/dist/sa-scoring/composite.js +139 -0
- package/dist/sa-scoring/depparse-client.d.ts +79 -0
- package/dist/sa-scoring/depparse-client.js +187 -0
- package/dist/sa-scoring/did-compiler.d.ts +122 -0
- package/dist/sa-scoring/did-compiler.js +286 -0
- package/dist/sa-scoring/drift-monitor.d.ts +84 -0
- package/dist/sa-scoring/drift-monitor.js +186 -0
- package/dist/sa-scoring/exemplar-bank.d.ts +78 -0
- package/dist/sa-scoring/exemplar-bank.js +154 -0
- package/dist/sa-scoring/feedback-store.d.ts +100 -0
- package/dist/sa-scoring/feedback-store.js +156 -0
- package/dist/sa-scoring/index.d.ts +71 -0
- package/dist/sa-scoring/index.js +158 -0
- package/dist/sa-scoring/layer1-deterministic.d.ts +115 -0
- package/dist/sa-scoring/layer1-deterministic.js +298 -0
- package/dist/sa-scoring/layer2-structural.d.ts +71 -0
- package/dist/sa-scoring/layer2-structural.js +151 -0
- package/dist/sa-scoring/layer3-llm.d.ts +86 -0
- package/dist/sa-scoring/layer3-llm.js +282 -0
- package/dist/sa-scoring/rescore-orchestrator.d.ts +52 -0
- package/dist/sa-scoring/rescore-orchestrator.js +47 -0
- package/dist/scheduling/burn-down.d.ts +27 -0
- package/dist/scheduling/burn-down.js +43 -0
- package/dist/scheduling/calibration.d.ts +42 -0
- package/dist/scheduling/calibration.js +150 -0
- package/dist/scheduling/index.d.ts +8 -0
- package/dist/scheduling/index.js +8 -0
- package/dist/scheduling/ledger.d.ts +59 -0
- package/dist/scheduling/ledger.js +216 -0
- package/dist/scheduling/off-peak.d.ts +27 -0
- package/dist/scheduling/off-peak.js +112 -0
- package/dist/scheduling/schedule-decision.d.ts +39 -0
- package/dist/scheduling/schedule-decision.js +89 -0
- package/dist/scheduling/tier-analysis.d.ts +47 -0
- package/dist/scheduling/tier-analysis.js +81 -0
- package/dist/scheduling/types.d.ts +140 -0
- package/dist/scheduling/types.js +11 -0
- package/dist/shared.d.ts +13 -0
- package/dist/shared.js +32 -0
- package/dist/state/schema.d.ts +5 -1
- package/dist/state/schema.js +223 -1
- package/dist/state/store.d.ts +55 -1
- package/dist/state/store.js +342 -7
- package/dist/state/types.d.ts +139 -0
- package/dist/types.d.ts +1 -1
- package/dist/validate-agent-output.js +4 -1
- package/dist/watch.js +6 -0
- package/package.json +2 -2
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admission-subset composite (RFC-0008 §A.6).
|
|
3
|
+
*
|
|
4
|
+
* The admission gate uses a subset of the full PPA composite:
|
|
5
|
+
*
|
|
6
|
+
* P_admission = SA × D-pi_adjusted × ER × (1 + HC)
|
|
7
|
+
*
|
|
8
|
+
* where:
|
|
9
|
+
* SA = soulAlignment (0–1)
|
|
10
|
+
* D-pi_adjusted = rawDP × (1 − defectRiskFactor)
|
|
11
|
+
* rawDP = (demand + consensus + conviction + drift) / 4
|
|
12
|
+
* ER = min(baseER × autonomyFactor, designSystemReadiness)
|
|
13
|
+
* baseER = 1 − complexity / 10
|
|
14
|
+
* HC = tanh(weighted sum — see §A.6 Amendment 4)
|
|
15
|
+
*
|
|
16
|
+
* M-phi, E-tau, C-kappa are **deferred to runtime scoring** (§A.6 table):
|
|
17
|
+
* they apply once the issue is admitted and picked up by an executor,
|
|
18
|
+
* not at the admission gate. To keep the returned `PriorityScore`
|
|
19
|
+
* shape consistent with downstream consumers, we fill those dimensions
|
|
20
|
+
* with neutral values: marketForce=1, entropyTax=0, calibration=1
|
|
21
|
+
* (or the configured calibration coefficient if supplied, for display).
|
|
22
|
+
*
|
|
23
|
+
* The `override` bypass is preserved at position 1: when the input has
|
|
24
|
+
* `override: true`, we return `composite = Infinity` without running
|
|
25
|
+
* the admission math — identical to the legacy PPA behaviour.
|
|
26
|
+
*/
|
|
27
|
+
import type { PriorityConfig, PriorityInput, PriorityScore } from '@ai-sdlc/reference';
|
|
28
|
+
import type { AdmissionInput } from './admission-score.js';
|
|
29
|
+
import { type AdmissionHumanCurveResult } from './admission-hc.js';
|
|
30
|
+
/**
|
|
31
|
+
* Result of the admission composite — returns a `PriorityScore`
|
|
32
|
+
* (backward-compatible with `scoreIssueForAdmission` consumers) plus
|
|
33
|
+
* the admission-specific breakdown for auditability.
|
|
34
|
+
*/
|
|
35
|
+
export interface AdmissionComposite {
|
|
36
|
+
score: PriorityScore;
|
|
37
|
+
breakdown: {
|
|
38
|
+
soulAlignment: number;
|
|
39
|
+
rawDemandPressure: number;
|
|
40
|
+
defectRiskFactor: number;
|
|
41
|
+
demandPressureAdjusted: number;
|
|
42
|
+
baseExecutionReality: number;
|
|
43
|
+
autonomyFactor: number;
|
|
44
|
+
designSystemReadiness: number;
|
|
45
|
+
executionReality: number;
|
|
46
|
+
humanCurve: AdmissionHumanCurveResult;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export interface AdmissionCompositeOptions {
|
|
50
|
+
/**
|
|
51
|
+
* Optional override for the soulAlignment dimension — when present
|
|
52
|
+
* (typically a Phase 2b/2c/3 SA-1 from `scoreSoulAlignment`), it
|
|
53
|
+
* replaces the label-based heuristic. In Phase 2a shadow mode,
|
|
54
|
+
* callers pass undefined and the label-based fallback applies.
|
|
55
|
+
*/
|
|
56
|
+
soulAlignmentOverride?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Partial PriorityInput overrides applied AFTER `mapIssueToPriorityInput`.
|
|
59
|
+
* Used by non-GitHub trackers (e.g. Backlog.md adapter) to inject
|
|
60
|
+
* tracker-specific signals — `priority:p*` labels, AC-derived
|
|
61
|
+
* complexity, `qualityFlags` — that the GitHub-shaped mapper
|
|
62
|
+
* cannot extract. Only fields with defined values overwrite.
|
|
63
|
+
*/
|
|
64
|
+
priorityInputOverrides?: Partial<PriorityInput>;
|
|
65
|
+
}
|
|
66
|
+
export declare function computeAdmissionComposite(input: AdmissionInput, config?: PriorityConfig, options?: AdmissionCompositeOptions): AdmissionComposite;
|
|
67
|
+
//# sourceMappingURL=admission-composite.d.ts.map
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admission-subset composite (RFC-0008 §A.6).
|
|
3
|
+
*
|
|
4
|
+
* The admission gate uses a subset of the full PPA composite:
|
|
5
|
+
*
|
|
6
|
+
* P_admission = SA × D-pi_adjusted × ER × (1 + HC)
|
|
7
|
+
*
|
|
8
|
+
* where:
|
|
9
|
+
* SA = soulAlignment (0–1)
|
|
10
|
+
* D-pi_adjusted = rawDP × (1 − defectRiskFactor)
|
|
11
|
+
* rawDP = (demand + consensus + conviction + drift) / 4
|
|
12
|
+
* ER = min(baseER × autonomyFactor, designSystemReadiness)
|
|
13
|
+
* baseER = 1 − complexity / 10
|
|
14
|
+
* HC = tanh(weighted sum — see §A.6 Amendment 4)
|
|
15
|
+
*
|
|
16
|
+
* M-phi, E-tau, C-kappa are **deferred to runtime scoring** (§A.6 table):
|
|
17
|
+
* they apply once the issue is admitted and picked up by an executor,
|
|
18
|
+
* not at the admission gate. To keep the returned `PriorityScore`
|
|
19
|
+
* shape consistent with downstream consumers, we fill those dimensions
|
|
20
|
+
* with neutral values: marketForce=1, entropyTax=0, calibration=1
|
|
21
|
+
* (or the configured calibration coefficient if supplied, for display).
|
|
22
|
+
*
|
|
23
|
+
* The `override` bypass is preserved at position 1: when the input has
|
|
24
|
+
* `override: true`, we return `composite = Infinity` without running
|
|
25
|
+
* the admission math — identical to the legacy PPA behaviour.
|
|
26
|
+
*/
|
|
27
|
+
import { mapIssueToPriorityInput } from './admission-score.js';
|
|
28
|
+
import { computeAutonomyFactor, computeDefectRiskFactor, computeReadinessFromDesignSystemContext, } from './admission-enrichment.js';
|
|
29
|
+
import { computeAdmissionHumanCurve } from './admission-hc.js';
|
|
30
|
+
import { computeConfidence } from './priority.js';
|
|
31
|
+
const DEFAULT_SIGNAL = 0.5;
|
|
32
|
+
export function computeAdmissionComposite(input, config, options) {
|
|
33
|
+
const timestamp = new Date().toISOString();
|
|
34
|
+
const baseInput = mapIssueToPriorityInput(input);
|
|
35
|
+
const priorityInput = options?.priorityInputOverrides
|
|
36
|
+
? mergePriorityInputOverrides(baseInput, options.priorityInputOverrides)
|
|
37
|
+
: baseInput;
|
|
38
|
+
// ── Override path: position-1 bypass (§6 / AC #4) ─────────────
|
|
39
|
+
if (priorityInput.override) {
|
|
40
|
+
const score = {
|
|
41
|
+
composite: Infinity,
|
|
42
|
+
dimensions: {
|
|
43
|
+
soulAlignment: 1,
|
|
44
|
+
demandPressure: 1.5,
|
|
45
|
+
marketForce: 3.0,
|
|
46
|
+
executionReality: 1,
|
|
47
|
+
entropyTax: 0,
|
|
48
|
+
humanCurve: 1,
|
|
49
|
+
calibration: clampCalibration(config?.calibrationCoefficient),
|
|
50
|
+
},
|
|
51
|
+
confidence: 1,
|
|
52
|
+
timestamp,
|
|
53
|
+
override: {
|
|
54
|
+
reason: priorityInput.overrideReason ?? 'No reason provided',
|
|
55
|
+
expiry: priorityInput.overrideExpiry,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
return {
|
|
59
|
+
score,
|
|
60
|
+
breakdown: {
|
|
61
|
+
soulAlignment: 1,
|
|
62
|
+
rawDemandPressure: 1,
|
|
63
|
+
defectRiskFactor: 0,
|
|
64
|
+
demandPressureAdjusted: 1,
|
|
65
|
+
baseExecutionReality: 1,
|
|
66
|
+
autonomyFactor: 1,
|
|
67
|
+
designSystemReadiness: 1,
|
|
68
|
+
executionReality: 1,
|
|
69
|
+
humanCurve: {
|
|
70
|
+
hcExplicit: 0,
|
|
71
|
+
hcConsensus: 0,
|
|
72
|
+
hcDecision: 0,
|
|
73
|
+
hcDesign: 0,
|
|
74
|
+
hcRaw: 0,
|
|
75
|
+
hcComposite: 1,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
// ── SA (soul alignment) — SA-1 override (M5) or label-based fallback ──
|
|
81
|
+
const soulAlignment = clamp01(options?.soulAlignmentOverride ?? priorityInput.soulAlignment ?? DEFAULT_SIGNAL);
|
|
82
|
+
// ── D-pi_adjusted ─────────────────────────────────────────────
|
|
83
|
+
const demand = priorityInput.demandSignal ?? DEFAULT_SIGNAL;
|
|
84
|
+
const consensus = priorityInput.teamConsensus ?? DEFAULT_SIGNAL;
|
|
85
|
+
const conviction = priorityInput.builderConviction ?? DEFAULT_SIGNAL;
|
|
86
|
+
const drift = priorityInput.competitiveDrift ?? 0;
|
|
87
|
+
const rawDemandPressure = clamp01((demand + consensus + conviction + drift) / 4);
|
|
88
|
+
const defectRiskFactor = computeDefectRiskFactor(input.codeAreaQuality);
|
|
89
|
+
const demandPressureAdjusted = rawDemandPressure * (1 - defectRiskFactor);
|
|
90
|
+
// ── ER (execution reality) ─────────────────────────────────────
|
|
91
|
+
// baseER = 1 - complexity/10; complexity defaults to neutral midpoint.
|
|
92
|
+
const complexity = priorityInput.complexity ?? 5;
|
|
93
|
+
const baseExecutionReality = clamp01(1 - complexity / 10);
|
|
94
|
+
const autonomyFactor = computeAutonomyFactor(input.autonomyContext);
|
|
95
|
+
const designSystemReadiness = computeReadinessFromDesignSystemContext(input.designSystemContext);
|
|
96
|
+
const executionReality = Math.min(baseExecutionReality * autonomyFactor, designSystemReadiness);
|
|
97
|
+
// ── HC (tanh-compressed with HC_design) ───────────────────────
|
|
98
|
+
const humanCurve = computeAdmissionHumanCurve(input);
|
|
99
|
+
// ── §A.6 admission subset composite ───────────────────────────
|
|
100
|
+
const composite = soulAlignment * demandPressureAdjusted * executionReality * (1 + humanCurve.hcComposite);
|
|
101
|
+
const score = {
|
|
102
|
+
composite,
|
|
103
|
+
dimensions: {
|
|
104
|
+
soulAlignment,
|
|
105
|
+
demandPressure: demandPressureAdjusted,
|
|
106
|
+
// M-phi deferred to runtime — neutral for admission.
|
|
107
|
+
marketForce: 1,
|
|
108
|
+
executionReality,
|
|
109
|
+
// E-tau deferred to runtime — admission does not apply the
|
|
110
|
+
// entropy tax (competitiveDrift feeds rawDP instead).
|
|
111
|
+
entropyTax: 0,
|
|
112
|
+
humanCurve: humanCurve.hcComposite,
|
|
113
|
+
// C-kappa deferred to runtime — expose configured value for
|
|
114
|
+
// display continuity but do not multiply it into `composite`.
|
|
115
|
+
calibration: clampCalibration(config?.calibrationCoefficient),
|
|
116
|
+
},
|
|
117
|
+
confidence: computeConfidence(priorityInput),
|
|
118
|
+
timestamp,
|
|
119
|
+
};
|
|
120
|
+
return {
|
|
121
|
+
score,
|
|
122
|
+
breakdown: {
|
|
123
|
+
soulAlignment,
|
|
124
|
+
rawDemandPressure,
|
|
125
|
+
defectRiskFactor,
|
|
126
|
+
demandPressureAdjusted,
|
|
127
|
+
baseExecutionReality,
|
|
128
|
+
autonomyFactor,
|
|
129
|
+
designSystemReadiness,
|
|
130
|
+
executionReality,
|
|
131
|
+
humanCurve,
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function clamp01(value) {
|
|
136
|
+
return Math.min(1, Math.max(0, value));
|
|
137
|
+
}
|
|
138
|
+
function clampCalibration(value) {
|
|
139
|
+
if (value === undefined)
|
|
140
|
+
return 1.0;
|
|
141
|
+
return Math.min(1.3, Math.max(0.7, value));
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Apply non-GitHub tracker overrides on top of the GitHub-shaped
|
|
145
|
+
* `mapIssueToPriorityInput` output. A field's override wins iff it is
|
|
146
|
+
* not `undefined`; this preserves the GitHub mapper's defaults for
|
|
147
|
+
* any field the override does not specify.
|
|
148
|
+
*/
|
|
149
|
+
function mergePriorityInputOverrides(base, overrides) {
|
|
150
|
+
const merged = { ...base };
|
|
151
|
+
for (const [key, value] of Object.entries(overrides)) {
|
|
152
|
+
if (value !== undefined) {
|
|
153
|
+
merged[key] = value;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return merged;
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=admission-composite.js.map
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bridge between stateless admission scoring and the stateful orchestrator
|
|
3
|
+
* (RFC-0008 Addendum A §A.2 – §A.5).
|
|
4
|
+
*
|
|
5
|
+
* `enrichAdmissionInput()` reads from the orchestrator's state store and
|
|
6
|
+
* resolved resources to populate the RFC-0008 context fields on
|
|
7
|
+
* `AdmissionInput`, then `computeDesignSystemReadiness()` produces the
|
|
8
|
+
* Eρ₄ scalar that feeds the admission composite in §A.6.
|
|
9
|
+
*
|
|
10
|
+
* Scope for AISDLC-43: implement C2 (Eρ₄) only. C3/C4/C5 are populated
|
|
11
|
+
* by later tasks (AISDLC-44/45/46).
|
|
12
|
+
*/
|
|
13
|
+
import type { AutonomyPolicy, DesignIntentDocument, DesignSystemBinding } from '@ai-sdlc/reference';
|
|
14
|
+
import type { StateStore } from './state/store.js';
|
|
15
|
+
import type { AdmissionInput, AutonomyContext, CodeAreaQuality, DesignAuthoritySignal, DesignSystemContext } from './admission-score.js';
|
|
16
|
+
/**
|
|
17
|
+
* Minimum data points required before `code_area_metrics` is trusted
|
|
18
|
+
* enough to drive defect-risk penalties (RFC-0008 §7.4 Open Question 4).
|
|
19
|
+
*/
|
|
20
|
+
export declare const CODE_AREA_METRICS_MIN_DATA_POINTS = 10;
|
|
21
|
+
export type LifecyclePhase = 'preDesignSystem' | 'catalogBootstrap' | 'postDesignSystem';
|
|
22
|
+
export interface EnrichmentContext {
|
|
23
|
+
/** State store for reading visual baselines and code-area metrics. */
|
|
24
|
+
stateStore?: StateStore;
|
|
25
|
+
/** Resolved DesignSystemBinding referenced by the DID (absent ⇒ preDesignSystem). */
|
|
26
|
+
designSystemBinding?: DesignSystemBinding;
|
|
27
|
+
/** Resolved DesignIntentDocument. Unused in C2 but threaded through for future connections. */
|
|
28
|
+
designIntentDocument?: DesignIntentDocument;
|
|
29
|
+
/** ISO timestamp when the DSB was adopted — used for age-based lifecycle detection. */
|
|
30
|
+
dsbAdoptedAt?: string;
|
|
31
|
+
/** Catalog gaps supplied by a catalog-provider adapter (AISDLC-43 accepts these pre-computed). */
|
|
32
|
+
catalogGaps?: string[];
|
|
33
|
+
/** Code area for the issue (e.g. "orchestrator/src/priority"), used by C3. */
|
|
34
|
+
codeArea?: string;
|
|
35
|
+
/** Resolved AutonomyPolicy — used by C4. */
|
|
36
|
+
autonomyPolicy?: AutonomyPolicy;
|
|
37
|
+
/**
|
|
38
|
+
* Agent expected to handle the issue. Used to pick a specific entry
|
|
39
|
+
* from `autonomyPolicy.status.agents`. When absent, the most
|
|
40
|
+
* permissive currently-earned level across all agents is used.
|
|
41
|
+
*/
|
|
42
|
+
agentName?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Task complexity in [0, 10] for mapping to a required autonomy level.
|
|
45
|
+
* When omitted, C4 falls back to the most permissive level for the
|
|
46
|
+
* resolved agent (requiredLevel = currentEarnedLevel → gap = 0).
|
|
47
|
+
*/
|
|
48
|
+
complexity?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Compliance score for the issue's area in [0, 1]. When present,
|
|
51
|
+
* `designAuthorityWeight` is modulated by `(1.2 - areaComplianceScore)`.
|
|
52
|
+
* When absent, the base weight applies unmodulated.
|
|
53
|
+
*/
|
|
54
|
+
areaComplianceScore?: number;
|
|
55
|
+
/** Clock injection for deterministic tests. Defaults to `Date.now`. */
|
|
56
|
+
now?: () => number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Populate `designSystemContext` on the admission input using the
|
|
60
|
+
* resolved DSB and state store. Returns the input unchanged when no DSB
|
|
61
|
+
* is available (preDesignSystem phase — caller falls through to the
|
|
62
|
+
* stateless path).
|
|
63
|
+
*/
|
|
64
|
+
export declare function enrichAdmissionInput(input: AdmissionInput, ctx: EnrichmentContext): AdmissionInput;
|
|
65
|
+
/**
|
|
66
|
+
* Compute the C3 defect-risk factor per §A.5. Returns 0 when
|
|
67
|
+
* `codeAreaQuality` is absent (insufficient data → no penalty).
|
|
68
|
+
*
|
|
69
|
+
* !hasFrontendComponents → 0.5×dd + 0.3×churn + 0.2×prRej
|
|
70
|
+
* hasFrontendComponents
|
|
71
|
+
* no designQuality → same as pure code (no blend target)
|
|
72
|
+
* with designQuality → 0.7 × code + 0.3 × design
|
|
73
|
+
* where design = 0.4×(1-ciPass)
|
|
74
|
+
* + 0.4×reviewRej
|
|
75
|
+
* + 0.2×(1-usabPass)
|
|
76
|
+
*
|
|
77
|
+
* Final value is clamped to [0, 0.5].
|
|
78
|
+
*/
|
|
79
|
+
export declare function computeDefectRiskFactor(quality: CodeAreaQuality | undefined): number;
|
|
80
|
+
/**
|
|
81
|
+
* Map task complexity to the required autonomy level per §A.4:
|
|
82
|
+
* complexity ≤ 3 → level 1
|
|
83
|
+
* complexity ≤ 6 → level 2
|
|
84
|
+
* else → level 3
|
|
85
|
+
*/
|
|
86
|
+
export declare function complexityToAutonomyLevel(complexity: number): number;
|
|
87
|
+
/**
|
|
88
|
+
* Compute the C4 autonomy factor per §A.5:
|
|
89
|
+
* gap = requiredLevel - currentEarnedLevel
|
|
90
|
+
* gap > 0 → max(0.1, 1.0 - gap × 0.4)
|
|
91
|
+
* gap ≤ 0 → 1.0
|
|
92
|
+
*/
|
|
93
|
+
export declare function computeAutonomyFactor(ctx: AutonomyContext | undefined): number;
|
|
94
|
+
/**
|
|
95
|
+
* Compute the C5 design-authority weight per §A.5.
|
|
96
|
+
*
|
|
97
|
+
* non-authority → 0.0
|
|
98
|
+
* authority + positive → +0.6 × modulation
|
|
99
|
+
* authority + negative → -0.4 × modulation
|
|
100
|
+
* authority + no type → +0.3 × modulation
|
|
101
|
+
*
|
|
102
|
+
* where `modulation = 1.2 - areaComplianceScore` when the score is
|
|
103
|
+
* supplied, else `1.0` (unmodulated base weight).
|
|
104
|
+
*/
|
|
105
|
+
export declare function computeDesignAuthorityWeight(signal: DesignAuthoritySignal | undefined): number;
|
|
106
|
+
/**
|
|
107
|
+
* Compute the C2 Eρ₄ design-system readiness scalar in [0, 1] per §A.5.
|
|
108
|
+
*
|
|
109
|
+
* preDesignSystem: 1.0 (no DSB → no penalty)
|
|
110
|
+
* catalogBootstrap: max(0.3, 0.4×cat + 0.3×tok + 0.3×baseline)
|
|
111
|
+
* postDesignSystem: 0.4×cat + 0.3×tok + 0.3×baseline
|
|
112
|
+
*/
|
|
113
|
+
export declare function computeDesignSystemReadiness(ctx: EnrichmentContext): number;
|
|
114
|
+
/**
|
|
115
|
+
* Compute the C2 Eρ₄ scalar directly from the DesignSystemContext
|
|
116
|
+
* already populated on an `AdmissionInput` (no DSB/state lookups).
|
|
117
|
+
*
|
|
118
|
+
* undefined (preDesignSystem) → 1.0
|
|
119
|
+
* inBootstrapPhase → max(0.3, computed)
|
|
120
|
+
* else → computed
|
|
121
|
+
*
|
|
122
|
+
* Used by the admission composite (§A.6) to avoid re-reading the state
|
|
123
|
+
* store on every score call.
|
|
124
|
+
*/
|
|
125
|
+
export declare function computeReadinessFromDesignSystemContext(context: DesignSystemContext | undefined): number;
|
|
126
|
+
export declare function detectLifecyclePhase(binding: DesignSystemBinding | undefined, normalizedCatalogCoverage: number, ageDays: number): LifecyclePhase;
|
|
127
|
+
/**
|
|
128
|
+
* Days since the DSB was adopted. Returns 0 when no adoption timestamp
|
|
129
|
+
* is supplied — the conservative default (treats DSB as brand-new and
|
|
130
|
+
* favours the bootstrap floor).
|
|
131
|
+
*/
|
|
132
|
+
export declare function computeDsbAgeDays(adoptedAt: string | undefined, now?: () => number): number;
|
|
133
|
+
/**
|
|
134
|
+
* Fraction of the UI under visual-regression monitoring for this binding,
|
|
135
|
+
* derived from approved baselines in `visual_regression_results`.
|
|
136
|
+
*
|
|
137
|
+
* Definition (§A.5 proxy): `approvedBaselines / totalBaselines`. Returns
|
|
138
|
+
* 0 when no history exists (bootstrap protection: avoids over-crediting
|
|
139
|
+
* readiness when the monitor hasn't run yet).
|
|
140
|
+
*/
|
|
141
|
+
export declare function computeBaselineCoverage(store: StateStore, bindingName: string): number;
|
|
142
|
+
//# sourceMappingURL=admission-enrichment.d.ts.map
|