dsh-provider-proxy 0.2.0 → 0.3.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 +119 -116
- package/lib/client.js +28 -5
- package/lib/client.js.map +2 -2
- package/lib/index.js +26 -11
- package/lib/index.js.map +2 -2
- package/package.json +88 -72
package/lib/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/fetch-router.ts", "../src/proxy-table.ts", "../src/config.ts", "../node_modules/@deepseek-ai/schemastery/lib/index.mjs", "../node_modules/@deepseek-ai/cosmokit/lib/index.js", "../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Provider-scoped fetch routing.\n *\n * DeepSeek Harness 0.2.0-rc.2 offers no supported seam for giving one LLM\n * provider its own transport:\n *\n * - `llm-deepseek` calls the unqualified global `fetch` with no `dispatcher`;\n * - `llm-pi-ai` delegates to the pi-ai SDK, whose HTTP layer DSH cannot\n * configure (its own source notes a fetch/dispatcher hook does not exist);\n * - `LlmCallControls` carries only reasoningEffort/temperature/maxTokens/stop;\n * - `llm/stream` intercepts already-decoded `StreamChunk`s, i.e. after HTTP;\n * - `ctx.web` serves `web_search`/`web_fetch` only, never provider traffic;\n * - the official `@deepseek-ai/dsh-http-proxy` is a library with a private\n * installer: one process-wide policy from env vars, no service, no Config.\n *\n * So the request is routed where the only available signal actually is: the\n * `llm/stream` waterfall, whose `options.provider` names the route. An\n * AsyncLocalStorage scope carries the chosen dispatcher over the stream, and a\n * thin `globalThis.fetch` wrapper applies it. Because every provider gets its\n * OWN dispatcher instance, one provider's proxy can never be picked up by\n * another provider's call \u2014 including two providers that resolve to the same\n * upstream host.\n *\n * IMPORTANT \u2014 one undici realm only. Node's built-in `fetch` uses an internal\n * undici and REJECTS a dispatcher built by the npm `undici` package with\n * `invalid onRequestStart method`, and vice versa. Every dispatcher here is\n * built from the npm `undici` that this module imports, so the wrapper must\n * dispatch through THAT same package's `fetch` rather than re-entering Node's.\n * The proxy therefore receives an absolute-form request line\n * (`GET http://host/path HTTP/1.1`), which is how an HTTP forward proxy is\n * addressed; an `https:` target is tunnelled with CONNECT.\n *\n * In-flight streams keep the dispatcher they started on; a configuration\n * change only affects new requests.\n */\n\nimport { AsyncLocalStorage } from 'node:async_hooks'\nimport { fetch as undiciFetch } from 'undici'\n\n/** Undici dispatcher, kept structurally typed so this file needs no undici types. */\nexport interface DispatcherLike {\n close(): Promise<void>\n}\n\nexport interface RouterStore {\n dispatcher: DispatcherLike\n}\n\n/** Shared across every plugin instance in one process, keyed so copies cooperate. */\nconst STATE_KEY = Symbol.for('dsh-provider-proxy.fetch-router.v1')\n\ninterface RouterState {\n owners: number\n storage: AsyncLocalStorage<RouterStore>\n originalFetch: typeof globalThis.fetch\n routedFetch: typeof globalThis.fetch\n descriptor?: PropertyDescriptor\n}\n\nfunction installSharedRouter(): RouterState {\n const current = (globalThis as Record<symbol, RouterState | undefined>)[STATE_KEY]\n if (current !== undefined) {\n current.owners += 1\n return current\n }\n\n if (typeof globalThis.fetch !== 'function') {\n throw new Error('dsh-provider-proxy: this Node runtime does not expose global fetch')\n }\n\n const storage = new AsyncLocalStorage<RouterStore>()\n const originalFetch = globalThis.fetch\n const descriptor = Object.getOwnPropertyDescriptor(globalThis, 'fetch')\n\n const routedFetch = function routedFetch(\n this: unknown,\n input: Parameters<typeof globalThis.fetch>[0],\n init?: Parameters<typeof globalThis.fetch>[1],\n ): ReturnType<typeof globalThis.fetch> {\n const active = storage.getStore()\n // No scope, or a caller that already picked a dispatcher: stay out of the way.\n if (active === undefined) return originalFetch.call(globalThis, input, init)\n if (init !== undefined && init !== null && (init as { dispatcher?: unknown }).dispatcher !== undefined) {\n return originalFetch.call(globalThis, input, init)\n }\n // Same undici realm as the dispatcher \u2014 Node's own fetch would reject it.\n // The init is passed through structurally: the DOM `RequestInit` and the\n // undici one disagree on `body`/`duplex`, so both are erased here.\n return undiciFetch(input as never, {\n ...(init as Record<string, unknown> | undefined),\n dispatcher: active.dispatcher as never,\n } as never) as never\n }\n\n Object.defineProperty(globalThis, 'fetch', {\n ...(descriptor ?? { configurable: true, enumerable: true, writable: true }),\n value: routedFetch,\n })\n\n const state: RouterState = { owners: 1, storage, originalFetch, routedFetch, descriptor }\n Object.defineProperty(globalThis, STATE_KEY, {\n configurable: true,\n value: state,\n })\n return state\n}\n\n/**\n * Re-apply the AsyncLocalStorage scope to every iterator operation.\n *\n * This is essential, not cosmetic: an adapter's stream is consumed lazily, so\n * the HTTP call typically happens inside a later `next()`, long after\n * `als.run(...)` returned. Without wrapping the iterator, every request would\n * silently fall back to the default dispatcher.\n */\nfunction contextualIterable(\n storage: AsyncLocalStorage<RouterStore>,\n store: RouterStore,\n factory: () => AsyncIterable<unknown>,\n): AsyncIterable<unknown> {\n return {\n [Symbol.asyncIterator]() {\n let iterator: AsyncIterator<unknown> | undefined\n\n const ensureIterator = (): AsyncIterator<unknown> => {\n if (iterator !== undefined) return iterator\n const iterable = factory()\n if (iterable === null || typeof iterable?.[Symbol.asyncIterator] !== 'function') {\n throw new TypeError('dsh-provider-proxy: llm/stream next() did not return an AsyncIterable')\n }\n iterator = iterable[Symbol.asyncIterator]()\n return iterator\n }\n\n const invoke = (method: 'next' | 'return' | 'throw', value?: unknown): Promise<IteratorResult<unknown>> =>\n storage.run(store, () => {\n // A stream abandoned before its first next() must not touch the adapter.\n if (method === 'return' && iterator === undefined) return Promise.resolve({ done: true, value })\n if (method === 'throw' && iterator === undefined) return Promise.reject(value)\n const target = ensureIterator()\n const operation = target[method]\n if (typeof operation !== 'function') {\n if (method === 'return') return Promise.resolve({ done: true, value })\n return Promise.reject(value)\n }\n return Promise.resolve(Reflect.apply(operation, target, method === 'next' ? [] : [value]))\n })\n\n return {\n next: (value?: unknown) => invoke('next', value),\n return: (value?: unknown) => invoke('return', value),\n throw: (value?: unknown) => invoke('throw', value),\n [Symbol.asyncIterator]() {\n return this\n },\n }\n },\n }\n}\n\nexport interface FetchRouter {\n /** Run one synchronous callback inside the provider's scope. */\n run(dispatcher: DispatcherLike, callback: () => unknown): unknown\n /** Wrap a lazy stream so every consumption step keeps the scope. */\n wrap(dispatcher: DispatcherLike, factory: () => AsyncIterable<unknown>): AsyncIterable<unknown>\n /** Release this holder; the shim is removed once the last holder releases. */\n release(): void\n}\n\n/** Install (or share) the single process-wide fetch shim. */\nexport function acquireFetchRouter(): FetchRouter {\n const state = installSharedRouter()\n let released = false\n\n return {\n run(dispatcher, callback) {\n return state.storage.run({ dispatcher }, callback)\n },\n wrap(dispatcher, factory) {\n return contextualIterable(state.storage, { dispatcher }, factory)\n },\n release() {\n if (released) return\n released = true\n state.owners -= 1\n if (state.owners !== 0) return\n\n if (globalThis.fetch === state.routedFetch) {\n if (state.descriptor === undefined) delete (globalThis as { fetch?: unknown }).fetch\n else Object.defineProperty(globalThis, 'fetch', state.descriptor)\n }\n delete (globalThis as Record<symbol, unknown>)[STATE_KEY]\n state.storage.disable()\n },\n }\n}", "/**\n * The proxy table: one dispatcher per enabled provider.\n *\n * A dispatcher is created per provider rather than shared, so a proxied\n * provider can never leak its transport into another provider's call even when\n * both resolve to the same upstream host.\n */\n\nimport { ProxyAgent } from 'undici'\n\nimport { normalizeRoute, type ProviderProxyRouteValue } from './config.js'\nimport type { DispatcherLike } from './fetch-router.js'\n\nexport interface RouteEntry {\n provider: string\n /** Normalized proxy origin, for diagnostics only. Never logged with credentials. */\n proxyOrigin: string\n dispatcher: DispatcherLike\n}\n\nfunction proxyUrl(route: ProviderProxyRouteValue): string {\n const auth =\n route.username.length === 0\n ? ''\n : `${encodeURIComponent(route.username).replace(/%3A/gi, ':')}@`\n // IPv6 literals need brackets in a URL authority.\n const host = route.host.includes(':') && !route.host.startsWith('[') ? `[${route.host}]` : route.host\n return `${route.protocol}://${auth}${host}:${route.port}`\n}\n\n/**\n * Build the dispatchers for every enabled, valid route.\n *\n * Invalid routes are skipped rather than thrown: one mistyped provider must not\n * stop the others from proxying. The caller surfaces the reason through\n * `problems`, which the Client shows instead of failing the whole table.\n */\nexport async function createProxyTable(\n config: { readonly [provider: string]: Partial<ProviderProxyRouteValue> } | undefined,\n options: { resolvePassword?: (provider: string, ref: string) => string | undefined } = {},\n): Promise<{ entries: Map<string, RouteEntry>; problems: Map<string, string> }> {\n const entries = new Map<string, RouteEntry>()\n const problems = new Map<string, string>()\n\n for (const [provider, raw] of Object.entries(config ?? {})) {\n let route: ProviderProxyRouteValue\n try {\n route = normalizeRoute(provider, raw)\n } catch (error) {\n problems.set(provider, error instanceof Error ? error.message : String(error))\n continue\n }\n if (!route.enabled) continue\n\n if (route.protocol === 'socks5') {\n // undici's ProxyAgent speaks HTTP CONNECT to an HTTP proxy only; a SOCKS5\n // endpoint needs a custom connector. Reported, never silently mis-routed.\n problems.set(provider, 'dsh-provider-proxy: socks5 \u6682\u672A\u5B9E\u73B0\uFF0C\u8BF7\u6539\u7528 http \u6216 https')\n continue\n }\n\n const password = options.resolvePassword?.(provider, route.passwordRef)\n void password // Reserved: credentials are injected as a header, never in the URL.\n\n const url = proxyUrl(route)\n let dispatcher: DispatcherLike\n try {\n dispatcher = new ProxyAgent({ uri: url }) as unknown as DispatcherLike\n } catch (error) {\n problems.set(provider, error instanceof Error ? error.message : String(error))\n continue\n }\n entries.set(provider, { provider, proxyOrigin: new URL(url).origin, dispatcher })\n }\n\n return { entries, problems }\n}\n\n/** Close every dispatcher, ignoring individual failures. */\nexport async function closeTable(entries: Map<string, RouteEntry>): Promise<void> {\n const closing = [...entries.values()].map(entry => entry.dispatcher.close().catch(() => undefined))\n await Promise.allSettled(closing)\n entries.clear()\n}\n\nexport { proxyUrl }", "/**\n * Plugin Config.\n *\n * Shape notes, all verified against DeepSeek Harness 0.2.0-rc.2:\n *\n * - `schemastery` is NOT guaranteed to be resolvable from a profile-hoisted\n * install, so the real package is preferred at runtime when `createRequire`\n * can see it and a bundled fallback is used otherwise. The reference plugin\n * `dsh-llm-retry-settings` does exactly this.\n * - Every editable field is `.volatile()` so a settings write is committed\n * into the running fiber WITHOUT remounting the plugin; the Host then\n * rebuilds its proxy table. Ordinary (non-volatile) fields would restart the\n * plugin instead, which is not what a settings page wants.\n * - The proxy password never lives in this Config. `passwordRef` is only the\n * NAME of a credential held by the credentials service; the secret itself is\n * written through `ctx.remote.credentials.set`, the same way the Models page\n * stores provider API keys. A `role('secret')` field would keep the value out\n * of settings responses but would still write it into cordis.patch.yml.\n */\n\nimport { createRequire } from 'node:module'\n\n// Imported statically so the bundler inlines it, making the package\n// self-contained. `loadSchemastery` below still PREFERS the profile's own copy\n// when one is reachable, so a DSH-provided instance stays authoritative; this\n// bundled copy is only the fallback that lets the plugin load at all.\nimport * as BundledSchema from '@deepseek-ai/schemastery'\n\ntype SchemaLike = {\n object: (...args: any[]) => any\n string: (...args: any[]) => any\n boolean: (...args: any[]) => any\n number: (...args: any[]) => any\n dict: (...args: any[]) => any\n union: (...args: any[]) => any\n}\n\n/**\n * Resolve the schemastery module for this fiber.\n *\n * A profile installation hoists dependencies next to the profile rather than\n * under this package, so a bare `import` can fail even when the Host itself\n * uses schemastery. `createRequire` resolves against this file's real\n * location, which is the best available view of the installation tree.\n *\n * When that finds nothing \u2014 a plain `npm install` of this package, which pulls\n * no schemastery \u2014 the BUNDLED copy is used, so the plugin still loads instead\n * of throwing at require time.\n */\nfunction loadSchemastery(): SchemaLike {\n try {\n const require = createRequire(import.meta.url)\n const candidate = require('@deepseek-ai/schemastery')\n const live = (candidate as { default?: SchemaLike })?.default ?? (candidate as SchemaLike)\n if (live && typeof live.object === 'function') return live\n } catch {\n // Fall through to the bundled copy below.\n }\n // The static import is only a fallback; what it actually exposes is decided at\n // runtime, which this structural type deliberately does not pin.\n const bundled = (BundledSchema as { default?: unknown }).default ?? BundledSchema\n if (typeof (bundled as SchemaLike).object === 'function') return bundled as SchemaLike\n throw new Error('dsh-provider-proxy: no usable @deepseek-ai/schemastery in this installation')\n}\n\nconst z = loadSchemastery()\n\n/** Apply `.volatile()` when the resolved schemastery supports it. */\nfunction vol<T>(field: T): T {\n const volatile = (field as { volatile?: () => unknown }).volatile\n return typeof volatile === 'function' ? (volatile.call(field) as T) : field\n}\n\n/** Forward-compatible passthrough for schemastery extensions used below. */\nfunction stepMin<T extends { step?: (n: number) => T; min?: (n: number) => T }>(field: T, step?: number): T {\n let out = field\n if (step !== undefined && typeof out.step === 'function') out = out.step(step)\n return out\n}\n\n/** Supported forward-proxy transports. */\nexport const PROTOCOLS = ['http', 'https', 'socks5'] as const\nexport type Protocol = (typeof PROTOCOLS)[number]\n\n/**\n * One provider's proxy settings. Keyed by provider route id.\n *\n * `port` is deliberately NOT constrained by schemastery's min/max: an unset\n * proxy is `0` (meaning \"no port chosen yet\"), and a bound of 1 here would make\n * that default fail to parse. The real range check lives in `normalizeRoute`,\n * which runs only when a route is actually enabled, so the error can name the\n * provider instead of surfacing a bare schema path.\n */\nexport const ProviderProxyRoute = z.object({\n /** Whether this provider's calls are routed through the proxy below. */\n enabled: z.boolean().default(false),\n /** Proxy transport. `socks5` is accepted but only honoured when the socks helper loaded. */\n protocol: z.union(PROTOCOLS).default('http'),\n /** Proxy host or IP, without scheme, port, or path. */\n host: z.string().default(''),\n /** Proxy port. 0 means \"not configured\"; enabled routes require 1-65535. */\n port: z.number().default(0),\n /** Optional proxy username. */\n username: z.string().default(''),\n /** NAME of the credentials-service record holding the proxy password. Never the password. */\n passwordRef: z.string().default(''),\n})\n\nexport const Config = z.object({\n /** Per-provider proxy routes, keyed by provider route id (e.g. `sensenova`). */\n providers: vol(z.dict(ProviderProxyRoute).default({})),\n})\n\nexport interface ProviderProxyRouteValue {\n enabled: boolean\n protocol: Protocol\n host: string\n port: number\n username: string\n passwordRef: string\n}\n\nexport interface ConfigShape {\n providers: { readonly [provider: string]: ProviderProxyRouteValue }\n}\n\n/**\n * Validate one route and return the normalized value, or throw with a\n * field-scoped message. Used by both the Host (before opening a dispatcher)\n * and the settings form (before writing), so an invalid value never reaches\n * disk or the network.\n */\nexport function normalizeRoute(\n provider: string,\n raw: Partial<ProviderProxyRouteValue> | undefined,\n): ProviderProxyRouteValue {\n const route = ProviderProxyRoute(raw ?? {})\n const value = typeof (route as { get?: () => unknown }).get === 'function'\n ? (route as unknown as { get: () => ProviderProxyRouteValue }).get()\n : (route as ProviderProxyRouteValue)\n\n if (!value.enabled) return { ...value, port: value.port || 0 }\n\n const host = value.host.trim()\n if (host.length === 0) {\n throw new TypeError(`dsh-provider-proxy: provider \"${provider}\" \u542F\u7528\u4E86\u4EE3\u7406\uFF0C\u4F46\u672A\u586B\u5199\u4EE3\u7406\u5730\u5740`)\n }\n if (/^[a-z][a-z0-9+.-]*:\\/\\//i.test(host) || host.includes('/')) {\n throw new TypeError(`dsh-provider-proxy: provider \"${provider}\" \u7684\u4EE3\u7406\u5730\u5740\u53EA\u586B\u4E3B\u673A\u540D\u6216 IP\uFF0C\u4E0D\u8981\u5E26\u534F\u8BAE\u524D\u7F00\u6216\u8DEF\u5F84`)\n }\n if (!Number.isInteger(value.port) || value.port < 1 || value.port > 65535) {\n throw new TypeError(\n `dsh-provider-proxy: provider \"${provider}\" \u7684\u4EE3\u7406\u7AEF\u53E3\u65E0\u6548\uFF08\u9700\u4E3A 1-65535 \u7684\u6574\u6570\uFF09`,\n )\n }\n return { ...value, host, username: value.username.trim() }\n}", "import { Binary, clone, createVolatile, deepEqual, filterKeys, isNullable, isPlainObject, isVolatile, pick, valueMap } from \"@deepseek-ai/cosmokit\";\n//#region lib/types/index.js\nconst kSchema = Symbol.for(\"schemastery\");\nconst kValidationError = Symbol.for(\"ValidationError\");\nglobalThis.__schemastery_index__ ??= 0;\nglobalThis.__schemastery_refs__ = void 0;\nvar ValidationError = class extends TypeError {\n\toptions;\n\tname = \"ValidationError\";\n\tconstructor(message, options) {\n\t\tlet prefix = \"$\";\n\t\tfor (const segment of options.path || []) if (typeof segment === \"string\") prefix += \".\" + segment;\n\t\telse if (typeof segment === \"number\") prefix += \"[\" + segment + \"]\";\n\t\telse if (typeof segment === \"symbol\") prefix += `[Symbol(${segment.toString()})]`;\n\t\tif (prefix.startsWith(\".\")) prefix = prefix.slice(1);\n\t\tsuper((prefix === \"$\" ? \"\" : `${prefix} `) + message);\n\t\tthis.options = options;\n\t}\n\tstatic is(error) {\n\t\treturn !!error?.[kValidationError];\n\t}\n};\nObject.defineProperty(ValidationError.prototype, kValidationError, { value: true });\nconst Schema = function(options) {\n\tconst schema = function(data, options = {}) {\n\t\treturn Schema.resolve(data, schema, options)[0];\n\t};\n\tif (options.refs) {\n\t\tconst refs = valueMap(options.refs, (options) => new Schema(options));\n\t\tconst getRef = (uid) => refs[uid];\n\t\tfor (const key in refs) {\n\t\t\tconst options = refs[key];\n\t\t\toptions.sKey = getRef(options.sKey);\n\t\t\toptions.inner = getRef(options.inner);\n\t\t\toptions.list = options.list && options.list.map(getRef);\n\t\t\toptions.dict = options.dict && valueMap(options.dict, getRef);\n\t\t}\n\t\treturn refs[options.uid];\n\t}\n\tObject.assign(schema, options);\n\tif (typeof schema.callback === \"string\") try {\n\t\tschema.callback = new Function(\"return \" + schema.callback)();\n\t} catch {}\n\tObject.defineProperty(schema, \"uid\", { value: globalThis.__schemastery_index__++ });\n\tObject.setPrototypeOf(schema, Schema.prototype);\n\tschema.meta ||= {};\n\tschema.toString = schema.toString.bind(schema);\n\treturn schema;\n};\nSchema.prototype = Object.create(Function.prototype);\nSchema.prototype[kSchema] = true;\nObject.defineProperty(Schema.prototype, \"~standard\", { get() {\n\treturn {\n\t\tversion: 1,\n\t\tvendor: \"schemastery\",\n\t\tvalidate: (value) => {\n\t\t\ttry {\n\t\t\t\treturn { value: Schema.resolve(value, this, {})[0] };\n\t\t\t} catch (error) {\n\t\t\t\tif (ValidationError.is(error)) return { issues: [{\n\t\t\t\t\tmessage: error.message,\n\t\t\t\t\tpath: error.options.path\n\t\t\t\t}] };\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t};\n} });\nSchema.ValidationError = ValidationError;\nSchema.prototype.toJSON = function toJSON() {\n\tif (globalThis.__schemastery_refs__) {\n\t\tglobalThis.__schemastery_refs__[this.uid] ??= JSON.parse(JSON.stringify({ ...this }));\n\t\treturn this.uid;\n\t}\n\tglobalThis.__schemastery_refs__ = { [this.uid]: { ...this } };\n\tglobalThis.__schemastery_refs__[this.uid] = JSON.parse(JSON.stringify({ ...this }));\n\tconst result = {\n\t\tuid: this.uid,\n\t\trefs: globalThis.__schemastery_refs__\n\t};\n\tglobalThis.__schemastery_refs__ = void 0;\n\treturn result;\n};\nSchema.prototype.set = function set(key, value) {\n\tthis.dict[key] = value;\n\treturn this;\n};\nSchema.prototype.push = function push(value) {\n\tthis.list.push(value);\n\treturn this;\n};\nfunction mergeDesc(original, messages) {\n\tconst result = typeof original === \"string\" ? { \"\": original } : { ...original };\n\tfor (const locale in messages) {\n\t\tconst value = messages[locale];\n\t\tif (value?.$description || value?.$desc) result[locale] = value.$description || value.$desc;\n\t\telse if (typeof value === \"string\") result[locale] = value;\n\t}\n\treturn result;\n}\nfunction getInner(value) {\n\treturn value?.$value ?? value?.$inner;\n}\nfunction extractKeys(data) {\n\treturn filterKeys(data ?? {}, (key) => !key.startsWith(\"$\"));\n}\nSchema.prototype.i18n = function i18n(messages) {\n\tconst schema = Schema(this);\n\tconst desc = mergeDesc(schema.meta.description, messages);\n\tif (Object.keys(desc).length) schema.meta.description = desc;\n\tif (schema.dict) schema.dict = valueMap(schema.dict, (inner, key) => {\n\t\treturn inner.i18n(valueMap(messages, (data) => getInner(data)?.[key] ?? data?.[key]));\n\t});\n\tif (schema.list) schema.list = schema.list.map((inner, index) => {\n\t\treturn inner.i18n(valueMap(messages, (data = {}) => {\n\t\t\tif (Array.isArray(getInner(data))) return getInner(data)[index];\n\t\t\tif (Array.isArray(data)) return data[index];\n\t\t\treturn extractKeys(data);\n\t\t}));\n\t});\n\tif (schema.inner) schema.inner = schema.inner.i18n(valueMap(messages, (data) => {\n\t\tif (getInner(data)) return getInner(data);\n\t\treturn extractKeys(data);\n\t}));\n\tif (schema.sKey) schema.sKey = schema.sKey.i18n(valueMap(messages, (data) => data?.$key));\n\treturn schema;\n};\nSchema.prototype.extra = function extra(key, value) {\n\tconst schema = Schema(this);\n\tschema.meta = {\n\t\t...schema.meta,\n\t\t[key]: value\n\t};\n\treturn schema;\n};\nfor (const key of [\n\t\"required\",\n\t\"disabled\",\n\t\"collapse\",\n\t\"hidden\",\n\t\"loose\"\n]) Object.assign(Schema.prototype, { [key](value = true) {\n\tconst schema = Schema(this);\n\tschema.meta = {\n\t\t...schema.meta,\n\t\t[key]: value\n\t};\n\treturn schema;\n} });\nSchema.prototype.deprecated = function deprecated() {\n\tconst schema = Schema(this);\n\tschema.meta.badges ||= [];\n\tschema.meta.badges.push({\n\t\ttext: \"deprecated\",\n\t\ttype: \"danger\"\n\t});\n\treturn schema;\n};\nSchema.prototype.experimental = function experimental() {\n\tconst schema = Schema(this);\n\tschema.meta.badges ||= [];\n\tschema.meta.badges.push({\n\t\ttext: \"experimental\",\n\t\ttype: \"warning\"\n\t});\n\treturn schema;\n};\nSchema.prototype.pattern = function pattern(regexp) {\n\tconst schema = Schema(this);\n\tconst pattern = pick(regexp, [\"source\", \"flags\"]);\n\tschema.meta = {\n\t\t...schema.meta,\n\t\tpattern\n\t};\n\treturn schema;\n};\nSchema.prototype.simplify = function simplify(value) {\n\tif (isVolatile(value)) value = value.get();\n\tif (deepEqual(value, this.meta.default, this.type === \"dict\")) return null;\n\tif (isNullable(value)) return value;\n\tif (this.type === \"object\" || this.type === \"dict\") {\n\t\tconst result = {};\n\t\tfor (const key in value) {\n\t\t\tconst item = (this.type === \"object\" ? this.dict[key] : this.inner)?.simplify(value[key]);\n\t\t\tif (this.type === \"dict\" || !isNullable(item)) result[key] = item;\n\t\t}\n\t\tif (deepEqual(result, this.meta.default, this.type === \"dict\")) return null;\n\t\treturn result;\n\t} else if (this.type === \"array\" || this.type === \"tuple\") {\n\t\tconst result = [];\n\t\tvalue.forEach((value, index) => {\n\t\t\tconst schema = this.type === \"array\" ? this.inner : this.list[index];\n\t\t\tconst item = schema ? schema.simplify(value) : value;\n\t\t\tresult.push(item);\n\t\t});\n\t\treturn result;\n\t} else if (this.type === \"intersect\") {\n\t\tconst result = {};\n\t\tfor (const item of this.list) Object.assign(result, item.simplify(value));\n\t\treturn result;\n\t} else if (this.type === \"union\") for (const schema of this.list) try {\n\t\tSchema.resolve(value, schema, {});\n\t\treturn schema.simplify(value);\n\t} catch {}\n\treturn value;\n};\nSchema.prototype.toString = function toString(inline) {\n\treturn formatters[this.type]?.(this, inline) ?? `Schema<${this.type}>`;\n};\nSchema.prototype.role = function role(role, extra) {\n\tconst schema = Schema(this);\n\tschema.meta = {\n\t\t...schema.meta,\n\t\trole,\n\t\textra\n\t};\n\treturn schema;\n};\nfor (const key of [\n\t\"default\",\n\t\"link\",\n\t\"comment\",\n\t\"description\",\n\t\"max\",\n\t\"min\",\n\t\"step\"\n]) Object.assign(Schema.prototype, { [key](value) {\n\tconst schema = Schema(this);\n\tschema.meta = {\n\t\t...schema.meta,\n\t\t[key]: value\n\t};\n\treturn schema;\n} });\nSchema.prototype.volatile = function volatile() {\n\tif (this.meta.volatile) throw new TypeError(\"volatile schema is already wrapped\");\n\treturn this.extra(\"volatile\", true);\n};\nconst resolvers = {};\nconst checkedVolatile = Symbol(\"checked-volatile-schema\");\nfunction validateVolatileSchema(schema, path = [], blocked = false, seen = /* @__PURE__ */ new Map()) {\n\tconst states = seen.get(schema) ?? /* @__PURE__ */ new Set();\n\tif (states.has(blocked)) return;\n\tstates.add(blocked);\n\tseen.set(schema, states);\n\tif (schema.meta?.volatile && blocked) throw new ValidationError(\"volatile fields require a fixed object path without an enclosing volatile field\", { path });\n\tconst nested = blocked || !!schema.meta?.volatile;\n\tif (schema.dict) for (const [key, child] of Object.entries(schema.dict)) validateVolatileSchema(child, [...path, key], nested, seen);\n\tif (schema.sKey) validateVolatileSchema(schema.sKey, [...path, \"<key>\"], true, seen);\n\tif (schema.inner && (schema.type !== \"lazy\" || schema.inner[kSchema])) validateVolatileSchema(schema.inner, [...path, \"*\"], true, seen);\n\tif (schema.list) for (let index = 0; index < schema.list.length; index++) validateVolatileSchema(schema.list[index], [...path, String(index)], true, seen);\n}\nSchema.extend = function extend(type, resolve) {\n\tresolvers[type] = resolve;\n};\nSchema.resolve = function resolve(data, schema, options = {}, strict = false) {\n\tif (!schema) return [data];\n\tif (!options[checkedVolatile]) {\n\t\tvalidateVolatileSchema(schema, options.path);\n\t\toptions = {\n\t\t\t...options,\n\t\t\t[checkedVolatile]: true\n\t\t};\n\t}\n\tif (schema.meta?.volatile) {\n\t\tconst inner = Schema(schema);\n\t\tinner.meta = {\n\t\t\t...schema.meta,\n\t\t\tvolatile: false\n\t\t};\n\t\tconst [value, adapted] = Schema.resolve(data, inner, options, strict);\n\t\ttry {\n\t\t\treturn [createVolatile(value), adapted];\n\t\t} catch (error) {\n\t\t\tthrow new ValidationError(error instanceof Error ? error.message : String(error), options);\n\t\t}\n\t}\n\tif (options.ignore?.(data, schema)) return [data];\n\tif (isNullable(data) && schema.type !== \"lazy\") {\n\t\tif (schema.meta.required) throw new ValidationError(`missing required value`, options);\n\t\tlet current = schema;\n\t\tlet fallback = schema.meta.default;\n\t\twhile (current?.type === \"intersect\" && isNullable(fallback)) {\n\t\t\tcurrent = current.list[0];\n\t\t\tfallback = current?.meta.default;\n\t\t}\n\t\tif (isNullable(fallback)) return [data];\n\t\tdata = clone(fallback);\n\t}\n\tconst callback = resolvers[schema.type];\n\tif (!callback) throw new ValidationError(`unsupported type \"${schema.type}\"`, options);\n\ttry {\n\t\treturn callback(data, schema, options, strict);\n\t} catch (error) {\n\t\tif (!schema.meta.loose) throw error;\n\t\treturn [schema.meta.default];\n\t}\n};\nSchema.from = function from(source) {\n\tif (isNullable(source)) return Schema.any();\n\telse if ([\n\t\t\"string\",\n\t\t\"number\",\n\t\t\"boolean\"\n\t].includes(typeof source)) return Schema.const(source).required();\n\telse if (source[kSchema]) return source;\n\telse if (typeof source === \"function\") switch (source) {\n\t\tcase String: return Schema.string().required();\n\t\tcase Number: return Schema.number().required();\n\t\tcase Boolean: return Schema.boolean().required();\n\t\tcase Function: return Schema.function().required();\n\t\tdefault: return Schema.is(source).required();\n\t}\n\telse throw new TypeError(`cannot infer schema from ${source}`);\n};\nSchema.lazy = function lazy(builder) {\n\tconst toJSON = () => {\n\t\tif (!schema.inner[kSchema]) {\n\t\t\tschema.inner = schema.builder();\n\t\t\tschema.inner.meta = {\n\t\t\t\t...schema.meta,\n\t\t\t\t...schema.inner.meta\n\t\t\t};\n\t\t}\n\t\treturn schema.inner.toJSON();\n\t};\n\tconst schema = new Schema({\n\t\ttype: \"lazy\",\n\t\tbuilder,\n\t\tinner: { toJSON }\n\t});\n\treturn schema;\n};\nSchema.natural = function natural() {\n\treturn Schema.number().step(1).min(0);\n};\nSchema.percent = function percent() {\n\treturn Schema.number().step(.01).min(0).max(1).role(\"slider\");\n};\nSchema.date = function date() {\n\treturn Schema.union([Schema.is(Date), Schema.transform(Schema.string().role(\"datetime\"), (value, options) => {\n\t\tconst date = new Date(value);\n\t\tif (isNaN(+date)) throw new ValidationError(`invalid date \"${value}\"`, options);\n\t\treturn date;\n\t}, true)]);\n};\nSchema.regExp = function regExp(flag = \"\") {\n\treturn Schema.union([Schema.is(RegExp), Schema.transform(Schema.string().role(\"regexp\", { flag }), (value, options) => {\n\t\ttry {\n\t\t\treturn new RegExp(value, flag);\n\t\t} catch (e) {\n\t\t\tthrow new ValidationError(e.message, options);\n\t\t}\n\t}, true)]);\n};\nSchema.arrayBuffer = function arrayBuffer(encoding) {\n\treturn Schema.union([\n\t\tSchema.is(ArrayBuffer),\n\t\tSchema.is(SharedArrayBuffer),\n\t\tSchema.transform(Schema.any(), (value, options) => {\n\t\t\tif (Binary.isSource(value)) return Binary.fromSource(value);\n\t\t\tthrow new ValidationError(`expected ArrayBufferSource but got ${value}`, options);\n\t\t}, true),\n\t\t...encoding ? [Schema.transform(Schema.string(), (value, options) => {\n\t\t\ttry {\n\t\t\t\treturn encoding === \"base64\" ? Binary.fromBase64(value) : Binary.fromHex(value);\n\t\t\t} catch (e) {\n\t\t\t\tthrow new ValidationError(e.message, options);\n\t\t\t}\n\t\t}, true)] : []\n\t]);\n};\nSchema.extend(\"lazy\", (data, schema, options, strict) => {\n\tif (!schema.inner[kSchema]) {\n\t\tschema.inner = schema.builder();\n\t\tschema.inner.meta = {\n\t\t\t...schema.meta,\n\t\t\t...schema.inner.meta\n\t\t};\n\t\tvalidateVolatileSchema(schema.inner, options.path, true);\n\t}\n\treturn Schema.resolve(data, schema.inner, options, strict);\n});\nSchema.extend(\"any\", (data) => {\n\treturn [data];\n});\nSchema.extend(\"never\", (data, _, options) => {\n\tthrow new ValidationError(`expected nullable but got ${data}`, options);\n});\nSchema.extend(\"const\", (data, { value }, options) => {\n\tif (deepEqual(data, value)) return [value];\n\tthrow new ValidationError(`expected ${value} but got ${data}`, options);\n});\nfunction checkWithinRange(data, meta, description, options, skipMin = false) {\n\tconst { max = Infinity, min = -Infinity } = meta;\n\tif (data > max) throw new ValidationError(`expected ${description} <= ${max} but got ${data}`, options);\n\tif (data < min && !skipMin) throw new ValidationError(`expected ${description} >= ${min} but got ${data}`, options);\n}\nSchema.extend(\"string\", (data, { meta }, options) => {\n\tif (typeof data !== \"string\") throw new ValidationError(`expected string but got ${data}`, options);\n\tif (meta.pattern) {\n\t\tconst regexp = new RegExp(meta.pattern.source, meta.pattern.flags);\n\t\tif (!regexp.test(data)) throw new ValidationError(`expect string to match regexp ${regexp}`, options);\n\t}\n\tcheckWithinRange(data.length, meta, \"string length\", options);\n\treturn [data];\n});\nfunction decimalShift(data, digits) {\n\tconst str = data.toString();\n\tif (str.includes(\"e\")) return data * Math.pow(10, digits);\n\tconst index = str.indexOf(\".\");\n\tif (index === -1) return data * Math.pow(10, digits);\n\tconst frac = str.slice(index + 1);\n\tconst integer = str.slice(0, index);\n\tif (frac.length <= digits) return +(integer + frac.padEnd(digits, \"0\"));\n\treturn +(integer + frac.slice(0, digits) + \".\" + frac.slice(digits));\n}\nfunction isMultipleOf(data, min, step) {\n\tstep = Math.abs(step);\n\tif (!/^\\d+\\.\\d+$/.test(step.toString())) return (data - min) % step === 0;\n\tconst index = step.toString().indexOf(\".\");\n\tconst digits = step.toString().slice(index + 1).length;\n\treturn Math.abs(decimalShift(data, digits) - decimalShift(min, digits)) % decimalShift(step, digits) === 0;\n}\nSchema.extend(\"number\", (data, { meta }, options) => {\n\tif (typeof data !== \"number\") throw new ValidationError(`expected number but got ${data}`, options);\n\tcheckWithinRange(data, meta, \"number\", options);\n\tconst { step } = meta;\n\tif (step && !isMultipleOf(data, meta.min ?? 0, step)) throw new ValidationError(`expected number multiple of ${step} but got ${data}`, options);\n\treturn [data];\n});\nSchema.extend(\"boolean\", (data, _, options) => {\n\tif (typeof data === \"boolean\") return [data];\n\tthrow new ValidationError(`expected boolean but got ${data}`, options);\n});\nSchema.extend(\"bitset\", (data, { bits, meta }, options) => {\n\tlet value = 0, keys = [];\n\tif (typeof data === \"number\") {\n\t\tvalue = data;\n\t\tfor (const key in bits) if (data & bits[key]) keys.push(key);\n\t} else if (Array.isArray(data)) {\n\t\tkeys = data;\n\t\tfor (const key of keys) {\n\t\t\tif (typeof key !== \"string\") throw new ValidationError(`expected string but got ${key}`, options);\n\t\t\tif (key in bits) value |= bits[key];\n\t\t}\n\t} else throw new ValidationError(`expected number or array but got ${data}`, options);\n\tif (value === meta.default) return [value];\n\treturn [value, keys];\n});\nSchema.extend(\"function\", (data, _, options) => {\n\tif (typeof data === \"function\") return [data];\n\tthrow new ValidationError(`expected function but got ${data}`, options);\n});\nSchema.extend(\"is\", (data, { constructor }, options) => {\n\tif (typeof constructor === \"function\") {\n\t\tif (data instanceof constructor) return [data];\n\t\tthrow new ValidationError(`expected ${constructor.name} but got ${data}`, options);\n\t} else {\n\t\tif (isNullable(data)) throw new ValidationError(`expected ${constructor} but got ${data}`, options);\n\t\tlet prototype = Object.getPrototypeOf(data);\n\t\twhile (prototype) {\n\t\t\tif (prototype.constructor?.name === constructor) return [data];\n\t\t\tprototype = Object.getPrototypeOf(prototype);\n\t\t}\n\t\tthrow new ValidationError(`expected ${constructor} but got ${data}`, options);\n\t}\n});\nfunction property(data, key, schema, options) {\n\ttry {\n\t\tconst [value, adapted] = Schema.resolve(data[key], schema, {\n\t\t\t...options,\n\t\t\tpath: [...options.path || [], key]\n\t\t});\n\t\tif (adapted !== void 0) data[key] = adapted;\n\t\treturn value;\n\t} catch (e) {\n\t\tif (!options?.autofix) throw e;\n\t\tdelete data[key];\n\t\treturn schema.meta.volatile ? createVolatile(schema.meta.default) : schema.meta.default;\n\t}\n}\nSchema.extend(\"array\", (data, { inner, meta }, options) => {\n\tif (!Array.isArray(data)) throw new ValidationError(`expected array but got ${data}`, options);\n\tcheckWithinRange(data.length, meta, \"array length\", options, !isNullable(inner.meta.default));\n\treturn [data.map((_, index) => property(data, index, inner, options))];\n});\nSchema.extend(\"dict\", (data, { inner, sKey }, options, strict) => {\n\tif (!isPlainObject(data)) throw new ValidationError(`expected object but got ${data}`, options);\n\tconst result = {};\n\tfor (const key in data) {\n\t\tlet rKey;\n\t\ttry {\n\t\t\trKey = Schema.resolve(key, sKey, options)[0];\n\t\t} catch (error) {\n\t\t\tif (strict) continue;\n\t\t\tthrow error;\n\t\t}\n\t\tresult[rKey] = property(data, key, inner, options);\n\t\tdata[rKey] = data[key];\n\t\tif (key !== rKey) delete data[key];\n\t}\n\treturn [result];\n});\nSchema.extend(\"tuple\", (data, { list }, options, strict) => {\n\tif (!Array.isArray(data)) throw new ValidationError(`expected array but got ${data}`, options);\n\tconst result = list.map((inner, index) => property(data, index, inner, options));\n\tif (strict) return [result];\n\tresult.push(...data.slice(list.length));\n\treturn [result];\n});\nfunction merge(result, data) {\n\tfor (const key in data) {\n\t\tif (key in result) continue;\n\t\tresult[key] = data[key];\n\t}\n}\nSchema.extend(\"object\", (data, { dict }, options, strict) => {\n\tif (!isPlainObject(data)) throw new ValidationError(`expected object but got ${data}`, options);\n\tconst result = {};\n\tfor (const key in dict) {\n\t\tconst value = property(data, key, dict[key], options);\n\t\tif (!isNullable(value) || key in data) result[key] = value;\n\t}\n\tif (!strict) merge(result, data);\n\treturn [result];\n});\nSchema.extend(\"union\", (data, { list, toString }, options, strict) => {\n\tconst messages = [];\n\tfor (const inner of list) try {\n\t\treturn Schema.resolve(data, inner, options, strict);\n\t} catch (error) {\n\t\tmessages.push(error);\n\t}\n\tthrow new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options);\n});\nSchema.extend(\"intersect\", (data, { list, toString }, options, strict) => {\n\tif (!list.length) return [data];\n\tlet result;\n\tfor (const inner of list) {\n\t\tconst value = Schema.resolve(data, inner, options, true)[0];\n\t\tif (isNullable(value)) continue;\n\t\tif (isNullable(result)) result = value;\n\t\telse if (typeof result !== typeof value) throw new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options);\n\t\telse if (typeof value === \"object\") merge(result ??= {}, value);\n\t\telse if (result !== value) throw new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options);\n\t}\n\tif (!strict && isPlainObject(data)) merge(result, data);\n\treturn [result];\n});\nSchema.extend(\"transform\", (data, { inner, callback, preserve }, options) => {\n\tconst [result, adapted = data] = Schema.resolve(data, inner, options, true);\n\tif (preserve) return [callback(result)];\n\telse return [callback(result), callback(adapted)];\n});\nconst formatters = {};\nfunction defineMethod(name, keys, format) {\n\tformatters[name] = format;\n\tObject.assign(Schema, { [name](...args) {\n\t\tconst schema = new Schema({ type: name });\n\t\tkeys.forEach((key, index) => {\n\t\t\tswitch (key) {\n\t\t\t\tcase \"sKey\":\n\t\t\t\t\tschema.sKey = args[index] ?? Schema.string();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"inner\":\n\t\t\t\t\tschema.inner = Schema.from(args[index]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"list\":\n\t\t\t\t\tschema.list = args[index].map(Schema.from);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"dict\":\n\t\t\t\t\tschema.dict = valueMap(args[index], Schema.from);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"bits\":\n\t\t\t\t\tschema.bits = {};\n\t\t\t\t\tfor (const key in args[index]) {\n\t\t\t\t\t\tif (typeof args[index][key] !== \"number\") continue;\n\t\t\t\t\t\tschema.bits[key] = args[index][key];\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"callback\": {\n\t\t\t\t\tconst callback = schema.callback = args[index];\n\t\t\t\t\tcallback[\"toJSON\"] ||= () => callback.toString();\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"constructor\": {\n\t\t\t\t\tconst constructor = schema.constructor = args[index];\n\t\t\t\t\tif (typeof constructor === \"function\") constructor[\"toJSON\"] ||= () => constructor[\"name\"];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault: schema[key] = args[index];\n\t\t\t}\n\t\t});\n\t\tif (name === \"object\" || name === \"dict\") schema.meta.default = {};\n\t\telse if (name === \"array\" || name === \"tuple\") schema.meta.default = [];\n\t\telse if (name === \"bitset\") schema.meta.default = 0;\n\t\treturn schema;\n\t} });\n}\ndefineMethod(\"is\", [\"constructor\"], ({ constructor }) => {\n\tif (typeof constructor === \"function\") return constructor.name;\n\telse return constructor;\n});\ndefineMethod(\"any\", [], () => \"any\");\ndefineMethod(\"never\", [], () => \"never\");\ndefineMethod(\"const\", [\"value\"], ({ value }) => typeof value === \"string\" ? JSON.stringify(value) : value);\ndefineMethod(\"string\", [], () => \"string\");\ndefineMethod(\"number\", [], () => \"number\");\ndefineMethod(\"boolean\", [], () => \"boolean\");\ndefineMethod(\"bitset\", [\"bits\"], () => \"bitset\");\ndefineMethod(\"function\", [], () => \"function\");\ndefineMethod(\"array\", [\"inner\"], ({ inner }) => `${inner.toString(true)}[]`);\ndefineMethod(\"dict\", [\"inner\", \"sKey\"], ({ inner, sKey }) => `{ [key: ${sKey.toString()}]: ${inner.toString()} }`);\ndefineMethod(\"tuple\", [\"list\"], ({ list }) => `[${list.map((inner) => inner.toString()).join(\", \")}]`);\ndefineMethod(\"object\", [\"dict\"], ({ dict }) => {\n\tif (Object.keys(dict).length === 0) return \"{}\";\n\treturn `{ ${Object.entries(dict).map(([key, inner]) => {\n\t\treturn `${key}${inner.meta.required ? \"\" : \"?\"}: ${inner.toString()}`;\n\t}).join(\", \")} }`;\n});\ndefineMethod(\"union\", [\"list\"], ({ list }, inline) => {\n\tconst result = list.map(({ toString: format }) => format()).join(\" | \");\n\treturn inline ? `(${result})` : result;\n});\ndefineMethod(\"intersect\", [\"list\"], ({ list }) => {\n\treturn `${list.map((inner) => inner.toString(true)).join(\" & \")}`;\n});\ndefineMethod(\"transform\", [\n\t\"inner\",\n\t\"callback\",\n\t\"preserve\"\n], ({ inner }, isInner) => inner.toString(isInner));\n//#endregion\nexport { Schema as default };\n", "//#region lib/types/misc.js\n/** No-op callback returning `undefined` at runtime and `any` at type level. */\nfunction noop() {}\n/** Return true when a value is `null` or `undefined`. */\nfunction isNullable(value) {\n\treturn value === null || value === void 0;\n}\n/** Return true when a value is neither `null` nor `undefined`. */\nfunction isNonNullable(value) {\n\treturn !isNullable(value);\n}\n/** Return true for non-array object values. */\nfunction isPlainObject(data) {\n\treturn data && typeof data === \"object\" && !Array.isArray(data);\n}\n/** Filter object entries and return a new object. */\nfunction filterKeys(object, filter) {\n\treturn Object.fromEntries(Object.entries(object).filter(([key, value]) => filter(key, value)));\n}\n/** Map object values while preserving the original key set. */\nfunction mapValues(object, transform) {\n\treturn Object.fromEntries(Object.entries(object).map(([key, value]) => [key, transform(value, key)]));\n}\n/** Pick selected keys from an object, optionally including `undefined` values. */\nfunction pick(source, keys, forced) {\n\tif (!keys) return { ...source };\n\tconst result = {};\n\tfor (const key of keys) if (forced || source[key] !== void 0) result[key] = source[key];\n\treturn result;\n}\n/** Omit selected keys from a shallow object copy. */\nfunction omit(source, keys) {\n\tif (!keys) return { ...source };\n\tconst result = { ...source };\n\tfor (const key of keys) Reflect.deleteProperty(result, key);\n\treturn result;\n}\n/** Define a non-enumerable writable property and return the object. */\nfunction defineProperty(object, key, value) {\n\treturn Object.defineProperty(object, key, {\n\t\twritable: true,\n\t\tvalue,\n\t\tenumerable: false\n\t});\n}\n//#endregion\n//#region lib/types/array.js\n/** Return true when every item in `array2` is present in `array1`. */\nfunction contain(array1, array2) {\n\treturn array2.every((item) => array1.includes(item));\n}\n/** Return items that appear in both arrays. */\nfunction intersection(array1, array2) {\n\treturn array1.filter((item) => array2.includes(item));\n}\n/** Return items from `array1` that do not appear in `array2`. */\nfunction difference(array1, array2) {\n\treturn array1.filter((item) => !array2.includes(item));\n}\n/** Return the set-union of two arrays while preserving first occurrence order. */\nfunction union(array1, array2) {\n\treturn Array.from(new Set([...array1, ...array2]));\n}\n/** Remove duplicate values while preserving first occurrence order. */\nfunction deduplicate(array) {\n\treturn [...new Set(array)];\n}\n/** Remove one item from an array and report whether it was found. */\nfunction remove(list, item) {\n\tconst index = list?.indexOf(item);\n\tif (index >= 0) {\n\t\tlist.splice(index, 1);\n\t\treturn true;\n\t} else return false;\n}\n/** Normalize nullish, scalar, or array input to an array. */\nfunction makeArray(source) {\n\treturn Array.isArray(source) ? source : isNullable(source) ? [] : [source];\n}\n//#endregion\n//#region lib/types/volatile.js\n/** Shared config references used by schema validators and plugin runtimes. */\nconst write = Symbol.for(\"cosmokit.volatile.write\");\nfunction snapshot(value, ancestors = /* @__PURE__ */ new Set()) {\n\tif (typeof value === \"function\") throw new TypeError(\"volatile config cannot contain functions\");\n\tif (value === null || typeof value !== \"object\") return value;\n\tif (ancestors.has(value)) throw new TypeError(\"volatile config cannot contain cycles\");\n\tancestors.add(value);\n\ttry {\n\t\tif (Array.isArray(value)) return Object.freeze(value.map((item) => snapshot(item, ancestors)));\n\t\tif (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) throw new TypeError(\"volatile config objects must be plain objects or arrays\");\n\t\treturn Object.freeze(Object.fromEntries(Object.entries(value).map(([key, item]) => [key, snapshot(item, ancestors)])));\n\t} finally {\n\t\tancestors.delete(value);\n\t}\n}\n/**\n* Create a detached reference containing an immutable copy of the supplied data.\n* @param value - validated config data; class instances and functions are unsupported.\n* @returns a reference whose value is updated only by its owning runtime.\n*/\nfunction createVolatile(value) {\n\tlet current = snapshot(value);\n\treturn Object.freeze({\n\t\tget: () => current,\n\t\t[write]: (value) => {\n\t\t\tcurrent = value;\n\t\t}\n\t});\n}\n/**\n* Identify references across ESM/CJS copies of the shared library.\n* @param value - a parsed config value.\n* @returns whether the value implements the shared reference protocol.\n*/\nfunction isVolatile(value) {\n\treturn typeof value === \"object\" && value !== null && write in value;\n}\n/**\n* Collect config references without descending into their snapshots or opaque objects.\n* @internal\n* @param value - parsed config; cyclic ordinary fields are visited once per path.\n* @returns references and their object-key paths, including an empty path for a root reference.\n*/\nfunction volatileEntries(value) {\n\tconst ancestors = /* @__PURE__ */ new Set();\n\tfunction visit(value, path) {\n\t\tif (isVolatile(value)) return [{\n\t\t\tpath,\n\t\t\tref: value\n\t\t}];\n\t\tif (!value || typeof value !== \"object\" || ancestors.has(value)) return [];\n\t\tif (!Array.isArray(value) && Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) return [];\n\t\tancestors.add(value);\n\t\ttry {\n\t\t\treturn Object.entries(value).flatMap(([key, child]) => visit(child, [...path, key]));\n\t\t} finally {\n\t\t\tancestors.delete(value);\n\t\t}\n\t}\n\treturn visit(value, []);\n}\n/**\n* Commit an already validated immutable snapshot from another reference.\n* @internal\n* @param target - the owning plugin's stable reference.\n* @param source - a newly parsed candidate reference.\n*/\nfunction updateVolatile(target, source) {\n\ttarget[write](source.get());\n}\n//#endregion\n//#region lib/types/types.js\n/** Test values using `instanceof` with a `toStringTag` fallback. */\nfunction is(type, value) {\n\tif (arguments.length === 1) return (value) => is(type, value);\n\treturn type in globalThis && value instanceof globalThis[type] || Object.prototype.toString.call(value).slice(8, -1) === type;\n}\nfunction isArrayBufferLike(value) {\n\treturn is(\"ArrayBuffer\", value) || is(\"SharedArrayBuffer\", value);\n}\nfunction isArrayBufferSource(value) {\n\treturn isArrayBufferLike(value) || ArrayBuffer.isView(value);\n}\n/** Binary source detection and base64/hex conversion helpers. */\nvar Binary;\n(function(Binary) {\n\tBinary.is = isArrayBufferLike;\n\tBinary.isSource = isArrayBufferSource;\n\tfunction fromSource(source) {\n\t\tif (ArrayBuffer.isView(source)) return source.buffer.slice(source.byteOffset, source.byteOffset + source.byteLength);\n\t\telse return source;\n\t}\n\tBinary.fromSource = fromSource;\n\tfunction toBase64(source) {\n\t\tsource = fromSource(source);\n\t\tif (typeof Buffer !== \"undefined\") return Buffer.from(source).toString(\"base64\");\n\t\tlet binary = \"\";\n\t\tconst bytes = new Uint8Array(source);\n\t\tfor (let i = 0; i < bytes.byteLength; i++) binary += String.fromCharCode(bytes[i]);\n\t\treturn btoa(binary);\n\t}\n\tBinary.toBase64 = toBase64;\n\tfunction fromBase64(source) {\n\t\tif (typeof Buffer !== \"undefined\") return fromSource(Buffer.from(source, \"base64\"));\n\t\treturn Uint8Array.from(atob(source), (c) => c.charCodeAt(0));\n\t}\n\tBinary.fromBase64 = fromBase64;\n\tfunction toHex(source) {\n\t\tsource = fromSource(source);\n\t\tif (typeof Buffer !== \"undefined\") return Buffer.from(source).toString(\"hex\");\n\t\treturn Array.from(new Uint8Array(source), (byte) => byte.toString(16).padStart(2, \"0\")).join(\"\");\n\t}\n\tBinary.toHex = toHex;\n\tfunction fromHex(source) {\n\t\tif (typeof Buffer !== \"undefined\") return fromSource(Buffer.from(source, \"hex\"));\n\t\tconst hex = source.length % 2 === 0 ? source : source.slice(0, source.length - 1);\n\t\tconst buffer = [];\n\t\tfor (let i = 0; i < hex.length; i += 2) buffer.push(parseInt(`${hex[i]}${hex[i + 1]}`, 16));\n\t\treturn Uint8Array.from(buffer).buffer;\n\t}\n\tBinary.fromHex = fromHex;\n})(Binary || (Binary = {}));\n/** Decode a base64 string into binary data. */\nconst base64ToArrayBuffer = Binary.fromBase64;\n/** Encode binary data as base64. */\nconst arrayBufferToBase64 = Binary.toBase64;\n/** Decode a hex string into binary data. */\nconst hexToArrayBuffer = Binary.fromHex;\n/** Encode binary data as hex. */\nconst arrayBufferToHex = Binary.toHex;\n/** Deep-clone common JavaScript values while preserving prototypes and cycles. */\nfunction clone(source, refs = /* @__PURE__ */ new Map()) {\n\tif (!source || typeof source !== \"object\") return source;\n\tif (is(\"Date\", source)) return new Date(source.valueOf());\n\tif (is(\"RegExp\", source)) return new RegExp(source.source, source.flags);\n\tif (isArrayBufferLike(source)) return source.slice(0);\n\tif (ArrayBuffer.isView(source)) return source.buffer.slice(source.byteOffset, source.byteOffset + source.byteLength);\n\tconst cached = refs.get(source);\n\tif (cached) return cached;\n\tif (Array.isArray(source)) {\n\t\tconst result = [];\n\t\trefs.set(source, result);\n\t\tsource.forEach((value, index) => {\n\t\t\tresult[index] = Reflect.apply(clone, null, [value, refs]);\n\t\t});\n\t\treturn result;\n\t}\n\tconst result = Object.create(Object.getPrototypeOf(source));\n\trefs.set(source, result);\n\tfor (const key of Reflect.ownKeys(source)) {\n\t\tconst descriptor = { ...Reflect.getOwnPropertyDescriptor(source, key) };\n\t\tif (\"value\" in descriptor) descriptor.value = Reflect.apply(clone, null, [descriptor.value, refs]);\n\t\tReflect.defineProperty(result, key, descriptor);\n\t}\n\treturn result;\n}\n/**\n* Compare values recursively, treating two volatile references as equal regardless of value.\n* Strict comparison distinguishes null/undefined, treats opaque objects by identity,\n* compares URLs by normalized href, treats array holes as undefined, and considers distinct cyclic structures unequal.\n* @param a - first value.\n* @param b - second value.\n* @param strict - whether to require strict data equality outside volatile references.\n* @returns whether the values compare equal.\n*/\nfunction deepEqual(a, b, strict) {\n\tconst ancestors = /* @__PURE__ */ new Set();\n\tfunction compare(a, b) {\n\t\tif (a === b) return true;\n\t\tif (isVolatile(a) || isVolatile(b)) return isVolatile(a) && isVolatile(b);\n\t\tif (!strict && isNullable(a) && isNullable(b)) return true;\n\t\tif (typeof a !== typeof b || typeof a !== \"object\" || !a || !b) return false;\n\t\tif (ancestors.has(a)) return false;\n\t\tfunction check(test, then) {\n\t\t\treturn test(a) ? test(b) ? then(a, b) : false : test(b) ? false : void 0;\n\t\t}\n\t\tancestors.add(a);\n\t\ttry {\n\t\t\treturn check(Array.isArray, (a, b) => {\n\t\t\t\tif (a.length !== b.length) return false;\n\t\t\t\tfor (let index = 0; index < a.length; index++) if (!compare(a[index], b[index])) return false;\n\t\t\t\treturn true;\n\t\t\t}) ?? check(is(\"Date\"), (a, b) => a.valueOf() === b.valueOf()) ?? check(is(\"URL\"), (a, b) => a.href === b.href) ?? check(is(\"RegExp\"), (a, b) => a.source === b.source && a.flags === b.flags) ?? check(isArrayBufferLike, (a, b) => {\n\t\t\t\tif (a.byteLength !== b.byteLength) return false;\n\t\t\t\tconst viewA = new Uint8Array(a);\n\t\t\t\tconst viewB = new Uint8Array(b);\n\t\t\t\tfor (let i = 0; i < viewA.length; i++) if (viewA[i] !== viewB[i]) return false;\n\t\t\t\treturn true;\n\t\t\t}) ?? ((!strict || [a, b].every((value) => Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null)) && Object.keys({\n\t\t\t\t...a,\n\t\t\t\t...b\n\t\t\t}).every((key) => compare(a[key], b[key])));\n\t\t} finally {\n\t\t\tancestors.delete(a);\n\t\t}\n\t}\n\treturn compare(a, b);\n}\n//#endregion\n//#region lib/types/string.js\n/** Uppercase the first character of a string. */\nfunction capitalize(source) {\n\treturn source.charAt(0).toUpperCase() + source.slice(1);\n}\n/** Lowercase the first character of a string. */\nfunction uncapitalize(source) {\n\treturn source.charAt(0).toLowerCase() + source.slice(1);\n}\n/** Convert dash or underscore delimited text to camelCase. */\nfunction camelCase(source) {\n\treturn source.replace(/[_-][a-z]/g, (str) => str.slice(1).toUpperCase());\n}\nfunction tokenize(source, delimiters, delimiter) {\n\tconst output = [];\n\tlet state = 0;\n\tfor (let i = 0; i < source.length; i++) {\n\t\tconst code = source.charCodeAt(i);\n\t\tif (code >= 65 && code <= 90) {\n\t\t\tif (state === 1) {\n\t\t\t\tconst next = source.charCodeAt(i + 1);\n\t\t\t\tif (next >= 97 && next <= 122) output.push(delimiter);\n\t\t\t\toutput.push(code + 32);\n\t\t\t} else {\n\t\t\t\tif (state !== 0) output.push(delimiter);\n\t\t\t\toutput.push(code + 32);\n\t\t\t}\n\t\t\tstate = 1;\n\t\t} else if (code >= 97 && code <= 122) {\n\t\t\toutput.push(code);\n\t\t\tstate = 2;\n\t\t} else if (delimiters.includes(code)) {\n\t\t\tif (state !== 0) output.push(delimiter);\n\t\t\tstate = 0;\n\t\t} else output.push(code);\n\t}\n\treturn String.fromCharCode(...output);\n}\n/** Convert text to dash-delimited parameter case. */\nfunction paramCase(source) {\n\treturn tokenize(source, [45, 95], 45);\n}\n/** Convert text to underscore-delimited snake case. */\nfunction snakeCase(source) {\n\treturn tokenize(source, [45, 95], 95);\n}\n/** Runtime alias for `camelCase`. */\nconst camelize = camelCase;\n/** Runtime alias for `paramCase`. */\nconst hyphenate = paramCase;\n/** Format a property key as a JavaScript member access suffix. */\nfunction formatProperty(key) {\n\tif (typeof key !== \"string\") return `[${key.toString()}]`;\n\treturn /^[a-z_$][\\w$]*$/i.test(key) ? `.${key}` : `[${JSON.stringify(key)}]`;\n}\n/** Remove one trailing slash from a path string. */\nfunction trimSlash(source) {\n\treturn source.replace(/\\/$/, \"\");\n}\n/** Ensure a path starts with `/` and has no trailing slash. */\nfunction sanitize(source) {\n\tif (!source.startsWith(\"/\")) source = \"/\" + source;\n\treturn trimSlash(source);\n}\n//#endregion\n//#region lib/types/time.js\n/** Time constants plus parsing and formatting helpers. */\nvar Time;\n(function(Time) {\n\tTime.millisecond = 1;\n\tTime.second = 1e3;\n\tTime.minute = Time.second * 60;\n\tTime.hour = Time.minute * 60;\n\tTime.day = Time.hour * 24;\n\tTime.week = Time.day * 7;\n\tlet timezoneOffset = (/* @__PURE__ */ new Date()).getTimezoneOffset();\n\tfunction setTimezoneOffset(offset) {\n\t\ttimezoneOffset = offset;\n\t}\n\tTime.setTimezoneOffset = setTimezoneOffset;\n\tfunction getTimezoneOffset() {\n\t\treturn timezoneOffset;\n\t}\n\tTime.getTimezoneOffset = getTimezoneOffset;\n\tfunction getDateNumber(date = /* @__PURE__ */ new Date(), offset) {\n\t\tif (typeof date === \"number\") date = new Date(date);\n\t\tif (offset === void 0) offset = timezoneOffset;\n\t\treturn Math.floor((date.valueOf() / Time.minute - offset) / 1440);\n\t}\n\tTime.getDateNumber = getDateNumber;\n\tfunction fromDateNumber(value, offset) {\n\t\tconst date = new Date(value * Time.day);\n\t\tif (offset === void 0) offset = timezoneOffset;\n\t\treturn new Date(+date + offset * Time.minute);\n\t}\n\tTime.fromDateNumber = fromDateNumber;\n\tconst numeric = /\\d+(?:\\.\\d+)?/.source;\n\tconst timeRegExp = new RegExp(`^${[\n\t\t\"w(?:eek(?:s)?)?\",\n\t\t\"d(?:ay(?:s)?)?\",\n\t\t\"h(?:our(?:s)?)?\",\n\t\t\"m(?:in(?:ute)?(?:s)?)?\",\n\t\t\"s(?:ec(?:ond)?(?:s)?)?\"\n\t].map((unit) => `(${numeric}${unit})?`).join(\"\")}$`);\n\tfunction parseTime(source) {\n\t\tconst capture = timeRegExp.exec(source);\n\t\tif (!capture) return 0;\n\t\treturn (parseFloat(capture[1]) * Time.week || 0) + (parseFloat(capture[2]) * Time.day || 0) + (parseFloat(capture[3]) * Time.hour || 0) + (parseFloat(capture[4]) * Time.minute || 0) + (parseFloat(capture[5]) * Time.second || 0);\n\t}\n\tTime.parseTime = parseTime;\n\tfunction parseDate(date) {\n\t\tconst parsed = parseTime(date);\n\t\tif (parsed) date = Date.now() + parsed;\n\t\telse if (/^\\d{1,2}(:\\d{1,2}){1,2}$/.test(date)) date = `${(/* @__PURE__ */ new Date()).toLocaleDateString()}-${date}`;\n\t\telse if (/^\\d{1,2}-\\d{1,2}-\\d{1,2}(:\\d{1,2}){1,2}$/.test(date)) date = `${(/* @__PURE__ */ new Date()).getFullYear()}-${date}`;\n\t\treturn date ? new Date(date) : /* @__PURE__ */ new Date();\n\t}\n\tTime.parseDate = parseDate;\n\tfunction format(ms) {\n\t\tconst abs = Math.abs(ms);\n\t\tif (abs >= Time.day - Time.hour / 2) return Math.round(ms / Time.day) + \"d\";\n\t\telse if (abs >= Time.hour - Time.minute / 2) return Math.round(ms / Time.hour) + \"h\";\n\t\telse if (abs >= Time.minute - Time.second / 2) return Math.round(ms / Time.minute) + \"m\";\n\t\telse if (abs >= Time.second) return Math.round(ms / Time.second) + \"s\";\n\t\treturn ms + \"ms\";\n\t}\n\tTime.format = format;\n\tfunction toDigits(source, length = 2) {\n\t\treturn source.toString().padStart(length, \"0\");\n\t}\n\tTime.toDigits = toDigits;\n\tfunction template(template, time = /* @__PURE__ */ new Date()) {\n\t\treturn template.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));\n\t}\n\tTime.template = template;\n})(Time || (Time = {}));\n//#endregion\nexport { Binary, Time, arrayBufferToBase64, arrayBufferToHex, base64ToArrayBuffer, camelCase, camelize, capitalize, clone, contain, createVolatile, deduplicate, deepEqual, defineProperty, difference, filterKeys, formatProperty, hexToArrayBuffer, hyphenate, intersection, is, isNonNullable, isNullable, isPlainObject, isVolatile, makeArray, mapValues, mapValues as valueMap, noop, omit, paramCase, pick, remove, sanitize, snakeCase, trimSlash, uncapitalize, union, updateVolatile, volatileEntries };\n", "/**\n * dsh-provider-proxy \u2014 Host half.\n *\n * Routes the model calls of the providers the user enabled through that\n * provider's own forward proxy. Every other provider, and all other DSH\n * traffic, keeps using the normal network path.\n */\n\nimport { acquireFetchRouter } from './fetch-router.js'\nimport { closeTable, createProxyTable, type RouteEntry } from './proxy-table.js'\nimport type { ProviderProxyRouteValue } from './config.js'\n\nexport const name = 'dsh-provider-proxy'\nexport const inject = ['llm']\n\n/**\n * The Config this fiber receives.\n *\n * It is NOT `ConfigShape`: under the Loader `providers` is a Volatile REFERENCE,\n * not the dictionary, so it has to be read through `.get()`. Declaring the plain\n * shape here made the two incompatible and hid every real value.\n */\ninterface ProxyConfig {\n /** The provider dictionary, or the Volatile wrapper around it. */\n readonly providers?: unknown\n}\n\nfunction plainProviders(\n config: ProxyConfig | undefined,\n): Record<string, Partial<ProviderProxyRouteValue>> {\n const raw = config?.providers\n if (raw === undefined) return {}\n // Under the Loader this is a Volatile reference; read it fresh every time so\n // a settings write is visible to the next request without a remount.\n const snapshot = (raw as { get?: () => unknown }).get\n const value = typeof snapshot === 'function' ? snapshot.call(raw) : raw\n return (value ?? {}) as Record<string, Partial<ProviderProxyRouteValue>>\n}\n\nexport function apply(ctx: any, config?: ProxyConfig): void {\n const router = acquireFetchRouter()\n let current = new Map<string, RouteEntry>()\n let problems = new Map<string, string>()\n let closed = false\n\n // One line on activation so a user can tell \"mounted\" from \"not mounted\" in\n // the Host log without guessing. Never prints a credential.\n try {\n ctx.logger.info('dsh-provider-proxy mounted (pid %d)', process.pid)\n } catch {\n // A context without a logger still works; the diagnostics getter remains.\n }\n\n const rebuild = async (): Promise<void> => {\n const next = await createProxyTable(plainProviders(config))\n const previous = current\n current = next.entries\n problems = next.problems\n // Retire the previous table only after the new one is live, so an in-flight\n // stream keeps a dispatcher that still works.\n void closeTable(previous)\n }\n\n const ready = rebuild()\n\n /**\n * The provider catalogue, read from `ctx.llm` where it is actually available.\n *\n * The browser has no LLM service in this release, so the page cannot ask for\n * this list itself. Serving it from the Host is the supported path: the\n * `webServer` service is confirmed live, and the shipped dsh-llm-retry-settings\n * registers its routes the same way.\n */\n const catalog = (): { providers: { id: string; name: string; live: boolean }[] } => {\n const live = new Set<string>()\n const out: { id: string; name: string; live: boolean }[] = []\n const seen = new Set<string>()\n try {\n for (const entry of ctx.llm?.listProviders?.() ?? []) {\n const id = entry?.id\n if (typeof id !== 'string' || id.length === 0) continue\n live.add(id)\n if (seen.has(id)) continue\n seen.add(id)\n const name = typeof entry?.name === 'string' && entry.name.length > 0 ? entry.name : id\n out.push({ id, name, live: true })\n }\n } catch {\n // no llm service in this composition\n }\n try {\n for (const entry of ctx.llm?.listConfigurableProviders?.() ?? []) {\n const id = entry?.provider\n if (typeof id !== 'string' || id.length === 0) continue\n const name =\n typeof entry.displayName === 'string' && entry.displayName.length > 0 ? entry.displayName : id\n const existing = out.find(row => row.id === id)\n if (existing === undefined) out.push({ id, name, live: live.has(id) })\n else existing.name = name\n }\n } catch {\n // ignore\n }\n out.sort((a, b) => a.name.localeCompare(b.name))\n return { providers: out }\n }\n\n // The page reads this same-origin JSON endpoint for the provider list. Mounted\n // inside an optional child so a composition without a web server still runs.\n ctx.inject?.(['webServer'], (wctx: any) => {\n try {\n wctx?.webServer?.register?.({\n kind: 'exact',\n path: '/dsh-provider-proxy/providers',\n handler: (_req: unknown, res: any) => {\n try {\n const text = JSON.stringify({ ...catalog(), problems: Object.fromEntries(problems) })\n res.writeHead(200, {\n 'content-type': 'application/json; charset=utf-8',\n 'cache-control': 'no-store',\n 'content-length': Buffer.byteLength(text),\n })\n res.end(text)\n } catch (error) {\n res.writeHead(500, { 'content-type': 'application/json' })\n res.end(JSON.stringify({ providers: [], error: String(error) }))\n }\n },\n })\n } catch (error) {\n // The page degrades to whatever is already configured.\n void error\n }\n })\n\n ctx.effect(() => {\n const stop = ctx.on(\n 'llm/stream',\n (options: { provider?: string }, next: () => AsyncIterable<unknown>) => {\n const provider = options?.provider\n if (typeof provider !== 'string') return next()\n const route = current.get(provider)\n if (route === undefined) return next()\n // The stream is consumed lazily; wrap it so the scope survives.\n return router.wrap(route.dispatcher, next as () => AsyncIterable<unknown>)\n },\n { global: true },\n )\n\n const onConfig = (): void => {\n void rebuild()\n }\n ctx.on('loader/volatile-update', onConfig, { global: true })\n\n return async () => {\n stop()\n if (closed) return\n closed = true\n await ready.catch(() => undefined)\n await closeTable(current)\n current = new Map()\n router.release()\n }\n }, 'dsh-provider-proxy: provider-scoped proxy routing')\n\n // Diagnostics, exported for the Host log and for tests. Never includes a\n // password: `proxyOrigin` is the sanitized origin only.\n Object.defineProperty(ctx, 'providerProxyState', {\n configurable: true,\n get: () => ({\n routes: [...current.values()].map(entry => ({\n provider: entry.provider,\n proxyOrigin: entry.proxyOrigin,\n })),\n problems: Object.fromEntries(problems),\n }),\n })\n}\n\nexport { acquireFetchRouter } from './fetch-router.js'\nexport { createProxyTable, closeTable, proxyUrl } from './proxy-table.js'\nexport { Config, ProviderProxyRoute, normalizeRoute, PROTOCOLS } from './config.js'"],
|
|
5
|
-
"mappings": ";;;;;;;AAoCA,SAAS,yBAAyB;AAClC,SAAS,SAAS,mBAAmB;AAYrC,IAAM,YAAY,uBAAO,IAAI,oCAAoC;AAUjE,SAAS,sBAAmC;AAC1C,QAAM,UAAW,WAAuD,SAAS;AACjF,MAAI,YAAY,QAAW;AACzB,YAAQ,UAAU;AAClB,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,WAAW,UAAU,YAAY;AAC1C,UAAM,IAAI,MAAM,oEAAoE;AAAA,EACtF;AAEA,QAAM,UAAU,IAAI,kBAA+B;AACnD,QAAM,gBAAgB,WAAW;AACjC,QAAM,aAAa,OAAO,yBAAyB,YAAY,OAAO;AAEtE,QAAM,cAAc,SAASA,aAE3B,OACA,MACqC;AACrC,UAAM,SAAS,QAAQ,SAAS;AAEhC,QAAI,WAAW,OAAW,QAAO,cAAc,KAAK,YAAY,OAAO,IAAI;AAC3E,QAAI,SAAS,UAAa,SAAS,QAAS,KAAkC,eAAe,QAAW;AACtG,aAAO,cAAc,KAAK,YAAY,OAAO,IAAI;AAAA,IACnD;AAIA,WAAO,YAAY,OA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AAO,aAAa,SAAU,QAAO,KAAK;AAC9C,cAAM,QAAQ,QAAQ,IAAI,QAAQ;AAClC,YAAI,UAAU,OAAW,QAAO,KAAK;AAErC,eAAO,OAAO,KAAK,MAAM,YAAY,IAAoC;AAAA,MAC3E;AAAA,MACA,EAAE,QAAQ,KAAK;AAAA,IACjB;AAEA,UAAM,WAAW,MAAY;AAC3B,WAAK,QAAQ;AAAA,IACf;AACA,QAAI,GAAG,0BAA0B,UAAU,EAAE,QAAQ,KAAK,CAAC;AAE3D,WAAO,YAAY;AACjB,WAAK;AACL,UAAI,OAAQ;AACZ,eAAS;AACT,YAAM,MAAM,MAAM,MAAM,MAAS;AACjC,YAAM,WAAW,OAAO;AACxB,gBAAU,oBAAI,IAAI;AAClB,aAAO,QAAQ;AAAA,IACjB;AAAA,EACF,GAAG,mDAAmD;AAItD,SAAO,eAAe,KAAK,sBAAsB;AAAA,IAC/C,cAAc;AAAA,IACd,KAAK,OAAO;AAAA,MACV,QAAQ,CAAC,GAAG,QAAQ,OAAO,CAAC,EAAE,IAAI,YAAU;AAAA,QAC1C,UAAU,MAAM;AAAA,QAChB,aAAa,MAAM;AAAA,MACrB,EAAE;AAAA,MACF,UAAU,OAAO,YAAY,QAAQ;AAAA,IACvC;AAAA,EACF,CAAC;AACH;",
|
|
4
|
+
"sourcesContent": ["/**\n * Provider-scoped fetch routing.\n *\n * DeepSeek Harness 0.2.0-rc.2 offers no supported seam for giving one LLM\n * provider its own transport:\n *\n * - `llm-deepseek` calls the unqualified global `fetch` with no `dispatcher`;\n * - `llm-pi-ai` delegates to the pi-ai SDK, whose HTTP layer DSH cannot\n * configure (its own source notes a fetch/dispatcher hook does not exist);\n * - `LlmCallControls` carries only reasoningEffort/temperature/maxTokens/stop;\n * - `llm/stream` intercepts already-decoded `StreamChunk`s, i.e. after HTTP;\n * - `ctx.web` serves `web_search`/`web_fetch` only, never provider traffic;\n * - the official `@deepseek-ai/dsh-http-proxy` is a library with a private\n * installer: one process-wide policy from env vars, no service, no Config.\n *\n * So the request is routed where the only available signal actually is: the\n * `llm/stream` waterfall, whose `options.provider` names the route. An\n * AsyncLocalStorage scope carries the chosen dispatcher over the stream, and a\n * thin `globalThis.fetch` wrapper applies it. Because every provider gets its\n * OWN dispatcher instance, one provider's proxy can never be picked up by\n * another provider's call \u2014 including two providers that resolve to the same\n * upstream host.\n *\n * IMPORTANT \u2014 one undici realm only. Node's built-in `fetch` uses an internal\n * undici and REJECTS a dispatcher built by the npm `undici` package with\n * `invalid onRequestStart method`, and vice versa. Every dispatcher here is\n * built from the npm `undici` that this module imports, so the wrapper must\n * dispatch through THAT same package's `fetch` rather than re-entering Node's.\n * The proxy therefore receives an absolute-form request line\n * (`GET http://host/path HTTP/1.1`), which is how an HTTP forward proxy is\n * addressed; an `https:` target is tunnelled with CONNECT.\n *\n * In-flight streams keep the dispatcher they started on; a configuration\n * change only affects new requests.\n */\n\nimport { AsyncLocalStorage } from 'node:async_hooks'\nimport { fetch as undiciFetch } from 'undici'\n\n/** Undici dispatcher, kept structurally typed so this file needs no undici types. */\nexport interface DispatcherLike {\n close(): Promise<void>\n}\n\nexport interface RouterStore {\n dispatcher: DispatcherLike\n}\n\n/** Shared across every plugin instance in one process, keyed so copies cooperate. */\nconst STATE_KEY = Symbol.for('dsh-provider-proxy.fetch-router.v1')\n\ninterface RouterState {\n owners: number\n storage: AsyncLocalStorage<RouterStore>\n originalFetch: typeof globalThis.fetch\n routedFetch: typeof globalThis.fetch\n descriptor?: PropertyDescriptor\n}\n\nfunction installSharedRouter(): RouterState {\n const current = (globalThis as Record<symbol, RouterState | undefined>)[STATE_KEY]\n if (current !== undefined) {\n current.owners += 1\n return current\n }\n\n if (typeof globalThis.fetch !== 'function') {\n throw new Error('dsh-provider-proxy: this Node runtime does not expose global fetch')\n }\n\n const storage = new AsyncLocalStorage<RouterStore>()\n const originalFetch = globalThis.fetch\n const descriptor = Object.getOwnPropertyDescriptor(globalThis, 'fetch')\n\n const routedFetch = function routedFetch(\n this: unknown,\n input: Parameters<typeof globalThis.fetch>[0],\n init?: Parameters<typeof globalThis.fetch>[1],\n ): ReturnType<typeof globalThis.fetch> {\n const active = storage.getStore()\n // No scope, or a caller that already picked a dispatcher: stay out of the way.\n if (active === undefined) return originalFetch.call(globalThis, input, init)\n if (init !== undefined && init !== null && (init as { dispatcher?: unknown }).dispatcher !== undefined) {\n return originalFetch.call(globalThis, input, init)\n }\n // Same undici realm as the dispatcher \u2014 Node's own fetch would reject it.\n // The init is passed through structurally: the DOM `RequestInit` and the\n // undici one disagree on `body`/`duplex`, so both are erased here.\n return undiciFetch(input as never, {\n ...(init as Record<string, unknown> | undefined),\n dispatcher: active.dispatcher as never,\n } as never) as never\n }\n\n Object.defineProperty(globalThis, 'fetch', {\n ...(descriptor ?? { configurable: true, enumerable: true, writable: true }),\n value: routedFetch,\n })\n\n const state: RouterState = { owners: 1, storage, originalFetch, routedFetch, descriptor }\n Object.defineProperty(globalThis, STATE_KEY, {\n configurable: true,\n value: state,\n })\n return state\n}\n\n/**\n * Re-apply the AsyncLocalStorage scope to every iterator operation.\n *\n * This is essential, not cosmetic: an adapter's stream is consumed lazily, so\n * the HTTP call typically happens inside a later `next()`, long after\n * `als.run(...)` returned. Without wrapping the iterator, every request would\n * silently fall back to the default dispatcher.\n */\nfunction contextualIterable(\n storage: AsyncLocalStorage<RouterStore>,\n store: RouterStore,\n factory: () => AsyncIterable<unknown>,\n): AsyncIterable<unknown> {\n return {\n [Symbol.asyncIterator]() {\n let iterator: AsyncIterator<unknown> | undefined\n\n const ensureIterator = (): AsyncIterator<unknown> => {\n if (iterator !== undefined) return iterator\n const iterable = factory()\n if (iterable === null || typeof iterable?.[Symbol.asyncIterator] !== 'function') {\n throw new TypeError('dsh-provider-proxy: llm/stream next() did not return an AsyncIterable')\n }\n iterator = iterable[Symbol.asyncIterator]()\n return iterator\n }\n\n const invoke = (method: 'next' | 'return' | 'throw', value?: unknown): Promise<IteratorResult<unknown>> =>\n storage.run(store, () => {\n // A stream abandoned before its first next() must not touch the adapter.\n if (method === 'return' && iterator === undefined) return Promise.resolve({ done: true, value })\n if (method === 'throw' && iterator === undefined) return Promise.reject(value)\n const target = ensureIterator()\n const operation = target[method]\n if (typeof operation !== 'function') {\n if (method === 'return') return Promise.resolve({ done: true, value })\n return Promise.reject(value)\n }\n return Promise.resolve(Reflect.apply(operation, target, method === 'next' ? [] : [value]))\n })\n\n return {\n next: (value?: unknown) => invoke('next', value),\n return: (value?: unknown) => invoke('return', value),\n throw: (value?: unknown) => invoke('throw', value),\n [Symbol.asyncIterator]() {\n return this\n },\n }\n },\n }\n}\n\nexport interface FetchRouter {\n /** Run one synchronous callback inside the provider's scope. */\n run(dispatcher: DispatcherLike, callback: () => unknown): unknown\n /** Wrap a lazy stream so every consumption step keeps the scope. */\n wrap(dispatcher: DispatcherLike, factory: () => AsyncIterable<unknown>): AsyncIterable<unknown>\n /** Release this holder; the shim is removed once the last holder releases. */\n release(): void\n}\n\n/** Install (or share) the single process-wide fetch shim. */\nexport function acquireFetchRouter(): FetchRouter {\n const state = installSharedRouter()\n let released = false\n\n return {\n run(dispatcher, callback) {\n return state.storage.run({ dispatcher }, callback)\n },\n wrap(dispatcher, factory) {\n return contextualIterable(state.storage, { dispatcher }, factory)\n },\n release() {\n if (released) return\n released = true\n state.owners -= 1\n if (state.owners !== 0) return\n\n if (globalThis.fetch === state.routedFetch) {\n if (state.descriptor === undefined) delete (globalThis as { fetch?: unknown }).fetch\n else Object.defineProperty(globalThis, 'fetch', state.descriptor)\n }\n delete (globalThis as Record<symbol, unknown>)[STATE_KEY]\n state.storage.disable()\n },\n }\n}", "/**\r\n * The proxy table: one dispatcher per enabled provider.\r\n *\r\n * A dispatcher is created per provider rather than shared, so a proxied\r\n * provider can never leak its transport into another provider's call even when\r\n * both resolve to the same upstream host.\r\n *\r\n * Two transports are supported, and they come from the SAME npm undici instance\r\n * (the build leaves `undici` external), which is what lets both be handed to\r\n * `undiciFetch` by the router:\r\n *\r\n * - `http`/`https` \u2192 `ProxyAgent`, which speaks HTTP CONNECT to an HTTP proxy;\r\n * - `socks5` \u2192 `Socks5ProxyAgent`, undici's built-in RFC 1928/1929 client,\r\n * which tunnels the target instead of forwarding to it.\r\n */\r\n\r\nimport { ProxyAgent, Socks5ProxyAgent } from 'undici'\r\n\r\nimport { normalizeRoute, type ProviderProxyRouteValue } from './config.js'\r\nimport type { DispatcherLike } from './fetch-router.js'\r\n\r\nexport interface RouteEntry {\r\n provider: string\r\n /** Normalized proxy origin, for diagnostics only. Never logged with credentials. */\r\n proxyOrigin: string\r\n dispatcher: DispatcherLike\r\n}\r\n\r\nfunction proxyUrl(route: ProviderProxyRouteValue): string {\r\n const auth =\r\n route.username.length === 0\r\n ? ''\r\n : `${encodeURIComponent(route.username).replace(/%3A/gi, ':')}@`\r\n // IPv6 literals need brackets in a URL authority.\r\n const host = route.host.includes(':') && !route.host.startsWith('[') ? `[${route.host}]` : route.host\r\n return `${route.protocol}://${auth}${host}:${route.port}`\r\n}\r\n\r\n/**\r\n * A credential-free origin, for diagnostics only.\r\n *\r\n * `new URL(url).origin` is NOT usable for socks5: socks5 is a non-special\r\n * scheme, and WHATWG URL serializes the origin of a non-special scheme as the\r\n * string `'null'` (the same rule that made `gopher` return `'null'` in Node\r\n * 15). That value is surfaced verbatim in `ctx.providerProxyState` and in the\r\n * settings page's diagnostics, so it would hide which proxy a SOCKS5 provider\r\n * is using. HTTP keeps using `.origin`, which is what it already did.\r\n *\r\n * Credentials are never part of this string: it is built from host and port.\r\n */\r\nfunction displayOrigin(route: ProviderProxyRouteValue, url: string): string {\r\n if (route.protocol !== 'socks5') return new URL(url).origin\r\n const host = route.host.includes(':') && !route.host.startsWith('[') ? `[${route.host}]` : route.host\r\n return `${route.protocol}://${host}:${route.port}`\r\n}\r\n\r\n/**\r\n * Build the dispatcher for one route.\r\n *\r\n * SOCKS5 authentication is passed as options rather than through the URL so the\r\n * password never appears in the proxy address. `Socks5ProxyAgent` also accepts\r\n * userinfo in the URL, but `proxyUrl()` already emits the username there for\r\n * the HTTP case, and the explicit option takes precedence \u2014 so the password\r\n * stays out of the string that is logged and reported.\r\n */\r\nfunction createDispatcher(\r\n route: ProviderProxyRouteValue,\r\n url: string,\r\n password: string,\r\n): DispatcherLike {\r\n if (route.protocol === 'socks5') {\r\n const auth: { username?: string; password?: string } = {}\r\n if (route.username.length > 0) auth.username = route.username\r\n if (password.length > 0) auth.password = password\r\n return new Socks5ProxyAgent(url, auth) as unknown as DispatcherLike\r\n }\r\n return new ProxyAgent({ uri: url }) as unknown as DispatcherLike\r\n}\r\n\r\n/**\r\n * Build the dispatchers for every enabled, valid route.\r\n *\r\n * Invalid routes are skipped rather than thrown: one mistyped provider must not\r\n * stop the others from proxying. The caller surfaces the reason through\r\n * `problems`, which the Client shows instead of failing the whole table.\r\n */\r\nexport function createProxyTable(\r\n config: { readonly [provider: string]: Partial<ProviderProxyRouteValue> } | undefined,\r\n): { entries: Map<string, RouteEntry>; problems: Map<string, string> } {\r\n const entries = new Map<string, RouteEntry>()\r\n const problems = new Map<string, string>()\r\n\r\n for (const [provider, raw] of Object.entries(config ?? {})) {\r\n let route: ProviderProxyRouteValue\r\n try {\r\n route = normalizeRoute(provider, raw)\r\n } catch (error) {\r\n problems.set(provider, error instanceof Error ? error.message : String(error))\r\n continue\r\n }\r\n if (!route.enabled) continue\r\n\r\n // A SOCKS5 username without a password must be REFUSED, not downgraded.\r\n //\r\n // undici's Socks5Client only offers USERNAME_PASSWORD when both parts are\r\n // present (`if (options.username && options.password)`); with a username\r\n // alone it quietly advertises NO_AUTH. Against a proxy that requires\r\n // authentication the user would then be told \"Authentication failed\" \u2014 a\r\n // wrong diagnosis pointing at the proxy rather than at the missing setting.\r\n if (route.protocol === 'socks5' && route.username.length > 0 && route.password.length === 0) {\r\n problems.set(\r\n provider,\r\n 'dsh-provider-proxy: SOCKS5 \u914D\u7F6E\u4E86\u7528\u6237\u540D\u4F46\u6CA1\u6709\u5BC6\u7801\uFF1B\u8BF7\u8865\u5168\u5BC6\u7801\u6216\u6E05\u7A7A\u7528\u6237\u540D',\r\n )\r\n continue\r\n }\r\n\r\n const url = proxyUrl(route)\r\n let dispatcher: DispatcherLike\r\n try {\r\n dispatcher = createDispatcher(route, url, route.password)\r\n } catch (error) {\r\n problems.set(provider, error instanceof Error ? error.message : String(error))\r\n continue\r\n }\r\n entries.set(provider, { provider, proxyOrigin: displayOrigin(route, url), dispatcher })\r\n }\r\n\r\n return { entries, problems }\r\n}\r\n\r\n/** Close every dispatcher, ignoring individual failures. */\r\nexport async function closeTable(entries: Map<string, RouteEntry>): Promise<void> {\r\n const closing = [...entries.values()].map(entry => entry.dispatcher.close().catch(() => undefined))\r\n await Promise.allSettled(closing)\r\n entries.clear()\r\n}\r\n\r\nexport { proxyUrl }", "/**\r\n * Plugin Config.\r\n *\r\n * Shape notes, all verified against DeepSeek Harness 0.2.0-rc.2:\r\n *\r\n * - `schemastery` is NOT guaranteed to be resolvable from a profile-hoisted\r\n * install, so the real package is preferred at runtime when `createRequire`\r\n * can see it and a bundled fallback is used otherwise. The reference plugin\r\n * `dsh-llm-retry-settings` does exactly this.\r\n * - Every editable field is `.volatile()` so a settings write is committed\r\n * into the running fiber WITHOUT remounting the plugin; the Host then\r\n * rebuilds its proxy table. Ordinary (non-volatile) fields would restart the\r\n * plugin instead, which is not what a settings page wants.\r\n * - The SOCKS5 proxy password lives directly on the route as `password`, so the\r\n * settings page writes it into cordis.patch.yml in the clear. It is only ever\r\n * handed to `Socks5ProxyAgent` as an option, never embedded in the proxy URL\r\n * that is logged or shown in the diagnostics.\r\n */\r\n\r\nimport { createRequire } from 'node:module'\r\n\r\n// Imported statically so the bundler inlines it, making the package\r\n// self-contained. `loadSchemastery` below still PREFERS the profile's own copy\r\n// when one is reachable, so a DSH-provided instance stays authoritative; this\r\n// bundled copy is only the fallback that lets the plugin load at all.\r\nimport * as BundledSchema from '@deepseek-ai/schemastery'\r\n\r\ntype SchemaLike = {\r\n object: (...args: any[]) => any\r\n string: (...args: any[]) => any\r\n boolean: (...args: any[]) => any\r\n number: (...args: any[]) => any\r\n dict: (...args: any[]) => any\r\n union: (...args: any[]) => any\r\n}\r\n\r\n/**\r\n * Resolve the schemastery module for this fiber.\r\n *\r\n * A profile installation hoists dependencies next to the profile rather than\r\n * under this package, so a bare `import` can fail even when the Host itself\r\n * uses schemastery. `createRequire` resolves against this file's real\r\n * location, which is the best available view of the installation tree.\r\n *\r\n * When that finds nothing \u2014 a plain `npm install` of this package, which pulls\r\n * no schemastery \u2014 the BUNDLED copy is used, so the plugin still loads instead\r\n * of throwing at require time.\r\n */\r\nfunction loadSchemastery(): SchemaLike {\r\n try {\r\n const require = createRequire(import.meta.url)\r\n const candidate = require('@deepseek-ai/schemastery')\r\n const live = (candidate as { default?: SchemaLike })?.default ?? (candidate as SchemaLike)\r\n if (live && typeof live.object === 'function') return live\r\n } catch {\r\n // Fall through to the bundled copy below.\r\n }\r\n // The static import is only a fallback; what it actually exposes is decided at\r\n // runtime, which this structural type deliberately does not pin.\r\n const bundled = (BundledSchema as { default?: unknown }).default ?? BundledSchema\r\n if (typeof (bundled as SchemaLike).object === 'function') return bundled as SchemaLike\r\n throw new Error('dsh-provider-proxy: no usable @deepseek-ai/schemastery in this installation')\r\n}\r\n\r\nconst z = loadSchemastery()\r\n\r\n/** Apply `.volatile()` when the resolved schemastery supports it. */\r\nfunction vol<T>(field: T): T {\r\n const volatile = (field as { volatile?: () => unknown }).volatile\r\n return typeof volatile === 'function' ? (volatile.call(field) as T) : field\r\n}\r\n\r\n/** Forward-compatible passthrough for schemastery extensions used below. */\r\nfunction stepMin<T extends { step?: (n: number) => T; min?: (n: number) => T }>(field: T, step?: number): T {\r\n let out = field\r\n if (step !== undefined && typeof out.step === 'function') out = out.step(step)\r\n return out\r\n}\r\n\r\n/** Supported forward-proxy transports. */\r\nexport const PROTOCOLS = ['http', 'https', 'socks5'] as const\r\nexport type Protocol = (typeof PROTOCOLS)[number]\r\n\r\n/**\r\n * One provider's proxy settings. Keyed by provider route id.\r\n *\r\n * `port` is deliberately NOT constrained by schemastery's min/max: an unset\r\n * proxy is `0` (meaning \"no port chosen yet\"), and a bound of 1 here would make\r\n * that default fail to parse. The real range check lives in `normalizeRoute`,\r\n * which runs only when a route is actually enabled, so the error can name the\r\n * provider instead of surfacing a bare schema path.\r\n */\r\nexport const ProviderProxyRoute = z.object({\r\n /** Whether this provider's calls are routed through the proxy below. */\r\n enabled: z.boolean().default(false),\r\n /** Proxy transport. `socks5` is accepted but only honoured when the socks helper loaded. */\r\n protocol: z.union(PROTOCOLS).default('http'),\r\n /** Proxy host or IP, without scheme, port, or path. */\r\n host: z.string().default(''),\r\n /** Proxy port. 0 means \"not configured\"; enabled routes require 1-65535. */\r\n port: z.number().default(0),\r\n /** Optional proxy username. */\r\n username: z.string().default(''),\r\n /** SOCKS5 proxy password. Only used when `protocol` is `socks5`. */\r\n password: z.string().default(''),\r\n})\r\n\r\nexport const Config = z.object({\r\n /** Per-provider proxy routes, keyed by provider route id (e.g. `sensenova`). */\r\n providers: vol(z.dict(ProviderProxyRoute).default({})),\r\n})\r\n\r\nexport interface ProviderProxyRouteValue {\r\n enabled: boolean\r\n protocol: Protocol\r\n host: string\r\n port: number\r\n username: string\r\n password: string\r\n}\r\n\r\nexport interface ConfigShape {\r\n providers: { readonly [provider: string]: ProviderProxyRouteValue }\r\n}\r\n\r\n/**\r\n * Validate one route and return the normalized value, or throw with a\r\n * field-scoped message. Used by both the Host (before opening a dispatcher)\r\n * and the settings form (before writing), so an invalid value never reaches\r\n * disk or the network.\r\n */\r\nexport function normalizeRoute(\r\n provider: string,\r\n raw: Partial<ProviderProxyRouteValue> | undefined,\r\n): ProviderProxyRouteValue {\r\n const route = ProviderProxyRoute(raw ?? {})\r\n const value = typeof (route as { get?: () => unknown }).get === 'function'\r\n ? (route as unknown as { get: () => ProviderProxyRouteValue }).get()\r\n : (route as ProviderProxyRouteValue)\r\n\r\n if (!value.enabled) return { ...value, port: value.port || 0 }\r\n\r\n const host = value.host.trim()\r\n if (host.length === 0) {\r\n throw new TypeError(`dsh-provider-proxy: provider \"${provider}\" \u542F\u7528\u4E86\u4EE3\u7406\uFF0C\u4F46\u672A\u586B\u5199\u4EE3\u7406\u5730\u5740`)\r\n }\r\n if (/^[a-z][a-z0-9+.-]*:\\/\\//i.test(host) || host.includes('/')) {\r\n throw new TypeError(`dsh-provider-proxy: provider \"${provider}\" \u7684\u4EE3\u7406\u5730\u5740\u53EA\u586B\u4E3B\u673A\u540D\u6216 IP\uFF0C\u4E0D\u8981\u5E26\u534F\u8BAE\u524D\u7F00\u6216\u8DEF\u5F84`)\r\n }\r\n if (!Number.isInteger(value.port) || value.port < 1 || value.port > 65535) {\r\n throw new TypeError(\r\n `dsh-provider-proxy: provider \"${provider}\" \u7684\u4EE3\u7406\u7AEF\u53E3\u65E0\u6548\uFF08\u9700\u4E3A 1-65535 \u7684\u6574\u6570\uFF09`,\r\n )\r\n }\r\n return { ...value, host, username: value.username.trim() }\r\n}", "import { Binary, clone, createVolatile, deepEqual, filterKeys, isNullable, isPlainObject, isVolatile, pick, valueMap } from \"@deepseek-ai/cosmokit\";\n//#region lib/types/index.js\nconst kSchema = Symbol.for(\"schemastery\");\nconst kValidationError = Symbol.for(\"ValidationError\");\nglobalThis.__schemastery_index__ ??= 0;\nglobalThis.__schemastery_refs__ = void 0;\nvar ValidationError = class extends TypeError {\n\toptions;\n\tname = \"ValidationError\";\n\tconstructor(message, options) {\n\t\tlet prefix = \"$\";\n\t\tfor (const segment of options.path || []) if (typeof segment === \"string\") prefix += \".\" + segment;\n\t\telse if (typeof segment === \"number\") prefix += \"[\" + segment + \"]\";\n\t\telse if (typeof segment === \"symbol\") prefix += `[Symbol(${segment.toString()})]`;\n\t\tif (prefix.startsWith(\".\")) prefix = prefix.slice(1);\n\t\tsuper((prefix === \"$\" ? \"\" : `${prefix} `) + message);\n\t\tthis.options = options;\n\t}\n\tstatic is(error) {\n\t\treturn !!error?.[kValidationError];\n\t}\n};\nObject.defineProperty(ValidationError.prototype, kValidationError, { value: true });\nconst Schema = function(options) {\n\tconst schema = function(data, options = {}) {\n\t\treturn Schema.resolve(data, schema, options)[0];\n\t};\n\tif (options.refs) {\n\t\tconst refs = valueMap(options.refs, (options) => new Schema(options));\n\t\tconst getRef = (uid) => refs[uid];\n\t\tfor (const key in refs) {\n\t\t\tconst options = refs[key];\n\t\t\toptions.sKey = getRef(options.sKey);\n\t\t\toptions.inner = getRef(options.inner);\n\t\t\toptions.list = options.list && options.list.map(getRef);\n\t\t\toptions.dict = options.dict && valueMap(options.dict, getRef);\n\t\t}\n\t\treturn refs[options.uid];\n\t}\n\tObject.assign(schema, options);\n\tif (typeof schema.callback === \"string\") try {\n\t\tschema.callback = new Function(\"return \" + schema.callback)();\n\t} catch {}\n\tObject.defineProperty(schema, \"uid\", { value: globalThis.__schemastery_index__++ });\n\tObject.setPrototypeOf(schema, Schema.prototype);\n\tschema.meta ||= {};\n\tschema.toString = schema.toString.bind(schema);\n\treturn schema;\n};\nSchema.prototype = Object.create(Function.prototype);\nSchema.prototype[kSchema] = true;\nObject.defineProperty(Schema.prototype, \"~standard\", { get() {\n\treturn {\n\t\tversion: 1,\n\t\tvendor: \"schemastery\",\n\t\tvalidate: (value) => {\n\t\t\ttry {\n\t\t\t\treturn { value: Schema.resolve(value, this, {})[0] };\n\t\t\t} catch (error) {\n\t\t\t\tif (ValidationError.is(error)) return { issues: [{\n\t\t\t\t\tmessage: error.message,\n\t\t\t\t\tpath: error.options.path\n\t\t\t\t}] };\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t};\n} });\nSchema.ValidationError = ValidationError;\nSchema.prototype.toJSON = function toJSON() {\n\tif (globalThis.__schemastery_refs__) {\n\t\tglobalThis.__schemastery_refs__[this.uid] ??= JSON.parse(JSON.stringify({ ...this }));\n\t\treturn this.uid;\n\t}\n\tglobalThis.__schemastery_refs__ = { [this.uid]: { ...this } };\n\tglobalThis.__schemastery_refs__[this.uid] = JSON.parse(JSON.stringify({ ...this }));\n\tconst result = {\n\t\tuid: this.uid,\n\t\trefs: globalThis.__schemastery_refs__\n\t};\n\tglobalThis.__schemastery_refs__ = void 0;\n\treturn result;\n};\nSchema.prototype.set = function set(key, value) {\n\tthis.dict[key] = value;\n\treturn this;\n};\nSchema.prototype.push = function push(value) {\n\tthis.list.push(value);\n\treturn this;\n};\nfunction mergeDesc(original, messages) {\n\tconst result = typeof original === \"string\" ? { \"\": original } : { ...original };\n\tfor (const locale in messages) {\n\t\tconst value = messages[locale];\n\t\tif (value?.$description || value?.$desc) result[locale] = value.$description || value.$desc;\n\t\telse if (typeof value === \"string\") result[locale] = value;\n\t}\n\treturn result;\n}\nfunction getInner(value) {\n\treturn value?.$value ?? value?.$inner;\n}\nfunction extractKeys(data) {\n\treturn filterKeys(data ?? {}, (key) => !key.startsWith(\"$\"));\n}\nSchema.prototype.i18n = function i18n(messages) {\n\tconst schema = Schema(this);\n\tconst desc = mergeDesc(schema.meta.description, messages);\n\tif (Object.keys(desc).length) schema.meta.description = desc;\n\tif (schema.dict) schema.dict = valueMap(schema.dict, (inner, key) => {\n\t\treturn inner.i18n(valueMap(messages, (data) => getInner(data)?.[key] ?? data?.[key]));\n\t});\n\tif (schema.list) schema.list = schema.list.map((inner, index) => {\n\t\treturn inner.i18n(valueMap(messages, (data = {}) => {\n\t\t\tif (Array.isArray(getInner(data))) return getInner(data)[index];\n\t\t\tif (Array.isArray(data)) return data[index];\n\t\t\treturn extractKeys(data);\n\t\t}));\n\t});\n\tif (schema.inner) schema.inner = schema.inner.i18n(valueMap(messages, (data) => {\n\t\tif (getInner(data)) return getInner(data);\n\t\treturn extractKeys(data);\n\t}));\n\tif (schema.sKey) schema.sKey = schema.sKey.i18n(valueMap(messages, (data) => data?.$key));\n\treturn schema;\n};\nSchema.prototype.extra = function extra(key, value) {\n\tconst schema = Schema(this);\n\tschema.meta = {\n\t\t...schema.meta,\n\t\t[key]: value\n\t};\n\treturn schema;\n};\nfor (const key of [\n\t\"required\",\n\t\"disabled\",\n\t\"collapse\",\n\t\"hidden\",\n\t\"loose\"\n]) Object.assign(Schema.prototype, { [key](value = true) {\n\tconst schema = Schema(this);\n\tschema.meta = {\n\t\t...schema.meta,\n\t\t[key]: value\n\t};\n\treturn schema;\n} });\nSchema.prototype.deprecated = function deprecated() {\n\tconst schema = Schema(this);\n\tschema.meta.badges ||= [];\n\tschema.meta.badges.push({\n\t\ttext: \"deprecated\",\n\t\ttype: \"danger\"\n\t});\n\treturn schema;\n};\nSchema.prototype.experimental = function experimental() {\n\tconst schema = Schema(this);\n\tschema.meta.badges ||= [];\n\tschema.meta.badges.push({\n\t\ttext: \"experimental\",\n\t\ttype: \"warning\"\n\t});\n\treturn schema;\n};\nSchema.prototype.pattern = function pattern(regexp) {\n\tconst schema = Schema(this);\n\tconst pattern = pick(regexp, [\"source\", \"flags\"]);\n\tschema.meta = {\n\t\t...schema.meta,\n\t\tpattern\n\t};\n\treturn schema;\n};\nSchema.prototype.simplify = function simplify(value) {\n\tif (isVolatile(value)) value = value.get();\n\tif (deepEqual(value, this.meta.default, this.type === \"dict\")) return null;\n\tif (isNullable(value)) return value;\n\tif (this.type === \"object\" || this.type === \"dict\") {\n\t\tconst result = {};\n\t\tfor (const key in value) {\n\t\t\tconst item = (this.type === \"object\" ? this.dict[key] : this.inner)?.simplify(value[key]);\n\t\t\tif (this.type === \"dict\" || !isNullable(item)) result[key] = item;\n\t\t}\n\t\tif (deepEqual(result, this.meta.default, this.type === \"dict\")) return null;\n\t\treturn result;\n\t} else if (this.type === \"array\" || this.type === \"tuple\") {\n\t\tconst result = [];\n\t\tvalue.forEach((value, index) => {\n\t\t\tconst schema = this.type === \"array\" ? this.inner : this.list[index];\n\t\t\tconst item = schema ? schema.simplify(value) : value;\n\t\t\tresult.push(item);\n\t\t});\n\t\treturn result;\n\t} else if (this.type === \"intersect\") {\n\t\tconst result = {};\n\t\tfor (const item of this.list) Object.assign(result, item.simplify(value));\n\t\treturn result;\n\t} else if (this.type === \"union\") for (const schema of this.list) try {\n\t\tSchema.resolve(value, schema, {});\n\t\treturn schema.simplify(value);\n\t} catch {}\n\treturn value;\n};\nSchema.prototype.toString = function toString(inline) {\n\treturn formatters[this.type]?.(this, inline) ?? `Schema<${this.type}>`;\n};\nSchema.prototype.role = function role(role, extra) {\n\tconst schema = Schema(this);\n\tschema.meta = {\n\t\t...schema.meta,\n\t\trole,\n\t\textra\n\t};\n\treturn schema;\n};\nfor (const key of [\n\t\"default\",\n\t\"link\",\n\t\"comment\",\n\t\"description\",\n\t\"max\",\n\t\"min\",\n\t\"step\"\n]) Object.assign(Schema.prototype, { [key](value) {\n\tconst schema = Schema(this);\n\tschema.meta = {\n\t\t...schema.meta,\n\t\t[key]: value\n\t};\n\treturn schema;\n} });\nSchema.prototype.volatile = function volatile() {\n\tif (this.meta.volatile) throw new TypeError(\"volatile schema is already wrapped\");\n\treturn this.extra(\"volatile\", true);\n};\nconst resolvers = {};\nconst checkedVolatile = Symbol(\"checked-volatile-schema\");\nfunction validateVolatileSchema(schema, path = [], blocked = false, seen = /* @__PURE__ */ new Map()) {\n\tconst states = seen.get(schema) ?? /* @__PURE__ */ new Set();\n\tif (states.has(blocked)) return;\n\tstates.add(blocked);\n\tseen.set(schema, states);\n\tif (schema.meta?.volatile && blocked) throw new ValidationError(\"volatile fields require a fixed object path without an enclosing volatile field\", { path });\n\tconst nested = blocked || !!schema.meta?.volatile;\n\tif (schema.dict) for (const [key, child] of Object.entries(schema.dict)) validateVolatileSchema(child, [...path, key], nested, seen);\n\tif (schema.sKey) validateVolatileSchema(schema.sKey, [...path, \"<key>\"], true, seen);\n\tif (schema.inner && (schema.type !== \"lazy\" || schema.inner[kSchema])) validateVolatileSchema(schema.inner, [...path, \"*\"], true, seen);\n\tif (schema.list) for (let index = 0; index < schema.list.length; index++) validateVolatileSchema(schema.list[index], [...path, String(index)], true, seen);\n}\nSchema.extend = function extend(type, resolve) {\n\tresolvers[type] = resolve;\n};\nSchema.resolve = function resolve(data, schema, options = {}, strict = false) {\n\tif (!schema) return [data];\n\tif (!options[checkedVolatile]) {\n\t\tvalidateVolatileSchema(schema, options.path);\n\t\toptions = {\n\t\t\t...options,\n\t\t\t[checkedVolatile]: true\n\t\t};\n\t}\n\tif (schema.meta?.volatile) {\n\t\tconst inner = Schema(schema);\n\t\tinner.meta = {\n\t\t\t...schema.meta,\n\t\t\tvolatile: false\n\t\t};\n\t\tconst [value, adapted] = Schema.resolve(data, inner, options, strict);\n\t\ttry {\n\t\t\treturn [createVolatile(value), adapted];\n\t\t} catch (error) {\n\t\t\tthrow new ValidationError(error instanceof Error ? error.message : String(error), options);\n\t\t}\n\t}\n\tif (options.ignore?.(data, schema)) return [data];\n\tif (isNullable(data) && schema.type !== \"lazy\") {\n\t\tif (schema.meta.required) throw new ValidationError(`missing required value`, options);\n\t\tlet current = schema;\n\t\tlet fallback = schema.meta.default;\n\t\twhile (current?.type === \"intersect\" && isNullable(fallback)) {\n\t\t\tcurrent = current.list[0];\n\t\t\tfallback = current?.meta.default;\n\t\t}\n\t\tif (isNullable(fallback)) return [data];\n\t\tdata = clone(fallback);\n\t}\n\tconst callback = resolvers[schema.type];\n\tif (!callback) throw new ValidationError(`unsupported type \"${schema.type}\"`, options);\n\ttry {\n\t\treturn callback(data, schema, options, strict);\n\t} catch (error) {\n\t\tif (!schema.meta.loose) throw error;\n\t\treturn [schema.meta.default];\n\t}\n};\nSchema.from = function from(source) {\n\tif (isNullable(source)) return Schema.any();\n\telse if ([\n\t\t\"string\",\n\t\t\"number\",\n\t\t\"boolean\"\n\t].includes(typeof source)) return Schema.const(source).required();\n\telse if (source[kSchema]) return source;\n\telse if (typeof source === \"function\") switch (source) {\n\t\tcase String: return Schema.string().required();\n\t\tcase Number: return Schema.number().required();\n\t\tcase Boolean: return Schema.boolean().required();\n\t\tcase Function: return Schema.function().required();\n\t\tdefault: return Schema.is(source).required();\n\t}\n\telse throw new TypeError(`cannot infer schema from ${source}`);\n};\nSchema.lazy = function lazy(builder) {\n\tconst toJSON = () => {\n\t\tif (!schema.inner[kSchema]) {\n\t\t\tschema.inner = schema.builder();\n\t\t\tschema.inner.meta = {\n\t\t\t\t...schema.meta,\n\t\t\t\t...schema.inner.meta\n\t\t\t};\n\t\t}\n\t\treturn schema.inner.toJSON();\n\t};\n\tconst schema = new Schema({\n\t\ttype: \"lazy\",\n\t\tbuilder,\n\t\tinner: { toJSON }\n\t});\n\treturn schema;\n};\nSchema.natural = function natural() {\n\treturn Schema.number().step(1).min(0);\n};\nSchema.percent = function percent() {\n\treturn Schema.number().step(.01).min(0).max(1).role(\"slider\");\n};\nSchema.date = function date() {\n\treturn Schema.union([Schema.is(Date), Schema.transform(Schema.string().role(\"datetime\"), (value, options) => {\n\t\tconst date = new Date(value);\n\t\tif (isNaN(+date)) throw new ValidationError(`invalid date \"${value}\"`, options);\n\t\treturn date;\n\t}, true)]);\n};\nSchema.regExp = function regExp(flag = \"\") {\n\treturn Schema.union([Schema.is(RegExp), Schema.transform(Schema.string().role(\"regexp\", { flag }), (value, options) => {\n\t\ttry {\n\t\t\treturn new RegExp(value, flag);\n\t\t} catch (e) {\n\t\t\tthrow new ValidationError(e.message, options);\n\t\t}\n\t}, true)]);\n};\nSchema.arrayBuffer = function arrayBuffer(encoding) {\n\treturn Schema.union([\n\t\tSchema.is(ArrayBuffer),\n\t\tSchema.is(SharedArrayBuffer),\n\t\tSchema.transform(Schema.any(), (value, options) => {\n\t\t\tif (Binary.isSource(value)) return Binary.fromSource(value);\n\t\t\tthrow new ValidationError(`expected ArrayBufferSource but got ${value}`, options);\n\t\t}, true),\n\t\t...encoding ? [Schema.transform(Schema.string(), (value, options) => {\n\t\t\ttry {\n\t\t\t\treturn encoding === \"base64\" ? Binary.fromBase64(value) : Binary.fromHex(value);\n\t\t\t} catch (e) {\n\t\t\t\tthrow new ValidationError(e.message, options);\n\t\t\t}\n\t\t}, true)] : []\n\t]);\n};\nSchema.extend(\"lazy\", (data, schema, options, strict) => {\n\tif (!schema.inner[kSchema]) {\n\t\tschema.inner = schema.builder();\n\t\tschema.inner.meta = {\n\t\t\t...schema.meta,\n\t\t\t...schema.inner.meta\n\t\t};\n\t\tvalidateVolatileSchema(schema.inner, options.path, true);\n\t}\n\treturn Schema.resolve(data, schema.inner, options, strict);\n});\nSchema.extend(\"any\", (data) => {\n\treturn [data];\n});\nSchema.extend(\"never\", (data, _, options) => {\n\tthrow new ValidationError(`expected nullable but got ${data}`, options);\n});\nSchema.extend(\"const\", (data, { value }, options) => {\n\tif (deepEqual(data, value)) return [value];\n\tthrow new ValidationError(`expected ${value} but got ${data}`, options);\n});\nfunction checkWithinRange(data, meta, description, options, skipMin = false) {\n\tconst { max = Infinity, min = -Infinity } = meta;\n\tif (data > max) throw new ValidationError(`expected ${description} <= ${max} but got ${data}`, options);\n\tif (data < min && !skipMin) throw new ValidationError(`expected ${description} >= ${min} but got ${data}`, options);\n}\nSchema.extend(\"string\", (data, { meta }, options) => {\n\tif (typeof data !== \"string\") throw new ValidationError(`expected string but got ${data}`, options);\n\tif (meta.pattern) {\n\t\tconst regexp = new RegExp(meta.pattern.source, meta.pattern.flags);\n\t\tif (!regexp.test(data)) throw new ValidationError(`expect string to match regexp ${regexp}`, options);\n\t}\n\tcheckWithinRange(data.length, meta, \"string length\", options);\n\treturn [data];\n});\nfunction decimalShift(data, digits) {\n\tconst str = data.toString();\n\tif (str.includes(\"e\")) return data * Math.pow(10, digits);\n\tconst index = str.indexOf(\".\");\n\tif (index === -1) return data * Math.pow(10, digits);\n\tconst frac = str.slice(index + 1);\n\tconst integer = str.slice(0, index);\n\tif (frac.length <= digits) return +(integer + frac.padEnd(digits, \"0\"));\n\treturn +(integer + frac.slice(0, digits) + \".\" + frac.slice(digits));\n}\nfunction isMultipleOf(data, min, step) {\n\tstep = Math.abs(step);\n\tif (!/^\\d+\\.\\d+$/.test(step.toString())) return (data - min) % step === 0;\n\tconst index = step.toString().indexOf(\".\");\n\tconst digits = step.toString().slice(index + 1).length;\n\treturn Math.abs(decimalShift(data, digits) - decimalShift(min, digits)) % decimalShift(step, digits) === 0;\n}\nSchema.extend(\"number\", (data, { meta }, options) => {\n\tif (typeof data !== \"number\") throw new ValidationError(`expected number but got ${data}`, options);\n\tcheckWithinRange(data, meta, \"number\", options);\n\tconst { step } = meta;\n\tif (step && !isMultipleOf(data, meta.min ?? 0, step)) throw new ValidationError(`expected number multiple of ${step} but got ${data}`, options);\n\treturn [data];\n});\nSchema.extend(\"boolean\", (data, _, options) => {\n\tif (typeof data === \"boolean\") return [data];\n\tthrow new ValidationError(`expected boolean but got ${data}`, options);\n});\nSchema.extend(\"bitset\", (data, { bits, meta }, options) => {\n\tlet value = 0, keys = [];\n\tif (typeof data === \"number\") {\n\t\tvalue = data;\n\t\tfor (const key in bits) if (data & bits[key]) keys.push(key);\n\t} else if (Array.isArray(data)) {\n\t\tkeys = data;\n\t\tfor (const key of keys) {\n\t\t\tif (typeof key !== \"string\") throw new ValidationError(`expected string but got ${key}`, options);\n\t\t\tif (key in bits) value |= bits[key];\n\t\t}\n\t} else throw new ValidationError(`expected number or array but got ${data}`, options);\n\tif (value === meta.default) return [value];\n\treturn [value, keys];\n});\nSchema.extend(\"function\", (data, _, options) => {\n\tif (typeof data === \"function\") return [data];\n\tthrow new ValidationError(`expected function but got ${data}`, options);\n});\nSchema.extend(\"is\", (data, { constructor }, options) => {\n\tif (typeof constructor === \"function\") {\n\t\tif (data instanceof constructor) return [data];\n\t\tthrow new ValidationError(`expected ${constructor.name} but got ${data}`, options);\n\t} else {\n\t\tif (isNullable(data)) throw new ValidationError(`expected ${constructor} but got ${data}`, options);\n\t\tlet prototype = Object.getPrototypeOf(data);\n\t\twhile (prototype) {\n\t\t\tif (prototype.constructor?.name === constructor) return [data];\n\t\t\tprototype = Object.getPrototypeOf(prototype);\n\t\t}\n\t\tthrow new ValidationError(`expected ${constructor} but got ${data}`, options);\n\t}\n});\nfunction property(data, key, schema, options) {\n\ttry {\n\t\tconst [value, adapted] = Schema.resolve(data[key], schema, {\n\t\t\t...options,\n\t\t\tpath: [...options.path || [], key]\n\t\t});\n\t\tif (adapted !== void 0) data[key] = adapted;\n\t\treturn value;\n\t} catch (e) {\n\t\tif (!options?.autofix) throw e;\n\t\tdelete data[key];\n\t\treturn schema.meta.volatile ? createVolatile(schema.meta.default) : schema.meta.default;\n\t}\n}\nSchema.extend(\"array\", (data, { inner, meta }, options) => {\n\tif (!Array.isArray(data)) throw new ValidationError(`expected array but got ${data}`, options);\n\tcheckWithinRange(data.length, meta, \"array length\", options, !isNullable(inner.meta.default));\n\treturn [data.map((_, index) => property(data, index, inner, options))];\n});\nSchema.extend(\"dict\", (data, { inner, sKey }, options, strict) => {\n\tif (!isPlainObject(data)) throw new ValidationError(`expected object but got ${data}`, options);\n\tconst result = {};\n\tfor (const key in data) {\n\t\tlet rKey;\n\t\ttry {\n\t\t\trKey = Schema.resolve(key, sKey, options)[0];\n\t\t} catch (error) {\n\t\t\tif (strict) continue;\n\t\t\tthrow error;\n\t\t}\n\t\tresult[rKey] = property(data, key, inner, options);\n\t\tdata[rKey] = data[key];\n\t\tif (key !== rKey) delete data[key];\n\t}\n\treturn [result];\n});\nSchema.extend(\"tuple\", (data, { list }, options, strict) => {\n\tif (!Array.isArray(data)) throw new ValidationError(`expected array but got ${data}`, options);\n\tconst result = list.map((inner, index) => property(data, index, inner, options));\n\tif (strict) return [result];\n\tresult.push(...data.slice(list.length));\n\treturn [result];\n});\nfunction merge(result, data) {\n\tfor (const key in data) {\n\t\tif (key in result) continue;\n\t\tresult[key] = data[key];\n\t}\n}\nSchema.extend(\"object\", (data, { dict }, options, strict) => {\n\tif (!isPlainObject(data)) throw new ValidationError(`expected object but got ${data}`, options);\n\tconst result = {};\n\tfor (const key in dict) {\n\t\tconst value = property(data, key, dict[key], options);\n\t\tif (!isNullable(value) || key in data) result[key] = value;\n\t}\n\tif (!strict) merge(result, data);\n\treturn [result];\n});\nSchema.extend(\"union\", (data, { list, toString }, options, strict) => {\n\tconst messages = [];\n\tfor (const inner of list) try {\n\t\treturn Schema.resolve(data, inner, options, strict);\n\t} catch (error) {\n\t\tmessages.push(error);\n\t}\n\tthrow new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options);\n});\nSchema.extend(\"intersect\", (data, { list, toString }, options, strict) => {\n\tif (!list.length) return [data];\n\tlet result;\n\tfor (const inner of list) {\n\t\tconst value = Schema.resolve(data, inner, options, true)[0];\n\t\tif (isNullable(value)) continue;\n\t\tif (isNullable(result)) result = value;\n\t\telse if (typeof result !== typeof value) throw new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options);\n\t\telse if (typeof value === \"object\") merge(result ??= {}, value);\n\t\telse if (result !== value) throw new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options);\n\t}\n\tif (!strict && isPlainObject(data)) merge(result, data);\n\treturn [result];\n});\nSchema.extend(\"transform\", (data, { inner, callback, preserve }, options) => {\n\tconst [result, adapted = data] = Schema.resolve(data, inner, options, true);\n\tif (preserve) return [callback(result)];\n\telse return [callback(result), callback(adapted)];\n});\nconst formatters = {};\nfunction defineMethod(name, keys, format) {\n\tformatters[name] = format;\n\tObject.assign(Schema, { [name](...args) {\n\t\tconst schema = new Schema({ type: name });\n\t\tkeys.forEach((key, index) => {\n\t\t\tswitch (key) {\n\t\t\t\tcase \"sKey\":\n\t\t\t\t\tschema.sKey = args[index] ?? Schema.string();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"inner\":\n\t\t\t\t\tschema.inner = Schema.from(args[index]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"list\":\n\t\t\t\t\tschema.list = args[index].map(Schema.from);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"dict\":\n\t\t\t\t\tschema.dict = valueMap(args[index], Schema.from);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"bits\":\n\t\t\t\t\tschema.bits = {};\n\t\t\t\t\tfor (const key in args[index]) {\n\t\t\t\t\t\tif (typeof args[index][key] !== \"number\") continue;\n\t\t\t\t\t\tschema.bits[key] = args[index][key];\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"callback\": {\n\t\t\t\t\tconst callback = schema.callback = args[index];\n\t\t\t\t\tcallback[\"toJSON\"] ||= () => callback.toString();\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"constructor\": {\n\t\t\t\t\tconst constructor = schema.constructor = args[index];\n\t\t\t\t\tif (typeof constructor === \"function\") constructor[\"toJSON\"] ||= () => constructor[\"name\"];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault: schema[key] = args[index];\n\t\t\t}\n\t\t});\n\t\tif (name === \"object\" || name === \"dict\") schema.meta.default = {};\n\t\telse if (name === \"array\" || name === \"tuple\") schema.meta.default = [];\n\t\telse if (name === \"bitset\") schema.meta.default = 0;\n\t\treturn schema;\n\t} });\n}\ndefineMethod(\"is\", [\"constructor\"], ({ constructor }) => {\n\tif (typeof constructor === \"function\") return constructor.name;\n\telse return constructor;\n});\ndefineMethod(\"any\", [], () => \"any\");\ndefineMethod(\"never\", [], () => \"never\");\ndefineMethod(\"const\", [\"value\"], ({ value }) => typeof value === \"string\" ? JSON.stringify(value) : value);\ndefineMethod(\"string\", [], () => \"string\");\ndefineMethod(\"number\", [], () => \"number\");\ndefineMethod(\"boolean\", [], () => \"boolean\");\ndefineMethod(\"bitset\", [\"bits\"], () => \"bitset\");\ndefineMethod(\"function\", [], () => \"function\");\ndefineMethod(\"array\", [\"inner\"], ({ inner }) => `${inner.toString(true)}[]`);\ndefineMethod(\"dict\", [\"inner\", \"sKey\"], ({ inner, sKey }) => `{ [key: ${sKey.toString()}]: ${inner.toString()} }`);\ndefineMethod(\"tuple\", [\"list\"], ({ list }) => `[${list.map((inner) => inner.toString()).join(\", \")}]`);\ndefineMethod(\"object\", [\"dict\"], ({ dict }) => {\n\tif (Object.keys(dict).length === 0) return \"{}\";\n\treturn `{ ${Object.entries(dict).map(([key, inner]) => {\n\t\treturn `${key}${inner.meta.required ? \"\" : \"?\"}: ${inner.toString()}`;\n\t}).join(\", \")} }`;\n});\ndefineMethod(\"union\", [\"list\"], ({ list }, inline) => {\n\tconst result = list.map(({ toString: format }) => format()).join(\" | \");\n\treturn inline ? `(${result})` : result;\n});\ndefineMethod(\"intersect\", [\"list\"], ({ list }) => {\n\treturn `${list.map((inner) => inner.toString(true)).join(\" & \")}`;\n});\ndefineMethod(\"transform\", [\n\t\"inner\",\n\t\"callback\",\n\t\"preserve\"\n], ({ inner }, isInner) => inner.toString(isInner));\n//#endregion\nexport { Schema as default };\n", "//#region lib/types/misc.js\n/** No-op callback returning `undefined` at runtime and `any` at type level. */\nfunction noop() {}\n/** Return true when a value is `null` or `undefined`. */\nfunction isNullable(value) {\n\treturn value === null || value === void 0;\n}\n/** Return true when a value is neither `null` nor `undefined`. */\nfunction isNonNullable(value) {\n\treturn !isNullable(value);\n}\n/** Return true for non-array object values. */\nfunction isPlainObject(data) {\n\treturn data && typeof data === \"object\" && !Array.isArray(data);\n}\n/** Filter object entries and return a new object. */\nfunction filterKeys(object, filter) {\n\treturn Object.fromEntries(Object.entries(object).filter(([key, value]) => filter(key, value)));\n}\n/** Map object values while preserving the original key set. */\nfunction mapValues(object, transform) {\n\treturn Object.fromEntries(Object.entries(object).map(([key, value]) => [key, transform(value, key)]));\n}\n/** Pick selected keys from an object, optionally including `undefined` values. */\nfunction pick(source, keys, forced) {\n\tif (!keys) return { ...source };\n\tconst result = {};\n\tfor (const key of keys) if (forced || source[key] !== void 0) result[key] = source[key];\n\treturn result;\n}\n/** Omit selected keys from a shallow object copy. */\nfunction omit(source, keys) {\n\tif (!keys) return { ...source };\n\tconst result = { ...source };\n\tfor (const key of keys) Reflect.deleteProperty(result, key);\n\treturn result;\n}\n/** Define a non-enumerable writable property and return the object. */\nfunction defineProperty(object, key, value) {\n\treturn Object.defineProperty(object, key, {\n\t\twritable: true,\n\t\tvalue,\n\t\tenumerable: false\n\t});\n}\n//#endregion\n//#region lib/types/array.js\n/** Return true when every item in `array2` is present in `array1`. */\nfunction contain(array1, array2) {\n\treturn array2.every((item) => array1.includes(item));\n}\n/** Return items that appear in both arrays. */\nfunction intersection(array1, array2) {\n\treturn array1.filter((item) => array2.includes(item));\n}\n/** Return items from `array1` that do not appear in `array2`. */\nfunction difference(array1, array2) {\n\treturn array1.filter((item) => !array2.includes(item));\n}\n/** Return the set-union of two arrays while preserving first occurrence order. */\nfunction union(array1, array2) {\n\treturn Array.from(new Set([...array1, ...array2]));\n}\n/** Remove duplicate values while preserving first occurrence order. */\nfunction deduplicate(array) {\n\treturn [...new Set(array)];\n}\n/** Remove one item from an array and report whether it was found. */\nfunction remove(list, item) {\n\tconst index = list?.indexOf(item);\n\tif (index >= 0) {\n\t\tlist.splice(index, 1);\n\t\treturn true;\n\t} else return false;\n}\n/** Normalize nullish, scalar, or array input to an array. */\nfunction makeArray(source) {\n\treturn Array.isArray(source) ? source : isNullable(source) ? [] : [source];\n}\n//#endregion\n//#region lib/types/volatile.js\n/** Shared config references used by schema validators and plugin runtimes. */\nconst write = Symbol.for(\"cosmokit.volatile.write\");\nfunction snapshot(value, ancestors = /* @__PURE__ */ new Set()) {\n\tif (typeof value === \"function\") throw new TypeError(\"volatile config cannot contain functions\");\n\tif (value === null || typeof value !== \"object\") return value;\n\tif (ancestors.has(value)) throw new TypeError(\"volatile config cannot contain cycles\");\n\tancestors.add(value);\n\ttry {\n\t\tif (Array.isArray(value)) return Object.freeze(value.map((item) => snapshot(item, ancestors)));\n\t\tif (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) throw new TypeError(\"volatile config objects must be plain objects or arrays\");\n\t\treturn Object.freeze(Object.fromEntries(Object.entries(value).map(([key, item]) => [key, snapshot(item, ancestors)])));\n\t} finally {\n\t\tancestors.delete(value);\n\t}\n}\n/**\n* Create a detached reference containing an immutable copy of the supplied data.\n* @param value - validated config data; class instances and functions are unsupported.\n* @returns a reference whose value is updated only by its owning runtime.\n*/\nfunction createVolatile(value) {\n\tlet current = snapshot(value);\n\treturn Object.freeze({\n\t\tget: () => current,\n\t\t[write]: (value) => {\n\t\t\tcurrent = value;\n\t\t}\n\t});\n}\n/**\n* Identify references across ESM/CJS copies of the shared library.\n* @param value - a parsed config value.\n* @returns whether the value implements the shared reference protocol.\n*/\nfunction isVolatile(value) {\n\treturn typeof value === \"object\" && value !== null && write in value;\n}\n/**\n* Collect config references without descending into their snapshots or opaque objects.\n* @internal\n* @param value - parsed config; cyclic ordinary fields are visited once per path.\n* @returns references and their object-key paths, including an empty path for a root reference.\n*/\nfunction volatileEntries(value) {\n\tconst ancestors = /* @__PURE__ */ new Set();\n\tfunction visit(value, path) {\n\t\tif (isVolatile(value)) return [{\n\t\t\tpath,\n\t\t\tref: value\n\t\t}];\n\t\tif (!value || typeof value !== \"object\" || ancestors.has(value)) return [];\n\t\tif (!Array.isArray(value) && Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) return [];\n\t\tancestors.add(value);\n\t\ttry {\n\t\t\treturn Object.entries(value).flatMap(([key, child]) => visit(child, [...path, key]));\n\t\t} finally {\n\t\t\tancestors.delete(value);\n\t\t}\n\t}\n\treturn visit(value, []);\n}\n/**\n* Commit an already validated immutable snapshot from another reference.\n* @internal\n* @param target - the owning plugin's stable reference.\n* @param source - a newly parsed candidate reference.\n*/\nfunction updateVolatile(target, source) {\n\ttarget[write](source.get());\n}\n//#endregion\n//#region lib/types/types.js\n/** Test values using `instanceof` with a `toStringTag` fallback. */\nfunction is(type, value) {\n\tif (arguments.length === 1) return (value) => is(type, value);\n\treturn type in globalThis && value instanceof globalThis[type] || Object.prototype.toString.call(value).slice(8, -1) === type;\n}\nfunction isArrayBufferLike(value) {\n\treturn is(\"ArrayBuffer\", value) || is(\"SharedArrayBuffer\", value);\n}\nfunction isArrayBufferSource(value) {\n\treturn isArrayBufferLike(value) || ArrayBuffer.isView(value);\n}\n/** Binary source detection and base64/hex conversion helpers. */\nvar Binary;\n(function(Binary) {\n\tBinary.is = isArrayBufferLike;\n\tBinary.isSource = isArrayBufferSource;\n\tfunction fromSource(source) {\n\t\tif (ArrayBuffer.isView(source)) return source.buffer.slice(source.byteOffset, source.byteOffset + source.byteLength);\n\t\telse return source;\n\t}\n\tBinary.fromSource = fromSource;\n\tfunction toBase64(source) {\n\t\tsource = fromSource(source);\n\t\tif (typeof Buffer !== \"undefined\") return Buffer.from(source).toString(\"base64\");\n\t\tlet binary = \"\";\n\t\tconst bytes = new Uint8Array(source);\n\t\tfor (let i = 0; i < bytes.byteLength; i++) binary += String.fromCharCode(bytes[i]);\n\t\treturn btoa(binary);\n\t}\n\tBinary.toBase64 = toBase64;\n\tfunction fromBase64(source) {\n\t\tif (typeof Buffer !== \"undefined\") return fromSource(Buffer.from(source, \"base64\"));\n\t\treturn Uint8Array.from(atob(source), (c) => c.charCodeAt(0));\n\t}\n\tBinary.fromBase64 = fromBase64;\n\tfunction toHex(source) {\n\t\tsource = fromSource(source);\n\t\tif (typeof Buffer !== \"undefined\") return Buffer.from(source).toString(\"hex\");\n\t\treturn Array.from(new Uint8Array(source), (byte) => byte.toString(16).padStart(2, \"0\")).join(\"\");\n\t}\n\tBinary.toHex = toHex;\n\tfunction fromHex(source) {\n\t\tif (typeof Buffer !== \"undefined\") return fromSource(Buffer.from(source, \"hex\"));\n\t\tconst hex = source.length % 2 === 0 ? source : source.slice(0, source.length - 1);\n\t\tconst buffer = [];\n\t\tfor (let i = 0; i < hex.length; i += 2) buffer.push(parseInt(`${hex[i]}${hex[i + 1]}`, 16));\n\t\treturn Uint8Array.from(buffer).buffer;\n\t}\n\tBinary.fromHex = fromHex;\n})(Binary || (Binary = {}));\n/** Decode a base64 string into binary data. */\nconst base64ToArrayBuffer = Binary.fromBase64;\n/** Encode binary data as base64. */\nconst arrayBufferToBase64 = Binary.toBase64;\n/** Decode a hex string into binary data. */\nconst hexToArrayBuffer = Binary.fromHex;\n/** Encode binary data as hex. */\nconst arrayBufferToHex = Binary.toHex;\n/** Deep-clone common JavaScript values while preserving prototypes and cycles. */\nfunction clone(source, refs = /* @__PURE__ */ new Map()) {\n\tif (!source || typeof source !== \"object\") return source;\n\tif (is(\"Date\", source)) return new Date(source.valueOf());\n\tif (is(\"RegExp\", source)) return new RegExp(source.source, source.flags);\n\tif (isArrayBufferLike(source)) return source.slice(0);\n\tif (ArrayBuffer.isView(source)) return source.buffer.slice(source.byteOffset, source.byteOffset + source.byteLength);\n\tconst cached = refs.get(source);\n\tif (cached) return cached;\n\tif (Array.isArray(source)) {\n\t\tconst result = [];\n\t\trefs.set(source, result);\n\t\tsource.forEach((value, index) => {\n\t\t\tresult[index] = Reflect.apply(clone, null, [value, refs]);\n\t\t});\n\t\treturn result;\n\t}\n\tconst result = Object.create(Object.getPrototypeOf(source));\n\trefs.set(source, result);\n\tfor (const key of Reflect.ownKeys(source)) {\n\t\tconst descriptor = { ...Reflect.getOwnPropertyDescriptor(source, key) };\n\t\tif (\"value\" in descriptor) descriptor.value = Reflect.apply(clone, null, [descriptor.value, refs]);\n\t\tReflect.defineProperty(result, key, descriptor);\n\t}\n\treturn result;\n}\n/**\n* Compare values recursively, treating two volatile references as equal regardless of value.\n* Strict comparison distinguishes null/undefined, treats opaque objects by identity,\n* compares URLs by normalized href, treats array holes as undefined, and considers distinct cyclic structures unequal.\n* @param a - first value.\n* @param b - second value.\n* @param strict - whether to require strict data equality outside volatile references.\n* @returns whether the values compare equal.\n*/\nfunction deepEqual(a, b, strict) {\n\tconst ancestors = /* @__PURE__ */ new Set();\n\tfunction compare(a, b) {\n\t\tif (a === b) return true;\n\t\tif (isVolatile(a) || isVolatile(b)) return isVolatile(a) && isVolatile(b);\n\t\tif (!strict && isNullable(a) && isNullable(b)) return true;\n\t\tif (typeof a !== typeof b || typeof a !== \"object\" || !a || !b) return false;\n\t\tif (ancestors.has(a)) return false;\n\t\tfunction check(test, then) {\n\t\t\treturn test(a) ? test(b) ? then(a, b) : false : test(b) ? false : void 0;\n\t\t}\n\t\tancestors.add(a);\n\t\ttry {\n\t\t\treturn check(Array.isArray, (a, b) => {\n\t\t\t\tif (a.length !== b.length) return false;\n\t\t\t\tfor (let index = 0; index < a.length; index++) if (!compare(a[index], b[index])) return false;\n\t\t\t\treturn true;\n\t\t\t}) ?? check(is(\"Date\"), (a, b) => a.valueOf() === b.valueOf()) ?? check(is(\"URL\"), (a, b) => a.href === b.href) ?? check(is(\"RegExp\"), (a, b) => a.source === b.source && a.flags === b.flags) ?? check(isArrayBufferLike, (a, b) => {\n\t\t\t\tif (a.byteLength !== b.byteLength) return false;\n\t\t\t\tconst viewA = new Uint8Array(a);\n\t\t\t\tconst viewB = new Uint8Array(b);\n\t\t\t\tfor (let i = 0; i < viewA.length; i++) if (viewA[i] !== viewB[i]) return false;\n\t\t\t\treturn true;\n\t\t\t}) ?? ((!strict || [a, b].every((value) => Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null)) && Object.keys({\n\t\t\t\t...a,\n\t\t\t\t...b\n\t\t\t}).every((key) => compare(a[key], b[key])));\n\t\t} finally {\n\t\t\tancestors.delete(a);\n\t\t}\n\t}\n\treturn compare(a, b);\n}\n//#endregion\n//#region lib/types/string.js\n/** Uppercase the first character of a string. */\nfunction capitalize(source) {\n\treturn source.charAt(0).toUpperCase() + source.slice(1);\n}\n/** Lowercase the first character of a string. */\nfunction uncapitalize(source) {\n\treturn source.charAt(0).toLowerCase() + source.slice(1);\n}\n/** Convert dash or underscore delimited text to camelCase. */\nfunction camelCase(source) {\n\treturn source.replace(/[_-][a-z]/g, (str) => str.slice(1).toUpperCase());\n}\nfunction tokenize(source, delimiters, delimiter) {\n\tconst output = [];\n\tlet state = 0;\n\tfor (let i = 0; i < source.length; i++) {\n\t\tconst code = source.charCodeAt(i);\n\t\tif (code >= 65 && code <= 90) {\n\t\t\tif (state === 1) {\n\t\t\t\tconst next = source.charCodeAt(i + 1);\n\t\t\t\tif (next >= 97 && next <= 122) output.push(delimiter);\n\t\t\t\toutput.push(code + 32);\n\t\t\t} else {\n\t\t\t\tif (state !== 0) output.push(delimiter);\n\t\t\t\toutput.push(code + 32);\n\t\t\t}\n\t\t\tstate = 1;\n\t\t} else if (code >= 97 && code <= 122) {\n\t\t\toutput.push(code);\n\t\t\tstate = 2;\n\t\t} else if (delimiters.includes(code)) {\n\t\t\tif (state !== 0) output.push(delimiter);\n\t\t\tstate = 0;\n\t\t} else output.push(code);\n\t}\n\treturn String.fromCharCode(...output);\n}\n/** Convert text to dash-delimited parameter case. */\nfunction paramCase(source) {\n\treturn tokenize(source, [45, 95], 45);\n}\n/** Convert text to underscore-delimited snake case. */\nfunction snakeCase(source) {\n\treturn tokenize(source, [45, 95], 95);\n}\n/** Runtime alias for `camelCase`. */\nconst camelize = camelCase;\n/** Runtime alias for `paramCase`. */\nconst hyphenate = paramCase;\n/** Format a property key as a JavaScript member access suffix. */\nfunction formatProperty(key) {\n\tif (typeof key !== \"string\") return `[${key.toString()}]`;\n\treturn /^[a-z_$][\\w$]*$/i.test(key) ? `.${key}` : `[${JSON.stringify(key)}]`;\n}\n/** Remove one trailing slash from a path string. */\nfunction trimSlash(source) {\n\treturn source.replace(/\\/$/, \"\");\n}\n/** Ensure a path starts with `/` and has no trailing slash. */\nfunction sanitize(source) {\n\tif (!source.startsWith(\"/\")) source = \"/\" + source;\n\treturn trimSlash(source);\n}\n//#endregion\n//#region lib/types/time.js\n/** Time constants plus parsing and formatting helpers. */\nvar Time;\n(function(Time) {\n\tTime.millisecond = 1;\n\tTime.second = 1e3;\n\tTime.minute = Time.second * 60;\n\tTime.hour = Time.minute * 60;\n\tTime.day = Time.hour * 24;\n\tTime.week = Time.day * 7;\n\tlet timezoneOffset = (/* @__PURE__ */ new Date()).getTimezoneOffset();\n\tfunction setTimezoneOffset(offset) {\n\t\ttimezoneOffset = offset;\n\t}\n\tTime.setTimezoneOffset = setTimezoneOffset;\n\tfunction getTimezoneOffset() {\n\t\treturn timezoneOffset;\n\t}\n\tTime.getTimezoneOffset = getTimezoneOffset;\n\tfunction getDateNumber(date = /* @__PURE__ */ new Date(), offset) {\n\t\tif (typeof date === \"number\") date = new Date(date);\n\t\tif (offset === void 0) offset = timezoneOffset;\n\t\treturn Math.floor((date.valueOf() / Time.minute - offset) / 1440);\n\t}\n\tTime.getDateNumber = getDateNumber;\n\tfunction fromDateNumber(value, offset) {\n\t\tconst date = new Date(value * Time.day);\n\t\tif (offset === void 0) offset = timezoneOffset;\n\t\treturn new Date(+date + offset * Time.minute);\n\t}\n\tTime.fromDateNumber = fromDateNumber;\n\tconst numeric = /\\d+(?:\\.\\d+)?/.source;\n\tconst timeRegExp = new RegExp(`^${[\n\t\t\"w(?:eek(?:s)?)?\",\n\t\t\"d(?:ay(?:s)?)?\",\n\t\t\"h(?:our(?:s)?)?\",\n\t\t\"m(?:in(?:ute)?(?:s)?)?\",\n\t\t\"s(?:ec(?:ond)?(?:s)?)?\"\n\t].map((unit) => `(${numeric}${unit})?`).join(\"\")}$`);\n\tfunction parseTime(source) {\n\t\tconst capture = timeRegExp.exec(source);\n\t\tif (!capture) return 0;\n\t\treturn (parseFloat(capture[1]) * Time.week || 0) + (parseFloat(capture[2]) * Time.day || 0) + (parseFloat(capture[3]) * Time.hour || 0) + (parseFloat(capture[4]) * Time.minute || 0) + (parseFloat(capture[5]) * Time.second || 0);\n\t}\n\tTime.parseTime = parseTime;\n\tfunction parseDate(date) {\n\t\tconst parsed = parseTime(date);\n\t\tif (parsed) date = Date.now() + parsed;\n\t\telse if (/^\\d{1,2}(:\\d{1,2}){1,2}$/.test(date)) date = `${(/* @__PURE__ */ new Date()).toLocaleDateString()}-${date}`;\n\t\telse if (/^\\d{1,2}-\\d{1,2}-\\d{1,2}(:\\d{1,2}){1,2}$/.test(date)) date = `${(/* @__PURE__ */ new Date()).getFullYear()}-${date}`;\n\t\treturn date ? new Date(date) : /* @__PURE__ */ new Date();\n\t}\n\tTime.parseDate = parseDate;\n\tfunction format(ms) {\n\t\tconst abs = Math.abs(ms);\n\t\tif (abs >= Time.day - Time.hour / 2) return Math.round(ms / Time.day) + \"d\";\n\t\telse if (abs >= Time.hour - Time.minute / 2) return Math.round(ms / Time.hour) + \"h\";\n\t\telse if (abs >= Time.minute - Time.second / 2) return Math.round(ms / Time.minute) + \"m\";\n\t\telse if (abs >= Time.second) return Math.round(ms / Time.second) + \"s\";\n\t\treturn ms + \"ms\";\n\t}\n\tTime.format = format;\n\tfunction toDigits(source, length = 2) {\n\t\treturn source.toString().padStart(length, \"0\");\n\t}\n\tTime.toDigits = toDigits;\n\tfunction template(template, time = /* @__PURE__ */ new Date()) {\n\t\treturn template.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));\n\t}\n\tTime.template = template;\n})(Time || (Time = {}));\n//#endregion\nexport { Binary, Time, arrayBufferToBase64, arrayBufferToHex, base64ToArrayBuffer, camelCase, camelize, capitalize, clone, contain, createVolatile, deduplicate, deepEqual, defineProperty, difference, filterKeys, formatProperty, hexToArrayBuffer, hyphenate, intersection, is, isNonNullable, isNullable, isPlainObject, isVolatile, makeArray, mapValues, mapValues as valueMap, noop, omit, paramCase, pick, remove, sanitize, snakeCase, trimSlash, uncapitalize, union, updateVolatile, volatileEntries };\n", "/**\r\n * dsh-provider-proxy \u2014 Host half.\r\n *\r\n * Routes the model calls of the providers the user enabled through that\r\n * provider's own forward proxy. Every other provider, and all other DSH\r\n * traffic, keeps using the normal network path.\r\n */\r\n\r\nimport { acquireFetchRouter } from './fetch-router.js'\r\nimport { closeTable, createProxyTable, type RouteEntry } from './proxy-table.js'\r\nimport type { ProviderProxyRouteValue } from './config.js'\r\n\r\nexport const name = 'dsh-provider-proxy'\r\nexport const inject = ['llm']\r\n\r\n/**\r\n * The Config this fiber receives.\r\n *\r\n * It is NOT `ConfigShape`: under the Loader `providers` is a Volatile REFERENCE,\r\n * not the dictionary, so it has to be read through `.get()`. Declaring the plain\r\n * shape here made the two incompatible and hid every real value.\r\n */\r\ninterface ProxyConfig {\r\n /** The provider dictionary, or the Volatile wrapper around it. */\r\n readonly providers?: unknown\r\n}\r\n\r\nfunction plainProviders(\r\n config: ProxyConfig | undefined,\r\n): Record<string, Partial<ProviderProxyRouteValue>> {\r\n const raw = config?.providers\r\n if (raw === undefined) return {}\r\n // Under the Loader this is a Volatile reference; read it fresh every time so\r\n // a settings write is visible to the next request without a remount.\r\n const snapshot = (raw as { get?: () => unknown }).get\r\n const value = typeof snapshot === 'function' ? snapshot.call(raw) : raw\r\n return (value ?? {}) as Record<string, Partial<ProviderProxyRouteValue>>\r\n}\r\n\r\nexport function apply(ctx: any, config?: ProxyConfig): void {\r\n const router = acquireFetchRouter()\r\n let current = new Map<string, RouteEntry>()\r\n let problems = new Map<string, string>()\r\n let closed = false\r\n\r\n // One line on activation so a user can tell \"mounted\" from \"not mounted\" in\r\n // the Host log without guessing. Never prints a credential.\r\n try {\r\n ctx.logger.info('dsh-provider-proxy mounted (pid %d)', process.pid)\r\n } catch {\r\n // A context without a logger still works; the diagnostics getter remains.\r\n }\r\n\r\n const rebuild = async (): Promise<void> => {\r\n const next = createProxyTable(plainProviders(config))\r\n const previous = current\r\n current = next.entries\r\n problems = next.problems\r\n // Retire the previous table only after the new one is live, so an in-flight\r\n // stream keeps a dispatcher that still works.\r\n void closeTable(previous)\r\n }\r\n\r\n const ready = rebuild()\r\n\r\n /**\r\n * The provider catalogue, read from `ctx.llm` where it is actually available.\r\n *\r\n * The browser has no LLM service in this release, so the page cannot ask for\r\n * this list itself. Serving it from the Host is the supported path: the\r\n * `webServer` service is confirmed live, and the shipped dsh-llm-retry-settings\r\n * registers its routes the same way.\r\n */\r\n const catalog = (): { providers: { id: string; name: string; live: boolean }[] } => {\r\n const live = new Set<string>()\r\n const out: { id: string; name: string; live: boolean }[] = []\r\n const seen = new Set<string>()\r\n try {\r\n for (const entry of ctx.llm?.listProviders?.() ?? []) {\r\n const id = entry?.id\r\n if (typeof id !== 'string' || id.length === 0) continue\r\n live.add(id)\r\n if (seen.has(id)) continue\r\n seen.add(id)\r\n const name = typeof entry?.name === 'string' && entry.name.length > 0 ? entry.name : id\r\n out.push({ id, name, live: true })\r\n }\r\n } catch {\r\n // no llm service in this composition\r\n }\r\n try {\r\n for (const entry of ctx.llm?.listConfigurableProviders?.() ?? []) {\r\n const id = entry?.provider\r\n if (typeof id !== 'string' || id.length === 0) continue\r\n const name =\r\n typeof entry.displayName === 'string' && entry.displayName.length > 0 ? entry.displayName : id\r\n const existing = out.find(row => row.id === id)\r\n if (existing === undefined) out.push({ id, name, live: live.has(id) })\r\n else existing.name = name\r\n }\r\n } catch {\r\n // ignore\r\n }\r\n out.sort((a, b) => a.name.localeCompare(b.name))\r\n return { providers: out }\r\n }\r\n\r\n // The page reads this same-origin JSON endpoint for the provider list. Mounted\r\n // inside an optional child so a composition without a web server still runs.\r\n ctx.inject?.(['webServer'], (wctx: any) => {\r\n try {\r\n wctx?.webServer?.register?.({\r\n kind: 'exact',\r\n path: '/dsh-provider-proxy/providers',\r\n handler: (_req: unknown, res: any) => {\r\n try {\r\n const text = JSON.stringify({ ...catalog(), problems: Object.fromEntries(problems) })\r\n res.writeHead(200, {\r\n 'content-type': 'application/json; charset=utf-8',\r\n 'cache-control': 'no-store',\r\n 'content-length': Buffer.byteLength(text),\r\n })\r\n res.end(text)\r\n } catch (error) {\r\n res.writeHead(500, { 'content-type': 'application/json' })\r\n res.end(JSON.stringify({ providers: [], error: String(error) }))\r\n }\r\n },\r\n })\r\n } catch (error) {\r\n // The page degrades to whatever is already configured.\r\n void error\r\n }\r\n })\r\n\r\n ctx.effect(() => {\r\n const stop = ctx.on(\r\n 'llm/stream',\r\n (options: { provider?: string }, next: () => AsyncIterable<unknown>) => {\r\n const provider = options?.provider\r\n if (typeof provider !== 'string') return next()\r\n const route = current.get(provider)\r\n if (route === undefined) return next()\r\n // The stream is consumed lazily; wrap it so the scope survives.\r\n return router.wrap(route.dispatcher, next as () => AsyncIterable<unknown>)\r\n },\r\n { global: true },\r\n )\r\n\r\n const onConfig = (): void => {\r\n void rebuild()\r\n }\r\n ctx.on('loader/volatile-update', onConfig, { global: true })\r\n\r\n return async () => {\r\n stop()\r\n if (closed) return\r\n closed = true\r\n await ready.catch(() => undefined)\r\n await closeTable(current)\r\n current = new Map()\r\n router.release()\r\n }\r\n }, 'dsh-provider-proxy: provider-scoped proxy routing')\r\n\r\n // Diagnostics, exported for the Host log and for tests. Never includes a\r\n // password: `proxyOrigin` is the sanitized origin only.\r\n Object.defineProperty(ctx, 'providerProxyState', {\r\n configurable: true,\r\n get: () => ({\r\n routes: [...current.values()].map(entry => ({\r\n provider: entry.provider,\r\n proxyOrigin: entry.proxyOrigin,\r\n })),\r\n problems: Object.fromEntries(problems),\r\n }),\r\n })\r\n}\r\n\r\nexport { acquireFetchRouter } from './fetch-router.js'\r\nexport { createProxyTable, closeTable, proxyUrl } from './proxy-table.js'\r\nexport { Config, ProviderProxyRoute, normalizeRoute, PROTOCOLS } from './config.js'"],
|
|
5
|
+
"mappings": ";;;;;;;AAoCA,SAAS,yBAAyB;AAClC,SAAS,SAAS,mBAAmB;AAYrC,IAAM,YAAY,uBAAO,IAAI,oCAAoC;AAUjE,SAAS,sBAAmC;AAC1C,QAAM,UAAW,WAAuD,SAAS;AACjF,MAAI,YAAY,QAAW;AACzB,YAAQ,UAAU;AAClB,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,WAAW,UAAU,YAAY;AAC1C,UAAM,IAAI,MAAM,oEAAoE;AAAA,EACtF;AAEA,QAAM,UAAU,IAAI,kBAA+B;AACnD,QAAM,gBAAgB,WAAW;AACjC,QAAM,aAAa,OAAO,yBAAyB,YAAY,OAAO;AAEtE,QAAM,cAAc,SAASA,aAE3B,OACA,MACqC;AAC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AAAA,IACjB;AAAA,EACF,GAAG,mDAAmD;AAItD,SAAO,eAAe,KAAK,sBAAsB;AAAA,IAC/C,cAAc;AAAA,IACd,KAAK,OAAO;AAAA,MACV,QAAQ,CAAC,GAAG,QAAQ,OAAO,CAAC,EAAE,IAAI,YAAU;AAAA,QAC1C,UAAU,MAAM;AAAA,QAChB,aAAa,MAAM;AAAA,MACrB,EAAE;AAAA,MACF,UAAU,OAAO,YAAY,QAAQ;AAAA,IACvC;AAAA,EACF,CAAC;AACH;",
|
|
6
6
|
"names": ["routedFetch", "value", "value", "Binary", "result", "a", "b", "Time", "date", "template", "options", "pattern", "value", "extra", "resolve", "toJSON", "date", "toString", "name", "key", "require", "volatile", "snapshot", "name"]
|
|
7
7
|
}
|