@ai-sdlc/orchestrator 0.10.0 → 0.14.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/adapters.d.ts +42 -3
- package/dist/adapters.js +133 -3
- package/dist/admission-composite.d.ts +112 -1
- package/dist/admission-composite.js +85 -4
- package/dist/admission-enrichment.d.ts +12 -3
- package/dist/admission-enrichment.js +64 -13
- package/dist/admission-score.d.ts +30 -0
- package/dist/admission-score.js +4 -1
- package/dist/analysis/file-walker.js +5 -0
- 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.js +1 -1
- package/dist/cli/commands/init-features.d.ts +301 -2
- package/dist/cli/commands/init-features.js +647 -7
- package/dist/cli/commands/init-templates.d.ts +198 -1
- package/dist/cli/commands/init-templates.js +943 -1
- package/dist/cli/commands/init.d.ts +45 -0
- package/dist/cli/commands/init.js +147 -5
- 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/cycle-utils.js +14 -1
- package/dist/database/adapters/external.js +5 -1
- 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 +200 -38
- package/dist/fix-review.js +1 -1
- 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/metric-snapshot.d.ts +403 -0
- package/dist/journey/metric-snapshot.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/otel-exporter.js +0 -3
- package/dist/runners/claude-code.js +3 -3
- 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 +173 -13
- package/dist/runtime/attestations.js +265 -43
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +1 -1
- package/dist/sa-scoring/exemplar-bank.js +3 -1
- 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/shared.d.ts +28 -0
- package/dist/shared.js +37 -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/dist/webhook-manager.js +7 -1
- package/package.json +15 -12
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deprecation lifecycle per RFC-0019 §9.1 + OQ-4 re-walkthrough.
|
|
3
|
+
*
|
|
4
|
+
* Three-layer grace-period precedence (highest → lowest):
|
|
5
|
+
* 1. per-org `gracePeriodDays` from `.ai-sdlc/embedding-config.yaml`
|
|
6
|
+
* 2. adapter-declared `defaultGracePeriodDays` (capability matrix)
|
|
7
|
+
* 3. framework default — 90 days
|
|
8
|
+
*
|
|
9
|
+
* Catalog dedup via per-Decision-key counter prevents Decision flood under
|
|
10
|
+
* orchestrator-driven loads: emit `Decision: embedding-provider-deprecated`
|
|
11
|
+
* at MILESTONES (89/60/30/7/1 days before deprecatedAt), NOT per-load. The
|
|
12
|
+
* dedup key is `embedding-provider-deprecated:<adapter-name>:<deprecatedAt>`.
|
|
13
|
+
*
|
|
14
|
+
* Lifecycle phases:
|
|
15
|
+
* - Pre-warning : today < (deprecatedAt - gracePeriod) → silent
|
|
16
|
+
* - Warning : today ∈ [deprecatedAt - gracePeriod, deprecatedAt) → milestone events
|
|
17
|
+
* - Deprecated : today ∈ [deprecatedAt, removedAt) → continued warnings; HIGH in strict mode
|
|
18
|
+
* - Removed : today ≥ removedAt → emit `Decision: embedding-provider-removed`
|
|
19
|
+
* + auto-action: emit cli-embedding-bump migration task.
|
|
20
|
+
* Pipeline NEVER halts — downstream consumers degrade.
|
|
21
|
+
*
|
|
22
|
+
* @module embedding/deprecation
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Framework default grace-period length per OQ-4 re-walkthrough.
|
|
26
|
+
* Conservative within OpenAI's typical 12-15 month deprecation window.
|
|
27
|
+
*/
|
|
28
|
+
export const FRAMEWORK_DEFAULT_GRACE_PERIOD_DAYS = 90;
|
|
29
|
+
/**
|
|
30
|
+
* Days-before-deprecatedAt at which a catalog Decision is emitted.
|
|
31
|
+
* Dedup counter ensures one event per milestone per (adapter, deprecatedAt) tuple.
|
|
32
|
+
*
|
|
33
|
+
* Sorted DESCENDING — when computing "next-due milestone" we walk from
|
|
34
|
+
* largest to smallest and pick the first one we have crossed.
|
|
35
|
+
*/
|
|
36
|
+
export const DEPRECATION_MILESTONE_DAYS = [89, 60, 30, 7, 1];
|
|
37
|
+
/**
|
|
38
|
+
* Resolve the effective grace period using the three-layer precedence chain
|
|
39
|
+
* per OQ-4 re-walkthrough.
|
|
40
|
+
*/
|
|
41
|
+
export function resolveGracePeriodDays(orgOverride, adapterDefault) {
|
|
42
|
+
if (typeof orgOverride === 'number' && Number.isFinite(orgOverride) && orgOverride > 0) {
|
|
43
|
+
return orgOverride;
|
|
44
|
+
}
|
|
45
|
+
if (typeof adapterDefault === 'number' && Number.isFinite(adapterDefault) && adapterDefault > 0) {
|
|
46
|
+
return adapterDefault;
|
|
47
|
+
}
|
|
48
|
+
return FRAMEWORK_DEFAULT_GRACE_PERIOD_DAYS;
|
|
49
|
+
}
|
|
50
|
+
/** Compute calendar-day difference (positive = future, negative = past). */
|
|
51
|
+
function daysBetween(from, to) {
|
|
52
|
+
const MS_PER_DAY = 1000 * 60 * 60 * 24;
|
|
53
|
+
// Normalize to UTC midnight so DST transitions don't bias the count.
|
|
54
|
+
const fromUtc = Date.UTC(from.getUTCFullYear(), from.getUTCMonth(), from.getUTCDate());
|
|
55
|
+
const toUtc = Date.UTC(to.getUTCFullYear(), to.getUTCMonth(), to.getUTCDate());
|
|
56
|
+
return Math.round((toUtc - fromUtc) / MS_PER_DAY);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Find the most-recently-crossed milestone at the current moment — i.e., the
|
|
60
|
+
* SMALLEST milestone the caller is at-or-under. Returns `null` when no
|
|
61
|
+
* milestone is due (today is BEFORE the largest milestone OR adapter has no
|
|
62
|
+
* deprecatedAt).
|
|
63
|
+
*
|
|
64
|
+
* "Crossed" = `daysToDeprecatedAt <= milestone`. We want the smallest such
|
|
65
|
+
* milestone so each emission represents a NEW threshold crossed:
|
|
66
|
+
*
|
|
67
|
+
* 90 days out → no milestone due
|
|
68
|
+
* 89 days out → milestone 89 (largest threshold first crossed)
|
|
69
|
+
* 75 days out → milestone 89 (still inside 89 window, 60 not yet crossed)
|
|
70
|
+
* 60 days out → milestone 60 (newly crossed)
|
|
71
|
+
* 50 days out → milestone 60 (still inside 60, 30 not yet crossed)
|
|
72
|
+
* 30 days out → milestone 30
|
|
73
|
+
* ...
|
|
74
|
+
*
|
|
75
|
+
* The dedup counter then collapses repeated emissions at the same milestone
|
|
76
|
+
* to exactly one event per (adapter, deprecatedAt, milestone) tuple.
|
|
77
|
+
*
|
|
78
|
+
* @param daysToDeprecatedAt - Result from `daysBetween(today, deprecatedAt)`.
|
|
79
|
+
* Positive when deprecatedAt is in the future, negative when past.
|
|
80
|
+
*/
|
|
81
|
+
export function nextDueMilestone(daysToDeprecatedAt) {
|
|
82
|
+
// After deprecatedAt: no milestone is "due" (we emit the deprecated phase
|
|
83
|
+
// event instead).
|
|
84
|
+
if (daysToDeprecatedAt < 0)
|
|
85
|
+
return null;
|
|
86
|
+
// Sorted ASCENDING for this lookup: pick the SMALLEST milestone we are
|
|
87
|
+
// at-or-under so each crossing surfaces as a distinct emission.
|
|
88
|
+
const ascending = [...DEPRECATION_MILESTONE_DAYS].sort((a, b) => a - b);
|
|
89
|
+
for (const milestone of ascending) {
|
|
90
|
+
if (daysToDeprecatedAt <= milestone)
|
|
91
|
+
return milestone;
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Build the catalog dedup key for a deprecation event at a given milestone.
|
|
97
|
+
* Same key across pipeline loads → caller refuses to emit a second time.
|
|
98
|
+
*/
|
|
99
|
+
export function buildDedupKey(decisionType, adapterName, deprecatedAt, milestoneDaysBefore) {
|
|
100
|
+
const base = `${decisionType}:${adapterName}:${deprecatedAt ?? 'undeclared'}`;
|
|
101
|
+
return milestoneDaysBefore === null ? base : `${base}:m${milestoneDaysBefore}`;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Evaluate the deprecation lifecycle for one adapter.
|
|
105
|
+
*
|
|
106
|
+
* Returns the phase, resolved grace period, and any catalog Decision events
|
|
107
|
+
* the caller should emit. Pipeline-load NEVER halts on the result; downstream
|
|
108
|
+
* consumers degrade gracefully per the RFC-0035 G0 non-blocking contract.
|
|
109
|
+
*
|
|
110
|
+
* Dedup contract: the returned `decisionEvents` always carry the dedup key.
|
|
111
|
+
* The caller MUST consult its dedup store before appending — re-emitting the
|
|
112
|
+
* same `(adapter, deprecatedAt, milestone)` triple is a bug.
|
|
113
|
+
*/
|
|
114
|
+
export function evaluateDeprecationLifecycle(input) {
|
|
115
|
+
const today = input.today ?? new Date();
|
|
116
|
+
const effectiveGracePeriodDays = resolveGracePeriodDays(input.orgGracePeriodDays, input.adapterDefaultGracePeriodDays);
|
|
117
|
+
// Inactive — no lifecycle declared.
|
|
118
|
+
if (!input.deprecatedAt && !input.removedAt) {
|
|
119
|
+
return {
|
|
120
|
+
phase: 'inactive',
|
|
121
|
+
effectiveGracePeriodDays,
|
|
122
|
+
daysToDeprecatedAt: null,
|
|
123
|
+
daysToRemovedAt: null,
|
|
124
|
+
decisionEvents: [],
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
const daysToDeprecatedAt = input.deprecatedAt
|
|
128
|
+
? daysBetween(today, new Date(input.deprecatedAt))
|
|
129
|
+
: null;
|
|
130
|
+
const daysToRemovedAt = input.removedAt ? daysBetween(today, new Date(input.removedAt)) : null;
|
|
131
|
+
// Removed — strongest signal. Always emit migration task.
|
|
132
|
+
if (daysToRemovedAt !== null && daysToRemovedAt <= 0) {
|
|
133
|
+
const dedupKey = buildDedupKey('embedding-provider-removed', input.adapterName, input.deprecatedAt, null);
|
|
134
|
+
return {
|
|
135
|
+
phase: 'removed',
|
|
136
|
+
effectiveGracePeriodDays,
|
|
137
|
+
daysToDeprecatedAt,
|
|
138
|
+
daysToRemovedAt,
|
|
139
|
+
decisionEvents: [
|
|
140
|
+
{
|
|
141
|
+
decisionType: 'embedding-provider-removed',
|
|
142
|
+
dedupKey,
|
|
143
|
+
severity: 'high',
|
|
144
|
+
summary: `Embedding adapter '${input.adapterName}' was removed on ${input.removedAt}. ` +
|
|
145
|
+
`Downstream consumers degrade gracefully (no pipeline halt). ` +
|
|
146
|
+
(input.replacementAlias
|
|
147
|
+
? `Migrate via: cli-embedding-bump --to ${input.replacementAlias}`
|
|
148
|
+
: 'No replacement alias declared.'),
|
|
149
|
+
milestoneDaysBefore: null,
|
|
150
|
+
autoAction: 'emit-migration-task',
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
// Deprecated — past deprecatedAt but before removedAt.
|
|
156
|
+
if (daysToDeprecatedAt !== null && daysToDeprecatedAt <= 0) {
|
|
157
|
+
const severity = input.strictModeAtDeprecatedAt ? 'high' : 'info';
|
|
158
|
+
const dedupKey = buildDedupKey('embedding-provider-deprecated', input.adapterName, input.deprecatedAt,
|
|
159
|
+
// Post-deprecatedAt: dedup on "phase-deprecated" rather than a milestone.
|
|
160
|
+
// Use a sentinel value (0) so future loads with the same key stay deduped.
|
|
161
|
+
0);
|
|
162
|
+
return {
|
|
163
|
+
phase: 'deprecated',
|
|
164
|
+
effectiveGracePeriodDays,
|
|
165
|
+
daysToDeprecatedAt,
|
|
166
|
+
daysToRemovedAt,
|
|
167
|
+
decisionEvents: [
|
|
168
|
+
{
|
|
169
|
+
decisionType: 'embedding-provider-deprecated',
|
|
170
|
+
dedupKey,
|
|
171
|
+
severity,
|
|
172
|
+
summary: `Embedding adapter '${input.adapterName}' was deprecated on ${input.deprecatedAt}. ` +
|
|
173
|
+
(input.replacementAlias
|
|
174
|
+
? `Run: cli-embedding-bump --to ${input.replacementAlias}`
|
|
175
|
+
: 'No replacement alias declared.'),
|
|
176
|
+
milestoneDaysBefore: 0,
|
|
177
|
+
autoAction: null,
|
|
178
|
+
},
|
|
179
|
+
],
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
// Warning period — today ∈ [deprecatedAt - gracePeriod, deprecatedAt).
|
|
183
|
+
if (daysToDeprecatedAt !== null &&
|
|
184
|
+
daysToDeprecatedAt > 0 &&
|
|
185
|
+
daysToDeprecatedAt <= effectiveGracePeriodDays) {
|
|
186
|
+
const milestone = nextDueMilestone(daysToDeprecatedAt);
|
|
187
|
+
if (milestone === null) {
|
|
188
|
+
// We are inside the warning window but BEFORE the largest milestone (89d).
|
|
189
|
+
// No event to emit yet.
|
|
190
|
+
return {
|
|
191
|
+
phase: 'warning',
|
|
192
|
+
effectiveGracePeriodDays,
|
|
193
|
+
daysToDeprecatedAt,
|
|
194
|
+
daysToRemovedAt,
|
|
195
|
+
decisionEvents: [],
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
const dedupKey = buildDedupKey('embedding-provider-deprecated', input.adapterName, input.deprecatedAt, milestone);
|
|
199
|
+
return {
|
|
200
|
+
phase: 'warning',
|
|
201
|
+
effectiveGracePeriodDays,
|
|
202
|
+
daysToDeprecatedAt,
|
|
203
|
+
daysToRemovedAt,
|
|
204
|
+
decisionEvents: [
|
|
205
|
+
{
|
|
206
|
+
decisionType: 'embedding-provider-deprecated',
|
|
207
|
+
dedupKey,
|
|
208
|
+
severity: 'info',
|
|
209
|
+
summary: `Embedding adapter '${input.adapterName}' will be deprecated on ${input.deprecatedAt} ` +
|
|
210
|
+
`(${daysToDeprecatedAt} days, milestone ${milestone}d). ` +
|
|
211
|
+
(input.replacementAlias
|
|
212
|
+
? `Migrate via: cli-embedding-bump --to ${input.replacementAlias}`
|
|
213
|
+
: 'No replacement alias declared.'),
|
|
214
|
+
milestoneDaysBefore: milestone,
|
|
215
|
+
autoAction: null,
|
|
216
|
+
},
|
|
217
|
+
],
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
// Pre-warning — today is more than `gracePeriodDays` before deprecatedAt.
|
|
221
|
+
return {
|
|
222
|
+
phase: 'pre-warning',
|
|
223
|
+
effectiveGracePeriodDays,
|
|
224
|
+
daysToDeprecatedAt,
|
|
225
|
+
daysToRemovedAt,
|
|
226
|
+
decisionEvents: [],
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
//# sourceMappingURL=deprecation.js.map
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error classes for the embedding adapter framework per RFC-0019 §11.
|
|
3
|
+
*
|
|
4
|
+
* Error hierarchy:
|
|
5
|
+
* EmbeddingError (base)
|
|
6
|
+
* ├── UnknownEmbeddingProvider — registry miss (fail-fast at pipeline-load)
|
|
7
|
+
* ├── EmbeddingProviderUnavailable — isAvailable() returned false
|
|
8
|
+
* ├── EmbeddingProviderError — upstream API error during embed()
|
|
9
|
+
* ├── EmbeddingDimensionMismatch — vector length != adapter.dimensions
|
|
10
|
+
* ├── EmbeddingModelDeprecating — deprecation warning (not fatal)
|
|
11
|
+
* ├── EmbeddingModelDeprecated — deprecated error (fatal in strict mode)
|
|
12
|
+
* └── EmbeddingModelRemoved — past removedAt (always fatal)
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Base class for all embedding framework errors.
|
|
16
|
+
*/
|
|
17
|
+
export declare class EmbeddingError extends Error {
|
|
18
|
+
constructor(message: string);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Thrown by getEmbeddingAdapter() when the requested adapter name
|
|
22
|
+
* is not present in the registry. Pipeline-load fails with this error
|
|
23
|
+
* so operator typos are caught at load time, not at first embed() call.
|
|
24
|
+
*/
|
|
25
|
+
export declare class UnknownEmbeddingProvider extends EmbeddingError {
|
|
26
|
+
readonly requestedName: string;
|
|
27
|
+
readonly availableNames: string[];
|
|
28
|
+
constructor(requestedName: string, availableNames: string[]);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Thrown by the orchestrator when adapter.isAvailable() returns { available: false }.
|
|
32
|
+
* Pipeline-load fails with this error naming the reason and detail from the probe.
|
|
33
|
+
*/
|
|
34
|
+
export declare class EmbeddingProviderUnavailable extends EmbeddingError {
|
|
35
|
+
readonly adapterName: string;
|
|
36
|
+
readonly reason: string;
|
|
37
|
+
readonly detail?: string | undefined;
|
|
38
|
+
constructor(adapterName: string, reason: string, detail?: string | undefined);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Thrown by adapter.embed() when the upstream API returns an error.
|
|
42
|
+
* Wraps the provider-specific error detail for operator-facing diagnostics.
|
|
43
|
+
*/
|
|
44
|
+
export declare class EmbeddingProviderError extends EmbeddingError {
|
|
45
|
+
readonly adapterName: string;
|
|
46
|
+
readonly detail: string;
|
|
47
|
+
constructor(adapterName: string, detail: string, cause?: unknown);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Thrown when the vector returned by embed() has a different length than
|
|
51
|
+
* adapter.dimensions. Indicates an adapter implementation bug or provider
|
|
52
|
+
* configuration drift.
|
|
53
|
+
*/
|
|
54
|
+
export declare class EmbeddingDimensionMismatch extends EmbeddingError {
|
|
55
|
+
readonly adapterName: string;
|
|
56
|
+
readonly expectedDimensions: number;
|
|
57
|
+
readonly actualDimensions: number;
|
|
58
|
+
constructor(adapterName: string, expectedDimensions: number, actualDimensions: number);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Emitted as a warning (not thrown) when today is within 90 days of adapter.deprecatedAt.
|
|
62
|
+
* Adapter still functions normally during the warning period.
|
|
63
|
+
*/
|
|
64
|
+
export declare class EmbeddingModelDeprecating extends EmbeddingError {
|
|
65
|
+
readonly adapterName: string;
|
|
66
|
+
readonly deprecatedAt: string;
|
|
67
|
+
readonly replacementAlias?: string | undefined;
|
|
68
|
+
constructor(adapterName: string, deprecatedAt: string, replacementAlias?: string | undefined);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Thrown when today >= adapter.deprecatedAt (in strict mode) or emitted as a
|
|
72
|
+
* warning (in default mode). Adapter still functions in non-strict mode.
|
|
73
|
+
*/
|
|
74
|
+
export declare class EmbeddingModelDeprecated extends EmbeddingError {
|
|
75
|
+
readonly adapterName: string;
|
|
76
|
+
readonly deprecatedAt: string;
|
|
77
|
+
readonly replacementAlias?: string | undefined;
|
|
78
|
+
constructor(adapterName: string, deprecatedAt: string, replacementAlias?: string | undefined);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Always fatal. Thrown when today >= adapter.removedAt.
|
|
82
|
+
* Pipeline-load fails and the operator MUST run cli-embedding-bump to migrate.
|
|
83
|
+
*/
|
|
84
|
+
export declare class EmbeddingModelRemoved extends EmbeddingError {
|
|
85
|
+
readonly adapterName: string;
|
|
86
|
+
readonly removedAt: string;
|
|
87
|
+
readonly replacementAlias?: string | undefined;
|
|
88
|
+
constructor(adapterName: string, removedAt: string, replacementAlias?: string | undefined);
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error classes for the embedding adapter framework per RFC-0019 §11.
|
|
3
|
+
*
|
|
4
|
+
* Error hierarchy:
|
|
5
|
+
* EmbeddingError (base)
|
|
6
|
+
* ├── UnknownEmbeddingProvider — registry miss (fail-fast at pipeline-load)
|
|
7
|
+
* ├── EmbeddingProviderUnavailable — isAvailable() returned false
|
|
8
|
+
* ├── EmbeddingProviderError — upstream API error during embed()
|
|
9
|
+
* ├── EmbeddingDimensionMismatch — vector length != adapter.dimensions
|
|
10
|
+
* ├── EmbeddingModelDeprecating — deprecation warning (not fatal)
|
|
11
|
+
* ├── EmbeddingModelDeprecated — deprecated error (fatal in strict mode)
|
|
12
|
+
* └── EmbeddingModelRemoved — past removedAt (always fatal)
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Base class for all embedding framework errors.
|
|
16
|
+
*/
|
|
17
|
+
export class EmbeddingError extends Error {
|
|
18
|
+
constructor(message) {
|
|
19
|
+
super(message);
|
|
20
|
+
this.name = 'EmbeddingError';
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Thrown by getEmbeddingAdapter() when the requested adapter name
|
|
25
|
+
* is not present in the registry. Pipeline-load fails with this error
|
|
26
|
+
* so operator typos are caught at load time, not at first embed() call.
|
|
27
|
+
*/
|
|
28
|
+
export class UnknownEmbeddingProvider extends EmbeddingError {
|
|
29
|
+
requestedName;
|
|
30
|
+
availableNames;
|
|
31
|
+
constructor(requestedName, availableNames) {
|
|
32
|
+
super(`Unknown embedding provider '${requestedName}'. ` +
|
|
33
|
+
`Available providers: [${availableNames.join(', ')}]. ` +
|
|
34
|
+
`Register the adapter in orchestrator/src/embedding/registry.ts or check your spelling.`);
|
|
35
|
+
this.requestedName = requestedName;
|
|
36
|
+
this.availableNames = availableNames;
|
|
37
|
+
this.name = 'UnknownEmbeddingProvider';
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Thrown by the orchestrator when adapter.isAvailable() returns { available: false }.
|
|
42
|
+
* Pipeline-load fails with this error naming the reason and detail from the probe.
|
|
43
|
+
*/
|
|
44
|
+
export class EmbeddingProviderUnavailable extends EmbeddingError {
|
|
45
|
+
adapterName;
|
|
46
|
+
reason;
|
|
47
|
+
detail;
|
|
48
|
+
constructor(adapterName, reason, detail) {
|
|
49
|
+
super(`Embedding provider '${adapterName}' is unavailable (reason: ${reason}).` +
|
|
50
|
+
(detail ? ` ${detail}` : ''));
|
|
51
|
+
this.adapterName = adapterName;
|
|
52
|
+
this.reason = reason;
|
|
53
|
+
this.detail = detail;
|
|
54
|
+
this.name = 'EmbeddingProviderUnavailable';
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Thrown by adapter.embed() when the upstream API returns an error.
|
|
59
|
+
* Wraps the provider-specific error detail for operator-facing diagnostics.
|
|
60
|
+
*/
|
|
61
|
+
export class EmbeddingProviderError extends EmbeddingError {
|
|
62
|
+
adapterName;
|
|
63
|
+
detail;
|
|
64
|
+
constructor(adapterName, detail, cause) {
|
|
65
|
+
super(`Embedding provider '${adapterName}' returned an error: ${detail}`);
|
|
66
|
+
this.adapterName = adapterName;
|
|
67
|
+
this.detail = detail;
|
|
68
|
+
this.name = 'EmbeddingProviderError';
|
|
69
|
+
if (cause) {
|
|
70
|
+
this.cause = cause;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Thrown when the vector returned by embed() has a different length than
|
|
76
|
+
* adapter.dimensions. Indicates an adapter implementation bug or provider
|
|
77
|
+
* configuration drift.
|
|
78
|
+
*/
|
|
79
|
+
export class EmbeddingDimensionMismatch extends EmbeddingError {
|
|
80
|
+
adapterName;
|
|
81
|
+
expectedDimensions;
|
|
82
|
+
actualDimensions;
|
|
83
|
+
constructor(adapterName, expectedDimensions, actualDimensions) {
|
|
84
|
+
super(`Dimension mismatch for adapter '${adapterName}': ` +
|
|
85
|
+
`expected ${expectedDimensions} dimensions but got ${actualDimensions}. ` +
|
|
86
|
+
`This indicates a provider configuration change or adapter implementation bug.`);
|
|
87
|
+
this.adapterName = adapterName;
|
|
88
|
+
this.expectedDimensions = expectedDimensions;
|
|
89
|
+
this.actualDimensions = actualDimensions;
|
|
90
|
+
this.name = 'EmbeddingDimensionMismatch';
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Emitted as a warning (not thrown) when today is within 90 days of adapter.deprecatedAt.
|
|
95
|
+
* Adapter still functions normally during the warning period.
|
|
96
|
+
*/
|
|
97
|
+
export class EmbeddingModelDeprecating extends EmbeddingError {
|
|
98
|
+
adapterName;
|
|
99
|
+
deprecatedAt;
|
|
100
|
+
replacementAlias;
|
|
101
|
+
constructor(adapterName, deprecatedAt, replacementAlias) {
|
|
102
|
+
super(`Embedding adapter '${adapterName}' will be deprecated on ${deprecatedAt}. ` +
|
|
103
|
+
(replacementAlias
|
|
104
|
+
? `Migrate to '${replacementAlias}' using: cli-embedding-bump --to ${replacementAlias}`
|
|
105
|
+
: 'No replacement alias declared — check the adapter documentation.'));
|
|
106
|
+
this.adapterName = adapterName;
|
|
107
|
+
this.deprecatedAt = deprecatedAt;
|
|
108
|
+
this.replacementAlias = replacementAlias;
|
|
109
|
+
this.name = 'EmbeddingModelDeprecating';
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Thrown when today >= adapter.deprecatedAt (in strict mode) or emitted as a
|
|
114
|
+
* warning (in default mode). Adapter still functions in non-strict mode.
|
|
115
|
+
*/
|
|
116
|
+
export class EmbeddingModelDeprecated extends EmbeddingError {
|
|
117
|
+
adapterName;
|
|
118
|
+
deprecatedAt;
|
|
119
|
+
replacementAlias;
|
|
120
|
+
constructor(adapterName, deprecatedAt, replacementAlias) {
|
|
121
|
+
super(`Embedding adapter '${adapterName}' was deprecated on ${deprecatedAt}. ` +
|
|
122
|
+
(replacementAlias
|
|
123
|
+
? `Run: cli-embedding-bump --to ${replacementAlias}`
|
|
124
|
+
: 'No replacement alias declared — check the adapter documentation.'));
|
|
125
|
+
this.adapterName = adapterName;
|
|
126
|
+
this.deprecatedAt = deprecatedAt;
|
|
127
|
+
this.replacementAlias = replacementAlias;
|
|
128
|
+
this.name = 'EmbeddingModelDeprecated';
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Always fatal. Thrown when today >= adapter.removedAt.
|
|
133
|
+
* Pipeline-load fails and the operator MUST run cli-embedding-bump to migrate.
|
|
134
|
+
*/
|
|
135
|
+
export class EmbeddingModelRemoved extends EmbeddingError {
|
|
136
|
+
adapterName;
|
|
137
|
+
removedAt;
|
|
138
|
+
replacementAlias;
|
|
139
|
+
constructor(adapterName, removedAt, replacementAlias) {
|
|
140
|
+
super(`Embedding adapter '${adapterName}' was removed on ${removedAt} and can no longer be used. ` +
|
|
141
|
+
(replacementAlias
|
|
142
|
+
? `Migrate by running: cli-embedding-bump --to ${replacementAlias}`
|
|
143
|
+
: 'No replacement alias declared — check the adapter documentation.'));
|
|
144
|
+
this.adapterName = adapterName;
|
|
145
|
+
this.removedAt = removedAt;
|
|
146
|
+
this.replacementAlias = replacementAlias;
|
|
147
|
+
this.name = 'EmbeddingModelRemoved';
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Embedding adapter framework per RFC-0019.
|
|
3
|
+
* Phase 1: interface + registry + OpenAI default adapter + errors.
|
|
4
|
+
* Phase 2: vector storage backend + JSONL default + backend factory + GC.
|
|
5
|
+
* Phase 3: stale-vector policy, cross-provider compatibility, deprecation
|
|
6
|
+
* lifecycle (AISDLC-339). Migration tooling itself lives in
|
|
7
|
+
* `pipeline-cli/src/cli/embedding-bump.ts`.
|
|
8
|
+
* Phase 4 (AISDLC-340): pipeline-load wiring + first-consumer (Eτ drift) spec stub.
|
|
9
|
+
*
|
|
10
|
+
* Phase 5 (soak) ships in AISDLC-341.
|
|
11
|
+
*/
|
|
12
|
+
export type { EmbeddingAdapter, EmbeddingAvailability, EmbeddingCapabilities, EmbeddingRequires, EmbeddingBillingModel, EmbeddingCostRecord, } from './types.js';
|
|
13
|
+
export { EmbeddingError, UnknownEmbeddingProvider, EmbeddingProviderUnavailable, EmbeddingProviderError, EmbeddingDimensionMismatch, EmbeddingModelDeprecating, EmbeddingModelDeprecated, EmbeddingModelRemoved, } from './errors.js';
|
|
14
|
+
export { getEmbeddingAdapter, registerEmbeddingAdapter, hasEmbeddingAdapter, listEmbeddingAdapters, } from './registry.js';
|
|
15
|
+
export { OpenAITextEmbedding3Small } from './adapters/openai-text-embedding-3-small.js';
|
|
16
|
+
export type { EmbeddingCostCallback } from './adapters/openai-text-embedding-3-small.js';
|
|
17
|
+
export type { EmbeddingStorageBackend, EmbeddingStaleVectorPolicy, VectorStoreEntry, VectorStoreFilter, } from './storage/types.js';
|
|
18
|
+
export { JsonlEmbeddingStorageBackend, SCALE_ESCALATION_MAX_ENTRIES, SCALE_ESCALATION_P95_READ_MS, createEmbeddingStorageBackend, } from './storage/index.js';
|
|
19
|
+
export type { ScaleEscalationSignal, StorageBackendName, StorageBackendOptions, } from './storage/index.js';
|
|
20
|
+
export type { StaleVectorPolicy, StaleVectorPolicyInput, StaleVectorContext, StaleVectorDecisionSeverity, } from './stale-vector.js';
|
|
21
|
+
export { FRAMEWORK_DEFAULT_STALE_VECTOR_POLICY, resolveStaleVectorPolicy, severityForPolicy, isCurrentVector, StaleVectorEncountered, } from './stale-vector.js';
|
|
22
|
+
export type { ProviderCompatibility, CrossProviderDecisionPayload } from './cross-provider.js';
|
|
23
|
+
export { checkProviderCompatibility, CrossProviderComparisonError, buildCrossProviderDecisionPayload, } from './cross-provider.js';
|
|
24
|
+
export type { DeprecationLifecycleInput, DeprecationLifecycleResult, DeprecationDecisionEvent, DeprecationPhase, } from './deprecation.js';
|
|
25
|
+
export { FRAMEWORK_DEFAULT_GRACE_PERIOD_DAYS, DEPRECATION_MILESTONE_DAYS, resolveGracePeriodDays, nextDueMilestone, buildDedupKey, evaluateDeprecationLifecycle, } from './deprecation.js';
|
|
26
|
+
export { loadEmbeddingFromPipelineSpec, isEmbeddingFrameworkEnabled, resolveEffectiveGracePeriodDays, EMBEDDING_DEFAULTS, } from './pipeline-load.js';
|
|
27
|
+
export type { EmbeddingSpecInput, ResolvedEmbedding, LoadEmbeddingOptions, DeprecationWarningEvent, } from './pipeline-load.js';
|
|
28
|
+
export { TESSELLATION_DRIFT_CONSUMER_LABEL, TESSELLATION_DRIFT_STALE_VECTOR_POLICY, TESSELLATION_DRIFT_CONSUMER, embedDriftSignal, } from './consumers/tessellation-drift.js';
|
|
29
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Embedding adapter framework per RFC-0019.
|
|
3
|
+
* Phase 1: interface + registry + OpenAI default adapter + errors.
|
|
4
|
+
* Phase 2: vector storage backend + JSONL default + backend factory + GC.
|
|
5
|
+
* Phase 3: stale-vector policy, cross-provider compatibility, deprecation
|
|
6
|
+
* lifecycle (AISDLC-339). Migration tooling itself lives in
|
|
7
|
+
* `pipeline-cli/src/cli/embedding-bump.ts`.
|
|
8
|
+
* Phase 4 (AISDLC-340): pipeline-load wiring + first-consumer (Eτ drift) spec stub.
|
|
9
|
+
*
|
|
10
|
+
* Phase 5 (soak) ships in AISDLC-341.
|
|
11
|
+
*/
|
|
12
|
+
export { EmbeddingError, UnknownEmbeddingProvider, EmbeddingProviderUnavailable, EmbeddingProviderError, EmbeddingDimensionMismatch, EmbeddingModelDeprecating, EmbeddingModelDeprecated, EmbeddingModelRemoved, } from './errors.js';
|
|
13
|
+
export { getEmbeddingAdapter, registerEmbeddingAdapter, hasEmbeddingAdapter, listEmbeddingAdapters, } from './registry.js';
|
|
14
|
+
export { OpenAITextEmbedding3Small } from './adapters/openai-text-embedding-3-small.js';
|
|
15
|
+
export { JsonlEmbeddingStorageBackend, SCALE_ESCALATION_MAX_ENTRIES, SCALE_ESCALATION_P95_READ_MS, createEmbeddingStorageBackend, } from './storage/index.js';
|
|
16
|
+
export { FRAMEWORK_DEFAULT_STALE_VECTOR_POLICY, resolveStaleVectorPolicy, severityForPolicy, isCurrentVector, StaleVectorEncountered, } from './stale-vector.js';
|
|
17
|
+
export { checkProviderCompatibility, CrossProviderComparisonError, buildCrossProviderDecisionPayload, } from './cross-provider.js';
|
|
18
|
+
export { FRAMEWORK_DEFAULT_GRACE_PERIOD_DAYS, DEPRECATION_MILESTONE_DAYS, resolveGracePeriodDays, nextDueMilestone, buildDedupKey, evaluateDeprecationLifecycle, } from './deprecation.js';
|
|
19
|
+
// Phase 4 (AISDLC-340): pipeline-load wiring per RFC-0019 §10.1.
|
|
20
|
+
export { loadEmbeddingFromPipelineSpec, isEmbeddingFrameworkEnabled, resolveEffectiveGracePeriodDays, EMBEDDING_DEFAULTS, } from './pipeline-load.js';
|
|
21
|
+
// Phase 4 (AISDLC-340): first downstream consumer spec stub
|
|
22
|
+
// (RFC-0009 Eτ_tessellation_drift — runtime usage activates when AISDLC-317 ships).
|
|
23
|
+
export { TESSELLATION_DRIFT_CONSUMER_LABEL, TESSELLATION_DRIFT_STALE_VECTOR_POLICY, TESSELLATION_DRIFT_CONSUMER, embedDriftSignal, } from './consumers/tessellation-drift.js';
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pipeline-load wiring for RFC-0019 §10.1 / Phase 4 (AISDLC-340).
|
|
3
|
+
*
|
|
4
|
+
* Resolves `Pipeline.spec.embedding` → adapter (via registry) + storage
|
|
5
|
+
* backend (via factory). This is the single entry point pipeline loaders
|
|
6
|
+
* call when constructing the embedding substrate for a pipeline run.
|
|
7
|
+
*
|
|
8
|
+
* Feature-flag semantics:
|
|
9
|
+
* AI_SDLC_EMBEDDING_PROVIDER=on → load per spec
|
|
10
|
+
* anything else / unset → return null (framework disabled)
|
|
11
|
+
*
|
|
12
|
+
* When the flag is off AND a spec is present, callers SHOULD log a
|
|
13
|
+
* warning so misconfiguration is visible — done here via the optional
|
|
14
|
+
* `onFlagOffWithSpec` callback so the orchestrator can route the
|
|
15
|
+
* warning through its own logging surface (events.jsonl, console, etc.).
|
|
16
|
+
*
|
|
17
|
+
* Errors:
|
|
18
|
+
* - Unknown adapter name → `UnknownEmbeddingProvider`
|
|
19
|
+
* - Unknown storage backend → bare `Error` from the storage factory
|
|
20
|
+
* - Adapter is deprecated/removed → re-thrown from the deprecation
|
|
21
|
+
* gate; pipeline-load aborts so operators see the failure at load
|
|
22
|
+
* time, not at first embed().
|
|
23
|
+
*
|
|
24
|
+
* Tests: `pipeline-load.test.ts`
|
|
25
|
+
*/
|
|
26
|
+
import type { EmbeddingStorageBackend } from './storage/types.js';
|
|
27
|
+
import type { EmbeddingAdapter } from './types.js';
|
|
28
|
+
/**
|
|
29
|
+
* Minimal subset of `Pipeline.spec.embedding` that pipeline-load reads.
|
|
30
|
+
* Defined here (rather than imported from `@ai-sdlc/reference`) to avoid
|
|
31
|
+
* a circular dependency — orchestrator already depends on reference,
|
|
32
|
+
* and reference must not depend on orchestrator.
|
|
33
|
+
*/
|
|
34
|
+
export interface EmbeddingSpecInput {
|
|
35
|
+
provider: string;
|
|
36
|
+
fallback?: string;
|
|
37
|
+
storageBackend?: string;
|
|
38
|
+
storageBackendConfig?: Record<string, unknown>;
|
|
39
|
+
staleVectorPolicy?: 'lazy-re-embed' | 'fail-loud' | 'warn';
|
|
40
|
+
autoEmbedOnWrite?: boolean;
|
|
41
|
+
maxBatchSize?: number;
|
|
42
|
+
deprecationOverrides?: {
|
|
43
|
+
gracePeriodDays?: number;
|
|
44
|
+
strictModeAtDeprecatedAt?: boolean;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Resolved embedding substrate returned by `loadEmbeddingFromPipelineSpec()`.
|
|
49
|
+
*
|
|
50
|
+
* Callers wire `adapter` into their embed() call sites and `storage` into
|
|
51
|
+
* their write/read paths. `staleVectorPolicy` is the per-org default;
|
|
52
|
+
* consumers MAY override at the API site per OQ-2 re-walkthrough.
|
|
53
|
+
*/
|
|
54
|
+
export interface ResolvedEmbedding {
|
|
55
|
+
adapter: EmbeddingAdapter;
|
|
56
|
+
/** Resolved fallback adapter (when distinct from primary). */
|
|
57
|
+
fallbackAdapter?: EmbeddingAdapter;
|
|
58
|
+
storage: EmbeddingStorageBackend;
|
|
59
|
+
/** Per-org default; consumers may pin a stricter policy at the API site. */
|
|
60
|
+
staleVectorPolicy: 'lazy-re-embed' | 'fail-loud' | 'warn';
|
|
61
|
+
autoEmbedOnWrite: boolean;
|
|
62
|
+
maxBatchSize: number;
|
|
63
|
+
}
|
|
64
|
+
/** Default values applied when fields are omitted from the spec. */
|
|
65
|
+
export declare const EMBEDDING_DEFAULTS: {
|
|
66
|
+
readonly storageBackend: "jsonl";
|
|
67
|
+
readonly staleVectorPolicy: "lazy-re-embed";
|
|
68
|
+
readonly autoEmbedOnWrite: true;
|
|
69
|
+
readonly maxBatchSize: 2048;
|
|
70
|
+
/** Framework default; adapter MAY declare a different defaultGracePeriodDays. */
|
|
71
|
+
readonly gracePeriodDays: 90;
|
|
72
|
+
};
|
|
73
|
+
/** Options for the loader. */
|
|
74
|
+
export interface LoadEmbeddingOptions {
|
|
75
|
+
/**
|
|
76
|
+
* Path to the artifacts directory. Used by the storage backend factory.
|
|
77
|
+
* Defaults to `process.env.ARTIFACTS_DIR ?? '.ai-sdlc/artifacts'`.
|
|
78
|
+
*/
|
|
79
|
+
artifactsDir?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Today, for deprecation-window math. Defaults to `new Date()`.
|
|
82
|
+
* Tests inject a fixed date so deprecation-gate behaviour is hermetic.
|
|
83
|
+
*/
|
|
84
|
+
now?: Date;
|
|
85
|
+
/**
|
|
86
|
+
* Called when `AI_SDLC_EMBEDDING_PROVIDER` is OFF but a non-null spec
|
|
87
|
+
* was passed. Lets the orchestrator route the warning to events.jsonl
|
|
88
|
+
* or another logging surface without coupling the loader to a logger.
|
|
89
|
+
*/
|
|
90
|
+
onFlagOffWithSpec?: (spec: EmbeddingSpecInput) => void;
|
|
91
|
+
/**
|
|
92
|
+
* Called when a deprecation WARNING fires (between adapter's effective
|
|
93
|
+
* `(deprecatedAt − gracePeriodDays)` and `deprecatedAt`). Operators
|
|
94
|
+
* SHOULD route this to the Decision catalog with milestone dedup.
|
|
95
|
+
*/
|
|
96
|
+
onDeprecationWarning?: (event: DeprecationWarningEvent) => void;
|
|
97
|
+
}
|
|
98
|
+
/** Event surfaced by the deprecation gate during the warning window. */
|
|
99
|
+
export interface DeprecationWarningEvent {
|
|
100
|
+
adapterName: string;
|
|
101
|
+
deprecatedAt: string;
|
|
102
|
+
removedAt?: string;
|
|
103
|
+
replacementAlias?: string;
|
|
104
|
+
daysUntilDeprecated: number;
|
|
105
|
+
/** Effective gracePeriodDays after applying three-layer precedence. */
|
|
106
|
+
effectiveGracePeriodDays: number;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* `AI_SDLC_EMBEDDING_PROVIDER` flag parser. Mirrors the
|
|
110
|
+
* `AI_SDLC_DEPS_COMPOSITION` and `AI_SDLC_AUTONOMOUS_ORCHESTRATOR` patterns:
|
|
111
|
+
* truthy = `1|true|yes|on` (case-insensitive); anything else (including
|
|
112
|
+
* unset) is OFF.
|
|
113
|
+
*/
|
|
114
|
+
export declare function isEmbeddingFrameworkEnabled(env?: NodeJS.ProcessEnv): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Resolve `(adapter, storage, policy)` from a pipeline spec.
|
|
117
|
+
*
|
|
118
|
+
* Returns `null` when the framework is disabled — by feature flag OR by
|
|
119
|
+
* absent spec. Callers SHOULD treat null as "no embedding substrate
|
|
120
|
+
* available" and let consumers emit `EmbeddingProviderNotConfigured`.
|
|
121
|
+
*
|
|
122
|
+
* Throws on:
|
|
123
|
+
* - unknown adapter (`UnknownEmbeddingProvider`)
|
|
124
|
+
* - unknown storage backend (bare `Error`)
|
|
125
|
+
* - adapter past `removedAt` (`EmbeddingModelRemoved`)
|
|
126
|
+
* - adapter past `deprecatedAt` in strict mode (`EmbeddingModelDeprecated`)
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* const substrate = loadEmbeddingFromPipelineSpec(
|
|
130
|
+
* pipeline.spec.embedding,
|
|
131
|
+
* { artifactsDir: '/repo/.ai-sdlc/artifacts' },
|
|
132
|
+
* );
|
|
133
|
+
* if (substrate) {
|
|
134
|
+
* const vec = await substrate.adapter.embed('hello', 'rfc-0009-tessellation-drift');
|
|
135
|
+
* await substrate.storage.write({ ... });
|
|
136
|
+
* }
|
|
137
|
+
*/
|
|
138
|
+
export declare function loadEmbeddingFromPipelineSpec(spec: EmbeddingSpecInput | null | undefined, options?: LoadEmbeddingOptions): ResolvedEmbedding | null;
|
|
139
|
+
/**
|
|
140
|
+
* Three-layer precedence per OQ-4 re-walkthrough:
|
|
141
|
+
* framework default (90d) → adapter.defaultGracePeriodDays → per-org override
|
|
142
|
+
*
|
|
143
|
+
* Returned value is the effective grace period in days for THIS load.
|
|
144
|
+
*/
|
|
145
|
+
export declare function resolveEffectiveGracePeriodDays(adapter: EmbeddingAdapter, spec: EmbeddingSpecInput): number;
|
|
146
|
+
//# sourceMappingURL=pipeline-load.d.ts.map
|