@aiwayds/dsh-model-sync 0.11.1 → 0.12.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.
Files changed (45) hide show
  1. package/lib/index.d.ts +8 -0
  2. package/lib/index.js +90 -24
  3. package/lib/index.js.map +1 -1
  4. package/lib/opencode-go-diagnose.d.ts +43 -21
  5. package/lib/opencode-go-diagnose.js +87 -56
  6. package/lib/opencode-go-diagnose.js.map +1 -1
  7. package/lib/opencode-go-grouping.d.ts +4 -26
  8. package/lib/opencode-go-grouping.js +12 -68
  9. package/lib/opencode-go-grouping.js.map +1 -1
  10. package/lib/opencode-go-host-catalog.d.ts +42 -0
  11. package/lib/opencode-go-host-catalog.js +98 -0
  12. package/lib/opencode-go-host-catalog.js.map +1 -0
  13. package/lib/opencode-go-journal.d.ts +6 -2
  14. package/lib/opencode-go-journal.js +1 -1
  15. package/lib/opencode-go-journal.js.map +1 -1
  16. package/lib/opencode-go-migrate.d.ts +40 -5
  17. package/lib/opencode-go-migrate.js +313 -84
  18. package/lib/opencode-go-migrate.js.map +1 -1
  19. package/lib/opencode-go-migration.d.ts +43 -0
  20. package/lib/opencode-go-migration.js +91 -2
  21. package/lib/opencode-go-migration.js.map +1 -1
  22. package/lib/opencode-go-one-shot.d.ts +6 -0
  23. package/lib/opencode-go-one-shot.js +41 -4
  24. package/lib/opencode-go-one-shot.js.map +1 -1
  25. package/lib/opencode-go-planner.d.ts +39 -24
  26. package/lib/opencode-go-planner.js +275 -207
  27. package/lib/opencode-go-planner.js.map +1 -1
  28. package/lib/opencode-go-sync.d.ts +16 -3
  29. package/lib/opencode-go-sync.js +24 -0
  30. package/lib/opencode-go-sync.js.map +1 -1
  31. package/lib/opencode-go-writer.d.ts +17 -1
  32. package/lib/opencode-go-writer.js +111 -16
  33. package/lib/opencode-go-writer.js.map +1 -1
  34. package/package.json +2 -2
  35. package/src/index.ts +100 -25
  36. package/src/opencode-go-diagnose.ts +124 -70
  37. package/src/opencode-go-grouping.ts +14 -85
  38. package/src/opencode-go-host-catalog.ts +125 -0
  39. package/src/opencode-go-journal.ts +5 -3
  40. package/src/opencode-go-migrate.ts +352 -95
  41. package/src/opencode-go-migration.ts +116 -2
  42. package/src/opencode-go-one-shot.ts +49 -4
  43. package/src/opencode-go-planner.ts +293 -216
  44. package/src/opencode-go-sync.ts +40 -2
  45. package/src/opencode-go-writer.ts +127 -15
@@ -7,83 +7,36 @@
7
7
  // here is a pure function of its inputs so it can be exercised with offline
8
8
  // fixtures only.
9
9
  //
10
- // Design refs: §2.1/§6.2.2 (route fields + msg baseURL normalization),
11
- // §6.2.3 (grouping), §6.2.4 (ownership-aware merge), §6.2.5 (route fields),
12
- // §9.2-9.4 (keep the name, conflicts, empty routes), ADR-004 (ledger keyed
13
- // by keyFingerprint), ADR-005 (deletion gates). F25 is intentionally absent:
14
- // report 19 proved the host injects x-opencode-session, so no special header
15
- // handling belongs in the plan.
10
+ // 0.12.0 single-route (catalog-reuse) shape: the host only reuses pi-ai's
11
+ // builtin catalog provider when a route carries no `api` field, and pi-ai
12
+ // 1.6.0's opencode-go catalog gives every model its own per-protocol baseUrl —
13
+ // so a managed route must never carry `api`/`baseURL`. The plan therefore
14
+ // writes ONE route (the `chat` slot route) holding ALL official entries, and
15
+ // plans cleanup for the three legacy protocol routes: unset when fully
16
+ // plugin-managed, keep+warn when they hold user content. Report 19's per-slot
17
+ // api/baseURL tables are gone with the topology they described.
16
18
  import { createHash } from 'node:crypto';
17
19
  import { deriveKeyRef } from "./route-credential.js";
