dsh-model-switch 0.4.68 → 0.4.70

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 (38) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/IMPLEMENTATION_PLAN.md +12 -1
  3. package/PRODUCT.md +3 -3
  4. package/README.en.md +16 -3
  5. package/README.md +16 -3
  6. package/cordis.patch.yml +9 -0
  7. package/lib/auto-review-CYvvootQ.js +1079 -0
  8. package/lib/auto-review.js +1 -1
  9. package/lib/automode-compat.js +1 -1
  10. package/lib/client.js +503 -47
  11. package/lib/compaction.js +1 -1
  12. package/lib/index.js +26 -7
  13. package/lib/prime-memory-compat.js +573 -1
  14. package/lib/prime-memory-route-DGUVfogE.js +117 -0
  15. package/lib/review-timeout-FB32BcnO.js +339 -0
  16. package/lib/review-timeout.js +1 -1
  17. package/lib/session-route-CRfpxarI.js +357 -0
  18. package/lib/session-title.js +17 -3
  19. package/lib/subagent-runtime-eNKrdb2H.js +424 -0
  20. package/lib/subagent-runtime.js +1 -1
  21. package/lib/tool-allowlist-cN9Z1XKn.js +489 -0
  22. package/lib/types/capabilities-rpc.d.ts +7 -0
  23. package/lib/types/client/ModelSwitchSettings.d.ts +6 -3
  24. package/lib/types/client/locales.d.ts +18 -2
  25. package/lib/types/client-contract.d.ts +33 -1
  26. package/lib/types/host-settings.d.ts +11 -0
  27. package/lib/types/prime-memory-compat.d.ts +14 -6
  28. package/lib/types/prime-memory-route.d.ts +22 -0
  29. package/lib/types/provider-group.d.ts +31 -3
  30. package/lib/types/session-route.d.ts +24 -3
  31. package/lib/types/session-title.d.ts +12 -0
  32. package/lib/types/tool-allowlist.d.ts +13 -0
  33. package/lib/types/vision-router-compat.d.ts +62 -0
  34. package/lib/types/vision-router-route.d.ts +94 -0
  35. package/lib/vision-router-compat-B9bkgJmh.js +312 -0
  36. package/lib/vision-router-compat-DP81VMLW.js +312 -0
  37. package/lib/vision-router-compat.js +2 -0
  38. package/package.json +6 -1
@@ -25,13 +25,18 @@
25
25
  */
26
26
  import type { Context } from '@deepseek-ai/cordis';
27
27
  import type { Entry } from '@deepseek-ai/cordis-plugin-loader';
28
- import { type CapabilityRoute } from './session-route.js';
28
+ import { type CapabilityRoute, type MemoryRoute } from './session-route.js';
29
29
  import { type DistillChainEntry } from './prime-memory-route.js';
30
30
  /** Row name and dependencies, mirroring the sibling adapter row. */
31
31
  export declare const name = "model-switch-prime-memory-compat";
32
32
  export declare const inject: string[];
33
- /** Why the adapter stayed out of the way. */
34
- export type PrimeMemoryRouteSkip = 'user-set' | 'no-route' | 'no-row' | 'no-service' | 'no-seam' | 'live-rejected';
33
+ /**
34
+ * Why the adapter stayed out of the way.
35
+ *
36
+ * `no-route` means the route itself is unset; `live-unavailable` means the
37
+ * memory plugin's live seam was unreachable (slow boot, retries exhausted).
38
+ */
39
+ export type PrimeMemoryRouteSkip = 'user-set' | 'no-route' | 'live-unavailable' | 'no-row' | 'no-service' | 'no-seam' | 'live-rejected';
35
40
  /** Live adapter state, surfaced next to the settings card. */
