@aiwayds/dsh-model-sync 0.8.0 → 0.10.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/LICENSE +202 -0
- package/README.md +9 -4
- package/README.zh-CN.md +9 -4
- package/lib/builtin-catalog-snapshot.d.ts +5 -1
- package/lib/builtin-catalog-snapshot.js +13 -10
- package/lib/builtin-catalog-snapshot.js.map +1 -1
- package/lib/index.d.ts +366 -0
- package/lib/index.js +729 -13
- package/lib/index.js.map +1 -1
- package/lib/opencode-go-diagnose.d.ts +74 -0
- package/lib/opencode-go-diagnose.js +146 -0
- package/lib/opencode-go-diagnose.js.map +1 -0
- package/lib/opencode-go-grouping.d.ts +29 -0
- package/lib/opencode-go-grouping.js +77 -0
- package/lib/opencode-go-grouping.js.map +1 -0
- package/lib/opencode-go-journal.d.ts +110 -0
- package/lib/opencode-go-journal.js +406 -0
- package/lib/opencode-go-journal.js.map +1 -0
- package/lib/opencode-go-migrate.d.ts +343 -0
- package/lib/opencode-go-migrate.js +1300 -0
- package/lib/opencode-go-migrate.js.map +1 -0
- package/lib/opencode-go-migration.d.ts +227 -0
- package/lib/opencode-go-migration.js +384 -0
- package/lib/opencode-go-migration.js.map +1 -0
- package/lib/opencode-go-planner.d.ts +153 -0
- package/lib/opencode-go-planner.js +339 -0
- package/lib/opencode-go-planner.js.map +1 -0
- package/lib/opencode-go-profile.d.ts +57 -0
- package/lib/opencode-go-profile.js +103 -0
- package/lib/opencode-go-profile.js.map +1 -0
- package/lib/opencode-go-scheduler.d.ts +128 -0
- package/lib/opencode-go-scheduler.js +241 -0
- package/lib/opencode-go-scheduler.js.map +1 -0
- package/lib/opencode-go-source.d.ts +117 -0
- package/lib/opencode-go-source.js +331 -0
- package/lib/opencode-go-source.js.map +1 -0
- package/lib/opencode-go-store.d.ts +18 -0
- package/lib/opencode-go-store.js +68 -0
- package/lib/opencode-go-store.js.map +1 -0
- package/lib/opencode-go-sync.d.ts +94 -0
- package/lib/opencode-go-sync.js +364 -0
- package/lib/opencode-go-sync.js.map +1 -0
- package/lib/opencode-go-writer.d.ts +132 -0
- package/lib/opencode-go-writer.js +966 -0
- package/lib/opencode-go-writer.js.map +1 -0
- package/lib/provider-native.d.ts +3 -1
- package/lib/provider-native.js +4 -2
- package/lib/provider-native.js.map +1 -1
- package/lib/remote-catalog.d.ts +37 -0
- package/lib/remote-catalog.js +261 -3
- package/lib/remote-catalog.js.map +1 -1
- package/package.json +18 -18
- package/src/builtin-catalog-snapshot.ts +18 -11
- package/src/index.ts +873 -12
- package/src/opencode-go-diagnose.ts +222 -0
- package/src/opencode-go-grouping.ts +97 -0
- package/src/opencode-go-journal.ts +458 -0
- package/src/opencode-go-migrate.ts +1694 -0
- package/src/opencode-go-migration.ts +552 -0
- package/src/opencode-go-planner.ts +505 -0
- package/src/opencode-go-profile.ts +114 -0
- package/src/opencode-go-scheduler.ts +315 -0
- package/src/opencode-go-source.ts +424 -0
- package/src/opencode-go-store.ts +73 -0
- package/src/opencode-go-sync.ts +503 -0
- package/src/opencode-go-writer.ts +1189 -0
- package/src/provider-native.ts +3 -1
- package/src/remote-catalog.ts +293 -3
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import { type GoRouteSlot } from './opencode-go-grouping.ts';
|
|
2
|
+
import { type GoManagedModel, type GoPlannedRouteFields } from './opencode-go-planner.ts';
|
|
3
|
+
import type { GoModelRecord } from './opencode-go-source.ts';
|
|
4
|
+
import type { SettingsModelProfile } from './translate.ts';
|
|
5
|
+
import { type MigrationRecord, type MigrationState, type MigrationStateStore, type RouteWriterConfig, type UnclaimedMigrationRecord } from './opencode-go-migration.ts';
|
|
6
|
+
import type { GoOwnershipStore } from './opencode-go-writer.ts';
|
|
7
|
+
import type { GoJournalStore } from './opencode-go-journal.ts';
|
|
8
|
+
import type { Logger, SettingsDescriptor, SettingsService } from './writer.ts';
|
|
9
|
+
/** What apply will do with one route. */
|
|
10
|
+
export type MigrationAction = 'create' | 'update' | 'keep' | 'unset';
|
|
11
|
+
/** Classification of one id that exists in the current route (design §14.2). */
|
|
12
|
+
export type MigrationIdKind = 'desired-chat' | 'desired-msg' | 'desired-resp' | 'desired-google' | 'legacy-other-protocol' | 'unknown-retired' | 'user-extra'
|
|
13
|
+
/** Public catalog unavailable (offline/401/403) — fail-closed, never deleted (§14.2). */
|
|
14
|
+
| 'unclassified';
|
|
15
|
+
export interface MigrationIdClass {
|
|
16
|
+
id: string;
|
|
17
|
+
kind: MigrationIdKind;
|
|
18
|
+
/** Conservative (adopt=false) keeps every existing id; adopt may move/delete. */
|
|
19
|
+
action: 'keep' | 'move' | 'delete' | 'adopt';
|
|
20
|
+
reason: string;
|
|
21
|
+
}
|
|
22
|
+
export interface MigrationDeletion {
|
|
23
|
+
route: string;
|
|
24
|
+
id: string;
|
|
25
|
+
kind: MigrationIdKind;
|
|
26
|
+
/** The three deletion gates (§6.2.4 / ADR-005), reported with the reason. */
|
|
27
|
+
gates: {
|
|
28
|
+
managedHash: string;
|
|
29
|
+
override: string;
|
|
30
|
+
pinned: string;
|
|
31
|
+
};
|
|
32
|
+
/** Only an explicitly confirmed id in adopt mode is actually deleted. */
|
|
33
|
+
willDelete: boolean;
|
|
34
|
+
reason: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* One row of the plan's per-id action table (design §14.2 / 31 B2). This is the
|
|
38
|
+
* SINGLE source of truth consumed by apply: it is hashed into planHash, so a
|
|
39
|
+
* plan and its apply can never disagree. `keep` rows are never destructive.
|
|
40
|
+
*/
|
|
41
|
+
export type MigrationIdActionOp = 'keep' | 'add' | 'update' | 'move' | 'delete';
|
|
42
|
+
export interface MigrationIdPlan {
|
|
43
|
+
id: string;
|
|
44
|
+
op: MigrationIdActionOp;
|
|
45
|
+
/** Route the op operates on (source route for `move`/`delete`). */
|
|
46
|
+
route: string;
|
|
47
|
+
/** Destination route for `move` (the id is removed from `route`). */
|
|
48
|
+
to?: string;
|
|
49
|
+
kind: MigrationIdKind;
|
|
50
|
+
/** True when the id is in pinnedModels — forced `keep`, never moved/deleted. */
|
|
51
|
+
pinned: boolean;
|
|
52
|
+
/** Exact profile to write for add/move. Set on `update` rows as the official
|
|
53
|
+
* target only for the plan's before/after report — apply never writes it. */
|
|
54
|
+
profile?: SettingsModelProfile;
|
|
55
|
+
/** Current profile on an `update` row (user-modified) — for before/after output. */
|
|
56
|
+
before?: SettingsModelProfile;
|
|
57
|
+
/** True iff applying this row puts the id under plugin ownership (managed ledger).
|
|
58
|
+
* `update` and user-owned `keep` rows are false by construction (B6 + user ruling). */
|
|
59
|
+
managed?: boolean;
|
|
60
|
+
reason: string;
|
|
61
|
+
}
|
|
62
|
+
export type RewriteRefMode = 'none' | 'default-model' | 'config';
|
|
63
|
+
/** A reference candidate reported by plan. Only verified config keys may be rewritten. */
|
|
64
|
+
export interface ReferenceCandidate {
|
|
65
|
+
surface: string;
|
|
66
|
+
location: string;
|
|
67
|
+
before: string;
|
|
68
|
+
after: string;
|
|
69
|
+
verified: boolean;
|
|
70
|
+
rewritable: boolean;
|
|
71
|
+
/** Session storage / external config: always report-only (never rewritten). */
|
|
72
|
+
reportOnly: boolean;
|
|
73
|
+
}
|
|
74
|
+
/** A rewrite request that an injected patch accessor can execute (opt-in only). */
|
|
75
|
+
export interface ReferenceRewrite {
|
|
76
|
+
surface: string;
|
|
77
|
+
location: string;
|
|
78
|
+
before: string;
|
|
79
|
+
after: string;
|
|
80
|
+
}
|
|
81
|
+
/** The hashed body of the plan. `planHash`/`confirmCode` are derived, not hashed. */
|
|
82
|
+
export interface MigrationPlanBody {
|
|
83
|
+
version: 1;
|
|
84
|
+
keyFingerprint: string;
|
|
85
|
+
adopt: boolean;
|
|
86
|
+
rewriteRefs: RewriteRefMode;
|
|
87
|
+
/** Fingerprint of the pre-apply go sections — apply refuses if it changed. */
|
|
88
|
+
preFingerprint: string;
|
|
89
|
+
state: MigrationState;
|
|
90
|
+
stateByRoute: Record<string, MigrationState>;
|
|
91
|
+
routes: MigrationPlannedRoute[];
|
|
92
|
+
deletions: MigrationDeletion[];
|
|
93
|
+
/** The complete per-id action table apply executes verbatim (31 B2). */
|
|
94
|
+
idActions: MigrationIdPlan[];
|
|
95
|
+
/** Fixed B6 informed-consent text; hashed into planHash so edits invalidate it. */
|
|
96
|
+
managedAfterMigration: string;
|
|
97
|
+
/** True when the official public catalog was unavailable at plan time. Every
|
|
98
|
+
* non-desired id is then `unclassified` and never deleted (fail-closed). */
|
|
99
|
+
publicCatalogAvailable: boolean;
|
|
100
|
+
/** True when apply cannot guarantee verbatim action-table execution: plan mode
|
|
101
|
+
* is `adopt-disabled` and `--adopt` is rejected at the command layer (§14.2). */
|
|
102
|
+
adoptDisabled: boolean;
|
|
103
|
+
references: ReferenceCandidate[];
|
|
104
|
+
pinnedSuggestions: string[];
|
|
105
|
+
backupPath: string;
|
|
106
|
+
rollbackCommand: string;
|
|
107
|
+
unverified: string[];
|
|
108
|
+
}
|
|
109
|
+
export interface MigrationPlan extends MigrationPlanBody {
|
|
110
|
+
planHash: string;
|
|
111
|
+
confirmCode: string;
|
|
112
|
+
}
|
|
113
|
+
export interface MigrationPlannedRoute {
|
|
114
|
+
slot: GoRouteSlot;
|
|
115
|
+
route: string;
|
|
116
|
+
state: MigrationState;
|
|
117
|
+
action: MigrationAction;
|
|
118
|
+
fields: GoPlannedRouteFields;
|
|
119
|
+
desired: SettingsModelProfile[];
|
|
120
|
+
existing: MigrationIdClass[];
|
|
121
|
+
}
|
|
122
|
+
export interface BuildPlanInput {
|
|
123
|
+
descriptor: SettingsDescriptor | undefined;
|
|
124
|
+
entries: readonly GoModelRecord[];
|
|
125
|
+
routes: Partial<Record<GoRouteSlot, string>>;
|
|
126
|
+
ref: string;
|
|
127
|
+
keyFingerprint: string;
|
|
128
|
+
adopt?: boolean;
|
|
129
|
+
rewriteRefs?: RewriteRefMode;
|
|
130
|
+
record?: MigrationRecord;
|
|
131
|
+
/** Reference candidates from the (offline) reference-surface scan. Report-only by default. */
|
|
132
|
+
references?: ReferenceCandidate[];
|
|
133
|
+
/** go.pinnedModels: ids forced to `keep` (never moved or deleted, 31 B2). */
|
|
134
|
+
pinnedModels?: readonly string[];
|
|
135
|
+
/** Only with this flag may user-extra ids be deleted — and only if plan-listed. */
|
|
136
|
+
pruneUserExtra?: boolean;
|
|
137
|
+
/** Official *public* catalog ids (may include ids the current key cannot use).
|
|
138
|
+
* Ids present here but absent from `entries` are `unknown-retired`; ids in
|
|
139
|
+
* neither set are `user-extra` (user-written, never auto-deleted). `undefined`
|
|
140
|
+
* means the catalog was unavailable → fail-closed `unclassified`. */
|
|
141
|
+
publicCatalogIds?: readonly string[];
|
|
142
|
+
/** Apply cannot execute the per-id table → plan mode `adopt-disabled` and
|
|
143
|
+
* `--adopt` rejected at the command layer (design §14.2 fallback). */
|
|
144
|
+
adoptDisabled?: boolean;
|
|
145
|
+
now: number;
|
|
146
|
+
}
|
|
147
|
+
/** sha256 of canonical JSON — the planHash algorithm (V17: changes with the plan). */
|
|
148
|
+
export declare function hashCanonical(value: unknown): string;
|
|
149
|
+
/** Deterministic 6-digit confirmation code derived from a planHash. */
|
|
150
|
+
export declare function confirmCodeOf(planHash: string): string;
|
|
151
|
+
export declare function planHashOf(body: MigrationPlanBody): string;
|
|
152
|
+
/** The action-table subset both plan-time simulation and apply consume. */
|
|
153
|
+
export interface MigrationActionTable {
|
|
154
|
+
routes: readonly MigrationPlannedRoute[];
|
|
155
|
+
idActions: readonly MigrationIdPlan[];
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* THE single source of truth for the per-route "managed after apply" id set.
|
|
159
|
+
*
|
|
160
|
+
* It simulates the action table against the SAME settings descriptor apply
|
|
161
|
+
* will use, so the ids the plan advertises are exactly the ids apply actually
|
|
162
|
+
* writes or adopts into the ownership ledger. An id already sitting on its
|
|
163
|
+
* target with a user-edited value (an `update` row, or a `move` onto a
|
|
164
|
+
* different-valued target) is NEVER claimed: it is not written, so it must not
|
|
165
|
+
* be advertised as managed anywhere (B6 + user ruling: update never overwrites
|
|
166
|
+
* and never manages).
|
|
167
|
+
*
|
|
168
|
+
* `buildMigrationPlan` derives the informed-consent text from this function,
|
|
169
|
+
* and `applyMigration` derives the ledger `managed` / `appliedManagedIds` from
|
|
170
|
+
* the very same `buildRouteWriteStates` computation, so the four surfaces
|
|
171
|
+
* cannot disagree.
|
|
172
|
+
*/
|
|
173
|
+
export declare function managedIdsAfterApply(table: MigrationActionTable, desc: SettingsDescriptor | undefined): Record<string, string[]>;
|
|
174
|
+
/**
|
|
175
|
+
* Fail-closed guard: any op outside the closed `MigrationIdActionOp` union is
|
|
176
|
+
* rejected before a single write. Returns the first offending row, if any.
|
|
177
|
+
*/
|
|
178
|
+
export declare function findUnknownAction(actions: readonly MigrationIdPlan[]): {
|
|
179
|
+
id: string;
|
|
180
|
+
op: string;
|
|
181
|
+
} | undefined;
|
|
182
|
+
export type ConsentResult = {
|
|
183
|
+
ok: true;
|
|
184
|
+
} | {
|
|
185
|
+
ok: false;
|
|
186
|
+
reason: 'consent-required' | 'plan-hash-mismatch' | 'confirm-code-mismatch' | 'ack-required';
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* The consent gate (V17 + 31 B6). THREE values are mandatory: the matching
|
|
190
|
+
* planHash, the 6-digit confirmCode and `--ack-managed` (acknowledgement of the
|
|
191
|
+
* `[managed-after-migration]` notice). A missing/incorrect value never reaches
|
|
192
|
+
* a write. Deliberately there is no accept-anything branch — `--yes`/`--auto`
|
|
193
|
+
* cannot be expressed.
|
|
194
|
+
*/
|
|
195
|
+
export declare function verifyConsent(plan: MigrationPlan, planHash: string | undefined, confirmCode: string | undefined, ackManaged?: boolean): ConsentResult;
|
|
196
|
+
/** Build the full change plan. Pure: identical inputs → identical plan/hash. */
|
|
197
|
+
export declare function buildMigrationPlan(input: BuildPlanInput): MigrationPlan;
|
|
198
|
+
export declare function formatMigrationPlan(plan: MigrationPlan): string;
|
|
199
|
+
export interface MigrateDeps {
|
|
200
|
+
settings: SettingsService | undefined;
|
|
201
|
+
ownershipStore: GoOwnershipStore;
|
|
202
|
+
migrationStore: MigrationStateStore;
|
|
203
|
+
logger: Logger;
|
|
204
|
+
/** Frozen official listing captured for plan/apply/rollback (no live network here). */
|
|
205
|
+
entries: readonly GoModelRecord[];
|
|
206
|
+
routes: Partial<Record<GoRouteSlot, string>>;
|
|
207
|
+
ref: string;
|
|
208
|
+
keyFingerprint: string;
|
|
209
|
+
adopt?: boolean;
|
|
210
|
+
rewriteRefs?: RewriteRefMode;
|
|
211
|
+
references?: ReferenceCandidate[];
|
|
212
|
+
/** go.pinnedModels: forced `keep` (31 B2). */
|
|
213
|
+
pinnedModels?: readonly string[];
|
|
214
|
+
/** Only with this flag may user-extra ids be deleted — and only if plan-listed. */
|
|
215
|
+
pruneUserExtra?: boolean;
|
|
216
|
+
/** Official public catalog ids, used to distinguish unknown-retired from user-extra.
|
|
217
|
+
* `undefined` → fail-closed `unclassified` (never deleted). */
|
|
218
|
+
publicCatalogIds?: readonly string[];
|
|
219
|
+
/** Capability flag: `--adopt` is refused at the command layer when the per-id
|
|
220
|
+
* action table cannot be executed verbatim (design §14.2 fallback). */
|
|
221
|
+
adoptDisabled?: boolean;
|
|
222
|
+
/** TEST FAULT INJECTION ONLY. When set, `applyMigration` appends one bogus
|
|
223
|
+
* action with this op to the rebuilt table so the fail-closed gate can be
|
|
224
|
+
* exercised. Production callers never set it. */
|
|
225
|
+
faultInjectOp?: string;
|
|
226
|
+
now: number;
|
|
227
|
+
/** M-5: true when a go sync round currently holds the single-flight lock. */
|
|
228
|
+
isSyncInFlight?: () => boolean;
|
|
229
|
+
/** Optional: execute an opt-in rewrite of a verified reference key. Default: none. */
|
|
230
|
+
applyReferenceRewrite?: (rewrite: ReferenceRewrite) => Promise<void>;
|
|
231
|
+
/**
|
|
232
|
+
* O1/C2: after apply/rollback the profile's write-ahead journals are stale
|
|
233
|
+
* (the migration rewrote or undid those settings). Clearing them prevents a
|
|
234
|
+
* later round re-accounting a journal left by the pre-migration writer.
|
|
235
|
+
*/
|
|
236
|
+
journalStore?: GoJournalStore;
|
|
237
|
+
/** O1/C2: stable profile key whose journals are cleared. */
|
|
238
|
+
profileKey?: string;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* The ONE plan-construction path used by both `/migrate plan` and `apply`.
|
|
242
|
+
* Sharing it is what makes the printed plan and the plan apply re-builds
|
|
243
|
+
* byte-identical — a prerequisite for the consent gate (V17) and V19.
|
|
244
|
+
*/
|
|
245
|
+
export declare function buildMigrationPlanFromDeps(deps: MigrateDeps, record: MigrationRecord | undefined): MigrationPlan;
|
|
246
|
+
interface RouteWriteState {
|
|
247
|
+
/** Desired end state of this route's models, seeded from the live section. */
|
|
248
|
+
models: Map<string, SettingsModelProfile>;
|
|
249
|
+
/** ids under plugin ownership after this apply (B6 ledger `managed`). */
|
|
250
|
+
managed: Record<string, GoManagedModel>;
|
|
251
|
+
/** ids this apply actually created on this route (ledger `appliedAddedIds`). */
|
|
252
|
+
addedIds: Set<string>;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Translate the plan's per-id action table into per-route desired states. This
|
|
256
|
+
* is the ONLY place that decides what apply writes: there is no
|
|
257
|
+
* `merged = [...desired]` re-derivation anywhere (31 B2). Every row yields
|
|
258
|
+
* exactly one result, in table order, so plan ↔ apply is checkable row by row.
|
|
259
|
+
*
|
|
260
|
+
* This same function powers plan-time simulation (`managedIdsAfterApply`) and
|
|
261
|
+
* apply-time execution, so "will be managed" and "was managed" use ONE source.
|
|
262
|
+
*
|
|
263
|
+
* Semantics (user rulings + §14.2/§14.3):
|
|
264
|
+
* keep → untouched; adopted only when the row is flagged `managed` AND the
|
|
265
|
+
* id is actually present on the route.
|
|
266
|
+
* add → write the official profile unless the id is already present; an
|
|
267
|
+
* already-present id is only adopted (managed) if its value matches.
|
|
268
|
+
* update → NOTHING written, never managed (user-edited value is preserved).
|
|
269
|
+
* move → remove from source route; on the destination, write/adopt the
|
|
270
|
+
* official profile ONLY if the target is empty or already holds the
|
|
271
|
+
* same value. A different-valued target is a user edit: never
|
|
272
|
+
* overwritten, never claimed, and reported as `skipped`.
|
|
273
|
+
* delete → remove from the route (only rows explicitly listed in the plan).
|
|
274
|
+
* pinned → expressed by keep (+ add on the target) rows; never moved/deleted.
|
|
275
|
+
* default → FAIL-CLOSED: an unknown op throws, it is never silently skipped.
|
|
276
|
+
*/
|
|
277
|
+
export declare function buildRouteWriteStates(table: MigrationActionTable, desc: SettingsDescriptor | undefined): {
|
|
278
|
+
byRoute: Map<string, RouteWriteState>;
|
|
279
|
+
results: MigrateApplyActionResult[];
|
|
280
|
+
};
|
|
281
|
+
export type MigrateApplyReason = 'applied' | 'consent-required' | 'plan-hash-mismatch' | 'confirm-code-mismatch' | 'ack-required' | 'adopt-disabled' | 'unknown-action' | 'nothing-to-apply' | 'sync-in-flight' | 'write-failed';
|
|
282
|
+
/** Result of ONE row of the plan's action table — mirrors it one-to-one (V19). */
|
|
283
|
+
export interface MigrateApplyActionResult {
|
|
284
|
+
id: string;
|
|
285
|
+
op: MigrationIdActionOp;
|
|
286
|
+
route: string;
|
|
287
|
+
to?: string;
|
|
288
|
+
status: 'applied' | 'kept' | 'skipped' | 'failed';
|
|
289
|
+
reason: string;
|
|
290
|
+
}
|
|
291
|
+
export interface MigrateApplyResult {
|
|
292
|
+
ok: boolean;
|
|
293
|
+
reason: MigrateApplyReason;
|
|
294
|
+
planHash: string;
|
|
295
|
+
confirmCode: string;
|
|
296
|
+
routes: {
|
|
297
|
+
route: string;
|
|
298
|
+
status: 'wrote' | 'failed' | 'skipped';
|
|
299
|
+
reason?: string;
|
|
300
|
+
}[];
|
|
301
|
+
/** One entry per `plan.idActions` row, in the same order. */
|
|
302
|
+
actions: MigrateApplyActionResult[];
|
|
303
|
+
backupPath?: string;
|
|
304
|
+
text: string;
|
|
305
|
+
}
|
|
306
|
+
export declare function applyMigration(args: {
|
|
307
|
+
planHash?: string;
|
|
308
|
+
confirmCode?: string;
|
|
309
|
+
ackManaged?: boolean;
|
|
310
|
+
}, deps: MigrateDeps): Promise<MigrateApplyResult>;
|
|
311
|
+
export type MigrateRollbackReason = 'rolled-back' | 'consent-required' | 'plan-hash-mismatch' | 'no-record' | 'snapshot-missing' | 'hash-mismatch';
|
|
312
|
+
export interface MigrateRollbackResult {
|
|
313
|
+
ok: boolean;
|
|
314
|
+
reason: MigrateRollbackReason;
|
|
315
|
+
routes: string[];
|
|
316
|
+
text: string;
|
|
317
|
+
}
|
|
318
|
+
export declare function rollbackMigration(args: {
|
|
319
|
+
planHash?: string;
|
|
320
|
+
}, deps: MigrateDeps): Promise<MigrateRollbackResult>;
|
|
321
|
+
export interface MigrationRouteStatus {
|
|
322
|
+
route: string;
|
|
323
|
+
state: MigrationState;
|
|
324
|
+
owner: string;
|
|
325
|
+
decision: 'write' | 'skip';
|
|
326
|
+
reason: string;
|
|
327
|
+
}
|
|
328
|
+
export interface MigrateStatusResult {
|
|
329
|
+
overall: MigrationState;
|
|
330
|
+
/**
|
|
331
|
+
* D6: structured write-authority summary for automation. `none` whenever an
|
|
332
|
+
* unclaimed record is present (gate closed), otherwise whether any route was
|
|
333
|
+
* granted write authority. Per-route authority is in `routes[].owner`.
|
|
334
|
+
*/
|
|
335
|
+
writeAuthority: 'none' | 'go';
|
|
336
|
+
/** D6: unclaimed migration records (foreign profile / legacy shape) — never claimed. */
|
|
337
|
+
unclaimed: UnclaimedMigrationRecord[];
|
|
338
|
+
applying: boolean;
|
|
339
|
+
routes: MigrationRouteStatus[];
|
|
340
|
+
text: string;
|
|
341
|
+
}
|
|
342
|
+
export declare function migrationStatusReport(deps: Pick<MigrateDeps, 'settings' | 'migrationStore' | 'keyFingerprint' | 'routes' | 'now'>, config?: Partial<RouteWriterConfig>): Promise<MigrateStatusResult>;
|
|
343
|
+
export {};
|