@aiwayds/dsh-model-sync 0.12.1 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +116 -0
- package/lib/official-migrate.js +643 -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 +840 -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
package/lib/index.d.ts
CHANGED
|
@@ -1,132 +1,52 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* dsh-model-sync —
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* Supports two write modes:
|
|
6
|
-
* - 'settings' (default): self-contained fetch → translate → settings.mutate
|
|
7
|
-
* pipeline that writes through the host settings service (zero patch
|
|
8
|
-
* required; settings.yaml up to dsh 0.1.6, the profile patch on 0.1.7+)
|
|
9
|
-
* - 'overlay' (legacy, deprecated): delegates to the patched dsh-llm-pi-ai's
|
|
10
|
-
* piAiCatalog.refresh() to overlay pi.dev entries in memory. dsh 0.2.1
|
|
11
|
-
* removed the piAiCatalog seam entirely (the pi-ai 0.87.1 → 1.3.0
|
|
12
|
-
* ModelsStore rework), so this mode can never refresh there and every
|
|
13
|
-
* round degrades to a notice; use the settings mode.
|
|
2
|
+
* dsh-model-sync — keep Builtin Providers synchronized with pi.dev and
|
|
3
|
+
* detach supported Official Sync vendors (starting with OpenCode Go) into
|
|
4
|
+
* per-protocol Managed Custom Providers backed by their official models API.
|
|
14
5
|
*
|
|
15
6
|
* @module dsh-model-sync
|
|
16
7
|
*/
|
|
17
8
|
import z from '@deepseek-ai/schemastery';
|
|
18
9
|
import type { Context } from '@deepseek-ai/cordis';
|
|
19
|
-
import { type RemoteCatalogEntry } from './remote-catalog.ts';
|
|
10
|
+
import { type ModelsStoreAccessor, type RemoteCatalogEntry } from './remote-catalog.ts';
|
|
20
11
|
import { type BuiltinModelData } from './translate.ts';
|
|
21
|
-
import { type
|
|
12
|
+
import { type SessionHeaderMode } from './official-adapter.ts';
|
|
13
|
+
import { type MigrateFs } from './official-migrate.ts';
|
|
14
|
+
import type { PatchFileIo } from './opencode-go-patch-file.ts';
|
|
22
15
|
export declare const name = "dsh-model-sync";
|
|
23
|
-
/** The settings seam this plugin consumes (its own config namespace). */
|
|
24
16
|
export declare const inject: string[];
|
|
25
|
-
/**
|
|
26
|
-
export declare const
|
|
27
|
-
export declare const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
export declare const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
* adapter's in-memory catalog via `llm.discoverModels`). Tests inject an
|
|
34
|
-
* array, `null` (fail-closed shape) or an async function; production resolves
|
|
35
|
-
* through the llm seam at each call site so a host adapter swap is picked up
|
|
36
|
-
* live.
|
|
37
|
-
*/
|
|
38
|
-
export declare const GO_HOST_CATALOG_SERVICE = "goHostCatalog";
|
|
39
|
-
/** Capability flag: when true, `--adopt` is refused and plan mode is adopt-disabled. */
|
|
40
|
-
export declare const GO_MIGRATION_ADOPT_DISABLED_SERVICE = "goMigrationAdoptDisabled";
|
|
41
|
-
/** Optional override for the single-flight check (tests inject an in-flight mutex). */
|
|
42
|
-
export declare const GO_MIGRATION_MUTEX_SERVICE = "goMigrationMutex";
|
|
43
|
-
/** O1/C2 seam: injected write-ahead journal store (tests use a temp-dir store). */
|
|
44
|
-
export declare const GO_JOURNAL_STORE_SERVICE = "goJournalStore";
|
|
45
|
-
/**
|
|
46
|
-
* One-shot migrate-go path overrides (tests point everything at a temp dir;
|
|
47
|
-
* a host may pin non-default locations). Plain `undefined` fields fall back
|
|
48
|
-
* to resolveDshHome() / MODELS_STORE_PATH / `<home>/profiles`.
|
|
49
|
-
*/
|
|
50
|
-
export declare const GO_ONESHOT_PATHS_SERVICE = "goOneShotPaths";
|
|
51
|
-
export interface GoOneShotPaths {
|
|
17
|
+
/** Optional test/host service seams for Official Sync. */
|
|
18
|
+
export declare const OFFICIAL_FETCH_SERVICE = "officialFetch";
|
|
19
|
+
export declare const OFFICIAL_SCHEDULER_TIMERS_SERVICE = "officialSchedulerTimers";
|
|
20
|
+
export declare const OFFICIAL_SCHEDULER_RANDOM_SERVICE = "officialSchedulerRandom";
|
|
21
|
+
export declare const OFFICIAL_SESSION_HEADER_DETECT_SERVICE = "officialSessionHeaderDetect";
|
|
22
|
+
export declare const OFFICIAL_COMPAT_HINTS_SERVICE = "officialCompatHints";
|
|
23
|
+
export declare const OFFICIAL_MIGRATION_PATHS_SERVICE = "officialMigrationPaths";
|
|
24
|
+
export interface OfficialMigrationPaths {
|
|
52
25
|
home?: string;
|
|
53
26
|
modelsStorePath?: string;
|
|
54
27
|
profilesDir?: string;
|
|
55
|
-
|
|
56
|
-
|
|
28
|
+
fs?: MigrateFs;
|
|
29
|
+
patchIoFor?: (path: string) => PatchFileIo;
|
|
30
|
+
storeAccessor?: ModelsStoreAccessor;
|
|
31
|
+
now?: () => number;
|
|
57
32
|
}
|
|
58
|
-
/**
|
|
59
|
-
* The plugin's `Config` schema: the settings form the 0.1.7 host projects from
|
|
60
|
-
* the `dsh-model-sync` entry. Every field is user-adjustable and therefore
|
|
61
|
-
* `.volatile()` — volatile fields are the only ones the settings page can edit
|
|
62
|
-
* (and the only ones the legacy settings.yaml import accepts), and they hot-
|
|
63
|
-
* reload without remounting the plugin. Requires schemastery >= 3.18.4 (the
|
|
64
|
-
* version the dsh 0.1.7 wave ships), which provides `.volatile()`.
|
|
65
|
-
*/
|
|
66
33
|
export declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
67
|
-
/**
|
|
68
|
-
* Write mode: 'settings' (default, zero-patch settings.mutate pipeline) or
|
|
69
|
-
* 'overlay'. DEPRECATED: 'overlay' delegates to the patched adapter's
|
|
70
|
-
* piAiCatalog.refresh, a seam dsh 0.2.1 removed outright (pi-ai 1.3.0
|
|
71
|
-
* ModelsStore rework) — every overlay round now degrades to a notice.
|
|
72
|
-
* Use the settings mode.
|
|
73
|
-
*/
|
|
74
34
|
writeMode: z<"settings" | "overlay", "settings" | "overlay", "volatile-defined">;
|
|
75
|
-
/** Minutes between auto refreshes (default 240 = 4 hours); 0 = startup-only. */
|
|
76
35
|
intervalMinutes: z<number, number, "volatile-defined">;
|
|
77
|
-
/** Delay before the first auto refresh, so the llm adapter is ready. */
|
|
78
36
|
startupDelaySeconds: z<number, number, "volatile-defined">;
|
|
79
|
-
/** Abort budget for one forced refresh's network round. */
|
|
80
37
|
refreshTimeoutMs: z<number, number, "volatile-defined">;
|
|
81
|
-
/** Routes to manage (empty = all pi.dev routes). */
|
|
82
38
|
managedRoutes: z<NoInfer<string[]>, NoInfer<string[]>, "volatile-defined">;
|
|
83
|
-
/** Keep builtin-only models not in pi.dev (smooth migration). */
|
|
84
39
|
keepBuiltinOnly: z<boolean, boolean, "volatile-defined">;
|
|
85
|
-
/** Drop unserviceable entries (true) or abort the entire route (false). */
|
|
86
40
|
dropUnserviceable: z<boolean, boolean, "volatile-defined">;
|
|
87
|
-
/**
|
|
88
|
-
* Union each mapped route's first-party /models listing into the pi.dev
|
|
89
|
-
* result (additions only — see provider-native.ts). Default on: the native
|
|
90
|
-
* listing is the fresher source; pi.dev lags (measured 2026-09-22).
|
|
91
|
-
*/
|
|
92
41
|
providerNativeFetch: z<boolean, boolean, "volatile-defined">;
|
|
93
|
-
/** Notify on changes (logger + /model-sync report). */
|
|
94
42
|
syncNotify: z<boolean, boolean, "volatile-defined">;
|
|
95
|
-
/**
|
|
96
|
-
* Force all models with a non-empty thinkingFormat to have max reasoning
|
|
97
|
-
* effort. Skips S2 gate's SRE check, ensures reasoningEfforts contains
|
|
98
|
-
* max, and forces compat.supportsReasoningEffort=true (S5 gate, openai-
|
|
99
|
-
* completions only). 400 risk is on the user.
|
|
100
|
-
*/
|
|
101
43
|
forceMaxReasoningEffort: z<boolean, boolean, "volatile-defined">;
|
|
102
|
-
/**
|
|
103
|
-
* keepBuiltinOnly may re-emit builtin ids the official default model list
|
|
104
|
-
* dropped (dsh 0.1.7 removed deepseek-v4-flash / deepseek-v4-flash-vision-
|
|
105
|
-
* exp). Those stay in the snapshot for historical user configurations but
|
|
106
|
-
* are excluded from the synced list unless this flag opts them back in —
|
|
107
|
-
* a re-emitted retired id is a model the 0.1.7 host no longer resolves.
|
|
108
|
-
*/
|
|
109
44
|
keepDeprecatedBuiltin: z<boolean, boolean, "volatile-defined">;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
* Config schema in P1: read-only subset (go.enabled/ref/modelsUrl/
|
|
113
|
-
* intervalMinutes, zen.enabled/ref/mode/modelsUrl) plus the write-side subset
|
|
114
|
-
* (go.routes/adoptExisting/pinnedModels/confirmRemovals,
|
|
115
|
-
* zen.routes/seedFromBuiltin). Defaults are byte-for-byte the P0 constants —
|
|
116
|
-
* `modelsUrl` and `ref` are imported from the P0 modules so a P0→P1 drift is
|
|
117
|
-
* impossible. Zen stays login-only with no modelsUrl by default (design A5).
|
|
118
|
-
* Nested leaves are `.volatile()` (host settings can edit them); the parent
|
|
119
|
-
* objects are not, because schemastery forbids a volatile field under an
|
|
120
|
-
* enclosing volatile field.
|
|
121
|
-
*/
|
|
122
|
-
opencode: z<Schemastery.ObjectS<NoInfer<{
|
|
123
|
-
go: z<Schemastery.ObjectS<NoInfer<{
|
|
124
|
-
enabled: z<boolean, boolean, "volatile-defined">;
|
|
125
|
-
ref: z<string, string, "volatile-defined">;
|
|
126
|
-
modelsUrl: z<string, string, "volatile-defined">;
|
|
45
|
+
officialSync: z<Schemastery.ObjectS<NoInfer<{
|
|
46
|
+
'opencode-go': z<Schemastery.ObjectS<NoInfer<{
|
|
127
47
|
intervalMinutes: z<number, number, "volatile-defined">;
|
|
128
|
-
|
|
129
|
-
|
|
48
|
+
modelsUrl: z<string, string, "volatile-defined">;
|
|
49
|
+
sessionHeader: z<"none" | "auto" | "static", "none" | "auto" | "static", "volatile-defined">;
|
|
130
50
|
routes: z<Schemastery.ObjectS<NoInfer<{
|
|
131
51
|
chat: z<string, string, "volatile-defined">;
|
|
132
52
|
msg: z<string, string, "volatile-defined">;
|
|
@@ -138,14 +58,10 @@ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
|
138
58
|
resp: z<string, string, "volatile-defined">;
|
|
139
59
|
google: z<string, string, "volatile-defined">;
|
|
140
60
|
}>>, "defined">;
|
|
141
|
-
confirmRemovals: z<number, number, "volatile-defined">;
|
|
142
61
|
}>>, Schemastery.ObjectT<NoInfer<{
|
|
143
|
-
enabled: z<boolean, boolean, "volatile-defined">;
|
|
144
|
-
ref: z<string, string, "volatile-defined">;
|
|
145
|
-
modelsUrl: z<string, string, "volatile-defined">;
|
|
146
62
|
intervalMinutes: z<number, number, "volatile-defined">;
|
|
147
|
-
|
|
148
|
-
|
|
63
|
+
modelsUrl: z<string, string, "volatile-defined">;
|
|
64
|
+
sessionHeader: z<"none" | "auto" | "static", "none" | "auto" | "static", "volatile-defined">;
|
|
149
65
|
routes: z<Schemastery.ObjectS<NoInfer<{
|
|
150
66
|
chat: z<string, string, "volatile-defined">;
|
|
151
67
|
msg: z<string, string, "volatile-defined">;
|
|
@@ -157,49 +73,12 @@ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
|
157
73
|
resp: z<string, string, "volatile-defined">;
|
|
158
74
|
google: z<string, string, "volatile-defined">;
|
|
159
75
|
}>>, "defined">;
|
|
160
|
-
confirmRemovals: z<number, number, "volatile-defined">;
|
|
161
|
-
}>>, "defined">;
|
|
162
|
-
zen: z<Schemastery.ObjectS<NoInfer<{
|
|
163
|
-
enabled: z<boolean, boolean, "volatile-defined">;
|
|
164
|
-
ref: z<string, string, "volatile-defined">;
|
|
165
|
-
mode: z<"login-only" | "routes", "login-only" | "routes", "volatile-defined">;
|
|
166
|
-
/** No proven listing endpoint; without it routes mode is unsupported. */
|
|
167
|
-
modelsUrl: z<string, string, "volatile">;
|
|
168
|
-
seedFromBuiltin: z<boolean, boolean, "volatile-defined">;
|
|
169
|
-
routes: z<Schemastery.ObjectS<NoInfer<{
|
|
170
|
-
chat: z<string, string, "volatile-defined">;
|
|
171
|
-
msg: z<string, string, "volatile-defined">;
|
|
172
|
-
resp: z<string, string, "volatile-defined">;
|
|
173
|
-
}>>, Schemastery.ObjectT<NoInfer<{
|
|
174
|
-
chat: z<string, string, "volatile-defined">;
|
|
175
|
-
msg: z<string, string, "volatile-defined">;
|
|
176
|
-
resp: z<string, string, "volatile-defined">;
|
|
177
|
-
}>>, "defined">;
|
|
178
|
-
}>>, Schemastery.ObjectT<NoInfer<{
|
|
179
|
-
enabled: z<boolean, boolean, "volatile-defined">;
|
|
180
|
-
ref: z<string, string, "volatile-defined">;
|
|
181
|
-
mode: z<"login-only" | "routes", "login-only" | "routes", "volatile-defined">;
|
|
182
|
-
/** No proven listing endpoint; without it routes mode is unsupported. */
|
|
183
|
-
modelsUrl: z<string, string, "volatile">;
|
|
184
|
-
seedFromBuiltin: z<boolean, boolean, "volatile-defined">;
|
|
185
|
-
routes: z<Schemastery.ObjectS<NoInfer<{
|
|
186
|
-
chat: z<string, string, "volatile-defined">;
|
|
187
|
-
msg: z<string, string, "volatile-defined">;
|
|
188
|
-
resp: z<string, string, "volatile-defined">;
|
|
189
|
-
}>>, Schemastery.ObjectT<NoInfer<{
|
|
190
|
-
chat: z<string, string, "volatile-defined">;
|
|
191
|
-
msg: z<string, string, "volatile-defined">;
|
|
192
|
-
resp: z<string, string, "volatile-defined">;
|
|
193
|
-
}>>, "defined">;
|
|
194
76
|
}>>, "defined">;
|
|
195
77
|
}>>, Schemastery.ObjectT<NoInfer<{
|
|
196
|
-
go: z<Schemastery.ObjectS<NoInfer<{
|
|
197
|
-
enabled: z<boolean, boolean, "volatile-defined">;
|
|
198
|
-
ref: z<string, string, "volatile-defined">;
|
|
199
|
-
modelsUrl: z<string, string, "volatile-defined">;
|
|
78
|
+
'opencode-go': z<Schemastery.ObjectS<NoInfer<{
|
|
200
79
|
intervalMinutes: z<number, number, "volatile-defined">;
|
|
201
|
-
|
|
202
|
-
|
|
80
|
+
modelsUrl: z<string, string, "volatile-defined">;
|
|
81
|
+
sessionHeader: z<"none" | "auto" | "static", "none" | "auto" | "static", "volatile-defined">;
|
|
203
82
|
routes: z<Schemastery.ObjectS<NoInfer<{
|
|
204
83
|
chat: z<string, string, "volatile-defined">;
|
|
205
84
|
msg: z<string, string, "volatile-defined">;
|
|
@@ -211,14 +90,10 @@ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
|
211
90
|
resp: z<string, string, "volatile-defined">;
|
|
212
91
|
google: z<string, string, "volatile-defined">;
|
|
213
92
|
}>>, "defined">;
|
|
214
|
-
confirmRemovals: z<number, number, "volatile-defined">;
|
|
215
93
|
}>>, Schemastery.ObjectT<NoInfer<{
|
|
216
|
-
enabled: z<boolean, boolean, "volatile-defined">;
|
|
217
|
-
ref: z<string, string, "volatile-defined">;
|
|
218
|
-
modelsUrl: z<string, string, "volatile-defined">;
|
|
219
94
|
intervalMinutes: z<number, number, "volatile-defined">;
|
|
220
|
-
|
|
221
|
-
|
|
95
|
+
modelsUrl: z<string, string, "volatile-defined">;
|
|
96
|
+
sessionHeader: z<"none" | "auto" | "static", "none" | "auto" | "static", "volatile-defined">;
|
|
222
97
|
routes: z<Schemastery.ObjectS<NoInfer<{
|
|
223
98
|
chat: z<string, string, "volatile-defined">;
|
|
224
99
|
msg: z<string, string, "volatile-defined">;
|
|
@@ -230,106 +105,25 @@ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
|
230
105
|
resp: z<string, string, "volatile-defined">;
|
|
231
106
|
google: z<string, string, "volatile-defined">;
|
|
232
107
|
}>>, "defined">;
|
|
233
|
-
confirmRemovals: z<number, number, "volatile-defined">;
|
|
234
|
-
}>>, "defined">;
|
|
235
|
-
zen: z<Schemastery.ObjectS<NoInfer<{
|
|
236
|
-
enabled: z<boolean, boolean, "volatile-defined">;
|
|
237
|
-
ref: z<string, string, "volatile-defined">;
|
|
238
|
-
mode: z<"login-only" | "routes", "login-only" | "routes", "volatile-defined">;
|
|
239
|
-
/** No proven listing endpoint; without it routes mode is unsupported. */
|
|
240
|
-
modelsUrl: z<string, string, "volatile">;
|
|
241
|
-
seedFromBuiltin: z<boolean, boolean, "volatile-defined">;
|
|
242
|
-
routes: z<Schemastery.ObjectS<NoInfer<{
|
|
243
|
-
chat: z<string, string, "volatile-defined">;
|
|
244
|
-
msg: z<string, string, "volatile-defined">;
|
|
245
|
-
resp: z<string, string, "volatile-defined">;
|
|
246
|
-
}>>, Schemastery.ObjectT<NoInfer<{
|
|
247
|
-
chat: z<string, string, "volatile-defined">;
|
|
248
|
-
msg: z<string, string, "volatile-defined">;
|
|
249
|
-
resp: z<string, string, "volatile-defined">;
|
|
250
|
-
}>>, "defined">;
|
|
251
|
-
}>>, Schemastery.ObjectT<NoInfer<{
|
|
252
|
-
enabled: z<boolean, boolean, "volatile-defined">;
|
|
253
|
-
ref: z<string, string, "volatile-defined">;
|
|
254
|
-
mode: z<"login-only" | "routes", "login-only" | "routes", "volatile-defined">;
|
|
255
|
-
/** No proven listing endpoint; without it routes mode is unsupported. */
|
|
256
|
-
modelsUrl: z<string, string, "volatile">;
|
|
257
|
-
seedFromBuiltin: z<boolean, boolean, "volatile-defined">;
|
|
258
|
-
routes: z<Schemastery.ObjectS<NoInfer<{
|
|
259
|
-
chat: z<string, string, "volatile-defined">;
|
|
260
|
-
msg: z<string, string, "volatile-defined">;
|
|
261
|
-
resp: z<string, string, "volatile-defined">;
|
|
262
|
-
}>>, Schemastery.ObjectT<NoInfer<{
|
|
263
|
-
chat: z<string, string, "volatile-defined">;
|
|
264
|
-
msg: z<string, string, "volatile-defined">;
|
|
265
|
-
resp: z<string, string, "volatile-defined">;
|
|
266
|
-
}>>, "defined">;
|
|
267
108
|
}>>, "defined">;
|
|
268
109
|
}>>, "defined">;
|
|
269
110
|
}>>, Schemastery.ObjectT<NoInfer<{
|
|
270
|
-
/**
|
|
271
|
-
* Write mode: 'settings' (default, zero-patch settings.mutate pipeline) or
|
|
272
|
-
* 'overlay'. DEPRECATED: 'overlay' delegates to the patched adapter's
|
|
273
|
-
* piAiCatalog.refresh, a seam dsh 0.2.1 removed outright (pi-ai 1.3.0
|
|
274
|
-
* ModelsStore rework) — every overlay round now degrades to a notice.
|
|
275
|
-
* Use the settings mode.
|
|
276
|
-
*/
|
|
277
111
|
writeMode: z<"settings" | "overlay", "settings" | "overlay", "volatile-defined">;
|
|
278
|
-
/** Minutes between auto refreshes (default 240 = 4 hours); 0 = startup-only. */
|
|
279
112
|
intervalMinutes: z<number, number, "volatile-defined">;
|
|
280
|
-
/** Delay before the first auto refresh, so the llm adapter is ready. */
|
|
281
113
|
startupDelaySeconds: z<number, number, "volatile-defined">;
|
|
282
|
-
/** Abort budget for one forced refresh's network round. */
|
|
283
114
|
refreshTimeoutMs: z<number, number, "volatile-defined">;
|
|
284
|
-
/** Routes to manage (empty = all pi.dev routes). */
|
|
285
115
|
managedRoutes: z<NoInfer<string[]>, NoInfer<string[]>, "volatile-defined">;
|
|
286
|
-
/** Keep builtin-only models not in pi.dev (smooth migration). */
|
|
287
116
|
keepBuiltinOnly: z<boolean, boolean, "volatile-defined">;
|
|
288
|
-
/** Drop unserviceable entries (true) or abort the entire route (false). */
|
|
289
117
|
dropUnserviceable: z<boolean, boolean, "volatile-defined">;
|
|
290
|
-
/**
|
|
291
|
-
* Union each mapped route's first-party /models listing into the pi.dev
|
|
292
|
-
* result (additions only — see provider-native.ts). Default on: the native
|
|
293
|
-
* listing is the fresher source; pi.dev lags (measured 2026-09-22).
|
|
294
|
-
*/
|
|
295
118
|
providerNativeFetch: z<boolean, boolean, "volatile-defined">;
|
|
296
|
-
/** Notify on changes (logger + /model-sync report). */
|
|
297
119
|
syncNotify: z<boolean, boolean, "volatile-defined">;
|
|
298
|
-
/**
|
|
299
|
-
* Force all models with a non-empty thinkingFormat to have max reasoning
|
|
300
|
-
* effort. Skips S2 gate's SRE check, ensures reasoningEfforts contains
|
|
301
|
-
* max, and forces compat.supportsReasoningEffort=true (S5 gate, openai-
|
|
302
|
-
* completions only). 400 risk is on the user.
|
|
303
|
-
*/
|
|
304
120
|
forceMaxReasoningEffort: z<boolean, boolean, "volatile-defined">;
|
|
305
|
-
/**
|
|
306
|
-
* keepBuiltinOnly may re-emit builtin ids the official default model list
|
|
307
|
-
* dropped (dsh 0.1.7 removed deepseek-v4-flash / deepseek-v4-flash-vision-
|
|
308
|
-
* exp). Those stay in the snapshot for historical user configurations but
|
|
309
|
-
* are excluded from the synced list unless this flag opts them back in —
|
|
310
|
-
* a re-emitted retired id is a model the 0.1.7 host no longer resolves.
|
|
311
|
-
*/
|
|
312
121
|
keepDeprecatedBuiltin: z<boolean, boolean, "volatile-defined">;
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
* Config schema in P1: read-only subset (go.enabled/ref/modelsUrl/
|
|
316
|
-
* intervalMinutes, zen.enabled/ref/mode/modelsUrl) plus the write-side subset
|
|
317
|
-
* (go.routes/adoptExisting/pinnedModels/confirmRemovals,
|
|
318
|
-
* zen.routes/seedFromBuiltin). Defaults are byte-for-byte the P0 constants —
|
|
319
|
-
* `modelsUrl` and `ref` are imported from the P0 modules so a P0→P1 drift is
|
|
320
|
-
* impossible. Zen stays login-only with no modelsUrl by default (design A5).
|
|
321
|
-
* Nested leaves are `.volatile()` (host settings can edit them); the parent
|
|
322
|
-
* objects are not, because schemastery forbids a volatile field under an
|
|
323
|
-
* enclosing volatile field.
|
|
324
|
-
*/
|
|
325
|
-
opencode: z<Schemastery.ObjectS<NoInfer<{
|
|
326
|
-
go: z<Schemastery.ObjectS<NoInfer<{
|
|
327
|
-
enabled: z<boolean, boolean, "volatile-defined">;
|
|
328
|
-
ref: z<string, string, "volatile-defined">;
|
|
329
|
-
modelsUrl: z<string, string, "volatile-defined">;
|
|
122
|
+
officialSync: z<Schemastery.ObjectS<NoInfer<{
|
|
123
|
+
'opencode-go': z<Schemastery.ObjectS<NoInfer<{
|
|
330
124
|
intervalMinutes: z<number, number, "volatile-defined">;
|
|
331
|
-
|
|
332
|
-
|
|
125
|
+
modelsUrl: z<string, string, "volatile-defined">;
|
|
126
|
+
sessionHeader: z<"none" | "auto" | "static", "none" | "auto" | "static", "volatile-defined">;
|
|
333
127
|
routes: z<Schemastery.ObjectS<NoInfer<{
|
|
334
128
|
chat: z<string, string, "volatile-defined">;
|
|
335
129
|
msg: z<string, string, "volatile-defined">;
|
|
@@ -341,14 +135,10 @@ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
|
341
135
|
resp: z<string, string, "volatile-defined">;
|
|
342
136
|
google: z<string, string, "volatile-defined">;
|
|
343
137
|
}>>, "defined">;
|
|
344
|
-
confirmRemovals: z<number, number, "volatile-defined">;
|
|
345
138
|
}>>, Schemastery.ObjectT<NoInfer<{
|
|
346
|
-
enabled: z<boolean, boolean, "volatile-defined">;
|
|
347
|
-
ref: z<string, string, "volatile-defined">;
|
|
348
|
-
modelsUrl: z<string, string, "volatile-defined">;
|
|
349
139
|
intervalMinutes: z<number, number, "volatile-defined">;
|
|
350
|
-
|
|
351
|
-
|
|
140
|
+
modelsUrl: z<string, string, "volatile-defined">;
|
|
141
|
+
sessionHeader: z<"none" | "auto" | "static", "none" | "auto" | "static", "volatile-defined">;
|
|
352
142
|
routes: z<Schemastery.ObjectS<NoInfer<{
|
|
353
143
|
chat: z<string, string, "volatile-defined">;
|
|
354
144
|
msg: z<string, string, "volatile-defined">;
|
|
@@ -360,49 +150,12 @@ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
|
360
150
|
resp: z<string, string, "volatile-defined">;
|
|
361
151
|
google: z<string, string, "volatile-defined">;
|
|
362
152
|
}>>, "defined">;
|
|
363
|
-
confirmRemovals: z<number, number, "volatile-defined">;
|
|
364
|
-
}>>, "defined">;
|
|
365
|
-
zen: z<Schemastery.ObjectS<NoInfer<{
|
|
366
|
-
enabled: z<boolean, boolean, "volatile-defined">;
|
|
367
|
-
ref: z<string, string, "volatile-defined">;
|
|
368
|
-
mode: z<"login-only" | "routes", "login-only" | "routes", "volatile-defined">;
|
|
369
|
-
/** No proven listing endpoint; without it routes mode is unsupported. */
|
|
370
|
-
modelsUrl: z<string, string, "volatile">;
|
|
371
|
-
seedFromBuiltin: z<boolean, boolean, "volatile-defined">;
|
|
372
|
-
routes: z<Schemastery.ObjectS<NoInfer<{
|
|
373
|
-
chat: z<string, string, "volatile-defined">;
|
|
374
|
-
msg: z<string, string, "volatile-defined">;
|
|
375
|
-
resp: z<string, string, "volatile-defined">;
|
|
376
|
-
}>>, Schemastery.ObjectT<NoInfer<{
|
|
377
|
-
chat: z<string, string, "volatile-defined">;
|
|
378
|
-
msg: z<string, string, "volatile-defined">;
|
|
379
|
-
resp: z<string, string, "volatile-defined">;
|
|
380
|
-
}>>, "defined">;
|
|
381
|
-
}>>, Schemastery.ObjectT<NoInfer<{
|
|
382
|
-
enabled: z<boolean, boolean, "volatile-defined">;
|
|
383
|
-
ref: z<string, string, "volatile-defined">;
|
|
384
|
-
mode: z<"login-only" | "routes", "login-only" | "routes", "volatile-defined">;
|
|
385
|
-
/** No proven listing endpoint; without it routes mode is unsupported. */
|
|
386
|
-
modelsUrl: z<string, string, "volatile">;
|
|
387
|
-
seedFromBuiltin: z<boolean, boolean, "volatile-defined">;
|
|
388
|
-
routes: z<Schemastery.ObjectS<NoInfer<{
|
|
389
|
-
chat: z<string, string, "volatile-defined">;
|
|
390
|
-
msg: z<string, string, "volatile-defined">;
|
|
391
|
-
resp: z<string, string, "volatile-defined">;
|
|
392
|
-
}>>, Schemastery.ObjectT<NoInfer<{
|
|
393
|
-
chat: z<string, string, "volatile-defined">;
|
|
394
|
-
msg: z<string, string, "volatile-defined">;
|
|
395
|
-
resp: z<string, string, "volatile-defined">;
|
|
396
|
-
}>>, "defined">;
|
|
397
153
|
}>>, "defined">;
|
|
398
154
|
}>>, Schemastery.ObjectT<NoInfer<{
|
|
399
|
-
go: z<Schemastery.ObjectS<NoInfer<{
|
|
400
|
-
enabled: z<boolean, boolean, "volatile-defined">;
|
|
401
|
-
ref: z<string, string, "volatile-defined">;
|
|
402
|
-
modelsUrl: z<string, string, "volatile-defined">;
|
|
155
|
+
'opencode-go': z<Schemastery.ObjectS<NoInfer<{
|
|
403
156
|
intervalMinutes: z<number, number, "volatile-defined">;
|
|
404
|
-
|
|
405
|
-
|
|
157
|
+
modelsUrl: z<string, string, "volatile-defined">;
|
|
158
|
+
sessionHeader: z<"none" | "auto" | "static", "none" | "auto" | "static", "volatile-defined">;
|
|
406
159
|
routes: z<Schemastery.ObjectS<NoInfer<{
|
|
407
160
|
chat: z<string, string, "volatile-defined">;
|
|
408
161
|
msg: z<string, string, "volatile-defined">;
|
|
@@ -414,14 +167,10 @@ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
|
414
167
|
resp: z<string, string, "volatile-defined">;
|
|
415
168
|
google: z<string, string, "volatile-defined">;
|
|
416
169
|
}>>, "defined">;
|
|
417
|
-
confirmRemovals: z<number, number, "volatile-defined">;
|
|
418
170
|
}>>, Schemastery.ObjectT<NoInfer<{
|
|
419
|
-
enabled: z<boolean, boolean, "volatile-defined">;
|
|
420
|
-
ref: z<string, string, "volatile-defined">;
|
|
421
|
-
modelsUrl: z<string, string, "volatile-defined">;
|
|
422
171
|
intervalMinutes: z<number, number, "volatile-defined">;
|
|
423
|
-
|
|
424
|
-
|
|
172
|
+
modelsUrl: z<string, string, "volatile-defined">;
|
|
173
|
+
sessionHeader: z<"none" | "auto" | "static", "none" | "auto" | "static", "volatile-defined">;
|
|
425
174
|
routes: z<Schemastery.ObjectS<NoInfer<{
|
|
426
175
|
chat: z<string, string, "volatile-defined">;
|
|
427
176
|
msg: z<string, string, "volatile-defined">;
|
|
@@ -433,54 +182,12 @@ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
|
433
182
|
resp: z<string, string, "volatile-defined">;
|
|
434
183
|
google: z<string, string, "volatile-defined">;
|
|
435
184
|
}>>, "defined">;
|
|
436
|
-
confirmRemovals: z<number, number, "volatile-defined">;
|
|
437
|
-
}>>, "defined">;
|
|
438
|
-
zen: z<Schemastery.ObjectS<NoInfer<{
|
|
439
|
-
enabled: z<boolean, boolean, "volatile-defined">;
|
|
440
|
-
ref: z<string, string, "volatile-defined">;
|
|
441
|
-
mode: z<"login-only" | "routes", "login-only" | "routes", "volatile-defined">;
|
|
442
|
-
/** No proven listing endpoint; without it routes mode is unsupported. */
|
|
443
|
-
modelsUrl: z<string, string, "volatile">;
|
|
444
|
-
seedFromBuiltin: z<boolean, boolean, "volatile-defined">;
|
|
445
|
-
routes: z<Schemastery.ObjectS<NoInfer<{
|
|
446
|
-
chat: z<string, string, "volatile-defined">;
|
|
447
|
-
msg: z<string, string, "volatile-defined">;
|
|
448
|
-
resp: z<string, string, "volatile-defined">;
|
|
449
|
-
}>>, Schemastery.ObjectT<NoInfer<{
|
|
450
|
-
chat: z<string, string, "volatile-defined">;
|
|
451
|
-
msg: z<string, string, "volatile-defined">;
|
|
452
|
-
resp: z<string, string, "volatile-defined">;
|
|
453
|
-
}>>, "defined">;
|
|
454
|
-
}>>, Schemastery.ObjectT<NoInfer<{
|
|
455
|
-
enabled: z<boolean, boolean, "volatile-defined">;
|
|
456
|
-
ref: z<string, string, "volatile-defined">;
|
|
457
|
-
mode: z<"login-only" | "routes", "login-only" | "routes", "volatile-defined">;
|
|
458
|
-
/** No proven listing endpoint; without it routes mode is unsupported. */
|
|
459
|
-
modelsUrl: z<string, string, "volatile">;
|
|
460
|
-
seedFromBuiltin: z<boolean, boolean, "volatile-defined">;
|
|
461
|
-
routes: z<Schemastery.ObjectS<NoInfer<{
|
|
462
|
-
chat: z<string, string, "volatile-defined">;
|
|
463
|
-
msg: z<string, string, "volatile-defined">;
|
|
464
|
-
resp: z<string, string, "volatile-defined">;
|
|
465
|
-
}>>, Schemastery.ObjectT<NoInfer<{
|
|
466
|
-
chat: z<string, string, "volatile-defined">;
|
|
467
|
-
msg: z<string, string, "volatile-defined">;
|
|
468
|
-
resp: z<string, string, "volatile-defined">;
|
|
469
|
-
}>>, "defined">;
|
|
470
185
|
}>>, "defined">;
|
|
471
186
|
}>>, "defined">;
|
|
472
187
|
}>>, "plain">;
|
|
473
|
-
/**
|
|
474
|
-
* A stable configuration reference — the protocol the 0.1.7 host hands the
|
|
475
|
-
* plugin for every volatile `Config` field (cosmokit's `Volatile<T>`, declared
|
|
476
|
-
* locally as a structural type so this module stays dependency-free). `get()`
|
|
477
|
-
* returns the current immutable snapshot; the host swaps the value in place on
|
|
478
|
-
* volatile-only edits, so reading per round is always fresh.
|
|
479
|
-
*/
|
|
480
188
|
interface VolatileRef<T> {
|
|
481
189
|
get(): T;
|
|
482
190
|
}
|
|
483
|
-
/** Typed view of the resolved `Config` value as delivered to apply(). */
|
|
484
191
|
interface ModelSyncConfigValue {
|
|
485
192
|
writeMode: VolatileRef<'settings' | 'overlay'>;
|
|
486
193
|
intervalMinutes: VolatileRef<number>;
|
|
@@ -493,63 +200,26 @@ interface ModelSyncConfigValue {
|
|
|
493
200
|
forceMaxReasoningEffort: VolatileRef<boolean>;
|
|
494
201
|
providerNativeFetch: VolatileRef<boolean>;
|
|
495
202
|
keepDeprecatedBuiltin: VolatileRef<boolean>;
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
adoptExisting: VolatileRef<boolean>;
|
|
503
|
-
pinnedModels: VolatileRef<readonly string[]>;
|
|
504
|
-
routes: Record<'chat' | 'msg' | 'resp' | 'google', VolatileRef<string>>;
|
|
505
|
-
confirmRemovals: VolatileRef<number>;
|
|
506
|
-
};
|
|
507
|
-
zen: {
|
|
508
|
-
enabled: VolatileRef<boolean>;
|
|
509
|
-
ref: VolatileRef<string>;
|
|
510
|
-
mode: VolatileRef<'login-only' | 'routes'>;
|
|
511
|
-
modelsUrl: VolatileRef<string | undefined>;
|
|
512
|
-
seedFromBuiltin: VolatileRef<boolean>;
|
|
513
|
-
routes: Record<'chat' | 'msg' | 'resp', VolatileRef<string>>;
|
|
514
|
-
};
|
|
515
|
-
};
|
|
203
|
+
officialSync?: Record<string, {
|
|
204
|
+
intervalMinutes?: VolatileRef<number>;
|
|
205
|
+
modelsUrl?: VolatileRef<string>;
|
|
206
|
+
sessionHeader?: VolatileRef<SessionHeaderMode>;
|
|
207
|
+
routes?: Record<string, VolatileRef<string>>;
|
|
208
|
+
}>;
|
|
516
209
|
}
|
|
517
|
-
/** The `modelSync` service surfaced to UIs: run one refresh round and get the report. */
|
|
518
210
|
export interface ModelSyncService {
|
|
519
211
|
syncNow(): Promise<string>;
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
pruneUserExtra?: boolean;
|
|
525
|
-
}): Promise<string>;
|
|
526
|
-
migrateApply?(args: {
|
|
527
|
-
planHash?: string;
|
|
528
|
-
confirmCode?: string;
|
|
529
|
-
ackManaged?: boolean;
|
|
212
|
+
syncOfficial?(provider: string): Promise<string>;
|
|
213
|
+
migrate?(provider: string, options?: {
|
|
214
|
+
allProfiles?: boolean;
|
|
215
|
+
confirm?: boolean;
|
|
530
216
|
}): Promise<string>;
|
|
531
|
-
|
|
532
|
-
|
|
217
|
+
rollback?(provider: string, options?: {
|
|
218
|
+
confirm?: boolean;
|
|
533
219
|
}): Promise<string>;
|
|
534
|
-
|
|
220
|
+
status?(provider?: string): Promise<string>;
|
|
535
221
|
}
|
|
536
|
-
/** Default route list — exported for tests that need to iterate the same set
|
|
537
|
-
* the plugin syncs when `managedRoutes` is empty. Not part of the public
|
|
538
|
-
* runtime surface; subject to change without notice. */
|
|
539
222
|
export declare const DEFAULT_ROUTES_LIST: string[];
|
|
540
223
|
export declare function apply(ctx: Context, config: ModelSyncConfigValue): Promise<void>;
|
|
541
|
-
/**
|
|
542
|
-
* Get entries from builtin catalog that are not in pi.dev (for keepBuiltinOnly).
|
|
543
|
-
* Returns minimal RemoteCatalogEntry-shaped objects — translateEntries only
|
|
544
|
-
* reads entry.id from these, emitting {id} profiles (I-3).
|
|
545
|
-
*
|
|
546
|
-
* Deprecated snapshot entries (the official default model list dropped them —
|
|
547
|
-
* dsh 0.1.7 removed deepseek-v4-flash / deepseek-v4-flash-vision-exp) are
|
|
548
|
-
* excluded unless `includeDeprecated` opts them back in: a re-emitted retired
|
|
549
|
-
* id is a model the 0.1.7 host no longer resolves. The data itself stays in
|
|
550
|
-
* the snapshot for historical user configurations.
|
|
551
|
-
*
|
|
552
|
-
* Exported for the test suite; not part of the public runtime surface.
|
|
553
|
-
*/
|
|
554
224
|
export declare function getBuiltinOnlyEntries(route: string, piDevEntries: RemoteCatalogEntry[], builtinData: BuiltinModelData[], includeDeprecated?: boolean): RemoteCatalogEntry[];
|
|
555
225
|
export {};
|