@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,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript interfaces for the CompliancePosture resource (RFC-0022 §5).
|
|
3
|
+
*
|
|
4
|
+
* Lives at .ai-sdlc/compliance.yaml; schema at
|
|
5
|
+
* spec/schemas/compliance-posture.v1.schema.json.
|
|
6
|
+
*
|
|
7
|
+
* Design notes:
|
|
8
|
+
* - Loader returns CompliancePosture[] (single-element list in v1) per OQ-6
|
|
9
|
+
* so v2 multi-tenant composition is additive — not a breaking API change.
|
|
10
|
+
* - derivedGates overrides require a sibling _notes map (OQ-2 enforcement).
|
|
11
|
+
* - All regime declarations require attestedBy + attestedAt (legal claim
|
|
12
|
+
* discipline — loader rejects postures missing either field).
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* A single regulatory regime declaration with attestation metadata.
|
|
16
|
+
*
|
|
17
|
+
* Convention for `id`: '<framework>-<tier-or-version>'.
|
|
18
|
+
* Examples: 'SOC2-T2', 'HIPAA', 'PCI-DSS-L1', 'GDPR', 'FedRAMP-Moderate', 'ISO-27001:2022'.
|
|
19
|
+
*/
|
|
20
|
+
export interface Regime {
|
|
21
|
+
/**
|
|
22
|
+
* Canonical regime identifier.
|
|
23
|
+
* Convention: '<framework>-<tier-or-version>'.
|
|
24
|
+
* Examples: 'SOC2-T2', 'HIPAA', 'PCI-DSS-L1', 'GDPR', 'FedRAMP-Moderate', 'ISO-27001:2022'.
|
|
25
|
+
*/
|
|
26
|
+
id: string;
|
|
27
|
+
/**
|
|
28
|
+
* Optional explicit control list from the regime the adopter is claiming coverage for.
|
|
29
|
+
* Examples: ['CC6.6', 'CC8.1'] for SOC2; ['§164.308(a)(4)', '§164.312(a)'] for HIPAA.
|
|
30
|
+
* Used by the audit export to slice evidence per control.
|
|
31
|
+
*/
|
|
32
|
+
controls?: string[];
|
|
33
|
+
/**
|
|
34
|
+
* Audit cadence — drives default retention windows and export pre-staging.
|
|
35
|
+
*/
|
|
36
|
+
auditFrequency?: 'annual' | 'continuous' | 'on-demand';
|
|
37
|
+
/**
|
|
38
|
+
* Who declared this regime applies.
|
|
39
|
+
* E.g., 'Acme Legal LLP' or a contributor name.
|
|
40
|
+
* REQUIRED in v1: framework refuses to load a posture with regimes lacking attestation
|
|
41
|
+
* metadata (forces explicit operator/legal sign-off on each declaration).
|
|
42
|
+
*/
|
|
43
|
+
attestedBy: string;
|
|
44
|
+
/**
|
|
45
|
+
* ISO 8601 date when the regime was attested.
|
|
46
|
+
* REQUIRED in v1 (same rationale as attestedBy).
|
|
47
|
+
*/
|
|
48
|
+
attestedAt: string;
|
|
49
|
+
/**
|
|
50
|
+
* Operator's rationale for declaring this regime.
|
|
51
|
+
* Recommended for audit trail; not enforced by loader but strongly encouraged.
|
|
52
|
+
*/
|
|
53
|
+
attestedNotes?: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Gate values derived from declared regimes.
|
|
57
|
+
* When multiple regimes are declared, tightest constraint wins per axis (RFC-0022 §6).
|
|
58
|
+
*/
|
|
59
|
+
export interface DerivedGates {
|
|
60
|
+
/**
|
|
61
|
+
* Per RFC-0009 OQ-11.
|
|
62
|
+
* 'shared-with-rls' = single Postgres branch with row-level security tenant isolation.
|
|
63
|
+
* 'per-shard' = one branch per shard / customer.
|
|
64
|
+
*/
|
|
65
|
+
databaseBranchPool: 'shared-with-rls' | 'per-shard';
|
|
66
|
+
/**
|
|
67
|
+
* Per AISDLC-128.
|
|
68
|
+
* 'minimal' = framework-default patterns only.
|
|
69
|
+
* 'standard' = + common cloud provider keys.
|
|
70
|
+
* 'strict' = + entropy-based detection + adopter-supplied custom patterns.
|
|
71
|
+
*/
|
|
72
|
+
secretScanStrictness: 'minimal' | 'standard' | 'strict';
|
|
73
|
+
/**
|
|
74
|
+
* Per AISDLC-74/146.
|
|
75
|
+
* When true, framework refuses to merge PRs without a valid DSSE attestation envelope at HEAD.
|
|
76
|
+
*/
|
|
77
|
+
attestationRequired: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Floor for log retention in days.
|
|
80
|
+
* Framework keeps logs for at least this many days; GC by mtime.
|
|
81
|
+
*/
|
|
82
|
+
auditRetentionDays: number;
|
|
83
|
+
/**
|
|
84
|
+
* Per config/trusted-reviewers.yaml.
|
|
85
|
+
* 'open' = any GitHub user can act as reviewer.
|
|
86
|
+
* 'allowlist' = explicit reviewer list; identity-only check.
|
|
87
|
+
* 'allowlist+role' = allowlist + per-role authority (review vs approve vs admin).
|
|
88
|
+
*/
|
|
89
|
+
reviewerAuthorityModel: 'open' | 'allowlist' | 'allowlist+role';
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Operator-supplied partial overrides for DerivedGates.
|
|
93
|
+
*
|
|
94
|
+
* Per OQ-2: each overridden field MUST have a corresponding non-empty entry
|
|
95
|
+
* in the sibling `_notes` map. The loader rejects any override missing notes.
|
|
96
|
+
*
|
|
97
|
+
* The `_notes` field is a sibling map keyed by field name to keep the override
|
|
98
|
+
* values themselves typed and to make the notes audit-traceable.
|
|
99
|
+
*/
|
|
100
|
+
export type PartialDerivedGatesOverrides = Partial<Omit<DerivedGates, never>> & {
|
|
101
|
+
/**
|
|
102
|
+
* Notes for each overridden gate field.
|
|
103
|
+
* Key = gate field name (e.g. 'databaseBranchPool').
|
|
104
|
+
* Value = non-empty rationale string.
|
|
105
|
+
* Loader rejects any gate field override whose corresponding _notes entry is missing or empty.
|
|
106
|
+
*/
|
|
107
|
+
_notes?: Record<string, string>;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Specification for a single evidence bundle included in `cli-compliance-audit export`.
|
|
111
|
+
*/
|
|
112
|
+
export interface AuditExportSpec {
|
|
113
|
+
/**
|
|
114
|
+
* Which kind of evidence to include in the export bundle.
|
|
115
|
+
*/
|
|
116
|
+
kind: 'dsse-envelope' | 'dor-calibration' | 'trusted-reviewers' | 'enforcement-events' | 'access-control-changes';
|
|
117
|
+
/**
|
|
118
|
+
* Output format for this evidence bundle.
|
|
119
|
+
*/
|
|
120
|
+
format: 'json' | 'jsonl' | 'csv';
|
|
121
|
+
/**
|
|
122
|
+
* Retention policy for this evidence bundle.
|
|
123
|
+
*/
|
|
124
|
+
retentionPolicy: {
|
|
125
|
+
/**
|
|
126
|
+
* Retention floor in days. Framework GC removes after `days + grace`.
|
|
127
|
+
*/
|
|
128
|
+
days: number;
|
|
129
|
+
/**
|
|
130
|
+
* hot = on local disk; cold = expected to be archived externally.
|
|
131
|
+
*/
|
|
132
|
+
tier?: 'hot' | 'cold';
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* The CompliancePosture resource.
|
|
137
|
+
*
|
|
138
|
+
* Lives at .ai-sdlc/compliance.yaml.
|
|
139
|
+
* Schema at spec/schemas/compliance-posture.v1.schema.json.
|
|
140
|
+
*
|
|
141
|
+
* Adopters declare which regulatory regimes apply; the framework derives gate
|
|
142
|
+
* defaults from those regimes and uses this posture to drive attestation
|
|
143
|
+
* requirements, secret-scan strictness, DB pool isolation, and audit-export
|
|
144
|
+
* configuration.
|
|
145
|
+
*/
|
|
146
|
+
export interface CompliancePosture {
|
|
147
|
+
apiVersion: 'ai-sdlc.io/v1alpha1';
|
|
148
|
+
kind: 'CompliancePosture';
|
|
149
|
+
metadata: {
|
|
150
|
+
/** Canonical project identifier. DNS-label format. */
|
|
151
|
+
name: string;
|
|
152
|
+
namespace?: string;
|
|
153
|
+
labels?: Record<string, string>;
|
|
154
|
+
annotations?: Record<string, string>;
|
|
155
|
+
};
|
|
156
|
+
spec: {
|
|
157
|
+
/**
|
|
158
|
+
* Declared regulatory posture. Empty array means "(none declared)" — baseline posture applies.
|
|
159
|
+
* Baseline: shared-with-rls, minimal, attestationRequired=false, 90d retention, open reviewer model.
|
|
160
|
+
*/
|
|
161
|
+
regimes: Regime[];
|
|
162
|
+
/**
|
|
163
|
+
* Operator overrides for derived gate values.
|
|
164
|
+
* Each overridden field requires a non-empty _notes entry (OQ-2).
|
|
165
|
+
* The loader rejects any override missing a notes entry.
|
|
166
|
+
*/
|
|
167
|
+
derivedGates?: PartialDerivedGatesOverrides;
|
|
168
|
+
/**
|
|
169
|
+
* Evidence bundles to produce on `cli-compliance-audit export`.
|
|
170
|
+
*/
|
|
171
|
+
auditExports: AuditExportSpec[];
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* The "(none declared)" baseline DerivedGates — applies when no regimes are declared.
|
|
176
|
+
* Matches pre-RFC-0022 framework behavior (no gate changes for existing projects).
|
|
177
|
+
*/
|
|
178
|
+
export declare const BASELINE_DERIVED_GATES: Readonly<DerivedGates>;
|
|
179
|
+
/**
|
|
180
|
+
* The "(none declared)" baseline CompliancePosture — returned when no
|
|
181
|
+
* .ai-sdlc/compliance.yaml exists (AC #6 / OQ-6 backward-compat).
|
|
182
|
+
*/
|
|
183
|
+
export declare const BASELINE_POSTURE: Readonly<CompliancePosture>;
|
|
184
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript interfaces for the CompliancePosture resource (RFC-0022 §5).
|
|
3
|
+
*
|
|
4
|
+
* Lives at .ai-sdlc/compliance.yaml; schema at
|
|
5
|
+
* spec/schemas/compliance-posture.v1.schema.json.
|
|
6
|
+
*
|
|
7
|
+
* Design notes:
|
|
8
|
+
* - Loader returns CompliancePosture[] (single-element list in v1) per OQ-6
|
|
9
|
+
* so v2 multi-tenant composition is additive — not a breaking API change.
|
|
10
|
+
* - derivedGates overrides require a sibling _notes map (OQ-2 enforcement).
|
|
11
|
+
* - All regime declarations require attestedBy + attestedAt (legal claim
|
|
12
|
+
* discipline — loader rejects postures missing either field).
|
|
13
|
+
*/
|
|
14
|
+
// ── Baseline ──────────────────────────────────────────────────────────────
|
|
15
|
+
/**
|
|
16
|
+
* The "(none declared)" baseline DerivedGates — applies when no regimes are declared.
|
|
17
|
+
* Matches pre-RFC-0022 framework behavior (no gate changes for existing projects).
|
|
18
|
+
*/
|
|
19
|
+
export const BASELINE_DERIVED_GATES = {
|
|
20
|
+
databaseBranchPool: 'shared-with-rls',
|
|
21
|
+
secretScanStrictness: 'minimal',
|
|
22
|
+
attestationRequired: false,
|
|
23
|
+
auditRetentionDays: 90,
|
|
24
|
+
reviewerAuthorityModel: 'open',
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* The "(none declared)" baseline CompliancePosture — returned when no
|
|
28
|
+
* .ai-sdlc/compliance.yaml exists (AC #6 / OQ-6 backward-compat).
|
|
29
|
+
*/
|
|
30
|
+
export const BASELINE_POSTURE = {
|
|
31
|
+
apiVersion: 'ai-sdlc.io/v1alpha1',
|
|
32
|
+
kind: 'CompliancePosture',
|
|
33
|
+
metadata: {
|
|
34
|
+
name: 'baseline',
|
|
35
|
+
},
|
|
36
|
+
spec: {
|
|
37
|
+
regimes: [],
|
|
38
|
+
auditExports: [],
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RFC-0009 Phase 4.1 — Eρ₅ Compliance Clearance scoring.
|
|
3
|
+
*
|
|
4
|
+
* Implements the categorical 0/1 gating dimension from RFC-0009 §7.1:
|
|
5
|
+
*
|
|
6
|
+
* Eρ₅ = soul.triad.engineering.complianceRegimes[].clearance(work_item)
|
|
7
|
+
* = 0 if any named regime is violated
|
|
8
|
+
* = 1 otherwise
|
|
9
|
+
*
|
|
10
|
+
* **OQ-5 scope** (v3.3 resolution, 2026-05-03): HARD regulatory frameworks
|
|
11
|
+
* ONLY — anything with formal external-audit consequences. Internal best
|
|
12
|
+
* practices, code style, architectural preferences, and team conventions are
|
|
13
|
+
* OUT OF SCOPE and rejected at declaration time per the boundary test:
|
|
14
|
+
* "would an external regulator or auditor have grounds to act on a violation?"
|
|
15
|
+
*
|
|
16
|
+
* In scope:
|
|
17
|
+
* - GDPR (EU data protection)
|
|
18
|
+
* - HIPAA (US healthcare)
|
|
19
|
+
* - SOC2 (audit trust framework — variants like SOC2-T2 accepted)
|
|
20
|
+
* - PCI-DSS (payment card data — variants like PCI-DSS-L1 accepted)
|
|
21
|
+
* - FedRAMP (US federal cloud — variants like FedRAMP-Moderate accepted)
|
|
22
|
+
* - Regional data-residency (Schrems II, EU data-localization, China PIPL,
|
|
23
|
+
* Canadian PIPEDA cross-border)
|
|
24
|
+
* - Regulated-industry rules (financial KYC/AML, healthcare device
|
|
25
|
+
* certification, telecom regulations, ISO-27001 audit framework, etc.)
|
|
26
|
+
*
|
|
27
|
+
* Out of scope (rejected at declaration time):
|
|
28
|
+
* - Internal best-practices ("clean-code", "team-style", "house-style")
|
|
29
|
+
* - Code-quality rules ("eslint-recommended", "prettier-standard")
|
|
30
|
+
* - Architectural preferences ("hexagonal", "ddd-strict")
|
|
31
|
+
* - Team conventions ("our-conventions", "internal-coding-standard")
|
|
32
|
+
*
|
|
33
|
+
* **Adopter opt-in gate** (RFC-0009 §10 Phase 4): Eρ₅ is gated behind
|
|
34
|
+
* `ComplianceClearanceContext.enabled === true` initially. Promotion to
|
|
35
|
+
* default behavior is subject to ecosystem feedback. When disabled (default),
|
|
36
|
+
* the admission composite does not apply the Eρ₅ multiplier and behaves
|
|
37
|
+
* exactly as in Phase 2/3 — full backward compatibility.
|
|
38
|
+
*
|
|
39
|
+
* **RFC-0022 consumption surface**: when an adopter wires the loaded
|
|
40
|
+
* `CompliancePosture[]` into `ComplianceClearanceContext.posture`, the
|
|
41
|
+
* declared regimes from that resource compose with the soul's own
|
|
42
|
+
* `complianceRegimes` field. Both sources contribute to the regime set
|
|
43
|
+
* the work item is checked against; clearance is gating across the union.
|
|
44
|
+
*
|
|
45
|
+
* @see spec/rfcs/RFC-0009-tessellated-design-intent-documents.md §7.1 + §10
|
|
46
|
+
* @see spec/rfcs/RFC-0022-compliance-posture-audit-surface.md (consumption surface)
|
|
47
|
+
*/
|
|
48
|
+
import type { CompliancePosture } from './compliance/types.js';
|
|
49
|
+
/**
|
|
50
|
+
* Canonical hard-regulatory framework prefixes per RFC-0009 §7.1 OQ-5 resolution.
|
|
51
|
+
*
|
|
52
|
+
* Matching is **prefix-based** to accept variants like `SOC2-T2`, `PCI-DSS-L1`,
|
|
53
|
+
* `FedRAMP-Moderate`, `FedRAMP-High`, `ISO-27001:2022`. The exact framework name
|
|
54
|
+
* (without tier/version suffix) is the prefix; anything starting with one of
|
|
55
|
+
* these prefixes is considered a hard-regulatory regime.
|
|
56
|
+
*
|
|
57
|
+
* Regional data-residency frameworks (Schrems II / PIPL / PIPEDA) are listed
|
|
58
|
+
* explicitly. Generic `DATA-RESIDENCY-*` prefix is also accepted for adopters
|
|
59
|
+
* who declare per-region constraints under a unified naming scheme.
|
|
60
|
+
*/
|
|
61
|
+
export declare const HARD_REGULATORY_REGIME_PREFIXES: readonly string[];
|
|
62
|
+
/**
|
|
63
|
+
* Predicate: returns true iff the regime ID matches a hard-regulatory prefix
|
|
64
|
+
* per the OQ-5 scope whitelist.
|
|
65
|
+
*
|
|
66
|
+
* Comparison is case-insensitive on the regime ID (`HIPAA` and `hipaa` both
|
|
67
|
+
* match) but the canonical prefixes are uppercase by convention.
|
|
68
|
+
*
|
|
69
|
+
* **Boundary guard (AISDLC-316 round-2 code-review fix)**: a match requires the
|
|
70
|
+
* prefix to be either the WHOLE regime id OR followed by a separator
|
|
71
|
+
* (`-`, `_`, `:`, `.`) or a digit (tier-variant pattern). This prevents
|
|
72
|
+
* collision-prone soft regimes like `SOXophone`, `AMLET`, `KYCS-internal`,
|
|
73
|
+
* `HIPAAphobia` from being mis-classified as hard-regulatory by a naive
|
|
74
|
+
* `startsWith` check. Tier-variants like `SOC2-T2`, `PCI-DSS-L1`,
|
|
75
|
+
* `FedRAMP-Moderate`, `ISO-27001:2022`, `SOC2T2` (digit boundary) still match.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* isHardRegulatoryRegime('HIPAA') // true
|
|
79
|
+
* isHardRegulatoryRegime('SOC2-T2') // true (SOC2 prefix + '-' boundary)
|
|
80
|
+
* isHardRegulatoryRegime('PCI-DSS-L1') // true (PCI-DSS prefix + '-' boundary)
|
|
81
|
+
* isHardRegulatoryRegime('FedRAMP-Moderate')// true (FedRAMP prefix + '-' boundary)
|
|
82
|
+
* isHardRegulatoryRegime('ISO-27001:2022') // true (ISO-27001 prefix + ':' boundary)
|
|
83
|
+
* isHardRegulatoryRegime('clean-code') // false (soft / out of scope)
|
|
84
|
+
* isHardRegulatoryRegime('team-style') // false (soft / out of scope)
|
|
85
|
+
* isHardRegulatoryRegime('SOXophone') // false (SOX prefix but letter boundary)
|
|
86
|
+
* isHardRegulatoryRegime('AMLET') // false (AML prefix but letter boundary)
|
|
87
|
+
* isHardRegulatoryRegime('HIPAAphobia') // false (HIPAA prefix but letter boundary)
|
|
88
|
+
*/
|
|
89
|
+
export declare function isHardRegulatoryRegime(regimeId: string): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Result of validating a set of declared regimes against the OQ-5 scope.
|
|
92
|
+
*/
|
|
93
|
+
export interface ValidateComplianceRegimesResult {
|
|
94
|
+
/** True iff every input regime passes `isHardRegulatoryRegime`. */
|
|
95
|
+
valid: boolean;
|
|
96
|
+
/** The subset of inputs that are hard-regulatory (in-scope). */
|
|
97
|
+
accepted: string[];
|
|
98
|
+
/** The subset rejected as soft / out of scope per OQ-5. */
|
|
99
|
+
rejected: string[];
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Validate a list of declared compliance regimes against the OQ-5 hard-regulatory
|
|
103
|
+
* scope. Used at declaration time (DID load, RFC-0022 posture parse) to reject
|
|
104
|
+
* soft regimes before they reach the Eρ₅ scoring path.
|
|
105
|
+
*
|
|
106
|
+
* Per RFC-0009 OQ-5 sub-decision: soft/advisory regimes are NOT in scope and
|
|
107
|
+
* MUST be filtered at declaration time. Internal best-practices, code style,
|
|
108
|
+
* and team conventions belong to other mechanisms (code review, lint).
|
|
109
|
+
*
|
|
110
|
+
* @param regimes - Declared regime IDs from a soul's `complianceRegimes`
|
|
111
|
+
* field or an RFC-0022 `CompliancePosture.spec.regimes[].id`.
|
|
112
|
+
* @returns Validation result with split accepted/rejected lists.
|
|
113
|
+
*/
|
|
114
|
+
export declare function validateComplianceRegimes(regimes: readonly string[] | undefined): ValidateComplianceRegimesResult;
|
|
115
|
+
/**
|
|
116
|
+
* A single asserted compliance violation against a work item.
|
|
117
|
+
*
|
|
118
|
+
* Adopters populate these from regime-specific clearance checks they run as
|
|
119
|
+
* part of admission enrichment — e.g., a HIPAA preprocessor that detects PHI
|
|
120
|
+
* fields in a work item's payload, a GDPR preprocessor that detects
|
|
121
|
+
* cross-border data transfers without lawful-basis annotation, etc.
|
|
122
|
+
*
|
|
123
|
+
* Phase 4.1 ships the **surface** for these violations; the per-regime
|
|
124
|
+
* clearance checkers themselves are out of scope (per RFC-0009 §10 Phase 4 —
|
|
125
|
+
* the scoring path activates first; specific checkers ship incrementally).
|
|
126
|
+
*/
|
|
127
|
+
export interface ComplianceViolation {
|
|
128
|
+
/** Regime ID the violation is asserted against (e.g. 'HIPAA'). */
|
|
129
|
+
regimeId: string;
|
|
130
|
+
/**
|
|
131
|
+
* Optional control / clause the violation cites
|
|
132
|
+
* (e.g. '§164.312(a)' for HIPAA technical safeguards).
|
|
133
|
+
*/
|
|
134
|
+
control?: string;
|
|
135
|
+
/** Human-readable reason — surfaced in audit logs + operator UI. */
|
|
136
|
+
reason: string;
|
|
137
|
+
/** Optional severity hint; Eρ₅ is gating regardless of severity. */
|
|
138
|
+
severity?: 'critical' | 'major' | 'minor';
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Per-work-item compliance violations, keyed by canonical work-item ID
|
|
142
|
+
* (e.g. `AISDLC-316`). Empty / missing entries imply no violations — clearance
|
|
143
|
+
* holds and Eρ₅ = 1.
|
|
144
|
+
*/
|
|
145
|
+
export interface ComplianceViolationEntry {
|
|
146
|
+
/** Canonical work item ID (case-insensitive match used internally). */
|
|
147
|
+
id: string;
|
|
148
|
+
/** Asserted violations against this work item. Empty = clearance holds. */
|
|
149
|
+
violations: ComplianceViolation[];
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Per-soul declared compliance regimes, keyed by `soulId` matching
|
|
153
|
+
* `Tessellation.souls[].soulId`. Sourced from each Soul DID's
|
|
154
|
+
* `spec.triad.engineering.complianceRegimes` field at load time.
|
|
155
|
+
*
|
|
156
|
+
* In the non-tessellated (single-DID) path, callers populate a single entry
|
|
157
|
+
* under a sentinel `__platform` key with the DID's own engineering regimes.
|
|
158
|
+
*/
|
|
159
|
+
export interface SoulComplianceRegimes {
|
|
160
|
+
/** Soul ID this entry applies to (or `__platform` for non-tessellated). */
|
|
161
|
+
soulId: string;
|
|
162
|
+
/** Hard-regulatory regimes declared on the soul's engineering vertex. */
|
|
163
|
+
regimes: string[];
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* All Eρ₅ Compliance Clearance inputs needed by the admission composite.
|
|
167
|
+
*
|
|
168
|
+
* Callers build this once per pipeline tick and pass it to
|
|
169
|
+
* `computeAdmissionComposite` via `AdmissionCompositeOptions.complianceClearanceContext`.
|
|
170
|
+
*
|
|
171
|
+
* **Adopter opt-in gate** (Phase 4.1): when `enabled === false` (the default
|
|
172
|
+
* for `undefined`), the admission composite does NOT apply Eρ₅ — full
|
|
173
|
+
* backward compatibility with Phase 2/3 behavior.
|
|
174
|
+
*/
|
|
175
|
+
export interface ComplianceClearanceContext {
|
|
176
|
+
/**
|
|
177
|
+
* Adopter opt-in gate. When `false` (default), Eρ₅ is not applied and the
|
|
178
|
+
* admission composite behaves as Phase 2/3 (no compliance multiplier).
|
|
179
|
+
*
|
|
180
|
+
* Initially gated on adopter opt-in per RFC-0009 §10 Phase 4; promotion
|
|
181
|
+
* to default-on subject to ecosystem feedback (tracked as a follow-up).
|
|
182
|
+
*/
|
|
183
|
+
enabled: boolean;
|
|
184
|
+
/**
|
|
185
|
+
* Per-soul declared regimes from each soul's `triad.engineering.complianceRegimes`.
|
|
186
|
+
*
|
|
187
|
+
* In tessellated mode, one entry per active soul; in non-tessellated mode,
|
|
188
|
+
* one entry under sentinel soulId `__platform`.
|
|
189
|
+
*
|
|
190
|
+
* Regimes here MUST already be filtered by `validateComplianceRegimes` —
|
|
191
|
+
* the loader / adapter that builds this struct is the OQ-5 enforcement
|
|
192
|
+
* boundary. Anything that slips through is treated as a soft regime that
|
|
193
|
+
* does NOT contribute to the gating decision.
|
|
194
|
+
*/
|
|
195
|
+
perSoulRegimes: SoulComplianceRegimes[];
|
|
196
|
+
/**
|
|
197
|
+
* Optional RFC-0022 `CompliancePosture[]` from
|
|
198
|
+
* `loadCompliancePosture()`. When present, declared regime IDs from the
|
|
199
|
+
* posture compose with the soul-declared regimes — both contribute to the
|
|
200
|
+
* regime set the work item is checked against. This is the RFC-0022
|
|
201
|
+
* consumption surface (AC #4).
|
|
202
|
+
*
|
|
203
|
+
* Regime IDs from the posture pass the same OQ-5 scope filter; the loader's
|
|
204
|
+
* own validation (`MissingComplianceAttestation`) is independent.
|
|
205
|
+
*/
|
|
206
|
+
posture?: readonly CompliancePosture[];
|
|
207
|
+
/**
|
|
208
|
+
* Asserted violations per work item, indexed by work-item ID. Absent ID
|
|
209
|
+
* (or empty `violations` array) implies clearance holds for that item.
|
|
210
|
+
*/
|
|
211
|
+
violations?: ComplianceViolationEntry[];
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Result of the Eρ₅ Compliance Clearance pass.
|
|
215
|
+
*
|
|
216
|
+
* `er5` is categorical 0/1 per RFC-0009 §7.1 — `0` means at least one declared
|
|
217
|
+
* regime was violated; `1` means clearance holds (or no regimes apply, or the
|
|
218
|
+
* adopter has not opted in yet).
|
|
219
|
+
*/
|
|
220
|
+
export interface ComplianceClearanceResult {
|
|
221
|
+
/** Categorical clearance score in {0, 1}. */
|
|
222
|
+
er5: 0 | 1;
|
|
223
|
+
/**
|
|
224
|
+
* Routing path taken (matches the scoring algorithm's decision branches).
|
|
225
|
+
*
|
|
226
|
+
* - `'disabled'` — adopter opt-in gate is off; Eρ₅ not applied.
|
|
227
|
+
* - `'no-regimes'` — no hard-regulatory regimes declared for any
|
|
228
|
+
* affected soul (or platform); Eρ₅ = 1.
|
|
229
|
+
* - `'clearance-holds'` — regimes declared, no violations asserted; Eρ₅ = 1.
|
|
230
|
+
* - `'clearance-violated'` — at least one declared regime asserts a violation; Eρ₅ = 0.
|
|
231
|
+
*/
|
|
232
|
+
routingPath: 'disabled' | 'no-regimes' | 'clearance-holds' | 'clearance-violated';
|
|
233
|
+
/**
|
|
234
|
+
* The regime IDs the work item was checked against (union of soul-declared
|
|
235
|
+
* regimes from `affectedSoulIds` and any RFC-0022 posture regimes).
|
|
236
|
+
*/
|
|
237
|
+
checkedRegimes: string[];
|
|
238
|
+
/**
|
|
239
|
+
* Violations that drove Eρ₅ to 0. Empty when clearance holds.
|
|
240
|
+
*/
|
|
241
|
+
violations: ComplianceViolation[];
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Compute Eρ₅ Compliance Clearance for a work item.
|
|
245
|
+
*
|
|
246
|
+
* Algorithm (RFC-0009 §7.1 + §10 Phase 4):
|
|
247
|
+
* 1. If `ctx.enabled !== true` → return `er5 = 1` with `routingPath = 'disabled'`.
|
|
248
|
+
* 2. Build the regime set from:
|
|
249
|
+
* - Each soul in `affectedSoulIds`'s `perSoulRegimes` entry, OR
|
|
250
|
+
* the `__platform` sentinel entry when `affectedSoulIds` is empty.
|
|
251
|
+
* - All RFC-0022 posture regimes (if `ctx.posture` present).
|
|
252
|
+
* Filter through `isHardRegulatoryRegime` (defense-in-depth on the OQ-5 boundary).
|
|
253
|
+
* 3. If regime set is empty → `er5 = 1`, `routingPath = 'no-regimes'`.
|
|
254
|
+
* 4. Look up violations for `workItemId` in `ctx.violations` (case-insensitive).
|
|
255
|
+
* Filter to violations whose `regimeId` is in the regime set.
|
|
256
|
+
* - If any remain → `er5 = 0`, `routingPath = 'clearance-violated'`.
|
|
257
|
+
* - Else → `er5 = 1`, `routingPath = 'clearance-holds'`.
|
|
258
|
+
*
|
|
259
|
+
* @param workItemId - Canonical work item ID (e.g. `AISDLC-316`).
|
|
260
|
+
* @param affectedSoulIds - Soul IDs the work item targets (from
|
|
261
|
+
* `resolveAffectedSouls()`). Empty array =
|
|
262
|
+
* non-tessellated or substrate-only; uses
|
|
263
|
+
* `__platform` sentinel.
|
|
264
|
+
* @param ctx - Compliance clearance context (or undefined =
|
|
265
|
+
* treated as disabled).
|
|
266
|
+
* @returns Eρ₅ clearance result with routing audit trail.
|
|
267
|
+
*/
|
|
268
|
+
export declare function computeComplianceClearance(workItemId: string, affectedSoulIds: readonly string[], ctx: ComplianceClearanceContext | undefined): ComplianceClearanceResult;
|
|
269
|
+
//# sourceMappingURL=compliance-clearance.d.ts.map
|