@ai-sdlc/orchestrator 0.9.0 → 0.13.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/__test-helpers/git-env.d.ts +40 -0
- package/dist/__test-helpers/git-env.js +73 -0
- package/dist/adapters.d.ts +42 -3
- package/dist/adapters.js +133 -3
- package/dist/admission-composite.d.ts +134 -1
- package/dist/admission-composite.js +170 -6
- package/dist/admission-enrichment.d.ts +12 -3
- package/dist/admission-enrichment.js +71 -10
- package/dist/admission-hc.d.ts +20 -1
- package/dist/admission-hc.js +12 -1
- package/dist/admission-score.d.ts +44 -0
- package/dist/admission-score.js +11 -2
- package/dist/backlog-adapter.d.ts +45 -0
- package/dist/backlog-adapter.js +145 -1
- package/dist/calibration.d.ts +81 -0
- package/dist/calibration.js +76 -0
- package/dist/cli/commands/git-remote.d.ts +25 -0
- package/dist/cli/commands/git-remote.js +80 -1
- package/dist/cli/commands/init-features.d.ts +507 -0
- package/dist/cli/commands/init-features.js +1100 -0
- package/dist/cli/commands/init-templates.d.ts +301 -0
- package/dist/cli/commands/init-templates.js +1341 -0
- package/dist/cli/commands/init.d.ts +67 -0
- package/dist/cli/commands/init.js +301 -2
- package/dist/cli/commands/run.js +9 -1
- package/dist/cli/index.d.ts +11 -0
- package/dist/cli/index.js +42 -8
- package/dist/compliance/composer.d.ts +79 -0
- package/dist/compliance/composer.js +258 -0
- package/dist/compliance/errors.d.ts +64 -0
- package/dist/compliance/errors.js +85 -0
- package/dist/compliance/loader.d.ts +52 -0
- package/dist/compliance/loader.js +124 -0
- package/dist/compliance/types.d.ts +184 -0
- package/dist/compliance/types.js +41 -0
- package/dist/compliance-clearance.d.ts +269 -0
- package/dist/compliance-clearance.js +269 -0
- package/dist/config.js +17 -0
- package/dist/cost-tracker.d.ts +22 -0
- package/dist/cost-tracker.js +41 -0
- package/dist/database/adapters/external.js +5 -1
- package/dist/design-authority.d.ts +13 -0
- package/dist/design-authority.js +13 -0
- package/dist/embedding/adapters/openai-text-embedding-3-small.d.ts +71 -0
- package/dist/embedding/adapters/openai-text-embedding-3-small.js +190 -0
- package/dist/embedding/consumers/tessellation-drift.d.ts +74 -0
- package/dist/embedding/consumers/tessellation-drift.js +76 -0
- package/dist/embedding/cross-provider.d.ts +78 -0
- package/dist/embedding/cross-provider.js +75 -0
- package/dist/embedding/deprecation.d.ts +151 -0
- package/dist/embedding/deprecation.js +229 -0
- package/dist/embedding/errors.d.ts +90 -0
- package/dist/embedding/errors.js +150 -0
- package/dist/embedding/index.d.ts +29 -0
- package/dist/embedding/index.js +24 -0
- package/dist/embedding/pipeline-load.d.ts +146 -0
- package/dist/embedding/pipeline-load.js +178 -0
- package/dist/embedding/registry.d.ts +45 -0
- package/dist/embedding/registry.js +61 -0
- package/dist/embedding/stale-vector.d.ts +110 -0
- package/dist/embedding/stale-vector.js +92 -0
- package/dist/embedding/storage/index.d.ts +51 -0
- package/dist/embedding/storage/index.js +43 -0
- package/dist/embedding/storage/jsonl-backend.d.ts +150 -0
- package/dist/embedding/storage/jsonl-backend.js +332 -0
- package/dist/embedding/storage/types.d.ts +135 -0
- package/dist/embedding/storage/types.js +13 -0
- package/dist/embedding/types.d.ts +180 -0
- package/dist/embedding/types.js +10 -0
- package/dist/execute.d.ts +29 -2
- package/dist/execute.js +179 -35
- package/dist/index.d.ts +14 -2
- package/dist/index.js +19 -2
- package/dist/journey/inheritance-validator.d.ts +396 -0
- package/dist/journey/inheritance-validator.js +370 -0
- package/dist/journey/state-id-drift-rule.d.ts +137 -0
- package/dist/journey/state-id-drift-rule.js +245 -0
- package/dist/journey-sa2-router.d.ts +395 -0
- package/dist/journey-sa2-router.js +308 -0
- package/dist/models/classifier.d.ts +3 -1
- package/dist/models/classifier.js +61 -5
- package/dist/pillar-breakdown.d.ts +23 -1
- package/dist/pillar-breakdown.js +9 -0
- package/dist/runners/review-agent.js +6 -2
- package/dist/runners/runner-registry.d.ts +36 -0
- package/dist/runners/runner-registry.js +90 -0
- package/dist/runtime/attestations.d.ts +663 -11
- package/dist/runtime/attestations.js +971 -24
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +1 -1
- package/dist/runtime/parallelism-flag.d.ts +21 -3
- package/dist/runtime/parallelism-flag.js +27 -6
- package/dist/runtime/port-allocator.d.ts +11 -0
- package/dist/runtime/port-allocator.js +30 -0
- package/dist/sa-scoring/layer3-llm.js +6 -1
- package/dist/sa-scoring/revision-proposal-config.d.ts +178 -0
- package/dist/sa-scoring/revision-proposal-config.js +198 -0
- package/dist/sa-scoring/revision-proposal.d.ts +285 -0
- package/dist/sa-scoring/revision-proposal.js +417 -0
- package/dist/signal-ingestion/adapters/community-thread.d.ts +43 -0
- package/dist/signal-ingestion/adapters/community-thread.js +55 -0
- package/dist/signal-ingestion/adapters/in-app-feedback.d.ts +67 -0
- package/dist/signal-ingestion/adapters/in-app-feedback.js +51 -0
- package/dist/signal-ingestion/adapters/manual.d.ts +78 -0
- package/dist/signal-ingestion/adapters/manual.js +112 -0
- package/dist/signal-ingestion/adapters/support-ticket.d.ts +47 -0
- package/dist/signal-ingestion/adapters/support-ticket.js +51 -0
- package/dist/signal-ingestion/classifier.d.ts +205 -0
- package/dist/signal-ingestion/classifier.js +494 -0
- package/dist/signal-ingestion/clustering-types.d.ts +36 -0
- package/dist/signal-ingestion/clustering-types.js +14 -0
- package/dist/signal-ingestion/clustering.d.ts +200 -0
- package/dist/signal-ingestion/clustering.js +413 -0
- package/dist/signal-ingestion/config.d.ts +351 -0
- package/dist/signal-ingestion/config.js +587 -0
- package/dist/signal-ingestion/d1.d.ts +252 -0
- package/dist/signal-ingestion/d1.js +235 -0
- package/dist/signal-ingestion/errors.d.ts +73 -0
- package/dist/signal-ingestion/errors.js +108 -0
- package/dist/signal-ingestion/governance-events.d.ts +181 -0
- package/dist/signal-ingestion/governance-events.js +189 -0
- package/dist/signal-ingestion/index.d.ts +35 -0
- package/dist/signal-ingestion/index.js +53 -0
- package/dist/signal-ingestion/manual-share-metric.d.ts +93 -0
- package/dist/signal-ingestion/manual-share-metric.js +106 -0
- package/dist/signal-ingestion/registry.d.ts +40 -0
- package/dist/signal-ingestion/registry.js +137 -0
- package/dist/signal-ingestion/residency.d.ts +227 -0
- package/dist/signal-ingestion/residency.js +238 -0
- package/dist/signal-ingestion/significance.d.ts +554 -0
- package/dist/signal-ingestion/significance.js +555 -0
- package/dist/signal-ingestion/types.d.ts +191 -0
- package/dist/signal-ingestion/types.js +8 -0
- package/dist/substrate/drift-composition.d.ts +270 -0
- package/dist/substrate/drift-composition.js +306 -0
- package/dist/substrate/drift-tui-surface.d.ts +61 -0
- package/dist/substrate/drift-tui-surface.js +102 -0
- package/dist/substrate/identity-class.d.ts +176 -0
- package/dist/substrate/identity-class.js +201 -0
- package/dist/tessellation/cross-soul-provenance-rule.d.ts +133 -0
- package/dist/tessellation/cross-soul-provenance-rule.js +171 -0
- package/dist/tessellation/inter-soul-embedding-distance-rule.d.ts +61 -0
- package/dist/tessellation/inter-soul-embedding-distance-rule.js +67 -0
- package/dist/tessellation/rule-registry.d.ts +269 -0
- package/dist/tessellation/rule-registry.js +92 -0
- package/dist/tessellation/soul-slug-ast-scan-rule.d.ts +90 -0
- package/dist/tessellation/soul-slug-ast-scan-rule.js +158 -0
- package/dist/tessellation-admission.d.ts +162 -0
- package/dist/tessellation-admission.js +146 -0
- package/dist/tessellation-drift.d.ts +246 -0
- package/dist/tessellation-drift.js +250 -0
- package/dist/validate-config.js +13 -0
- package/dist/validate-issue.js +2 -2
- package/dist/variant/cardinality-activation.d.ts +126 -0
- package/dist/variant/cardinality-activation.js +101 -0
- package/dist/variant/deprecation-lifecycle.d.ts +184 -0
- package/dist/variant/deprecation-lifecycle.js +208 -0
- package/dist/variant/drift-extension.d.ts +136 -0
- package/dist/variant/drift-extension.js +164 -0
- package/dist/variant/engineering-review.d.ts +185 -0
- package/dist/variant/engineering-review.js +142 -0
- package/dist/variant/index.d.ts +32 -0
- package/dist/variant/index.js +32 -0
- package/dist/variant/inheritance-validator.d.ts +165 -0
- package/dist/variant/inheritance-validator.js +139 -0
- package/dist/variant/internal-adopter/index.d.ts +11 -0
- package/dist/variant/internal-adopter/index.js +10 -0
- package/dist/variant/internal-adopter/products.d.ts +156 -0
- package/dist/variant/internal-adopter/products.js +366 -0
- package/dist/variant-admission.d.ts +316 -0
- package/dist/variant-admission.js +247 -0
- package/package.json +11 -8
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RFC-0017 Phase 3 — Eτ_tessellation_drift extension for variant-scoped scans.
|
|
3
|
+
*
|
|
4
|
+
* Composes with RFC-0009 Phase 4.2 / AISDLC-317 (`orchestrator/src/tessellation-drift.ts`)
|
|
5
|
+
* to extend drift detection with variant-scoped design intent scans per RFC-0017 §6.2:
|
|
6
|
+
*
|
|
7
|
+
* "when a variant is added/removed/modified, the Eτ_tessellation_drift detector
|
|
8
|
+
* MUST scan substrate code for variant-specific identifiers (parallel to per-soul
|
|
9
|
+
* scan). Substrate code referring to specific variant IDs is a drift signal."
|
|
10
|
+
*
|
|
11
|
+
* Emits `Decision: variant-design-intent-drift` events catalog-routed per
|
|
12
|
+
* RFC-0035 Stage A/B/C (non-blocking per G0 contract).
|
|
13
|
+
*
|
|
14
|
+
* **Composition model:**
|
|
15
|
+
* This extension runs AFTER the base `detectTessellationDrift` (soul-scope detector).
|
|
16
|
+
* It adds a variant-scoped Rule #1a: scan substrate files for variant-slug leakage,
|
|
17
|
+
* parallel to how the base detector scans for soul-slug leakage. The rationale is
|
|
18
|
+
* identical: variant IDs in shared substrate code are a drift signal — they indicate
|
|
19
|
+
* variant-specific logic has leaked into non-variant-scoped files, which complicates
|
|
20
|
+
* future variant removal and creates implicit coupling.
|
|
21
|
+
*
|
|
22
|
+
* @see spec/rfcs/RFC-0017-in-soul-variant-pattern.md §6.2 Behavioral changes
|
|
23
|
+
* @see orchestrator/src/tessellation-drift.ts — base RFC-0009 Phase 4.2 detector
|
|
24
|
+
* @see spec/rfcs/RFC-0035-decision-catalog-operator-routing.md G0
|
|
25
|
+
*/
|
|
26
|
+
// ── Internal helpers ──────────────────────────────────────────────────────────
|
|
27
|
+
function isValidSlug(slug) {
|
|
28
|
+
return /^[a-z0-9-]+$/.test(slug) && slug.length >= 1 && slug.length <= 64;
|
|
29
|
+
}
|
|
30
|
+
function escapeRegex(s) {
|
|
31
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Scan a single substrate file for variant-slug leakage.
|
|
35
|
+
*
|
|
36
|
+
* Detection strategy: textual regex scan (parallel to the base detector's
|
|
37
|
+
* Rule #1 soul-slug scan). Two patterns:
|
|
38
|
+
*
|
|
39
|
+
* 1. `'<variant-slug>'` or `"<variant-slug>"` — bare string literal.
|
|
40
|
+
* 2. `if (variant === '<variant-slug>')` etc. — variant-discriminating branch.
|
|
41
|
+
*/
|
|
42
|
+
function scanSubstrateFileForVariants(file, soulSlug, variantSlugs) {
|
|
43
|
+
const findings = [];
|
|
44
|
+
if (file.contents.length === 0 || variantSlugs.length === 0)
|
|
45
|
+
return findings;
|
|
46
|
+
const lines = file.contents.split('\n');
|
|
47
|
+
for (const variantSlug of variantSlugs) {
|
|
48
|
+
if (!isValidSlug(variantSlug))
|
|
49
|
+
continue;
|
|
50
|
+
const esc = escapeRegex(variantSlug);
|
|
51
|
+
// Pattern 1: bare string literal (single or double quote, exact match)
|
|
52
|
+
const literalRe = new RegExp(`(['"])${esc}\\1`);
|
|
53
|
+
// Pattern 2: variant-discriminating conditional
|
|
54
|
+
// Permissive on identifier name: variant, variantId, variant_id, etc.
|
|
55
|
+
const condRe = new RegExp(`(?:variant[A-Za-z_]*)\\s*===\\s*(['"])${esc}\\1`);
|
|
56
|
+
for (let i = 0; i < lines.length; i++) {
|
|
57
|
+
const line = lines[i];
|
|
58
|
+
const condMatch = line.match(condRe);
|
|
59
|
+
if (condMatch) {
|
|
60
|
+
findings.push({
|
|
61
|
+
filePath: file.path,
|
|
62
|
+
soulSlug,
|
|
63
|
+
variantSlug,
|
|
64
|
+
line: i + 1,
|
|
65
|
+
pattern: 'variant-conditional',
|
|
66
|
+
excerpt: line.trim().slice(0, 200),
|
|
67
|
+
});
|
|
68
|
+
continue; // don't double-report as a bare literal
|
|
69
|
+
}
|
|
70
|
+
if (literalRe.test(line)) {
|
|
71
|
+
findings.push({
|
|
72
|
+
filePath: file.path,
|
|
73
|
+
soulSlug,
|
|
74
|
+
variantSlug,
|
|
75
|
+
line: i + 1,
|
|
76
|
+
pattern: 'string-literal',
|
|
77
|
+
excerpt: line.trim().slice(0, 200),
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return findings;
|
|
83
|
+
}
|
|
84
|
+
// ── Public API ────────────────────────────────────────────────────────────────
|
|
85
|
+
/**
|
|
86
|
+
* Detect variant-scoped design intent drift in shared substrate files.
|
|
87
|
+
*
|
|
88
|
+
* Composes with `detectTessellationDrift` (RFC-0009 Phase 4.2) by adding a
|
|
89
|
+
* variant-scope parallel to its Rule #1 (soul-slug scan). Substrate code that
|
|
90
|
+
* mentions specific variant slugs is a drift signal — variant-specific logic
|
|
91
|
+
* should be isolated behind variant-aware routing, not hardcoded in shared code.
|
|
92
|
+
*
|
|
93
|
+
* Emits `Decision: variant-design-intent-drift` (catalog-routed, G0 non-blocking).
|
|
94
|
+
*
|
|
95
|
+
* When `config.enabled !== true` the detector short-circuits immediately and
|
|
96
|
+
* returns `{ events: [], optedOut: true }` — honoring the RFC-0009 §10
|
|
97
|
+
* "adopter opt-in initially" convention.
|
|
98
|
+
*
|
|
99
|
+
* @param input Detection inputs.
|
|
100
|
+
* @param config Detector configuration.
|
|
101
|
+
* @param emit Optional callback called once per emitted event. Errors propagate.
|
|
102
|
+
*/
|
|
103
|
+
export async function detectVariantDrift(input, config = {}, emit) {
|
|
104
|
+
// Master opt-out
|
|
105
|
+
if (config.enabled !== true) {
|
|
106
|
+
return { events: [], optedOut: true };
|
|
107
|
+
}
|
|
108
|
+
const catalogStage = config.catalogStage ?? 'A';
|
|
109
|
+
const now = new Date().toISOString();
|
|
110
|
+
const allFindings = [];
|
|
111
|
+
// Scan each soul's variants against the substrate files
|
|
112
|
+
if (input.substrateFiles && input.substrateFiles.length > 0) {
|
|
113
|
+
for (const [soulSlug, variants] of Object.entries(input.variantsBySoul)) {
|
|
114
|
+
if (!isValidSlug(soulSlug))
|
|
115
|
+
continue;
|
|
116
|
+
const variantSlugs = variants.map((v) => v.id).filter(isValidSlug);
|
|
117
|
+
if (variantSlugs.length === 0)
|
|
118
|
+
continue;
|
|
119
|
+
for (const file of input.substrateFiles) {
|
|
120
|
+
const findings = scanSubstrateFileForVariants(file, soulSlug, variantSlugs);
|
|
121
|
+
allFindings.push(...findings);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
const events = [];
|
|
126
|
+
if (allFindings.length > 0) {
|
|
127
|
+
// Aggregate involved souls and variants
|
|
128
|
+
const involvedSoulsSet = new Set(allFindings.map((f) => f.soulSlug));
|
|
129
|
+
const involvedVariants = {};
|
|
130
|
+
for (const finding of allFindings) {
|
|
131
|
+
if (!involvedVariants[finding.soulSlug]) {
|
|
132
|
+
involvedVariants[finding.soulSlug] = [];
|
|
133
|
+
}
|
|
134
|
+
if (!involvedVariants[finding.soulSlug].includes(finding.variantSlug)) {
|
|
135
|
+
involvedVariants[finding.soulSlug].push(finding.variantSlug);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// Sort for determinism
|
|
139
|
+
for (const soul of Object.keys(involvedVariants)) {
|
|
140
|
+
involvedVariants[soul].sort();
|
|
141
|
+
}
|
|
142
|
+
const totalVariants = Object.values(involvedVariants).flat().length;
|
|
143
|
+
const ev = {
|
|
144
|
+
type: 'VariantDesignIntentDriftDetected',
|
|
145
|
+
timestamp: now,
|
|
146
|
+
tessellatedDid: input.tessellatedDid,
|
|
147
|
+
involvedSouls: [...involvedSoulsSet].sort(),
|
|
148
|
+
involvedVariants,
|
|
149
|
+
severity: 'warning',
|
|
150
|
+
message: `Variant design intent drift: ${allFindings.length} variant-slug leakage hit(s) ` +
|
|
151
|
+
`across ${totalVariants} variant(s) in ${involvedSoulsSet.size} soul(s) detected ` +
|
|
152
|
+
`in shared substrate. Decision: variant-design-intent-drift (RFC-0035 Stage ${catalogStage}, non-blocking).`,
|
|
153
|
+
decisionKind: 'variant-design-intent-drift',
|
|
154
|
+
routing: { blocking: false, catalogStage },
|
|
155
|
+
details: { findings: allFindings },
|
|
156
|
+
};
|
|
157
|
+
events.push(ev);
|
|
158
|
+
if (emit) {
|
|
159
|
+
await emit(ev);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return { events, optedOut: false };
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=drift-extension.js.map
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RFC-0017 Phase 3 — OQ-7 Engineering review routing.
|
|
3
|
+
*
|
|
4
|
+
* Per OQ-7 resolution (2026-05-18):
|
|
5
|
+
*
|
|
6
|
+
* "Design owns + Engineering review routed through Decision Catalog.
|
|
7
|
+
* Engineering's review becomes a tracked `Decision: variant-substrate-cost-review`
|
|
8
|
+
* in the catalog. Substrate-cost block → `Decision: variant-substrate-cost-block`
|
|
9
|
+
* → Design/Engineering routing per RFC-0029 actor model."
|
|
10
|
+
*
|
|
11
|
+
* This module implements:
|
|
12
|
+
*
|
|
13
|
+
* 1. **Variant declaration trigger** — when a new variant is declared, emit
|
|
14
|
+
* `Decision: variant-substrate-cost-review` (catalog-routed, Engineering
|
|
15
|
+
* Authority reviewer, non-blocking per G0).
|
|
16
|
+
*
|
|
17
|
+
* 2. **Substrate-cost block** — when Engineering flags a substrate cost concern,
|
|
18
|
+
* emit `Decision: variant-substrate-cost-block` → routes to Design+Engineering
|
|
19
|
+
* via RFC-0029 actor model (operator resolves multi-pillar decision).
|
|
20
|
+
*
|
|
21
|
+
* 3. **Reviewer-subagent gate (AISDLC-298)** — given a set of PR-staged variant
|
|
22
|
+
* declarations and the Decision Catalog state, flag as `critical` any variant
|
|
23
|
+
* declaration that lacks a corresponding Engineering review Decision record.
|
|
24
|
+
* Composes with the AISDLC-298 code-reviewer / test-reviewer gate.
|
|
25
|
+
*
|
|
26
|
+
* All Decisions route through RFC-0035 G0 (non-blocking pipeline contract).
|
|
27
|
+
*
|
|
28
|
+
* @see spec/rfcs/RFC-0017-in-soul-variant-pattern.md OQ-7
|
|
29
|
+
* @see spec/rfcs/RFC-0035-decision-catalog-operator-routing.md G0 + §6.2
|
|
30
|
+
* @see spec/rfcs/RFC-0029-product-pillar-architectural-vision.md actor model
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* Decision summary keys for Engineering review routing (OQ-7 resolution).
|
|
34
|
+
*/
|
|
35
|
+
export type EngineeringReviewDecisionKind = 'variant-substrate-cost-review' | 'variant-substrate-cost-block';
|
|
36
|
+
/**
|
|
37
|
+
* Minimal representation of a variant declaration triggering Engineering review.
|
|
38
|
+
* Callers populate from the Soul DID's `spec.variants[]` entries being added
|
|
39
|
+
* or modified in a PR diff.
|
|
40
|
+
*/
|
|
41
|
+
export interface VariantDeclarationForReview {
|
|
42
|
+
/** Soul identifier (kebab-case). */
|
|
43
|
+
soulId: string;
|
|
44
|
+
/** Variant identifier (kebab-case). */
|
|
45
|
+
variantId: string;
|
|
46
|
+
/**
|
|
47
|
+
* Design overrides declared on this variant. Used by Engineering to assess
|
|
48
|
+
* substrate cost (e.g., new layout engine needed for a novel `densityProfile`).
|
|
49
|
+
*/
|
|
50
|
+
designOverrides?: {
|
|
51
|
+
colorPaletteOverlay?: string;
|
|
52
|
+
densityProfile?: string;
|
|
53
|
+
typographyScale?: string;
|
|
54
|
+
motionProfile?: string;
|
|
55
|
+
radiusProfile?: string;
|
|
56
|
+
[vendorPrefixedKey: string]: string | undefined;
|
|
57
|
+
};
|
|
58
|
+
/** Optional substrate cost assessment from Engineering (when provided). */
|
|
59
|
+
substrateCostAssessment?: {
|
|
60
|
+
/** True when Engineering flags a substrate cost concern. */
|
|
61
|
+
blocked: boolean;
|
|
62
|
+
/** Engineering's rationale for the block (required when blocked: true). */
|
|
63
|
+
rationale?: string;
|
|
64
|
+
/** Estimated additional substrate cost (free-form — e.g., "2 new layout engine variants"). */
|
|
65
|
+
estimatedCost?: string;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* RFC-0035 Decision Catalog routing metadata for Engineering review events.
|
|
70
|
+
* Always non-blocking per G0.
|
|
71
|
+
*/
|
|
72
|
+
export interface EngineeringReviewRouting {
|
|
73
|
+
/** Always false — G0 non-blocking contract. */
|
|
74
|
+
blocking: false;
|
|
75
|
+
/** RFC-0029 pillar assignment for this Decision. */
|
|
76
|
+
assignedPillar: 'engineering' | 'design-engineering-operator';
|
|
77
|
+
/** RFC-0035 actor routing rubric outcome. */
|
|
78
|
+
actorRationale: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Engineering review Decision event for a single variant declaration.
|
|
82
|
+
*/
|
|
83
|
+
export interface VariantSubstrateCostReviewEvent {
|
|
84
|
+
kind: 'variant-substrate-cost-review';
|
|
85
|
+
soulId: string;
|
|
86
|
+
variantId: string;
|
|
87
|
+
/** RFC-3339 UTC timestamp. */
|
|
88
|
+
timestamp: string;
|
|
89
|
+
routing: EngineeringReviewRouting;
|
|
90
|
+
message: string;
|
|
91
|
+
designOverrides?: VariantDeclarationForReview['designOverrides'];
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Substrate-cost block Decision event — routes to Design+Engineering operator.
|
|
95
|
+
*/
|
|
96
|
+
export interface VariantSubstrateCostBlockEvent {
|
|
97
|
+
kind: 'variant-substrate-cost-block';
|
|
98
|
+
soulId: string;
|
|
99
|
+
variantId: string;
|
|
100
|
+
timestamp: string;
|
|
101
|
+
routing: EngineeringReviewRouting;
|
|
102
|
+
/** Engineering's blocking rationale. */
|
|
103
|
+
rationale: string;
|
|
104
|
+
estimatedCost?: string;
|
|
105
|
+
message: string;
|
|
106
|
+
}
|
|
107
|
+
export type EngineeringReviewEvent = VariantSubstrateCostReviewEvent | VariantSubstrateCostBlockEvent;
|
|
108
|
+
/**
|
|
109
|
+
* Reviewer-subagent gate flag per AISDLC-298.
|
|
110
|
+
*
|
|
111
|
+
* When a PR contains variant declarations that lack a corresponding
|
|
112
|
+
* `variant-substrate-cost-review` Decision record in the catalog,
|
|
113
|
+
* the reviewer-subagent gate flags them as `critical`.
|
|
114
|
+
*/
|
|
115
|
+
export interface MissingEngineeringReviewFlag {
|
|
116
|
+
severity: 'critical';
|
|
117
|
+
soulId: string;
|
|
118
|
+
variantId: string;
|
|
119
|
+
message: string;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Input for the reviewer-subagent gate check (AC #7).
|
|
123
|
+
*/
|
|
124
|
+
export interface ReviewerGateCheckInput {
|
|
125
|
+
/** Variant declarations staged in the PR being reviewed. */
|
|
126
|
+
stagedVariants: Array<{
|
|
127
|
+
soulId: string;
|
|
128
|
+
variantId: string;
|
|
129
|
+
}>;
|
|
130
|
+
/**
|
|
131
|
+
* Decision Catalog summaries present for this workspace.
|
|
132
|
+
* Each entry is a (soulId, variantId) pair for which a
|
|
133
|
+
* `variant-substrate-cost-review` Decision exists.
|
|
134
|
+
*
|
|
135
|
+
* Callers populate this from the Decision Catalog event log
|
|
136
|
+
* projected state — specifically the set of `variant-substrate-cost-review`
|
|
137
|
+
* events whose lifecycle is `open` or `answered`.
|
|
138
|
+
*/
|
|
139
|
+
existingReviewDecisions: Array<{
|
|
140
|
+
soulId: string;
|
|
141
|
+
variantId: string;
|
|
142
|
+
}>;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Result of the reviewer-subagent gate check.
|
|
146
|
+
*/
|
|
147
|
+
export interface ReviewerGateCheckResult {
|
|
148
|
+
/** Flags for variant declarations missing Engineering review Decisions. */
|
|
149
|
+
flags: MissingEngineeringReviewFlag[];
|
|
150
|
+
/** True when at least one critical flag was emitted (reviewer blocks). */
|
|
151
|
+
hasCriticalFlags: boolean;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Emit Engineering review Decisions for a set of new/modified variant declarations.
|
|
155
|
+
*
|
|
156
|
+
* For each declaration:
|
|
157
|
+
* - Always emits `variant-substrate-cost-review` (non-blocking catalog log).
|
|
158
|
+
* - If `substrateCostAssessment.blocked === true`, additionally emits
|
|
159
|
+
* `variant-substrate-cost-block` (multi-pillar Design+Engineering routing).
|
|
160
|
+
*
|
|
161
|
+
* Per RFC-0035 G0: all emitted events have `blocking: false`. The pipeline
|
|
162
|
+
* continues regardless of Engineering's assessment — operator resolves via catalog.
|
|
163
|
+
*
|
|
164
|
+
* @param declarations - Variant declarations to trigger review for.
|
|
165
|
+
* @param now - Injectable wall-clock for tests.
|
|
166
|
+
* @param emitDecision - Optional callback for each emitted event. Errors propagate.
|
|
167
|
+
*/
|
|
168
|
+
export declare function triggerEngineeringReview(declarations: VariantDeclarationForReview[], now?: Date, emitDecision?: (event: EngineeringReviewEvent) => void): EngineeringReviewEvent[];
|
|
169
|
+
/**
|
|
170
|
+
* Check whether PR-staged variant declarations have corresponding Engineering
|
|
171
|
+
* review Decisions in the catalog (AISDLC-298 reviewer-subagent gate, AC #7).
|
|
172
|
+
*
|
|
173
|
+
* Returns a `critical` flag for every staged variant that lacks a
|
|
174
|
+
* `variant-substrate-cost-review` Decision record.
|
|
175
|
+
*
|
|
176
|
+
* **Composition with AISDLC-298:**
|
|
177
|
+
* The `code-reviewer` and `test-reviewer` subagents invoke this check for every
|
|
178
|
+
* PR diff containing variant declarations. A `hasCriticalFlags: true` result
|
|
179
|
+
* BLOCKS the reviewer from approving — variant declarations without Engineering
|
|
180
|
+
* review are treated as equivalent to "scope-creep candidate" per AISDLC-308.
|
|
181
|
+
*
|
|
182
|
+
* @param input - Staged variants + existing review Decisions from the catalog.
|
|
183
|
+
*/
|
|
184
|
+
export declare function checkReviewerGate(input: ReviewerGateCheckInput): ReviewerGateCheckResult;
|
|
185
|
+
//# sourceMappingURL=engineering-review.d.ts.map
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RFC-0017 Phase 3 — OQ-7 Engineering review routing.
|
|
3
|
+
*
|
|
4
|
+
* Per OQ-7 resolution (2026-05-18):
|
|
5
|
+
*
|
|
6
|
+
* "Design owns + Engineering review routed through Decision Catalog.
|
|
7
|
+
* Engineering's review becomes a tracked `Decision: variant-substrate-cost-review`
|
|
8
|
+
* in the catalog. Substrate-cost block → `Decision: variant-substrate-cost-block`
|
|
9
|
+
* → Design/Engineering routing per RFC-0029 actor model."
|
|
10
|
+
*
|
|
11
|
+
* This module implements:
|
|
12
|
+
*
|
|
13
|
+
* 1. **Variant declaration trigger** — when a new variant is declared, emit
|
|
14
|
+
* `Decision: variant-substrate-cost-review` (catalog-routed, Engineering
|
|
15
|
+
* Authority reviewer, non-blocking per G0).
|
|
16
|
+
*
|
|
17
|
+
* 2. **Substrate-cost block** — when Engineering flags a substrate cost concern,
|
|
18
|
+
* emit `Decision: variant-substrate-cost-block` → routes to Design+Engineering
|
|
19
|
+
* via RFC-0029 actor model (operator resolves multi-pillar decision).
|
|
20
|
+
*
|
|
21
|
+
* 3. **Reviewer-subagent gate (AISDLC-298)** — given a set of PR-staged variant
|
|
22
|
+
* declarations and the Decision Catalog state, flag as `critical` any variant
|
|
23
|
+
* declaration that lacks a corresponding Engineering review Decision record.
|
|
24
|
+
* Composes with the AISDLC-298 code-reviewer / test-reviewer gate.
|
|
25
|
+
*
|
|
26
|
+
* All Decisions route through RFC-0035 G0 (non-blocking pipeline contract).
|
|
27
|
+
*
|
|
28
|
+
* @see spec/rfcs/RFC-0017-in-soul-variant-pattern.md OQ-7
|
|
29
|
+
* @see spec/rfcs/RFC-0035-decision-catalog-operator-routing.md G0 + §6.2
|
|
30
|
+
* @see spec/rfcs/RFC-0029-product-pillar-architectural-vision.md actor model
|
|
31
|
+
*/
|
|
32
|
+
// ── Event factories ───────────────────────────────────────────────────────────
|
|
33
|
+
function makeCostReviewEvent(declaration, now) {
|
|
34
|
+
return {
|
|
35
|
+
kind: 'variant-substrate-cost-review',
|
|
36
|
+
soulId: declaration.soulId,
|
|
37
|
+
variantId: declaration.variantId,
|
|
38
|
+
timestamp: now,
|
|
39
|
+
routing: {
|
|
40
|
+
blocking: false,
|
|
41
|
+
assignedPillar: 'engineering',
|
|
42
|
+
actorRationale: 'OQ-7 resolution: Design owns variant declaration; Engineering reviews substrate cost ' +
|
|
43
|
+
'via Decision Catalog (single-pillar Engineering decision — RFC-0029 Principle 1 + ' +
|
|
44
|
+
'RFC-0035 §6.2 single-pillar → pillar owner routing).',
|
|
45
|
+
},
|
|
46
|
+
message: `Variant '${declaration.variantId}' on soul '${declaration.soulId}' declared. ` +
|
|
47
|
+
`Decision: variant-substrate-cost-review → Engineering Authority review via catalog ` +
|
|
48
|
+
`(RFC-0017 OQ-7; RFC-0035 G0 non-blocking).`,
|
|
49
|
+
designOverrides: declaration.designOverrides,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function makeCostBlockEvent(declaration, assessment, now) {
|
|
53
|
+
return {
|
|
54
|
+
kind: 'variant-substrate-cost-block',
|
|
55
|
+
soulId: declaration.soulId,
|
|
56
|
+
variantId: declaration.variantId,
|
|
57
|
+
timestamp: now,
|
|
58
|
+
routing: {
|
|
59
|
+
blocking: false,
|
|
60
|
+
assignedPillar: 'design-engineering-operator',
|
|
61
|
+
actorRationale: 'OQ-7 resolution: Substrate-cost block → multi-pillar decision (Design + Engineering). ' +
|
|
62
|
+
'RFC-0029 actor model: cross-pillar decisions route to operator. ' +
|
|
63
|
+
'RFC-0035 §6.2: multi-pillar → operator with escalation note.',
|
|
64
|
+
},
|
|
65
|
+
rationale: assessment.rationale ?? 'Engineering flagged substrate cost concern.',
|
|
66
|
+
estimatedCost: assessment.estimatedCost,
|
|
67
|
+
message: `Engineering substrate-cost block on variant '${declaration.variantId}' (soul '${declaration.soulId}'). ` +
|
|
68
|
+
`Decision: variant-substrate-cost-block → Design+Engineering routing per RFC-0029 actor model ` +
|
|
69
|
+
`(RFC-0035 G0 — pipeline continues; operator resolves multi-pillar decision).`,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
// ── Main trigger function ─────────────────────────────────────────────────────
|
|
73
|
+
/**
|
|
74
|
+
* Emit Engineering review Decisions for a set of new/modified variant declarations.
|
|
75
|
+
*
|
|
76
|
+
* For each declaration:
|
|
77
|
+
* - Always emits `variant-substrate-cost-review` (non-blocking catalog log).
|
|
78
|
+
* - If `substrateCostAssessment.blocked === true`, additionally emits
|
|
79
|
+
* `variant-substrate-cost-block` (multi-pillar Design+Engineering routing).
|
|
80
|
+
*
|
|
81
|
+
* Per RFC-0035 G0: all emitted events have `blocking: false`. The pipeline
|
|
82
|
+
* continues regardless of Engineering's assessment — operator resolves via catalog.
|
|
83
|
+
*
|
|
84
|
+
* @param declarations - Variant declarations to trigger review for.
|
|
85
|
+
* @param now - Injectable wall-clock for tests.
|
|
86
|
+
* @param emitDecision - Optional callback for each emitted event. Errors propagate.
|
|
87
|
+
*/
|
|
88
|
+
export function triggerEngineeringReview(declarations, now = new Date(), emitDecision) {
|
|
89
|
+
const nowStr = now.toISOString();
|
|
90
|
+
const events = [];
|
|
91
|
+
for (const declaration of declarations) {
|
|
92
|
+
// Always emit cost-review Decision (OQ-7 primary routing)
|
|
93
|
+
const reviewEvent = makeCostReviewEvent(declaration, nowStr);
|
|
94
|
+
events.push(reviewEvent);
|
|
95
|
+
if (emitDecision)
|
|
96
|
+
emitDecision(reviewEvent);
|
|
97
|
+
// Conditionally emit substrate-cost-block (OQ-7 block path)
|
|
98
|
+
const assessment = declaration.substrateCostAssessment;
|
|
99
|
+
if (assessment?.blocked === true) {
|
|
100
|
+
const blockEvent = makeCostBlockEvent(declaration, assessment, nowStr);
|
|
101
|
+
events.push(blockEvent);
|
|
102
|
+
if (emitDecision)
|
|
103
|
+
emitDecision(blockEvent);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return events;
|
|
107
|
+
}
|
|
108
|
+
// ── Reviewer-subagent gate (AISDLC-298 composition) ─────────────────────────
|
|
109
|
+
/**
|
|
110
|
+
* Check whether PR-staged variant declarations have corresponding Engineering
|
|
111
|
+
* review Decisions in the catalog (AISDLC-298 reviewer-subagent gate, AC #7).
|
|
112
|
+
*
|
|
113
|
+
* Returns a `critical` flag for every staged variant that lacks a
|
|
114
|
+
* `variant-substrate-cost-review` Decision record.
|
|
115
|
+
*
|
|
116
|
+
* **Composition with AISDLC-298:**
|
|
117
|
+
* The `code-reviewer` and `test-reviewer` subagents invoke this check for every
|
|
118
|
+
* PR diff containing variant declarations. A `hasCriticalFlags: true` result
|
|
119
|
+
* BLOCKS the reviewer from approving — variant declarations without Engineering
|
|
120
|
+
* review are treated as equivalent to "scope-creep candidate" per AISDLC-308.
|
|
121
|
+
*
|
|
122
|
+
* @param input - Staged variants + existing review Decisions from the catalog.
|
|
123
|
+
*/
|
|
124
|
+
export function checkReviewerGate(input) {
|
|
125
|
+
const flags = [];
|
|
126
|
+
for (const staged of input.stagedVariants) {
|
|
127
|
+
const hasReview = input.existingReviewDecisions.some((d) => d.soulId === staged.soulId && d.variantId === staged.variantId);
|
|
128
|
+
if (!hasReview) {
|
|
129
|
+
flags.push({
|
|
130
|
+
severity: 'critical',
|
|
131
|
+
soulId: staged.soulId,
|
|
132
|
+
variantId: staged.variantId,
|
|
133
|
+
message: `Variant '${staged.variantId}' on soul '${staged.soulId}' was declared in this PR ` +
|
|
134
|
+
`without a corresponding 'variant-substrate-cost-review' Decision in the catalog. ` +
|
|
135
|
+
`Per RFC-0017 OQ-7 + AISDLC-298: Engineering review via Decision Catalog is required ` +
|
|
136
|
+
`for all variant declarations. File the Decision before merging.`,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return { flags, hasCriticalFlags: flags.length > 0 };
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=engineering-review.js.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RFC-0017 In-Soul Variant Pattern — module barrel.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports the public surfaces for all five phases:
|
|
5
|
+
*
|
|
6
|
+
* Phase 1 (AISDLC-435):
|
|
7
|
+
* - Variant inheritance validator + event types
|
|
8
|
+
*
|
|
9
|
+
* Phase 3 (AISDLC-436):
|
|
10
|
+
* - Deprecation lifecycle engine (OQ-3)
|
|
11
|
+
* - Eτ_tessellation_drift variant-scoped extension (AC #4)
|
|
12
|
+
* - Engineering review routing (OQ-7, AC #5, #6, #7)
|
|
13
|
+
*
|
|
14
|
+
* Phase 4 (AISDLC-437):
|
|
15
|
+
* - InternalAdopter three-product reference impl
|
|
16
|
+
*
|
|
17
|
+
* Phase 5 (AISDLC-438):
|
|
18
|
+
* - OQ-8 cardinality activation Decision wiring
|
|
19
|
+
*/
|
|
20
|
+
export { INHERITED_LOCKED_FIELDS, DEFAULT_SOFT_WARN_AT, DEFAULT_HARD_LIMIT, validateVariantDeclarations, hasBlockingViolations, } from './inheritance-validator.js';
|
|
21
|
+
export type { InheritedLockedField, VariantEventKind, VariantInheritanceViolation, VariantCountSoftWarning, VariantCountHardLimitExceeded, NestedVariantRejected, VariantEvent, VariantDeclarationInput, VariantLimitsConfig, ValidateVariantDeclarationsOptions, } from './inheritance-validator.js';
|
|
22
|
+
export { DEFAULT_DEPRECATION_WINDOW_DAYS, DEFAULT_APPROACHING_WINDOW_DAYS, resolveDeprecationState, evaluateDeprecationLifecycle, } from './deprecation-lifecycle.js';
|
|
23
|
+
export type { VariantDeprecationState, VariantDeprecationDecisionKind, VariantLifecycleConfig, DeprecatedVariantDeclaration, VariantDeprecationEvent, VariantMigrationTask, VariantDeprecationResult, } from './deprecation-lifecycle.js';
|
|
24
|
+
export { detectVariantDrift } from './drift-extension.js';
|
|
25
|
+
export type { VariantDriftFinding, VariantDesignIntentDriftEvent, VariantDriftExtensionConfig, VariantDriftExtensionInput, VariantDriftExtensionResult, } from './drift-extension.js';
|
|
26
|
+
export { triggerEngineeringReview, checkReviewerGate } from './engineering-review.js';
|
|
27
|
+
export type { EngineeringReviewDecisionKind, VariantDeclarationForReview, EngineeringReviewRouting, VariantSubstrateCostReviewEvent, VariantSubstrateCostBlockEvent, EngineeringReviewEvent, MissingEngineeringReviewFlag, ReviewerGateCheckInput, ReviewerGateCheckResult, } from './engineering-review.js';
|
|
28
|
+
export { trackCardinalityActivationRequest, shouldPromoteToOperatorReview, DEFAULT_CARDINALITY_ACTIVATION_THRESHOLD, } from './cardinality-activation.js';
|
|
29
|
+
export type { CardinalityActivationRequest, CardinalityActivationResult, } from './cardinality-activation.js';
|
|
30
|
+
export { INTERNAL_ADOPTER_SUBSTRATE, INTERNAL_ADOPTER_PRODUCTS, productA, productB, productC, buildVariantsBySoul, buildVariantScores, computeSoulAggregateBaseline, } from './internal-adopter/index.js';
|
|
31
|
+
export type { InternalAdopterSubstrate, InternalAdopterProduct } from './internal-adopter/index.js';
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RFC-0017 In-Soul Variant Pattern — module barrel.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports the public surfaces for all five phases:
|
|
5
|
+
*
|
|
6
|
+
* Phase 1 (AISDLC-435):
|
|
7
|
+
* - Variant inheritance validator + event types
|
|
8
|
+
*
|
|
9
|
+
* Phase 3 (AISDLC-436):
|
|
10
|
+
* - Deprecation lifecycle engine (OQ-3)
|
|
11
|
+
* - Eτ_tessellation_drift variant-scoped extension (AC #4)
|
|
12
|
+
* - Engineering review routing (OQ-7, AC #5, #6, #7)
|
|
13
|
+
*
|
|
14
|
+
* Phase 4 (AISDLC-437):
|
|
15
|
+
* - InternalAdopter three-product reference impl
|
|
16
|
+
*
|
|
17
|
+
* Phase 5 (AISDLC-438):
|
|
18
|
+
* - OQ-8 cardinality activation Decision wiring
|
|
19
|
+
*/
|
|
20
|
+
// Phase 1 — Inheritance validator
|
|
21
|
+
export { INHERITED_LOCKED_FIELDS, DEFAULT_SOFT_WARN_AT, DEFAULT_HARD_LIMIT, validateVariantDeclarations, hasBlockingViolations, } from './inheritance-validator.js';
|
|
22
|
+
// Phase 3 — Deprecation lifecycle (OQ-3)
|
|
23
|
+
export { DEFAULT_DEPRECATION_WINDOW_DAYS, DEFAULT_APPROACHING_WINDOW_DAYS, resolveDeprecationState, evaluateDeprecationLifecycle, } from './deprecation-lifecycle.js';
|
|
24
|
+
// Phase 3 — Eτ_tessellation_drift variant-scoped extension (AC #4)
|
|
25
|
+
export { detectVariantDrift } from './drift-extension.js';
|
|
26
|
+
// Phase 3 — Engineering review routing (OQ-7, AC #5-#7)
|
|
27
|
+
export { triggerEngineeringReview, checkReviewerGate } from './engineering-review.js';
|
|
28
|
+
// Phase 5 — OQ-8 cardinality activation Decision wiring (AISDLC-438)
|
|
29
|
+
export { trackCardinalityActivationRequest, shouldPromoteToOperatorReview, DEFAULT_CARDINALITY_ACTIVATION_THRESHOLD, } from './cardinality-activation.js';
|
|
30
|
+
// Phase 4 — InternalAdopter three-product reference impl (AISDLC-437)
|
|
31
|
+
export { INTERNAL_ADOPTER_SUBSTRATE, INTERNAL_ADOPTER_PRODUCTS, productA, productB, productC, buildVariantsBySoul, buildVariantScores, computeSoulAggregateBaseline, } from './internal-adopter/index.js';
|
|
32
|
+
//# sourceMappingURL=index.js.map
|