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