18
- import { GO_SLOT_ROUTES, groupGoModelsByProtocol, } from "./opencode-go-grouping.js";
19
- // ---------------------------------------------------------------------------
20
- // Static route-field plan (design §2.1 / §6.2.2, confirmed by report 19)
21
- // ---------------------------------------------------------------------------
22
- /** Host `api` value per slot (llm-pi-ai PROTOCOLS, report 19 §1). */
23
- export const GO_API_BY_SLOT = {
24
- chat: 'openai-completions',
25
- msg: 'anthropic-messages',
26
- resp: 'openai-responses',
27
- google: 'google-generative-ai',
28
- };
29
- /** The only display field the host uses to group providers (F22/13). */
30
- export const GO_DISPLAY_NAME_BY_SLOT = {
31
- chat: 'OpenCode Go',
32
- msg: 'OpenCode Go · msg',
33
- resp: 'OpenCode Go · resp',
34
- google: 'OpenCode Go · google',
35
- };
20
+ import { HOST_CATALOG_PROVIDER } from "./opencode-go-host-catalog.js";
21
+ import { GO_SLOT_ROUTES, } from "./opencode-go-grouping.js";
22
+ /** The display name planned for the single managed route (F22/13). */
23
+ export const GO_DISPLAY_NAME = 'OpenCode Go';
36
24
  /**
37
- * Fallback host baseURLs — the values report 19 confirmed end-to-end. Normally
38
- * the baseURL comes from the official payload (§6.2.2); these are used only
39
- * when a record carries no per-protocol `base_url`.
25
+ * Legacy route fields the writer must strip from the managed route (and that
26
+ * old 0.11.x routes carry). They are never part of a written plan.
40
27
  */
41
- export const GO_BASE_URL_BY_SLOT = {
42
- chat: 'https://opencode.ai/inference/go/openai/v1',
43
- msg: 'https://opencode.ai/inference/go/anthropic',
44
- resp: 'https://opencode.ai/inference/go/openai/v1',
45
- google: 'https://opencode.ai/inference/go/google/v1beta',
46
- };
47
- /** Official protocol keys that back each slot (§6.2.2 table). */
48
- export const GO_PROTOCOLS_BY_SLOT = {
49
- chat: ['chat-completions'],
50
- msg: ['messages'],
51
- resp: ['responses'],
52
- google: ['interactions', 'generate-content'],
53
- };
28
+ export const GO_LEGACY_ROUTE_FIELDS = ['api', 'baseURL'];
54
29
  /**
55
- * Normalize an official `base_url` for host use. Only `msg` changes: pi-ai
56
- * calls `beta.messages.create` and appends `/v1/messages?beta=true`, so the
57
- * trailing `/v1` must be stripped (ADR-003 / report 19 negative control).
58
- */
59
- export function normalizeGoBaseUrl(raw, slot) {
60
- const trimmed = raw.replace(/\/+$/, '');
61
- if (slot === 'msg' && trimmed.endsWith('/v1'))
62
- return trimmed.slice(0, -3);
63
- return trimmed;
64
- }
65
- /**
66
- * Build the route fields for a slot from the payload's per-protocol base_url.
30
+ * Build the planned route fields for the single managed route. `entries` is
31
+ * kept in the signature for symmetry with the migration caller (and future
32
+ * payload-driven fields); with the catalog-reuse shape the fields no longer
33
+ * depend on the payload — the endpoint lives in pi-ai's builtin catalog.
67
34
  * `ref` defaults to the P0-derived `OPENCODE_GO_API_KEY`.
68
35
  */