36
41
  export interface PrimeMemoryCompatStatus {
37
42
  /** Whether at least one write reached the memory plugin's settings. */
@@ -115,14 +120,16 @@ interface Loader {
115
120
  * call, and a document change reloads the composition — so pushing an unchanged
116
121
  * route re-triggers this adapter forever (a ~6 s recompose loop, observed with
117
122
  * `dsh-prime-memory@0.26.10`). Comparing first is what makes the push idempotent
118
- * across reloads.
123
+ * across reloads. The reasoning effort compares on both the global field and
124
+ * every layer entry; the plugin's schema defaults both to `''` (auto).
119
125
  *
120
126
  * @param value - the memory row's live settings object, as the forms describe it.
121
127
  * @param provider - route provider to compare against.
122
128
  * @param model - route model to compare against.
129
+ * @param effort - route reasoning effort to compare against; undefined means auto.
123
130
  * @returns true when a push would change nothing.
124
131
  */
125
- export declare function memoryLiveMatchesRoute(value: unknown, provider: string, model: string): boolean;
132
+ export declare function memoryLiveMatchesRoute(value: unknown, provider: string, model: string, effort?: string): boolean;
126
133
  /**
127
134
  * Hand the route to the memory plugin through the RPC it registers for its own
128
135
  * settings page.
@@ -136,6 +143,7 @@ export declare function memoryLiveMatchesRoute(value: unknown, provider: string,
136
143
  export declare function pushMemoryRoute(ctx: Context, route: {
137
144
  provider: string;
138
145
  model: string;
146
+ reasoningEffort?: string;
139
147
  }): Promise<'pushed' | 'absent' | 'rejected'>;
140
148
  /**
141
149
  * Read the memory plugin's live settings through the RPC its panel posts to.
@@ -161,7 +169,7 @@ export declare function readMemoryLive(ctx: Context): Promise<unknown>;
161
169
  * @param routeOf - resolves this plugin's distillation route for one settings snapshot.
162
170
  * @returns The disposer and a replay hook.
163
171
  */
164
- export declare function installPrimeMemoryCompat(ctx: Context, loader: Loader | undefined, routeOf: () => CapabilityRoute | undefined): {
172
+ export declare function installPrimeMemoryCompat(ctx: Context, loader: Loader | undefined, routeOf: () => MemoryRoute | undefined): {
165
173
  dispose: () => void;
166
174
  replay: () => boolean;
167
175
  };
@@ -73,3 +73,25 @@ export declare function distillChainPatch(chain: readonly DistillChainEntry[]):
73
73
  readonly distillChain: readonly DistillChainEntry[];
74
74
  };
75
75
  };
76
+ /** The subset of a loader entry the deployment-default reader reads. */
77
+ export interface DefaultModelRowLike {
78
+ readonly options?: {
79
+ readonly id?: unknown;
80
+ readonly config?: unknown;
81
+ };
82
+ }
83
+ /** A loader-like service whose entries can be scanned. */
84
+ export interface LoaderEntriesLike {
85
+ entries?(): Iterable<DefaultModelRowLike>;
86
+ }
87
+ /**
88
+ * The deployment default provider, canonicalized for group keying.
89
+ *
90
+ * The `agent-default-model` row names the provider new sessions start on; a
91
+ * deployment whose default is a dsh-vision-router twin (`${provider}-vision`)
92
+ * keys its deployment-wide groups under the base provider, so the twin suffix
93
+ * is stripped here.
94
+ * @param loader - the loader service, when present.
95
+ * @returns The base provider id, or undefined when the row or its provider is absent.
96
+ */
97
+ export declare function deploymentDefaultProviderOf(loader: LoaderEntriesLike | undefined): string | undefined;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Provider configuration groups: per-provider presets for the compaction,
3
- * auto-review, session-naming, and subagent routes.
3
+ * auto-review, session-naming, subagent, memory-distillation, and vision routes.
4
4
  *
5
5
  * A group is a DERIVED policy, not a write: `src/session-route.ts` resolves the
6
6
  * routes one session should use from its own provider plus this stored table, so
@@ -11,8 +11,8 @@
11
11
  *
12
12
  * All functions here are pure and never throw on malformed storage.
13
13
  */
14
- /** Flat settings fields a provider group carries across all four per-session capabilities. */
15
- export type ProviderGroupRouteField = 'compactProvider' | 'compactModel' | 'autoReviewProvider' | 'autoReviewModel' | 'subagentProvider' | 'subagentModel' | 'subagentReasoningEffort' | 'titleProvider' | 'titleModel' | 'memoryProvider' | 'memoryModel';
14
+ /** Flat settings fields a provider group carries across all capabilities. */
15
+ export type ProviderGroupRouteField = 'compactProvider' | 'compactModel' | 'autoReviewProvider' | 'autoReviewModel' | 'subagentProvider' | 'subagentModel' | 'subagentReasoningEffort' | 'titleProvider' | 'titleModel' | 'memoryProvider' | 'memoryModel' | 'memoryReasoningEffort' | 'visionProvider' | 'visionModel';
16
16
  /** Stored entry: the owning provider plus every route field; '' means the capability stays at its default. */
17
17
  export interface ProviderGroupEntry {
18
18
  provider: string;
@@ -28,6 +28,11 @@ export interface ProviderGroupEntry {
28
28
  /** Distillation route for the memory plugin; '' keeps that plugin's own default. */
29
29
  memoryProvider: string;
30
30
  memoryModel: string;
31
+ /** Distillation reasoning effort; '' keeps the memory plugin's auto resolution. */
32
+ memoryReasoningEffort: string;
33
+ /** Vision backend route for dsh-vision-router; '' keeps that plugin's own chain. */
34
+ visionProvider: string;
35
+ visionModel: string;
31
36
  }
32
37
  /** Normalized view of one provider's group; absent fields follow their default state. */
33
38
  export type ProviderGroupConfig = Partial<Record<ProviderGroupRouteField, string>>;
@@ -40,14 +45,37 @@ export type ProviderGroupsStorage = readonly ProviderGroupEntry[];
40
45
  * shapes are accepted: the stored entry array (keys live in each entry's
41
46
  * `provider` field) and a hand-written provider → routes map (keys are the
42
47
  * providers). All-empty entries stay: they pin a provider to every default.
48
+ * `-vision` twin groups fold into their base provider (see {@link foldTwinGroups}).
43
49
  */
44
50
  export declare function normalizeProviderGroups(raw: unknown): ProviderGroups;
51
+ /**
52
+ * The base provider id a dsh-vision-router twin route resolves to.
53
+ *
54
+ * dsh-vision-router materializes a `${provider}-vision` twin route for every
55
+ * enabled text provider (its own sync skips ids ending in `-vision`), and a
56
+ * session with vision on runs on that twin. Groups are keyed by the base
57
+ * provider: one group per provider whether vision is on or off.
58
+ * @param provider - the provider id a session or the deployment default names.
59
+ * @returns the base id (one trailing `-vision` stripped when the rest is non-empty), else the input unchanged.
60
+ */
61
+ export declare function canonicalGroupProvider(provider: string): string;
45
62
  /**
46
63
  * The saved group for a provider.
47
64
  * @returns the normalized group, or undefined when the provider has no group —
48
65
  * which is what leaves the live routes untouched during a switch.
49
66
  */
50
67
  export declare function groupOf(groups: ProviderGroups | undefined, provider: string): ProviderGroupConfig | undefined;
68
+ /**
69
+ * The saved group for a provider, resolving a vision twin to its base first.
70
+ *
71
+ * The base key wins over the raw twin key, which is what merges a twin group
72
+ * into its base; the raw key stays as a fallback so a group saved under a
73
+ * twin-only key still resolves before the stored entry is folded.
74
+ * @param groups - the normalized provider → group map.
75
+ * @param provider - the provider a session runs on or the deployment default names.
76
+ * @returns the normalized group, or undefined when neither key has one.
77
+ */
78
+ export declare function groupOfCanonical(groups: ProviderGroups | undefined, provider: string): ProviderGroupConfig | undefined;
51
79
  /** Storage entry for one provider's group; absent or blank route fields become ''. */
52
80
  export declare function entryOf(provider: string, group: ProviderGroupConfig): ProviderGroupEntry;
53
81
  /**
@@ -23,7 +23,7 @@ import type { Context } from '@deepseek-ai/cordis';
23
23
  import type { Session } from '@deepseek-ai/dsh-session';
24
24
  import { type ProviderGroups } from './provider-group.js';
25
25
  /** Capabilities whose route can be derived per session. */
26
- export type CapabilityId = 'compaction' | 'autoReview' | 'title' | 'subagent' | 'memory';
26
+ export type CapabilityId = 'compaction' | 'autoReview' | 'title' | 'subagent' | 'memory' | 'vision';
27
27
  /** A complete pinned route; either half missing means "follow the default". */
28
28
  export interface CapabilityRoute {
29
29
  readonly provider: string;
@@ -47,6 +47,10 @@ export interface RouteBearingSettings {
47
47
  readonly titleModel?: string;
48
48
  readonly memoryProvider?: string;
49
49
  readonly memoryModel?: string;
50
+ /** Distillation reasoning effort; blank keeps the memory plugin's auto resolution. */
51
+ readonly memoryReasoningEffort?: string;
52
+ readonly visionProvider?: string;
53
+ readonly visionModel?: string;
50
54
  readonly providerGroups?: ProviderGroups;
51
55
  }
52
56
  /**
@@ -56,6 +60,10 @@ export interface RouteBearingSettings {
56
60
  * @returns The complete pair, or undefined when the capability stays at its official/derived default.
57
61
  */
58
62
  export declare function deploymentRoute(settings: RouteBearingSettings | undefined, capability: CapabilityId): CapabilityRoute | undefined;
63
+ /** The distillation route plus the reasoning effort a distillation call carries. */
64
+ export interface MemoryRoute extends CapabilityRoute {
65
+ readonly reasoningEffort?: string;
66
+ }
59
67
  /**
60
68
  * The distillation route one deployment should use.
61
69
  *
@@ -63,12 +71,25 @@ export declare function deploymentRoute(settings: RouteBearingSettings | undefin
63
71
  * key is the deployment default provider (the provider the profile starts
64
72
  * sessions on) rather than a session's provider. A provider without a group falls
65
73
  * back to the flat memory pair; an empty pair leaves the memory plugin at its own
66
- * default.
74
+ * default. The reasoning effort rides the same layering: the group's effort,
75
+ * else the flat effort, else the memory plugin's own auto resolution.
76
+ * @param settings - live Model Switch settings.
77
+ * @param provider - the deployment default provider, when one is observable.
78
+ * @returns The complete route, or undefined when nothing is pinned.
79
+ */
80
+ export declare function memoryRouteOf(settings: RouteBearingSettings | undefined, provider: string | undefined): MemoryRoute | undefined;
81
+ /**
82
+ * The vision backend route one deployment should use.
83
+ *
84
+ * dsh-vision-router's backend chain is deployment-wide with no session of its
85
+ * own, so the group key is the deployment default provider — the same key the
86
+ * memory route uses. A provider without a group falls back to the flat vision
87
+ * pair; an empty pair leaves the vision plugin on its own chain.
67
88
  * @param settings - live Model Switch settings.
68
89
  * @param provider - the deployment default provider, when one is observable.
69
90
  * @returns The complete pair, or undefined when nothing is pinned.
70
91
  */
71
- export declare function memoryRouteOf(settings: RouteBearingSettings | undefined, provider: string | undefined): CapabilityRoute | undefined;
92
+ export declare function visionRouteOf(settings: RouteBearingSettings | undefined, provider: string | undefined): CapabilityRoute | undefined;
72
93
  /** One capability's route plus the reasoning effort a subagent spawn also carries. */
73
94
  export interface SubagentRoute extends CapabilityRoute {
74
95
  readonly reasoningEffort?: string;
@@ -287,6 +287,18 @@ export declare const TAKEOVER_MAX_ATTEMPTS = 20;
287
287
  * group or an unrelated plugin's row with a recycled id.
288
288
  */
289
289
  export declare function isOfficialTitleRow(entry: Entry | undefined): boolean;
290
+ /**
291
+ * The one-shot guidance for the layer-order naming conflict.
292
+ *
293
+ * An id-disable in this plugin's bundle patch cannot reach a row the
294
+ * session-titles bundle inserts in a LATER layer, so the profile's bundle
295
+ * order decides whether the official naming row arrives disabled. The runtime
296
+ * takeover still displaces it, but that order leaves the composition one
297
+ * "did not activate" warning away from blocking unrelated profile-persisting
298
+ * writes (observed in the lab: prime-memory settings-set rolling back on the
299
+ * composition warning). Names the two durable profile-side fixes.
300
+ */
301
+ export declare const NAMING_CONFLICT_GUIDANCE = "an official naming row is enabled in the composed tree (the session-titles bundle composes after dsh-model-switch, so this plugin id-disable cannot reach it). The takeover displaces it at runtime; to also keep the composition clean, either move the session-titles bundle before dsh-model-switch in the profile bundles list, or add a profile-patch row with id optional-session-title-all-prompts and disabled: true";
290
302
  /**
291
303
  * Mount the Model Switch session-naming row for this profile.
292
304
  *
@@ -69,6 +69,19 @@ export declare const SOURCE_BY_ID: ReadonlyMap<string, SourceCatalogEntry>;
69
69
  * child session seeds its preset from `permissionPresets.current(parent.session)`,
70
70
  * and this bypass answers `'custom'` for an allowlisted call in flight — releasing
71
71
  * them would hand the child no `auto` preset at all, i.e. no review.
72
+ * Beyond that rule sit the entries the user explicitly released (2026-10-24:
73
+ * goal/schedule/terminal creation; 2026-11-20: the vision model calls, the
74
+ * mineru document_parse task, todo/goal updates, and the prime-memory write
75
+ * tools). These do have side effects — vision calls spend the configured
76
+ * backend's quota and send image content to it, document_parse spawns a parse
77
+ * task, the memory tools mutate the memory store — but everything they enable
78
+ * stays inside the same session and auto preset. Releasing them only skips the
79
+ * reviewer; it grants no permission the preset did not already grant. The
80
+ * delegation spawns stay excluded regardless: a child session seeds its preset
81
+ * from the parent's in-flight bypass answer, so releasing them would strip the
82
+ * child of the auto preset entirely (see DELEGATION_SPAWNS in the tests).
83
+ * schedule_edit was reviewed on 2026-11-20 and deliberately kept OUT: it can
84
+ * modify or delete tasks other sessions created.
72
85
  */
73
86
  export declare const DEFAULT_READ_ONLY_TOOLS: readonly string[];
74
87
  /** Why one allowlist entry was refused. */
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Adapt `dsh-vision-router`'s backend chain to this plugin's vision route.
3
+ *
4
+ * The vision plugin owns an ordered `providers` chain in its `vision-router`
5
+ * row config and reads it live. The write crosses the same boundary the
6
+ * plugin's own settings facade uses: `ctx.configEditor.edit(entry, change)` —
7
+ * the released core ConfigEditor seam. The edit validates through the plugin's
8
+ * own Config schema (`providers` is declared there), persists into the profile
9
+ * patch row, and hot-reloads just that entry, so a provider switch applies
10
+ * without a Host restart. The plugin's HTTP local-settings transport stays
11
+ * unused: its BrowserAuth fence only admits an authenticated local browser,
12
+ * not a plugin fiber.
13
+ *
14
+ * The route itself is provider-group based: the group of the deployment
15
+ * default provider (canonicalized — a twin `${provider}-vision` default keys
16
+ * its base), falling back to the flat vision pair. Chain semantics are the
17
+ * managed head documented in `./vision-router-route.ts`: a configured route
18
+ * owns the first row, the user's own rows stay below as fallbacks, and an
19
+ * empty route leaves the chain untouched.
20
+ */
21
+ import type { Context } from '@deepseek-ai/cordis';
22
+ import { type CapabilityRoute } from './session-route.js';
23
+ /** Row name and dependencies, mirroring the sibling adapter rows. */
24
+ export declare const name = "model-switch-vision-router-compat";
25
+ export declare const inject: string[];
26
+ /** Why the adapter stayed out of the way. */
27
+ export type VisionRouterRouteSkip = 'no-row' | 'no-route' | 'no-seam' | 'rejected';
28
+ /** Live adapter state, surfaced next to the settings card. */
29
+ export interface VisionRouterCompatStatus {
30
+ /** Whether at least one write reached the vision plugin's row config. */
31
+ installed: boolean;
32
+ /** The `provider/model` written on the last pass. */
33
+ route?: string | undefined;
34
+ /** Why the route was not written, when it was not. */
35
+ routeSkipped?: VisionRouterRouteSkip | undefined;
36
+ /** How many settings-update replays this adapter has run (diagnostics). */
37
+ replays: number;
38
+ }
39
+ /** The state the settings page reads. */
40
+ export declare const visionRouterCompatStatus: VisionRouterCompatStatus;
41
+ /**
42
+ * Install the adapter for the whole profile.
43
+ *
44
+ * Runs on activation, on every `loader/patch-context` and `loader/entry-init`
45
+ * that concerns the vision plugin's row, once more after a short delay (the
46
+ * row is often composed after this one), when the `configEditor` service
47
+ * appears, and whenever this plugin's settings change. Every pass compares
48
+ * before writing: a ConfigEditor edit reconciles the profile and re-enters
49
+ * this adapter, so an unchanged head must not produce another write.
50
+ * @param ctx - this row's context.
51
+ * @param routeOf - resolves this plugin's vision route for one settings snapshot.
52
+ * @returns The disposer and a replay hook.
53
+ */
54
+ export declare function installVisionRouterCompat(ctx: Context, routeOf: () => CapabilityRoute | undefined): {
55
+ dispose: () => void;
56
+ replay: () => boolean;
57
+ };
58
+ /**
59
+ * Row entry point: adapt the vision plugin on activation and on remount.
60
+ * @param ctx - this row's context.
61
+ */
62
+ export declare function apply(ctx: Context): void;
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Model Switch's adapter to `dsh-vision-router`'s backend chain.
3
+ *
4
+ * dsh-vision-router owns the vision backend chain: an ordered `providers` list
5
+ * of `{ provider, model, fallbacks }` rows in its `vision-router` row config,
6
+ * each row a host llm provider/model the chain tries in order. This module only
7
+ * builds the chain Model Switch offers; it never runs a vision call, never
8
+ * rewrites another row, and never touches a route the user did not ask to
9
+ * change.
10
+ *
11
+ * Managed-head semantics: a configured route owns the chain's FIRST row (the
12
+ * primary backend); the rows the user already had stay below in their own order
13
+ * as fallbacks. Unlike the memory adapter there is no `user-set` skip: the
14
+ * chain is an ordered fallback table that is never empty (the built-in free
15
+ * endpoint is the runtime's last resort), so the head is the routing decision
16
+ * and a user-set head is exactly what a configured route replaces.
17
+ *
18
+ * All functions here are pure.
19
+ */
20
+ /** One row of dsh-vision-router's backend chain. */
21
+ export interface VisionProviderEntry {
22
+ readonly provider: string;
23
+ readonly model: string;
24
+ readonly fallbacks: readonly string[];
25
+ }
26
+ /** The loader row id dsh-vision-router is composed under (fixed by its bundle patch). */
27
+ export declare const VISION_ROUTER_ENTRY_ID = "vision-router";
28
+ /** The package name that identifies the row; the authoritative identity. */
29
+ export declare const VISION_ROUTER_PACKAGE = "dsh-vision-router";
30
+ /** dsh-vision-router's runtime cap on backend rows (`MAX_RUNTIME_PROVIDER_ROWS`). */
31
+ export declare const MAX_VISION_PROVIDER_ROWS = 32;
32
+ /** dsh-vision-router's per-identifier length cap (`MAX_RUNTIME_MODEL_ID_CHARS`). */
33
+ export declare const MAX_VISION_ID_CHARS = 512;
34
+ /** The subset of a loader entry this adapter reads. */
35
+ export interface RowLike {
36
+ readonly options?: {
37
+ readonly id?: unknown;
38
+ readonly name?: unknown;
39
+ };
40
+ }
41
+ /**
42
+ * Whether one loader entry is dsh-vision-router.
43
+ *
44
+ * The package name wins over the row id: a profile layer may rename the row,
45
+ * while an unrelated row could recycle the id.
46
+ * @param entry - the loader entry to test.
47
+ * @returns True for dsh-vision-router's row.
48
+ */
49
+ export declare function isVisionRouterRow(entry: RowLike | undefined): boolean;
50
+ /**
51
+ * The dsh-vision-router rows present in one loader tree.
52
+ * @param entries - the loader's entries.
53
+ * @returns Matching rows, in loader order.
54
+ */
55
+ export declare function visionRouterRows<T extends RowLike>(entries: Iterable<T>): T[];
56
+ /**
57
+ * Strip a raw providers value to well-formed chain rows.
58
+ *
59
+ * Mirrors dsh-vision-router's own runtime normalization: entries without a
60
+ * valid provider and model are dropped, fallbacks are kept as strings, and the
61
+ * chain is capped at the plugin's row limit.
62
+ * @param value - the raw `providers` config value, when present.
63
+ * @returns The valid rows, in stored order.
64
+ */
65
+ export declare function normalizeVisionProviderEntries(value: unknown): readonly VisionProviderEntry[];
66
+ /** What one plan decided about the backend chain. */
67
+ export interface VisionProvidersPlan {
68
+ /** The chain to install (unchanged when `changed` is false). */
69
+ readonly providers: readonly VisionProviderEntry[];
70
+ /** Whether the chain differs from the input. */
71
+ readonly changed: boolean;
72
+ /** The `provider/model` this plan pins, when it pins one. */
73
+ readonly route?: string | undefined;
74
+ /** Why nothing was written. */
75
+ readonly skipped?: 'no-route' | undefined;
76
+ }
77
+ /**
78
+ * The backend chain dsh-vision-router should run, given the route Model Switch wants.
79
+ *
80
+ * The chosen route goes first; the entries the plugin already had follow in
81
+ * their own order, minus any duplicate of the chosen pair (a duplicate is a
82
+ * guaranteed second failure, not a fallback) and minus the entry this adapter
83
+ * wrote on an earlier pass (identified by `adopted`, so a route change
84
+ * replaces in place instead of accumulating). An empty chosen route leaves the
85
+ * existing chain untouched.
86
+ * @param existing - the raw `providers` config value as currently stored.
87
+ * @param route - the route Model Switch wants first, if any.
88
+ * @param adopted - the `provider/model` this adapter wrote on an earlier pass.
89
+ * @returns The chain to write, whether it changed, and what was applied.
90
+ */
91
+ export declare function planVisionProviders(existing: unknown, route: {
92
+ readonly provider?: string;
93
+ readonly model?: string;
94
+ } | undefined, adopted?: string): VisionProvidersPlan;