@carljia/omd-dsh 0.1.5 → 0.1.8

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.
@@ -1,183 +1,900 @@
1
- import z from "@deepseek-ai/schemastery";
2
- import { scopeOf } from "@deepseek-ai/dsh-scope";
3
- /**
4
- * @module @carljia/omd-dsh
5
- *
6
- * omd-mode: per-mode (agent preset) model routing row for DeepSeek Harness.
7
- *
8
- * Structurally identical to the harness built-in installModelSelection
9
- * (dsh-agent): it listens on the system-prompt/assemble event to inject
10
- * the provider/model prompt variables (so a persona can render the
11
- * model and provider template variables), and overrides provider/model
12
- * on the agent/request waterfall after next(), dropping any inherited
13
- * reasoningEffort. Both listeners register with prepend: true so this
14
- * row sits OUTSIDE the entry point per-session selection listener.
15
- *
16
- * Precedence vs. the UI model switch: the matrix model is the preset's
17
- * DEFAULT route, but an explicit user selection wins for the task.
18
- * The entry selection (installModelSelection) is invisible to this row
19
- * (it is owned by the host entry point), so the decision is derived
20
- * from what the waterfall actually resolved:
21
- *
22
- * - entry selection == matrix model -> pin (no-op);
23
- * - entry selection missing -> pin (claim the mode);
24
- * - session still blank (no request/header)
25
- * and entry selection == the deployment
26
- * default captured at mount -> pin (fallback, no pick);
27
- * - a preset switch (agent-preset/selected)
28
- * happened after the last request/header and
29
- * entry selection == the route the session
30
- * was running before the switch -> pin (new mode claims);
31
- * - otherwise the user explicitly picked a
32
- * different model -> yield: the request and
33
- * the persona variables keep the user's selection, and the row
34
- * records it on the scoped context as `omdModeOverride` so the
35
- * omd-task row can route the "deep" tier to the user's model.
36
- *
37
- * When provider/model are not configured the row passes everything
38
- * through and only serves the persona banner variables (inheriting the
39
- * entry/session selection), so it is safe to mount into any preset.
40
- */
41
- /** Cordis plugin name. */
42
- const name = "omd-mode";
43
- /** No service injection: this row only registers scoped event listeners. */
44
- const inject = [];
45
- /** Runtime schema for the omd-mode row. */
46
- const Config = z.object({
47
- mode: z.string().required(),
48
- provider: z.string(),
49
- model: z.string(),
50
- reasoningEffort: z.string(),
51
- });
52
- /**
53
- * 子代理(subagentDepth > 0)透传:omd-task 的 tier 模型通过显式 agentOptions
54
- * 落到子代理的 AgentOptions 上,本行若再覆盖会压回模式模型、破坏差异化委派。
55
- * 无显式 agentOptions 的子代理按 DSH 原生语义继承父级入口选择。
56
- */
57
- function isSubagent(agent) {
58
- return agent !== undefined && agent !== null && agent.options !== undefined && agent.options !== null
59
- && typeof agent.options.subagentDepth === "number" && agent.options.subagentDepth > 0;
60
- }
61
- /**
62
- * 最近一次 request/header 之后是否发生过 agent-preset/selected(UI 预设选择或 /mode 切换)。
63
- * 切换事件由 api-proxy 与 omd-mode-switch 在 recompose 完成之后追加,因此必须每次实时计算——
64
- * 本行挂载时事件尚未入日志,挂载时快照会漏判。
65
- */
66
- function presetSwitchedAfterLastRequest(session) {
67
- const events = session === undefined || session === null ? undefined : session.events;
68
- if (events === undefined)
69
- return false;
70
- let lastHeader = -1;
71
- let lastSwitch = -1;
72
- for (const event of events) {
73
- if (event === undefined || event === null || typeof event.seq !== "number")
74
- continue;
75
- if (event.type === "request/header")
76
- lastHeader = event.seq;
77
- else if (event.type === "agent-preset/selected")
78
- lastSwitch = event.seq;
1
+ // ../../node_modules/@deepseek-ai/cosmokit/lib/index.js
2
+ function isNullable(value) {
3
+ return value === null || value === void 0;
4
+ }
5
+ function isPlainObject(data) {
6
+ return data && typeof data === "object" && !Array.isArray(data);
7
+ }
8
+ function filterKeys(object, filter) {
9
+ return Object.fromEntries(Object.entries(object).filter(([key, value]) => filter(key, value)));
10
+ }
11
+ function mapValues(object, transform) {
12
+ return Object.fromEntries(Object.entries(object).map(([key, value]) => [key, transform(value, key)]));
13
+ }
14
+ function pick(source, keys, forced) {
15
+ if (!keys) return { ...source };
16
+ const result = {};
17
+ for (const key of keys) if (forced || source[key] !== void 0) result[key] = source[key];
18
+ return result;
19
+ }
20
+ function is(type, value) {
21
+ if (arguments.length === 1) return (value2) => is(type, value2);
22
+ return type in globalThis && value instanceof globalThis[type] || Object.prototype.toString.call(value).slice(8, -1) === type;
23
+ }
24
+ function isArrayBufferLike(value) {
25
+ return is("ArrayBuffer", value) || is("SharedArrayBuffer", value);
26
+ }
27
+ function isArrayBufferSource(value) {
28
+ return isArrayBufferLike(value) || ArrayBuffer.isView(value);
29
+ }
30
+ var Binary;
31
+ (function(Binary2) {
32
+ Binary2.is = isArrayBufferLike;
33
+ Binary2.isSource = isArrayBufferSource;
34
+ function fromSource(source) {
35
+ if (ArrayBuffer.isView(source)) return source.buffer.slice(source.byteOffset, source.byteOffset + source.byteLength);
36
+ else return source;
37
+ }
38
+ Binary2.fromSource = fromSource;
39
+ function toBase64(source) {
40
+ source = fromSource(source);
41
+ if (typeof Buffer !== "undefined") return Buffer.from(source).toString("base64");
42
+ let binary = "";
43
+ const bytes = new Uint8Array(source);
44
+ for (let i = 0; i < bytes.byteLength; i++) binary += String.fromCharCode(bytes[i]);
45
+ return btoa(binary);
46
+ }
47
+ Binary2.toBase64 = toBase64;
48
+ function fromBase64(source) {
49
+ if (typeof Buffer !== "undefined") return fromSource(Buffer.from(source, "base64"));
50
+ return Uint8Array.from(atob(source), (c) => c.charCodeAt(0));
51
+ }
52
+ Binary2.fromBase64 = fromBase64;
53
+ function toHex(source) {
54
+ source = fromSource(source);
55
+ if (typeof Buffer !== "undefined") return Buffer.from(source).toString("hex");
56
+ return Array.from(new Uint8Array(source), (byte) => byte.toString(16).padStart(2, "0")).join("");
57
+ }
58
+ Binary2.toHex = toHex;
59
+ function fromHex(source) {
60
+ if (typeof Buffer !== "undefined") return fromSource(Buffer.from(source, "hex"));
61
+ const hex = source.length % 2 === 0 ? source : source.slice(0, source.length - 1);
62
+ const buffer = [];
63
+ for (let i = 0; i < hex.length; i += 2) buffer.push(parseInt(`${hex[i]}${hex[i + 1]}`, 16));
64
+ return Uint8Array.from(buffer).buffer;
65
+ }
66
+ Binary2.fromHex = fromHex;
67
+ })(Binary || (Binary = {}));
68
+ var base64ToArrayBuffer = Binary.fromBase64;
69
+ var arrayBufferToBase64 = Binary.toBase64;
70
+ var hexToArrayBuffer = Binary.fromHex;
71
+ var arrayBufferToHex = Binary.toHex;
72
+ function clone(source, refs = /* @__PURE__ */ new Map()) {
73
+ if (!source || typeof source !== "object") return source;
74
+ if (is("Date", source)) return new Date(source.valueOf());
75
+ if (is("RegExp", source)) return new RegExp(source.source, source.flags);
76
+ if (isArrayBufferLike(source)) return source.slice(0);
77
+ if (ArrayBuffer.isView(source)) return source.buffer.slice(source.byteOffset, source.byteOffset + source.byteLength);
78
+ const cached = refs.get(source);
79
+ if (cached) return cached;
80
+ if (Array.isArray(source)) {
81
+ const result2 = [];
82
+ refs.set(source, result2);
83
+ source.forEach((value, index) => {
84
+ result2[index] = Reflect.apply(clone, null, [value, refs]);
85
+ });
86
+ return result2;
87
+ }
88
+ const result = Object.create(Object.getPrototypeOf(source));
89
+ refs.set(source, result);
90
+ for (const key of Reflect.ownKeys(source)) {
91
+ const descriptor = { ...Reflect.getOwnPropertyDescriptor(source, key) };
92
+ if ("value" in descriptor) descriptor.value = Reflect.apply(clone, null, [descriptor.value, refs]);
93
+ Reflect.defineProperty(result, key, descriptor);
94
+ }
95
+ return result;
96
+ }
97
+ function deepEqual(a, b, strict) {
98
+ if (a === b) return true;
99
+ if (!strict && isNullable(a) && isNullable(b)) return true;
100
+ if (typeof a !== typeof b) return false;
101
+ if (typeof a !== "object") return false;
102
+ if (!a || !b) return false;
103
+ function check(test, then) {
104
+ return test(a) ? test(b) ? then(a, b) : false : test(b) ? false : void 0;
105
+ }
106
+ return check(Array.isArray, (a2, b2) => a2.length === b2.length && a2.every((item, index) => deepEqual(item, b2[index]))) ?? check(is("Date"), (a2, b2) => a2.valueOf() === b2.valueOf()) ?? check(is("RegExp"), (a2, b2) => a2.source === b2.source && a2.flags === b2.flags) ?? check(isArrayBufferLike, (a2, b2) => {
107
+ if (a2.byteLength !== b2.byteLength) return false;
108
+ const viewA = new Uint8Array(a2);
109
+ const viewB = new Uint8Array(b2);
110
+ for (let i = 0; i < viewA.length; i++) if (viewA[i] !== viewB[i]) return false;
111
+ return true;
112
+ }) ?? Object.keys({
113
+ ...a,
114
+ ...b
115
+ }).every((key) => deepEqual(a[key], b[key], strict));
116
+ }
117
+ var Time;
118
+ (function(Time2) {
119
+ Time2.millisecond = 1;
120
+ Time2.second = 1e3;
121
+ Time2.minute = Time2.second * 60;
122
+ Time2.hour = Time2.minute * 60;
123
+ Time2.day = Time2.hour * 24;
124
+ Time2.week = Time2.day * 7;
125
+ let timezoneOffset = (/* @__PURE__ */ new Date()).getTimezoneOffset();
126
+ function setTimezoneOffset(offset) {
127
+ timezoneOffset = offset;
128
+ }
129
+ Time2.setTimezoneOffset = setTimezoneOffset;
130
+ function getTimezoneOffset() {
131
+ return timezoneOffset;
132
+ }
133
+ Time2.getTimezoneOffset = getTimezoneOffset;
134
+ function getDateNumber(date2 = /* @__PURE__ */ new Date(), offset) {
135
+ if (typeof date2 === "number") date2 = new Date(date2);
136
+ if (offset === void 0) offset = timezoneOffset;
137
+ return Math.floor((date2.valueOf() / Time2.minute - offset) / 1440);
138
+ }
139
+ Time2.getDateNumber = getDateNumber;
140
+ function fromDateNumber(value, offset) {
141
+ const date2 = new Date(value * Time2.day);
142
+ if (offset === void 0) offset = timezoneOffset;
143
+ return new Date(+date2 + offset * Time2.minute);
144
+ }
145
+ Time2.fromDateNumber = fromDateNumber;
146
+ const numeric = /\d+(?:\.\d+)?/.source;
147
+ const timeRegExp = new RegExp(`^${[
148
+ "w(?:eek(?:s)?)?",
149
+ "d(?:ay(?:s)?)?",
150
+ "h(?:our(?:s)?)?",
151
+ "m(?:in(?:ute)?(?:s)?)?",
152
+ "s(?:ec(?:ond)?(?:s)?)?"
153
+ ].map((unit) => `(${numeric}${unit})?`).join("")}$`);
154
+ function parseTime(source) {
155
+ const capture = timeRegExp.exec(source);
156
+ if (!capture) return 0;
157
+ return (parseFloat(capture[1]) * Time2.week || 0) + (parseFloat(capture[2]) * Time2.day || 0) + (parseFloat(capture[3]) * Time2.hour || 0) + (parseFloat(capture[4]) * Time2.minute || 0) + (parseFloat(capture[5]) * Time2.second || 0);
158
+ }
159
+ Time2.parseTime = parseTime;
160
+ function parseDate(date2) {
161
+ const parsed = parseTime(date2);
162
+ if (parsed) date2 = Date.now() + parsed;
163
+ else if (/^\d{1,2}(:\d{1,2}){1,2}$/.test(date2)) date2 = `${(/* @__PURE__ */ new Date()).toLocaleDateString()}-${date2}`;
164
+ else if (/^\d{1,2}-\d{1,2}-\d{1,2}(:\d{1,2}){1,2}$/.test(date2)) date2 = `${(/* @__PURE__ */ new Date()).getFullYear()}-${date2}`;
165
+ return date2 ? new Date(date2) : /* @__PURE__ */ new Date();
166
+ }
167
+ Time2.parseDate = parseDate;
168
+ function format(ms) {
169
+ const abs = Math.abs(ms);
170
+ if (abs >= Time2.day - Time2.hour / 2) return Math.round(ms / Time2.day) + "d";
171
+ else if (abs >= Time2.hour - Time2.minute / 2) return Math.round(ms / Time2.hour) + "h";
172
+ else if (abs >= Time2.minute - Time2.second / 2) return Math.round(ms / Time2.minute) + "m";
173
+ else if (abs >= Time2.second) return Math.round(ms / Time2.second) + "s";
174
+ return ms + "ms";
175
+ }
176
+ Time2.format = format;
177
+ function toDigits(source, length = 2) {
178
+ return source.toString().padStart(length, "0");
179
+ }
180
+ Time2.toDigits = toDigits;
181
+ function template(template2, time = /* @__PURE__ */ new Date()) {
182
+ return template2.replace("yyyy", time.getFullYear().toString()).replace("yy", time.getFullYear().toString().slice(2)).replace("MM", toDigits(time.getMonth() + 1)).replace("dd", toDigits(time.getDate())).replace("hh", toDigits(time.getHours())).replace("mm", toDigits(time.getMinutes())).replace("ss", toDigits(time.getSeconds())).replace("SSS", toDigits(time.getMilliseconds(), 3));
183
+ }
184
+ Time2.template = template;
185
+ })(Time || (Time = {}));
186
+
187
+ // ../../node_modules/@deepseek-ai/schemastery/lib/index.mjs
188
+ var kSchema = /* @__PURE__ */ Symbol.for("schemastery");
189
+ var kValidationError = /* @__PURE__ */ Symbol.for("ValidationError");
190
+ globalThis.__schemastery_index__ ??= 0;
191
+ globalThis.__schemastery_refs__ = void 0;
192
+ var ValidationError = class extends TypeError {
193
+ options;
194
+ name = "ValidationError";
195
+ constructor(message, options) {
196
+ let prefix = "$";
197
+ for (const segment of options.path || []) if (typeof segment === "string") prefix += "." + segment;
198
+ else if (typeof segment === "number") prefix += "[" + segment + "]";
199
+ else if (typeof segment === "symbol") prefix += `[Symbol(${segment.toString()})]`;
200
+ if (prefix.startsWith(".")) prefix = prefix.slice(1);
201
+ super((prefix === "$" ? "" : `${prefix} `) + message);
202
+ this.options = options;
203
+ }
204
+ static is(error) {
205
+ return !!error?.[kValidationError];
206
+ }
207
+ };
208
+ Object.defineProperty(ValidationError.prototype, kValidationError, { value: true });
209
+ var Schema = function(options) {
210
+ const schema = function(data, options2 = {}) {
211
+ return Schema.resolve(data, schema, options2)[0];
212
+ };
213
+ if (options.refs) {
214
+ const refs = mapValues(options.refs, (options2) => new Schema(options2));
215
+ const getRef = (uid) => refs[uid];
216
+ for (const key in refs) {
217
+ const options2 = refs[key];
218
+ options2.sKey = getRef(options2.sKey);
219
+ options2.inner = getRef(options2.inner);
220
+ options2.list = options2.list && options2.list.map(getRef);
221
+ options2.dict = options2.dict && mapValues(options2.dict, getRef);
79
222
  }
80
- return lastSwitch > lastHeader;
223
+ return refs[options.uid];
224
+ }
225
+ Object.assign(schema, options);
226
+ if (typeof schema.callback === "string") try {
227
+ schema.callback = new Function("return " + schema.callback)();
228
+ } catch {
229
+ }
230
+ Object.defineProperty(schema, "uid", { value: globalThis.__schemastery_index__++ });
231
+ Object.setPrototypeOf(schema, Schema.prototype);
232
+ schema.meta ||= {};
233
+ schema.toString = schema.toString.bind(schema);
234
+ return schema;
235
+ };
236
+ Schema.prototype = Object.create(Function.prototype);
237
+ Schema.prototype[kSchema] = true;
238
+ Object.defineProperty(Schema.prototype, "~standard", { get() {
239
+ return {
240
+ version: 1,
241
+ vendor: "schemastery",
242
+ validate: (value) => {
243
+ try {
244
+ return { value: Schema.resolve(value, this, {})[0] };
245
+ } catch (error) {
246
+ if (ValidationError.is(error)) return { issues: [{
247
+ message: error.message,
248
+ path: error.options.path
249
+ }] };
250
+ throw error;
251
+ }
252
+ }
253
+ };
254
+ } });
255
+ Schema.ValidationError = ValidationError;
256
+ Schema.prototype.toJSON = function toJSON() {
257
+ if (globalThis.__schemastery_refs__) {
258
+ globalThis.__schemastery_refs__[this.uid] ??= JSON.parse(JSON.stringify({ ...this }));
259
+ return this.uid;
260
+ }
261
+ globalThis.__schemastery_refs__ = { [this.uid]: { ...this } };
262
+ globalThis.__schemastery_refs__[this.uid] = JSON.parse(JSON.stringify({ ...this }));
263
+ const result = {
264
+ uid: this.uid,
265
+ refs: globalThis.__schemastery_refs__
266
+ };
267
+ globalThis.__schemastery_refs__ = void 0;
268
+ return result;
269
+ };
270
+ Schema.prototype.set = function set(key, value) {
271
+ this.dict[key] = value;
272
+ return this;
273
+ };
274
+ Schema.prototype.push = function push(value) {
275
+ this.list.push(value);
276
+ return this;
277
+ };
278
+ function mergeDesc(original, messages) {
279
+ const result = typeof original === "string" ? { "": original } : { ...original };
280
+ for (const locale in messages) {
281
+ const value = messages[locale];
282
+ if (value?.$description || value?.$desc) result[locale] = value.$description || value.$desc;
283
+ else if (typeof value === "string") result[locale] = value;
284
+ }
285
+ return result;
81
286
  }
82
- function apply(ctx, config) {
83
- if (scopeOf(ctx) === undefined) {
84
- throw new Error("omd-mode: refusing to mount outside a scoped context (mode '" + config.mode + "'). " +
85
- "Mount this row inside an agent preset; a global mount would pin the model for every agent in the process.");
287
+ function getInner(value) {
288
+ return value?.$value ?? value?.$inner;
289
+ }
290
+ function extractKeys(data) {
291
+ return filterKeys(data ?? {}, (key) => !key.startsWith("$"));
292
+ }
293
+ Schema.prototype.i18n = function i18n(messages) {
294
+ const schema = Schema(this);
295
+ const desc = mergeDesc(schema.meta.description, messages);
296
+ if (Object.keys(desc).length) schema.meta.description = desc;
297
+ if (schema.dict) schema.dict = mapValues(schema.dict, (inner, key) => {
298
+ return inner.i18n(mapValues(messages, (data) => getInner(data)?.[key] ?? data?.[key]));
299
+ });
300
+ if (schema.list) schema.list = schema.list.map((inner, index) => {
301
+ return inner.i18n(mapValues(messages, (data = {}) => {
302
+ if (Array.isArray(getInner(data))) return getInner(data)[index];
303
+ if (Array.isArray(data)) return data[index];
304
+ return extractKeys(data);
305
+ }));
306
+ });
307
+ if (schema.inner) schema.inner = schema.inner.i18n(mapValues(messages, (data) => {
308
+ if (getInner(data)) return getInner(data);
309
+ return extractKeys(data);
310
+ }));
311
+ if (schema.sKey) schema.sKey = schema.sKey.i18n(mapValues(messages, (data) => data?.$key));
312
+ return schema;
313
+ };
314
+ Schema.prototype.extra = function extra(key, value) {
315
+ const schema = Schema(this);
316
+ schema.meta = {
317
+ ...schema.meta,
318
+ [key]: value
319
+ };
320
+ return schema;
321
+ };
322
+ for (const key of [
323
+ "required",
324
+ "disabled",
325
+ "collapse",
326
+ "hidden",
327
+ "loose"
328
+ ]) Object.assign(Schema.prototype, { [key](value = true) {
329
+ const schema = Schema(this);
330
+ schema.meta = {
331
+ ...schema.meta,
332
+ [key]: value
333
+ };
334
+ return schema;
335
+ } });
336
+ Schema.prototype.deprecated = function deprecated() {
337
+ const schema = Schema(this);
338
+ schema.meta.badges ||= [];
339
+ schema.meta.badges.push({
340
+ text: "deprecated",
341
+ type: "danger"
342
+ });
343
+ return schema;
344
+ };
345
+ Schema.prototype.experimental = function experimental() {
346
+ const schema = Schema(this);
347
+ schema.meta.badges ||= [];
348
+ schema.meta.badges.push({
349
+ text: "experimental",
350
+ type: "warning"
351
+ });
352
+ return schema;
353
+ };
354
+ Schema.prototype.pattern = function pattern(regexp) {
355
+ const schema = Schema(this);
356
+ const pattern2 = pick(regexp, ["source", "flags"]);
357
+ schema.meta = {
358
+ ...schema.meta,
359
+ pattern: pattern2
360
+ };
361
+ return schema;
362
+ };
363
+ Schema.prototype.simplify = function simplify(value) {
364
+ if (deepEqual(value, this.meta.default, this.type === "dict")) return null;
365
+ if (isNullable(value)) return value;
366
+ if (this.type === "object" || this.type === "dict") {
367
+ const result = {};
368
+ for (const key in value) {
369
+ const item = (this.type === "object" ? this.dict[key] : this.inner)?.simplify(value[key]);
370
+ if (this.type === "dict" || !isNullable(item)) result[key] = item;
86
371
  }
87
- const pinned = config.provider !== undefined && config.model !== undefined
88
- ? {
89
- provider: config.provider,
90
- model: config.model,
91
- }
92
- : undefined;
93
- if (config.reasoningEffort !== undefined && pinned !== undefined) {
94
- pinned.reasoningEffort = config.reasoningEffort;
372
+ if (deepEqual(result, this.meta.default, this.type === "dict")) return null;
373
+ return result;
374
+ } else if (this.type === "array" || this.type === "tuple") {
375
+ const result = [];
376
+ value.forEach((value2, index) => {
377
+ const schema = this.type === "array" ? this.inner : this.list[index];
378
+ const item = schema ? schema.simplify(value2) : value2;
379
+ result.push(item);
380
+ });
381
+ return result;
382
+ } else if (this.type === "intersect") {
383
+ const result = {};
384
+ for (const item of this.list) Object.assign(result, item.simplify(value));
385
+ return result;
386
+ } else if (this.type === "union") for (const schema of this.list) try {
387
+ Schema.resolve(value, schema, {});
388
+ return schema.simplify(value);
389
+ } catch {
390
+ }
391
+ return value;
392
+ };
393
+ Schema.prototype.toString = function toString(inline) {
394
+ return formatters[this.type]?.(this, inline) ?? `Schema<${this.type}>`;
395
+ };
396
+ Schema.prototype.role = function role(role, extra2) {
397
+ const schema = Schema(this);
398
+ schema.meta = {
399
+ ...schema.meta,
400
+ role,
401
+ extra: extra2
402
+ };
403
+ return schema;
404
+ };
405
+ for (const key of [
406
+ "default",
407
+ "link",
408
+ "comment",
409
+ "description",
410
+ "max",
411
+ "min",
412
+ "step"
413
+ ]) Object.assign(Schema.prototype, { [key](value) {
414
+ const schema = Schema(this);
415
+ schema.meta = {
416
+ ...schema.meta,
417
+ [key]: value
418
+ };
419
+ return schema;
420
+ } });
421
+ var resolvers = {};
422
+ Schema.extend = function extend(type, resolve2) {
423
+ resolvers[type] = resolve2;
424
+ };
425
+ Schema.resolve = function resolve(data, schema, options = {}, strict = false) {
426
+ if (!schema) return [data];
427
+ if (options.ignore?.(data, schema)) return [data];
428
+ if (isNullable(data) && schema.type !== "lazy") {
429
+ if (schema.meta.required) throw new ValidationError(`missing required value`, options);
430
+ let current = schema;
431
+ let fallback = schema.meta.default;
432
+ while (current?.type === "intersect" && isNullable(fallback)) {
433
+ current = current.list[0];
434
+ fallback = current?.meta.default;
435
+ }
436
+ if (isNullable(fallback)) return [data];
437
+ data = clone(fallback);
438
+ }
439
+ const callback = resolvers[schema.type];
440
+ if (!callback) throw new ValidationError(`unsupported type "${schema.type}"`, options);
441
+ try {
442
+ return callback(data, schema, options, strict);
443
+ } catch (error) {
444
+ if (!schema.meta.loose) throw error;
445
+ return [schema.meta.default];
446
+ }
447
+ };
448
+ Schema.from = function from(source) {
449
+ if (isNullable(source)) return Schema.any();
450
+ else if ([
451
+ "string",
452
+ "number",
453
+ "boolean"
454
+ ].includes(typeof source)) return Schema.const(source).required();
455
+ else if (source[kSchema]) return source;
456
+ else if (typeof source === "function") switch (source) {
457
+ case String:
458
+ return Schema.string().required();
459
+ case Number:
460
+ return Schema.number().required();
461
+ case Boolean:
462
+ return Schema.boolean().required();
463
+ case Function:
464
+ return Schema.function().required();
465
+ default:
466
+ return Schema.is(source).required();
467
+ }
468
+ else throw new TypeError(`cannot infer schema from ${source}`);
469
+ };
470
+ Schema.lazy = function lazy(builder) {
471
+ const toJSON2 = () => {
472
+ if (!schema.inner[kSchema]) {
473
+ schema.inner = schema.builder();
474
+ schema.inner.meta = {
475
+ ...schema.meta,
476
+ ...schema.inner.meta
477
+ };
95
478
  }
96
- // 挂载时快照部署默认模型(d0)。blank 会话的入口选择 == d0 视为「未显式选择」。
97
- // 必须静态快照:session.selectModel 每次都会把用户选择写回全局默认,动态读取会把
98
- // 用户选择误判为默认值。
99
- let d0;
479
+ return schema.inner.toJSON();
480
+ };
481
+ const schema = new Schema({
482
+ type: "lazy",
483
+ builder,
484
+ inner: { toJSON: toJSON2 }
485
+ });
486
+ return schema;
487
+ };
488
+ Schema.natural = function natural() {
489
+ return Schema.number().step(1).min(0);
490
+ };
491
+ Schema.percent = function percent() {
492
+ return Schema.number().step(0.01).min(0).max(1).role("slider");
493
+ };
494
+ Schema.date = function date() {
495
+ return Schema.union([Schema.is(Date), Schema.transform(Schema.string().role("datetime"), (value, options) => {
496
+ const date2 = new Date(value);
497
+ if (isNaN(+date2)) throw new ValidationError(`invalid date "${value}"`, options);
498
+ return date2;
499
+ }, true)]);
500
+ };
501
+ Schema.regExp = function regExp(flag = "") {
502
+ return Schema.union([Schema.is(RegExp), Schema.transform(Schema.string().role("regexp", { flag }), (value, options) => {
100
503
  try {
101
- const def = ctx.get("agentDefaultModel");
102
- const current = def !== undefined && def !== null ? def.currentSelection() : undefined;
103
- if (current !== undefined && current !== null && typeof current.provider === "string" && typeof current.model === "string") {
104
- d0 = { provider: current.provider, model: current.model };
105
- }
504
+ return new RegExp(value, flag);
505
+ } catch (e) {
506
+ throw new ValidationError(e.message, options);
106
507
  }
107
- catch { /* 读不到默认时退化为仅 entry == pinned 判定 */ }
108
- // 供同 preset 内的 omd-task 行读取:用户显式切换模型后(本行让路),deep tier 沿用用户选择。
109
- ctx.omdModeOverride = undefined;
110
- /**
111
- * 判定一次入口选择是否应钉到模式模型(true),还是让路给用户选择(false)。
112
- * @param agent - 顶层 agent(子代理已由调用方过滤)。
113
- * @param entry - 入口选择 { provider, model };provider/model 缺失 = 无入口选择。
114
- */
115
- function shouldPin(agent, entry) {
116
- if (pinned === undefined)
117
- return false;
118
- if (entry === undefined || entry.provider === undefined || entry.model === undefined)
119
- return true;
120
- if (entry.provider === pinned.provider && entry.model === pinned.model)
121
- return true;
122
- const session = agent !== undefined && agent !== null ? agent.session : undefined;
123
- const logged = session === undefined ? undefined : session.requestHeader();
124
- if (logged === undefined) {
125
- // 会话尚无任何请求:入口选择要么是部署默认(未选择),要么是首请求前的显式选择。
126
- // 只有默认值视为「未选择」;其余一律视为用户选择。
127
- if (d0 !== undefined && entry.provider === d0.provider && entry.model === d0.model)
128
- return true;
129
- return false;
508
+ }, true)]);
509
+ };
510
+ Schema.arrayBuffer = function arrayBuffer(encoding) {
511
+ return Schema.union([
512
+ Schema.is(ArrayBuffer),
513
+ Schema.is(SharedArrayBuffer),
514
+ Schema.transform(Schema.any(), (value, options) => {
515
+ if (Binary.isSource(value)) return Binary.fromSource(value);
516
+ throw new ValidationError(`expected ArrayBufferSource but got ${value}`, options);
517
+ }, true),
518
+ ...encoding ? [Schema.transform(Schema.string(), (value, options) => {
519
+ try {
520
+ return encoding === "base64" ? Binary.fromBase64(value) : Binary.fromHex(value);
521
+ } catch (e) {
522
+ throw new ValidationError(e.message, options);
523
+ }
524
+ }, true)] : []
525
+ ]);
526
+ };
527
+ Schema.extend("lazy", (data, schema, options, strict) => {
528
+ if (!schema.inner[kSchema]) {
529
+ schema.inner = schema.builder();
530
+ schema.inner.meta = {
531
+ ...schema.meta,
532
+ ...schema.inner.meta
533
+ };
534
+ }
535
+ return Schema.resolve(data, schema.inner, options, strict);
536
+ });
537
+ Schema.extend("any", (data) => {
538
+ return [data];
539
+ });
540
+ Schema.extend("never", (data, _, options) => {
541
+ throw new ValidationError(`expected nullable but got ${data}`, options);
542
+ });
543
+ Schema.extend("const", (data, { value }, options) => {
544
+ if (deepEqual(data, value)) return [value];
545
+ throw new ValidationError(`expected ${value} but got ${data}`, options);
546
+ });
547
+ function checkWithinRange(data, meta, description, options, skipMin = false) {
548
+ const { max = Infinity, min = -Infinity } = meta;
549
+ if (data > max) throw new ValidationError(`expected ${description} <= ${max} but got ${data}`, options);
550
+ if (data < min && !skipMin) throw new ValidationError(`expected ${description} >= ${min} but got ${data}`, options);
551
+ }
552
+ Schema.extend("string", (data, { meta }, options) => {
553
+ if (typeof data !== "string") throw new ValidationError(`expected string but got ${data}`, options);
554
+ if (meta.pattern) {
555
+ const regexp = new RegExp(meta.pattern.source, meta.pattern.flags);
556
+ if (!regexp.test(data)) throw new ValidationError(`expect string to match regexp ${regexp}`, options);
557
+ }
558
+ checkWithinRange(data.length, meta, "string length", options);
559
+ return [data];
560
+ });
561
+ function decimalShift(data, digits) {
562
+ const str = data.toString();
563
+ if (str.includes("e")) return data * Math.pow(10, digits);
564
+ const index = str.indexOf(".");
565
+ if (index === -1) return data * Math.pow(10, digits);
566
+ const frac = str.slice(index + 1);
567
+ const integer = str.slice(0, index);
568
+ if (frac.length <= digits) return +(integer + frac.padEnd(digits, "0"));
569
+ return +(integer + frac.slice(0, digits) + "." + frac.slice(digits));
570
+ }
571
+ function isMultipleOf(data, min, step) {
572
+ step = Math.abs(step);
573
+ if (!/^\d+\.\d+$/.test(step.toString())) return (data - min) % step === 0;
574
+ const index = step.toString().indexOf(".");
575
+ const digits = step.toString().slice(index + 1).length;
576
+ return Math.abs(decimalShift(data, digits) - decimalShift(min, digits)) % decimalShift(step, digits) === 0;
577
+ }
578
+ Schema.extend("number", (data, { meta }, options) => {
579
+ if (typeof data !== "number") throw new ValidationError(`expected number but got ${data}`, options);
580
+ checkWithinRange(data, meta, "number", options);
581
+ const { step } = meta;
582
+ if (step && !isMultipleOf(data, meta.min ?? 0, step)) throw new ValidationError(`expected number multiple of ${step} but got ${data}`, options);
583
+ return [data];
584
+ });
585
+ Schema.extend("boolean", (data, _, options) => {
586
+ if (typeof data === "boolean") return [data];
587
+ throw new ValidationError(`expected boolean but got ${data}`, options);
588
+ });
589
+ Schema.extend("bitset", (data, { bits, meta }, options) => {
590
+ let value = 0, keys = [];
591
+ if (typeof data === "number") {
592
+ value = data;
593
+ for (const key in bits) if (data & bits[key]) keys.push(key);
594
+ } else if (Array.isArray(data)) {
595
+ keys = data;
596
+ for (const key of keys) {
597
+ if (typeof key !== "string") throw new ValidationError(`expected string but got ${key}`, options);
598
+ if (key in bits) value |= bits[key];
599
+ }
600
+ } else throw new ValidationError(`expected number or array but got ${data}`, options);
601
+ if (value === meta.default) return [value];
602
+ return [value, keys];
603
+ });
604
+ Schema.extend("function", (data, _, options) => {
605
+ if (typeof data === "function") return [data];
606
+ throw new ValidationError(`expected function but got ${data}`, options);
607
+ });
608
+ Schema.extend("is", (data, { constructor }, options) => {
609
+ if (typeof constructor === "function") {
610
+ if (data instanceof constructor) return [data];
611
+ throw new ValidationError(`expected ${constructor.name} but got ${data}`, options);
612
+ } else {
613
+ if (isNullable(data)) throw new ValidationError(`expected ${constructor} but got ${data}`, options);
614
+ let prototype = Object.getPrototypeOf(data);
615
+ while (prototype) {
616
+ if (prototype.constructor?.name === constructor) return [data];
617
+ prototype = Object.getPrototypeOf(prototype);
618
+ }
619
+ throw new ValidationError(`expected ${constructor} but got ${data}`, options);
620
+ }
621
+ });
622
+ function property(data, key, schema, options) {
623
+ try {
624
+ const [value, adapted] = Schema.resolve(data[key], schema, {
625
+ ...options,
626
+ path: [...options.path || [], key]
627
+ });
628
+ if (adapted !== void 0) data[key] = adapted;
629
+ return value;
630
+ } catch (e) {
631
+ if (!options?.autofix) throw e;
632
+ delete data[key];
633
+ return schema.meta.default;
634
+ }
635
+ }
636
+ Schema.extend("array", (data, { inner, meta }, options) => {
637
+ if (!Array.isArray(data)) throw new ValidationError(`expected array but got ${data}`, options);
638
+ checkWithinRange(data.length, meta, "array length", options, !isNullable(inner.meta.default));
639
+ return [data.map((_, index) => property(data, index, inner, options))];
640
+ });
641
+ Schema.extend("dict", (data, { inner, sKey }, options, strict) => {
642
+ if (!isPlainObject(data)) throw new ValidationError(`expected object but got ${data}`, options);
643
+ const result = {};
644
+ for (const key in data) {
645
+ let rKey;
646
+ try {
647
+ rKey = Schema.resolve(key, sKey, options)[0];
648
+ } catch (error) {
649
+ if (strict) continue;
650
+ throw error;
651
+ }
652
+ result[rKey] = property(data, key, inner, options);
653
+ data[rKey] = data[key];
654
+ if (key !== rKey) delete data[key];
655
+ }
656
+ return [result];
657
+ });
658
+ Schema.extend("tuple", (data, { list }, options, strict) => {
659
+ if (!Array.isArray(data)) throw new ValidationError(`expected array but got ${data}`, options);
660
+ const result = list.map((inner, index) => property(data, index, inner, options));
661
+ if (strict) return [result];
662
+ result.push(...data.slice(list.length));
663
+ return [result];
664
+ });
665
+ function merge(result, data) {
666
+ for (const key in data) {
667
+ if (key in result) continue;
668
+ result[key] = data[key];
669
+ }
670
+ }
671
+ Schema.extend("object", (data, { dict }, options, strict) => {
672
+ if (!isPlainObject(data)) throw new ValidationError(`expected object but got ${data}`, options);
673
+ const result = {};
674
+ for (const key in dict) {
675
+ const value = property(data, key, dict[key], options);
676
+ if (!isNullable(value) || key in data) result[key] = value;
677
+ }
678
+ if (!strict) merge(result, data);
679
+ return [result];
680
+ });
681
+ Schema.extend("union", (data, { list, toString: toString2 }, options, strict) => {
682
+ const messages = [];
683
+ for (const inner of list) try {
684
+ return Schema.resolve(data, inner, options, strict);
685
+ } catch (error) {
686
+ messages.push(error);
687
+ }
688
+ throw new ValidationError(`expected ${toString2()} but got ${JSON.stringify(data)}`, options);
689
+ });
690
+ Schema.extend("intersect", (data, { list, toString: toString2 }, options, strict) => {
691
+ if (!list.length) return [data];
692
+ let result;
693
+ for (const inner of list) {
694
+ const value = Schema.resolve(data, inner, options, true)[0];
695
+ if (isNullable(value)) continue;
696
+ if (isNullable(result)) result = value;
697
+ else if (typeof result !== typeof value) throw new ValidationError(`expected ${toString2()} but got ${JSON.stringify(data)}`, options);
698
+ else if (typeof value === "object") merge(result ??= {}, value);
699
+ else if (result !== value) throw new ValidationError(`expected ${toString2()} but got ${JSON.stringify(data)}`, options);
700
+ }
701
+ if (!strict && isPlainObject(data)) merge(result, data);
702
+ return [result];
703
+ });
704
+ Schema.extend("transform", (data, { inner, callback, preserve }, options) => {
705
+ const [result, adapted = data] = Schema.resolve(data, inner, options, true);
706
+ if (preserve) return [callback(result)];
707
+ else return [callback(result), callback(adapted)];
708
+ });
709
+ var formatters = {};
710
+ function defineMethod(name2, keys, format) {
711
+ formatters[name2] = format;
712
+ Object.assign(Schema, { [name2](...args) {
713
+ const schema = new Schema({ type: name2 });
714
+ keys.forEach((key, index) => {
715
+ switch (key) {
716
+ case "sKey":
717
+ schema.sKey = args[index] ?? Schema.string();
718
+ break;
719
+ case "inner":
720
+ schema.inner = Schema.from(args[index]);
721
+ break;
722
+ case "list":
723
+ schema.list = args[index].map(Schema.from);
724
+ break;
725
+ case "dict":
726
+ schema.dict = mapValues(args[index], Schema.from);
727
+ break;
728
+ case "bits":
729
+ schema.bits = {};
730
+ for (const key2 in args[index]) {
731
+ if (typeof args[index][key2] !== "number") continue;
732
+ schema.bits[key2] = args[index][key2];
733
+ }
734
+ break;
735
+ case "callback": {
736
+ const callback = schema.callback = args[index];
737
+ callback["toJSON"] ||= () => callback.toString();
738
+ break;
130
739
  }
131
- // 会话已跑过请求:刚切换 preset(/mode 或 UI 选择)时,切换前的路由(logged)是
132
- // 新模式认领矩阵模型的基线;否则入口选择与模式模型不同 = 用户显式切换,让路。
133
- if (presetSwitchedAfterLastRequest(session)
134
- && logged.config !== undefined && logged.config !== null
135
- && entry.provider === logged.config.provider && entry.model === logged.config.model) {
136
- return true;
740
+ case "constructor": {
741
+ const constructor = schema.constructor = args[index];
742
+ if (typeof constructor === "function") constructor["toJSON"] ||= () => constructor["name"];
743
+ break;
137
744
  }
138
- return false;
745
+ default:
746
+ schema[key] = args[index];
747
+ }
748
+ });
749
+ if (name2 === "object" || name2 === "dict") schema.meta.default = {};
750
+ else if (name2 === "array" || name2 === "tuple") schema.meta.default = [];
751
+ else if (name2 === "bitset") schema.meta.default = 0;
752
+ return schema;
753
+ } });
754
+ }
755
+ defineMethod("is", ["constructor"], ({ constructor }) => {
756
+ if (typeof constructor === "function") return constructor.name;
757
+ else return constructor;
758
+ });
759
+ defineMethod("any", [], () => "any");
760
+ defineMethod("never", [], () => "never");
761
+ defineMethod("const", ["value"], ({ value }) => typeof value === "string" ? JSON.stringify(value) : value);
762
+ defineMethod("string", [], () => "string");
763
+ defineMethod("number", [], () => "number");
764
+ defineMethod("boolean", [], () => "boolean");
765
+ defineMethod("bitset", ["bits"], () => "bitset");
766
+ defineMethod("function", [], () => "function");
767
+ defineMethod("array", ["inner"], ({ inner }) => `${inner.toString(true)}[]`);
768
+ defineMethod("dict", ["inner", "sKey"], ({ inner, sKey }) => `{ [key: ${sKey.toString()}]: ${inner.toString()} }`);
769
+ defineMethod("tuple", ["list"], ({ list }) => `[${list.map((inner) => inner.toString()).join(", ")}]`);
770
+ defineMethod("object", ["dict"], ({ dict }) => {
771
+ if (Object.keys(dict).length === 0) return "{}";
772
+ return `{ ${Object.entries(dict).map(([key, inner]) => {
773
+ return `${key}${inner.meta.required ? "" : "?"}: ${inner.toString()}`;
774
+ }).join(", ")} }`;
775
+ });
776
+ defineMethod("union", ["list"], ({ list }, inline) => {
777
+ const result = list.map(({ toString: format }) => format()).join(" | ");
778
+ return inline ? `(${result})` : result;
779
+ });
780
+ defineMethod("intersect", ["list"], ({ list }) => {
781
+ return `${list.map((inner) => inner.toString(true)).join(" & ")}`;
782
+ });
783
+ defineMethod("transform", [
784
+ "inner",
785
+ "callback",
786
+ "preserve"
787
+ ], ({ inner }, isInner) => inner.toString(isInner));
788
+
789
+ // lib/index.js
790
+ import { setModeOverride } from "./shared.js";
791
+ var name = "omd-mode";
792
+ var inject = [];
793
+ var Config = Schema.object({
794
+ mode: Schema.string().required(),
795
+ provider: Schema.string(),
796
+ model: Schema.string(),
797
+ reasoningEffort: Schema.string()
798
+ });
799
+ function isSubagent(agent) {
800
+ return agent !== void 0 && agent !== null && agent.options !== void 0 && agent.options !== null && typeof agent.options.subagentDepth === "number" && agent.options.subagentDepth > 0;
801
+ }
802
+ function presetSwitchedAfterLastRequest(session) {
803
+ const events = session === void 0 || session === null ? void 0 : session.events;
804
+ if (events === void 0)
805
+ return false;
806
+ let lastHeader = -1;
807
+ let lastSwitch = -1;
808
+ for (const event of events) {
809
+ if (event === void 0 || event === null || typeof event.seq !== "number")
810
+ continue;
811
+ if (event.type === "request/header")
812
+ lastHeader = event.seq;
813
+ else if (event.type === "agent-preset/selected")
814
+ lastSwitch = event.seq;
815
+ }
816
+ return lastSwitch > lastHeader;
817
+ }
818
+ function apply(ctx, config) {
819
+ const pinned = config.provider !== void 0 && config.model !== void 0 ? {
820
+ provider: config.provider,
821
+ model: config.model
822
+ } : void 0;
823
+ if (config.reasoningEffort !== void 0 && pinned !== void 0) {
824
+ pinned.reasoningEffort = config.reasoningEffort;
825
+ }
826
+ let d0;
827
+ try {
828
+ const def = ctx.get("agentDefaultModel");
829
+ const current = def !== void 0 && def !== null ? def.currentSelection() : void 0;
830
+ if (current !== void 0 && current !== null && typeof current.provider === "string" && typeof current.model === "string") {
831
+ d0 = { provider: current.provider, model: current.model };
139
832
  }
140
- ctx.on("system-prompt/assemble", async (assembly, _context, next) => {
141
- const assembled = await next();
142
- const agent = _context && _context.agent;
143
- if (pinned === undefined || isSubagent(agent))
144
- return assembled;
145
- const variables = assembled.variables ?? {};
146
- if (shouldPin(agent, { provider: variables.provider, model: variables.model })) {
147
- return {
148
- ...assembled,
149
- variables: {
150
- ...variables,
151
- provider: pinned.provider,
152
- model: pinned.model,
153
- },
154
- };
155
- }
156
- // 让路:保留入口(用户)选择注入的变量,persona 展示实际路由的模型。
157
- return assembled;
158
- }, { prepend: true });
159
- ctx.on("agent/request", async (_payload, next) => {
160
- const resolved = await next();
161
- const agent = _payload && _payload.agent;
162
- if (pinned === undefined || isSubagent(agent))
163
- return resolved;
164
- if (shouldPin(agent, { provider: resolved.provider, model: resolved.model })) {
165
- ctx.omdModeOverride = undefined;
166
- const stripped = { ...resolved };
167
- delete stripped.reasoningEffort;
168
- const out = {
169
- ...stripped,
170
- provider: pinned.provider,
171
- model: pinned.model,
172
- };
173
- if (pinned.reasoningEffort !== undefined) {
174
- out.reasoningEffort = pinned.reasoningEffort;
175
- }
176
- return out;
833
+ } catch {
834
+ }
835
+ function shouldPin(agent, entry) {
836
+ if (pinned === void 0)
837
+ return false;
838
+ if (entry === void 0 || entry.provider === void 0 || entry.model === void 0)
839
+ return true;
840
+ if (entry.provider === pinned.provider && entry.model === pinned.model)
841
+ return true;
842
+ const session = agent !== void 0 && agent !== null ? agent.session : void 0;
843
+ const logged = session === void 0 ? void 0 : session.requestHeader();
844
+ if (logged === void 0) {
845
+ if (d0 !== void 0 && entry.provider === d0.provider && entry.model === d0.model)
846
+ return true;
847
+ return false;
848
+ }
849
+ if (presetSwitchedAfterLastRequest(session) && logged.config !== void 0 && logged.config !== null && entry.provider === logged.config.provider && entry.model === logged.config.model) {
850
+ return true;
851
+ }
852
+ return false;
853
+ }
854
+ ctx.on("system-prompt/assemble", async (assembly, _context, next) => {
855
+ const assembled = await next();
856
+ const agent = _context && _context.agent;
857
+ if (pinned === void 0 || isSubagent(agent))
858
+ return assembled;
859
+ const variables = assembled.variables ?? {};
860
+ if (shouldPin(agent, { provider: variables.provider, model: variables.model })) {
861
+ return {
862
+ ...assembled,
863
+ variables: {
864
+ ...variables,
865
+ provider: pinned.provider,
866
+ model: pinned.model
177
867
  }
178
- // 用户显式选择了别的模型:本次任务顶层路由用用户选择;deep tier 同步(omd-task 读取)。
179
- ctx.omdModeOverride = { provider: resolved.provider, model: resolved.model };
180
- return resolved;
181
- }, { prepend: true });
868
+ };
869
+ }
870
+ return assembled;
871
+ }, { prepend: true });
872
+ ctx.on("agent/request", async (_payload, next) => {
873
+ const resolved = await next();
874
+ const agent = _payload && _payload.agent;
875
+ if (pinned === void 0 || isSubagent(agent))
876
+ return resolved;
877
+ if (shouldPin(agent, { provider: resolved.provider, model: resolved.model })) {
878
+ setModeOverride(agent, void 0);
879
+ const stripped = { ...resolved };
880
+ delete stripped.reasoningEffort;
881
+ const out = {
882
+ ...stripped,
883
+ provider: pinned.provider,
884
+ model: pinned.model
885
+ };
886
+ if (pinned.reasoningEffort !== void 0) {
887
+ out.reasoningEffort = pinned.reasoningEffort;
888
+ }
889
+ return out;
890
+ }
891
+ setModeOverride(agent, { provider: resolved.provider, model: resolved.model });
892
+ return resolved;
893
+ }, { prepend: true });
182
894
  }
183
- export { Config, apply, inject, name };
895
+ export {
896
+ Config,
897
+ apply,
898
+ inject,
899
+ name
900
+ };