69
- export function planGoRouteFields(slot, entries, ref = deriveKeyRef('opencode-go')) {
70
- const protocols = GO_PROTOCOLS_BY_SLOT[slot];
71
- let raw;
72
- for (const entry of entries) {
73
- for (const protocol of protocols) {
74
- const base = entry.baseUrls[protocol];
75
- if (base !== undefined && base.length > 0) {
76
- raw = base;
77
- break;
78
- }
79
- }
80
- if (raw !== undefined)
81
- break;
82
- }
36
+ export function planGoRouteFields(entries, ref = deriveKeyRef('opencode-go')) {
37
+ void entries;
83
38
  return {
84
- api: GO_API_BY_SLOT[slot],
85
- baseURL: raw !== undefined ? normalizeGoBaseUrl(raw, slot) : GO_BASE_URL_BY_SLOT[slot],
86
- displayName: GO_DISPLAY_NAME_BY_SLOT[slot],
39
+ displayName: GO_DISPLAY_NAME,
87
40
  apiKeyEnv: ref,
88
41
  };
89
42
  }
@@ -136,7 +89,7 @@ function canonicalize(value) {
136
89
  export function profileHash(profile) {
137
90
  return createHash('sha256').update(JSON.stringify(canonicalize(profile))).digest('hex');
138
91
  }
139
- const OWNERSHIP_FIELDS = ['api', 'baseURL', 'apiKeyEnv'];
92
+ const OWNERSHIP_FIELDS = ['apiKeyEnv'];
140
93
  /** A current route conflicts only when a field is explicitly set to a different value. */
141
94
  function detectConflict(slot, route, fields, current) {
142
95
  if (current === undefined || !current.exists)
@@ -167,172 +120,287 @@ function ownedFieldsMatch(owned, fields) {
167
120
  /**
168
121
  * Build the write plan. Pure: identical inputs always produce an identical
169
122
  * plan (report/order included). No mutation of `options` or its nested values.
123
+ *
124
+ * Topology (0.12.0): ONE managed route (the `chat` slot route) receives ALL
125
+ * official entries; the three legacy protocol routes (msg/resp/google) are
126
+ * cleanup targets — unset when fully plugin-managed, kept with a warn when
127
+ * they hold user content.
170
128
  */
171
129
  export function planGoRoutes(options) {
172
130
  const ref = options.ref ?? deriveKeyRef('opencode-go');
173
131
  const routes = { ...GO_SLOT_ROUTES, ...(options.routes ?? {}) };
174
132
  const pinned = new Set(options.pinnedModels ?? []);
175
- const grouping = groupGoModelsByProtocol(options.entries);
176
133
  const report = [];
177
134
  const conflicts = [];
178
135
  const plannedRoutes = [];
179
136
  const unsetRoutes = [];
180
137
  const nextOwnership = { ...options.ownership };
181
138
  const desiredByRoute = {};
182
- // Unknown / otherwise unsupported protocols are fail-closed: reported, never
183
- // written (design §6.2.3, V1).
184
- for (const unassigned of grouping.unassigned) {
139
+ const entryById = new Map(options.entries.map((entry) => [entry.id, entry]));
140
+ // 0.12.1 catalog-intersection: ids the host runtime catalog does not know
141
+ // are NEVER desired — the host validates every route model id against its
142
+ // in-memory pi-ai catalog and rejects the whole mutate on one unknown id
143
+ // (fail-closed; incident migrate-go 20261129-114103: beam-free). The full
144
+ // official entry set stays in `entryById` for mapping/reports; the filtered
145
+ // ids are surfaced as one `needs-host-catalog` info line.
146
+ //
147
+ // P1-1 scope: that validation exists ONLY for the route that reuses the
148
+ // builtin catalog — the one NAMED after the catalog provider id
149
+ // (`go.routes.chat === 'opencode-go'`, the default). A custom go.routes.chat
150
+ // name keeps its own api/baseURL (it does not reuse any catalog), so the
151
+ // host never validates its ids against the runtime catalog: the whole
152
+ // restriction (filter, lag report, kept-host-unknown warnings) is off for it.
153
+ const hostSet = options.hostCatalogIds === undefined || routes.chat !== HOST_CATALOG_PROVIDER
154
+ ? undefined
155
+ : new Set(options.hostCatalogIds);
156
+ const lagIds = hostSet === undefined
157
+ ? []
158
+ : options.entries.map((entry) => entry.id).filter((id) => !hostSet.has(id)).sort((a, b) => a.localeCompare(b));
159
+ if (lagIds.length > 0) {
185
160
  report.push({
186
- level: 'warn',
187
- code: unassigned.reason,
188
- id: unassigned.id,
189
- message: `model ${unassigned.id} not assigned (${unassigned.protocols.join(',') || 'no protocols'})`,
161
+ level: 'info',
162
+ code: 'needs-host-catalog',
163
+ route: routes.chat,
164
+ slot: 'chat',
165
+ message: `host catalog lag: ${lagIds.join(', ')} not written — 官方 listing 有、宿主内置目录没有(宿主侧滞后,非本插件问题);宿主升级后 sync 自动纳入`,
190
166
  });
191
167
  }
192
- const entryById = new Map(options.entries.map((entry) => [entry.id, entry]));
193
- for (const slot of ['chat', 'msg', 'resp', 'google']) {
194
- const desiredIds = grouping.slots[slot] ?? [];
195
- const route = routes[slot];
196
- const current = options.currentRoutes[route];
197
- const ledgerKey = goOwnershipKey(route, options.keyFingerprint);
198
- const owned = options.ownership[ledgerKey];
199
- desiredByRoute[route] = [];
200
- // Google slot is conditional and default-off (design §2.1): materialize it
201
- // only when it has members, or when there is a previous ledger to clean up.
202
- if (slot === 'google' && desiredIds.length === 0 && owned === undefined)
203
- continue;
204
- const slotEntries = desiredIds
205
- .map((id) => entryById.get(id))
206
- .filter((entry) => entry !== undefined);
207
- const fields = planGoRouteFields(slot, slotEntries, ref);
208
- // Empty group: never produce a `models: []` write (§9.4 / A9). Unset a
209
- // fully plugin-managed route, otherwise skip (keeping the route as-is) and
210
- // report. A slot with no route at all is not planned at all.
211
- if (desiredIds.length === 0) {
212
- const currentModels = current?.models ?? [];
213
- if (current === undefined || !current.exists)
214
- continue;
215
- if (slot === 'chat') {
216
- // §9.4: an empty main route after a 200 is an upstream anomaly — keep
217
- // last-good, write nothing.
218
- plannedRoutes.push({ slot, route, fields, models: [...currentModels], unset: false, skip: true });
219
- report.push({ level: 'warn', code: 'upstream-empty', route, slot, message: 'main route has no members; kept last-good, no write' });
220
- continue;
221
- }
222
- const managed = owned?.managed ?? {};
223
- const fullyManaged = owned !== undefined
224
- && currentModels.length > 0
225
- && currentModels.every((model) => {
226
- const record = managed[model.id];
227
- return record !== undefined && record.hash === profileHash(model);
228
- })
229
- && ownedFieldsMatch(owned, fields);
230
- if (fullyManaged) {
231
- plannedRoutes.push({ slot, route, fields, models: [], unset: true, skip: false });
232
- unsetRoutes.push(route);
233
- report.push({ level: 'info', code: 'unset-route', route, slot, message: `route ${route} is empty and fully plugin-managed; unset` });
234
- delete nextOwnership[ledgerKey];
235
- }
236
- else {
237
- plannedRoutes.push({ slot, route, fields, models: [...currentModels], unset: false, skip: true });
238
- if (currentModels.length > 0) {
239
- report.push({ level: 'warn', code: 'route-empty-has-user-content', route, slot, message: `route ${route} is empty but has user content; kept, no empty write` });
240
- }
241
- }
242
- continue;
168
+ // Single-route desired set: every official entry the host catalog knows, in
169
+ // stable id order (0.12.0 behavior when no host catalog was supplied).
170
+ const desiredIds = [...entryById.keys()]
171
+ .filter((id) => hostSet === undefined || hostSet.has(id))
172
+ .sort((a, b) => a.localeCompare(b));
173
+ // --- The single managed route (chat slot) --------------------------------
174
+ const managedSlot = 'chat';
175
+ const managedRoute = routes[managedSlot];
176
+ const current = options.currentRoutes[managedRoute];
177
+ const ledgerKey = goOwnershipKey(managedRoute, options.keyFingerprint);
178
+ const owned = options.ownership[ledgerKey];
179
+ const fields = planGoRouteFields(options.entries, ref);
180
+ desiredByRoute[managedRoute] = [];
181
+ // H2: the main route's field conflict, hoisted so the legacy cleanup below
182
+ // can defer while the managed route is not writable.
183
+ let conflictOnMainRoute;
184
+ if (desiredIds.length === 0) {
185
+ const currentModels = current?.models ?? [];
186
+ if (current !== undefined && current.exists) {
187
+ // §9.4: an empty main route after a 200 is an upstream anomaly — keep
188
+ // last-good, write nothing.
189
+ plannedRoutes.push({ slot: managedSlot, route: managedRoute, fields, models: [...currentModels], unset: false, skip: true });
190
+ report.push({ level: 'warn', code: 'upstream-empty', route: managedRoute, slot: managedSlot, message: 'main route has no members; kept last-good, no write' });
243
191
  }
244
- const conflict = detectConflict(slot, route, fields, current);
192
+ }
193
+ else {
194
+ const conflict = detectConflict(managedSlot, managedRoute, fields, current);
245
195
  if (conflict !== undefined) {
246
196
  conflicts.push(conflict);
197
+ conflictOnMainRoute = conflict;
247
198
  report.push({
248
199
  level: 'error',
249
200
  code: 'route-conflict',
250
- route,
251
- slot,
252
- message: `${route}.${conflict.field} is ${conflict.actual}, expected ${conflict.expected}`,
201
+ route: managedRoute,
202
+ slot: managedSlot,
203
+ message: `${managedRoute}.${conflict.field} is ${conflict.actual}, expected ${conflict.expected}`,
253
204
  });
254
- continue;
255
205
  }
256
- const desiredById = new Map();
257
- for (const id of desiredIds) {
258
- const entry = entryById.get(id);
259
- if (entry !== undefined)
260
- desiredById.set(id, mapGoModelToProfile(entry));
261
- }
262
- desiredByRoute[route] = [...desiredById.values()];
263
- const currentModels = current?.models ?? [];
264
- const managed = owned?.managed ?? {};
265
- const nextManaged = {};
266
- const kept = [];
267
- for (const model of currentModels) {
268
- const id = model.id;
269
- const desired = desiredById.get(id);
270
- const record = managed[id];
271
- const hashMatches = record !== undefined && record.hash === profileHash(model);
272
- const hasOverride = (current?.overrideIds ?? []).includes(id);
273
- const isPinned = pinned.has(id);
274
- if (desired !== undefined) {
275
- if (record !== undefined && hashMatches) {
276
- // Plugin-owned and untouched: overwrite with the freshly mapped value.
277
- const next = desired;
278
- nextManaged[id] = { hash: profileHash(next) };
279
- kept.push(next);
280
- report.push({ level: 'info', code: 'overwrote-managed', route, slot, id, message: `refreshed plugin-managed model ${id}` });
206
+ else {
207
+ const desiredById = new Map();
208
+ for (const id of desiredIds) {
209
+ const entry = entryById.get(id);
210
+ if (entry !== undefined)
211
+ desiredById.set(id, mapGoModelToProfile(entry));
212
+ }
213
+ desiredByRoute[managedRoute] = [...desiredById.values()];
214
+ // Catalog-reuse strip notice: a route still carrying the old 0.11.x
215
+ // `api`/`baseURL` fields gets them unset this round (the writer emits
216
+ // the ops; this line explains why in the report). H3 scope: only the
217
+ // builtin catalog provider route may lose api/baseURL — catalog-reuse
218
+ // only exists for it. A custom go.routes.chat name (or a kept legacy
219
+ // custom route) NEEDS api/baseURL to be servable, so it is never
220
+ // stripped (empty-string fields are still garbage the host rejects and
221
+ // are stripped unconditionally by the writer).
222
+ if (managedRoute === HOST_CATALOG_PROVIDER && current !== undefined && current.exists
223
+ && GO_LEGACY_ROUTE_FIELDS.some((field) => current[field] !== undefined)) {
224
+ report.push({
225
+ level: 'info',
226
+ code: 'legacy-fields-strip',
227
+ route: managedRoute,
228
+ slot: managedSlot,
229
+ message: `route ${managedRoute} carries legacy api/baseURL fields; unsetting them so the host reuses the pi-ai builtin catalog provider (catalog-reuse fix)`,
230
+ });
231
+ }
232
+ const currentModels = current?.models ?? [];
233
+ const managed = owned?.managed ?? {};
234
+ const nextManaged = {};
235
+ const kept = [];
236
+ // H5: a KEPT id the host catalog does not know poisons every future
237
+ // mutate of this route (the host rejects the whole models array). The
238
+ // plan never removes user content on its own, so it warns instead — the
239
+ // actionable exits are a custom route (with api/baseURL) or the host
240
+ // upgrade.
241
+ const warnKeptHostUnknown = (id) => {
242
+ if (hostSet === undefined || hostSet.has(id))
243
+ return;
244
+ report.push({
245
+ level: 'warn',
246
+ code: 'kept-host-unknown',
247
+ route: managedRoute,
248
+ slot: managedSlot,
249
+ id,
250
+ message: `model ${id} kept but not in the host runtime catalog — 宿主可能拒绝本路由的全部写入;请迁移到带 api/baseURL 的自定义路由或等待宿主升级`,
251
+ });
252
+ };
253
+ for (const model of currentModels) {
254
+ const id = model.id;
255
+ const desired = desiredById.get(id);
256
+ const record = managed[id];
257
+ const hashMatches = record !== undefined && record.hash === profileHash(model);
258
+ const hasOverride = (current?.overrideIds ?? []).includes(id);
259
+ const isPinned = pinned.has(id);
260
+ if (desired !== undefined) {
261
+ if (record !== undefined && hashMatches) {
262
+ // Plugin-owned and untouched: overwrite with the freshly mapped value.
263
+ const next = desired;
264
+ nextManaged[id] = { hash: profileHash(next) };
265
+ kept.push(next);
266
+ report.push({ level: 'info', code: 'overwrote-managed', route: managedRoute, slot: managedSlot, id, message: `refreshed plugin-managed model ${id}` });
267
+ }
268
+ else {
269
+ // Not in ledger, or hash differs (user edited): keep as-is, never claim.
270
+ kept.push(model);
271
+ if (record !== undefined)
272
+ nextManaged[id] = record;
273
+ report.push({
274
+ level: 'info',
275
+ code: 'kept-user-owned',
276
+ route: managedRoute,
277
+ slot: managedSlot,
278
+ id,
279
+ message: record !== undefined ? `model ${id} was modified; kept user value` : `model ${id} is user-owned; kept`,
280
+ });
281
+ warnKeptHostUnknown(id);
282
+ }
283
+ continue;
281
284
  }
282
- else {
283
- // Not in ledger, or hash differs (user edited): keep as-is, never claim.
284
- kept.push(model);
285
- if (record !== undefined)
286
- nextManaged[id] = record;
287
- report.push({
288
- level: 'info',
289
- code: 'kept-user-owned',
290
- route,
291
- slot,
292
- id,
293
- message: record !== undefined ? `model ${id} was modified; kept user value` : `model ${id} is user-owned; kept`,
294
- });
285
+ // Not desired: the three deletion gates (ADR-005 / §6.2.4).
286
+ if (record !== undefined && hashMatches && !hasOverride && !isPinned) {
287
+ report.push({ level: 'info', code: 'deletion-candidate', route: managedRoute, slot: managedSlot, id, message: `model ${id} passed all three deletion gates` });
288
+ continue;
295
289
  }
296
- continue;
290
+ kept.push(model);
291
+ if (record !== undefined)
292
+ nextManaged[id] = record;
293
+ const code = record === undefined
294
+ ? 'kept-user-owned'
295
+ : !hashMatches
296
+ ? 'kept-modified'
297
+ : hasOverride
298
+ ? 'kept-override'
299
+ : 'kept-pinned';
300
+ report.push({ level: 'info', code, route: managedRoute, slot: managedSlot, id, message: `model ${id} kept (${code}); not removed` });
301
+ warnKeptHostUnknown(id);
297
302
  }
298
- // Not desired: the three deletion gates (ADR-005 / §6.2.4).
299
- if (record !== undefined && hashMatches && !hasOverride && !isPinned) {
300
- report.push({ level: 'info', code: 'deletion-candidate', route, slot, id, message: `model ${id} passed all three deletion gates` });
301
- continue;
303
+ // New desired ids (absent from settings) are added and claimed.
304
+ const currentIds = new Set(currentModels.map((model) => model.id));
305
+ for (const id of desiredIds) {
306
+ if (currentIds.has(id))
307
+ continue;
308
+ const profile = desiredById.get(id);
309
+ if (profile === undefined)
310
+ continue;
311
+ nextManaged[id] = { hash: profileHash(profile) };
312
+ kept.push(profile);
313
+ report.push({ level: 'info', code: 'added', route: managedRoute, slot: managedSlot, id, message: `added model ${id}` });
302
314
  }
303
- kept.push(model);
304
- if (record !== undefined)
305
- nextManaged[id] = record;
306
- const code = record === undefined
307
- ? 'kept-user-owned'
308
- : !hashMatches
309
- ? 'kept-modified'
310
- : hasOverride
311
- ? 'kept-override'
312
- : 'kept-pinned';
313
- report.push({ level: 'info', code, route, slot, id, message: `model ${id} kept (${code}); not removed` });
315
+ // `desiredIds` is non-empty here, so the merged array is never empty.
316
+ const merged = [...kept].sort((a, b) => a.id.localeCompare(b.id));
317
+ plannedRoutes.push({ slot: managedSlot, route: managedRoute, fields, models: merged, unset: false, skip: false });
318
+ // P1d-2 ownership: inherit the prior entry so migration-period fields
319
+ // (`preManagedSection` / `appliedAddedIds` and any future ones) survive the
320
+ // plan round-trip untouched. The planner never writes or clears these — it
321
+ // only refreshes the fields it owns (routeFields / managed). The go writer
322
+ // applies the same merge when it persists the ledger entry.
323
+ nextOwnership[ledgerKey] = { ...owned, routeFields: fields, managed: nextManaged };
314
324
  }
315
- // New desired ids (absent from settings) are added and claimed.
316
- const currentIds = new Set(currentModels.map((model) => model.id));
317
- for (const id of desiredIds) {
318
- if (currentIds.has(id))
319
- continue;
320
- const profile = desiredById.get(id);
321
- if (profile === undefined)
325
+ }
326
+ // --- Legacy protocol routes: cleanup plan ---------------------------------
327
+ // Only on a healthy payload: an anomalous empty listing must not trigger
328
+ // route teardown on top of the upstream anomaly.
329
+ // H2: also NOT while the main route has a field conflict — the writer
330
+ // executes routes independently, and a failed/skipped main-route write must
331
+ // never be followed by legacy unsets (the host validates route REMOVAL
332
+ // against no catalog, so the unsets would succeed and the user's
333
+ // non-chat-protocol models would be gone with the main route unwritten).
334
+ const conflictDeferred = conflictOnMainRoute !== undefined && desiredIds.length > 0;
335
+ if (conflictDeferred) {
336
+ report.push({
337
+ level: 'warn',
338
+ code: 'legacy-cleanup-deferred',
339
+ route: managedRoute,
340
+ slot: managedSlot,
341
+ message: `main route ${managedRoute} has a field conflict; legacy route cleanup is deferred to the round that fixes it (H2: never unset legacy routes while the managed route write is not healthy)`,
342
+ });
343
+ }
344
+ if (desiredIds.length > 0 && conflictOnMainRoute === undefined) {
345
+ for (const slot of ['msg', 'resp', 'google']) {
346
+ const route = routes[slot];
347
+ const routeCurrent = options.currentRoutes[route];
348
+ const legacyLedgerKey = goOwnershipKey(route, options.keyFingerprint);
349
+ const legacyOwned = options.ownership[legacyLedgerKey];
350
+ if ((routeCurrent === undefined || !routeCurrent.exists) && legacyOwned === undefined)
322
351
  continue;
323
- nextManaged[id] = { hash: profileHash(profile) };
324
- kept.push(profile);
325
- report.push({ level: 'info', code: 'added', route, slot, id, message: `added model ${id}` });
352
+ const legacyFields = planGoRouteFields(options.entries, ref);
353
+ const currentModels = routeCurrent?.models ?? [];
354
+ const managed = legacyOwned?.managed ?? {};
355
+ // Fully managed = the plugin owns every model present (an empty route
356
+ // with a ledger entry counts: it was emptied by a previous round), the
357
+ // recorded ownership fields match this plan, AND the section carries no
358
+ // user content the whole-route unset would destroy (M1): no
359
+ // modelOverrides, no pinned ids, no renamed-away apiKeyEnv, no unknown
360
+ // fields (headers, custom keys).
361
+ const overrideIds = routeCurrent?.overrideIds ?? [];
362
+ const unknownKeys = routeCurrent?.unknownKeys ?? [];
363
+ const liveApiKeyEnv = routeCurrent?.apiKeyEnv;
364
+ const apiKeyEnvUserTouched = liveApiKeyEnv !== undefined
365
+ && liveApiKeyEnv !== '' && liveApiKeyEnv !== legacyFields.apiKeyEnv;
366
+ const fullyManaged = legacyOwned !== undefined
367
+ && currentModels.every((model) => {
368
+ const record = managed[model.id];
369
+ return record !== undefined && record.hash === profileHash(model);
370
+ })
371
+ && currentModels.every((model) => !pinned.has(model.id))
372
+ && overrideIds.length === 0
373
+ && unknownKeys.length === 0
374
+ && !apiKeyEnvUserTouched
375
+ && ownedFieldsMatch(legacyOwned, legacyFields);
376
+ if (fullyManaged) {
377
+ plannedRoutes.push({ slot, route, fields: legacyFields, models: [], unset: true, skip: false });
378
+ unsetRoutes.push(route);
379
+ report.push({ level: 'info', code: 'unset-legacy-route', route, slot, message: `legacy route ${route} is superseded by the single managed route and fully plugin-managed; unset` });
380
+ delete nextOwnership[legacyLedgerKey];
381
+ }
382
+ else {
383
+ plannedRoutes.push({ slot, route, fields: legacyFields, models: [...currentModels], unset: false, skip: true });
384
+ const userContent = [];
385
+ if (currentModels.length > 0)
386
+ userContent.push(`${currentModels.length} model(s)`);
387
+ if (overrideIds.length > 0)
388
+ userContent.push(`modelOverrides: ${overrideIds.join(', ')}`);
389
+ if (unknownKeys.length > 0)
390
+ userContent.push(`custom fields: ${unknownKeys.join(', ')}`);
391
+ if (apiKeyEnvUserTouched)
392
+ userContent.push(`apiKeyEnv: ${liveApiKeyEnv}`);
393
+ // P3: when pinned ids are the ONLY reason the route stays, say so —
394
+ // otherwise the keep looks unexplained (the fully-managed unset gates
395
+ // would have passed without them).
396
+ const pinnedKept = currentModels.filter((model) => pinned.has(model.id)).map((model) => model.id);
397
+ if (pinnedKept.length > 0)
398
+ userContent.push(`pinned: ${pinnedKept.join(', ')}`);
399
+ if (userContent.length > 0) {
400
+ report.push({ level: 'warn', code: 'legacy-route-kept', route, slot, message: `legacy route ${route} holds user content (${userContent.join('; ')}); kept as-is (superseded by the single managed route)` });
401
+ }
402
+ }
326
403
  }
327
- // `desiredIds` is non-empty here, so the merged array is never empty.
328
- const merged = [...kept].sort((a, b) => a.id.localeCompare(b.id));
329
- plannedRoutes.push({ slot, route, fields, models: merged, unset: false, skip: false });
330
- // P1d-2 ownership: inherit the prior entry so migration-period fields
331
- // (`preManagedSection` / `appliedAddedIds` and any future ones) survive the
332
- // plan round-trip untouched. The planner never writes or clears these — it
333
- // only refreshes the fields it owns (routeFields / managed). The go writer
334
- // applies the same merge when it persists the ledger entry.
335
- nextOwnership[ledgerKey] = { ...owned, routeFields: fields, managed: nextManaged };
336
404
  }
337
405
  return { routes: plannedRoutes, unsetRoutes, conflicts, report, nextOwnership, desiredByRoute };
338
406
  }
@@ -1 +1 @@
1
- {"version":3,"file":"opencode-go-planner.js","sourceRoot":"","sources":["../src/opencode-go-planner.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,wDAAwD;AACxD,EAAE;AACF,yEAAyE;AACzE,8EAA8E;AAC9E,6EAA6E;AAC7E,4EAA4E;AAC5E,iBAAiB;AACjB,EAAE;AACF,uEAAuE;AACvE,4EAA4E;AAC5E,2EAA2E;AAC3E,6EAA6E;AAC7E,6EAA6E;AAC7E,gCAAgC;AAEhC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAGxC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EACL,cAAc,EACd,uBAAuB,GAExB,MAAM,2BAA2B,CAAA;AAElC,8EAA8E;AAC9E,yEAAyE;AACzE,8EAA8E;AAE9E,qEAAqE;AACrE,MAAM,CAAC,MAAM,cAAc,GAA0C;IACnE,IAAI,EAAE,oBAAoB;IAC1B,GAAG,EAAE,oBAAoB;IACzB,IAAI,EAAE,kBAAkB;IACxB,MAAM,EAAE,sBAAsB;CAC/B,CAAA;AAED,wEAAwE;AACxE,MAAM,CAAC,MAAM,uBAAuB,GAA0C;IAC5E,IAAI,EAAE,aAAa;IACnB,GAAG,EAAE,mBAAmB;IACxB,IAAI,EAAE,oBAAoB;IAC1B,MAAM,EAAE,sBAAsB;CAC/B,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAA0C;IACxE,IAAI,EAAE,4CAA4C;IAClD,GAAG,EAAE,4CAA4C;IACjD,IAAI,EAAE,4CAA4C;IAClD,MAAM,EAAE,gDAAgD;CACzD,CAAA;AAED,iEAAiE;AACjE,MAAM,CAAC,MAAM,oBAAoB,GAAqD;IACpF,IAAI,EAAE,CAAC,kBAAkB,CAAC;IAC1B,GAAG,EAAE,CAAC,UAAU,CAAC;IACjB,IAAI,EAAE,CAAC,WAAW,C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