@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
@@ -8,10 +8,6 @@ import type { GoJournalStore } from './opencode-go-journal.ts';
8
8
  import type { Logger, SettingsDescriptor, SettingsService } from './writer.ts';
9
9
  /** What apply will do with one route. */
10
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
11
  export interface MigrationIdClass {
16
12
  id: string;
17
13
  kind: MigrationIdKind;
@@ -59,6 +55,20 @@ export interface MigrationIdPlan {
59
55
  managed?: boolean;
60
56
  reason: string;
61
57
  }
58
+ /**
59
+ * Classification of one id that exists in the current route (design §14.2).
60
+ * 0.12.1 adds `host-catalog-lag`: an OFFICIAL id the host runtime catalog does
61
+ * not know (the host would reject any route write carrying it — fail-closed;
62
+ * incident migrate-go 20261129-114103: beam-free).
63
+ */
64
+ export type MigrationIdKind =
65
+ /** Official desired id — always targets the single managed route (0.12.0). */
66
+ 'desired' | 'legacy-other-protocol' | 'unknown-retired' | 'user-extra'
67
+ /** Public catalog unavailable (offline/401/403) — fail-closed, never deleted (§14.2). */
68
+ | 'unclassified'
69
+ /** Official but absent from the host runtime catalog (0.12.1): not written;
70
+ * plugin-written leftovers are removed to keep the route writable. */
71
+ | 'host-catalog-lag';
62
72
  export type RewriteRefMode = 'none' | 'default-model' | 'config';
63
73
  /** A reference candidate reported by plan. Only verified config keys may be rewritten. */
64
74
  export interface ReferenceCandidate {
@@ -100,6 +110,16 @@ export interface MigrationPlanBody {
100
110
  /** True when apply cannot guarantee verbatim action-table execution: plan mode
101
111
  * is `adopt-disabled` and `--adopt` is rejected at the command layer (§14.2). */
102
112
  adoptDisabled: boolean;
113
+ /**
114
+ * 0.12.1 host-catalog intersection. `true` when the host runtime catalog ids
115
+ * were supplied; `hostCatalogLagIds` lists the OFFICIAL ids they exclude from
116
+ * the desired write (the host rejects any route carrying them — fail-closed).
117
+ * `false` (including the explicit null fail-closed input) keeps the 0.12.0
118
+ * full-listing desired set and an empty lag list.
119
+ */
120
+ hostCatalogAvailable: boolean;
121
+ /** Official ids excluded from the desired write because the host runtime catalog does not know them. */
122
+ hostCatalogLagIds: string[];
103
123
  references: ReferenceCandidate[];
104
124
  pinnedSuggestions: string[];
105
125
  backupPath: string;
@@ -139,6 +159,16 @@ export interface BuildPlanInput {
139
159
  * neither set are `user-extra` (user-written, never auto-deleted). `undefined`
140
160
  * means the catalog was unavailable → fail-closed `unclassified`. */
141
161
  publicCatalogIds?: readonly string[];
162
+ /**
163
+ * 0.12.1 host runtime catalog ids for opencode-go. `undefined` = not
164
+ * supplied (legacy 0.12.0 behavior, no filtering); an array intersects the
165
+ * desired set — excluded official ids become `host-catalog-lag` (not
166
+ * written; plugin-written leftovers on routes are removed to keep the route
167
+ * writable, user/pinned/override leftovers are kept with an explicit
168
+ * warning); `null` = the catalog could not be read → FAIL-CLOSED: the
169
+ * builder refuses (writes must never carry an unverified listing).
170
+ */
171
+ hostCatalogIds?: readonly string[] | null;
142
172
  /** Apply cannot execute the per-id table → plan mode `adopt-disabled` and
143
173
  * `--adopt` rejected at the command layer (design §14.2 fallback). */
144
174
  adoptDisabled?: boolean;
@@ -216,6 +246,11 @@ export interface MigrateDeps {
216
246
  /** Official public catalog ids, used to distinguish unknown-retired from user-extra.
217
247
  * `undefined` → fail-closed `unclassified` (never deleted). */
218
248
  publicCatalogIds?: readonly string[];
249
+ /**
250
+ * 0.12.1 host runtime catalog ids (see BuildPlanInput). `null` fails the
251
+ * whole apply CLOSED before anything is built or written.
252
+ */
253
+ hostCatalogIds?: readonly string[] | null;
219
254
  /** Capability flag: `--adopt` is refused at the command layer when the per-id
220
255
  * action table cannot be executed verbatim (design §14.2 fallback). */
221
256
  adoptDisabled?: boolean;
@@ -278,7 +313,7 @@ export declare function buildRouteWriteStates(table: MigrationActionTable, desc:
278
313
  byRoute: Map<string, RouteWriteState>;
279
314
  results: MigrateApplyActionResult[];
280
315
  };
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';
316
+ export type MigrateApplyReason = 'applied' | 'consent-required' | 'plan-hash-mismatch' | 'confirm-code-mismatch' | 'ack-required' | 'adopt-disabled' | 'unknown-action' | 'nothing-to-apply' | 'sync-in-flight' | 'host-catalog-unavailable' | 'host-catalog-unknown-models' | 'write-failed';
282
317
  /** Result of ONE row of the plan's action table — mirrors it one-to-one (V19). */
283
318
  export interface MigrateApplyActionResult {
284
319
  id: string;