dsh-mobile 0.6.1 → 0.6.3

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/CONTRIBUTORS.md +12 -4
  3. package/README.en.md +11 -38
  4. package/README.md +11 -38
  5. package/SECURITY.md +3 -2
  6. package/apps/mobile/README.md +132 -0
  7. package/apps/mobile/release.json +5 -0
  8. package/cordis.patch.yml +2 -1
  9. package/docs/ATTACH_EXISTING_FRPS.md +1 -1
  10. package/docs/CADDY_MANAGED.en.md +15 -1
  11. package/docs/CADDY_MANAGED.md +15 -1
  12. package/docs/CLIENT_MODULES.en.md +2 -2
  13. package/docs/CLIENT_MODULES.md +2 -2
  14. package/docs/CLOUDFLARE_TUNNEL.en.md +2 -2
  15. package/docs/CLOUDFLARE_TUNNEL.md +3 -3
  16. package/docs/EXTENSION_WORKERS.en.md +49 -0
  17. package/docs/EXTENSION_WORKERS.md +49 -0
  18. package/docs/MOBILE_COMPOSER_TOOLBAR.en.md +19 -0
  19. package/docs/MOBILE_COMPOSER_TOOLBAR.md +19 -0
  20. package/docs/README.md +2 -0
  21. package/docs/SELF_HOSTED_FRP.en.md +1 -1
  22. package/docs/SELF_HOSTED_FRP.md +1 -1
  23. package/docs/SLOW_CONNECTIONS.en.md +1 -1
  24. package/docs/SLOW_CONNECTIONS.md +1 -1
  25. package/docs/TRUSTED_NETWORKS.en.md +1 -1
  26. package/docs/TRUSTED_NETWORKS.md +1 -1
  27. package/lib/cli.js +1 -0
  28. package/lib/cli.js.map +1 -1
  29. package/lib/client.js +866 -99
  30. package/lib/client.js.map +1 -1
  31. package/lib/extension-worker-runtime.mjs +1646 -0
  32. package/lib/extension-worker-runtime.mjs.map +1 -0
  33. package/lib/index.d.mts +199 -7
  34. package/lib/index.mjs +1645 -586
  35. package/lib/index.mjs.map +1 -1
  36. package/lib/mobile-compat.js +1 -1
  37. package/lib/mobile-compat.js.map +1 -1
  38. package/lib/mobile-layout.js +2 -1
  39. package/lib/mobile-layout.js.map +1 -1
  40. package/package.json +17 -6
  41. package/packages/question-fixes/LICENSE +201 -0
  42. package/packages/question-fixes/package.json +9 -2
  43. package/node_modules/dsh-mobile-question-fixes/lib/client.js +0 -78
  44. package/node_modules/dsh-mobile-question-fixes/lib/client.js.map +0 -1
  45. package/node_modules/dsh-mobile-question-fixes/lib/index.mjs +0 -14
  46. package/node_modules/dsh-mobile-question-fixes/lib/index.mjs.map +0 -1
  47. package/node_modules/dsh-mobile-question-fixes/package.json +0 -25
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension-worker-runtime.mjs","names":["valueMap","z"],"sources":["../src/extension-worker-config.ts","../node_modules/@deepseek-ai/cosmokit/lib/index.js","../node_modules/@deepseek-ai/schemastery/lib/index.mjs","../src/extension-worker-protocol.ts","../src/extension-worker-runtime.ts"],"sourcesContent":["/** Operator-owned limits for opt-in local extension worker execution. */\nexport interface HostExecutionConfig {\n readonly mode?: 'in-process' | 'worker'\n /** Apply worker mode only to these exact local ids; omitted selects every local host. */\n readonly extensions?: readonly string[] | undefined\n readonly maxWorkers?: number\n readonly maxRegistrations?: number\n readonly maxOldGenerationSizeMb?: number\n readonly maxYoungGenerationSizeMb?: number\n readonly stackSizeMb?: number\n readonly activationTimeoutMs?: number\n readonly operationTimeoutMs?: number\n readonly cancelGraceMs?: number\n readonly streamCancelGraceMs?: number\n readonly disposeGraceMs?: number\n readonly resultMaxBytes?: number\n readonly streamWindowBytes?: number\n readonly streamChunkBytes?: number\n readonly streamAggregateBytes?: number\n readonly logWindowMs?: number\n readonly logMessagesPerWindow?: number\n readonly logMessageBytes?: number\n}\n\n/** Complete settings passed to each owned worker; Node limits do not isolate filesystem access. */\nexport interface ResolvedHostExecutionConfig extends Required<Omit<HostExecutionConfig, 'extensions'>> {\n readonly extensions: readonly string[] | undefined\n}\n\nfunction integer(value: unknown, name: string, fallback: number, minimum: number, maximum: number): number {\n const resolved = value ?? fallback\n if (typeof resolved !== 'number' || !Number.isSafeInteger(resolved) || resolved < minimum || resolved > maximum) {\n throw new Error(`hostExecution.${name} must be an integer from ${minimum} through ${maximum}`)\n }\n return resolved\n}\n\n/** Resolve configuration once; reject malformed modes, ids and incoherent stream windows. */\nexport function resolveHostExecution(raw: unknown): ResolvedHostExecutionConfig {\n if (raw !== undefined && (raw === null || typeof raw !== 'object' || Array.isArray(raw))) throw new Error('hostExecution must be an object')\n const value = (raw ?? {}) as HostExecutionConfig\n const mode = value.mode ?? 'in-process'\n if (mode !== 'worker' && mode !== 'in-process') throw new Error('hostExecution.mode is invalid')\n if (value.extensions !== undefined && (!Array.isArray(value.extensions) || value.extensions.some(id => typeof id !== 'string' || !/^[a-z][a-z0-9-]{0,63}$/u.test(id)) || new Set(value.extensions).size !== value.extensions.length)) throw new Error('hostExecution.extensions must contain unique local extension ids')\n const streamWindowBytes = integer(value.streamWindowBytes, 'streamWindowBytes', 256 * 1024, 1024, 4 * 1024 * 1024)\n const streamChunkBytes = integer(value.streamChunkBytes, 'streamChunkBytes', 64 * 1024, 1024, streamWindowBytes)\n const streamAggregateBytes = integer(value.streamAggregateBytes, 'streamAggregateBytes', 1024 * 1024, streamWindowBytes, 32 * 1024 * 1024)\n return Object.freeze({\n mode, extensions: value.extensions === undefined ? undefined : Object.freeze([...value.extensions]),\n maxWorkers: integer(value.maxWorkers, 'maxWorkers', 8, 1, 128),\n maxRegistrations: integer(value.maxRegistrations, 'maxRegistrations', 256, 1, 4096),\n maxOldGenerationSizeMb: integer(value.maxOldGenerationSizeMb, 'maxOldGenerationSizeMb', 128, 16, 4096),\n maxYoungGenerationSizeMb: integer(value.maxYoungGenerationSizeMb, 'maxYoungGenerationSizeMb', 16, 1, 512),\n stackSizeMb: integer(value.stackSizeMb, 'stackSizeMb', 4, 1, 64),\n activationTimeoutMs: integer(value.activationTimeoutMs, 'activationTimeoutMs', 5000, 1, 300_000),\n operationTimeoutMs: integer(value.operationTimeoutMs, 'operationTimeoutMs', 30_000, 1, 300_000),\n cancelGraceMs: integer(value.cancelGraceMs, 'cancelGraceMs', 250, 1, 30_000),\n streamCancelGraceMs: integer(value.streamCancelGraceMs, 'streamCancelGraceMs', 1000, 1, 30_000),\n disposeGraceMs: integer(value.disposeGraceMs, 'disposeGraceMs', 2000, 1, 30_000),\n resultMaxBytes: integer(value.resultMaxBytes, 'resultMaxBytes', 4 * 1024 * 1024, 1024, 4 * 1024 * 1024),\n streamWindowBytes, streamChunkBytes, streamAggregateBytes,\n logWindowMs: integer(value.logWindowMs, 'logWindowMs', 1000, 1, 60_000),\n logMessagesPerWindow: integer(value.logMessagesPerWindow, 'logMessagesPerWindow', 64, 1, 1024),\n logMessageBytes: integer(value.logMessageBytes, 'logMessageBytes', 4096, 128, 64 * 1024),\n })\n}\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","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","/**\n * Message protocol for opt-in extension worker\n * execution mode. This module is imported by BOTH the parent supervisor and\n * the worker runtime, so it must stay pure: types and dependency-free helpers\n * only — no Cordis, no node:worker_threads.\n */\n\n/** Upper bound for a per-operation `timeoutMs` override (mirrors extensions.ts). */\nexport const WORKER_OPERATION_TIMEOUT_MAX_MS = 300_000\n\n/** Ceiling for one serialized action result, enforced worker-side. */\nexport const WORKER_RESULT_MAX_BYTES = 4 * 1024 * 1024\n/** HTTP response metadata crossing threads stays within the ordinary HTTP header budget. */\nexport const WORKER_RESPONSE_METADATA_MAX_BYTES = 16 * 1024\n\n/** Per-stream credit window: the worker may send at most this many unacknowledged bytes. */\nexport const WORKER_STREAM_CREDIT_BYTES = 256 * 1024\n\n/** The worker splits source chunks larger than this before credit control. */\nexport const WORKER_STREAM_MAX_CHUNK_BYTES = 64 * 1024\n\n/** Per-worker aggregate bound: total unacknowledged bytes across ALL streams. */\nexport const WORKER_STREAM_AGGREGATE_BYTES = 1024 * 1024\n\n/** Logger-adapter budget per time window: bursts are allowed, silence is not permanent. */\nexport const WORKER_LOG_WINDOW_MS = 1_000\n\n/** If a cancelled stream is not ended by the worker within this grace, the supervisor terminates it. */\nexport const WORKER_STREAM_CANCEL_GRACE_MS = 1_000\n\n/** Default budget for one worker action when the action sets no override. */\nexport const WORKER_OPERATION_TIMEOUT_MS = 30_000\n\n/** After a deadline-detached action fails to settle within this grace, the worker is terminated. */\nexport const WORKER_DEADLINE_GRACE_MS = 250\n\n/** Parent → worker: activate one extension generation inside this runtime. */\nexport interface WorkerActivateMessage {\n readonly kind: 'activate'\n readonly id: string\n readonly hostFile: string\n readonly generation: string\n /** Full manifest so `api.manifest` matches the in-process contract. */\n readonly manifest: WorkerActivationManifest\n}\n\n/** Manifest shape crossing the boundary (structural, Cordis-free). */\nexport interface WorkerActivationManifest {\n readonly schemaVersion: 1\n readonly id: string\n readonly name: string\n readonly version: string\n readonly description?: string\n}\n\n/** Parent → worker: run one action; reply with worker-serialized bytes. */\nexport interface WorkerInvokeMessage {\n readonly kind: 'invoke'\n readonly id: string\n readonly action: string\n readonly deviceId: string\n readonly input: unknown\n}\n\n/** Parent → worker: the caller detached; stop the identified operation. */\nexport interface WorkerCancelMessage {\n readonly kind: 'cancel'\n readonly id: string\n}\n\n/** Parent → worker: run generation teardown inside the runtime. */\nexport interface WorkerDisposeMessage {\n readonly kind: 'dispose'\n readonly id: string\n}\n\n/** Parent → worker: run one route handler; the body crosses as bytes. */\nexport interface WorkerRouteMessage {\n readonly kind: 'route'\n readonly id: string\n readonly routeIndex: number\n readonly method: string\n readonly path: string\n readonly query: readonly (readonly [string, string])[]\n readonly headers: Readonly<Record<string, string>>\n readonly body: Uint8Array\n readonly deviceId: string\n}\n\n/** Parent → worker: the consumer took this many streamed bytes; grant credit. */\nexport interface WorkerStreamAckMessage {\n readonly kind: 'stream-ack'\n readonly id: string\n readonly bytes: number\n}\n\n/** Parent → worker: the consumer is gone; stop this stream. */\nexport interface WorkerStreamCancelMessage {\n readonly kind: 'stream-cancel'\n readonly id: string\n}\n\nexport type ParentMessage = WorkerActivateMessage | WorkerInvokeMessage | WorkerCancelMessage | WorkerDisposeMessage | WorkerRouteMessage | WorkerStreamAckMessage | WorkerStreamCancelMessage\n\n/** Metadata for one action, crossing the boundary without its functions. */\nexport interface WorkerActionMetadata {\n readonly name: string\n readonly timeoutMs?: number\n}\n\n/** Metadata for one route, crossing the boundary without its functions. */\nexport interface WorkerRouteMetadata {\n readonly method: string\n readonly path: string\n readonly kind?: 'exact' | 'prefix'\n readonly timeoutMs?: number\n}\n\n/** Worker → parent: activation finished; registration crossed as metadata only. */\nexport interface WorkerActivatedMessage {\n readonly kind: 'activated'\n readonly runtimeId: string\n readonly actions: readonly WorkerActionMetadata[]\n readonly routes: readonly WorkerRouteMetadata[]\n}\n\n/** Worker → parent: an action produced size-checked JSON bytes. */\nexport interface WorkerResultMessage {\n readonly kind: 'result'\n readonly runtimeId: string\n readonly id: string\n readonly bytes: Uint8Array\n}\n\n/** Worker → parent: an operation failed with a controlled business error. */\nexport interface WorkerErrorMessage {\n readonly kind: 'error'\n readonly runtimeId: string\n readonly id: string\n readonly code: string\n readonly message: string\n readonly status: number\n}\n\n/** Worker → parent: bounded logger-adapter traffic. */\nexport interface WorkerLogMessage {\n readonly kind: 'log'\n readonly level: 'debug' | 'info' | 'warn' | 'error'\n readonly args: readonly unknown[]\n}\n\n/** Worker → parent: a route produced a complete buffered response as bytes. */\nexport interface WorkerRouteResponseMessage {\n readonly kind: 'route-response'\n readonly runtimeId: string\n readonly id: string\n readonly status?: number\n readonly contentType?: string\n readonly headers?: Readonly<Record<string, string>>\n readonly bytes?: Uint8Array\n}\n\n/** Worker → parent: a route produced a stream; chunks follow under credit control. */\nexport interface WorkerStreamStartMessage {\n readonly kind: 'stream-start'\n readonly runtimeId: string\n readonly id: string\n readonly status?: number\n readonly contentType?: string\n readonly headers?: Readonly<Record<string, string>>\n}\n\n/** Worker → parent: one stream chunk, sent only while credit remains. */\nexport interface WorkerStreamChunkMessage {\n readonly kind: 'stream-chunk'\n readonly runtimeId: string\n readonly id: string\n readonly bytes: Uint8Array\n}\n\n/** Worker → parent: the stream finished normally. */\nexport interface WorkerStreamEndMessage {\n readonly kind: 'stream-end'\n readonly runtimeId: string\n readonly id: string\n}\n\n/** Worker → parent: the stream failed. */\nexport interface WorkerStreamErrorMessage {\n readonly kind: 'stream-error'\n readonly runtimeId: string\n readonly id: string\n readonly message: string\n}\n\nexport type WorkerMessage = WorkerActivatedMessage | WorkerResultMessage | WorkerErrorMessage | WorkerLogMessage | WorkerRouteResponseMessage | WorkerStreamStartMessage | WorkerStreamChunkMessage | WorkerStreamEndMessage | WorkerStreamErrorMessage\n\n/** Validate an optional per-operation timeout override against the same bounds as in-process. */\nexport function validOperationTimeout(value: unknown): number | undefined {\n if (value === undefined) return undefined\n if (typeof value !== 'number' || !Number.isInteger(value) || value < 1 || value > WORKER_OPERATION_TIMEOUT_MAX_MS) return undefined\n return value\n}\n\n/** Normalize an extension route path exactly like the in-process registry. */\nexport function normalizeWorkerRoutePath(value: string): string {\n if (typeof value !== 'string' || value.length === 0 || value.length > 256 || value.includes('?') || value.includes('#') || value.includes('\\\\') || /[\\u0000-\\u001f\\u007f]/u.test(value)) throw new Error('invalid route path')\n const normalizedInput = value.startsWith('/') ? value : `/${value}`\n const parts = normalizedInput.split('/')\n if (parts.some(part => part === '..' || part === '.')) throw new Error('invalid route path')\n return normalizedInput === '/' ? '/' : normalizedInput.replace(/\\/+$/u, '')\n}\n\n/**\n * Recognize a controlled business error (MobileExtensionError shape) thrown by\n * host code so its code/status survive the boundary instead of collapsing to\n * a generic 500. Pure duck-typing keeps the runtime Cordis-free.\n */\nexport function businessErrorShape(error: unknown): { readonly code: string; readonly message: string; readonly status: number } | undefined {\n if (error === null || typeof error !== 'object') return undefined\n const candidate = error as { readonly code?: unknown; readonly message?: unknown; readonly status?: unknown }\n if (typeof candidate.code !== 'string' || candidate.code.length === 0 || candidate.code.length > 64) return undefined\n if (typeof candidate.message !== 'string' || candidate.message.length > 500) return undefined\n if (typeof candidate.status !== 'number' || !Number.isInteger(candidate.status) || candidate.status < 400 || candidate.status > 599) return undefined\n return { code: candidate.code, message: candidate.message, status: candidate.status }\n}\n\n/**\n * Serialize an action result to JSON bytes worker-side.\n *\n * Plain JSON.stringify, matching the in-process gateway contract exactly:\n * non-JSON-serializable values (e.g. BigInt) throw and surface as\n * `extension_failed`, same as in-process mode today.\n */\nexport function serializeWorkerResult(value: unknown): Uint8Array {\n const serialized = JSON.stringify(value)\n if (serialized === undefined) throw new Error('extension result is not JSON serializable')\n return new TextEncoder().encode(serialized)\n}\n","/**\n * Worker-side runtime for opt-in local extension hosts.\n *\n * This file is a standalone tsdown entry (lib/extension-worker-runtime.mjs).\n * It executes ALL host behavior inside the worker thread — module import,\n * activation, input validation, actions, effects and cleanup — and answers the\n * parent with metadata and pre-serialized bytes only. It must never import\n * Cordis or any DSH service.\n */\nimport { parentPort, workerData } from 'node:worker_threads'\nimport { inspect } from 'node:util'\nimport { resolveHostExecution } from './extension-worker-config.js'\nimport { randomUUID } from 'node:crypto'\nimport { pathToFileURL } from 'node:url'\nimport z from '@deepseek-ai/schemastery'\nimport {\n businessErrorShape,\n normalizeWorkerRoutePath,\n serializeWorkerResult,\n validOperationTimeout,\n WORKER_RESPONSE_METADATA_MAX_BYTES,\n type ParentMessage,\n type WorkerActionMetadata,\n type WorkerRouteMetadata,\n} from './extension-worker-protocol.js'\n\ninterface RuntimeActionSpec {\n readonly timeoutMs?: number\n readonly input?: ((value: unknown) => unknown) | { parse(value: unknown): unknown }\n readonly run: (context: { readonly signal: AbortSignal; readonly deviceId: string }, input: unknown) => unknown\n}\n\ninterface RuntimeRouteSpec {\n readonly method: string\n readonly path: string\n readonly kind?: 'exact' | 'prefix'\n readonly timeoutMs?: number\n readonly handle: (request: {\n readonly method: string\n readonly pathname: string\n readonly query: URLSearchParams\n readonly headers: Readonly<Record<string, string>>\n readonly body: Buffer\n readonly signal: AbortSignal\n readonly deviceId: string\n }) => { status?: number; contentType?: string; headers?: Record<string, string>; body: string | Uint8Array | import('node:stream').Readable } | Promise<{ status?: number; contentType?: string; headers?: Record<string, string>; body: string | Uint8Array | import('node:stream').Readable }>\n}\n\ntype HostModule = { readonly default?: (api: RuntimeHostApi) => void | Promise<void> }\n\n/**\n * The worker-side host API. `context` is a documented LOGGER-ONLY adapter —\n * it is deliberately not typed or advertised as a Cordis Context.\n */\ninterface RuntimeHostApi {\n readonly manifest: { readonly id: string }\n readonly context: { readonly logger: Record<'debug' | 'info' | 'warn' | 'error', (...args: unknown[]) => void> }\n readonly schema: typeof z\n readonly signal: AbortSignal\n action(name: string, spec: RuntimeActionSpec): void\n route(spec: RuntimeRouteSpec): void\n effect(setup: () => void | (() => void | Promise<void>) | Promise<void | (() => void | Promise<void>)>): void\n}\n\nconst parentChannel = parentPort\nif (parentChannel === null) throw new Error('extension-worker-runtime must run inside a Worker')\nconst port = parentChannel\nconst limits = resolveHostExecution((workerData as { readonly limits?: unknown } | undefined)?.limits)\n\n/** Logger-adapter burst budget per time window; the budget resets each window. */\nconst LOG_QUEUE_LIMIT = limits.logMessagesPerWindow\n\nconst runtimeId = randomUUID()\nconst generationController = new AbortController()\nconst actions = new Map<string, RuntimeActionSpec>()\nconst routes: RuntimeRouteSpec[] = []\nconst cleanups: (() => void | Promise<void>)[] = []\nlet logWindowCount = 0\nlet logWindowStartedAt = Date.now()\n\nfunction send(message: unknown): void {\n port.postMessage(message)\n}\n\n/** Upper bound for one stringified log argument forwarded to the parent. */\nconst LOG_ARG_MAX_CHARS = limits.logMessageBytes\n\n/** Render a log argument that structured cloning cannot carry (or that is huge). */\nfunction sanitizeLogArg(value: unknown): string {\n const rendered = typeof value === 'string' ? value : inspect(value, { depth: 2, maxArrayLength: 16, maxStringLength: 256, customInspect: false, getters: false })\n return rendered.slice(0, LOG_ARG_MAX_CHARS)\n}\n\nfunction log(level: 'debug' | 'info' | 'warn' | 'error', args: readonly unknown[]): void {\n const now = Date.now()\n if (now - logWindowStartedAt >= limits.logWindowMs) {\n logWindowStartedAt = now\n logWindowCount = 0\n }\n if (logWindowCount >= LOG_QUEUE_LIMIT) return\n logWindowCount += 1\n try {\n // Logging must never fail the host's calling code: clone-unsafe values are\n // rendered, oversized strings are truncated, and a postMessage failure\n // (deep non-cloneable objects) is swallowed.\n let remaining = limits.logMessageBytes\n const rendered: string[] = []\n for (const arg of args) {\n if (remaining <= 0) break\n const bytes = Buffer.from(sanitizeLogArg(arg)).subarray(0, remaining)\n const text = bytes.toString('utf8').replace(/\\uFFFD$/u, '')\n rendered.push(text); remaining -= Buffer.byteLength(text)\n }\n send({ kind: 'log', level, args: rendered })\n } catch (error) { void error /* Logging cannot fail host execution. */ }\n}\n\n/** Bound a forwarded error message so it cannot carry unbounded text. */\nfunction boundedMessage(error: unknown): string {\n const text = error instanceof Error ? error.message : String(error)\n return text.length > 500 ? text.slice(0, 500) : text\n}\n\nconst loggerAdapter = {\n debug: (...args: unknown[]) => { log('debug', args) },\n info: (...args: unknown[]) => { log('info', args) },\n warn: (...args: unknown[]) => { log('warn', args) },\n error: (...args: unknown[]) => { log('error', args) },\n}\n\n/** The lifecycle RPC id currently in flight, for outer-catch replies. */\nlet lifecycleReplyId = 'lifecycle'\n\nport.on('message', (message: ParentMessage) => {\n void handleMessage(message).catch((error: unknown) => {\n send({ kind: 'error', runtimeId, id: lifecycleReplyId, code: 'extension_failed', message: boundedMessage(error), status: 500 })\n })\n})\n\n/** Live per-request controllers, so parent cancel messages abort running work. */\nconst requestControllers = new Map<string, AbortController>()\n\nfunction abortRequest(id: string): void {\n requestControllers.get(id)?.abort(new Error('request cancelled'))\n}\n\n/** Live stream sources by request id, so generation abort can destroy them. */\nconst activeSources = new Map<string, import('node:stream').Readable>()\n\n/** Credit per stream id; the worker pauses a source when its window is exhausted. */\nconst streamCredit = new Map<string, number>()\n\n/** Sent and acknowledged bytes per stream; their difference is in-flight load. */\nconst streamSent = new Map<string, number>()\nconst streamAcked = new Map<string, number>()\n\n/** FIFO demands reserve aggregate bytes before waking a source pump. */\nconst sendBudgetWaiters: { readonly id: string; readonly length: number; readonly bail: () => boolean; readonly resolve: (granted: boolean) => void }[] = []\nconst finishedStreams = new Set<string>()\nlet drainingBudget = false\n\n/** Bytes sent but not yet acknowledged, across all live streams. */\nfunction inFlightTotal(): number {\n let total = 0\n for (const [id, sent] of streamSent) total += sent - (streamAcked.get(id) ?? 0)\n return total\n}\n\nfunction wakeSendBudgetWaiters(): void {\n if (drainingBudget) return\n drainingBudget = true\n try {\n for (let index = 0; index < sendBudgetWaiters.length;) {\n const waiter = sendBudgetWaiters[index]!\n if (waiter.bail()) { sendBudgetWaiters.splice(index, 1); waiter.resolve(false); continue }\n // An unconsumed full stream does not block siblings that have their own window credit.\n if ((streamCredit.get(waiter.id) ?? 0) < waiter.length) { index += 1; continue }\n // Protect headroom for the oldest eligible demand: a hot small-chunk producer cannot continually steal it.\n if (inFlightTotal() + waiter.length > limits.streamAggregateBytes) break\n if (!tryReserve(waiter.id, waiter.length)) throw new Error('worker stream reservation failed')\n sendBudgetWaiters.splice(index, 1)\n waiter.resolve(true)\n }\n } finally { drainingBudget = false }\n}\n\n/**\n * Atomically check and debit send budget for one piece: the per-stream window\n * must hold it AND the per-worker aggregate in-flight bound must hold. Check\n * and debit are one synchronous step, so concurrently awakened pumps can never\n * double-reserve the same freed capacity.\n */\nfunction tryReserve(id: string, length: number): boolean {\n const credit = streamCredit.get(id) ?? 0\n if (credit < length) return false\n if (inFlightTotal() + length > limits.streamAggregateBytes) return false\n streamCredit.set(id, credit - length)\n streamSent.set(id, (streamSent.get(id) ?? 0) + length)\n return true\n}\n\n/** Wait until a piece may be sent; resolves false when the caller bailed. */\nasync function acquireSendBudget(id: string, length: number, bail: () => boolean): Promise<boolean> {\n if (bail()) return false\n return new Promise<boolean>(resolve => { sendBudgetWaiters.push({ id, length, bail, resolve }); wakeSendBudgetWaiters() })\n}\n\nasync function handleMessage(message: ParentMessage): Promise<void> {\n if (message.kind === 'activate') {\n lifecycleReplyId = message.id\n await activate(message.id, message.hostFile, message.generation, message.manifest)\n return\n }\n if (message.kind === 'invoke') {\n await runAction(message.id, message.action, message.deviceId, message.input)\n return\n }\n if (message.kind === 'route') {\n await runRoute(message)\n return\n }\n if (message.kind === 'stream-ack') {\n if (!streamSent.has(message.id) || !Number.isInteger(message.bytes) || message.bytes < 0 || message.bytes > (streamSent.get(message.id) ?? 0) - (streamAcked.get(message.id) ?? 0)) return\n streamAcked.set(message.id, (streamAcked.get(message.id) ?? 0) + message.bytes)\n if (!finishedStreams.has(message.id)) streamCredit.set(message.id, (streamCredit.get(message.id) ?? 0) + message.bytes)\n if (finishedStreams.has(message.id) && streamSent.get(message.id) === streamAcked.get(message.id)) releaseStreamAccounting(message.id)\n // Freed aggregate headroom may unblock streams that opened starved.\n wakeSendBudgetWaiters()\n return\n }\n if (message.kind === 'stream-cancel') {\n const source = activeSources.get(message.id)\n source?.destroy()\n if (finishedStreams.has(message.id)) releaseStreamAccounting(message.id)\n // A pump parked on exhausted budget must wake up and observe the destroy.\n wakeSendBudgetWaiters()\n return\n }\n if (message.kind === 'cancel') {\n abortRequest(message.id)\n return\n }\n if (message.kind === 'dispose') {\n lifecycleReplyId = message.id\n generationController.abort()\n for (const source of activeSources.values()) source.destroy()\n const pending: Promise<unknown>[] = []\n for (const cleanup of [...cleanups].reverse()) {\n try { pending.push(Promise.resolve(cleanup())) } catch { /* teardown cannot block the parent */ }\n }\n await Promise.allSettled(pending)\n send({ kind: 'result', runtimeId, id: message.id, bytes: new Uint8Array() })\n return\n }\n}\n\nasync function runRoute(message: {\n readonly id: string\n readonly routeIndex: number\n readonly method: string\n readonly path: string\n readonly query: readonly (readonly [string, string])[]\n readonly headers: Readonly<Record<string, string>>\n readonly body: Uint8Array\n readonly deviceId: string\n}): Promise<void> {\n const spec = routes[message.routeIndex]\n if (spec === undefined) {\n send({ kind: 'error', runtimeId, id: message.id, code: 'route_not_found', message: 'route not found', status: 404 })\n return\n }\n const controller = new AbortController()\n requestControllers.set(message.id, controller)\n const onGenerationAbort = (): void => { controller.abort(generationController.signal.reason) }\n if (generationController.signal.aborted) controller.abort()\n else generationController.signal.addEventListener('abort', onGenerationAbort, { once: true })\n try {\n const response = await spec.handle({\n method: message.method,\n pathname: message.path,\n query: new URLSearchParams([...message.query].map(([key, value]) => [key, value] as [string, string])),\n headers: message.headers,\n body: Buffer.from(message.body),\n signal: controller.signal,\n deviceId: message.deviceId,\n })\n if (response === null || typeof response !== 'object') {\n send({ kind: 'error', runtimeId, id: message.id, code: 'invalid_route_response', message: 'extension returned an invalid response', status: 500 })\n return\n }\n const body:unknown = response.body\n if (typeof body !== 'string' && !(body instanceof Uint8Array) && !isStream(body)) throw Object.assign(new Error('extension returned an invalid response'), {code:'invalid_route_response',status:500})\n let wireMeta:ReturnType<typeof snapshotResponseMetadata>\n try {wireMeta = snapshotResponseMetadata(response)} catch(error) {\n if(isStream(body)){body.once('error',()=>undefined);body.destroy()}\n throw error\n }\n if (isStream(body)) {\n await pumpStream(message.id, body, wireMeta)\n return\n }\n const bytes = typeof body === 'string' ? new TextEncoder().encode(body) : new Uint8Array(body)\n if (bytes.byteLength > limits.resultMaxBytes) {\n send({ kind: 'error', runtimeId, id: message.id, code: 'extension_result_too_large', message: 'extension response is too large', status: 500 })\n return\n }\n send({\n kind: 'route-response', runtimeId, id: message.id,\n ...wireMeta,\n bytes,\n })\n } catch (error) {\n const business = businessErrorShape(error)\n if (business !== undefined) {\n send({ kind: 'error', runtimeId, id: message.id, code: business.code, message: business.message, status: business.status })\n return\n }\n send({ kind: 'error', runtimeId, id: message.id, code: 'extension_failed', message: boundedMessage(error), status: 500 })\n } finally {\n requestControllers.delete(message.id)\n generationController.signal.removeEventListener('abort', onGenerationAbort)\n }\n}\n\nfunction isStream(value: unknown): value is import('node:stream').Readable {\n return value !== null && typeof value === 'object' && typeof (value as { pipe?: unknown }).pipe === 'function'\n}\n\nasync function pumpStream(id: string, source: import('node:stream').Readable, meta: { status?: number; contentType?: string; headers?: Record<string, string> }): Promise<void> {\n activeSources.set(id, source)\n streamCredit.set(id, limits.streamWindowBytes)\n streamSent.set(id, 0)\n streamAcked.set(id, 0)\n send({\n kind: 'stream-start', runtimeId, id,\n ...(meta.status === undefined ? {} : { status: meta.status }),\n ...(meta.contentType === undefined ? {} : { contentType: meta.contentType }),\n ...(meta.headers === undefined ? {} : { headers: meta.headers }),\n })\n let ended = false\n const finish = (): void => {\n if (ended) return\n ended = true\n activeSources.delete(id)\n streamCredit.delete(id)\n finishedStreams.add(id)\n if (source.destroyed && !source.readableEnded || streamSent.get(id) === streamAcked.get(id)) releaseStreamAccounting(id)\n // Freed aggregate budget may unblock other streams.\n wakeSendBudgetWaiters()\n }\n source.once('error', error => {\n if (ended) return\n finish()\n send({ kind: 'stream-error', runtimeId, id, message: boundedMessage(error) })\n })\n try {\n for await (const chunk of source) {\n const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk as Uint8Array)\n if (ended) return\n // A chunk larger than the whole window can never be granted: split it.\n for (let offset = 0; offset < bytes.byteLength;) {\n const piece = bytes.subarray(offset, Math.min(offset + limits.streamChunkBytes, bytes.byteLength))\n // Explicit pull/credit flow control plus the per-worker aggregate bound;\n // reservation is atomic, so competing wakes cannot over-send.\n if (!(await acquireSendBudget(id, piece.byteLength, () => source.destroyed || ended))) {\n finish()\n send({ kind: 'stream-end', runtimeId, id })\n source.destroy()\n return\n }\n send({ kind: 'stream-chunk', runtimeId, id, bytes: new Uint8Array(piece) })\n offset += piece.byteLength\n }\n }\n finish()\n send({ kind: 'stream-end', runtimeId, id })\n } catch (error) {\n if (ended) return\n finish()\n send({ kind: 'stream-error', runtimeId, id, message: boundedMessage(error) })\n }\n}\n\n/** Evaluate extension metadata only in the worker and forward the Gateway's existing safe headers. */\nfunction snapshotResponseMetadata(response: {status?:number;contentType?:string;headers?:Record<string,string>}): {status?:number;contentType?:string;headers?:Record<string,string>} {\n const status = response.status\n const contentType = response.contentType\n if (status !== undefined && (!Number.isSafeInteger(status) || status < 200 || status > 599)) throw Object.assign(new Error('invalid HTTP status'), {code:'invalid_route_response',status:500})\n if (contentType !== undefined && (typeof contentType !== 'string' || contentType.length > 1024 || !/^[\\x20-\\x7e]+$/u.test(contentType) || !/^[\\w!#$&+.^-]+\\/[\\w!#$&+.^-]+(?:;[\\x20-\\x7e]*)?$/u.test(contentType))) throw Object.assign(new Error('invalid content type'), {code:'invalid_route_response',status:500})\n const headers:Record<string,string> = {}\n const source = response.headers\n let bytes = Buffer.byteLength(contentType ?? '')\n if (source !== undefined) {\n if (source === null || typeof source !== 'object' || Array.isArray(source)) throw Object.assign(new Error('invalid response headers'), {code:'invalid_route_response',status:500})\n for (const name of Object.keys(source)) {\n if (!/^(?:content-disposition|cache-control|etag)$/iu.test(name)) continue\n const value = source[name]\n if (typeof value !== 'string') throw Object.assign(new Error('invalid response header'), {code:'invalid_route_response',status:500})\n if (/[\\r\\n]/u.test(value)) continue\n bytes += Buffer.byteLength(name) + Buffer.byteLength(value)\n if (bytes > WORKER_RESPONSE_METADATA_MAX_BYTES) throw Object.assign(new Error('response headers are too large'), {code:'invalid_route_response',status:500})\n headers[name.toLowerCase()] = value\n }\n }\n return {...(status === undefined ? {} : {status}),...(contentType === undefined ? {} : {contentType}),...(source === undefined ? {} : {headers})}\n}\n\nfunction releaseStreamAccounting(id: string): void {\n finishedStreams.delete(id); streamCredit.delete(id); streamSent.delete(id); streamAcked.delete(id)\n wakeSendBudgetWaiters()\n}\n\nasync function activate(replyId: string, hostFile: string, generation: string, manifest: import('./extension-worker-protocol.js').WorkerActivationManifest): Promise<void> {\n // Async effect setups gate activation exactly like the in-process path: a\n // rejection fails activation instead of vanishing.\n const pendingEffects: Promise<void>[] = []\n let activationOpen = true\n const ensureOpen = (): void => { if (!activationOpen || generationController.signal.aborted) throw new Error('host activation is closed') }\n const api: RuntimeHostApi = {\n manifest: Object.freeze(manifest),\n context: Object.freeze({ logger: Object.freeze(loggerAdapter) }),\n schema: z,\n signal: generationController.signal,\n action(name, spec) {\n ensureOpen()\n if (!/^[a-z][a-z0-9-]{0,63}$/u.test(name) || typeof spec?.run !== 'function') throw runtimeError('invalid_action', `invalid action ${name}`)\n if (actions.has(name)) throw runtimeError('duplicate_action', `duplicate action ${name}`)\n if (actions.size + routes.length >= limits.maxRegistrations) throw runtimeError('extension_registration_limit', 'local worker registration limit reached')\n const timeoutMs = checkedTimeout(spec.timeoutMs, 'invalid_action')\n const input = spec.input\n actions.set(name, Object.freeze({ run: spec.run.bind(spec), ...(input === undefined ? {} : { input: typeof input === 'function' ? input : Object.freeze({ parse: input.parse.bind(input) }) }), ...(timeoutMs === undefined ? {} : { timeoutMs }) }))\n },\n route(spec) {\n ensureOpen()\n if (typeof spec?.handle !== 'function') throw runtimeError('invalid_route', 'invalid route')\n if (actions.size + routes.length >= limits.maxRegistrations) throw runtimeError('extension_registration_limit', 'local worker registration limit reached')\n const method = spec.method.toUpperCase()\n if (!['GET', 'HEAD', 'POST', 'PUT', 'PATCH', 'DELETE'].includes(method) || spec.kind !== undefined && spec.kind !== 'exact' && spec.kind !== 'prefix') throw new Error('invalid route')\n const path = normalizeWorkerRoutePath(spec.path)\n const kind = spec.kind ?? 'exact'\n if (routes.some(route => route.method === method && route.path === path && (route.kind ?? 'exact') === kind)) throw new Error('duplicate route')\n const timeoutMs = checkedTimeout(spec.timeoutMs, 'invalid_route')\n routes.push(Object.freeze({ method, path, kind, handle: spec.handle.bind(spec), ...(timeoutMs === undefined ? {} : { timeoutMs }) }))\n },\n effect(setup) {\n ensureOpen()\n const result = setup()\n if (result instanceof Promise) {\n const pending = result.then(async cleanup => {\n if (typeof cleanup !== 'function') return\n if (activationOpen && !generationController.signal.aborted) cleanups.push(cleanup)\n else await cleanup()\n })\n pendingEffects.push(pending)\n void pending.catch(() => undefined)\n } else if (typeof result === 'function') {\n cleanups.push(result)\n }\n },\n }\n let imported: HostModule\n try {\n imported = await import(`${pathToFileURL(hostFile).href}?dsh_generation=${generation}`) as HostModule\n } catch {\n send({ kind: 'error', runtimeId, id: replyId, code: 'host_load_failed', message: 'could not load host.mjs', status: 500 })\n return\n }\n if (generationController.signal.aborted) return\n try {\n if (imported.default !== undefined) await imported.default(api)\n await Promise.all(pendingEffects)\n } catch (error) {\n activationOpen = false\n const business = businessErrorShape(error)\n send({ kind: 'error', runtimeId, id: replyId, code: business?.code ?? 'host_activation_failed', message: boundedMessage(error), status: business?.status ?? 500 })\n return\n }\n activationOpen = false\n const actionMetadata: WorkerActionMetadata[] = [...actions.entries()].map(([name, spec]) => {\n const timeoutMs = validOperationTimeout(spec.timeoutMs)\n return { name, ...(timeoutMs === undefined ? {} : { timeoutMs }) }\n })\n const routeMetadata: WorkerRouteMetadata[] = routes.map(route => {\n const timeoutMs = validOperationTimeout(route.timeoutMs)\n return {\n method: String(route.method).toUpperCase(),\n path: normalizeWorkerRoutePath(route.path),\n kind: route.kind ?? 'exact',\n ...(timeoutMs === undefined ? {} : { timeoutMs }),\n }\n })\n send({ kind: 'activated', runtimeId, actions: actionMetadata, routes: routeMetadata })\n}\n\nfunction checkedTimeout(value: unknown, code: string): number | undefined {\n if (value === undefined) return undefined\n const timeout = validOperationTimeout(value)\n if (timeout === undefined) throw Object.assign(new Error('operation timeoutMs is invalid'), { code, status: 400 })\n return timeout\n}\n\nfunction runtimeError(code: string, message: string): Error & { readonly code: string; readonly status: number } {\n return Object.assign(new Error(message), { code, status: 400 })\n}\n\nasync function runAction(id: string, name: string, deviceId: string, input: unknown): Promise<void> {\n const spec = actions.get(name)\n if (spec === undefined) {\n send({ kind: 'error', runtimeId, id, code: 'action_not_found', message: `action ${name} not found`, status: 404 })\n return\n }\n const controller = new AbortController()\n requestControllers.set(id, controller)\n const onGenerationAbort = (): void => { controller.abort(generationController.signal.reason) }\n if (generationController.signal.aborted) controller.abort()\n else generationController.signal.addEventListener('abort', onGenerationAbort, { once: true })\n const errorReply = (error: unknown): void => {\n const business = businessErrorShape(error)\n if (business !== undefined) {\n send({ kind: 'error', runtimeId, id, code: business.code, message: business.message, status: business.status })\n return\n }\n send({ kind: 'error', runtimeId, id, code: 'extension_failed', message: boundedMessage(error), status: 500 })\n }\n try {\n let parsed = input\n if (spec.input !== undefined) {\n try {\n parsed = typeof spec.input === 'function' ? spec.input(input) : spec.input.parse(input) ?? input\n parsed = await parsed\n } catch {\n // Input validation failures keep the in-process contract: 400.\n send({ kind: 'error', runtimeId, id, code: 'invalid_action_input', message: 'action input is invalid', status: 400 })\n return\n }\n }\n controller.signal.throwIfAborted()\n const value = await spec.run({ signal: controller.signal, deviceId }, parsed)\n const bytes = serializeWorkerResult(value)\n if (bytes.byteLength > limits.resultMaxBytes) {\n send({ kind: 'error', runtimeId, id, code: 'extension_result_too_large', message: 'extension result is too large', status: 500 })\n return\n }\n send({ kind: 'result', runtimeId, id, bytes })\n } catch (error) {\n errorReply(error)\n } finally {\n requestControllers.delete(id)\n generationController.signal.removeEventListener('abort', onGenerationAbort)\n }\n}\n"],"x_google_ignoreList":[1,2],"mappings":";;;;;AA6BA,SAAS,QAAQ,OAAgB,MAAc,UAAkB,SAAiB,SAAyB;CACzG,MAAM,WAAW,SAAS;CAC1B,IAAI,OAAO,aAAa,YAAY,CAAC,OAAO,cAAc,QAAQ,KAAK,WAAW,WAAW,WAAW,SACtG,MAAM,IAAI,MAAM,iBAAiB,KAAK,2BAA2B,QAAQ,WAAW,SAAS;CAE/F,OAAO;AACT;;AAGA,SAAgB,qBAAqB,KAA2C;CAC9E,IAAI,QAAQ,KAAA,MAAc,QAAQ,QAAQ,OAAO,QAAQ,YAAY,MAAM,QAAQ,GAAG,IAAI,MAAM,IAAI,MAAM,iCAA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K;GAAG,QAAQ;EAAI,CAAC;CAC9G;CACA,IAAI;EACF,IAAI,SAAS;EACb,IAAI,KAAK,UAAU,KAAA,GACjB,IAAI;GACF,SAAS,OAAO,KAAK,UAAU,aAAa,KAAK,MAAM,KAAK,IAAI,KAAK,MAAM,MAAM,KAAK,KAAK;GAC3F,SAAS,MAAM;EACjB,QAAQ;GAEN,KAAK;IAAE,MAAM;IAAS;IAAW;IAAI,MAAM;IAAwB,SAAS;IAA2B,QAAQ;GAAI,CAAC;GACpH;EACF;EAEF,WAAW,OAAO,eAAe;EAEjC,MAAM,QAAQ,sBAAsB,MADhB,KAAK,IAAI;GAAE,QAAQ,WAAW;GAAQ;EAAS,GAAG,MAAM,CACnC;EACzC,IAAI,MAAM,aAAa,OAAO,gBAAgB;GAC5C,KAAK;IAAE,MAAM;IAAS;IAAW;IAAI,MAAM;IAA8B,SAAS;IAAiC,QAAQ;GAAI,CAAC;GAChI;EACF;EACA,KAAK;GAAE,MAAM;GAAU;GAAW;GAAI;EAAM,CAAC;CAC/C,SAAS,OAAO;EACd,WAAW,KAAK;CAClB,UAAU;EACR,mBAAmB,OAAO,EAAE;EAC5B,qBAAqB,OAAO,oBAAoB,SAAS,iBAAiB;CAC5E;AACF"}
package/lib/index.d.mts CHANGED
@@ -229,6 +229,37 @@ export declare class RequestTrustPolicy {
229
229
  canonicalOrigin(header: string | undefined): string | undefined;
230
230
  }
231
231
  //#endregion
232
+ //#region src/extension-worker-config.d.ts
233
+ /** Operator-owned limits for opt-in local extension worker execution. */
234
+ interface HostExecutionConfig {
235
+ readonly mode?: 'in-process' | 'worker';
236
+ /** Apply worker mode only to these exact local ids; omitted selects every local host. */
237
+ readonly extensions?: readonly string[] | undefined;
238
+ readonly maxWorkers?: number;
239
+ readonly maxRegistrations?: number;
240
+ readonly maxOldGenerationSizeMb?: number;
241
+ readonly maxYoungGenerationSizeMb?: number;
242
+ readonly stackSizeMb?: number;
243
+ readonly activationTimeoutMs?: number;
244
+ readonly operationTimeoutMs?: number;
245
+ readonly cancelGraceMs?: number;
246
+ readonly streamCancelGraceMs?: number;
247
+ readonly disposeGraceMs?: number;
248
+ readonly resultMaxBytes?: number;
249
+ readonly streamWindowBytes?: number;
250
+ readonly streamChunkBytes?: number;
251
+ readonly streamAggregateBytes?: number;
252
+ readonly logWindowMs?: number;
253
+ readonly logMessagesPerWindow?: number;
254
+ readonly logMessageBytes?: number;
255
+ }
256
+ /** Complete settings passed to each owned worker; Node limits do not isolate filesystem access. */
257
+ interface ResolvedHostExecutionConfig extends Required<Omit<HostExecutionConfig, 'extensions'>> {
258
+ readonly extensions: readonly string[] | undefined;
259
+ }
260
+ /** Resolve configuration once; reject malformed modes, ids and incoherent stream windows. */
261
+ export declare function resolveHostExecution(raw: unknown): ResolvedHostExecutionConfig;
262
+ //#endregion
232
263
  //#region src/config.d.ts
233
264
  /** Optional compression for exact, already authorized WebSocket paths. */
234
265
  interface WebSocketCompressionConfig {
@@ -264,6 +295,8 @@ interface DisabledTlsConfig {
264
295
  type TlsConfig = ProvidedTlsConfig | DisabledTlsConfig;
265
296
  /** Operator-facing plugin configuration. */
266
297
  interface PluginConfig {
298
+ /** Local host execution mode and owned worker budgets; defaults to in-process. */
299
+ hostExecution?: HostExecutionConfig;
267
300
  /** Optional setup JSON written by the packaged CLI. */
268
301
  setupFile?: string;
269
302
  /** Preferred HTTPS origin used to derive the public authority and listener port. */
@@ -319,6 +352,7 @@ interface PluginConfig {
319
352
  }
320
353
  /** Resolved, validated security and resource limits. */
321
354
  interface ResolvedGatewayConfig {
355
+ readonly hostExecution: ResolvedHostExecutionConfig;
322
356
  readonly listenHost: string;
323
357
  readonly listenPort: number;
324
358
  readonly upstreamOrigin: URL;
@@ -519,6 +553,117 @@ export declare class WebSocketPathStore {
519
553
  replace(paths: readonly string[]): Promise<string[]>;
520
554
  }
521
555
  //#endregion
556
+ //#region src/extension-worker-protocol.d.ts
557
+ /** Metadata for one action, crossing the boundary without its functions. */
558
+ interface WorkerActionMetadata {
559
+ readonly name: string;
560
+ readonly timeoutMs?: number;
561
+ }
562
+ /** Metadata for one route, crossing the boundary without its functions. */
563
+ interface WorkerRouteMetadata {
564
+ readonly method: string;
565
+ readonly path: string;
566
+ readonly kind?: 'exact' | 'prefix';
567
+ readonly timeoutMs?: number;
568
+ }
569
+ //#endregion
570
+ //#region src/extension-worker.d.ts
571
+ /** JSON bytes serialized and size-checked inside the worker. */
572
+ declare class PreparedJsonResult {
573
+ readonly bytes: Buffer;
574
+ constructor(bytes: Buffer);
575
+ }
576
+ /** Worker context is logger-only, never a Cordis Context or service proxy. */
577
+ type WorkerParentLogger = Record<'debug' | 'info' | 'warn' | 'error', (...args: unknown[]) => void>;
578
+ /** Every thread counts until actual exit, including activation, retirement and termination. */
579
+ declare class ExtensionWorkerBudget {
580
+ readonly maximum: number;
581
+ private count;
582
+ constructor(maximum: number);
583
+ get current(): number;
584
+ reserve(): () => void;
585
+ }
586
+ interface ExtensionWorkerHostOptions {
587
+ readonly workerModule: string | URL;
588
+ readonly hostFile: string;
589
+ readonly manifest: LocalExtensionManifest;
590
+ readonly generation: string;
591
+ readonly logger: WorkerParentLogger;
592
+ readonly activationTimeoutMs?: number;
593
+ readonly limits?: HostExecutionConfig;
594
+ readonly budget?: ExtensionWorkerBudget;
595
+ readonly onUnavailable?: (error: MobileExtensionError) => void;
596
+ }
597
+ interface ExtensionWorkerActivation {
598
+ readonly runtimeId: string;
599
+ readonly actions: readonly WorkerActionMetadata[];
600
+ readonly routes: readonly WorkerRouteMetadata[];
601
+ }
602
+ declare class ExtensionWorkerHost {
603
+ private readonly options;
604
+ private readonly limits;
605
+ private readonly worker;
606
+ private readonly pending;
607
+ private readonly routePending;
608
+ private readonly streams;
609
+ private readonly detachedRoutes;
610
+ private readonly executionGrace;
611
+ private readonly exited;
612
+ private readonly unavailableController;
613
+ private termination;
614
+ private activation;
615
+ private dead;
616
+ private disposed;
617
+ private maxBufferedBytes;
618
+ private cancelledStreams;
619
+ private logWindowStart;
620
+ private logCount;
621
+ private stdioBytes;
622
+ private stdioResume;
623
+ constructor(options: ExtensionWorkerHostOptions);
624
+ /** A stopped generation never silently respawns. */
625
+ available(): boolean;
626
+ /** Activate once and receive executable-free registration metadata. */
627
+ activate(): Promise<ExtensionWorkerActivation>;
628
+ actionMetadata(): readonly WorkerActionMetadata[];
629
+ routeMetadata(): readonly WorkerRouteMetadata[];
630
+ /** Underlying action: settles only when execution completes or the thread exits. */
631
+ invokeExecution(action: string, input: unknown, caller: {
632
+ readonly signal: AbortSignal;
633
+ readonly deviceId: string;
634
+ }): Promise<PreparedJsonResult>;
635
+ /** Direct caller budget; service dispatch observes invokeExecution separately. */
636
+ invoke(action: string, input: unknown, caller: {
637
+ readonly signal: AbortSignal;
638
+ readonly deviceId: string;
639
+ }): Promise<PreparedJsonResult>;
640
+ /** Underlying route: late streams are cancelled and observed to confirmed end. */
641
+ handleRouteExecution(routeIndex: number, request: MobileRouteRequest): Promise<MobileRouteResponse>;
642
+ /** Handler budget ends at stream-start; stream lifetime remains cancellation-bound. */
643
+ handleRoute(routeIndex: number, request: MobileRouteRequest): Promise<MobileRouteResponse>;
644
+ private callerBudget;
645
+ streamStats(): {
646
+ readonly activeStreams: number;
647
+ readonly maxBufferedBytes: number;
648
+ readonly cancelledStreams: number;
649
+ readonly bufferedBytes: number;
650
+ };
651
+ /** Graceful effects cleanup followed by termination; completion requires actual exit. */
652
+ dispose(): Promise<void>;
653
+ whenExited(): Promise<void>;
654
+ /** Stop admission now, retain execution/budget ownership until confirmed thread exit. */
655
+ terminate(reason: string): Promise<void>;
656
+ private unavailable;
657
+ private markUnavailable;
658
+ private armExecutionGrace;
659
+ private settleExecutionGrace;
660
+ private post;
661
+ private handleMessage;
662
+ private totalUnacked;
663
+ private openStream;
664
+ private cancelStream;
665
+ }
666
+ //#endregion
522
667
  //#region src/extensions.d.ts
523
668
  /** Maximum sizes enforced at the local-extension filesystem boundary. */
524
669
  export declare const EXTENSION_LIMITS: Readonly<{
@@ -625,6 +770,26 @@ interface ActiveLocalExtension {
625
770
  readonly controller: AbortController;
626
771
  readonly cleanups: readonly (() => void | Promise<void>)[];
627
772
  readonly digest: string;
773
+ readonly worker?: ExtensionWorkerHost;
774
+ }
775
+ /** Local execution options; the packaged worker entry is used unless a test supplies an override. */
776
+ interface LocalExecutionOptions {
777
+ readonly hostExecution?: HostExecutionConfig & {
778
+ readonly workerModule?: string;
779
+ };
780
+ readonly workerBudget?: ExtensionWorkerBudget;
781
+ }
782
+ /** Worker-host API: logger-only context, with no Cordis services or registrations crossing threads. */
783
+ interface MobileWorkerHostApi {
784
+ readonly manifest: LocalExtensionManifest;
785
+ readonly context: {
786
+ readonly logger: WorkerParentLogger;
787
+ };
788
+ readonly schema: typeof z;
789
+ readonly signal: AbortSignal;
790
+ action(name: string, spec: MobileHostAction): void;
791
+ route(spec: MobileHostRoute): void;
792
+ effect(setup: () => void | (() => void | Promise<void>) | Promise<void | (() => void | Promise<void>)>): void;
628
793
  }
629
794
  /** Validate a stable extension id. */
630
795
  export declare function assertExtensionId(value: unknown): string;
@@ -647,6 +812,11 @@ export declare class MobileAccessService extends Service {
647
812
  private localRefreshAbort;
648
813
  private localLifecycle;
649
814
  private localClosed;
815
+ private localExecution;
816
+ private localExecutionKey;
817
+ private workerBudget;
818
+ private readonly disposal;
819
+ private readonly recoveries;
650
820
  constructor(ctx: Context);
651
821
  /** Register a normal Cordis extension and return an idempotent disposer. */
652
822
  registerExtension(definition: MobileExtensionDefinition): () => void;
@@ -659,6 +829,23 @@ export declare class MobileAccessService extends Service {
659
829
  manifest(): readonly MobileExtensionClientEntry[];
660
830
  /** Return loaded and failed local extension counts without exposing host errors. */
661
831
  status(): MobileExtensionStatus;
832
+ /** Local Host status does not reveal filesystem paths, credentials or extension errors. */
833
+ hostStatus(): {
834
+ readonly hosts: readonly {
835
+ readonly id: string;
836
+ readonly name: string;
837
+ readonly mode: 'worker' | 'in-process';
838
+ readonly state: 'ready' | 'unavailable';
839
+ readonly generation: string;
840
+ }[];
841
+ readonly limits: {
842
+ readonly maxWorkers: number;
843
+ readonly workers: number;
844
+ };
845
+ };
846
+ /** Explicitly replace one unavailable worker without replaying requests or changing its files. */
847
+ recoverExtension(id: string): Promise<void>;
848
+ private queueDisposal;
662
849
  /** Locate one active extension. */
663
850
  extension(id: string, generation?: string): MobileExtensionDefinition | ActiveLocalExtension | undefined;
664
851
  /** Return the active local generation signal for gateway cancellation wiring. */
@@ -683,7 +870,7 @@ export declare class MobileAccessService extends Service {
683
870
  /** Match one route and invoke it with a generation-bound abort signal. */
684
871
  route(id: string, method: string, pathname: string, request: MobileRouteRequest, generation?: string): Promise<MobileRouteResponse>;
685
872
  /** Start the local directory watcher; an absent directory is intentionally inert. */
686
- startLocal(root: string, context: Context): Promise<void>;
873
+ startLocal(root: string, context: Context, options?: LocalExecutionOptions): Promise<void>;
687
874
  /** Stop the watcher and abort every local host generation. */
688
875
  stopLocal(): Promise<void>;
689
876
  /** Refresh all local extensions atomically; failures keep the previous snapshot. */
@@ -942,6 +1129,7 @@ export declare class FrpComponentManager {
942
1129
  readonly componentStorage: string;
943
1130
  readonly logRoot: string;
944
1131
  private readonly stagingRoot;
1132
+ private readonly stateDirectory;
945
1133
  private readonly artifact;
946
1134
  private readonly fetchArtifact;
947
1135
  private readonly extractArtifact;
@@ -1146,6 +1334,7 @@ export declare function createFrpcToml(settings: FrpSettings, localPort: number,
1146
1334
  export declare function createFrpServerTemplate(settings: FrpSettings): string;
1147
1335
  /** Owns private FRP settings and generation-specific frpc configuration. */
1148
1336
  export declare class FrpConfigStore {
1337
+ private readonly ownedRoot;
1149
1338
  readonly stateRoot: string;
1150
1339
  readonly settingsFile: string;
1151
1340
  readonly runtimeConfigFile: string;
@@ -1159,7 +1348,7 @@ export declare class FrpConfigStore {
1159
1348
  readonly proxyName: string;
1160
1349
  private settingsValue;
1161
1350
  private errorCode;
1162
- constructor(stateDirectory: string, proxyName?: string);
1351
+ constructor(stateDirectory: string, proxyName?: string, ownedRoot?: string);
1163
1352
  /** Load private settings while rejecting links, oversized files, and unknown fields. */
1164
1353
  initialize(): Promise<void>;
1165
1354
  /**
@@ -1372,14 +1561,14 @@ export declare function frpIngressPaths(stateFile: string): FrpIngressPaths;
1372
1561
  * replaced silently. The leaf is re-signed when expiring or no longer valid for
1373
1562
  * the public IPv4, and the running gateway reloads it after a renewal check.
1374
1563
  */
1375
- export declare function ensureFrpIngressCertificate(settings: FrpSettings, stateFile: string, now?: number, expectedCaFingerprint?: string): Promise<FrpIngressCertificate>;
1564
+ export declare function ensureFrpIngressCertificate(settings: FrpSettings, stateFile: string, now?: number, expectedCaFingerprint?: string, ownedRoot?: string): Promise<FrpIngressCertificate>;
1376
1565
  /**
1377
1566
  * Build the read-only self-check payload shown in the desktop panel.
1378
1567
  *
1379
1568
  * No secret ever leaves this function: the CA is reported by fingerprint only,
1380
1569
  * and the token is never read.
1381
1570
  */
1382
- export declare function frpIngressSelfCheck(settings: FrpSettings, stateFile: string): Promise<FrpIngressSelfCheck>;
1571
+ export declare function frpIngressSelfCheck(settings: FrpSettings, stateFile: string, ownedRoot?: string): Promise<FrpIngressSelfCheck>;
1383
1572
  //#endregion
1384
1573
  //#region src/managed-setup.d.ts
1385
1574
  /** One host a server leaf must be valid for: an IP literal, a DNS name, or both. */
@@ -1599,11 +1788,12 @@ export declare function validateOriginAllowedCidrs(value: unknown, listenHost: s
1599
1788
  export declare function parseOriginSettings(value: unknown): OriginSettings;
1600
1789
  /** Owns only origin settings; shared paired-device storage is never removed. */
1601
1790
  export declare class OriginConfigStore {
1791
+ private readonly ownedRoot;
1602
1792
  readonly stateRoot: string;
1603
1793
  readonly settingsFile: string;
1604
1794
  private settingsValue;
1605
1795
  private errorCode;
1606
- constructor(stateDirectory: string);
1796
+ constructor(stateDirectory: string, ownedRoot?: string);
1607
1797
  initialize(): Promise<void>;
1608
1798
  status(): OriginConfigurationStatus;
1609
1799
  settings(): OriginSettings | undefined;
@@ -1724,6 +1914,7 @@ export declare class CloudflaredComponentManager {
1724
1914
  readonly stateRoot: string;
1725
1915
  readonly logRoot: string;
1726
1916
  private readonly stagingRoot;
1917
+ private readonly stateDirectory;
1727
1918
  private readonly platform;
1728
1919
  private readonly arch;
1729
1920
  private readonly release;
@@ -1803,11 +1994,12 @@ export declare function parseCloudflaredTunnelSettings(value: unknown): Cloudfla
1803
1994
  export declare function mergeSavedCloudflaredTunnelSettings(partial: Readonly<Record<string, unknown>>, saved: CloudflaredTunnelSettings | undefined): CloudflaredTunnelSettings;
1804
1995
  /** Owns the private cloudflared tunnel configuration for one DSH installation. */
1805
1996
  export declare class CloudflaredTunnelStore {
1997
+ private readonly ownedRoot;
1806
1998
  readonly stateRoot: string;
1807
1999
  readonly settingsFile: string;
1808
2000
  private settingsValue;
1809
2001
  private errorCode;
1810
- constructor(stateDirectory: string);
2002
+ constructor(stateDirectory: string, ownedRoot?: string);
1811
2003
  /** Load private settings while rejecting links, oversized files and unknown fields. */
1812
2004
  initialize(): Promise<void>;
1813
2005
  /** Return configuration metadata without exposing the connector token. */
@@ -2009,5 +2201,5 @@ export declare function originGatewayConfig(template: ResolvedGatewayConfig, set
2009
2201
  /** Mount the resident control route and its optional authenticated LAN gateway. */
2010
2202
  export declare function apply(ctx: Context, config: PluginConfig): Promise<void>;
2011
2203
  //#endregion
2012
- export { type AccessControllerOptions, type AuthoritySpec, type BlockedUpgradePathEntry, type CaddySiteOptions, type CertRenewalStatus, type ClientModuleEntry, type ClientModulePreferenceSelection, type ClientModulePreferenceView, type CloudflaredComponentStatus, type CloudflaredControllerOptions, type CloudflaredState, type CloudflaredStatus, type CloudflaredTunnelMode, type CloudflaredTunnelSettings, type CloudflaredTunnelStatus, FRP_VHOST_HTTP_PORT as DEFAULT_VHOST_HTTP_PORT, type DeviceProbeResult, type DeviceSnapshot, type DeviceStore, type DeviceSummary, type DisabledTlsConfig, type FrpAttachOptions, type FrpAttachPlan, type FrpAttachPlanLocal, type FrpAttachPlanStep, type FrpAttachStepId, type FrpAttachTemplate, type FrpAttachVpsParts, type FrpComponentStatus, type FrpConfigurationStatus, type FrpControllerOptions, type FrpEntryTls, type FrpIngressCertificate, type FrpIngressPaths, type FrpIngressSelfCheck, type FrpSettings, type FrpState, type FrpStatus, type LocalExtensionManifest, type MobileAccessControlState, type MobileAccessControlStore, type MobileAccessService as MobileAccessRegistry, type MobileAccessRuntime, type MobileActionContext, type MobileExtensionClientEntry, type MobileExtensionDefinition, type MobileExtensionManifest, type MobileExtensionStatus, type MobileHostAction, type MobileHostRoute, type MobileRouteRequest, type MobileRouteResponse, type OriginConfigurationStatus, type OriginControllerOptions, type OriginSettings, type OriginState, type OriginStatus, type PairingResult, type ParsedCidr, type PluginConfig, type ProvidedTlsConfig, type RemoteProvider, type RemoteProviderController, type RemoteProviderState, type RemoteProviderStatus, type RenewalResult, type ResolvedGatewayConfig, type ServerCertificateAuthority, type ServerCertificateFiles, type ServerCertificateTarget, type SessionAuthorization, type SessionEndReason, type StoredDevice, type TaskCompletionEvent, type TaskEventContext, type TaskEventSession, type TaskEventSink, type TaskEventWatcherOptions, type TaskTurnEvent, type TlsConfig };
2204
+ export { type AccessControllerOptions, type AuthoritySpec, type BlockedUpgradePathEntry, type CaddySiteOptions, type CertRenewalStatus, type ClientModuleEntry, type ClientModulePreferenceSelection, type ClientModulePreferenceView, type CloudflaredComponentStatus, type CloudflaredControllerOptions, type CloudflaredState, type CloudflaredStatus, type CloudflaredTunnelMode, type CloudflaredTunnelSettings, type CloudflaredTunnelStatus, FRP_VHOST_HTTP_PORT as DEFAULT_VHOST_HTTP_PORT, type DeviceProbeResult, type DeviceSnapshot, type DeviceStore, type DeviceSummary, type DisabledTlsConfig, type FrpAttachOptions, type FrpAttachPlan, type FrpAttachPlanLocal, type FrpAttachPlanStep, type FrpAttachStepId, type FrpAttachTemplate, type FrpAttachVpsParts, type FrpComponentStatus, type FrpConfigurationStatus, type FrpControllerOptions, type FrpEntryTls, type FrpIngressCertificate, type FrpIngressPaths, type FrpIngressSelfCheck, type FrpSettings, type FrpState, type FrpStatus, type HostExecutionConfig, type LocalExtensionManifest, type MobileAccessControlState, type MobileAccessControlStore, type MobileAccessService as MobileAccessRegistry, type MobileAccessRuntime, type MobileActionContext, type MobileExtensionClientEntry, type MobileExtensionDefinition, type MobileExtensionManifest, type MobileExtensionStatus, type MobileHostAction, type MobileHostRoute, type MobileRouteRequest, type MobileRouteResponse, type MobileWorkerHostApi, type OriginConfigurationStatus, type OriginControllerOptions, type OriginSettings, type OriginState, type OriginStatus, type PairingResult, type ParsedCidr, type PluginConfig, type ProvidedTlsConfig, type RemoteProvider, type RemoteProviderController, type RemoteProviderState, type RemoteProviderStatus, type RenewalResult, type ResolvedGatewayConfig, type ResolvedHostExecutionConfig, type ServerCertificateAuthority, type ServerCertificateFiles, type ServerCertificateTarget, type SessionAuthorization, type SessionEndReason, type StoredDevice, type TaskCompletionEvent, type TaskEventContext, type TaskEventSession, type TaskEventSink, type TaskEventWatcherOptions, type TaskTurnEvent, type TlsConfig };
2013
2205
  //# sourceMappingURL=index.d.mts.map