@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,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RFC-0017 Phase 1 — Variant Inheritance Validator.
|
|
3
|
+
*
|
|
4
|
+
* Implements RFC-0017 §5.3 bounded-inheritance enforcement. A variant MUST NOT
|
|
5
|
+
* attempt to override fields that are inherited from (and locked to) the parent
|
|
6
|
+
* Soul DID. When a violation is detected the validator emits a
|
|
7
|
+
* `VariantInheritanceViolation` event (RFC-0008 §C5 Engineering vertex error).
|
|
8
|
+
*
|
|
9
|
+
* Additionally implements the OQ-1 variant count constraints:
|
|
10
|
+
* - Soft warn (non-blocking) at `softWarnAt` variants (default 5).
|
|
11
|
+
* - Hard reject at `hardLimit` variants (default 20).
|
|
12
|
+
*
|
|
13
|
+
* And the OQ-2 nested-variants rejection: schema-enforced flat means a variant
|
|
14
|
+
* declaration MUST NOT contain a nested `variants[]` field.
|
|
15
|
+
*
|
|
16
|
+
* @see spec/rfcs/RFC-0017-in-soul-variant-pattern.md §5.3 + §10.1
|
|
17
|
+
* @see orchestrator/src/variant-admission.ts — Phase 2 admission composite
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Fields that are INHERITED from the parent Soul DID and cannot be overridden
|
|
21
|
+
* by any variant declaration. Attempting to declare these fields on a variant
|
|
22
|
+
* triggers a `VariantInheritanceViolation`.
|
|
23
|
+
*
|
|
24
|
+
* Corresponds to the left column of the §5.3 inheritance table.
|
|
25
|
+
*/
|
|
26
|
+
export declare const INHERITED_LOCKED_FIELDS: readonly ["complianceRegimes", "substrateInvariants", "tenantQuotaShare", "performanceBudgets", "observabilityRequirements"];
|
|
27
|
+
export type InheritedLockedField = (typeof INHERITED_LOCKED_FIELDS)[number];
|
|
28
|
+
/**
|
|
29
|
+
* Discriminated event kind for variant-level events emitted to events.jsonl.
|
|
30
|
+
*/
|
|
31
|
+
export type VariantEventKind = 'VariantInheritanceViolation' | 'VariantCountSoftWarning' | 'VariantCountHardLimitExceeded' | 'NestedVariantRejected';
|
|
32
|
+
/**
|
|
33
|
+
* Emitted when a variant attempts to override an inherited locked field per
|
|
34
|
+
* RFC-0017 §5.3. This is an Engineering vertex error (RFC-0008 §C5).
|
|
35
|
+
*
|
|
36
|
+
* The result is `blocking: true` — the declaring Soul DID is invalid until
|
|
37
|
+
* the offending override is removed.
|
|
38
|
+
*/
|
|
39
|
+
export interface VariantInheritanceViolation {
|
|
40
|
+
readonly kind: 'VariantInheritanceViolation';
|
|
41
|
+
/** Identifier of the Soul DID that contains the offending variant. */
|
|
42
|
+
readonly soulId: string;
|
|
43
|
+
/** The variant's `id` field value. */
|
|
44
|
+
readonly variantId: string;
|
|
45
|
+
/** The field name the variant attempted to override. */
|
|
46
|
+
readonly field: InheritedLockedField;
|
|
47
|
+
/** Human-readable description of the violation. */
|
|
48
|
+
readonly message: string;
|
|
49
|
+
/** Always true — inheritance violations are blocking errors. */
|
|
50
|
+
readonly blocking: true;
|
|
51
|
+
readonly timestamp: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Non-blocking warning emitted when a Soul DID's variant count reaches the
|
|
55
|
+
* soft-warn threshold (default 5 per OQ-1). Routes through Decision Catalog
|
|
56
|
+
* as `Decision: variant-count-soft-warning` for operator batch review.
|
|
57
|
+
*/
|
|
58
|
+
export interface VariantCountSoftWarning {
|
|
59
|
+
readonly kind: 'VariantCountSoftWarning';
|
|
60
|
+
readonly soulId: string;
|
|
61
|
+
readonly variantCount: number;
|
|
62
|
+
readonly threshold: number;
|
|
63
|
+
readonly message: string;
|
|
64
|
+
readonly blocking: false;
|
|
65
|
+
readonly timestamp: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Hard-blocking rejection emitted when a Soul DID's variant count reaches the
|
|
69
|
+
* hard limit (default 20 per OQ-1). The Soul DID declaration is rejected.
|
|
70
|
+
* Routes through Decision Catalog as `Decision: variant-count-hard-limit-exceeded`
|
|
71
|
+
* plus a clarification task recommending multi-soul re-architecture.
|
|
72
|
+
*/
|
|
73
|
+
export interface VariantCountHardLimitExceeded {
|
|
74
|
+
readonly kind: 'VariantCountHardLimitExceeded';
|
|
75
|
+
readonly soulId: string;
|
|
76
|
+
readonly variantCount: number;
|
|
77
|
+
readonly limit: number;
|
|
78
|
+
readonly message: string;
|
|
79
|
+
readonly blocking: true;
|
|
80
|
+
readonly timestamp: string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Emitted when a nested `variants[]` field is detected inside a variant
|
|
84
|
+
* declaration. Schema-enforced flat per RFC-0017 OQ-2. Blocking.
|
|
85
|
+
*/
|
|
86
|
+
export interface NestedVariantRejected {
|
|
87
|
+
readonly kind: 'NestedVariantRejected';
|
|
88
|
+
readonly soulId: string;
|
|
89
|
+
readonly variantId: string;
|
|
90
|
+
readonly message: string;
|
|
91
|
+
readonly blocking: true;
|
|
92
|
+
readonly timestamp: string;
|
|
93
|
+
}
|
|
94
|
+
export type VariantEvent = VariantInheritanceViolation | VariantCountSoftWarning | VariantCountHardLimitExceeded | NestedVariantRejected;
|
|
95
|
+
/**
|
|
96
|
+
* Minimal representation of one variant declaration as loaded from a Soul DID.
|
|
97
|
+
* Mirrors the JSON Schema shape at `spec/schemas/design-intent-document.schema.json`
|
|
98
|
+
* `$defs.variantDeclaration`.
|
|
99
|
+
*/
|
|
100
|
+
export interface VariantDeclarationInput {
|
|
101
|
+
/** Kebab-case variant id. */
|
|
102
|
+
id: string;
|
|
103
|
+
/**
|
|
104
|
+
* Any additional fields present in the raw declaration — used to detect
|
|
105
|
+
* attempts to override locked inherited fields.
|
|
106
|
+
*/
|
|
107
|
+
[key: string]: unknown;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Per-org variant count configuration. Loaded from
|
|
111
|
+
* `.ai-sdlc/variant-config.yaml` (`variant.limits`) with the defaults below.
|
|
112
|
+
*/
|
|
113
|
+
export interface VariantLimitsConfig {
|
|
114
|
+
/** Non-blocking soft warn threshold. Default: 5. */
|
|
115
|
+
softWarnAt?: number;
|
|
116
|
+
/** Hard-blocking rejection limit. Default: 20. */
|
|
117
|
+
hardLimit?: number;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Options for `validateVariantDeclarations`.
|
|
121
|
+
*/
|
|
122
|
+
export interface ValidateVariantDeclarationsOptions {
|
|
123
|
+
/** Identifier of the Soul DID being validated (for event attribution). */
|
|
124
|
+
soulId: string;
|
|
125
|
+
/** Raw variant declarations from the Soul DID's `spec.variants[]`. */
|
|
126
|
+
variants: VariantDeclarationInput[];
|
|
127
|
+
/** Per-org or per-Soul limit overrides. Defaults apply when absent. */
|
|
128
|
+
limits?: VariantLimitsConfig;
|
|
129
|
+
/** ISO 8601 timestamp to stamp on emitted events. Defaults to now. */
|
|
130
|
+
now?: string;
|
|
131
|
+
}
|
|
132
|
+
/** OQ-1 default: soft warn at 5 variants (Miller 7±2 cognitive-load threshold). */
|
|
133
|
+
export declare const DEFAULT_SOFT_WARN_AT = 5;
|
|
134
|
+
/** OQ-1 default: hard limit at 20 variants (re-architect-as-multi-soul threshold). */
|
|
135
|
+
export declare const DEFAULT_HARD_LIMIT = 20;
|
|
136
|
+
/**
|
|
137
|
+
* Validate a Soul DID's `variants[]` declarations against RFC-0017 §5.3 rules.
|
|
138
|
+
*
|
|
139
|
+
* Returns all emitted events. Callers check `event.blocking` to determine
|
|
140
|
+
* whether the Soul DID should be rejected. Caller's responsibility to write
|
|
141
|
+
* events to events.jsonl via the artifact layer.
|
|
142
|
+
*
|
|
143
|
+
* Validation rules (in order):
|
|
144
|
+
*
|
|
145
|
+
* 1. **Hard-limit check (OQ-1)** — if `variants.length >= hardLimit`, emit
|
|
146
|
+
* `VariantCountHardLimitExceeded` (blocking). Continue to check individual
|
|
147
|
+
* variants for completeness of the error report.
|
|
148
|
+
*
|
|
149
|
+
* 2. **Soft-warn check (OQ-1)** — if `variants.length >= softWarnAt` AND
|
|
150
|
+
* below hard limit, emit `VariantCountSoftWarning` (non-blocking).
|
|
151
|
+
*
|
|
152
|
+
* 3. **Per-variant inheritance check (§5.3)** — for each variant, verify it
|
|
153
|
+
* does not declare any field from `INHERITED_LOCKED_FIELDS`. Each violation
|
|
154
|
+
* emits `VariantInheritanceViolation` (blocking).
|
|
155
|
+
*
|
|
156
|
+
* 4. **Nested-variants rejection (OQ-2)** — for each variant, verify it does
|
|
157
|
+
* not contain a `variants` key. Emits `NestedVariantRejected` (blocking).
|
|
158
|
+
*/
|
|
159
|
+
export declare function validateVariantDeclarations(options: ValidateVariantDeclarationsOptions): VariantEvent[];
|
|
160
|
+
/**
|
|
161
|
+
* Convenience predicate: returns true when any event in the list is blocking.
|
|
162
|
+
* Use to decide whether to reject the Soul DID declaration.
|
|
163
|
+
*/
|
|
164
|
+
export declare function hasBlockingViolations(events: VariantEvent[]): boolean;
|
|
165
|
+
//# sourceMappingURL=inheritance-validator.d.ts.map
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RFC-0017 Phase 1 — Variant Inheritance Validator.
|
|
3
|
+
*
|
|
4
|
+
* Implements RFC-0017 §5.3 bounded-inheritance enforcement. A variant MUST NOT
|
|
5
|
+
* attempt to override fields that are inherited from (and locked to) the parent
|
|
6
|
+
* Soul DID. When a violation is detected the validator emits a
|
|
7
|
+
* `VariantInheritanceViolation` event (RFC-0008 §C5 Engineering vertex error).
|
|
8
|
+
*
|
|
9
|
+
* Additionally implements the OQ-1 variant count constraints:
|
|
10
|
+
* - Soft warn (non-blocking) at `softWarnAt` variants (default 5).
|
|
11
|
+
* - Hard reject at `hardLimit` variants (default 20).
|
|
12
|
+
*
|
|
13
|
+
* And the OQ-2 nested-variants rejection: schema-enforced flat means a variant
|
|
14
|
+
* declaration MUST NOT contain a nested `variants[]` field.
|
|
15
|
+
*
|
|
16
|
+
* @see spec/rfcs/RFC-0017-in-soul-variant-pattern.md §5.3 + §10.1
|
|
17
|
+
* @see orchestrator/src/variant-admission.ts — Phase 2 admission composite
|
|
18
|
+
*/
|
|
19
|
+
// ── Inherited (locked) field names per RFC-0017 §5.3 ────────────────────────
|
|
20
|
+
/**
|
|
21
|
+
* Fields that are INHERITED from the parent Soul DID and cannot be overridden
|
|
22
|
+
* by any variant declaration. Attempting to declare these fields on a variant
|
|
23
|
+
* triggers a `VariantInheritanceViolation`.
|
|
24
|
+
*
|
|
25
|
+
* Corresponds to the left column of the §5.3 inheritance table.
|
|
26
|
+
*/
|
|
27
|
+
export const INHERITED_LOCKED_FIELDS = [
|
|
28
|
+
'complianceRegimes',
|
|
29
|
+
'substrateInvariants',
|
|
30
|
+
'tenantQuotaShare',
|
|
31
|
+
'performanceBudgets',
|
|
32
|
+
'observabilityRequirements',
|
|
33
|
+
];
|
|
34
|
+
// ── Default constants ────────────────────────────────────────────────────────
|
|
35
|
+
/** OQ-1 default: soft warn at 5 variants (Miller 7±2 cognitive-load threshold). */
|
|
36
|
+
export const DEFAULT_SOFT_WARN_AT = 5;
|
|
37
|
+
/** OQ-1 default: hard limit at 20 variants (re-architect-as-multi-soul threshold). */
|
|
38
|
+
export const DEFAULT_HARD_LIMIT = 20;
|
|
39
|
+
// ── Validator ────────────────────────────────────────────────────────────────
|
|
40
|
+
/**
|
|
41
|
+
* Validate a Soul DID's `variants[]` declarations against RFC-0017 §5.3 rules.
|
|
42
|
+
*
|
|
43
|
+
* Returns all emitted events. Callers check `event.blocking` to determine
|
|
44
|
+
* whether the Soul DID should be rejected. Caller's responsibility to write
|
|
45
|
+
* events to events.jsonl via the artifact layer.
|
|
46
|
+
*
|
|
47
|
+
* Validation rules (in order):
|
|
48
|
+
*
|
|
49
|
+
* 1. **Hard-limit check (OQ-1)** — if `variants.length >= hardLimit`, emit
|
|
50
|
+
* `VariantCountHardLimitExceeded` (blocking). Continue to check individual
|
|
51
|
+
* variants for completeness of the error report.
|
|
52
|
+
*
|
|
53
|
+
* 2. **Soft-warn check (OQ-1)** — if `variants.length >= softWarnAt` AND
|
|
54
|
+
* below hard limit, emit `VariantCountSoftWarning` (non-blocking).
|
|
55
|
+
*
|
|
56
|
+
* 3. **Per-variant inheritance check (§5.3)** — for each variant, verify it
|
|
57
|
+
* does not declare any field from `INHERITED_LOCKED_FIELDS`. Each violation
|
|
58
|
+
* emits `VariantInheritanceViolation` (blocking).
|
|
59
|
+
*
|
|
60
|
+
* 4. **Nested-variants rejection (OQ-2)** — for each variant, verify it does
|
|
61
|
+
* not contain a `variants` key. Emits `NestedVariantRejected` (blocking).
|
|
62
|
+
*/
|
|
63
|
+
export function validateVariantDeclarations(options) {
|
|
64
|
+
const { soulId, variants, limits, now } = options;
|
|
65
|
+
const timestamp = now ?? new Date().toISOString();
|
|
66
|
+
const softWarnAt = limits?.softWarnAt ?? DEFAULT_SOFT_WARN_AT;
|
|
67
|
+
const hardLimit = limits?.hardLimit ?? DEFAULT_HARD_LIMIT;
|
|
68
|
+
const events = [];
|
|
69
|
+
const count = variants.length;
|
|
70
|
+
// Rule 1 — Hard limit (OQ-1)
|
|
71
|
+
if (count >= hardLimit) {
|
|
72
|
+
events.push({
|
|
73
|
+
kind: 'VariantCountHardLimitExceeded',
|
|
74
|
+
soulId,
|
|
75
|
+
variantCount: count,
|
|
76
|
+
limit: hardLimit,
|
|
77
|
+
message: `Soul '${soulId}' declares ${count} variant(s), reaching or exceeding the hard limit of ` +
|
|
78
|
+
`${hardLimit}. Declaration rejected. Consider re-architecting as multiple Soul DIDs ` +
|
|
79
|
+
`(RFC-0017 §5.5 boundary guidance). Decision: variant-count-hard-limit-exceeded.`,
|
|
80
|
+
blocking: true,
|
|
81
|
+
timestamp,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
else if (count >= softWarnAt) {
|
|
85
|
+
// Rule 2 — Soft warn (OQ-1, non-blocking)
|
|
86
|
+
events.push({
|
|
87
|
+
kind: 'VariantCountSoftWarning',
|
|
88
|
+
soulId,
|
|
89
|
+
variantCount: count,
|
|
90
|
+
threshold: softWarnAt,
|
|
91
|
+
message: `Soul '${soulId}' declares ${count} variant(s), at or above the soft-warn threshold of ` +
|
|
92
|
+
`${softWarnAt}. Non-blocking review recommended. Decision: variant-count-soft-warning.`,
|
|
93
|
+
blocking: false,
|
|
94
|
+
timestamp,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
// Rules 3 + 4 — Per-variant checks
|
|
98
|
+
for (const variant of variants) {
|
|
99
|
+
const variantId = String(variant.id ?? '<unknown>');
|
|
100
|
+
// Rule 3 — Inheritance violation check (§5.3)
|
|
101
|
+
for (const field of INHERITED_LOCKED_FIELDS) {
|
|
102
|
+
if (Object.prototype.hasOwnProperty.call(variant, field)) {
|
|
103
|
+
events.push({
|
|
104
|
+
kind: 'VariantInheritanceViolation',
|
|
105
|
+
soulId,
|
|
106
|
+
variantId,
|
|
107
|
+
field,
|
|
108
|
+
message: `Variant '${variantId}' on soul '${soulId}' attempts to override '${field}', ` +
|
|
109
|
+
`which is inherited-and-locked from the parent Soul DID (RFC-0017 §5.3 bounded ` +
|
|
110
|
+
`inheritance table). Remove '${field}' from the variant declaration.`,
|
|
111
|
+
blocking: true,
|
|
112
|
+
timestamp,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
// Rule 4 — Nested variants rejection (OQ-2)
|
|
117
|
+
if (Object.prototype.hasOwnProperty.call(variant, 'variants')) {
|
|
118
|
+
events.push({
|
|
119
|
+
kind: 'NestedVariantRejected',
|
|
120
|
+
soulId,
|
|
121
|
+
variantId,
|
|
122
|
+
message: `Variant '${variantId}' on soul '${soulId}' declares a nested 'variants[]' field. ` +
|
|
123
|
+
`RFC-0017 OQ-2 resolution mandates schema-enforced flat: variants cannot contain ` +
|
|
124
|
+
`sub-variants in v1. Remove the nested 'variants' field.`,
|
|
125
|
+
blocking: true,
|
|
126
|
+
timestamp,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return events;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Convenience predicate: returns true when any event in the list is blocking.
|
|
134
|
+
* Use to decide whether to reject the Soul DID declaration.
|
|
135
|
+
*/
|
|
136
|
+
export function hasBlockingViolations(events) {
|
|
137
|
+
return events.some((e) => e.blocking);
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=inheritance-validator.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RFC-0017 Phase 4 — InternalAdopter three-product reference impl barrel.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports the canonical product fixtures + helpers. ProductD is
|
|
5
|
+
* intentionally absent — deferred to RFC-0018 per RFC-0017 §11 v0.4.
|
|
6
|
+
*
|
|
7
|
+
* @see ./products.ts
|
|
8
|
+
*/
|
|
9
|
+
export { INTERNAL_ADOPTER_SUBSTRATE, INTERNAL_ADOPTER_PRODUCTS, productA, productB, productC, buildVariantsBySoul, buildVariantScores, computeSoulAggregateBaseline, } from './products.js';
|
|
10
|
+
export type { InternalAdopterSubstrate, InternalAdopterProduct } from './products.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RFC-0017 Phase 4 — InternalAdopter three-product reference impl barrel.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports the canonical product fixtures + helpers. ProductD is
|
|
5
|
+
* intentionally absent — deferred to RFC-0018 per RFC-0017 §11 v0.4.
|
|
6
|
+
*
|
|
7
|
+
* @see ./products.ts
|
|
8
|
+
*/
|
|
9
|
+
export { INTERNAL_ADOPTER_SUBSTRATE, INTERNAL_ADOPTER_PRODUCTS, productA, productB, productC, buildVariantsBySoul, buildVariantScores, computeSoulAggregateBaseline, } from './products.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RFC-0017 Phase 4 — InternalAdopter three-product reference implementation
|
|
3
|
+
* (AISDLC-437).
|
|
4
|
+
*
|
|
5
|
+
* Ships ProductA / ProductB / ProductC as canonical fixtures that demonstrate
|
|
6
|
+
* the In-Soul Variant Pattern against real-world adopter constraints. Each
|
|
7
|
+
* product is a distinct Soul on shared substrate; each declares three variants
|
|
8
|
+
* with audience-segment / form-factor / role-based specialization.
|
|
9
|
+
*
|
|
10
|
+
* **ProductD is INTENTIONALLY OMITTED** — per RFC-0017 §11 v0.4 (2026-05-26
|
|
11
|
+
* Design Authority editorial pass), ProductD's proposed variants
|
|
12
|
+
* (`annual-test`, `repair-event`, `regulatory-audit-mode`) are temporal-context-
|
|
13
|
+
* bound operational modes activated by *when* and *why* a user is in the
|
|
14
|
+
* system. Same user, different operational moment = Journey shape (RFC-0018),
|
|
15
|
+
* not Variant shape. ProductD's validation is deferred to RFC-0018 §11 as a
|
|
16
|
+
* Variant/Journey boundary validation case for the companion RFC.
|
|
17
|
+
*
|
|
18
|
+
* Variant constraints validated by `products.test.ts`:
|
|
19
|
+
* - Every variant has ≤ 5 `designImperatives` strings (closed-enum discipline)
|
|
20
|
+
* - Every variant's `designOverrides` uses only framework-owned enum fields
|
|
21
|
+
* (`colorPaletteOverlay`, `densityProfile`, `typographyScale`,
|
|
22
|
+
* `motionProfile`, `radiusProfile` per §6.1 OQ-5 2026-05-26 revisit)
|
|
23
|
+
* - All variants of a given product share the same compliance + substrate
|
|
24
|
+
* (substrate-shared check, AC #7)
|
|
25
|
+
* - All variants pass `validateVariantDeclarations()` (no inheritance
|
|
26
|
+
* violations, no nested variants, under the soft-warn / hard-limit caps)
|
|
27
|
+
*
|
|
28
|
+
* @see spec/rfcs/RFC-0017-in-soul-variant-pattern.md §11 (practitioner validation)
|
|
29
|
+
* @see ./products.test.ts — substrate-shared + closed-enum + inheritance checks
|
|
30
|
+
* @see ./admission-spotcheck.test.ts — variant-routed vs soul-aggregate scoring
|
|
31
|
+
* @see ./deprecation-lifecycle.test.ts — end-to-end lifecycle on ProductA variant
|
|
32
|
+
*/
|
|
33
|
+
import type { VariantOverlay, VariantScores } from '../../variant-admission.js';
|
|
34
|
+
/**
|
|
35
|
+
* The shared substrate every InternalAdopter product Soul inherits.
|
|
36
|
+
*
|
|
37
|
+
* Per RFC-0017 §5.3 bounded-inheritance table: substrate fields are
|
|
38
|
+
* INHERITED-AND-LOCKED — variants cannot override these. Capturing them here
|
|
39
|
+
* in a single shared constant proves AC #7 (substrate shared across variants
|
|
40
|
+
* of every product) at the type/declaration level rather than via runtime
|
|
41
|
+
* spot-check alone.
|
|
42
|
+
*
|
|
43
|
+
* `complianceRegimes: ['WCAG-2.1-AA']` is the field-tech-deployed baseline
|
|
44
|
+
* documented in RFC-0017 §1: "all sharing the soul's WCAG 2.1 AA compliance
|
|
45
|
+
* floor and shared design system tokens."
|
|
46
|
+
*/
|
|
47
|
+
export interface InternalAdopterSubstrate {
|
|
48
|
+
/** Compliance regimes inherited by every variant on every product. */
|
|
49
|
+
readonly complianceRegimes: readonly string[];
|
|
50
|
+
/**
|
|
51
|
+
* Substrate invariants — event bus, schema, tenant model. Captured as an
|
|
52
|
+
* opaque string identifier here; the reconciler is what proves substrate
|
|
53
|
+
* sharing at runtime (per RFC-0017 §5.3 footnote).
|
|
54
|
+
*/
|
|
55
|
+
readonly substrateInvariants: {
|
|
56
|
+
readonly eventBus: string;
|
|
57
|
+
readonly schemaRegistry: string;
|
|
58
|
+
readonly tenantModel: string;
|
|
59
|
+
};
|
|
60
|
+
/** Engineering performance budgets shared across all variants. */
|
|
61
|
+
readonly performanceBudgets: {
|
|
62
|
+
readonly initialLoadMs: number;
|
|
63
|
+
readonly interactionResponseMs: number;
|
|
64
|
+
};
|
|
65
|
+
/** Engineering observability requirements shared across all variants. */
|
|
66
|
+
readonly observabilityRequirements: readonly string[];
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Canonical shared substrate for the InternalAdopter product suite.
|
|
70
|
+
* Every ProductA/B/C variant inherits this identical block — substrate
|
|
71
|
+
* sharing is enforced at the fixture level (AC #7).
|
|
72
|
+
*/
|
|
73
|
+
export declare const INTERNAL_ADOPTER_SUBSTRATE: InternalAdopterSubstrate;
|
|
74
|
+
/**
|
|
75
|
+
* A reference-impl Soul descriptor. Captures the inherited-locked substrate
|
|
76
|
+
* separately from the variant overlays so AC #7 (substrate shared across
|
|
77
|
+
* variants) is provable by structural inspection.
|
|
78
|
+
*
|
|
79
|
+
* This is NOT the full Soul DID schema (`reference/src/core/types.ts` carries
|
|
80
|
+
* that). It's the minimum surface needed for the variant-pattern reference
|
|
81
|
+
* impl — `soulId` + shared substrate + variant overlays.
|
|
82
|
+
*/
|
|
83
|
+
export interface InternalAdopterProduct {
|
|
84
|
+
/** Soul identifier in kebab-case. */
|
|
85
|
+
readonly soulId: string;
|
|
86
|
+
/** Human-readable product description. */
|
|
87
|
+
readonly description: string;
|
|
88
|
+
/** What variant axis this product is validating per RFC-0017 §11. */
|
|
89
|
+
readonly validationAxis: string;
|
|
90
|
+
/** Shared substrate — identical reference across all three products (AC #7). */
|
|
91
|
+
readonly substrate: InternalAdopterSubstrate;
|
|
92
|
+
/** Variant overlays declared on this Soul (exactly 3 per RFC-0017 §11). */
|
|
93
|
+
readonly variants: readonly VariantOverlay[];
|
|
94
|
+
/**
|
|
95
|
+
* Soul-level `designImperatives` — apply to all variants of this Soul
|
|
96
|
+
* unless a variant overrides the same design dimension (variant-wins per
|
|
97
|
+
* RFC-0017 §5.4). Captured here so the admission-spotcheck test can
|
|
98
|
+
* compose soul-aggregate vs variant-routed scoring.
|
|
99
|
+
*/
|
|
100
|
+
readonly soulDesignImperatives: readonly string[];
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The three InternalAdopter products — ProductA / ProductB / ProductC.
|
|
104
|
+
* ProductD is intentionally omitted per RFC-0017 §11 v0.4 (deferred to
|
|
105
|
+
* RFC-0018 §11 — temporal-context-bound modes are Journey shape, not Variant).
|
|
106
|
+
*/
|
|
107
|
+
export declare const INTERNAL_ADOPTER_PRODUCTS: readonly InternalAdopterProduct[];
|
|
108
|
+
/** Individual product accessors for direct consumption by tests / tooling. */
|
|
109
|
+
export declare const productA: InternalAdopterProduct;
|
|
110
|
+
export declare const productB: InternalAdopterProduct;
|
|
111
|
+
export declare const productC: InternalAdopterProduct;
|
|
112
|
+
/**
|
|
113
|
+
* Build a `variantsBySoul` map suitable for `VariantContext`, derived from
|
|
114
|
+
* the three product declarations. Test helper + the canonical shape callers
|
|
115
|
+
* use to wire the reference impl into the admission composite.
|
|
116
|
+
*/
|
|
117
|
+
export declare function buildVariantsBySoul(): Record<string, VariantOverlay[]>;
|
|
118
|
+
/**
|
|
119
|
+
* Build a representative `variantScores` map for spot-check admission scoring.
|
|
120
|
+
*
|
|
121
|
+
* Score shape: each variant gets `sa1` and `sa2` numbers in [0, 1].
|
|
122
|
+
* Per-variant scores are chosen to demonstrate that **variant-routed scoring
|
|
123
|
+
* differs from soul-aggregate scoring on a representative work item** (AC #6):
|
|
124
|
+
*
|
|
125
|
+
* - The "well-aligned" variant for a given work item scores HIGH (sa1=0.92,
|
|
126
|
+
* sa2=0.88).
|
|
127
|
+
* - The "misaligned" variants score LOW (sa1=0.30-0.40, sa2=0.35-0.45).
|
|
128
|
+
*
|
|
129
|
+
* If the same work item were scored at soul-aggregate scope, the average of
|
|
130
|
+
* its variants would compress to a middling value (sa1≈0.54, sa2≈0.56) —
|
|
131
|
+
* the variant-routed score for the well-aligned variant is meaningfully
|
|
132
|
+
* different (≈ +70% on sa1, +57% on sa2). This is the failure mode RFC-0017
|
|
133
|
+
* §2 documents: soul-aggregate scoring underweights variant-specific intent.
|
|
134
|
+
*
|
|
135
|
+
* The spot-check test in `admission-spotcheck.test.ts` exercises this against
|
|
136
|
+
* a representative ProductA work item ("small-utility onboarding improvement").
|
|
137
|
+
*/
|
|
138
|
+
export declare function buildVariantScores(): Record<string, Record<string, VariantScores>>;
|
|
139
|
+
/**
|
|
140
|
+
* Soul-aggregate Sα₁ / Sα₂ baseline for a given Soul, computed by averaging
|
|
141
|
+
* the per-variant scores from `buildVariantScores()`. Used by the spot-check
|
|
142
|
+
* test to demonstrate that variant-routed scoring meaningfully deviates from
|
|
143
|
+
* the soul-aggregate baseline (AC #6).
|
|
144
|
+
*
|
|
145
|
+
* The aggregation rule used here is `mean` — chosen because the failure mode
|
|
146
|
+
* documented in RFC-0017 §2 is the SMOOTHING/AVERAGING effect of soul-aggregate
|
|
147
|
+
* Sα₂ scoring across heterogeneous variants. Comparing variant-routed to mean
|
|
148
|
+
* is what shows the misallocation pattern. (The admission composite itself
|
|
149
|
+
* uses `min` per OQ-4, but that's a different question — we're showing that
|
|
150
|
+
* the per-variant view is structurally different from any soul-level aggregate.)
|
|
151
|
+
*/
|
|
152
|
+
export declare function computeSoulAggregateBaseline(soulId: string): {
|
|
153
|
+
sa1: number;
|
|
154
|
+
sa2: number;
|
|
155
|
+
};
|
|
156
|
+
//# sourceMappingURL=products.d.ts.map
|