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.
- package/CHANGELOG.md +30 -0
- package/IMPLEMENTATION_PLAN.md +12 -1
- package/PRODUCT.md +3 -3
- package/README.en.md +16 -3
- package/README.md +16 -3
- package/cordis.patch.yml +9 -0
- package/lib/auto-review-CYvvootQ.js +1079 -0
- package/lib/auto-review.js +1 -1
- package/lib/automode-compat.js +1 -1
- package/lib/client.js +503 -47
- package/lib/compaction.js +1 -1
- package/lib/index.js +26 -7
- package/lib/prime-memory-compat.js +573 -1
- package/lib/prime-memory-route-DGUVfogE.js +117 -0
- package/lib/review-timeout-FB32BcnO.js +339 -0
- package/lib/review-timeout.js +1 -1
- package/lib/session-route-CRfpxarI.js +357 -0
- package/lib/session-title.js +17 -3
- package/lib/subagent-runtime-eNKrdb2H.js +424 -0
- package/lib/subagent-runtime.js +1 -1
- package/lib/tool-allowlist-cN9Z1XKn.js +489 -0
- package/lib/types/capabilities-rpc.d.ts +7 -0
- package/lib/types/client/ModelSwitchSettings.d.ts +6 -3
- package/lib/types/client/locales.d.ts +18 -2
- package/lib/types/client-contract.d.ts +33 -1
- package/lib/types/host-settings.d.ts +11 -0
- package/lib/types/prime-memory-compat.d.ts +14 -6
- package/lib/types/prime-memory-route.d.ts +22 -0
- package/lib/types/provider-group.d.ts +31 -3
- package/lib/types/session-route.d.ts +24 -3
- package/lib/types/session-title.d.ts +12 -0
- package/lib/types/tool-allowlist.d.ts +13 -0
- package/lib/types/vision-router-compat.d.ts +62 -0
- package/lib/types/vision-router-route.d.ts +94 -0
- package/lib/vision-router-compat-B9bkgJmh.js +312 -0
- package/lib/vision-router-compat-DP81VMLW.js +312 -0
- package/lib/vision-router-compat.js +2 -0
- package/package.json +6 -1
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
//#region lib/types/provider-group.js
|
|
2
|
+
/**
|
|
3
|
+
* Provider configuration groups: per-provider presets for the compaction,
|
|
4
|
+
* auto-review, session-naming, subagent, memory-distillation, and vision routes.
|
|
5
|
+
*
|
|
6
|
+
* A group is a DERIVED policy, not a write: `src/session-route.ts` resolves the
|
|
7
|
+
* routes one session should use from its own provider plus this stored table, so
|
|
8
|
+
* switching a session's provider never rewrites deployment-wide settings and two
|
|
9
|
+
* sessions on different providers cannot overwrite each other. The field names
|
|
10
|
+
* below are the flat settings field names a group pins, which keeps the stored
|
|
11
|
+
* shape identical across releases.
|
|
12
|
+
*
|
|
13
|
+
* All functions here are pure and never throw on malformed storage.
|
|
14
|
+
*/
|
|
15
|
+
const ROUTE_FIELDS = Object.freeze([
|
|
16
|
+
"compactProvider",
|
|
17
|
+
"compactModel",
|
|
18
|
+
"autoReviewProvider",
|
|
19
|
+
"autoReviewModel",
|
|
20
|
+
"subagentProvider",
|
|
21
|
+
"subagentModel",
|
|
22
|
+
"subagentReasoningEffort",
|
|
23
|
+
"titleProvider",
|
|
24
|
+
"titleModel",
|
|
25
|
+
"memoryProvider",
|
|
26
|
+
"memoryModel",
|
|
27
|
+
"memoryReasoningEffort",
|
|
28
|
+
"visionProvider",
|
|
29
|
+
"visionModel"
|
|
30
|
+
]);
|
|
31
|
+
/** Own data property, so a literal '__proto__' provider id can never touch a prototype. */
|
|
32
|
+
function setKey(target, key, value) {
|
|
33
|
+
Object.defineProperty(target, key, {
|
|
34
|
+
value,
|
|
35
|
+
enumerable: true,
|
|
36
|
+
writable: true,
|
|
37
|
+
configurable: true
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/** A non-blank string. Blank values behave exactly like an absent field. */
|
|
41
|
+
function present$1(value) {
|
|
42
|
+
return typeof value === "string" && value.trim() !== "";
|
|
43
|
+
}
|
|
44
|
+
/** Normalize one raw entry to its owning provider and route view; undefined for non-object junk. */
|
|
45
|
+
function normalizeEntry(value) {
|
|
46
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
47
|
+
const source = value;
|
|
48
|
+
const group = {};
|
|
49
|
+
for (const field of ROUTE_FIELDS) {
|
|
50
|
+
const item = source[field];
|
|
51
|
+
if (present$1(item)) group[field] = item;
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
provider: present$1(source.provider) ? source.provider : "",
|
|
55
|
+
group
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Strip a raw stored value to well-formed groups; never throws. Both storage
|
|
60
|
+
* shapes are accepted: the stored entry array (keys live in each entry's
|
|
61
|
+
* `provider` field) and a hand-written provider → routes map (keys are the
|
|
62
|
+
* providers). All-empty entries stay: they pin a provider to every default.
|
|
63
|
+
* `-vision` twin groups fold into their base provider (see {@link foldTwinGroups}).
|
|
64
|
+
*/
|
|
65
|
+
function normalizeProviderGroups(raw) {
|
|
66
|
+
const groups = {};
|
|
67
|
+
if (Array.isArray(raw)) for (const entry of raw) {
|
|
68
|
+
const view = normalizeEntry(entry);
|
|
69
|
+
if (view === void 0 || view.provider === "") continue;
|
|
70
|
+
setKey(groups, view.provider, view.group);
|
|
71
|
+
}
|
|
72
|
+
else if (raw !== null && typeof raw === "object") for (const [key, value] of Object.entries(raw)) {
|
|
73
|
+
if (key.trim() === "") continue;
|
|
74
|
+
const view = normalizeEntry(value);
|
|
75
|
+
if (view === void 0) continue;
|
|
76
|
+
setKey(groups, key, view.group);
|
|
77
|
+
}
|
|
78
|
+
return foldTwinGroups(groups);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The base provider id a dsh-vision-router twin route resolves to.
|
|
82
|
+
*
|
|
83
|
+
* dsh-vision-router materializes a `${provider}-vision` twin route for every
|
|
84
|
+
* enabled text provider (its own sync skips ids ending in `-vision`), and a
|
|
85
|
+
* session with vision on runs on that twin. Groups are keyed by the base
|
|
86
|
+
* provider: one group per provider whether vision is on or off.
|
|
87
|
+
* @param provider - the provider id a session or the deployment default names.
|
|
88
|
+
* @returns the base id (one trailing `-vision` stripped when the rest is non-empty), else the input unchanged.
|
|
89
|
+
*/
|
|
90
|
+
function canonicalGroupProvider(provider) {
|
|
91
|
+
if (!provider.endsWith("-vision")) return provider;
|
|
92
|
+
const base = provider.slice(0, -7);
|
|
93
|
+
return base === "" ? provider : base;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Fold `-vision` twin groups into their base provider (read-side merge).
|
|
97
|
+
*
|
|
98
|
+
* A session with vision on keys its provider as `${base}-vision`, so a group
|
|
99
|
+
* saved under that twin id belongs to the same provider. The base entry wins
|
|
100
|
+
* on conflicts, the twin fills only fields the base leaves empty, and a twin
|
|
101
|
+
* without a base entry is rekeyed to its base. Storage converges on the next
|
|
102
|
+
* save, which re-emits entries from this normalized view.
|
|
103
|
+
*/
|
|
104
|
+
function foldTwinGroups(groups) {
|
|
105
|
+
const source = new Map(Object.entries(groups).map(([key, value]) => [key, value]));
|
|
106
|
+
for (const [key, twin] of source) {
|
|
107
|
+
const base = canonicalGroupProvider(key);
|
|
108
|
+
if (base === key) continue;
|
|
109
|
+
const existing = source.get(base);
|
|
110
|
+
if (existing === void 0) source.set(base, twin);
|
|
111
|
+
else for (const field of ROUTE_FIELDS) if (existing[field] === void 0 && twin[field] !== void 0) existing[field] = twin[field];
|
|
112
|
+
source.delete(key);
|
|
113
|
+
}
|
|
114
|
+
const folded = {};
|
|
115
|
+
for (const [key, value] of source) setKey(folded, key, value);
|
|
116
|
+
return folded;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* The saved group for a provider, resolving a vision twin to its base first.
|
|
120
|
+
*
|
|
121
|
+
* The base key wins over the raw twin key, which is what merges a twin group
|
|
122
|
+
* into its base; the raw key stays as a fallback so a group saved under a
|
|
123
|
+
* twin-only key still resolves before the stored entry is folded.
|
|
124
|
+
* @param groups - the normalized provider → group map.
|
|
125
|
+
* @param provider - the provider a session runs on or the deployment default names.
|
|
126
|
+
* @returns the normalized group, or undefined when neither key has one.
|
|
127
|
+
*/
|
|
128
|
+
function groupOfCanonical(groups, provider) {
|
|
129
|
+
if (groups === void 0 || provider.trim() === "") return void 0;
|
|
130
|
+
const canonical = canonicalGroupProvider(provider);
|
|
131
|
+
if (canonical !== provider && Object.prototype.hasOwnProperty.call(groups, canonical)) return groups[canonical];
|
|
132
|
+
if (Object.prototype.hasOwnProperty.call(groups, provider)) return groups[provider];
|
|
133
|
+
}
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region lib/types/session-route.js
|
|
136
|
+
/**
|
|
137
|
+
* Per-session capability route derivation.
|
|
138
|
+
*
|
|
139
|
+
* Model Switch stores one deployment-wide route per capability (the flat
|
|
140
|
+
* settings fields) plus, per provider, a saved provider group. Nothing is
|
|
141
|
+
* written when a session changes provider: this module DERIVES the route a
|
|
142
|
+
* capability should use for one session from (a) the session's own provider and
|
|
143
|
+
* (b) the stored group table. Two sessions on different providers therefore
|
|
144
|
+
* resolve independently, and no session's actions rewrite another session's
|
|
145
|
+
* route.
|
|
146
|
+
*
|
|
147
|
+
* The session's provider is read from durable, official state in this order:
|
|
148
|
+
* the `modelSelection` session projection (`pending` before `lastUsed`, so a
|
|
149
|
+
* selection the user just made counts), then the latest logged request-context
|
|
150
|
+
* route, then the latest `request/header` route. Every read is optional: a
|
|
151
|
+
* session with no observable provider, an unregistered projection, or a
|
|
152
|
+
* profile without the projection package all resolve to the deployment default,
|
|
153
|
+
* which is exactly the pre-derivation behavior.
|
|
154
|
+
*
|
|
155
|
+
* All functions are pure except the readers, which never throw and never write.
|
|
156
|
+
*/
|
|
157
|
+
/** Flat deployment-default fields per capability, in group-storage field names. */
|
|
158
|
+
const CAPABILITY_FIELDS = Object.freeze({
|
|
159
|
+
compaction: {
|
|
160
|
+
provider: "compactProvider",
|
|
161
|
+
model: "compactModel"
|
|
162
|
+
},
|
|
163
|
+
autoReview: {
|
|
164
|
+
provider: "autoReviewProvider",
|
|
165
|
+
model: "autoReviewModel"
|
|
166
|
+
},
|
|
167
|
+
title: {
|
|
168
|
+
provider: "titleProvider",
|
|
169
|
+
model: "titleModel"
|
|
170
|
+
},
|
|
171
|
+
subagent: {
|
|
172
|
+
provider: "subagentProvider",
|
|
173
|
+
model: "subagentModel"
|
|
174
|
+
},
|
|
175
|
+
memory: {
|
|
176
|
+
provider: "memoryProvider",
|
|
177
|
+
model: "memoryModel"
|
|
178
|
+
},
|
|
179
|
+
vision: {
|
|
180
|
+
provider: "visionProvider",
|
|
181
|
+
model: "visionModel"
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
/** A non-blank string; blank values behave exactly like an absent field. */
|
|
185
|
+
function present(value) {
|
|
186
|
+
return typeof value === "string" && value.trim() !== "";
|
|
187
|
+
}
|
|
188
|
+
/** Read one capability's pair from a flat route record; undefined unless both halves are present. */
|
|
189
|
+
function pairOf(source, fields) {
|
|
190
|
+
if (source === void 0) return void 0;
|
|
191
|
+
const record = source;
|
|
192
|
+
const provider = record[fields.provider];
|
|
193
|
+
const model = record[fields.model];
|
|
194
|
+
if (!present(provider) || !present(model)) return void 0;
|
|
195
|
+
return {
|
|
196
|
+
provider,
|
|
197
|
+
model
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* The deployment-wide route for one capability: the flat settings pair.
|
|
202
|
+
* @param settings - live Model Switch settings; undefined means none are reachable.
|
|
203
|
+
* @param capability - capability whose flat pair is read.
|
|
204
|
+
* @returns The complete pair, or undefined when the capability stays at its official/derived default.
|
|
205
|
+
*/
|
|
206
|
+
function deploymentRoute(settings, capability) {
|
|
207
|
+
return pairOf(settings, CAPABILITY_FIELDS[capability]);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* The distillation route one deployment should use.
|
|
211
|
+
*
|
|
212
|
+
* Distillation is a background pipeline with no session of its own, so the group
|
|
213
|
+
* key is the deployment default provider (the provider the profile starts
|
|
214
|
+
* sessions on) rather than a session's provider. A provider without a group falls
|
|
215
|
+
* back to the flat memory pair; an empty pair leaves the memory plugin at its own
|
|
216
|
+
* default. The reasoning effort rides the same layering: the group's effort,
|
|
217
|
+
* else the flat effort, else the memory plugin's own auto resolution.
|
|
218
|
+
* @param settings - live Model Switch settings.
|
|
219
|
+
* @param provider - the deployment default provider, when one is observable.
|
|
220
|
+
* @returns The complete route, or undefined when nothing is pinned.
|
|
221
|
+
*/
|
|
222
|
+
function memoryRouteOf(settings, provider) {
|
|
223
|
+
const group = groupRoute(settings, provider, "memory");
|
|
224
|
+
if (group !== void 0) {
|
|
225
|
+
const effort = groupOfCanonical(settings?.providerGroups, provider ?? "")?.memoryReasoningEffort;
|
|
226
|
+
return present(effort) ? {
|
|
227
|
+
...group,
|
|
228
|
+
reasoningEffort: effort
|
|
229
|
+
} : group;
|
|
230
|
+
}
|
|
231
|
+
const flat = deploymentRoute(settings, "memory");
|
|
232
|
+
if (flat === void 0) return void 0;
|
|
233
|
+
const flatEffort = settings?.memoryReasoningEffort;
|
|
234
|
+
return present(flatEffort) ? {
|
|
235
|
+
...flat,
|
|
236
|
+
reasoningEffort: flatEffort
|
|
237
|
+
} : flat;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* The vision backend route one deployment should use.
|
|
241
|
+
*
|
|
242
|
+
* dsh-vision-router's backend chain is deployment-wide with no session of its
|
|
243
|
+
* own, so the group key is the deployment default provider — the same key the
|
|
244
|
+
* memory route uses. A provider without a group falls back to the flat vision
|
|
245
|
+
* pair; an empty pair leaves the vision plugin on its own chain.
|
|
246
|
+
* @param settings - live Model Switch settings.
|
|
247
|
+
* @param provider - the deployment default provider, when one is observable.
|
|
248
|
+
* @returns The complete pair, or undefined when nothing is pinned.
|
|
249
|
+
*/
|
|
250
|
+
function visionRouteOf(settings, provider) {
|
|
251
|
+
return groupRoute(settings, provider, "vision") ?? deploymentRoute(settings, "vision");
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* The route a subagent spawn should use for one parent-session provider.
|
|
255
|
+
*
|
|
256
|
+
* A saved group for that provider pins the spawn; otherwise the flat Subagent
|
|
257
|
+
* card pins it, but only in `fixed` mode — `follow-main` IS the official inherit
|
|
258
|
+
* path, expressed by leaving the request untouched rather than by naming it.
|
|
259
|
+
* @param settings - live Model Switch settings.
|
|
260
|
+
* @param provider - the delegating session's provider, when one is observable.
|
|
261
|
+
* @returns The complete route, or undefined for official inherit.
|
|
262
|
+
*/
|
|
263
|
+
function subagentRouteOf(settings, provider) {
|
|
264
|
+
const group = groupRoute(settings, provider, "subagent");
|
|
265
|
+
if (group !== void 0) {
|
|
266
|
+
const effort = groupOfCanonical(settings?.providerGroups, provider ?? "")?.subagentReasoningEffort;
|
|
267
|
+
return present(effort) ? {
|
|
268
|
+
...group,
|
|
269
|
+
reasoningEffort: effort
|
|
270
|
+
} : group;
|
|
271
|
+
}
|
|
272
|
+
if (settings?.subagentMode !== "fixed") return void 0;
|
|
273
|
+
const fixed = deploymentRoute(settings, "subagent");
|
|
274
|
+
if (fixed === void 0) return void 0;
|
|
275
|
+
return present(settings.subagentReasoningEffort) ? {
|
|
276
|
+
...fixed,
|
|
277
|
+
reasoningEffort: settings.subagentReasoningEffort
|
|
278
|
+
} : fixed;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* One provider's saved route for one capability.
|
|
282
|
+
* @param settings - live Model Switch settings carrying the group table.
|
|
283
|
+
* @param provider - the session's provider; blank or unknown resolves to undefined.
|
|
284
|
+
* @param capability - capability whose group pin is read.
|
|
285
|
+
* @returns The complete group pair, or undefined when the group pins nothing here.
|
|
286
|
+
*/
|
|
287
|
+
function groupRoute(settings, provider, capability) {
|
|
288
|
+
if (!present(provider)) return void 0;
|
|
289
|
+
return pairOf(groupOfCanonical(settings?.providerGroups, provider), CAPABILITY_FIELDS[capability]);
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* The route one capability should use for one session.
|
|
293
|
+
*
|
|
294
|
+
* A saved provider group for the session's provider wins; otherwise the flat
|
|
295
|
+
* deployment default applies. An unknown session provider skips every group, so
|
|
296
|
+
* a session Model Switch cannot attribute keeps the deployment default.
|
|
297
|
+
* @param settings - live Model Switch settings.
|
|
298
|
+
* @param provider - the session's provider, when one is observable.
|
|
299
|
+
* @param capability - capability being resolved.
|
|
300
|
+
* @returns The complete pair, or undefined for the capability's official default.
|
|
301
|
+
*/
|
|
302
|
+
function resolveCapabilityRoute(settings, provider, capability) {
|
|
303
|
+
return groupRoute(settings, provider, capability) ?? deploymentRoute(settings, capability);
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Read the provider from the durable model-selection projection.
|
|
307
|
+
* @param ctx - context that may expose `sessionProjections`.
|
|
308
|
+
* @param session - the session whose selection is read.
|
|
309
|
+
* @returns The pending provider, else the last-used provider, else undefined.
|
|
310
|
+
*/
|
|
311
|
+
function projectionProvider(ctx, session) {
|
|
312
|
+
let state;
|
|
313
|
+
try {
|
|
314
|
+
state = ctx.get("sessionProjections", false)?.stateOf(session, "modelSelection");
|
|
315
|
+
} catch {
|
|
316
|
+
state = void 0;
|
|
317
|
+
}
|
|
318
|
+
if (state === void 0) return void 0;
|
|
319
|
+
if (present(state.pending?.provider)) return state.pending.provider;
|
|
320
|
+
if (present(state.lastUsed?.provider)) return state.lastUsed.provider;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* The provider one session is using, from official durable state.
|
|
324
|
+
*
|
|
325
|
+
* Preferred source is the session's own model selection (it covers a switch the
|
|
326
|
+
* client has sent but no request has consumed yet); the logged request-context
|
|
327
|
+
* and request-header routes cover profiles without the projection package and
|
|
328
|
+
* replayed sessions that never emitted a selection.
|
|
329
|
+
* @param ctx - context used for the optional projection read.
|
|
330
|
+
* @param session - the session to resolve; undefined resolves to undefined.
|
|
331
|
+
* @returns The provider, or undefined when nothing durable names one.
|
|
332
|
+
*/
|
|
333
|
+
function sessionProviderOf(ctx, session) {
|
|
334
|
+
if (session === void 0) return void 0;
|
|
335
|
+
const selected = projectionProvider(ctx, session);
|
|
336
|
+
if (selected !== void 0) return selected;
|
|
337
|
+
try {
|
|
338
|
+
const context = session.requestContext()?.provider;
|
|
339
|
+
if (present(context)) return context;
|
|
340
|
+
const header = session.requestHeader()?.config.provider;
|
|
341
|
+
if (present(header)) return header;
|
|
342
|
+
} catch {
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* The subagent route one exact session's spawns should use.
|
|
348
|
+
* @param ctx - context used for the optional session reads.
|
|
349
|
+
* @param session - the delegating session; undefined keeps official inherit.
|
|
350
|
+
* @param settings - live Model Switch settings.
|
|
351
|
+
* @returns The complete route, or undefined for official inherit.
|
|
352
|
+
*/
|
|
353
|
+
function sessionSubagentRouteOf(ctx, session, settings) {
|
|
354
|
+
return subagentRouteOf(settings, sessionProviderOf(ctx, session));
|
|
355
|
+
}
|
|
356
|
+
//#endregion
|
|
357
|
+
export { sessionProviderOf as a, canonicalGroupProvider as c, resolveCapabilityRoute as i, normalizeProviderGroups as l, groupRoute as n, sessionSubagentRouteOf as o, memoryRouteOf as r, visionRouteOf as s, deploymentRoute as t };
|
package/lib/session-title.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as sessionProviderOf, n as groupRoute, t as deploymentRoute } from "./session-route-
|
|
1
|
+
import { a as sessionProviderOf, n as groupRoute, t as deploymentRoute } from "./session-route-CRfpxarI.js";
|
|
2
2
|
//#region lib/types/title-settings-reader.js
|
|
3
3
|
/**
|
|
4
4
|
* Safe reads of the optional Model Switch settings service for the naming row.
|
|
@@ -698,6 +698,18 @@ function leafId(entry) {
|
|
|
698
698
|
return typeof raw === "string" ? raw : void 0;
|
|
699
699
|
}
|
|
700
700
|
/**
|
|
701
|
+
* The one-shot guidance for the layer-order naming conflict.
|
|
702
|
+
*
|
|
703
|
+
* An id-disable in this plugin's bundle patch cannot reach a row the
|
|
704
|
+
* session-titles bundle inserts in a LATER layer, so the profile's bundle
|
|
705
|
+
* order decides whether the official naming row arrives disabled. The runtime
|
|
706
|
+
* takeover still displaces it, but that order leaves the composition one
|
|
707
|
+
* "did not activate" warning away from blocking unrelated profile-persisting
|
|
708
|
+
* writes (observed in the lab: prime-memory settings-set rolling back on the
|
|
709
|
+
* composition warning). Names the two durable profile-side fixes.
|
|
710
|
+
*/
|
|
711
|
+
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";
|
|
712
|
+
/**
|
|
701
713
|
* Every official naming row the loader currently has instantiated and enabled.
|
|
702
714
|
*
|
|
703
715
|
* A row that is enabled here may be about to run its own `register()`, so this
|
|
@@ -860,8 +872,10 @@ async function apply(ctx) {
|
|
|
860
872
|
const plan = planFor(ctx, module, entry);
|
|
861
873
|
if (plan === void 0) return;
|
|
862
874
|
const seam = new NamingSeam(ctx, module, settingsReader, plan);
|
|
863
|
-
|
|
875
|
+
const pendingOfficial = enabledOfficialRows(ctx).length > 0;
|
|
876
|
+
if (pendingOfficial) ctx.logger.warn("model-switch: 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");
|
|
877
|
+
if (!pendingOfficial && !seam.claim()) ctx.logger.info("model-switch: another session-title provider already owns the seam; naming follows it while it is active");
|
|
864
878
|
installTakeover(ctx, module, seam);
|
|
865
879
|
}
|
|
866
880
|
//#endregion
|
|
867
|
-
export { TAKEOVER_MAX_ATTEMPTS, TAKEOVER_RETRY_DELAY_MS, TITLE_CADENCES, apply, composeTitleRoute, forwardedConfig, frameTitleInput, inject, isMaxTokensFailure, isModernTitleModule, isOfficialTitleRow, name, normalizeTitleText, officialTitleEntry, officialTitlePackage, resolveNamingPolicy, selectTitleMessages, selectTitleReasoningEffort, shouldTryNextCandidate, splitTitlePolicy, titleCadence, titleFromOutput, titleFromResponse, titleRouteCandidates, titleSystemPrompt, widerTitleBudget };
|
|
881
|
+
export { NAMING_CONFLICT_GUIDANCE, TAKEOVER_MAX_ATTEMPTS, TAKEOVER_RETRY_DELAY_MS, TITLE_CADENCES, apply, composeTitleRoute, forwardedConfig, frameTitleInput, inject, isMaxTokensFailure, isModernTitleModule, isOfficialTitleRow, name, normalizeTitleText, officialTitleEntry, officialTitlePackage, resolveNamingPolicy, selectTitleMessages, selectTitleReasoningEffort, shouldTryNextCandidate, splitTitlePolicy, titleCadence, titleFromOutput, titleFromResponse, titleRouteCandidates, titleSystemPrompt, widerTitleBudget };
|