@aiwayds/dsh-model-sync 0.12.1 → 0.13.1
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/README.md +18 -17
- package/README.zh-CN.md +18 -17
- package/lib/index.d.ts +54 -384
- package/lib/index.js +306 -1107
- package/lib/index.js.map +1 -1
- package/lib/official-adapter.d.ts +80 -0
- package/lib/official-adapter.js +34 -0
- package/lib/official-adapter.js.map +1 -0
- package/lib/official-migrate.d.ts +122 -0
- package/lib/official-migrate.js +653 -0
- package/lib/official-migrate.js.map +1 -0
- package/lib/official-scheduler.d.ts +72 -0
- package/lib/official-scheduler.js +195 -0
- package/lib/official-scheduler.js.map +1 -0
- package/lib/official-store.d.ts +41 -0
- package/lib/official-store.js +84 -0
- package/lib/official-store.js.map +1 -0
- package/lib/official-sync.d.ts +68 -0
- package/lib/official-sync.js +274 -0
- package/lib/official-sync.js.map +1 -0
- package/lib/opencode-go-adapter.d.ts +56 -0
- package/lib/opencode-go-adapter.js +455 -0
- package/lib/opencode-go-adapter.js.map +1 -0
- package/lib/opencode-go-patch-file.d.ts +11 -0
- package/lib/opencode-go-patch-file.js +175 -11
- package/lib/opencode-go-patch-file.js.map +1 -1
- package/lib/opencode-go-source.d.ts +1 -1
- package/lib/opencode-go-source.js +1 -1
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +3 -3
- package/src/index.ts +352 -1281
- package/src/official-adapter.ts +111 -0
- package/src/official-migrate.ts +863 -0
- package/src/official-scheduler.ts +235 -0
- package/src/official-store.ts +122 -0
- package/src/official-sync.ts +371 -0
- package/src/opencode-go-adapter.ts +494 -0
- package/src/opencode-go-patch-file.ts +175 -9
- package/src/opencode-go-source.ts +1 -1
- package/lib/opencode-go-diagnose.d.ts +0 -96
- package/lib/opencode-go-diagnose.js +0 -177
- package/lib/opencode-go-diagnose.js.map +0 -1
- package/lib/opencode-go-grouping.d.ts +0 -7
- package/lib/opencode-go-grouping.js +0 -21
- package/lib/opencode-go-grouping.js.map +0 -1
- package/lib/opencode-go-host-catalog.d.ts +0 -42
- package/lib/opencode-go-host-catalog.js +0 -98
- package/lib/opencode-go-host-catalog.js.map +0 -1
- package/lib/opencode-go-journal.d.ts +0 -114
- package/lib/opencode-go-journal.js +0 -406
- package/lib/opencode-go-journal.js.map +0 -1
- package/lib/opencode-go-migrate.d.ts +0 -378
- package/lib/opencode-go-migrate.js +0 -1529
- package/lib/opencode-go-migrate.js.map +0 -1
- package/lib/opencode-go-migration.d.ts +0 -270
- package/lib/opencode-go-migration.js +0 -473
- package/lib/opencode-go-migration.js.map +0 -1
- package/lib/opencode-go-one-shot.d.ts +0 -282
- package/lib/opencode-go-one-shot.js +0 -1131
- package/lib/opencode-go-one-shot.js.map +0 -1
- package/lib/opencode-go-planner.d.ts +0 -168
- package/lib/opencode-go-planner.js +0 -407
- package/lib/opencode-go-planner.js.map +0 -1
- package/lib/opencode-go-scheduler.d.ts +0 -128
- package/lib/opencode-go-scheduler.js +0 -241
- package/lib/opencode-go-scheduler.js.map +0 -1
- package/lib/opencode-go-store.d.ts +0 -18
- package/lib/opencode-go-store.js +0 -68
- package/lib/opencode-go-store.js.map +0 -1
- package/lib/opencode-go-sync.d.ts +0 -107
- package/lib/opencode-go-sync.js +0 -388
- package/lib/opencode-go-sync.js.map +0 -1
- package/lib/opencode-go-writer.d.ts +0 -148
- package/lib/opencode-go-writer.js +0 -1061
- package/lib/opencode-go-writer.js.map +0 -1
- package/src/opencode-go-diagnose.ts +0 -276
- package/src/opencode-go-grouping.ts +0 -26
- package/src/opencode-go-host-catalog.ts +0 -125
- package/src/opencode-go-journal.ts +0 -460
- package/src/opencode-go-migrate.ts +0 -1951
- package/src/opencode-go-migration.ts +0 -666
- package/src/opencode-go-one-shot.ts +0 -1399
- package/src/opencode-go-planner.ts +0 -582
- package/src/opencode-go-scheduler.ts +0 -315
- package/src/opencode-go-store.ts +0 -73
- package/src/opencode-go-sync.ts +0 -541
- package/src/opencode-go-writer.ts +0 -1301
|
@@ -0,0 +1,653 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Official Sync migration, rollback, and read-only status diagnostic.
|
|
3
|
+
*
|
|
4
|
+
* Design:
|
|
5
|
+
* - Strict precondition: target profile MUST already declare the legacy
|
|
6
|
+
* `providers.<builtinProviderId>` section (e.g. `providers.opencode-go`).
|
|
7
|
+
* Blank profiles cannot initialize via `migrate`.
|
|
8
|
+
* - Single confirmation gate via `userQuestions` (or `--confirm` when
|
|
9
|
+
* non-interactive; fail-closed otherwise).
|
|
10
|
+
* - File backups (`cordis.patch.yml.bak.<stamp>` and
|
|
11
|
+
* `models-store.json.bak.<stamp>`, keeping 3 newest per category) are
|
|
12
|
+
* created before confirmation/writes, with byte-restore on mid-apply failure.
|
|
13
|
+
* - Rewrites `agent-default-model` when it points at the deleted builtin
|
|
14
|
+
* provider, and reports advisory warnings for any other references in
|
|
15
|
+
* `cordis.patch.yml`.
|
|
16
|
+
* - Rollback restores the previous builtin provider, restores
|
|
17
|
+
* `agent-default-model`, removes the Managed Custom Providers, and deletes
|
|
18
|
+
* the profile's OfficialMigrationRecord.
|
|
19
|
+
*
|
|
20
|
+
* @module dsh-model-sync/official-migrate
|
|
21
|
+
*/
|
|
22
|
+
import { mkdir, open, readFile, readdir, rename, stat as statFd, unlink, writeFile } from 'node:fs/promises';
|
|
23
|
+
import { readFileSync, statSync, writeFileSync } from 'node:fs';
|
|
24
|
+
import { basename, dirname, join } from 'node:path';
|
|
25
|
+
import { resolveDshHome } from "./legacy-import.js";
|
|
26
|
+
import { MODELS_STORE_PATH, loadModelsStore } from "./remote-catalog.js";
|
|
27
|
+
import { createFilePatchSettingsService, scanPatchReferences, } from "./opencode-go-patch-file.js";
|
|
28
|
+
import { cleanupLegacyGoStoreKeys, createOfficialMigrationStore, } from "./official-store.js";
|
|
29
|
+
import { buildCustomProviderValue, resolveCredentialByRefs, } from "./official-sync.js";
|
|
30
|
+
const BACKUP_KEEP_COUNT = 3;
|
|
31
|
+
const LABEL_MIGRATE = '执行迁移';
|
|
32
|
+
const LABEL_ROLLBACK = '确认回退';
|
|
33
|
+
const LABEL_CANCEL = '取消';
|
|
34
|
+
function formatStamp(ms) {
|
|
35
|
+
const d = new Date(ms);
|
|
36
|
+
const p = (n, w = 2) => String(n).padStart(w, '0');
|
|
37
|
+
return `${d.getFullYear()}${p(d.getMonth() + 1)}${p(d.getDate())}-${p(d.getHours())}${p(d.getMinutes())}${p(d.getSeconds())}`;
|
|
38
|
+
}
|
|
39
|
+
let exclusiveSeq = 0;
|
|
40
|
+
export function createDefaultMigrateFs() {
|
|
41
|
+
return {
|
|
42
|
+
readFile: (path) => readFile(path, 'utf8'),
|
|
43
|
+
writeFile: (path, data, mode) => (mode === undefined ? writeFile(path, data) : writeFile(path, data, { mode })),
|
|
44
|
+
rename: (from, to) => rename(from, to),
|
|
45
|
+
unlink: async (path) => { await unlink(path); },
|
|
46
|
+
mkdir: async (path, options) => { await mkdir(path, options); },
|
|
47
|
+
stat: async (path) => {
|
|
48
|
+
const info = await statFd(path).catch(() => undefined);
|
|
49
|
+
return info === undefined ? undefined : { mode: info.mode };
|
|
50
|
+
},
|
|
51
|
+
readdir: async (path) => readdir(path),
|
|
52
|
+
writeFileExclusive: async (path, data, mode) => {
|
|
53
|
+
let handle;
|
|
54
|
+
try {
|
|
55
|
+
handle = await open(path, 'wx', mode);
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
if (err.code === 'EEXIST')
|
|
59
|
+
return false;
|
|
60
|
+
throw err;
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
await handle.writeFile('dsh-model-sync: backup claim in progress\n');
|
|
64
|
+
}
|
|
65
|
+
finally {
|
|
66
|
+
await handle.close().catch(() => { });
|
|
67
|
+
}
|
|
68
|
+
const tmp = `${path}.tmp-${process.pid}-${exclusiveSeq++}`;
|
|
69
|
+
try {
|
|
70
|
+
await writeFile(tmp, data, mode === undefined ? undefined : { mode });
|
|
71
|
+
await rename(tmp, path);
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
catch (err) {
|
|
75
|
+
await unlink(tmp).catch(() => { });
|
|
76
|
+
await unlink(path).catch(() => { });
|
|
77
|
+
throw err;
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export function createDefaultPatchIo(path) {
|
|
83
|
+
let seq = 0;
|
|
84
|
+
return {
|
|
85
|
+
readText: () => readFileSync(path, 'utf8'),
|
|
86
|
+
writeAtomic: async (text) => {
|
|
87
|
+
seq += 1;
|
|
88
|
+
const tmp = `${path}.tmp-${process.pid}-${seq}`;
|
|
89
|
+
const mode = statSync(path).mode;
|
|
90
|
+
try {
|
|
91
|
+
writeFileSync(tmp, text, mode !== undefined ? { mode } : undefined);
|
|
92
|
+
await rename(tmp, path);
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
await unlink(tmp).catch(() => { });
|
|
96
|
+
throw err;
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
async function createExclusiveBackup(fs, sourcePath, stamp) {
|
|
102
|
+
const info = await fs.stat(sourcePath).catch(() => undefined);
|
|
103
|
+
if (info === undefined)
|
|
104
|
+
return undefined;
|
|
105
|
+
const sourceText = await fs.readFile(sourcePath);
|
|
106
|
+
const dir = dirname(sourcePath);
|
|
107
|
+
const base = basename(sourcePath);
|
|
108
|
+
await fs.mkdir(dir, { recursive: true });
|
|
109
|
+
const mode = info.mode & 0o777;
|
|
110
|
+
for (let attempt = 0; attempt < 100; attempt++) {
|
|
111
|
+
const suffix = attempt === 0 ? stamp : `${stamp}-${attempt}`;
|
|
112
|
+
const candidate = join(dir, `${base}.bak.${suffix}`);
|
|
113
|
+
const ok = await fs.writeFileExclusive(candidate, sourceText, mode);
|
|
114
|
+
if (ok) {
|
|
115
|
+
await pruneOldBackups(fs, dir, `${base}.bak.`, BACKUP_KEEP_COUNT);
|
|
116
|
+
return { backupPath: candidate, sourceText, mode };
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
throw new Error(`failed to claim unique backup path for ${sourcePath}`);
|
|
120
|
+
}
|
|
121
|
+
async function pruneOldBackups(fs, dir, prefix, keepCount) {
|
|
122
|
+
const entries = await fs.readdir(dir).catch(() => []);
|
|
123
|
+
const matching = entries
|
|
124
|
+
.filter((name) => name.startsWith(prefix) && /^\d{8}-\d{6}/.test(name.slice(prefix.length)))
|
|
125
|
+
.sort((a, b) => b.localeCompare(a));
|
|
126
|
+
for (const stale of matching.slice(keepCount)) {
|
|
127
|
+
await fs.unlink(join(dir, stale)).catch(() => { });
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function storeForProfile(deps, profileKey) {
|
|
131
|
+
if (deps.storeFor !== undefined)
|
|
132
|
+
return deps.storeFor(profileKey);
|
|
133
|
+
const accessor = deps.storeAccessor ?? loadModelsStore(deps.modelsStorePath);
|
|
134
|
+
return createOfficialMigrationStore(accessor, profileKey, deps.adapter.id);
|
|
135
|
+
}
|
|
136
|
+
function planDefaultModelRewrite(defaultModelUser, builtinProviderId, providers) {
|
|
137
|
+
if (defaultModelUser === undefined)
|
|
138
|
+
return undefined;
|
|
139
|
+
const currentProvider = defaultModelUser.provider;
|
|
140
|
+
const currentModel = defaultModelUser.model;
|
|
141
|
+
if (currentProvider !== builtinProviderId || typeof currentModel !== 'string' || currentModel.length === 0) {
|
|
142
|
+
return undefined;
|
|
143
|
+
}
|
|
144
|
+
const matchingProvider = providers.find((p) => p.models.some((m) => m.id === currentModel));
|
|
145
|
+
const targetProvider = matchingProvider ?? providers[0];
|
|
146
|
+
if (targetProvider === undefined || targetProvider.models.length === 0)
|
|
147
|
+
return undefined;
|
|
148
|
+
const nextModel = matchingProvider !== undefined ? currentModel : targetProvider.models[0].id;
|
|
149
|
+
return {
|
|
150
|
+
currentProvider: builtinProviderId,
|
|
151
|
+
currentModel,
|
|
152
|
+
nextProvider: targetProvider.routeId,
|
|
153
|
+
nextModel,
|
|
154
|
+
previousConfig: structuredClone(defaultModelUser),
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
async function askSingleConfirmation(ask, questionId, question, header, confirmLabel, confirmFlag, invocation) {
|
|
158
|
+
if (ask === undefined) {
|
|
159
|
+
if (confirmFlag)
|
|
160
|
+
return { confirmed: true };
|
|
161
|
+
return {
|
|
162
|
+
confirmed: false,
|
|
163
|
+
error: 'Interactive confirmation channel is unavailable in this host. Run from an interactive UI, or pass `--confirm` explicitly after reviewing the status/preview.',
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
let response;
|
|
167
|
+
try {
|
|
168
|
+
response = await ask.ask({
|
|
169
|
+
questions: [{
|
|
170
|
+
id: questionId,
|
|
171
|
+
question,
|
|
172
|
+
header,
|
|
173
|
+
options: [
|
|
174
|
+
{ label: confirmLabel },
|
|
175
|
+
{ label: LABEL_CANCEL },
|
|
176
|
+
],
|
|
177
|
+
multiSelect: false,
|
|
178
|
+
}],
|
|
179
|
+
...(invocation?.agent === undefined ? {} : { agent: invocation.agent }),
|
|
180
|
+
...(invocation?.signal === undefined ? {} : { signal: invocation.signal }),
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
catch (err) {
|
|
184
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
185
|
+
return { confirmed: false, error: `Confirmation failed (${msg}); no settings were changed.` };
|
|
186
|
+
}
|
|
187
|
+
if (invocation?.signal?.aborted === true) {
|
|
188
|
+
return { confirmed: false, error: 'Cancelled (signal aborted); no settings were changed.' };
|
|
189
|
+
}
|
|
190
|
+
const answer = (response?.answers ?? []).find((item) => item.id === questionId);
|
|
191
|
+
const selected = answer?.selected ?? [];
|
|
192
|
+
const choseConfirm = selected.includes(confirmLabel);
|
|
193
|
+
const choseCancel = selected.includes(LABEL_CANCEL);
|
|
194
|
+
if (choseConfirm && !choseCancel) {
|
|
195
|
+
return { confirmed: true };
|
|
196
|
+
}
|
|
197
|
+
if (choseConfirm && choseCancel) {
|
|
198
|
+
return { confirmed: false, error: 'Confirmation answer was ambiguous; no settings were changed.' };
|
|
199
|
+
}
|
|
200
|
+
return { confirmed: false, error: 'Cancelled by user; no settings were changed.' };
|
|
201
|
+
}
|
|
202
|
+
async function resolveTargetProfiles(deps, allProfiles) {
|
|
203
|
+
const fs = deps.fs ?? createDefaultMigrateFs();
|
|
204
|
+
const patchIoFor = deps.patchIoFor ?? createDefaultPatchIo;
|
|
205
|
+
const currentKey = deps.currentProfile.key;
|
|
206
|
+
if (currentKey === undefined) {
|
|
207
|
+
return {
|
|
208
|
+
ok: false,
|
|
209
|
+
error: 'Cannot resolve current dsh profile identity. Launch inside a dsh profile before migrating.',
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
const currentDir = deps.currentProfile.dir;
|
|
213
|
+
const currentPatchPath = currentDir !== undefined ? join(currentDir, 'cordis.patch.yml') : undefined;
|
|
214
|
+
const currentPatchText = currentPatchPath !== undefined
|
|
215
|
+
? await fs.readFile(currentPatchPath).catch(() => undefined)
|
|
216
|
+
: undefined;
|
|
217
|
+
const currentTarget = {
|
|
218
|
+
profileKey: currentKey,
|
|
219
|
+
profileDir: currentDir,
|
|
220
|
+
isCurrent: true,
|
|
221
|
+
settings: deps.currentSettings,
|
|
222
|
+
patchPath: currentPatchPath,
|
|
223
|
+
patchText: currentPatchText,
|
|
224
|
+
};
|
|
225
|
+
if (!allProfiles)
|
|
226
|
+
return { ok: true, targets: [currentTarget] };
|
|
227
|
+
const targets = [];
|
|
228
|
+
const currentLlmDesc = deps.currentSettings?.describe().find((d) => d.ns === 'llm-pi-ai');
|
|
229
|
+
const currentProviders = currentLlmDesc?.user?.providers ?? {};
|
|
230
|
+
const currentAlreadyMigrated = (await storeForProfile(deps, currentKey).read()) !== undefined;
|
|
231
|
+
if (!currentAlreadyMigrated && currentProviders[deps.adapter.builtinProviderId] !== undefined) {
|
|
232
|
+
targets.push(currentTarget);
|
|
233
|
+
}
|
|
234
|
+
const profilesRoot = deps.profilesDir ?? join(deps.home || resolveDshHome(), 'profiles');
|
|
235
|
+
const dirs = await fs.readdir(profilesRoot).catch(() => []);
|
|
236
|
+
for (const name of dirs.sort()) {
|
|
237
|
+
const dir = join(profilesRoot, name);
|
|
238
|
+
if (name === currentKey || (currentDir !== undefined && dir === currentDir))
|
|
239
|
+
continue;
|
|
240
|
+
const patchPath = join(dir, 'cordis.patch.yml');
|
|
241
|
+
const info = await fs.stat(patchPath).catch(() => undefined);
|
|
242
|
+
if (info === undefined)
|
|
243
|
+
continue;
|
|
244
|
+
const patchText = await fs.readFile(patchPath).catch(() => undefined);
|
|
245
|
+
if (patchText === undefined)
|
|
246
|
+
continue;
|
|
247
|
+
const fileSettings = createFilePatchSettingsService(patchIoFor(patchPath));
|
|
248
|
+
const llmDesc = fileSettings.describe().find((d) => d.ns === 'llm-pi-ai');
|
|
249
|
+
const providers = llmDesc?.user?.providers ?? {};
|
|
250
|
+
if (providers[deps.adapter.builtinProviderId] === undefined)
|
|
251
|
+
continue;
|
|
252
|
+
const existingRecord = await storeForProfile(deps, name).read();
|
|
253
|
+
if (existingRecord !== undefined)
|
|
254
|
+
continue;
|
|
255
|
+
targets.push({
|
|
256
|
+
profileKey: name,
|
|
257
|
+
profileDir: dir,
|
|
258
|
+
isCurrent: false,
|
|
259
|
+
settings: fileSettings,
|
|
260
|
+
patchPath,
|
|
261
|
+
patchText,
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
if (targets.length === 0) {
|
|
265
|
+
return {
|
|
266
|
+
ok: false,
|
|
267
|
+
error: `No unmigrated profiles with \`providers.${deps.adapter.builtinProviderId}\` found.`,
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
return { ok: true, targets };
|
|
271
|
+
}
|
|
272
|
+
async function prepareProfilePlan(deps, target) {
|
|
273
|
+
const { adapter, config } = deps;
|
|
274
|
+
const store = storeForProfile(deps, target.profileKey);
|
|
275
|
+
const existing = await store.read();
|
|
276
|
+
if (existing !== undefined) {
|
|
277
|
+
const alias = adapter.aliases[0] ?? adapter.id;
|
|
278
|
+
return {
|
|
279
|
+
ok: false,
|
|
280
|
+
error: `[${target.profileKey}] ${adapter.id} is already migrated. Use \`/model-sync ${alias}\` to update or \`/model-sync rollback ${alias}\` to revert.`,
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
if (target.settings === undefined) {
|
|
284
|
+
return { ok: false, error: `[${target.profileKey}] settings service unavailable.` };
|
|
285
|
+
}
|
|
286
|
+
const descs = target.settings.describe();
|
|
287
|
+
const llmDesc = descs.find((d) => d.ns === 'llm-pi-ai');
|
|
288
|
+
const providers = llmDesc?.user?.providers ?? {};
|
|
289
|
+
const rawBuiltin = providers[adapter.builtinProviderId];
|
|
290
|
+
if (rawBuiltin === undefined || rawBuiltin === null || typeof rawBuiltin !== 'object' || Array.isArray(rawBuiltin)) {
|
|
291
|
+
return {
|
|
292
|
+
ok: false,
|
|
293
|
+
error: `[${target.profileKey}] No existing Builtin Provider \`providers.${adapter.builtinProviderId}\` found. Please configure \`${adapter.builtinProviderId}\` and its API key first; blank profiles cannot initialize via migrate.`,
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
const previousBuiltinSection = structuredClone(rawBuiltin);
|
|
297
|
+
const declaredKeyEnv = typeof previousBuiltinSection.apiKeyEnv === 'string' && previousBuiltinSection.apiKeyEnv.trim().length > 0
|
|
298
|
+
? previousBuiltinSection.apiKeyEnv.trim()
|
|
299
|
+
: undefined;
|
|
300
|
+
const candidateRefs = declaredKeyEnv !== undefined
|
|
301
|
+
? [declaredKeyEnv, ...adapter.defaultKeyRefs]
|
|
302
|
+
: adapter.defaultKeyRefs;
|
|
303
|
+
const resolved = await resolveCredentialByRefs(deps.credentialCtx, candidateRefs);
|
|
304
|
+
if (resolved.value === undefined) {
|
|
305
|
+
return {
|
|
306
|
+
ok: false,
|
|
307
|
+
error: `[${target.profileKey}] API key for \`${resolved.ref}\` is not configured. Please set the credential before running migrate.`,
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
const fetched = await adapter.fetchAndPlan({
|
|
311
|
+
apiKey: resolved.value,
|
|
312
|
+
apiKeyEnv: resolved.ref,
|
|
313
|
+
config,
|
|
314
|
+
timeoutMs: deps.timeoutMs,
|
|
315
|
+
fetchImpl: deps.fetchImpl,
|
|
316
|
+
detectHostSessionHeader: deps.detectHostSessionHeader,
|
|
317
|
+
loadPiAiCompatHints: deps.loadPiAiCompatHints,
|
|
318
|
+
});
|
|
319
|
+
if (!fetched.ok || fetched.providers.length === 0) {
|
|
320
|
+
return {
|
|
321
|
+
ok: false,
|
|
322
|
+
error: `[${target.profileKey}] Failed to fetch official ${adapter.displayName} models (${fetched.error?.message ?? 'empty listing'}); zero writes performed.`,
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
const defaultModelDesc = descs.find((d) => d.ns === 'agent-default-model');
|
|
326
|
+
const defaultModelRewrite = planDefaultModelRewrite(defaultModelDesc?.user, adapter.builtinProviderId, fetched.providers);
|
|
327
|
+
const otherRefs = target.patchText !== undefined
|
|
328
|
+
? scanPatchReferences(target.patchText, adapter.builtinProviderId)
|
|
329
|
+
: [];
|
|
330
|
+
const previousManagedSections = {};
|
|
331
|
+
for (const spec of fetched.providers) {
|
|
332
|
+
const cur = providers[spec.routeId];
|
|
333
|
+
previousManagedSections[spec.routeId] = cur !== undefined && cur !== null && typeof cur === 'object' && !Array.isArray(cur)
|
|
334
|
+
? structuredClone(cur)
|
|
335
|
+
: null;
|
|
336
|
+
}
|
|
337
|
+
const activeRouteIds = new Set(fetched.providers.map((p) => p.routeId));
|
|
338
|
+
const staleRoutesToUnset = [];
|
|
339
|
+
for (const legacyRoute of [...adapter.legacyExtraRoutes, ...Object.values(config.routes)]) {
|
|
340
|
+
if (legacyRoute === adapter.builtinProviderId || activeRouteIds.has(legacyRoute))
|
|
341
|
+
continue;
|
|
342
|
+
if (providers[legacyRoute] !== undefined) {
|
|
343
|
+
staleRoutesToUnset.push(legacyRoute);
|
|
344
|
+
previousManagedSections[legacyRoute] = providers[legacyRoute] !== null && typeof providers[legacyRoute] === 'object' && !Array.isArray(providers[legacyRoute])
|
|
345
|
+
? structuredClone(providers[legacyRoute])
|
|
346
|
+
: null;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
return {
|
|
350
|
+
ok: true,
|
|
351
|
+
plan: {
|
|
352
|
+
target,
|
|
353
|
+
store,
|
|
354
|
+
apiKeyEnv: resolved.ref,
|
|
355
|
+
previousBuiltinSection,
|
|
356
|
+
previousManagedSections,
|
|
357
|
+
specs: fetched.providers,
|
|
358
|
+
totalModels: fetched.totalModels,
|
|
359
|
+
sessionHeaderApplied: fetched.sessionHeaderApplied,
|
|
360
|
+
hostNativeSessionHeader: fetched.hostNativeSessionHeader,
|
|
361
|
+
warnings: fetched.warnings,
|
|
362
|
+
defaultModelRewrite,
|
|
363
|
+
otherRefs,
|
|
364
|
+
staleRoutesToUnset,
|
|
365
|
+
},
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
export async function runOfficialMigrate(deps, options = {}) {
|
|
369
|
+
const fs = deps.fs ?? createDefaultMigrateFs();
|
|
370
|
+
const targetsRes = await resolveTargetProfiles(deps, options.allProfiles === true);
|
|
371
|
+
if (!targetsRes.ok)
|
|
372
|
+
return { kind: 'error', text: targetsRes.error };
|
|
373
|
+
const plans = [];
|
|
374
|
+
for (const target of targetsRes.targets) {
|
|
375
|
+
const res = await prepareProfilePlan(deps, target);
|
|
376
|
+
if (!res.ok)
|
|
377
|
+
return { kind: 'error', text: res.error };
|
|
378
|
+
plans.push(res.plan);
|
|
379
|
+
}
|
|
380
|
+
// Build backups BEFORE asking confirmation (matching safe backup pattern)
|
|
381
|
+
const stamp = formatStamp((deps.now ?? Date.now)());
|
|
382
|
+
const backups = [];
|
|
383
|
+
for (const plan of plans) {
|
|
384
|
+
if (plan.target.patchPath !== undefined) {
|
|
385
|
+
const bak = await createExclusiveBackup(fs, plan.target.patchPath, stamp);
|
|
386
|
+
if (bak !== undefined)
|
|
387
|
+
backups.push({ originalPath: plan.target.patchPath, ...bak });
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
const storeBak = await createExclusiveBackup(fs, deps.modelsStorePath, stamp);
|
|
391
|
+
// Single confirmation gate
|
|
392
|
+
const previewLines = [
|
|
393
|
+
`迁移 ${deps.adapter.displayName} (${deps.adapter.builtinProviderId}) 到独立 Custom Providers:`,
|
|
394
|
+
];
|
|
395
|
+
for (const plan of plans) {
|
|
396
|
+
const slots = plan.specs.map((s) => `${s.routeId} (${s.api}, ${s.models.length} models)`).join(', ');
|
|
397
|
+
previewLines.push(`• Profile "${plan.target.profileKey}":`);
|
|
398
|
+
previewLines.push(` - 提取 Key 引用: ${plan.apiKeyEnv}`);
|
|
399
|
+
previewLines.push(` - 删除 Builtin Provider: ${deps.adapter.builtinProviderId}`);
|
|
400
|
+
previewLines.push(` - 创建 Custom Providers: ${slots}`);
|
|
401
|
+
if (plan.defaultModelRewrite !== undefined) {
|
|
402
|
+
previewLines.push(` - 改写默认模型: ${plan.defaultModelRewrite.currentProvider}/${plan.defaultModelRewrite.currentModel} → ${plan.defaultModelRewrite.nextProvider}/${plan.defaultModelRewrite.nextModel}`);
|
|
403
|
+
}
|
|
404
|
+
if (plan.otherRefs.length > 0) {
|
|
405
|
+
previewLines.push(` - 提示其他配置引用 (${plan.otherRefs.length} 处需按需手工调整): ${plan.otherRefs.map((h) => `${h.entryId}:${h.value}`).join(', ')}`);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
if (backups.length > 0 || storeBak !== undefined) {
|
|
409
|
+
const bakPaths = [...backups.map((b) => b.backupPath), ...(storeBak ? [storeBak.backupPath] : [])];
|
|
410
|
+
previewLines.push(`• 备份文件: ${bakPaths.join(', ')}`);
|
|
411
|
+
}
|
|
412
|
+
previewLines.push(`• 迁移后将自动开启每 ${deps.config.intervalMinutes} 分钟同步一次官方最新模型(可通过 /model-sync rollback ${deps.adapter.aliases[0] ?? deps.adapter.id} 回退)。`);
|
|
413
|
+
const ask = deps.resolveAsk?.();
|
|
414
|
+
const consent = await askSingleConfirmation(ask, 'official-migrate-confirm', previewLines.join('\n'), `迁移 ${deps.adapter.displayName}`, LABEL_MIGRATE, options.confirm === true, { agent: options.agent, signal: options.signal });
|
|
415
|
+
if (!consent.confirmed) {
|
|
416
|
+
return { kind: 'error', text: consent.error };
|
|
417
|
+
}
|
|
418
|
+
// Apply writes; on failure, byte-restore backed up patch files & store
|
|
419
|
+
const modifiedPatches = [];
|
|
420
|
+
try {
|
|
421
|
+
const accessor = deps.storeAccessor ?? loadModelsStore(deps.modelsStorePath);
|
|
422
|
+
for (const plan of plans) {
|
|
423
|
+
const settings = plan.target.settings;
|
|
424
|
+
const descs = settings.describe();
|
|
425
|
+
const llmDesc = descs.find((d) => d.ns === 'llm-pi-ai');
|
|
426
|
+
if (llmDesc === undefined)
|
|
427
|
+
throw new Error(`[${plan.target.profileKey}] llm-pi-ai namespace missing`);
|
|
428
|
+
const ops = [];
|
|
429
|
+
for (const spec of plan.specs) {
|
|
430
|
+
ops.push({ op: 'set', path: ['providers', spec.routeId], value: buildCustomProviderValue(spec) });
|
|
431
|
+
}
|
|
432
|
+
ops.push({ op: 'unset', path: ['providers', deps.adapter.builtinProviderId] });
|
|
433
|
+
for (const stale of plan.staleRoutesToUnset) {
|
|
434
|
+
ops.push({ op: 'unset', path: ['providers', stale] });
|
|
435
|
+
}
|
|
436
|
+
const patchBak = backups.find((b) => b.originalPath === plan.target.patchPath);
|
|
437
|
+
if (patchBak !== undefined)
|
|
438
|
+
modifiedPatches.push(patchBak);
|
|
439
|
+
await settings.mutate('llm-pi-ai', ops, llmDesc.revision);
|
|
440
|
+
if (plan.defaultModelRewrite !== undefined) {
|
|
441
|
+
const dmDesc = settings.describe().find((d) => d.ns === 'agent-default-model');
|
|
442
|
+
if (dmDesc !== undefined) {
|
|
443
|
+
const dmOps = [
|
|
444
|
+
{ op: 'set', path: ['provider'], value: plan.defaultModelRewrite.nextProvider },
|
|
445
|
+
];
|
|
446
|
+
if (plan.defaultModelRewrite.nextModel !== plan.defaultModelRewrite.currentModel) {
|
|
447
|
+
dmOps.push({ op: 'set', path: ['model'], value: plan.defaultModelRewrite.nextModel });
|
|
448
|
+
}
|
|
449
|
+
await settings.mutate('agent-default-model', dmOps, dmDesc.revision);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
const record = {
|
|
453
|
+
version: 2,
|
|
454
|
+
adapterId: deps.adapter.id,
|
|
455
|
+
profileKey: plan.target.profileKey,
|
|
456
|
+
migratedAt: (deps.now ?? Date.now)(),
|
|
457
|
+
apiKeyEnv: plan.apiKeyEnv,
|
|
458
|
+
builtinProviderId: deps.adapter.builtinProviderId,
|
|
459
|
+
managedRoutes: plan.specs.map((s) => s.routeId),
|
|
460
|
+
previousBuiltinSection: plan.previousBuiltinSection,
|
|
461
|
+
previousManagedSections: plan.previousManagedSections,
|
|
462
|
+
...(plan.defaultModelRewrite !== undefined
|
|
463
|
+
? { previousDefaultModel: plan.defaultModelRewrite.previousConfig, rewroteDefaultModel: true }
|
|
464
|
+
: {}),
|
|
465
|
+
};
|
|
466
|
+
await plan.store.write(record);
|
|
467
|
+
await cleanupLegacyGoStoreKeys(accessor, plan.target.profileKey, Object.values(deps.config.routes));
|
|
468
|
+
}
|
|
469
|
+
if (plans.some((p) => p.target.isCurrent)) {
|
|
470
|
+
await deps.onCurrentProfileMigrated?.();
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
catch (err) {
|
|
474
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
475
|
+
for (const bak of modifiedPatches) {
|
|
476
|
+
await fs.writeFile(bak.originalPath, bak.sourceText, bak.mode).catch(() => { });
|
|
477
|
+
}
|
|
478
|
+
if (storeBak !== undefined) {
|
|
479
|
+
await fs.writeFile(deps.modelsStorePath, storeBak.sourceText, storeBak.mode).catch(() => { });
|
|
480
|
+
}
|
|
481
|
+
return {
|
|
482
|
+
kind: 'error',
|
|
483
|
+
text: `Migration failed (${msg}); modified files were restored from backup.`,
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
const summaryLines = [
|
|
487
|
+
`Migration succeeded for ${plans.length} profile(s):`,
|
|
488
|
+
...plans.map((p) => {
|
|
489
|
+
const slots = p.specs.map((s) => `${s.routeId}(${s.models.length})`).join(', ');
|
|
490
|
+
const dm = p.defaultModelRewrite !== undefined
|
|
491
|
+
? `; default-model -> ${p.defaultModelRewrite.nextProvider}/${p.defaultModelRewrite.nextModel}`
|
|
492
|
+
: '';
|
|
493
|
+
const refs = p.otherRefs.length > 0
|
|
494
|
+
? `; advisory refs remaining in other entries: ${p.otherRefs.map((h) => `${h.entryId}:${h.value}`).join(', ')}`
|
|
495
|
+
: '';
|
|
496
|
+
return `- ${p.target.profileKey}: deleted ${deps.adapter.builtinProviderId}, created [${slots}]${dm}${refs}`;
|
|
497
|
+
}),
|
|
498
|
+
];
|
|
499
|
+
return { kind: 'success', text: summaryLines.join('\n') };
|
|
500
|
+
}
|
|
501
|
+
export async function runOfficialRollback(deps, options = {}) {
|
|
502
|
+
const fs = deps.fs ?? createDefaultMigrateFs();
|
|
503
|
+
const profileKey = deps.currentProfile.key;
|
|
504
|
+
if (profileKey === undefined) {
|
|
505
|
+
return { kind: 'error', text: 'Cannot resolve current dsh profile identity.' };
|
|
506
|
+
}
|
|
507
|
+
const store = storeForProfile(deps, profileKey);
|
|
508
|
+
const record = await store.read();
|
|
509
|
+
if (record === undefined) {
|
|
510
|
+
return { kind: 'error', text: `[${profileKey}] No migration record found for ${deps.adapter.id}; nothing to roll back.` };
|
|
511
|
+
}
|
|
512
|
+
const settings = deps.currentSettings;
|
|
513
|
+
if (settings === undefined) {
|
|
514
|
+
return { kind: 'error', text: `[${profileKey}] settings service unavailable.` };
|
|
515
|
+
}
|
|
516
|
+
const stamp = formatStamp((deps.now ?? Date.now)());
|
|
517
|
+
const patchPath = deps.currentProfile.dir !== undefined ? join(deps.currentProfile.dir, 'cordis.patch.yml') : undefined;
|
|
518
|
+
const patchBak = patchPath !== undefined ? await createExclusiveBackup(fs, patchPath, stamp) : undefined;
|
|
519
|
+
const storeBak = await createExclusiveBackup(fs, deps.modelsStorePath, stamp);
|
|
520
|
+
const previewLines = [
|
|
521
|
+
`回退 ${deps.adapter.displayName} 迁移 (profile "${profileKey}"):`,
|
|
522
|
+
`- 还原 Builtin Provider: ${record.builtinProviderId}`,
|
|
523
|
+
`- 移除 Managed Custom Providers: ${record.managedRoutes.join(', ')}`,
|
|
524
|
+
...(record.rewroteDefaultModel && record.previousDefaultModel
|
|
525
|
+
? [`- 还原默认模型: ${String(record.previousDefaultModel.provider ?? '')}/${String(record.previousDefaultModel.model ?? '')}`]
|
|
526
|
+
: []),
|
|
527
|
+
...(patchBak || storeBak
|
|
528
|
+
? [`- 备份路径: ${[patchBak?.backupPath, storeBak?.backupPath].filter(Boolean).join(', ')}`]
|
|
529
|
+
: []),
|
|
530
|
+
];
|
|
531
|
+
const consent = await askSingleConfirmation(deps.resolveAsk?.(), 'official-rollback-confirm', previewLines.join('\n'), `回退 ${deps.adapter.displayName}`, LABEL_ROLLBACK, options.confirm === true, { agent: options.agent, signal: options.signal });
|
|
532
|
+
if (!consent.confirmed)
|
|
533
|
+
return { kind: 'error', text: consent.error };
|
|
534
|
+
try {
|
|
535
|
+
const descs = settings.describe();
|
|
536
|
+
const llmDesc = descs.find((d) => d.ns === 'llm-pi-ai');
|
|
537
|
+
if (llmDesc === undefined)
|
|
538
|
+
throw new Error('llm-pi-ai namespace missing');
|
|
539
|
+
const ops = [
|
|
540
|
+
{ op: 'set', path: ['providers', record.builtinProviderId], value: record.previousBuiltinSection },
|
|
541
|
+
];
|
|
542
|
+
const routesToClear = new Set([
|
|
543
|
+
...record.managedRoutes,
|
|
544
|
+
...Object.keys(record.previousManagedSections ?? {}),
|
|
545
|
+
]);
|
|
546
|
+
routesToClear.delete(record.builtinProviderId);
|
|
547
|
+
for (const routeId of routesToClear) {
|
|
548
|
+
const prev = record.previousManagedSections?.[routeId];
|
|
549
|
+
if (prev !== undefined && prev !== null) {
|
|
550
|
+
ops.push({ op: 'set', path: ['providers', routeId], value: prev });
|
|
551
|
+
}
|
|
552
|
+
else {
|
|
553
|
+
ops.push({ op: 'unset', path: ['providers', routeId] });
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
await settings.mutate('llm-pi-ai', ops, llmDesc.revision);
|
|
557
|
+
if (record.rewroteDefaultModel && record.previousDefaultModel !== undefined) {
|
|
558
|
+
const dmDesc = settings.describe().find((d) => d.ns === 'agent-default-model');
|
|
559
|
+
if (dmDesc !== undefined) {
|
|
560
|
+
const dmOps = [];
|
|
561
|
+
for (const [k, v] of Object.entries(record.previousDefaultModel)) {
|
|
562
|
+
dmOps.push({ op: 'set', path: [k], value: v });
|
|
563
|
+
}
|
|
564
|
+
if (dmOps.length > 0)
|
|
565
|
+
await settings.mutate('agent-default-model', dmOps, dmDesc.revision);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
await store.delete();
|
|
569
|
+
await deps.onCurrentProfileRolledBack?.();
|
|
570
|
+
}
|
|
571
|
+
catch (err) {
|
|
572
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
573
|
+
if (patchBak !== undefined && patchPath !== undefined) {
|
|
574
|
+
await fs.writeFile(patchPath, patchBak.sourceText, patchBak.mode).catch(() => { });
|
|
575
|
+
}
|
|
576
|
+
if (storeBak !== undefined) {
|
|
577
|
+
await fs.writeFile(deps.modelsStorePath, storeBak.sourceText, storeBak.mode).catch(() => { });
|
|
578
|
+
}
|
|
579
|
+
return { kind: 'error', text: `Rollback failed (${msg}); files restored from backup.` };
|
|
580
|
+
}
|
|
581
|
+
return {
|
|
582
|
+
kind: 'success',
|
|
583
|
+
text: `[${profileKey}] Rolled back ${deps.adapter.id}: restored ${record.builtinProviderId}, removed [${record.managedRoutes.join(', ')}], stopped auto-sync.`,
|
|
584
|
+
};
|
|
585
|
+
}
|
|
586
|
+
export async function runOfficialStatus(deps) {
|
|
587
|
+
const { adapter, config } = deps;
|
|
588
|
+
const alias = adapter.aliases[0] ?? adapter.id;
|
|
589
|
+
const profileKey = deps.currentProfile.key;
|
|
590
|
+
const descs = deps.currentSettings?.describe() ?? [];
|
|
591
|
+
const llmDesc = descs.find((d) => d.ns === 'llm-pi-ai');
|
|
592
|
+
const providers = llmDesc?.user?.providers ?? {};
|
|
593
|
+
const record = profileKey !== undefined ? await storeForProfile(deps, profileKey).read() : undefined;
|
|
594
|
+
const hostNative = (deps.detectHostSessionHeader ?? adapter.detectHostSessionHeader ?? (() => false))();
|
|
595
|
+
const lines = [
|
|
596
|
+
`${adapter.displayName} (${adapter.id}) status:`,
|
|
597
|
+
`- profile: ${profileKey ?? '(unknown)'}`,
|
|
598
|
+
`- migration: ${record !== undefined ? `migrated (at ${new Date(record.migratedAt).toISOString()}, keyRef=${record.apiKeyEnv})` : 'not migrated'}`,
|
|
599
|
+
`- auto-sync interval: ${config.intervalMinutes} min (0 = manual only)`,
|
|
600
|
+
`- sessionHeader: mode=${config.sessionHeader}, host-native=${hostNative ? 'yes' : 'no'}`,
|
|
601
|
+
];
|
|
602
|
+
const hasLegacyBuiltin = providers[adapter.builtinProviderId] !== undefined;
|
|
603
|
+
if (hasLegacyBuiltin) {
|
|
604
|
+
const builtinModels = providers[adapter.builtinProviderId]?.models;
|
|
605
|
+
lines.push(`- builtin ${adapter.builtinProviderId}: present (${Array.isArray(builtinModels) ? builtinModels.length : 'catalog'} models)`);
|
|
606
|
+
}
|
|
607
|
+
else {
|
|
608
|
+
lines.push(`- builtin ${adapter.builtinProviderId}: absent`);
|
|
609
|
+
}
|
|
610
|
+
const slotRoutes = new Set([
|
|
611
|
+
...(record?.managedRoutes ?? []),
|
|
612
|
+
...Object.values(config.routes),
|
|
613
|
+
]);
|
|
614
|
+
for (const routeId of slotRoutes) {
|
|
615
|
+
if (routeId === adapter.builtinProviderId)
|
|
616
|
+
continue;
|
|
617
|
+
const section = providers[routeId];
|
|
618
|
+
if (section !== undefined) {
|
|
619
|
+
const count = Array.isArray(section.models) ? section.models.length : 0;
|
|
620
|
+
lines.push(`- custom ${routeId}: active (api=${section.api ?? '?'}, models=${count}, static-headers=${section.headers ? 'yes' : 'no'})`);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
const keyRefs = record !== undefined ? [record.apiKeyEnv, ...adapter.defaultKeyRefs] : adapter.defaultKeyRefs;
|
|
624
|
+
const resolved = await resolveCredentialByRefs(deps.credentialCtx, keyRefs);
|
|
625
|
+
if (resolved.value === undefined) {
|
|
626
|
+
lines.push(`- official API: skipped (${resolved.ref} not configured)`);
|
|
627
|
+
}
|
|
628
|
+
else {
|
|
629
|
+
const fetched = await adapter.fetchAndPlan({
|
|
630
|
+
apiKey: resolved.value,
|
|
631
|
+
apiKeyEnv: resolved.ref,
|
|
632
|
+
config,
|
|
633
|
+
timeoutMs: deps.timeoutMs,
|
|
634
|
+
fetchImpl: deps.fetchImpl,
|
|
635
|
+
detectHostSessionHeader: deps.detectHostSessionHeader,
|
|
636
|
+
loadPiAiCompatHints: deps.loadPiAiCompatHints,
|
|
637
|
+
});
|
|
638
|
+
if (!fetched.ok) {
|
|
639
|
+
lines.push(`- official API: error (${fetched.error?.message ?? 'unknown'})`);
|
|
640
|
+
}
|
|
641
|
+
else {
|
|
642
|
+
const slotSummary = fetched.providers.map((p) => `${p.routeId}=${p.models.length}`).join(', ');
|
|
643
|
+
lines.push(`- official API: ok (${fetched.totalModels} models → ${slotSummary})`);
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
if (record === undefined) {
|
|
647
|
+
lines.push(hasLegacyBuiltin
|
|
648
|
+
? `Hint: run \`/model-sync migrate ${alias}\` to detach into Managed Custom Providers.`
|
|
649
|
+
: `Hint: configure \`${adapter.builtinProviderId}\` in settings first, then run \`/model-sync migrate ${alias}\`.`);
|
|
650
|
+
}
|
|
651
|
+
return { kind: 'success', text: lines.join('\n') };
|
|
652
|
+
}
|
|
653
|
+
//# sourceMappingURL=official-migrate.js.map
|