@artenx/dshb 0.1.2 → 0.1.4

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-instruction-context-CxUldQkP.js","names":["valueMap","z"],"sources":["../../../node_modules/@deepseek-ai/dsh-typert-protocol/lib/index.js","../../../node_modules/@deepseek-ai/dsh-util-values/lib/index.js","../../../node_modules/@deepseek-ai/dsh-util-crypto/lib/index.js","../../../node_modules/@deepseek-ai/dsh-brand/lib/index.js","../../../node_modules/@deepseek-ai/cosmokit/lib/index.js","../../../node_modules/@deepseek-ai/schemastery/lib/index.mjs","../../../node_modules/@deepseek-ai/dsh-timeout/lib/index.js","../../../node_modules/@deepseek-ai/dsh-llm/lib/index.js","../src/core/workspace-instruction-context.ts"],"sourcesContent":["import { Service } from \"@deepseek-ai/cordis\";\n//#region lib/types/remote-error.js\n/** The one Remote failure class shared by owners, the Gateway, and consumers. */\n/**\n* One Remote call failure: a real Error carrying its stable code and typed\n* details. Owners throw it at the failure point; the Host Gateway encodes it\n* onto the wire unchanged; the Client face rebuilds an instance for the\n* `RemoteResult` error branch, so `throw result.error` keeps throw semantics.\n* Discrimination is always by `code`, never by instanceof.\n*/\nvar RemoteError = class extends Error {\n\tcode;\n\tdetails;\n\t/** Structural marker: cross-realm/bundle identification never uses instanceof. */\n\tisDSHRemoteError = true;\n\t/**\n\t* @param code - stable failure code declared in {@link RemoteErrorDetailsMap}.\n\t* @param message - human diagnostic carried across the wire.\n\t* @param details - structured payload typed by the code.\n\t* @param options - standard Error options (`cause` survives in-process only).\n\t*/\n\tconstructor(code, message, details, options) {\n\t\tsuper(message, options);\n\t\tthis.code = code;\n\t\tthis.details = details;\n\t\tthis.name = \"RemoteError\";\n\t}\n};\n/**\n* Structurally identify a RemoteError thrown across module or realm copies of\n* this class. Mechanism-internal: the Gateway and test assertions use it;\n* business code receives typed failures and never needs it.\n* @param value - a caught value.\n* @returns the failure when the marker matches, otherwise undefined.\n*/\nfunction remoteErrorOf(value) {\n\tif (typeof value === \"object\" && value !== null && value.isDSHRemoteError === true && typeof value.code === \"string\") return value;\n}\n//#endregion\n//#region lib/types/index.js\n/**\n* Remote decorators and explicit Gateway bindings backed by versioned\n* descriptors carried on decorated class prototypes. Strict reflection\n* remains a Typert compiler responsibility.\n* @module @deepseek-ai/dsh-typert-protocol\n*/\nconst TYPERT_REMOTE_SEGMENT_PATTERN = /^[A-Za-z0-9_$.-]+$/;\n/**\n* Test one generated Remote name against the Connection endpoint grammar.\n* @param value - namespace, method, lookup, or Context segment.\n* @returns whether the value can cross the shared RPC carrier unchanged.\n*/\nfunction isTypertRemoteSegment(value) {\n\treturn value !== \".\" && value !== \"..\" && TYPERT_REMOTE_SEGMENT_PATTERN.test(value);\n}\nconst REMOTE_METHOD_DESCRIPTOR = \"@deepseek-ai/dsh-typert-protocol/remote-methods\";\n/**\n* Bind one visible Service field to a Cordis key and Remote namespace.\n* @param service - owning Service instance, normally `this`.\n* @param serviceKey - exact Cordis service key.\n* @param options - optional distinct wire namespace.\n* @returns a frozen, inspectable binding with no compiler-injected metadata.\n*/\nfunction bindTypertRemote(service, serviceKey, options = {}) {\n\tvalidateName(\"service key\", serviceKey);\n\tconst namespace = options.namespace ?? serviceKey;\n\tvalidateName(\"namespace\", namespace);\n\treturn Object.freeze({\n\t\tservice,\n\t\tserviceKey,\n\t\tnamespace\n\t});\n}\n/** Cordis Service base that exposes its registered name through Typert Gateway. */\nvar TypertRemoteService = class extends Service {\n\t/** Visible binding consumed by the Gateway's source-mode discovery. */\n\ttypertRemote;\n\t/**\n\t* Register the Service and bind the same key to Typert Gateway.\n\t* @param ctx - owning Cordis Context.\n\t* @param serviceKey - exact Cordis service key and default wire namespace.\n\t* @param options - optional distinct wire namespace.\n\t*/\n\tconstructor(ctx, serviceKey, options = {}) {\n\t\tsuper(ctx, serviceKey);\n\t\tthis.typertRemote = bindTypertRemote(this, this.name, options);\n\t}\n};\nfunction Remote(methodExportOrOptions, context) {\n\tif (typeof methodExportOrOptions === \"string\") {\n\t\tvalidateName(\"Remote export name\", methodExportOrOptions);\n\t\treturn remoteDecorator({ kind: \"direct\" }, void 0, methodExportOrOptions);\n\t}\n\tif (typeof methodExportOrOptions === \"object\") {\n\t\tif (remoteOptionMode(methodExportOrOptions) !== \"stream\" || Reflect.ownKeys(methodExportOrOptions).length !== 1) throw new TypeError(\"typert-protocol: Remote options must contain exactly mode: \\\"stream\\\"\");\n\t\treturn remoteDecorator({ kind: \"direct\" }, \"stream\");\n\t}\n\tif (context === void 0) throw new TypeError(\"typert-protocol: Remote decorator context is missing\");\n\taddMarkerInitializer(context, { kind: \"direct\" });\n}\nfunction remoteOptionMode(options) {\n\treturn Reflect.get(options, \"mode\");\n}\nfunction remoteDecorator(invocation, mode, exportName) {\n\treturn function(_method, context) {\n\t\taddMarkerInitializer(context, invocation, mode, exportName);\n\t};\n}\n/**\n* Create a decorator for a method resolved from one Remote Scope.\n* @param key - scope key declared through the Context map.\n* @param exportName - optional Remote export name; defaults to the method name.\n* @returns a standard method decorator that records a versioned prototype descriptor.\n*/\nfunction RemoteScope(key, exportName) {\n\tvalidateName(\"Scope key\", key);\n\tif (exportName !== void 0) validateName(\"Remote export name\", exportName);\n\treturn remoteDecorator({\n\t\tkind: \"context\",\n\t\tcontext: key\n\t}, void 0, exportName);\n}\n/**\n* Read Remote markers attached to a live Service's class prototype.\n* The returned snapshot cannot mutate the stored descriptor.\n* @param service - live Service instance.\n* @returns markers in class declaration order.\n*/\nfunction remoteMethods(service) {\n\tconst prototype = Object.getPrototypeOf(service);\n\tif (prototype === null) return [];\n\treturn (readRemoteMethodDescriptor(prototype)?.methods ?? []).map((marker) => ({ ...marker }));\n}\nfunction readRemoteMethodDescriptor(prototype) {\n\tconst property = Object.getOwnPropertyDescriptor(prototype, REMOTE_METHOD_DESCRIPTOR);\n\tif (property === void 0) return void 0;\n\tconst descriptor = property.value;\n\tif (descriptor === null || typeof descriptor !== \"object\") throw new TypeError(\"typert-protocol: Remote method descriptor must be an object\");\n\tconst version = Reflect.get(descriptor, \"version\");\n\tif (version !== 1) throw new TypeError(`typert-protocol: unsupported Remote method descriptor version ${String(version)}`);\n\tconst methods = Reflect.get(descriptor, \"methods\");\n\tif (!Array.isArray(methods)) throw new TypeError(\"typert-protocol: Remote method descriptor methods must be an array\");\n\treturn descriptor;\n}\nfunction addMarkerInitializer(context, invocation, mode, exportName) {\n\tif (context.private || context.static || typeof context.name !== \"string\") throw new TypeError(\"typert-protocol: Remote decorators require a public instance method with a string name\");\n\tconst method = context.name;\n\tcontext.addInitializer(function() {\n\t\tconst prototype = Object.getPrototypeOf(this);\n\t\tif (prototype === null) throw new TypeError(`typert-protocol: cannot mark Remote method \"${method}\" on an object without a prototype`);\n\t\tmark(prototype, method, invocation, mode, exportName);\n\t});\n}\nfunction mark(prototype, method, invocation, mode, exportName) {\n\tconst descriptor = readRemoteMethodDescriptor(prototype);\n\tconst marker = Object.freeze({\n\t\tmethod,\n\t\t...exportName === void 0 || exportName === method ? {} : { exportName },\n\t\t...mode === void 0 ? {} : { mode },\n\t\tinvocation: Object.freeze(invocation)\n\t});\n\tconst current = descriptor?.methods.find((candidate) => candidate.method === method);\n\tif (current !== void 0) {\n\t\tif (current.exportName === marker.exportName && current.mode === marker.mode && sameInvocation(current.invocation, invocation)) return;\n\t\tthrow new Error(`typert-protocol: Remote method \"${method}\" has conflicting invocation markers`);\n\t}\n\tObject.defineProperty(prototype, REMOTE_METHOD_DESCRIPTOR, {\n\t\tconfigurable: true,\n\t\tvalue: Object.freeze({\n\t\t\tversion: 1,\n\t\t\tmethods: Object.freeze([...descriptor?.methods ?? [], marker])\n\t\t})\n\t});\n}\nfunction sameInvocation(left, right) {\n\tif (left.kind === \"direct\") return right.kind === \"direct\";\n\tif (right.kind === \"direct\") return false;\n\treturn left.context === right.context;\n}\nfunction validateName(subject, value) {\n\tif (!isTypertRemoteSegment(value)) throw new TypeError(`typert-protocol: ${subject} must contain only RPC endpoint segment characters`);\n}\n//#endregion\nexport { Remote, RemoteError, RemoteScope, TypertRemoteService, bindTypertRemote, isTypertRemoteSegment, remoteErrorOf, remoteMethods };\n","//#region lib/types/index.js\n/** Duplicate-install-safe JSON and immutable-value helpers. @module @deepseek-ai/dsh-util-values */\n/**\n* Mark an unreachable closed-union branch.\n* @param value - impossible value; an unhandled typed variant fails at the call site.\n* @param context - optional switch-site label included in the failure message.\n* @returns never; a runtime value that escaped its type always throws.\n*/\nfunction assertNever(value, context) {\n\tconst rendered = JSON.stringify(value) ?? String(value);\n\tthrow new Error(`unreachable variant${context ? ` in ${context}` : \"\"}: ${rendered}`);\n}\n/** Whether a realm-owned intrinsic prototype is backed by its native constructor. */\nfunction hasIntrinsicConstructor(prototype, name) {\n\tconst constructor = Object.getOwnPropertyDescriptor(prototype, \"constructor\")?.value;\n\tif (typeof constructor !== \"function\") return false;\n\ttry {\n\t\treturn constructor.name === name && constructor.prototype === prototype && Function.prototype.toString.call(constructor) === `function ${name}() { [native code] }`;\n\t} catch {\n\t\treturn false;\n\t}\n}\n/** Whether a candidate is one realm's intrinsic `Object.prototype`. */\nfunction isIntrinsicObjectPrototype(value) {\n\treturn Object.getPrototypeOf(value) === null && hasIntrinsicConstructor(value, \"Object\");\n}\n/** Whether an array uses one realm's intrinsic `Array.prototype`, not a subclass or forged prototype. */\nfunction hasPlainArrayPrototype(value) {\n\tconst prototype = Object.getPrototypeOf(value);\n\tif (!Array.isArray(prototype) || !hasIntrinsicConstructor(prototype, \"Array\")) return false;\n\tconst objectPrototype = Object.getPrototypeOf(prototype);\n\treturn typeof objectPrototype === \"object\" && objectPrototype !== null && isIntrinsicObjectPrototype(objectPrototype);\n}\n/** Whether an object is a plain or null-prototype record from any JavaScript realm. */\nfunction hasPlainObjectPrototype(value) {\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn prototype === null || typeof prototype === \"object\" && isIntrinsicObjectPrototype(prototype);\n}\n/** Return every JSON-visible object key, or reject own data JSON would discard. */\nfunction enumerableStringKeys(value) {\n\tconst keys = Reflect.ownKeys(value);\n\tif (keys.some((key) => typeof key !== \"string\" || !Object.prototype.propertyIsEnumerable.call(value, key))) return void 0;\n\treturn keys;\n}\n/** Validate lossless JSON iteratively, optionally materializing a detached snapshot. */\nfunction walkJsonValue(value, detach) {\n\tconst ancestors = /* @__PURE__ */ new Set();\n\tlet root;\n\tconst assign = (destination, item) => {\n\t\tif (destination === void 0) return;\n\t\tif (destination.kind === \"root\") root = item;\n\t\telse if (destination.kind === \"array\") destination.target[destination.index] = item;\n\t\telse Object.defineProperty(destination.target, destination.key, {\n\t\t\tvalue: item,\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true\n\t\t});\n\t};\n\tconst tasks = [{\n\t\tkind: \"visit\",\n\t\tvalue,\n\t\t...detach ? { destination: { kind: \"root\" } } : {}\n\t}];\n\tfor (let task = tasks.pop(); task !== void 0; task = tasks.pop()) {\n\t\tif (task.kind === \"leave\") {\n\t\t\tancestors.delete(task.source);\n\t\t\tcontinue;\n\t\t}\n\t\tif (task.kind === \"array-item\") {\n\t\t\tif (!Object.prototype.hasOwnProperty.call(task.source, task.index)) return void 0;\n\t\t\ttasks.push({\n\t\t\t\tkind: \"visit\",\n\t\t\t\tvalue: task.source[task.index],\n\t\t\t\t...task.target === void 0 ? {} : { destination: {\n\t\t\t\t\tkind: \"array\",\n\t\t\t\t\ttarget: task.target,\n\t\t\t\t\tindex: task.index\n\t\t\t\t} }\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (task.kind === \"object-property\") {\n\t\t\ttasks.push({\n\t\t\t\tkind: \"visit\",\n\t\t\t\tvalue: task.source[task.key],\n\t\t\t\t...task.target === void 0 ? {} : { destination: {\n\t\t\t\t\tkind: \"object\",\n\t\t\t\t\ttarget: task.target,\n\t\t\t\t\tkey: task.key\n\t\t\t\t} }\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst current = task.value;\n\t\tif (current === null) {\n\t\t\tassign(task.destination, null);\n\t\t\tcontinue;\n\t\t}\n\t\tif (typeof current === \"boolean\" || typeof current === \"string\") {\n\t\t\tassign(task.destination, current);\n\t\t\tcontinue;\n\t\t}\n\t\tif (typeof current === \"number\") {\n\t\t\tif (!Number.isFinite(current) || Object.is(current, -0)) return void 0;\n\t\t\tassign(task.destination, current);\n\t\t\tcontinue;\n\t\t}\n\t\tif (typeof current !== \"object\") return void 0;\n\t\tif (ancestors.has(current)) return void 0;\n\t\tif (Array.isArray(current)) {\n\t\t\tif (!hasPlainArrayPrototype(current)) return void 0;\n\t\t\tconst length = current.length;\n\t\t\tif (Reflect.ownKeys(current).length !== length + 1) return void 0;\n\t\t\tconst target = detach ? [] : void 0;\n\t\t\tif (target !== void 0) assign(task.destination, target);\n\t\t\tancestors.add(current);\n\t\t\ttasks.push({\n\t\t\t\tkind: \"leave\",\n\t\t\t\tsource: current\n\t\t\t});\n\t\t\tfor (let index = length - 1; index >= 0; index--) tasks.push({\n\t\t\t\tkind: \"array-item\",\n\t\t\t\tsource: current,\n\t\t\t\tindex,\n\t\t\t\t...target === void 0 ? {} : { target }\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (!hasPlainObjectPrototype(current)) return void 0;\n\t\tconst keys = enumerableStringKeys(current);\n\t\tif (keys === void 0) return void 0;\n\t\tconst target = detach ? {} : void 0;\n\t\tif (target !== void 0) assign(task.destination, target);\n\t\tancestors.add(current);\n\t\ttasks.push({\n\t\t\tkind: \"leave\",\n\t\t\tsource: current\n\t\t});\n\t\tfor (let index = keys.length - 1; index >= 0; index--) {\n\t\t\tconst key = keys[index];\n\t\t\t/* v8 ignore next -- the loop is bounded by the captured key count. */\n\t\t\tif (key === void 0) return void 0;\n\t\t\ttasks.push({\n\t\t\t\tkind: \"object-property\",\n\t\t\t\tsource: current,\n\t\t\t\tkey,\n\t\t\t\t...target === void 0 ? {} : { target }\n\t\t\t});\n\t\t}\n\t}\n\treturn detach ? root : true;\n}\n/**\n* Validate and detach lossless JSON in one read per property.\n* @param value - candidate value to validate and detach.\n* @returns the detached snapshot, or `undefined` when the value is not losslessly JSON-serializable.\n*/\nfunction snapshotJsonValue(value) {\n\treturn walkJsonValue(value, true);\n}\n/**\n* Test the same lossless JSON rules as {@link snapshotJsonValue} without detaching the value.\n* @param value - candidate value to test.\n* @returns whether the value survives a JSON round trip without loss.\n*/\nfunction isJsonValue(value) {\n\treturn walkJsonValue(value, false) === true;\n}\n/**\n* Compare JSON-compatible values structurally.\n* @param a - one JSON-compatible value.\n* @param b - the other JSON-compatible value.\n* @returns whether both values contain the same JSON data.\n*/\nfunction deepEqualJson(a, b) {\n\tif (a === b) return true;\n\tif (typeof a !== \"object\" || typeof b !== \"object\" || a === null || b === null) return false;\n\tif (Array.isArray(a) || Array.isArray(b)) {\n\t\tif (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false;\n\t\treturn a.every((entry, index) => deepEqualJson(entry, b[index]));\n\t}\n\tconst left = a;\n\tconst right = b;\n\tconst keys = Object.keys(left);\n\tif (keys.length !== Object.keys(right).length) return false;\n\treturn keys.every((key) => key in right && deepEqualJson(left[key], right[key]));\n}\n/**\n* Deep-freeze an object graph in place while leaving live AbortSignal objects mutable.\n* @param value - value to freeze.\n* @returns the same value after every reachable enumerable child is frozen.\n*/\nfunction deepFreeze(value) {\n\tconst seen = /* @__PURE__ */ new WeakSet();\n\tconst pending = [{\n\t\tkind: \"visit\",\n\t\tnode: value\n\t}];\n\twhile (pending.length > 0) {\n\t\tconst task = pending.pop();\n\t\t/* v8 ignore next -- the loop condition guarantees one pending task. */\n\t\tif (task === void 0) continue;\n\t\tif (task.kind === \"property\") {\n\t\t\tpending.push({\n\t\t\t\tkind: \"visit\",\n\t\t\t\tnode: task.source[task.key]\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst node = task.node;\n\t\tif (node === null || typeof node !== \"object\") continue;\n\t\tif (node instanceof AbortSignal) continue;\n\t\tif (seen.has(node)) continue;\n\t\tseen.add(node);\n\t\tObject.freeze(node);\n\t\tconst keys = Object.keys(node);\n\t\tfor (let index = keys.length - 1; index >= 0; index--) {\n\t\t\tconst key = keys[index];\n\t\t\t/* v8 ignore next -- the loop is bounded by the captured key count. */\n\t\t\tif (key === void 0) continue;\n\t\t\tpending.push({\n\t\t\t\tkind: \"property\",\n\t\t\t\tsource: node,\n\t\t\t\tkey\n\t\t\t});\n\t\t}\n\t}\n\treturn value;\n}\n//#endregion\nexport { assertNever, deepEqualJson, deepFreeze, isJsonValue, snapshotJsonValue };\n","//#region lib/types/index.js\n/**\n* UUID minting that works in every JavaScript context this repository ships\n* to. `crypto.randomUUID` is a secure-context Web API — a page or worker\n* served over plain HTTP on a LAN address has no such method — while\n* `crypto.getRandomValues` is unrestricted everywhere (browsers, workers,\n* Node ≥ 19). One implementation here replaces per-caller polyfills; the\n* `no-restricted-properties` lint rule points `crypto.randomUUID` callers at\n* this module.\n* @module @deepseek-ai/dsh-util-crypto\n*/\n/**\n* Encode bytes as canonical base64 without overflowing function argument limits.\n* @param data - Bytes to encode.\n* @returns base64 text.\n*/\nfunction bytesToBase64(data) {\n\tlet binary = \"\";\n\tconst chunk = 32768;\n\tfor (let offset = 0; offset < data.length; offset += chunk) binary += String.fromCharCode(...data.subarray(offset, offset + chunk));\n\treturn btoa(binary);\n}\n/**\n* Random v4 UUID, minted from `crypto.getRandomValues`.\n* @returns the UUID string.\n*/\nfunction randomUUID() {\n\tconst bytes = globalThis.crypto.getRandomValues(new Uint8Array(16));\n\tconst hex = Array.from(bytes, (byte, index) => {\n\t\treturn (index === 6 ? byte & 15 | 64 : index === 8 ? byte & 63 | 128 : byte).toString(16).padStart(2, \"0\");\n\t}).join(\"\");\n\treturn `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;\n}\n//#endregion\nexport { bytesToBase64, randomUUID };\n","//#region lib/types/index.js\n/**\n* Duplicate-install-safe nominal primitive helpers.\n*\n* A brand makes structurally identical strings or numbers non-interchangeable\n* at the type level: a `SessionId` cannot be passed where a `ToolCallId` is\n* expected, and an event sequence cannot be passed as a log offset. Comparison,\n* logging, and serialization retain the underlying primitive behavior.\n*\n* This package owns no concrete domain value and keeps no runtime identity or mutable\n* state, so independently installed copies produce interchangeable values.\n*\n* @module @deepseek-ai/dsh-brand\n*/\n/**\n* Apply a compile-time string brand without changing the value.\n* @param value - string admitted by the domain that owns the target brand.\n* @returns the same string with the requested compile-time brand.\n*/\nfunction brandString(value) {\n\treturn value;\n}\n/**\n* Apply a compile-time number brand without changing the value.\n* @param value - number admitted by the domain that owns the target brand.\n* @returns the same number with the requested compile-time brand.\n*/\nfunction brandNumber(value) {\n\treturn value;\n}\n//#endregion\nexport { brandNumber, brandString };\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/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/** Deeply compare arrays, dates, regexps, buffers, and plain object fields. */\nfunction deepEqual(a, b, strict) {\n\tif (a === b) return true;\n\tif (!strict && isNullable(a) && isNullable(b)) return true;\n\tif (typeof a !== typeof b) return false;\n\tif (typeof a !== \"object\") return false;\n\tif (!a || !b) return false;\n\tfunction check(test, then) {\n\t\treturn test(a) ? test(b) ? then(a, b) : false : test(b) ? false : void 0;\n\t}\n\treturn check(Array.isArray, (a, b) => a.length === b.length && a.every((item, index) => deepEqual(item, b[index]))) ?? check(is(\"Date\"), (a, b) => a.valueOf() === b.valueOf()) ?? check(is(\"RegExp\"), (a, b) => a.source === b.source && a.flags === b.flags) ?? check(isArrayBufferLike, (a, b) => {\n\t\tif (a.byteLength !== b.byteLength) return false;\n\t\tconst viewA = new Uint8Array(a);\n\t\tconst viewB = new Uint8Array(b);\n\t\tfor (let i = 0; i < viewA.length; i++) if (viewA[i] !== viewB[i]) return false;\n\t\treturn true;\n\t}) ?? Object.keys({\n\t\t...a,\n\t\t...b\n\t}).every((key) => deepEqual(a[key], b[key], strict));\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, deduplicate, deepEqual, defineProperty, difference, filterKeys, formatProperty, hexToArrayBuffer, hyphenate, intersection, is, isNonNullable, isNullable, isPlainObject, makeArray, mapValues, mapValues as valueMap, noop, omit, paramCase, pick, remove, sanitize, snakeCase, trimSlash, uncapitalize, union };\n","import { Binary, clone, deepEqual, filterKeys, isNullable, isPlainObject, 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 (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} });\nconst resolvers = {};\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.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}\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.default;\n\t}\n}\nSchema.extend(\"array\", (data, { inner, meta }, options) => {\n\tif (!Array.isArray(data)) throw new ValidationError(`expected array but got ${data}`, options);\n\tcheckWithinRange(data.length, meta, \"array length\", options, !isNullable(inner.meta.default));\n\treturn [data.map((_, index) => property(data, index, inner, options))];\n});\nSchema.extend(\"dict\", (data, { inner, sKey }, options, strict) => {\n\tif (!isPlainObject(data)) throw new ValidationError(`expected object but got ${data}`, options);\n\tconst result = {};\n\tfor (const key in data) {\n\t\tlet rKey;\n\t\ttry {\n\t\t\trKey = Schema.resolve(key, sKey, options)[0];\n\t\t} catch (error) {\n\t\t\tif (strict) continue;\n\t\t\tthrow error;\n\t\t}\n\t\tresult[rKey] = property(data, key, inner, options);\n\t\tdata[rKey] = data[key];\n\t\tif (key !== rKey) delete data[key];\n\t}\n\treturn [result];\n});\nSchema.extend(\"tuple\", (data, { list }, options, strict) => {\n\tif (!Array.isArray(data)) throw new ValidationError(`expected array but got ${data}`, options);\n\tconst result = list.map((inner, index) => property(data, index, inner, options));\n\tif (strict) return [result];\n\tresult.push(...data.slice(list.length));\n\treturn [result];\n});\nfunction merge(result, data) {\n\tfor (const key in data) {\n\t\tif (key in result) continue;\n\t\tresult[key] = data[key];\n\t}\n}\nSchema.extend(\"object\", (data, { dict }, options, strict) => {\n\tif (!isPlainObject(data)) throw new ValidationError(`expected object but got ${data}`, options);\n\tconst result = {};\n\tfor (const key in dict) {\n\t\tconst value = property(data, key, dict[key], options);\n\t\tif (!isNullable(value) || key in data) result[key] = value;\n\t}\n\tif (!strict) merge(result, data);\n\treturn [result];\n});\nSchema.extend(\"union\", (data, { list, toString }, options, strict) => {\n\tconst messages = [];\n\tfor (const inner of list) try {\n\t\treturn Schema.resolve(data, inner, options, strict);\n\t} catch (error) {\n\t\tmessages.push(error);\n\t}\n\tthrow new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options);\n});\nSchema.extend(\"intersect\", (data, { list, toString }, options, strict) => {\n\tif (!list.length) return [data];\n\tlet result;\n\tfor (const inner of list) {\n\t\tconst value = Schema.resolve(data, inner, options, true)[0];\n\t\tif (isNullable(value)) continue;\n\t\tif (isNullable(result)) result = value;\n\t\telse if (typeof result !== typeof value) throw new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options);\n\t\telse if (typeof value === \"object\") merge(result ??= {}, value);\n\t\telse if (result !== value) throw new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options);\n\t}\n\tif (!strict && isPlainObject(data)) merge(result, data);\n\treturn [result];\n});\nSchema.extend(\"transform\", (data, { inner, callback, preserve }, options) => {\n\tconst [result, adapted = data] = Schema.resolve(data, inner, options, true);\n\tif (preserve) return [callback(result)];\n\telse return [callback(result), callback(adapted)];\n});\nconst formatters = {};\nfunction defineMethod(name, keys, format) {\n\tformatters[name] = format;\n\tObject.assign(Schema, { [name](...args) {\n\t\tconst schema = new Schema({ type: name });\n\t\tkeys.forEach((key, index) => {\n\t\t\tswitch (key) {\n\t\t\t\tcase \"sKey\":\n\t\t\t\t\tschema.sKey = args[index] ?? Schema.string();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"inner\":\n\t\t\t\t\tschema.inner = Schema.from(args[index]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"list\":\n\t\t\t\t\tschema.list = args[index].map(Schema.from);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"dict\":\n\t\t\t\t\tschema.dict = valueMap(args[index], Schema.from);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"bits\":\n\t\t\t\t\tschema.bits = {};\n\t\t\t\t\tfor (const key in args[index]) {\n\t\t\t\t\t\tif (typeof args[index][key] !== \"number\") continue;\n\t\t\t\t\t\tschema.bits[key] = args[index][key];\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"callback\": {\n\t\t\t\t\tconst callback = schema.callback = args[index];\n\t\t\t\t\tcallback[\"toJSON\"] ||= () => callback.toString();\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"constructor\": {\n\t\t\t\t\tconst constructor = schema.constructor = args[index];\n\t\t\t\t\tif (typeof constructor === \"function\") constructor[\"toJSON\"] ||= () => constructor[\"name\"];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault: schema[key] = args[index];\n\t\t\t}\n\t\t});\n\t\tif (name === \"object\" || name === \"dict\") schema.meta.default = {};\n\t\telse if (name === \"array\" || name === \"tuple\") schema.meta.default = [];\n\t\telse if (name === \"bitset\") schema.meta.default = 0;\n\t\treturn schema;\n\t} });\n}\ndefineMethod(\"is\", [\"constructor\"], ({ constructor }) => {\n\tif (typeof constructor === \"function\") return constructor.name;\n\telse return constructor;\n});\ndefineMethod(\"any\", [], () => \"any\");\ndefineMethod(\"never\", [], () => \"never\");\ndefineMethod(\"const\", [\"value\"], ({ value }) => typeof value === \"string\" ? JSON.stringify(value) : value);\ndefineMethod(\"string\", [], () => \"string\");\ndefineMethod(\"number\", [], () => \"number\");\ndefineMethod(\"boolean\", [], () => \"boolean\");\ndefineMethod(\"bitset\", [\"bits\"], () => \"bitset\");\ndefineMethod(\"function\", [], () => \"function\");\ndefineMethod(\"array\", [\"inner\"], ({ inner }) => `${inner.toString(true)}[]`);\ndefineMethod(\"dict\", [\"inner\", \"sKey\"], ({ inner, sKey }) => `{ [key: ${sKey.toString()}]: ${inner.toString()} }`);\ndefineMethod(\"tuple\", [\"list\"], ({ list }) => `[${list.map((inner) => inner.toString()).join(\", \")}]`);\ndefineMethod(\"object\", [\"dict\"], ({ dict }) => {\n\tif (Object.keys(dict).length === 0) return \"{}\";\n\treturn `{ ${Object.entries(dict).map(([key, inner]) => {\n\t\treturn `${key}${inner.meta.required ? \"\" : \"?\"}: ${inner.toString()}`;\n\t}).join(\", \")} }`;\n});\ndefineMethod(\"union\", [\"list\"], ({ list }, inline) => {\n\tconst result = list.map(({ toString: format }) => format()).join(\" | \");\n\treturn inline ? `(${result})` : result;\n});\ndefineMethod(\"intersect\", [\"list\"], ({ list }) => {\n\treturn `${list.map((inner) => inner.toString(true)).join(\" & \")}`;\n});\ndefineMethod(\"transform\", [\n\t\"inner\",\n\t\"callback\",\n\t\"preserve\"\n], ({ inner }, isInner) => inner.toString(isInner));\n//#endregion\nexport { Schema as default };\n","//#region lib/types/index.js\n/**\n* Shared timeout arithmetic, signal fusion, and classification. The library\n* only notifies through abort signals; each capability still owns the mechanism\n* that stops its work and translates timeout reasons into public outcomes.\n* @module @deepseek-ai/dsh-timeout\n*/\n/**\n* Internal abort reason carrying a capability-owned code and elapsed deadline.\n* Providers translate it through {@link timeoutOf} before returning to callers.\n*/\nvar TimeoutReason = class extends Error {\n\tcode;\n\ttimeoutMs;\n\tname = \"TimeoutReason\";\n\t/**\n\t* @param code Capability-owned timeout code (e.g. `BASH_TIMEOUT`).\n\t* @param timeoutMs The deadline that elapsed, in milliseconds.\n\t*/\n\tconstructor(code, timeoutMs) {\n\t\tsuper(`${code} after ${timeoutMs}ms`);\n\t\tthis.code = code;\n\t\tthis.timeoutMs = timeoutMs;\n\t}\n};\n/** Largest delay Node schedules without clamping it to one millisecond. */\nconst MAX_TIMER_DELAY_MS = 2147483647;\nfunction assertTimerDelay(timeoutMs, name) {\n\tif (!Number.isFinite(timeoutMs) || timeoutMs <= 0 || timeoutMs > 2147483647) throw new Error(`${name} must be a positive finite number no greater than ${MAX_TIMER_DELAY_MS}`);\n}\n/**\n* Validate a caller's optional timeout hint, use the backend default, then cap\n* it. Supplied values must be positive and finite; zero is not a public\n* disable-timeout sentinel.\n*\n* @param requested The caller's optional hint; validated when present.\n* @param def The backend default applied when `requested` is absent.\n* @param max The backend upper bound the result is capped to.\n* @param name Field name used in the thrown message (so the caller sees which input was\n* bad).\n* @returns The effective timeout in milliseconds: `min(requested ?? def, max)`.\n*/\nfunction clampTimeout(requested, def, max, name = \"timeoutMs\") {\n\tif (requested !== void 0 && (!Number.isFinite(requested) || requested <= 0)) throw new Error(`${name} must be a positive finite number`);\n\treturn Math.min(requested ?? def, max);\n}\n/**\n* Fuse upstream cancellation with an identifiable timeout. `timeoutMs <= 0` is\n* the internal no-timer sentinel; the returned disposer clears an armed timer.\n* The signal only notifies, so callers must stop their own work.\n*\n* @param upstream The caller's cancellation signal, if any, fused into the result.\n* @param timeoutMs Deadline in milliseconds; `<= 0` means \"no timeout\" (arm no timer).\n* @param code Capability-owned code stamped onto the timeout's {@link TimeoutReason}.\n* @returns The fused {@link Deadline} (signal + timer cleanup).\n*/\nfunction deadline(upstream, timeoutMs, code) {\n\tif (timeoutMs <= 0) return {\n\t\tsignal: upstream ?? new AbortController().signal,\n\t\t[Symbol.dispose]() {}\n\t};\n\tassertTimerDelay(timeoutMs, \"deadline timeoutMs\");\n\tconst timer = new AbortController();\n\tconst id = setTimeout(() => {\n\t\ttimer.abort(new TimeoutReason(code, timeoutMs));\n\t}, timeoutMs);\n\treturn {\n\t\tsignal: upstream !== void 0 ? AbortSignal.any([upstream, timer.signal]) : timer.signal,\n\t\t[Symbol.dispose]() {\n\t\t\tclearTimeout(id);\n\t\t}\n\t};\n}\n/**\n* Create a rearmable idle watchdog for an async iterator. The timer exists only\n* while {@link IdleWatchdog.next} is outstanding, so consumer think time does\n* not count as provider idle time. The returned signal is stable for the whole\n* call and only notifies; the iterator must observe it to terminate its work.\n*\n* @param upstream - caller cancellation fused into the stable signal.\n* @param timeoutMs - positive finite idle interval in milliseconds.\n* @param code - capability-owned code carried by the timeout reason.\n* @returns a stable signal, guarded next operation, and timer disposer.\n*/\nfunction idleWatchdog(upstream, timeoutMs, code) {\n\tassertTimerDelay(timeoutMs, \"idleWatchdog timeoutMs\");\n\tconst timeout = new AbortController();\n\tconst signal = upstream === void 0 ? timeout.signal : AbortSignal.any([upstream, timeout.signal]);\n\tlet timer;\n\tlet outstanding = false;\n\tlet disposed = false;\n\tconst arm = () => {\n\t\tif (timer !== void 0) clearTimeout(timer);\n\t\ttimer = setTimeout(() => {\n\t\t\ttimeout.abort(new TimeoutReason(code, timeoutMs));\n\t\t}, timeoutMs);\n\t};\n\treturn {\n\t\tsignal,\n\t\tasync next(iterator) {\n\t\t\tif (disposed) throw new Error(\"idleWatchdog is disposed\");\n\t\t\tif (outstanding) throw new Error(\"idleWatchdog next is already outstanding\");\n\t\t\toutstanding = true;\n\t\t\tarm();\n\t\t\ttry {\n\t\t\t\treturn await iterator.next();\n\t\t\t} finally {\n\t\t\t\tclearTimeout(timer);\n\t\t\t\ttimer = void 0;\n\t\t\t\toutstanding = false;\n\t\t\t}\n\t\t},\n\t\tpulse() {\n\t\t\tif (disposed || !outstanding) return;\n\t\t\tarm();\n\t\t},\n\t\t[Symbol.dispose]() {\n\t\t\tif (disposed) return;\n\t\t\tdisposed = true;\n\t\t\tif (timer !== void 0) clearTimeout(timer);\n\t\t\ttimer = void 0;\n\t\t}\n\t};\n}\n/**\n* Recover a timeout reason from a reason-bearing object. Supplying `code`\n* distinguishes this deadline from a nested upstream deadline; a foreign code\n* follows the ordinary cancellation path.\n*\n* @param x An {@link AbortSignal} or any `{ reason }` carrier (e.g. a caught abort error).\n* @param code When provided, only a {@link TimeoutReason} with this exact `code` matches.\n* @returns The matching {@link TimeoutReason}, else `undefined`.\n*/\nfunction timeoutOf(x, code) {\n\tconst reason = x.reason;\n\tif (!(reason instanceof TimeoutReason)) return void 0;\n\treturn code === void 0 || reason.code === code ? reason : void 0;\n}\n//#endregion\nexport { MAX_TIMER_DELAY_MS, TimeoutReason, clampTimeout, deadline, idleWatchdog, timeoutOf };\n","import { createRequire } from \"node:module\";\nimport { Remote, RemoteError, TypertRemoteService } from \"@deepseek-ai/dsh-typert-protocol\";\nimport { assertNever, deepFreeze, snapshotJsonValue } from \"@deepseek-ai/dsh-util-values\";\nimport { randomUUID } from \"@deepseek-ai/dsh-util-crypto\";\nimport { brandString } from \"@deepseek-ai/dsh-brand\";\nimport z from \"@deepseek-ai/schemastery\";\nimport { MAX_TIMER_DELAY_MS } from \"@deepseek-ai/dsh-timeout\";\n//#region lib/types/message.js\n/** Message value types, identity, and immutable construction helpers. */\n/**\n* Bound for a `notice` summary. The account rides a collapsed transcript row\n* and is committed to the durable log, while its inputs — task labels, goal\n* objectives, tool arguments — are caller text with no length of their own.\n*/\nconst CONTEXT_SUMMARY_MAX_CHARS = 120;\n/**\n* Bound one `notice` summary to {@link CONTEXT_SUMMARY_MAX_CHARS}.\n* @param summary - the producer's one-line account, of any length.\n* @returns the account, ellipsized when it exceeds the bound.\n*/\nfunction boundContextSummary(summary) {\n\treturn summary.length <= 120 ? summary : `${summary.slice(0, 119)}…`;\n}\n/**\n* Detach and deep-freeze a message whose identity already exists.\n* @param message - complete message, including its stable identity.\n* @returns an immutable snapshot that preserves the identity.\n*/\nfunction freezeMessage(message) {\n\treturn deepFreeze(structuredClone(message));\n}\n/**\n* Create one identified message and freeze it before publication.\n* @param input - complete role, content, and source for a new message.\n* @returns an immutable message with a fresh stable identity.\n*/\nfunction createMessage(input) {\n\treturn freezeMessage({\n\t\t...input,\n\t\tid: brandString(randomUUID())\n\t});\n}\n/**\n* Create one identified user-role message and freeze it before publication.\n* @param input - complete content and source for a new user message.\n* @returns an immutable user message with a fresh stable identity.\n*/\nfunction createUserMessage(input) {\n\treturn createMessage({\n\t\t...input,\n\t\trole: \"user\"\n\t});\n}\n/**\n* Create one identified model-produced assistant message and freeze it before publication.\n* @param input - complete content plus the provider, model, and optional replay state for a new assistant message.\n* @returns an immutable assistant message with fixed role/source tags and a fresh stable identity.\n*/\nfunction createAssistantMessage(input) {\n\treturn createMessage({\n\t\trole: \"assistant\",\n\t\tcontent: input.content,\n\t\tsource: {\n\t\t\tkind: \"model\",\n\t\t\t...input.source\n\t\t}\n\t});\n}\n/**\n* Create and freeze one identified system-role message holding a rendered\n* system prompt.\n* @param text - the complete rendered prompt; `''` records \"no system prompt\".\n* @param plugin - the plugin that assembled the prompt.\n* @returns an immutable system message with a fresh stable identity.\n*/\nfunction createSystemMessage(text, plugin) {\n\treturn createMessage({\n\t\trole: \"system\",\n\t\tcontent: text.length === 0 ? [] : [{\n\t\t\ttype: \"text\",\n\t\t\ttext\n\t\t}],\n\t\tsource: {\n\t\t\tkind: \"plugin\",\n\t\t\tplugin\n\t\t}\n\t});\n}\n/**\n* Create and freeze one identified tool-result message.\n* @param input - call identity, raw result blocks, and outcome.\n* @returns an immutable user-role tool-result message.\n*/\nfunction createToolResultMessage(input) {\n\treturn createUserMessage({\n\t\tsource: {\n\t\t\tkind: \"tool\",\n\t\t\tcallId: input.callId\n\t\t},\n\t\tcontent: [{\n\t\t\ttype: \"tool-result\",\n\t\t\ttoolCallId: input.callId,\n\t\t\tcontent: input.content,\n\t\t\tisError: input.isError\n\t\t}]\n\t});\n}\n//#endregion\n//#region lib/types/error.js\n/**\n* Harness error base with a stable machine-routable code and chained cause.\n* Package errors extend it so tool results and replay can retain failure class.\n* @module @deepseek-ai/dsh-llm/error\n*/\n/**\n* Base class for all harness errors. Carries a `code` (stable, programmatic —\n* e.g. `NO_ADAPTER`, `INVALID_ARGS`, `INVARIANT`) distinct from the\n* human-readable `message`, and supports `cause` chaining via the standard\n* `ErrorOptions`. `name` defaults to the subclass constructor name.\n*/\nvar HarnessError = class extends Error {\n\t/** Stable machine-routable failure class (e.g. `RATE_LIMIT`); route on this, never by parsing `message`. */\n\tcode;\n\tconstructor(message, code, options) {\n\t\tsuper(message, options);\n\t\tthis.code = code;\n\t\tthis.name = new.target.name;\n\t}\n};\n/** Canonical provider-neutral code for a model request rejected because its context window was exceeded. */\nconst CONTEXT_WINDOW_EXCEEDED_CODE = \"CONTEXT_WINDOW_EXCEEDED\";\n/** Canonical provider-neutral code for an exhausted account quota or balance. */\nconst QUOTA_EXCEEDED_CODE = \"QUOTA\";\n/**\n* Canonical provider-neutral code for a response that completed normally but\n* carried no content blocks at all. Providers occasionally emit a degenerate\n* completion (a terminal stop with zero output); adapters classify it as this\n* failure instead of yielding an empty assistant message, because an empty\n* message silently ends the turn with nothing for the user or the loop to act\n* on. The attempt produced nothing durable, so retry policy treats it as safe\n* to repeat.\n*/\nconst EMPTY_RESPONSE_CODE = \"EMPTY_RESPONSE\";\n/**\n* Canonical provider-neutral code for a credential that was supplied but\n* cannot be used — malformed rather than absent. Distinct from\n* `MISSING_CREDENTIAL` because the fix differs: correct the stored value\n* rather than supply one. Deliberately outside the default retryable set —\n* a malformed credential fails identically on every attempt.\n*/\nconst INVALID_CREDENTIAL_CODE = \"INVALID_CREDENTIAL\";\n/** Structured codes and plain phrases that explicitly name a context bound being exceeded. */\nconst STRUCTURED_CONTEXT_OVERFLOW = new RegExp(String.raw`(?:^|[^a-z0-9])context[\\s_-](?:length|window)[\\s_-]` + String.raw`(?:exceed(?:ed|s)?|overflow(?:ed)?|limit[\\s_-]exceeded)(?:$|[^a-z0-9])`, \"i\");\n/** Request-size wording that ties \"too large\" directly to model context capacity. */\nconst TOO_LARGE_FOR_CONTEXT = new RegExp(String.raw`\\b(?:request|prompt|input|messages?)\\s+(?:is\\s+|are\\s+)?` + String.raw`too\\s+(?:large|long)\\s+for\\s+(?:(?:this|the)\\s+)?` + String.raw`(?:model(?:'s)?\\s+)?context(?:\\s+window)?\\b`, \"i\");\n/** \"Exceeds\" wording is safe only when its object is explicitly the model context. */\nconst EXCEEDS_MODEL_CONTEXT = new RegExp(String.raw`\\b(?:input|prompt|request|messages?)\\b.{0,40}` + String.raw`\\b(?:exceed(?:s|ed)?|overflows?|is\\s+larger\\s+than)\\b.{0,40}` + String.raw`\\b(?:the\\s+)?(?:model(?:'s)?\\s+)?context(?:\\s+(?:length|window))?\\b`, \"i\");\n/**\n* Recognize the context-overflow wording used by OpenAI-compatible providers\n* and library adapters. Adapters pass all available provider code, type, and\n* message text so both thrown and in-band delivery styles share one classifier.\n* @param detail - provider error code/type/message text joined into one string.\n* @returns true when the detail identifies a request exceeding the model context window.\n*/\nfunction isContextWindowExceededError(detail) {\n\treturn STRUCTURED_CONTEXT_OVERFLOW.test(detail) || /\\b(?:maximum|max)(?:\\s+(?:allowed|supported))?\\s+context\\s+(?:length|window)\\b/i.test(detail) || TOO_LARGE_FOR_CONTEXT.test(detail) || /\\b(?:input|prompt|request)\\s+(?:is\\s+)?too\\s+(?:long|large)\\s+for\\s+(?:this|the)\\s+model\\b/i.test(detail) || EXCEEDS_MODEL_CONTEXT.test(detail);\n}\n/**\n* Recognize provider wording that identifies an exhausted account quota rather\n* than a transient request-rate limit.\n* @param detail - provider error code/type/message text joined into one string.\n* @returns true only for terminal quota, balance, credit, budget, or usage-limit wording.\n*/\nfunction isQuotaExceededError(detail) {\n\treturn /\\binsufficient[\\s_-]+(?:quota|balance|credits?)\\b/i.test(detail) || /\\b(?:quota|usage[\\s_-]+limit)[\\s_-]+(?:exceeded|exhausted|reached)\\b/i.test(detail) || /\\bexceed(?:ed|s)?[\\s_-]+(?:(?:your|the)[\\s_-]+)?(?:current[\\s_-]+)?quota\\b/i.test(detail) || /\\b(?:balance|credits?)[\\s_-]+(?:exhausted|depleted)\\b/i.test(detail) || /\\bout[\\s_-]+of[\\s_-]+(?:credits?|budget)\\b/i.test(detail);\n}\n/**\n* Render a thrown value with its full `cause` chain and AggregateError\n* members, so transport wrappers like undici's `TypeError: fetch failed`\n* surface the underlying failure instead of masking it. Plain structured\n* failures render their own data-backed `message`. Diagnostic-surface\n* rendering only (messages, notices, logs) — never parse the result; route on\n* {@link HarnessError.code}.\n* @param value - the caught value (`unknown` in catch clauses).\n* @returns the outermost message first, each cause appended with `: ` (skipped\n* when it repeats the wrapper message verbatim), and AggregateError members\n* bracketed and `; `-joined.\n*/\nfunction errorChain(value) {\n\tconst path = /* @__PURE__ */ new Set();\n\tconst render = (current) => {\n\t\tif (path.has(current)) return \"<circular cause>\";\n\t\tpath.add(current);\n\t\ttry {\n\t\t\tif (!(current instanceof Error)) {\n\t\t\t\tif (typeof current === \"object\" && current !== null) {\n\t\t\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(current, \"message\");\n\t\t\t\t\tif (descriptor !== void 0 && \"value\" in descriptor && typeof descriptor.value === \"string\") return descriptor.value;\n\t\t\t\t}\n\t\t\t\treturn String(current);\n\t\t\t}\n\t\t\tconst message = current.message === \"\" ? current.name : current.message;\n\t\t\tconst members = current instanceof AggregateError && current.errors.length > 0 ? ` [${current.errors.map(render).join(\"; \")}]` : \"\";\n\t\t\tconst causeText = current.cause === void 0 || current.cause === null ? \"\" : render(current.cause);\n\t\t\treturn `${message}${members}${causeText === \"\" || causeText === message ? \"\" : `: ${causeText}`}`;\n\t\t} catch {\n\t\t\treturn \"<unrenderable value>\";\n\t\t} finally {\n\t\t\tpath.delete(current);\n\t\t}\n\t};\n\treturn render(value);\n}\n/**\n* Narrow an arbitrary thrown value to a HarnessError (for `instanceof` at runtime boundaries).\n* @param value - the caught value (`unknown` in catch clauses).\n* @returns true only for real instances; duck-typed or cross-realm errors do not narrow.\n*/\nfunction isHarnessError(value) {\n\treturn value instanceof HarnessError;\n}\n//#endregion\n//#region lib/types/retry-policy.js\n/**\n* Provider-owned request-retry policy configuration and resolution.\n*\n* Adapters expose one resolved policy per registered provider route; the\n* optional dsh-llm-retry plugin executes it on the agent's failed-step extension point.\n*\n* @module @deepseek-ai/dsh-llm/retry-policy\n*/\nconst DEFAULT_MAX_RETRIES = 5;\nconst DEFAULT_INITIAL_DELAY_MS = 500;\nconst DEFAULT_MAX_DELAY_MS = 1e4;\nconst DEFAULT_JITTER_RATIO = .1;\nconst DEFAULT_RETRYABLE_CODES = Object.freeze([\n\tEMPTY_RESPONSE_CODE,\n\t\"RATE_LIMIT\",\n\t\"SERVER\",\n\t\"TIMEOUT\",\n\t\"TRANSPORT\"\n]);\nconst backoffSchema = z.object({\n\tinitialDelayMs: z.number().max(MAX_TIMER_DELAY_MS).default(DEFAULT_INITIAL_DELAY_MS),\n\tmaxDelayMs: z.number().max(MAX_TIMER_DELAY_MS).default(DEFAULT_MAX_DELAY_MS),\n\tjitterRatio: z.number().min(0).max(1).default(DEFAULT_JITTER_RATIO)\n});\nconst normalPolicySchema = z.object({\n\tmode: z.const(\"normal\").required(),\n\tmaxRetries: z.number().step(1).min(0).max(Number.MAX_SAFE_INTEGER).default(DEFAULT_MAX_RETRIES),\n\tretryableCodes: z.array(z.string()).default([...DEFAULT_RETRYABLE_CODES]),\n\tbackoff: backoffSchema\n});\nconst alwaysPolicySchema = z.object({\n\tmode: z.const(\"always\").required(),\n\tbackoff: backoffSchema\n});\n/** Cordis schema embedded by each concrete provider configuration. */\nconst RetryPolicySchema = z.union([normalPolicySchema, alwaysPolicySchema]);\nconst NORMAL_POLICY_KEYS = new Set([\n\t\"mode\",\n\t\"maxRetries\",\n\t\"retryableCodes\",\n\t\"backoff\"\n]);\nconst ALWAYS_POLICY_KEYS = new Set([\n\t\"mode\",\n\t\"maxRetries\",\n\t\"retryableCodes\",\n\t\"backoff\"\n]);\nconst BACKOFF_KEYS = new Set([\n\t\"initialDelayMs\",\n\t\"maxDelayMs\",\n\t\"jitterRatio\"\n]);\nfunction validateKeys(value, allowed, path) {\n\tfor (const key of Object.keys(value)) if (!allowed.has(key)) throw new Error(`${path}: unknown key \"${key}\"`);\n}\nfunction resolveBackoff(config, path) {\n\tif (config !== void 0) validateKeys(config, BACKOFF_KEYS, path);\n\tconst initialDelayMs = config?.initialDelayMs ?? DEFAULT_INITIAL_DELAY_MS;\n\tconst maxDelayMs = config?.maxDelayMs ?? DEFAULT_MAX_DELAY_MS;\n\tconst jitterRatio = config?.jitterRatio ?? DEFAULT_JITTER_RATIO;\n\tif (!Number.isFinite(initialDelayMs) || initialDelayMs <= 0 || initialDelayMs > MAX_TIMER_DELAY_MS) throw new Error(`${path}.initialDelayMs must be a positive finite number no greater than ${MAX_TIMER_DELAY_MS}`);\n\tif (!Number.isFinite(maxDelayMs) || maxDelayMs <= 0 || maxDelayMs > MAX_TIMER_DELAY_MS) throw new Error(`${path}.maxDelayMs must be a positive finite number no greater than ${MAX_TIMER_DELAY_MS}`);\n\tif (initialDelayMs > maxDelayMs) throw new Error(`${path}.initialDelayMs must be less than or equal to maxDelayMs`);\n\tif (!Number.isFinite(jitterRatio) || jitterRatio < 0 || jitterRatio > 1) throw new Error(`${path}.jitterRatio must be between 0 and 1`);\n\treturn Object.freeze({\n\t\tinitialDelayMs,\n\t\tmaxDelayMs,\n\t\tjitterRatio\n\t});\n}\n/**\n* Validate, default, and detach one provider-owned retry policy.\n* @param config - optional provider configuration; omission selects normal defaults.\n* @param path - diagnostic path naming the provider config that owns the value.\n* @returns an immutable policy safe to capture in provider registration state.\n*/\nfunction resolveRetryPolicy(config, path) {\n\tif (config === void 0) return Object.freeze({\n\t\tmode: \"normal\",\n\t\tmaxRetries: DEFAULT_MAX_RETRIES,\n\t\tretryableCodes: DEFAULT_RETRYABLE_CODES,\n\t\t...resolveBackoff(void 0, `${path}.backoff`)\n\t});\n\tswitch (config.mode) {\n\t\tcase \"normal\": {\n\t\t\tvalidateKeys(config, NORMAL_POLICY_KEYS, path);\n\t\t\tconst maxRetries = config.maxRetries ?? DEFAULT_MAX_RETRIES;\n\t\t\tconst retryableCodes = config.retryableCodes ?? [...DEFAULT_RETRYABLE_CODES];\n\t\t\tif (!Number.isSafeInteger(maxRetries) || maxRetries < 0) throw new Error(`${path}.maxRetries must be a non-negative safe integer`);\n\t\t\tif (retryableCodes.length === 0) throw new Error(`${path}.retryableCodes must not be empty`);\n\t\t\tif (retryableCodes.some((code) => typeof code !== \"string\" || code.length === 0)) throw new Error(`${path}.retryableCodes must contain only non-empty strings`);\n\t\t\tif (new Set(retryableCodes).size !== retryableCodes.length) throw new Error(`${path}.retryableCodes must not contain duplicates`);\n\t\t\treturn Object.freeze({\n\t\t\t\tmode: \"normal\",\n\t\t\t\tmaxRetries,\n\t\t\t\tretryableCodes: Object.freeze([...retryableCodes]),\n\t\t\t\t...resolveBackoff(config.backoff, `${path}.backoff`)\n\t\t\t});\n\t\t}\n\t\tcase \"always\":\n\t\t\tvalidateKeys(config, ALWAYS_POLICY_KEYS, path);\n\t\t\treturn Object.freeze({\n\t\t\t\tmode: \"always\",\n\t\t\t\t...resolveBackoff(config.backoff, `${path}.backoff`)\n\t\t\t});\n\t\tdefault: throw new Error(`${path}.mode must be \"normal\" or \"always\"`);\n\t}\n}\n//#endregion\n//#region lib/types/call-config.js\n/**\n* Conversation call configuration and freeze utilities. Provider routing,\n* model, reasoning effort, and sampling values are request-header state that\n* can affect cache reuse; request waterfalls replace them and the loop logs\n* changed snapshots instead of allowing silent per-call drift.\n* @module dsh-llm/call-config\n*/\n/** Process-local identities of request objects assembled by dsh-agent-loop. */\nconst AGENT_LOOP_REQUESTS = /* @__PURE__ */ new WeakSet();\n/**\n* Field-wise equality over {@link LlmCallConfig} — the comparison a caller\n* runs to decide whether a proposed configuration is a real change (worth a\n* logged header snapshot) or the held one restated.\n* @param a - one configuration.\n* @param b - the other.\n* @returns whether every field (including the `stop` list, element-wise) matches.\n*/\nfunction callConfigEquals(a, b) {\n\tif (a.provider !== b.provider || a.model !== b.model || a.reasoningEffort !== b.reasoningEffort || a.temperature !== b.temperature || a.maxTokens !== b.maxTokens) return false;\n\tif (a.stop === void 0 || b.stop === void 0) return a.stop === b.stop;\n\treturn a.stop.length === b.stop.length && a.stop.every((s, i) => s === b.stop?.[i]);\n}\n/**\n* Mark one exact request object as assembled by dsh-agent-loop.\n* @param request - loop-owned request envelope before LLM dispatch.\n* @returns the same request object marked as created by the process-local agent loop.\n*/\nfunction markAgentLoopRequest(request) {\n\tAGENT_LOOP_REQUESTS.add(request);\n\treturn request;\n}\n/**\n* Test whether the exact request object was assembled by dsh-agent-loop.\n* @param request - request envelope observed at the LLM waterfall.\n* @returns whether {@link markAgentLoopRequest} recorded this object.\n*/\nfunction isAgentLoopRequest(request) {\n\treturn AGENT_LOOP_REQUESTS.has(request);\n}\n//#endregion\n//#region lib/types/adapter-failure.js\n/**\n* Normalization for values thrown by a final LLM adapter boundary.\n*\n* @module @deepseek-ai/dsh-llm/adapter-failure\n*/\n/**\n* Detach serializable provider facts from a value thrown by an adapter.\n* @param value - arbitrary value thrown during adapter dispatch or iteration.\n* @returns immutable provider-neutral facts suitable for a terminal finish chunk.\n* @internal\n*/\nfunction normalizeLlmFailure(value) {\n\tconst error = value instanceof Error ? value : new HarnessError(thrownMessage(value), \"UNKNOWN\", { cause: value });\n\tconst carried = ownFailureSnapshot(error);\n\tif (carried !== void 0 && carried.code === ownErrorCode(error)) return carried;\n\treturn Object.freeze({\n\t\tmessage: errorMessage(error),\n\t\tcode: harnessErrorCode(error)\n\t});\n}\n/** Render a non-Error throw without letting hostile coercion escape normalization. */\nfunction thrownMessage(value) {\n\ttry {\n\t\tconst message = String(value);\n\t\treturn message.length > 0 ? message : \"LLM adapter failed\";\n\t} catch (_hostileThrownValue) {\n\t\treturn \"LLM adapter failed\";\n\t}\n}\n/** Read a foreign error's own data-backed `code` without invoking accessors. */\nfunction ownErrorCode(error) {\n\ttry {\n\t\tconst descriptor = Object.getOwnPropertyDescriptor(error, \"code\");\n\t\treturn descriptor !== void 0 && \"value\" in descriptor ? descriptor.value : void 0;\n\t} catch (_sdkPropertyTrap) {\n\t\treturn;\n\t}\n}\n/** Snapshot an own data property without invoking an SDK-defined accessor. */\nfunction ownFailureSnapshot(error) {\n\ttry {\n\t\tconst descriptor = Object.getOwnPropertyDescriptor(error, \"failure\");\n\t\treturn descriptor !== void 0 && \"value\" in descriptor ? failureSnapshot(descriptor.value) : void 0;\n\t} catch (_sdkPropertyTrap) {\n\t\treturn;\n\t}\n}\n/** Validate and detach an arbitrary serializable failure payload. */\nfunction failureSnapshot(value) {\n\tif (typeof value !== \"object\" || value === null) return void 0;\n\ttry {\n\t\tconst candidate = value;\n\t\tconst message = candidate.message;\n\t\tconst code = candidate.code;\n\t\tconst status = candidate.status;\n\t\tconst providerRetryAfterMs = candidate.providerRetryAfterMs;\n\t\tconst requestId = candidate.requestId;\n\t\tif (typeof message !== \"string\" || message.length === 0 || typeof code !== \"string\" || code.length === 0 || status !== void 0 && (!Number.isInteger(status) || status < 100 || status > 599) || providerRetryAfterMs !== void 0 && (!Number.isFinite(providerRetryAfterMs) || providerRetryAfterMs <= 0) || requestId !== void 0 && (typeof requestId !== \"string\" || requestId.length === 0)) return void 0;\n\t\treturn Object.freeze({\n\t\t\tmessage,\n\t\t\tcode,\n\t\t\t...status === void 0 ? {} : { status },\n\t\t\t...providerRetryAfterMs === void 0 ? {} : { providerRetryAfterMs },\n\t\t\t...requestId === void 0 ? {} : { requestId }\n\t\t});\n\t} catch (_sdkFailureGetter) {\n\t\treturn;\n\t}\n}\n/** Read an SDK error message without letting an accessor replace the primary failure. */\nfunction errorMessage(error) {\n\ttry {\n\t\tconst message = error.message;\n\t\tif (typeof message === \"string\" && message.length > 0) return message;\n\t} catch (_sdkMessageGetter) {}\n\treturn \"LLM adapter failed\";\n}\n/** Trust only Harness-owned codes; third-party SDK codes are not our taxonomy. */\nfunction harnessErrorCode(error) {\n\treturn error instanceof HarnessError ? error.code : \"UNKNOWN\";\n}\n//#endregion\n//#region lib/types/api-key.js\n/**\n* The one definition of a well-formed provider API key, shared by every\n* adapter that puts one in an HTTP header.\n* @module @deepseek-ai/dsh-llm/api-key\n*/\n/**\n* Characters an HTTP header value carries verbatim and every known provider\n* key uses: printable ASCII, space excluded. A key outside this set cannot\n* reach any provider — `fetch` refuses to build the header — so this is a\n* transport invariant rather than one provider's policy. Latin-1 is excluded\n* deliberately: a header could carry it, but no provider issues it, and\n* admitting it trades a local explained refusal for an opaque 401.\n*/\nconst LEGAL_API_KEY = /^[\\x21-\\x7E]+$/;\n/**\n* Judge one *supplied* API key, trimming surrounding whitespace first.\n*\n* Trimming is silent because a padded key has one unambiguous reading; every\n* other defect is reported. Absence is a configuration state this function\n* never sees — a profile naming no credential authenticates through the\n* provider's own ambient discovery or OAuth — so callers decide whether a\n* value was supplied before asking.\n* @param raw - the key exactly as configured, stored, or typed.\n* @returns the trimmed key, or why it cannot be used.\n*/\nfunction normalizeApiKey(raw) {\n\tconst value = raw.trim();\n\tif (value.length === 0) return {\n\t\tok: false,\n\t\treason: \"empty\"\n\t};\n\tif (!LEGAL_API_KEY.test(value)) return {\n\t\tok: false,\n\t\treason: \"illegalCharacters\"\n\t};\n\treturn {\n\t\tok: true,\n\t\tvalue\n\t};\n}\n//#endregion\n//#region lib/types/content.js\n/** Content-block structure helpers. @module @deepseek-ai/dsh-llm/content */\n/**\n* Bridge one attachment provider's host object location into the mounted\n* tool execution world. The consumer supplies the current filesystem\n* provider's mapping without making attachment or LLM definitions depend on it.\n* @param attachments - provider that owns the normalized attachment object.\n* @param mapHostPath - map one absolute host path into the current tool execution world.\n* @param ref - durable normalized attachment reference.\n* @returns a read-only execution-world path, or undefined when either provider exposes no mapping.\n* @throws an attachment error when the durable reference is invalid.\n*/\nfunction resolveImageAttachmentAccess(attachments, mapHostPath, ref) {\n\tconst hostPath = attachments.imageHostPath(ref);\n\tif (hostPath === void 0) return void 0;\n\tconst readonlyPath = mapHostPath(hostPath);\n\treturn readonlyPath === void 0 ? void 0 : { readonlyPath };\n}\nfunction quoted(value) {\n\treturn JSON.stringify(value);\n}\nfunction imageIdentity(ref) {\n\treturn ref.name === void 0 ? String(ref.attachmentId) : `${quoted(ref.name)} (${ref.attachmentId})`;\n}\nfunction extension(mediaType) {\n\tswitch (mediaType) {\n\t\tcase \"image/png\": return \".png\";\n\t\tcase \"image/jpeg\": return \".jpg\";\n\t\tcase \"image/webp\": return \".webp\";\n\t\tcase \"image/gif\": return \".gif\";\n\t\tdefault: return assertNever(mediaType, \"image extension\");\n\t}\n}\nfunction normalizedAccessText(ref, access) {\n\treturn ` Normalized copy (read-only; may be resized or re-encoded): ${quoted(access.readonlyPath)} (${ref.width}x${ref.height}px, ${ref.mediaType}). Source dimensions, format, and byte size may differ. Copy to a writable path ending in ${extension(ref.mediaType)} before editing.`;\n}\n/**\n* Stable text shown to a model that cannot accept one durable image reference.\n* @param ref - durable normalized attachment omitted from the request.\n* @returns deterministic text-only placeholder.\n*/\nfunction textOnlyImageText(ref) {\n\treturn `[image omitted because this model accepts text only; attachment sha256:${String(ref.attachmentId).slice(7, 15)}]`;\n}\n/**\n* Stable model-facing handle for one exact request image. Identity comes from\n* the occurrence's own durable reference: request versions are prepared per\n* attachment id, so one shared version may serve occurrences whose display\n* names differ.\n* @param ref - the occurrence's durable normalized attachment.\n* @param version - exact request-image dimensions shown beside the text.\n* @param access - optional path resolved for the current tool execution world.\n* @returns attachment handle and request-image dimensions.\n*/\nfunction requestImageHandleText(ref, version, access) {\n\tconst preview = `Image ${imageIdentity(ref)}; request preview ${version.width}x${version.height}px.`;\n\treturn access === void 0 ? `${preview} It may be resized or re-encoded; source dimensions, format, and byte size may differ.` : preview + normalizedAccessText(ref, access);\n}\n/**\n* Stable per-image placeholder for a request-limit omission.\n* @param ref - durable normalized attachment omitted from this request.\n* @param access - optional provider-resolved path for model tools.\n* @returns identity, normalized metadata, and the available recovery path.\n*/\nfunction offloadedImageText(ref, access) {\n\tconst identity = `image omitted to fit request image limits; ${imageIdentity(ref)}.`;\n\tif (access === void 0) return `[${identity} No local normalized image path is available; ask the user to attach it again if needed.]`;\n\treturn `[${identity}${normalizedAccessText(ref, access)}]`;\n}\n/**\n* True when typed model content contains an image block, walking nested\n* tool-result content. This is the one recursive image walk shared by every\n* image policy (capability gating, text-only serialization, compaction\n* survey), so a consumer cannot silently diverge on nesting depth.\n* @param content - typed model content blocks.\n* @returns whether any nested block is an image.\n*/\nfunction contentHasImage(content) {\n\treturn content.some((block) => block.type === \"image\" || block.type === \"tool-result\" && contentHasImage(block.content));\n}\n/**\n* True when typed model content contains a file block, walking nested\n* tool-result content on the same recursion every file policy shares.\n* Reads current content on every call without retaining scan results.\n* @param content - typed model content blocks.\n* @returns whether any nested block is a file.\n*/\nfunction contentHasFile(content) {\n\tfor (const block of content) if (block.type === \"file\" || block.type === \"tool-result\" && contentHasFile(block.content)) return true;\n\treturn false;\n}\n/**\n* Stable model-facing handle for one durable file reference: the address of\n* the verbatim stored copy and the instruction to read it on demand. This is\n* the only representation a provider ever receives for a file.\n* @param ref - durable verbatim file reference.\n* @param readonlyPath - execution-world path of the stored copy, when resolvable.\n* @returns deterministic handle text naming the file, its size, and its address.\n*/\nfunction fileHandleText(ref, readonlyPath) {\n\tconst digest = String(ref.attachmentId).slice(7, 15);\n\tconst identity = `File ${quoted(ref.name)} (${ref.bytes} bytes, sha256:${digest})`;\n\tif (readonlyPath === void 0) return `[${identity} was uploaded, but the current execution environment cannot access a readable path. Report that limitation if its contents are needed; do not claim to have read it.]`;\n\treturn `[${identity}: verbatim read-only copy saved at ${quoted(readonlyPath)}. Read that path with your file tools when its contents are needed; copy it to a writable location before modifying it. When delegating file work, include this saved path in the delegation prompt; only subagents sharing this execution environment can read it.]`;\n}\n/** Replace every file occurrence, including nested tool results, with handle text. */\nfunction replaceFilesWithHandles(blocks, resolvePath) {\n\tlet next;\n\tfor (const [index, block] of blocks.entries()) {\n\t\tif (block.type === \"file\") {\n\t\t\tnext ??= blocks.slice(0, index);\n\t\t\tnext.push({\n\t\t\t\ttype: \"text\",\n\t\t\t\ttext: fileHandleText(block.attachment, resolvePath(block.attachment))\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (block.type === \"tool-result\") {\n\t\t\tconst content = replaceFilesWithHandles(block.content, resolvePath);\n\t\t\tif (content !== block.content) {\n\t\t\t\tnext ??= blocks.slice(0, index);\n\t\t\t\tnext.push({\n\t\t\t\t\t...block,\n\t\t\t\t\tcontent\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tnext?.push(block);\n\t}\n\treturn next ?? blocks;\n}\n/**\n* Project durable file history into deterministic handle text for every model\n* route. Unlike images, no provider receives file blocks natively, so this\n* projection is unconditional in request assembly.\n* @param messages - complete request history.\n* @param resolvePath - resolve one reference's current execution-world read path.\n* @returns the original list without files, otherwise shallow message copies with handle text.\n*/\nfunction projectFilesToText(messages, resolvePath) {\n\tif (!messages.some((message) => contentHasFile(message.content))) return messages;\n\treturn messages.map((message) => {\n\t\tconst content = replaceFilesWithHandles(message.content, resolvePath);\n\t\treturn content === message.content ? message : {\n\t\t\t...message,\n\t\t\tcontent\n\t\t};\n\t});\n}\n/** Base64 length of raw image bytes, including padding. */\nfunction base64Length(bytes) {\n\treturn Math.ceil(bytes / 3) * 4;\n}\n/** Collect represented image lengths in request and nested-block order. */\nfunction collectImageLengths(blocks, lengths, policy) {\n\tfor (const block of blocks) if (block.type === \"image\") {\n\t\tconst bytes = policy.byteLength === void 0 ? block.attachment.bytes : policy.byteLength(block.attachment);\n\t\tlengths.push(policy.representation === \"base64\" ? base64Length(bytes) : bytes);\n\t} else if (block.type === \"tool-result\") collectImageLengths(block.content, lengths, policy);\n}\n/** Replace the first `remaining.count` image occurrences without mutating durable messages. */\nfunction replaceOldestImages(blocks, remaining, placeholder) {\n\tlet next;\n\tfor (const [index, block] of blocks.entries()) {\n\t\tif (block.type === \"image\" && remaining.count > 0) {\n\t\t\tremaining.count -= 1;\n\t\t\tnext ??= blocks.slice(0, index);\n\t\t\tnext.push({\n\t\t\t\ttype: \"text\",\n\t\t\t\ttext: placeholder(block.attachment)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (block.type === \"tool-result\") {\n\t\t\tconst content = replaceOldestImages(block.content, remaining, placeholder);\n\t\t\tif (content !== block.content) {\n\t\t\t\tnext ??= blocks.slice(0, index);\n\t\t\t\tnext.push({\n\t\t\t\t\t...block,\n\t\t\t\t\tcontent\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tnext?.push(block);\n\t}\n\treturn next ?? blocks;\n}\n/** Replace every image occurrence, including nested tool results, for a text-only model. */\nfunction replaceImagesForTextModel(blocks) {\n\tlet next;\n\tfor (const [index, block] of blocks.entries()) {\n\t\tif (block.type === \"image\") {\n\t\t\tnext ??= blocks.slice(0, index);\n\t\t\tnext.push({\n\t\t\t\ttype: \"text\",\n\t\t\t\ttext: textOnlyImageText(block.attachment)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (block.type === \"tool-result\") {\n\t\t\tconst content = replaceImagesForTextModel(block.content);\n\t\t\tif (content !== block.content) {\n\t\t\t\tnext ??= blocks.slice(0, index);\n\t\t\t\tnext.push({\n\t\t\t\t\t...block,\n\t\t\t\t\tcontent\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tnext?.push(block);\n\t}\n\treturn next ?? blocks;\n}\n/**\n* Project durable image history into deterministic text for an exact text-only model.\n* @param messages - complete request history.\n* @returns the original list without images, otherwise shallow message copies with stable placeholders.\n*/\nfunction projectImagesForTextModel(messages) {\n\tif (!messages.some((message) => contentHasImage(message.content))) return messages;\n\treturn messages.map((message) => {\n\t\tconst content = replaceImagesForTextModel(message.content);\n\t\treturn content === message.content ? message : {\n\t\t\t...message,\n\t\t\tcontent\n\t\t};\n\t});\n}\n/**\n* Number of oldest image occurrences one request projection removes, in whole\n* count and byte quanta, once a route budget is exceeded. The result depends\n* only on the represented lengths, so provider request pricing reproduces the\n* exact serialization decision without building the projected messages.\n* @param lengths - represented byte length of every occurrence, in request order.\n* @param policy - count/byte budgets and removal quanta; unbounded when absent.\n* @returns how many leading occurrences the projection replaces with placeholders.\n*/\nfunction offloadedImagePrefixCount(lengths, policy) {\n\tconst total = lengths.reduce((sum, bytes) => sum + bytes, 0);\n\tconst excessCount = policy.maxImages === void 0 ? 0 : Math.max(0, lengths.length - policy.maxImages);\n\tconst excessBytes = policy.maxBytes === void 0 ? 0 : Math.max(0, total - policy.maxBytes);\n\tif (excessCount === 0 && excessBytes === 0) return 0;\n\tconst countQuantum = policy.countQuantum ?? 1;\n\tconst byteQuantum = policy.byteQuantum ?? 1;\n\tconst removeCount = excessCount === 0 ? 0 : Math.ceil(excessCount / countQuantum) * countQuantum;\n\tconst removeBytes = excessBytes === 0 ? 0 : Math.ceil(excessBytes / byteQuantum) * byteQuantum;\n\tlet count = 0;\n\tlet removedBytes = 0;\n\tfor (const imageBytes of lengths) {\n\t\tif (count >= removeCount && (removeBytes === 0 || (byteQuantum === 1 ? removedBytes >= removeBytes : removedBytes > removeBytes))) break;\n\t\tremovedBytes += imageBytes;\n\t\tcount += 1;\n\t}\n\treturn count;\n}\n/**\n* Return a deterministic transient projection whose oldest images are replaced\n* in whole count and byte quanta after a route budget is exceeded. The target\n* depends only on complete durable history: at 129 one-megabyte images under\n* a 128 MiB bound with a 64 MiB quantum, the oldest 65 images are removed so\n* 64 MiB remain; that removed prefix stays fixed until total history exceeds\n* 192 MiB.\n* @param messages - complete request history, oldest first.\n* @param policy - route representation, budgets, and removal quanta.\n* @returns original messages below both bounds, otherwise shallow copies with deterministic placeholders.\n*/\nfunction offloadRequestImagesWithPolicy(messages, policy) {\n\tconst lengths = [];\n\tfor (const message of messages) collectImageLengths(message.content, lengths, policy);\n\tconst count = offloadedImagePrefixCount(lengths, policy);\n\tif (count === 0) return messages;\n\tconst remaining = { count };\n\treturn messages.map((message) => {\n\t\tconst content = replaceOldestImages(message.content, remaining, policy.placeholder);\n\t\treturn content === message.content ? message : {\n\t\t\t...message,\n\t\t\tcontent\n\t\t};\n\t});\n}\n//#endregion\n//#region lib/types/attribution.js\n/**\n* Centralize the non-secret product identity every provider request sends as `User-Agent`, keeping\n* adapters from drifting. See\n* `.agents/notes/implemented/architecture/2026-06-21-mandatory-app-attribution-headers.md`.\n*\n* App-attribution vocabulary for provider requests.\n* @module @deepseek-ai/dsh-llm/attribution\n*/\nconst { version } = createRequire(import.meta.url)(\"../package.json\");\n/**\n* The harness's own identity: the default every adapter sends. Deployments\n* that need a white-label identity pass their own {@link AppIdentity} to\n* {@link attributionHeaders} — omission falls back to this default; nothing\n* can suppress attribution entirely.\n*/\nconst APP_IDENTITY = {\n\tproduct: \"deepseek-harness\",\n\tversion,\n\turl: \"https://github.com/deepseek-ai/deepseek-harness\"\n};\n/**\n* The standard `User-Agent` value: `product/version (+url)`. The\n* parenthesized `+url` comment is the conventional self-identification form\n* (RFC 9110 §10.1.5 product + comment syntax).\n* @param identity - the identity to render; defaults to {@link APP_IDENTITY}.\n* @returns the ready-to-send header value.\n*/\nfunction userAgent(identity = APP_IDENTITY) {\n\treturn `${identity.product}/${identity.version} (+${identity.url})`;\n}\n/**\n* Build the attribution headers an adapter must send on every provider\n* request. Header names are lowercase (HTTP field names are case-insensitive\n* on the wire).\n* @param identity - the identity to send; defaults to {@link APP_IDENTITY} — omission cannot suppress attribution.\n* @returns headers to merge into the provider request (currently just `user-agent`).\n*/\nfunction attributionHeaders(identity = APP_IDENTITY) {\n\treturn { \"user-agent\": userAgent(identity) };\n}\n//#endregion\n//#region lib/types/brand.js\n/**\n* dsh-llm's owned branded ids: tool-call correlation and provider request\n* diagnostics.\n*\n* The `Branded<B>` primitive and stateless constructor live in\n* `@deepseek-ai/dsh-brand` so every owner of a cross-boundary id can brand it\n* without depending on dsh-llm; see that package's README for the\n* nominal-typing policy.\n*\n* @module @deepseek-ai/dsh-llm/brand\n*/\n/**\n* Brand a message identifier.\n* @param id - the opaque message identifier.\n* @returns the same string with the message-id brand.\n*/\nfunction MessageId(id) {\n\treturn brandString(id);\n}\n/**\n* Brand a string as a {@link ToolCallId}.\n* @param id - the provider-issued or synthesized call id.\n* @returns the same string with the tool-call-id brand.\n*/\nfunction ToolCallId(id) {\n\treturn brandString(id);\n}\n/**\n* Brand a provider-issued request identifier.\n* @param id - the opaque provider-issued string.\n* @returns the same string, branded; no validation is performed.\n*/\nfunction ProviderRequestId(id) {\n\treturn brandString(id);\n}\n/**\n* Brand one loop-owned streaming attempt identifier.\n* @param id - the opaque Agent-lifecycle-local identifier.\n* @returns the same string with the attempt-id brand.\n*/\nfunction LlmAttemptId(id) {\n\treturn brandString(id);\n}\n/**\n* Brand an adapter-owned reasoning-effort identifier.\n* @param id - the opaque identifier exposed by one model capability.\n* @returns the same string, branded; no validation is performed.\n*/\nfunction ReasoningEffortId(id) {\n\treturn brandString(id);\n}\n//#endregion\n//#region lib/types/assembler.js\n/**\n* Incremental chunk-to-message assembler. This is the single canonical assembly\n* algorithm used by the agent loop to build an assistant message from a chunk\n* stream while logging the raw chunks for replay fidelity.\n*\n* @module @deepseek-ai/dsh-llm/assembler\n*/\n/**\n* Incrementally assembles raw {@link StreamChunk}s into complete\n* {@link ContentBlock}s and a final assistant {@link Message}.\n*\n* The agent loop feeds it while logging raw chunks for replay fidelity, then\n* reads `blocks()` / `message()` / `usage` / `finish` once the stream ends,\n* or `interruptedBlocks()` when cancellation cut the stream short.\n*\n* Tolerant of delta-only protocols (no block-start/end); deltas arriving for\n* an index already closed by `block-end` are ignored (malformed stream) so a\n* misbehaving adapter cannot grow memory or corrupt a completed block.\n*/\nvar BlockAssembler = class {\n\tpartials = /* @__PURE__ */ new Map();\n\torder = [];\n\t_usage;\n\t_finish;\n\t_replayState;\n\t/**\n\t* Feed one chunk into the assembly state.\n\t* @param chunk - the next raw chunk, in stream order.\n\t*/\n\tpush(chunk) {\n\t\tswitch (chunk.type) {\n\t\t\tcase \"block-start\":\n\t\t\t\tif (!this.partials.has(chunk.index)) {\n\t\t\t\t\tthis.order.push(chunk.index);\n\t\t\t\t\tthis.partials.set(chunk.index, {\n\t\t\t\t\t\tblockType: chunk.blockType,\n\t\t\t\t\t\ttext: \"\",\n\t\t\t\t\t\ttoolCallArguments: \"\"\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\tcase \"text-delta\":\n\t\t\tcase \"reasoning-delta\": {\n\t\t\t\tconst partial = this.ensure(chunk.index, chunk.type === \"text-delta\" ? \"text\" : \"reasoning\");\n\t\t\t\tif (partial.block) return;\n\t\t\t\tpartial.text += chunk.text;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase \"tool-call-delta\": {\n\t\t\t\tconst partial = this.ensure(chunk.index, \"tool-call\");\n\t\t\t\tif (partial.block) return;\n\t\t\t\tpartial.toolCallId = chunk.id;\n\t\t\t\tif (chunk.name) partial.toolCallName = chunk.name;\n\t\t\t\tpartial.toolCallArguments += chunk.argumentsDelta;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase \"block-end\": {\n\t\t\t\tconst partial = this.ensure(chunk.index, chunk.block.type);\n\t\t\t\tif (partial.block) return;\n\t\t\t\tpartial.block = chunk.block;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase \"usage\":\n\t\t\t\tthis._usage = chunk.usage;\n\t\t\t\treturn;\n\t\t\tcase \"finish\":\n\t\t\t\tthis._finish = chunk.reason;\n\t\t\t\tthis._replayState = chunk.replayState;\n\t\t\t\treturn;\n\t\t\tdefault: return assertNever(chunk, \"BlockAssembler.push\");\n\t\t}\n\t}\n\tensure(index, blockType) {\n\t\tlet partial = this.partials.get(index);\n\t\tif (!partial) {\n\t\t\tpartial = {\n\t\t\t\tblockType,\n\t\t\t\ttext: \"\",\n\t\t\t\ttoolCallArguments: \"\"\n\t\t\t};\n\t\t\tthis.partials.set(index, partial);\n\t\t\tthis.order.push(index);\n\t\t}\n\t\treturn partial;\n\t}\n\tassemble(partial, index) {\n\t\tif (partial.block) return partial.block;\n\t\tswitch (partial.blockType) {\n\t\t\tcase \"text\": return {\n\t\t\t\ttype: \"text\",\n\t\t\t\ttext: partial.text\n\t\t\t};\n\t\t\tcase \"reasoning\": return {\n\t\t\t\ttype: \"reasoning\",\n\t\t\t\ttext: partial.text\n\t\t\t};\n\t\t\tcase \"tool-call\": return {\n\t\t\t\ttype: \"tool-call\",\n\t\t\t\tid: partial.toolCallId ?? brandString(`call-${index}`),\n\t\t\t\tname: partial.toolCallName ?? \"\",\n\t\t\t\targuments: partial.toolCallArguments\n\t\t\t};\n\t\t\tdefault: throw new Error(`cannot assemble incomplete block of type \"${partial.blockType}\"`);\n\t\t}\n\t}\n\t/** Invariant accessor: every index in `order` has a partial. */\n\tmustGet(index) {\n\t\tconst partial = this.partials.get(index);\n\t\tif (!partial) throw new Error(`BlockAssembler invariant violated: no partial for index ${index}`);\n\t\treturn partial;\n\t}\n\t/**\n\t* The one shared keep/drop decision over all seen blocks: max-token\n\t* truncation drops tool calls that cannot be executed safely. Emitted blocks\n\t* and replay metadata both derive from this result, so they cannot disagree.\n\t*/\n\tassembled() {\n\t\tconst all = this.order.map((index) => this.assemble(this.mustGet(index), index));\n\t\tconst kept = this.finish.kind === \"max-tokens\" ? all.map((block) => block.type !== \"tool-call\") : void 0;\n\t\tconst blocks = kept === void 0 ? all : all.filter((_, position) => kept[position]);\n\t\tconst envelope = this._replayState;\n\t\tif (envelope?.blocks === void 0) return {\n\t\t\tblocks,\n\t\t\treplay: envelope\n\t\t};\n\t\tif (envelope.blocks.length !== all.length) return {\n\t\t\tblocks,\n\t\t\treplay: void 0\n\t\t};\n\t\treturn {\n\t\t\tblocks,\n\t\t\treplay: kept === void 0 || blocks.length === all.length ? envelope : {\n\t\t\t\tresponse: envelope.response,\n\t\t\t\tblocks: envelope.blocks.filter((_, position) => kept[position])\n\t\t\t}\n\t\t};\n\t}\n\t/**\n\t* Assemble all blocks seen so far, in stream order.\n\t* @returns one block per seen index, except that max-token truncation drops\n\t* tool calls that cannot be executed safely; an open block assembles from\n\t* its accumulated deltas (an unknown block type never closed by `block-end` throws).\n\t*/\n\tblocks() {\n\t\treturn this.assembled().blocks;\n\t}\n\t/**\n\t* Assemble the prefix an interrupted stream can safely finalize: closed and\n\t* open text/reasoning blocks with non-whitespace content, in stream order.\n\t* Tool calls are omitted because interruption precedes dispatch; retaining\n\t* one would require a fabricated result. Open unknown blocks are also omitted.\n\t* @returns the kept blocks; empty when nothing streamed before the interruption.\n\t*/\n\tinterruptedBlocks() {\n\t\treturn this.order.map((index) => {\n\t\t\tconst partial = this.mustGet(index);\n\t\t\tconst type = partial.block?.type ?? partial.blockType;\n\t\t\tif (type !== \"text\" && type !== \"reasoning\") return void 0;\n\t\t\treturn this.assemble(partial, index);\n\t\t}).filter((block) => (block?.type === \"text\" || block?.type === \"reasoning\") && block.text.trim() !== \"\");\n\t}\n\t/** Usage from the `usage` chunk; undefined until one arrives. */\n\tget usage() {\n\t\treturn this._usage;\n\t}\n\t/** Finish reason from the `finish` chunk; `{kind: 'stop'}` when the stream ended without one. */\n\tget finish() {\n\t\treturn this._finish ?? { kind: \"stop\" };\n\t}\n\t/**\n\t* Replay metadata from the terminal finish chunk, if any, with per-block\n\t* entries pruned in step with {@link blocks}. Undefined when the envelope's\n\t* entries do not align with the emitted blocks.\n\t*/\n\tget replayState() {\n\t\treturn this.assembled().replay;\n\t}\n\t/**\n\t* The assembled assistant message.\n\t* @param source - producer attribution for the assembled message.\n\t* @returns a frozen assistant-role message over `blocks()` (same open-block assembly rules).\n\t*/\n\tmessage(source = {\n\t\tkind: \"plugin\",\n\t\tplugin: \"dsh-llm/assembler\"\n\t}) {\n\t\treturn createMessage({\n\t\t\trole: \"assistant\",\n\t\t\tcontent: this.blocks(),\n\t\t\tsource\n\t\t});\n\t}\n};\n//#endregion\n//#region lib/types/assistant-stream.js\n/**\n* Lossless compact representation of one model-stream attempt, plus record-level\n* readers that answer common consumer questions without materializing members.\n* Readers trust the static record type; expandAssistantStream is the validating\n* path for records read at a durable boundary.\n*/\nfunction safeTime(value) {\n\tif (!Number.isSafeInteger(value)) throw new TypeError(`Assistant stream time must be a safe integer, got ${String(value)}`);\n\treturn value;\n}\nfunction safeIndex(value, label) {\n\tif (!Number.isSafeInteger(value) || value < 0 || Object.is(value, -0)) throw new TypeError(`${label} index must be a non-negative safe integer`);\n\treturn value;\n}\nfunction snapshotChunk(chunk) {\n\tconst snapshot = snapshotJsonValue(chunk);\n\tif (snapshot === void 0) throw new TypeError(\"Assistant stream chunk must be losslessly JSON-serializable\");\n\treturn snapshot;\n}\nfunction safeGap(previous, next) {\n\tconst gap = next - previous;\n\treturn Number.isSafeInteger(gap) && previous + gap === next ? gap : void 0;\n}\n/** Incrementally compacts one attempt without retaining a second raw-chunk list. */\nvar AssistantStreamAccumulator = class {\n\trecords = [];\n\t/**\n\t* Add one timed chunk to the compact attempt stream.\n\t* @param value - model chunk and its original Session timestamp.\n\t* @returns a detached immutable copy for assembly and live publication.\n\t*/\n\tpush(value) {\n\t\tconst time = safeTime(value.time);\n\t\tconst chunk = snapshotChunk(value.chunk);\n\t\tconst timed = deepFreeze({\n\t\t\ttime,\n\t\t\tchunk\n\t\t});\n\t\tconst previous = this.records.at(-1);\n\t\tswitch (chunk.type) {\n\t\t\tcase \"text-delta\":\n\t\t\tcase \"reasoning-delta\": {\n\t\t\t\tsafeIndex(chunk.index, chunk.type);\n\t\t\t\tif (typeof chunk.text !== \"string\") throw new TypeError(`${chunk.type} text must be a string`);\n\t\t\t\tconst type = chunk.type === \"text-delta\" ? \"text-chunks\" : \"reasoning-chunks\";\n\t\t\t\tconst gap = previous !== void 0 && previous.type === type ? safeGap(previous.lastTime, time) : void 0;\n\t\t\t\tif (previous !== void 0 && previous.type === type && previous.index === chunk.index && gap !== void 0) {\n\t\t\t\t\tprevious.dt.push(gap);\n\t\t\t\t\tprevious.texts.push(chunk.text);\n\t\t\t\t\tprevious.lastTime = time;\n\t\t\t\t} else this.records.push({\n\t\t\t\t\ttype,\n\t\t\t\t\ttime0: time,\n\t\t\t\t\tindex: chunk.index,\n\t\t\t\t\tdt: [],\n\t\t\t\t\ttexts: [chunk.text],\n\t\t\t\t\tlastTime: time\n\t\t\t\t});\n\t\t\t\treturn timed;\n\t\t\t}\n\t\t\tcase \"tool-call-delta\": {\n\t\t\t\tsafeIndex(chunk.index, chunk.type);\n\t\t\t\tif (typeof chunk.id !== \"string\") throw new TypeError(\"tool-call-delta id must be a string\");\n\t\t\t\tif (Object.hasOwn(chunk, \"name\") && typeof chunk.name !== \"string\") throw new TypeError(\"tool-call-delta name must be a string\");\n\t\t\t\tif (typeof chunk.argumentsDelta !== \"string\") throw new TypeError(\"tool-call-delta argumentsDelta must be a string\");\n\t\t\t\tif (chunk.id.length === 0 || chunk.name === \"\") {\n\t\t\t\t\tthis.records.push({\n\t\t\t\t\t\ttype: \"chunk\",\n\t\t\t\t\t\ttime,\n\t\t\t\t\t\tchunk\n\t\t\t\t\t});\n\t\t\t\t\treturn timed;\n\t\t\t\t}\n\t\t\t\tconst gap = previous?.type === \"tool-call-chunks\" ? safeGap(previous.lastTime, time) : void 0;\n\t\t\t\tconst sameName = previous?.type === \"tool-call-chunks\" && Object.hasOwn(previous, \"name\") === Object.hasOwn(chunk, \"name\") && previous.name === chunk.name;\n\t\t\t\tif (previous?.type === \"tool-call-chunks\" && previous.index === chunk.index && previous.id === chunk.id && sameName && gap !== void 0) {\n\t\t\t\t\tprevious.dt.push(gap);\n\t\t\t\t\tprevious.args.push(chunk.argumentsDelta);\n\t\t\t\t\tprevious.lastTime = time;\n\t\t\t\t} else this.records.push({\n\t\t\t\t\ttype: \"tool-call-chunks\",\n\t\t\t\t\ttime0: time,\n\t\t\t\t\tindex: chunk.index,\n\t\t\t\t\tdt: [],\n\t\t\t\t\tid: chunk.id,\n\t\t\t\t\t...Object.hasOwn(chunk, \"name\") ? { name: chunk.name } : {},\n\t\t\t\t\targs: [chunk.argumentsDelta],\n\t\t\t\t\tlastTime: time\n\t\t\t\t});\n\t\t\t\treturn timed;\n\t\t\t}\n\t\t\tcase \"block-start\":\n\t\t\tcase \"block-end\":\n\t\t\tcase \"usage\":\n\t\t\tcase \"finish\":\n\t\t\t\tthis.records.push({\n\t\t\t\t\ttype: \"chunk\",\n\t\t\t\t\ttime,\n\t\t\t\t\tchunk\n\t\t\t\t});\n\t\t\t\treturn timed;\n\t\t\tdefault: return assertNever(chunk, \"AssistantStreamAccumulator.push\");\n\t\t}\n\t}\n\t/**\n\t* Return the current compact attempt stream.\n\t* @returns a detached immutable record list suitable for a durable event.\n\t*/\n\tsnapshot() {\n\t\treturn deepFreeze(this.records.map((record) => {\n\t\t\tif (record.type === \"chunk\") return { ...record };\n\t\t\tconst { lastTime: _lastTime, ...durable } = record;\n\t\t\tif (durable.type === \"tool-call-chunks\") return {\n\t\t\t\t...durable,\n\t\t\t\tdt: [...durable.dt],\n\t\t\t\targs: [...durable.args]\n\t\t\t};\n\t\t\treturn {\n\t\t\t\t...durable,\n\t\t\t\tdt: [...durable.dt],\n\t\t\t\ttexts: [...durable.texts]\n\t\t\t};\n\t\t}));\n\t}\n};\n/**\n* Expand compact records into the exact timed chunk sequence.\n* @param stream - compact records from one durable Assistant settlement.\n* @returns detached timed chunks with every original delta boundary preserved.\n* @throws {TypeError} when a record or reconstructed timestamp is invalid.\n*/\nfunction expandAssistantStream(stream) {\n\tconst chunks = [];\n\tfor (const candidate of stream) {\n\t\tconst record = validateRecord(candidate);\n\t\tif (record.type === \"chunk\") {\n\t\t\tchunks.push({\n\t\t\t\ttime: record.time,\n\t\t\t\tchunk: record.chunk\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst members = record.type === \"tool-call-chunks\" ? record.args : record.texts;\n\t\tlet time = record.time0;\n\t\tfor (let index = 0; index < members.length; index += 1) {\n\t\t\tif (index > 0) time += record.dt[index - 1];\n\t\t\tlet chunk;\n\t\t\tif (record.type === \"text-chunks\") chunk = {\n\t\t\t\ttype: \"text-delta\",\n\t\t\t\tindex: record.index,\n\t\t\t\ttext: members[index]\n\t\t\t};\n\t\t\telse if (record.type === \"reasoning-chunks\") chunk = {\n\t\t\t\ttype: \"reasoning-delta\",\n\t\t\t\tindex: record.index,\n\t\t\t\ttext: members[index]\n\t\t\t};\n\t\t\telse chunk = {\n\t\t\t\ttype: \"tool-call-delta\",\n\t\t\t\tindex: record.index,\n\t\t\t\tid: record.id,\n\t\t\t\t...Object.hasOwn(record, \"name\") ? { name: record.name } : {},\n\t\t\t\targumentsDelta: members[index]\n\t\t\t};\n\t\t\tchunks.push({\n\t\t\t\ttime,\n\t\t\t\tchunk\n\t\t\t});\n\t\t}\n\t}\n\treturn chunks;\n}\nfunction hasNonWhitespace(text) {\n\treturn /\\S/.test(text);\n}\nfunction blockIsVisible(block) {\n\tif (block.type === \"tool-call\") return false;\n\tif (block.type === \"text\" || block.type === \"reasoning\") return hasNonWhitespace(block.text);\n\treturn true;\n}\n/**\n* Whether one chunk carries the model's first output token for latency measurement.\n* @param chunk - any stream chunk.\n* @returns true for a non-empty text, reasoning, or Tool-call arguments fragment and for\n* every name-bearing Tool-call delta; false for block, usage, and finish chunks.\n*/\nfunction isTokenDelta(chunk) {\n\tswitch (chunk.type) {\n\t\tcase \"text-delta\":\n\t\tcase \"reasoning-delta\": return chunk.text !== \"\";\n\t\tcase \"tool-call-delta\": return chunk.argumentsDelta !== \"\" || chunk.name !== void 0;\n\t\tdefault: return false;\n\t}\n}\n/**\n* Whether one chunk by itself contributes reader-visible transcript content.\n* Text and reasoning count only with non-whitespace content, streamed as a delta or\n* completed as a block; a block of any other kind counts at its start and its end,\n* except a Tool call, which is protocol rather than content. Usage and finish never count.\n* @param chunk - any stream chunk.\n* @returns whether a transcript reader would see this chunk.\n*/\nfunction isVisibleChunk(chunk) {\n\tswitch (chunk.type) {\n\t\tcase \"text-delta\":\n\t\tcase \"reasoning-delta\": return hasNonWhitespace(chunk.text);\n\t\tcase \"block-start\": return chunk.blockType !== \"text\" && chunk.blockType !== \"reasoning\" && chunk.blockType !== \"tool-call\";\n\t\tcase \"block-end\": return blockIsVisible(chunk.block);\n\t\tdefault: return false;\n\t}\n}\n/**\n* Whether one chunk carries non-whitespace text, as a text delta or a completed text block.\n* Reasoning, Tool calls, and other block kinds never count.\n* @param chunk - any stream chunk.\n* @returns whether the chunk contributes visible text.\n*/\nfunction chunkHasVisibleText(chunk) {\n\tif (chunk.type === \"text-delta\") return hasNonWhitespace(chunk.text);\n\treturn chunk.type === \"block-end\" && chunk.block.type === \"text\" && hasNonWhitespace(chunk.block.text);\n}\nfunction firstRunMemberTime(run, predicate) {\n\tconst fragments = run.type === \"tool-call-chunks\" ? run.args : run.texts;\n\tlet time = run.time0;\n\tfor (let index = 0; index < fragments.length; index += 1) {\n\t\tif (index > 0) time += run.dt[index - 1];\n\t\tif (predicate(fragments[index])) return time;\n\t}\n}\n/**\n* Time of the first member of one packed run that {@link isTokenDelta} accepts: a\n* name-bearing Tool-call run starts at its first member, otherwise the first non-empty fragment.\n* Stops scanning at that member.\n* @param run - one packed delta run.\n* @returns the member's reconstructed time, or undefined when no member qualifies.\n*/\nfunction runFirstTokenTime(run) {\n\tif (run.type === \"tool-call-chunks\" && run.name !== void 0) return run.time0;\n\treturn firstRunMemberTime(run, (fragment) => fragment !== \"\");\n}\n/**\n* Time of the first member of one packed run that {@link isVisibleChunk} accepts: the first\n* non-whitespace text or reasoning fragment. A Tool-call run has none. Stops scanning at that member.\n* @param run - one packed delta run.\n* @returns the member's reconstructed time, or undefined when no member qualifies.\n*/\nfunction runFirstVisibleTime(run) {\n\treturn run.type === \"tool-call-chunks\" ? void 0 : firstRunMemberTime(run, hasNonWhitespace);\n}\n/**\n* Time of the first token in one compact stream per {@link isTokenDelta}, read from the\n* records themselves and stopping at the first qualifying member.\n* @param stream - compact records from one durable Assistant settlement.\n* @returns the first token's time, or undefined when the stream carries no token.\n*/\nfunction assistantStreamFirstTokenTime(stream) {\n\tfor (const record of stream) {\n\t\tconst time = record.type === \"chunk\" ? isTokenDelta(record.chunk) ? record.time : void 0 : runFirstTokenTime(record);\n\t\tif (time !== void 0) return time;\n\t}\n}\n/**\n* Whether one compact stream carries any reader-visible content per {@link isVisibleChunk},\n* stopping at the first qualifying member.\n* @param stream - compact records from one durable Assistant settlement.\n* @returns whether a transcript reader would see anything from this stream.\n*/\nfunction assistantStreamHasVisibleContent(stream) {\n\treturn stream.some((record) => record.type === \"chunk\" ? isVisibleChunk(record.chunk) : runFirstVisibleTime(record) !== void 0);\n}\n/**\n* Whether one compact stream carries non-whitespace text per {@link chunkHasVisibleText},\n* stopping at the first qualifying member.\n* @param stream - compact records from one durable Assistant settlement.\n* @returns whether the stream contributes visible text.\n*/\nfunction assistantStreamHasVisibleText(stream) {\n\treturn stream.some((record) => record.type === \"text-chunks\" ? record.texts.some(hasNonWhitespace) : record.type === \"chunk\" && chunkHasVisibleText(record.chunk));\n}\n/**\n* The last raw chunk of one never-packed type, scanning backwards and stopping at the first hit.\n* @param stream - compact records from one durable Assistant settlement.\n* @param type - chunk type that only appears as a raw record.\n* @returns the stream's final chunk of that type, or undefined when it has none.\n*/\nfunction lastAssistantStreamChunk(stream, type) {\n\tfor (let index = stream.length - 1; index >= 0; index -= 1) {\n\t\tconst record = stream[index];\n\t\tif (record.type === \"chunk\" && record.chunk.type === type) return record.chunk;\n\t}\n}\n/**\n* Every raw chunk of one never-packed type, in stream order.\n* @param stream - compact records from one durable Assistant settlement.\n* @param type - chunk type that only appears as a raw record.\n* @returns the matching chunks; empty when the stream has none.\n*/\nfunction assistantStreamChunks(stream, type) {\n\tconst chunks = [];\n\tfor (const record of stream) if (record.type === \"chunk\" && record.chunk.type === type) chunks.push(record.chunk);\n\treturn chunks;\n}\n/**\n* Every streamed text-delta fragment joined in stream order; reasoning and Tool-call fragments are excluded.\n* @param stream - compact records from one durable Assistant settlement.\n* @returns the joined text, empty when the stream carries no text delta.\n*/\nfunction joinAssistantStreamText(stream) {\n\tconst parts = [];\n\tfor (const record of stream) if (record.type === \"text-chunks\") parts.push(record.texts.join(\"\"));\n\telse if (record.type === \"chunk\" && record.chunk.type === \"text-delta\") parts.push(record.chunk.text);\n\treturn parts.join(\"\");\n}\n/**\n* Feed one compact stream into a {@link BlockAssembler} without materializing members.\n* Each run contributes one delta carrying its joined fragments, which assembles the same\n* blocks as the original per-member deltas because assembly only concatenates them;\n* raw chunks are pushed as recorded. The records are trusted, not validated: validate a\n* stream read at a durable boundary with {@link expandAssistantStream} first.\n* @param stream - compact records from one durable Assistant settlement.\n* @param assembler - assembler to feed; a fresh one by default.\n* @returns the same assembler after every record was pushed.\n*/\nfunction assembleAssistantStream(stream, assembler = new BlockAssembler()) {\n\tfor (const record of stream) switch (record.type) {\n\t\tcase \"chunk\":\n\t\t\tassembler.push(record.chunk);\n\t\t\tbreak;\n\t\tcase \"text-chunks\":\n\t\t\tassembler.push({\n\t\t\t\ttype: \"text-delta\",\n\t\t\t\tindex: record.index,\n\t\t\t\ttext: record.texts.join(\"\")\n\t\t\t});\n\t\t\tbreak;\n\t\tcase \"reasoning-chunks\":\n\t\t\tassembler.push({\n\t\t\t\ttype: \"reasoning-delta\",\n\t\t\t\tindex: record.index,\n\t\t\t\ttext: record.texts.join(\"\")\n\t\t\t});\n\t\t\tbreak;\n\t\tcase \"tool-call-chunks\":\n\t\t\tassembler.push({\n\t\t\t\ttype: \"tool-call-delta\",\n\t\t\t\tindex: record.index,\n\t\t\t\tid: record.id,\n\t\t\t\t...record.name === void 0 ? {} : { name: record.name },\n\t\t\t\targumentsDelta: record.args.join(\"\")\n\t\t\t});\n\t\t\tbreak;\n\t\tdefault: assertNever(record, \"assembleAssistantStream\");\n\t}\n\treturn assembler;\n}\nfunction validateRecord(value) {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) throw new TypeError(\"Assistant stream record must be an object\");\n\tconst record = value;\n\tswitch (record.type) {\n\t\tcase \"text-chunks\":\n\t\tcase \"reasoning-chunks\": {\n\t\t\texactKeys(record, [\n\t\t\t\t\"type\",\n\t\t\t\t\"time0\",\n\t\t\t\t\"index\",\n\t\t\t\t\"dt\",\n\t\t\t\t\"texts\"\n\t\t\t], record.type);\n\t\t\tconst texts = stringArray(record.texts, `${record.type} texts`);\n\t\t\tif (texts.length === 0) throw new TypeError(`${record.type} texts must be non-empty`);\n\t\t\tvalidateRun(record, texts.length, record.type);\n\t\t\treturn record;\n\t\t}\n\t\tcase \"tool-call-chunks\": {\n\t\t\texactKeys(record, Object.hasOwn(record, \"name\") ? [\n\t\t\t\t\"type\",\n\t\t\t\t\"time0\",\n\t\t\t\t\"index\",\n\t\t\t\t\"dt\",\n\t\t\t\t\"id\",\n\t\t\t\t\"name\",\n\t\t\t\t\"args\"\n\t\t\t] : [\n\t\t\t\t\"type\",\n\t\t\t\t\"time0\",\n\t\t\t\t\"index\",\n\t\t\t\t\"dt\",\n\t\t\t\t\"id\",\n\t\t\t\t\"args\"\n\t\t\t], record.type);\n\t\t\tconst args = stringArray(record.args, \"tool-call-chunks args\");\n\t\t\tif (args.length === 0) throw new TypeError(\"tool-call-chunks args must be non-empty\");\n\t\t\tif (typeof record.id !== \"string\" || record.id.length === 0) throw new TypeError(\"tool-call-chunks id must be a non-empty string\");\n\t\t\tif (record.name !== void 0 && (typeof record.name !== \"string\" || record.name.length === 0)) throw new TypeError(\"tool-call-chunks name must be a non-empty string\");\n\t\t\tvalidateRun(record, args.length, record.type);\n\t\t\treturn record;\n\t\t}\n\t\tcase \"chunk\": {\n\t\t\texactKeys(record, [\n\t\t\t\t\"type\",\n\t\t\t\t\"time\",\n\t\t\t\t\"chunk\"\n\t\t\t], \"chunk\");\n\t\t\tconst time = safeTime(record.time);\n\t\t\tif (typeof record.chunk !== \"object\" || record.chunk === null || Array.isArray(record.chunk)) throw new TypeError(\"Assistant stream raw chunk must be a lossless JSON object\");\n\t\t\tlet chunk;\n\t\t\ttry {\n\t\t\t\tchunk = snapshotChunk(record.chunk);\n\t\t\t} catch (error) {\n\t\t\t\tthrow new TypeError(\"Assistant stream raw chunk must be a lossless JSON object\", { cause: error });\n\t\t\t}\n\t\t\treturn deepFreeze({\n\t\t\t\ttype: \"chunk\",\n\t\t\t\ttime,\n\t\t\t\tchunk\n\t\t\t});\n\t\t}\n\t\tdefault: throw new TypeError(`Unsupported Assistant stream record ${JSON.stringify(record.type)}`);\n\t}\n}\nfunction validateRun(record, members, label) {\n\tsafeTime(record.time0);\n\tsafeIndex(record.index, label);\n\tif (!Array.isArray(record.dt) || record.dt.some((value) => !Number.isSafeInteger(value))) throw new TypeError(`${label} dt must contain safe integers`);\n\tif (record.dt.length !== members - 1) throw new TypeError(`${label} dt length must be one less than its members`);\n\tlet time = record.time0;\n\tfor (const gap of record.dt) {\n\t\ttime += gap;\n\t\tif (!Number.isSafeInteger(time)) throw new TypeError(`${label} member times must stay safe integers`);\n\t}\n}\nfunction stringArray(value, label) {\n\tif (!Array.isArray(value) || value.some((member) => typeof member !== \"string\")) throw new TypeError(`${label} must be a string array`);\n\treturn value;\n}\nfunction exactKeys(record, keys, label) {\n\tif (Object.keys(record).length !== keys.length || !keys.every((key) => Object.hasOwn(record, key))) throw new TypeError(`${label} Assistant stream record must contain exactly ${keys.join(\", \")}`);\n}\n//#endregion\n//#region lib/types/index.js\n/**\n* LLM service: adapter registry with a waterfall-interceptable streaming call\n* API. Exports the `LlmRuntime` default, the abstract `LlmAdapter` for\n* provider backends, and `BlockAssembler` for chunk assembly.\n*\n* @module @deepseek-ai/dsh-llm\n*/\nvar __runInitializers = function(thisArg, initializers, value) {\n\tvar useValue = arguments.length > 2;\n\tfor (var i = 0; i < initializers.length; i++) value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n\treturn useValue ? value : void 0;\n};\nvar __esDecorate = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n\tfunction accept(f) {\n\t\tif (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\");\n\t\treturn f;\n\t}\n\tvar kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n\tvar target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n\tvar descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n\tvar _, done = false;\n\tfor (var i = decorators.length - 1; i >= 0; i--) {\n\t\tvar context = {};\n\t\tfor (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\n\t\tfor (var p in contextIn.access) context.access[p] = contextIn.access[p];\n\t\tcontext.addInitializer = function(f) {\n\t\t\tif (done) throw new TypeError(\"Cannot add initializers after decoration has completed\");\n\t\t\textraInitializers.push(accept(f || null));\n\t\t};\n\t\tvar result = (0, decorators[i])(kind === \"accessor\" ? {\n\t\t\tget: descriptor.get,\n\t\t\tset: descriptor.set\n\t\t} : descriptor[key], context);\n\t\tif (kind === \"accessor\") {\n\t\t\tif (result === void 0) continue;\n\t\t\tif (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\n\t\t\tif (_ = accept(result.get)) descriptor.get = _;\n\t\t\tif (_ = accept(result.set)) descriptor.set = _;\n\t\t\tif (_ = accept(result.init)) initializers.unshift(_);\n\t\t} else if (_ = accept(result)) if (kind === \"field\") initializers.unshift(_);\n\t\telse descriptor[key] = _;\n\t}\n\tif (target) Object.defineProperty(target, contextIn.name, descriptor);\n\tdone = true;\n};\n/**\n* Typed error for LLM-related failures. Extends {@link HarnessError}, so the\n* `code` string (e.g. `AUTH`, `RATE_LIMIT`, `NO_ADAPTER`) is shared taxonomy.\n*/\nvar LlmError = class extends HarnessError {\n\t/** Serializable facts retained beside this live Error. */\n\tfailure;\n\t/**\n\t* @param message - non-empty human-readable failure summary.\n\t* @param code - non-empty stable provider-neutral machine code.\n\t* @param options - optional cause and validated serializable provider facts.\n\t*/\n\tconstructor(message, code, options) {\n\t\tif (typeof message !== \"string\" || message.length === 0) throw new Error(\"LlmError message must be a non-empty string\");\n\t\tif (typeof code !== \"string\" || code.length === 0) throw new Error(\"LlmError code must be a non-empty string\");\n\t\tif (options?.status !== void 0 && (!Number.isInteger(options.status) || options.status < 100 || options.status > 599)) throw new Error(\"LlmError status must be an integer from 100 through 599\");\n\t\tif (options?.providerRetryAfterMs !== void 0 && (!Number.isFinite(options.providerRetryAfterMs) || options.providerRetryAfterMs <= 0)) throw new Error(\"LlmError providerRetryAfterMs must be a positive finite number\");\n\t\tif (options?.requestId !== void 0 && (typeof options.requestId !== \"string\" || options.requestId.length === 0)) throw new Error(\"LlmError requestId must be a non-empty string\");\n\t\tsuper(message, code, options);\n\t\tthis.name = \"LlmError\";\n\t\tthis.failure = Object.freeze({\n\t\t\tmessage,\n\t\t\tcode,\n\t\t\t...options?.status === void 0 ? {} : { status: options.status },\n\t\t\t...options?.providerRetryAfterMs === void 0 ? {} : { providerRetryAfterMs: options.providerRetryAfterMs },\n\t\t\t...options?.requestId === void 0 ? {} : { requestId: options.requestId }\n\t\t});\n\t}\n};\n/**\n* Accept one supplied credential, or refuse it as unusable.\n*\n* A stored key arrives from the credentials seam, a `.env` line, or a shell\n* export, all of which pick up surrounding whitespace, so trimming is silent.\n* Anything else fails here rather than inside `fetch`, whose ByteString\n* refusal names a UTF-16 code point instead of the setting to change. The key\n* never enters the message: `ref` names where to fix it, and echoing any part\n* of a secret into a log or a UI is the failure this diagnosis avoids.\n*\n* Lives beside {@link LlmError} rather than in `./api-key.ts` so the predicate\n* module stays dependency-free; both adapters share this one diagnosis instead\n* of keeping near-identical local copies.\n* @param raw - the credential exactly as supplied.\n* @param pkg - the refusing package name, prefixed to the diagnostic.\n* @param ref - the credential reference the value resolved through.\n* @returns the trimmed, usable key.\n*/\nfunction assertUsableApiKey(raw, pkg, ref) {\n\tconst checked = normalizeApiKey(raw);\n\tif (checked.ok) return checked.value;\n\tthrow new LlmError(checked.reason === \"empty\" ? `${pkg}: the API key resolved from ${ref} is blank; set ${ref} to the raw key (the web Models page writes it) or export it in the launching environment` : `${pkg}: the API key resolved from ${ref} contains characters no HTTP header can carry; set ${ref} to the raw key alone (the web Models page writes it)`, INVALID_CREDENTIAL_CODE);\n}\n/**\n* Provider-wire adapter for the harness message and stream vocabulary. Register implementations\n* with `ctx.llm.registerAdapter(providers, adapter)`. Every provider HTTP request must include\n* `attributionHeaders()`; prove the headers are added in the wire request or library header hook. The direct-fetch\n* DeepSeek and library-backed pi-ai adapters meet this contract through different internals.\n*/\nvar LlmAdapter = class {\n\t/**\n\t* Describe one provider route owned by this adapter.\n\t* @param provider - a route passed to `registerAdapter()` for this instance.\n\t* @returns detached display metadata whose id must equal `provider`.\n\t*/\n\tproviderInfo(provider) {\n\t\treturn {\n\t\t\tid: provider,\n\t\t\tname: provider\n\t\t};\n\t}\n\t/**\n\t* Return the provider-owned retry policy captured with this route.\n\t* @param _provider - a route passed to `registerAdapter()` for this instance.\n\t* @returns a resolved policy, or `undefined` to use the normal defaults.\n\t*/\n\tproviderRetryPolicy(_provider) {}\n\t/**\n\t* Resolve provider-side request-image pricing for one exact model route.\n\t* The default declares none, so consumers fall back to their own neutral\n\t* estimate. Implementations must answer synchronously without I/O; the\n\t* token meter resolves this per measurement.\n\t* @param _provider - a route passed to `registerAdapter()` for this instance.\n\t* @param _model - exact model id passed to {@link GenerateOptions.model}.\n\t* @returns route-owned image pricing, or `undefined` when the route declares none.\n\t*/\n\timageRequestPricing(_provider, _model) {}\n\t/**\n\t* List models this adapter can currently advertise for one owned provider.\n\t* The result is advisory: an adapter may accept unlisted model ids, and\n\t* consumers must not turn absence into request rejection.\n\t* @param _provider - one provider route owned by this adapter.\n\t* @returns discoverable models in adapter-preferred order.\n\t*/\n\tlistModels(_provider) {\n\t\treturn Promise.resolve([]);\n\t}\n\t/**\n\t* Resolve all metadata available for one exact model. This query is\n\t* independent of the advisory catalog and does not validate request routing.\n\t* @param provider - one provider route owned by this adapter.\n\t* @param model - exact model id passed to {@link GenerateOptions.model}.\n\t* @param _signal - cancellation for this exact-model lookup; asynchronous\n\t* implementations must settle promptly after it aborts.\n\t* @returns provider/model identity plus any context, call-default, and reasoning metadata.\n\t*/\n\tresolveModel(provider, model, _signal) {\n\t\treturn Promise.resolve({\n\t\t\tprovider,\n\t\t\tid: model,\n\t\t\tname: model\n\t\t});\n\t}\n\t/**\n\t* Bind exact model metadata and the eventual request dispatch to one adapter generation.\n\t* Dynamic adapters override this so settings changes between preparation and\n\t* dispatch cannot combine one generation's capabilities with another's endpoint.\n\t* @param provider - registered provider route.\n\t* @param model - exact model id.\n\t* @param signal - cancellation for model resolution.\n\t* @returns model metadata and a one-generation stream entry point.\n\t*/\n\tasync prepareCall(provider, model, signal) {\n\t\treturn {\n\t\t\tmodel: await this.resolveModel(provider, model, signal),\n\t\t\tstream: (options) => this.stream(options)\n\t\t};\n\t}\n};\n/**\n* The abstract `llm` service: an adapter registry plus a streaming model-call\n* API, interceptable via the `llm/stream` waterfall.\n*/\nlet LlmRuntime = (() => {\n\tlet _classSuper = TypertRemoteService;\n\tlet _instanceExtraInitializers = [];\n\tlet _listProviders_decorators;\n\tlet _listConfigurableProviders_decorators;\n\tlet _remoteDiscoverModels_decorators;\n\treturn class LlmRuntime extends _classSuper {\n\t\tstatic {\n\t\t\tconst _metadata = typeof Symbol === \"function\" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;\n\t\t\t_listProviders_decorators = [Remote];\n\t\t\t_listConfigurableProviders_decorators = [Remote];\n\t\t\t_remoteDiscoverModels_decorators = [Remote(\"discoverModels\")];\n\t\t\t__esDecorate(this, null, _listProviders_decorators, {\n\t\t\t\tkind: \"method\",\n\t\t\t\tname: \"listProviders\",\n\t\t\t\tstatic: false,\n\t\t\t\tprivate: false,\n\t\t\t\taccess: {\n\t\t\t\t\thas: (obj) => \"listProviders\" in obj,\n\t\t\t\t\tget: (obj) => obj.listProviders\n\t\t\t\t},\n\t\t\t\tmetadata: _metadata\n\t\t\t}, null, _instanceExtraInitializers);\n\t\t\t__esDecorate(this, null, _listConfigurableProviders_decorators, {\n\t\t\t\tkind: \"method\",\n\t\t\t\tname: \"listConfigurableProviders\",\n\t\t\t\tstatic: false,\n\t\t\t\tprivate: false,\n\t\t\t\taccess: {\n\t\t\t\t\thas: (obj) => \"listConfigurableProviders\" in obj,\n\t\t\t\t\tget: (obj) => obj.listConfigurableProviders\n\t\t\t\t},\n\t\t\t\tmetadata: _metadata\n\t\t\t}, null, _instanceExtraInitializers);\n\t\t\t__esDecorate(this, null, _remoteDiscoverModels_decorators, {\n\t\t\t\tkind: \"method\",\n\t\t\t\tname: \"remoteDiscoverModels\",\n\t\t\t\tstatic: false,\n\t\t\t\tprivate: false,\n\t\t\t\taccess: {\n\t\t\t\t\thas: (obj) => \"remoteDiscoverModels\" in obj,\n\t\t\t\t\tget: (obj) => obj.remoteDiscoverModels\n\t\t\t\t},\n\t\t\t\tmetadata: _metadata\n\t\t\t}, null, _instanceExtraInitializers);\n\t\t\tif (_metadata) Object.defineProperty(this, Symbol.metadata, {\n\t\t\t\tenumerable: true,\n\t\t\t\tconfigurable: true,\n\t\t\t\twritable: true,\n\t\t\t\tvalue: _metadata\n\t\t\t});\n\t\t}\n\t\tadapters = (__runInitializers(this, _instanceExtraInitializers), /* @__PURE__ */ new Map());\n\t\tdirectory = /* @__PURE__ */ new Map();\n\t\tdiscoveries = /* @__PURE__ */ new Map();\n\t\tconstructor(ctx) {\n\t\t\tsuper(ctx, \"llm\");\n\t\t}\n\t\t/** Notify topology observers without letting one broken listener veto the commit. */\n\t\temitAdaptersUpdated() {\n\t\t\tlet invariantFailure;\n\t\t\tfor (const listener of this.ctx.events.dispatch(\"emit\", [\"llm/adapters-updated\"])) try {\n\t\t\t\tconst returned = listener();\n\t\t\t\tif (returned != null && typeof returned.then === \"function\") Promise.resolve(returned).then(void 0, (error) => {\n\t\t\t\t\tthis.warnAdaptersListenerFailure(error);\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\tif (error?.code === \"INVARIANT\") {\n\t\t\t\t\tinvariantFailure ??= error;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tthis.warnAdaptersListenerFailure(error);\n\t\t\t}\n\t\t\tif (invariantFailure !== void 0) throw invariantFailure;\n\t\t}\n\t\t/** Contained-listener diagnostic shared by the sync and async failure paths. */\n\t\twarnAdaptersListenerFailure(error) {\n\t\t\tthis.ctx.logger.warn(\"llm: an llm/adapters-updated listener failed\");\n\t\t\tthis.ctx.logger.warn(error);\n\t\t}\n\t\t/**\n\t\t* Register an adapter for the given provider routes. Throws `LlmError` with code\n\t\t* `DUPLICATE_ADAPTER` if any provider already has an adapter (all-or-nothing).\n\t\t* Disposed with the fiber.\n\t\t* @param providers - every provider route this adapter should serve.\n\t\t* @param adapter - the adapter that streams calls for those providers.\n\t\t* @returns the disposer, carrying {@link AdapterRegistrationHandle.replace}.\n\t\t*/\n\t\tregisterAdapter(providers, adapter) {\n\t\t\tconst owned = /* @__PURE__ */ new Set();\n\t\t\tlet released = false;\n\t\t\tconst dispose = this.ctx.effect(function* () {\n\t\t\t\tif (providers.length === 0) throw new LlmError(\"an adapter must register at least one provider\", \"INVALID_ADAPTER\");\n\t\t\t\tthis.commitRoutes(owned, this.prepareRoutes(providers, adapter, owned));\n\t\t\t\tyield () => {\n\t\t\t\t\treleased = true;\n\t\t\t\t\tfor (const provider of owned) this.adapters.delete(provider);\n\t\t\t\t\towned.clear();\n\t\t\t\t\tthis.emitAdaptersUpdated();\n\t\t\t\t};\n\t\t\t}.bind(this), \"llm.registerAdapter()\");\n\t\t\tconst handle = (() => void dispose());\n\t\t\thandle.replace = (next) => {\n\t\t\t\tif (released) throw new LlmError(\"a disposed adapter registration cannot replace its routes\", \"REGISTRATION_DISPOSED\");\n\t\t\t\tthis.commitRoutes(owned, this.prepareRoutes(next, adapter, owned));\n\t\t\t};\n\t\t\treturn handle;\n\t\t}\n\t\t/**\n\t\t* Validate one candidate route set for `adapter`, treating routes this\n\t\t* registration already holds as available. Nothing is mutated: a rejected\n\t\t* candidate leaves the registry exactly as it was.\n\t\t*/\n\t\tprepareRoutes(providers, adapter, owned) {\n\t\t\tconst unique = /* @__PURE__ */ new Set();\n\t\t\tconst registrations = [];\n\t\t\tfor (const provider of providers) {\n\t\t\t\tif (provider.length === 0) throw new LlmError(\"adapter provider names must be non-empty\", \"INVALID_ADAPTER\");\n\t\t\t\tif (unique.has(provider) || this.adapters.has(provider) && !owned.has(provider)) throw new LlmError(`an adapter for provider \"${provider}\" is already registered`, \"DUPLICATE_ADAPTER\");\n\t\t\t\tconst info = adapter.providerInfo(provider);\n\t\t\t\tif (typeof info.id !== \"string\" || info.id !== provider || typeof info.name !== \"string\" || info.name.length === 0) throw new LlmError(`adapter metadata for provider \"${provider}\" must preserve its id and have a non-empty name`, \"INVALID_ADAPTER\");\n\t\t\t\tunique.add(provider);\n\t\t\t\tconst retryPolicy = adapter.providerRetryPolicy(provider) ?? resolveRetryPolicy(void 0, `llm: provider \"${provider}\" retryPolicy`);\n\t\t\t\tregistrations.push({\n\t\t\t\t\tadapter,\n\t\t\t\t\tprovider: {\n\t\t\t\t\t\tid: info.id,\n\t\t\t\t\t\tname: info.name\n\t\t\t\t\t},\n\t\t\t\t\tretryPolicy\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn registrations;\n\t\t}\n\t\t/**\n\t\t* Swap this registration's routes for the prepared ones in one synchronous\n\t\t* section, so no observer can see the registry between the release and the\n\t\t* re-registration. The route set's one mutation point is also where\n\t\t* `llm/adapters-updated` is published, so a `replace` announces itself\n\t\t* exactly like a first registration.\n\t\t*/\n\t\tcommitRoutes(owned, registrations) {\n\t\t\tfor (const provider of owned) this.adapters.delete(provider);\n\t\t\towned.clear();\n\t\t\tfor (const registration of registrations) {\n\t\t\t\tthis.adapters.set(registration.provider.id, registration);\n\t\t\t\towned.add(registration.provider.id);\n\t\t\t}\n\t\t\tthis.emitAdaptersUpdated();\n\t\t}\n\t\t/**\n\t\t* Describe provider routes with a registered adapter.\n\t\t* @returns detached provider metadata in registration order.\n\t\t*/\n\t\tlistProviders() {\n\t\t\treturn [...this.adapters.values()].map(({ provider }) => ({ ...provider }));\n\t\t}\n\t\t/**\n\t\t* Declare provider routes an adapter plugin can activate through\n\t\t* configuration. Registration is all-or-nothing: an empty list, invalid\n\t\t* entry, or a provider already declared by any registration throws\n\t\t* `LlmError` without registering the rest. Disposed with the fiber.\n\t\t* @param entries - every configurable provider this plugin owns.\n\t\t* @returns a handle that withdraws all of them, and can atomically replace them.\n\t\t*/\n\t\tregisterConfigurableProviders(entries) {\n\t\t\tlet held = [];\n\t\t\tlet disposed = false;\n\t\t\t/**\n\t\t\t* Validate a candidate set in full against everything this registration\n\t\t\t* does not already hold, then publish it. Nothing is written until the\n\t\t\t* whole set passes, so a refused candidate leaves the current entries in\n\t\t\t* place — the property that makes `replace` a swap rather than a\n\t\t\t* delete-then-add that can strand the directory empty.\n\t\t\t*/\n\t\t\tconst commit = (candidates) => {\n\t\t\t\tconst detached = [];\n\t\t\t\tconst own = new Set(held.map((entry) => entry.provider));\n\t\t\t\tfor (const entry of candidates) {\n\t\t\t\t\tif (entry.provider.length === 0 || entry.displayName.length === 0 || entry.settingsNs.length === 0) throw new LlmError(\"configurable providers need a non-empty provider, displayName, and settingsNs\", \"INVALID_DIRECTORY\");\n\t\t\t\t\tif (entry.settingsPath.some((segment) => segment.length === 0)) throw new LlmError(`configurable provider \"${entry.provider}\" has an empty settingsPath segment`, \"INVALID_DIRECTORY\");\n\t\t\t\t\tif (this.directory.has(entry.provider) && !own.has(entry.provider) || detached.some((seen) => seen.provider === entry.provider)) throw new LlmError(`configurable provider \"${entry.provider}\" is already declared`, \"DUPLICATE_DIRECTORY\");\n\t\t\t\t\tdetached.push({\n\t\t\t\t\t\t...entry,\n\t\t\t\t\t\tsettingsPath: [...entry.settingsPath]\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tfor (const entry of held) this.directory.delete(entry.provider);\n\t\t\t\tfor (const entry of detached) this.directory.set(entry.provider, entry);\n\t\t\t\theld = detached;\n\t\t\t\tthis.emitAdaptersUpdated();\n\t\t\t};\n\t\t\tconst dispose = this.ctx.effect(function* () {\n\t\t\t\tif (entries.length === 0) throw new LlmError(\"a configurable-provider registration must declare at least one provider\", \"INVALID_DIRECTORY\");\n\t\t\t\tcommit(entries);\n\t\t\t\tyield () => {\n\t\t\t\t\tdisposed = true;\n\t\t\t\t\tfor (const entry of held) this.directory.delete(entry.provider);\n\t\t\t\t\theld = [];\n\t\t\t\t\tthis.emitAdaptersUpdated();\n\t\t\t\t};\n\t\t\t}.bind(this), \"llm.registerConfigurableProviders()\");\n\t\t\tconst handle = (() => void dispose());\n\t\t\thandle.replace = (next) => {\n\t\t\t\tif (disposed) throw new LlmError(\"this configurable-provider registration was disposed\", \"REGISTRATION_DISPOSED\");\n\t\t\t\tcommit(next);\n\t\t\t};\n\t\t\treturn handle;\n\t\t}\n\t\t/**\n\t\t* List every declared configurable provider, registered or dormant.\n\t\t* @returns detached directory entries in declaration order.\n\t\t*/\n\t\tlistConfigurableProviders() {\n\t\t\treturn [...this.directory.values()].map((entry) => ({\n\t\t\t\t...entry,\n\t\t\t\tsettingsPath: [...entry.settingsPath]\n\t\t\t}));\n\t\t}\n\t\t/**\n\t\t* Offer to interrogate provider endpoints on behalf of the settings\n\t\t* namespace this plugin owns. The namespace is the key because that is what\n\t\t* a configuration surface already holds from the configurable-provider\n\t\t* directory, and because a provider being *added* has no route to name yet.\n\t\t* Disposed with the fiber.\n\t\t* @param settingsNs - the namespace whose profiles this discovery serves.\n\t\t* @param discover - interrogates one endpoint and must honor the supplied signal.\n\t\t* @returns the disposer that withdraws the offer.\n\t\t*/\n\t\tregisterModelDiscovery(settingsNs, discover) {\n\t\t\tconst dispose = this.ctx.effect(function* () {\n\t\t\t\tif (settingsNs.length === 0) throw new LlmError(\"model discovery needs a non-empty settings namespace\", \"INVALID_DISCOVERY\");\n\t\t\t\tif (this.discoveries.has(settingsNs)) throw new LlmError(`model discovery for \"${settingsNs}\" is already registered`, \"DUPLICATE_DISCOVERY\");\n\t\t\t\tthis.discoveries.set(settingsNs, discover);\n\t\t\t\tyield () => {\n\t\t\t\t\tthis.discoveries.delete(settingsNs);\n\t\t\t\t};\n\t\t\t}.bind(this), \"llm.registerModelDiscovery()\");\n\t\t\treturn () => void dispose();\n\t\t}\n\t\t/**\n\t\t* Interrogate one provider endpoint for the models it advertises. The\n\t\t* request describes a draft, not a stored route, so nothing here reads or\n\t\t* writes settings or credentials — the caller owns both, and the reply is\n\t\t* candidate metadata a surface may offer for adoption.\n\t\t* @param settingsNs - namespace whose registered discovery serves this draft.\n\t\t* @param request - the endpoint, protocol, and one-shot credential to use.\n\t\t* @param signal - caller cancellation.\n\t\t* @returns the advertised models, deduplicated in endpoint order.\n\t\t*/\n\t\tasync discoverModels(settingsNs, request, signal) {\n\t\t\tconst discover = this.discoveries.get(settingsNs);\n\t\t\tif (discover === void 0) throw new LlmError(`no model discovery is registered for \"${settingsNs}\"`, \"NO_DISCOVERY\");\n\t\t\tif ((request.provider ?? \"\").length === 0 && (request.baseURL ?? \"\").length === 0) throw new LlmError(\"model discovery needs a provider route or a baseURL\", \"INVALID_DISCOVERY\");\n\t\t\tconst discovered = signal === void 0 ? await discover(request) : await discover(request, signal);\n\t\t\tconst seen = /* @__PURE__ */ new Set();\n\t\t\tconst models = [];\n\t\t\tfor (const model of discovered) {\n\t\t\t\tif (typeof model.id !== \"string\" || model.id.length === 0 || seen.has(model.id)) continue;\n\t\t\t\tseen.add(model.id);\n\t\t\t\tmodels.push({\n\t\t\t\t\tid: model.id,\n\t\t\t\t\t...model.name === void 0 ? {} : { name: model.name },\n\t\t\t\t\t...model.contextWindow === void 0 ? {} : { contextWindow: model.contextWindow },\n\t\t\t\t\t...model.maxTokens === void 0 ? {} : { maxTokens: model.maxTokens }\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn models;\n\t\t}\n\t\t/**\n\t\t* Remote adapter for one draft provider interrogation.\n\t\t* @param settingsNs - namespace whose registered discovery serves this draft.\n\t\t* @param request - endpoint, protocol, and one-shot credential to use.\n\t\t* @param signal - caller cancellation supplied by the Remote carrier.\n\t\t* @returns advertised models in endpoint order.\n\t\t* @throws RemoteError with `llm/model-discovery-rejected` when discovery refuses or fails.\n\t\t*/\n\t\tasync remoteDiscoverModels(settingsNs, request, signal) {\n\t\t\ttry {\n\t\t\t\treturn await this.discoverModels(settingsNs, request, signal);\n\t\t\t} catch (error) {\n\t\t\t\tthrow new RemoteError(\"llm/model-discovery-rejected\", error instanceof Error ? error.message : String(error), {\n\t\t\t\t\tsettingsNs,\n\t\t\t\t\t...request.baseURL === void 0 ? {} : { baseURL: request.baseURL }\n\t\t\t\t}, { cause: error });\n\t\t\t}\n\t\t}\n\t\t/**\n\t\t* Resolve the retry policy captured when one provider route was registered.\n\t\t* @param provider - registered provider route to inspect.\n\t\t* @returns the provider-owned policy, with normal defaults already resolved.\n\t\t*/\n\t\tproviderRetryPolicy(provider) {\n\t\t\treturn this.registration(provider).retryPolicy;\n\t\t}\n\t\t/**\n\t\t* Resolve provider-side request-image pricing for one exact route, or\n\t\t* `undefined` when the provider is unregistered or declares none. Unknown\n\t\t* providers degrade to `undefined` rather than throwing because callers\n\t\t* price durable history whose route may no longer be mounted.\n\t\t* @param provider - provider route named by a request header.\n\t\t* @param model - exact model id named by the same header.\n\t\t* @returns the owning adapter's image pricing for the route, when declared.\n\t\t*/\n\t\timageRequestPricing(provider, model) {\n\t\t\treturn this.adapters.get(provider)?.adapter.imageRequestPricing(provider, model);\n\t\t}\n\t\t/**\n\t\t* Resolve the exact text one durable file occurrence contributes to every\n\t\t* provider request in the current execution environment.\n\t\t* @param ref - durable verbatim file reference from model history.\n\t\t* @returns the same deterministic handle text used at adapter dispatch.\n\t\t*/\n\t\tfileRequestText(ref) {\n\t\t\treturn fileHandleText(ref, this.fileReadPath(ref));\n\t\t}\n\t\t/** Detach typed adapter-owned modality metadata. */\n\t\tdetachedModalities(modalities) {\n\t\t\treturn modalities === void 0 ? void 0 : [...modalities];\n\t\t}\n\t\t/**\n\t\t* Discover models advertised by one registered provider. Catalog membership\n\t\t* is advisory and never changes routing or request validation.\n\t\t* @param provider - registered provider route to inspect.\n\t\t* @returns detached model metadata in adapter-preferred order.\n\t\t*/\n\t\tasync listModels(provider) {\n\t\t\tconst models = await this.registration(provider).adapter.listModels(provider);\n\t\t\tconst seen = /* @__PURE__ */ new Set();\n\t\t\treturn models.map((model) => {\n\t\t\t\tif (typeof model.provider !== \"string\" || model.provider !== provider || typeof model.id !== \"string\" || model.id.length === 0 || typeof model.name !== \"string\" || model.name.length === 0 || model.description !== void 0 && typeof model.description !== \"string\" || seen.has(model.id)) throw new LlmError(`adapter returned invalid or duplicate model metadata for provider \"${provider}\"`, \"INVALID_CATALOG\");\n\t\t\t\tseen.add(model.id);\n\t\t\t\tconst inputModalities = this.detachedModalities(model.inputModalities);\n\t\t\t\treturn {\n\t\t\t\t\tprovider: model.provider,\n\t\t\t\t\tid: model.id,\n\t\t\t\t\tname: model.name,\n\t\t\t\t\t...model.description === void 0 ? {} : { description: model.description },\n\t\t\t\t\t...inputModalities === void 0 ? {} : { inputModalities }\n\t\t\t\t};\n\t\t\t});\n\t\t}\n\t\t/**\n\t\t* Resolve and validate all metadata from the adapter that owns one exact\n\t\t* route. The result is detached from adapter-owned objects; catalog\n\t\t* membership remains advisory and does not control request routing.\n\t\t* @param provider - registered provider route to inspect.\n\t\t* @param model - exact model id passed to the adapter.\n\t\t* @param signal - optional cancellation for adapter-owned asynchronous lookup.\n\t\t* @returns exact model identity plus available context and reasoning metadata.\n\t\t*/\n\t\tasync resolveModelInfo(provider, model, signal) {\n\t\t\treturn this.resolveModelInfoFor(this.registration(provider), model, signal);\n\t\t}\n\t\tasync resolveModelInfoFor(registration, model, signal) {\n\t\t\tconst resolved = await registration.adapter.resolveModel(registration.provider.id, model, signal);\n\t\t\treturn this.normalizeModelInfo(registration, model, resolved);\n\t\t}\n\t\t/** Validate and detach one adapter-returned exact model result. */\n\t\tnormalizeModelInfo(registration, model, resolved) {\n\t\t\tconst provider = registration.provider.id;\n\t\t\tif (typeof resolved.provider !== \"string\" || resolved.provider !== provider || typeof resolved.id !== \"string\" || resolved.id !== model || typeof resolved.name !== \"string\" || resolved.name.length === 0 || resolved.description !== void 0 && typeof resolved.description !== \"string\") throw new LlmError(`adapter returned invalid exact model metadata for provider \"${provider}\" model \"${model}\"`, \"INVALID_MODEL_INFO\");\n\t\t\tconst context = resolved.context;\n\t\t\tif (context !== void 0 && (!Number.isInteger(context.contextWindow) || context.contextWindow <= 0)) throw new LlmError(`adapter returned invalid context metadata for provider \"${provider}\" model \"${model}\"`, \"INVALID_MODEL_CONTEXT\");\n\t\t\tconst inputModalities = this.detachedModalities(resolved.inputModalities);\n\t\t\tconst systemPromptUpdate = resolved.systemPromptUpdate;\n\t\t\tif (systemPromptUpdate !== void 0 && systemPromptUpdate !== \"in-history\") throw new LlmError(`adapter returned invalid system prompt update mode for provider \"${provider}\" model \"${model}\"`, \"INVALID_MODEL_INFO\");\n\t\t\tconst defaultMaxTokens = resolved.defaultMaxTokens;\n\t\t\tif (defaultMaxTokens !== void 0 && (!Number.isSafeInteger(defaultMaxTokens) || defaultMaxTokens <= 0)) throw new LlmError(`adapter returned invalid default maxTokens for provider \"${provider}\" model \"${model}\"`, \"INVALID_MODEL_MAX_TOKENS\");\n\t\t\tconst info = {\n\t\t\t\tprovider,\n\t\t\t\tid: model,\n\t\t\t\tname: resolved.name,\n\t\t\t\t...resolved.description === void 0 ? {} : { description: resolved.description },\n\t\t\t\t...inputModalities === void 0 ? {} : { inputModalities },\n\t\t\t\t...context === void 0 ? {} : { context: { contextWindow: context.contextWindow } },\n\t\t\t\t...defaultMaxTokens === void 0 ? {} : { defaultMaxTokens },\n\t\t\t\t...resolved.systemPromptUpdate === void 0 ? {} : { systemPromptUpdate: resolved.systemPromptUpdate }\n\t\t\t};\n\t\t\tconst reasoning = resolved.reasoning;\n\t\t\tif (reasoning === void 0) return info;\n\t\t\tif (reasoning.efforts.length === 0) throw new LlmError(`adapter returned invalid reasoning metadata for provider \"${provider}\" model \"${model}\"`, \"INVALID_MODEL_REASONING\");\n\t\t\tconst seen = /* @__PURE__ */ new Set();\n\t\t\tconst efforts = reasoning.efforts.map((effort) => {\n\t\t\t\tif (typeof effort.id !== \"string\" || effort.id.length === 0 || typeof effort.name !== \"string\" || effort.name.length === 0 || effort.description !== void 0 && typeof effort.description !== \"string\" || seen.has(effort.id)) throw new LlmError(`adapter returned invalid or duplicate reasoning effort metadata for provider \"${provider}\" model \"${model}\"`, \"INVALID_MODEL_REASONING\");\n\t\t\t\tseen.add(effort.id);\n\t\t\t\treturn {\n\t\t\t\t\tid: effort.id,\n\t\t\t\t\tname: effort.name,\n\t\t\t\t\t...effort.description === void 0 ? {} : { description: effort.description }\n\t\t\t\t};\n\t\t\t});\n\t\t\tif (reasoning.defaultEffort !== void 0 && !seen.has(reasoning.defaultEffort)) throw new LlmError(`adapter returned an unknown default reasoning effort for provider \"${provider}\" model \"${model}\"`, \"INVALID_MODEL_REASONING\");\n\t\t\treturn {\n\t\t\t\t...info,\n\t\t\t\treasoning: {\n\t\t\t\t\tefforts,\n\t\t\t\t\t...reasoning.defaultEffort === void 0 ? {} : { defaultEffort: reasoning.defaultEffort }\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t\t/**\n\t\t* Validate a conversation call config against its exact model capability and\n\t\t* materialize adapter-configured defaults. Unsupported explicit efforts\n\t\t* reject before provider I/O; no clamping or aliasing is performed. This\n\t\t* standalone query does not bind a later dispatch; use {@link prepareCall}\n\t\t* when logging and streaming must share one adapter registration.\n\t\t* @param config - provider/model route and optional request controls.\n\t\t* @param signal - optional cancellation for adapter-owned capability lookup.\n\t\t* @returns a detached config only when a default must be materialized.\n\t\t*/\n\t\tasync resolveCallConfig(config, signal) {\n\t\t\treturn (await this.resolveCallFor(this.registration(config.provider), config, signal)).config;\n\t\t}\n\t\tasync resolveCallFor(registration, config, signal) {\n\t\t\tconst info = await this.resolveModelInfoFor(registration, config.model, signal);\n\t\t\treturn this.resolveCallWithInfo(config, info);\n\t\t}\n\t\t/** Validate request controls against one already-bound exact model result. */\n\t\tresolveCallWithInfo(config, info) {\n\t\t\tconst defaulted = config.maxTokens === void 0 && info.defaultMaxTokens !== void 0 ? {\n\t\t\t\t...config,\n\t\t\t\tmaxTokens: info.defaultMaxTokens\n\t\t\t} : config;\n\t\t\tconst reasoning = info.reasoning;\n\t\t\tconst requested = defaulted.reasoningEffort;\n\t\t\tlet resolvedConfig = defaulted;\n\t\t\tif (reasoning === void 0) {\n\t\t\t\tif (requested !== void 0) throw new LlmError(`provider \"${config.provider}\" model \"${config.model}\" does not support reasoning effort \"${requested}\"`, \"UNSUPPORTED_REASONING_EFFORT\");\n\t\t\t} else {\n\t\t\t\tconst effective = requested ?? reasoning.defaultEffort;\n\t\t\t\tif (effective !== void 0) {\n\t\t\t\t\tif (!reasoning.efforts.some((effort) => effort.id === effective)) throw new LlmError(`provider \"${config.provider}\" model \"${config.model}\" does not support reasoning effort \"${effective}\"`, \"UNSUPPORTED_REASONING_EFFORT\");\n\t\t\t\t\tif (requested !== effective) resolvedConfig = {\n\t\t\t\t\t\t...defaulted,\n\t\t\t\t\t\treasoningEffort: effective\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tconfig: resolvedConfig,\n\t\t\t\t...info.context === void 0 ? {} : { context: info.context },\n\t\t\t\tmodelInfo: info\n\t\t\t};\n\t\t}\n\t\t/**\n\t\t* Resolve one call under its current adapter registration. The returned\n\t\t* one-shot handle keeps that registration across header logging and dispatch,\n\t\t* so HMR cannot combine one adapter's capability result with another adapter.\n\t\t* @param config - provider/model route and optional request controls.\n\t\t* @param signal - optional cancellation for adapter-owned capability lookup.\n\t\t* @returns a prepared config and its registration-bound stream entry point.\n\t\t*/\n\t\tasync prepareCall(config, signal) {\n\t\t\tconst registration = this.registration(config.provider);\n\t\t\tconst adapterCall = await registration.adapter.prepareCall(config.provider, config.model, signal);\n\t\t\tconst modelInfo = this.normalizeModelInfo(registration, config.model, adapterCall.model);\n\t\t\tconst resolved = this.resolveCallWithInfo(config, modelInfo);\n\t\t\tconst resolvedConfig = deepFreeze(structuredClone(resolved.config));\n\t\t\tconst context = resolved.context === void 0 ? void 0 : deepFreeze(structuredClone(resolved.context));\n\t\t\tconst adapterDefaults = deepFreeze({\n\t\t\t\t...config.reasoningEffort === void 0 && resolvedConfig.reasoningEffort !== void 0 ? { reasoningEffort: true } : {},\n\t\t\t\t...config.maxTokens === void 0 && resolvedConfig.maxTokens !== void 0 ? { maxTokens: true } : {}\n\t\t\t});\n\t\t\tlet dispatched = false;\n\t\t\treturn Object.freeze({\n\t\t\t\tconfig: resolvedConfig,\n\t\t\t\tretryPolicy: registration.retryPolicy,\n\t\t\t\tadapterDefaults,\n\t\t\t\t...context === void 0 ? {} : { context },\n\t\t\t\t...modelInfo.inputModalities === void 0 ? {} : { inputModalities: Object.freeze([...modelInfo.inputModalities]) },\n\t\t\t\t...modelInfo.systemPromptUpdate === void 0 ? {} : { systemPromptUpdate: modelInfo.systemPromptUpdate },\n\t\t\t\tstream: (options) => {\n\t\t\t\t\tif (dispatched) throw new LlmError(\"a prepared LLM call can only be dispatched once\", \"INVALID_PREPARED_CALL\");\n\t\t\t\t\tif (!callConfigEquals(options, resolvedConfig)) throw new LlmError(\"prepared LLM call config changed before adapter dispatch\", \"INVALID_PREPARED_CALL\");\n\t\t\t\t\tdispatched = true;\n\t\t\t\t\treturn this.streamWithRegistration(options, {\n\t\t\t\t\t\tregistration,\n\t\t\t\t\t\tconfig: resolvedConfig,\n\t\t\t\t\t\tmodelInfo,\n\t\t\t\t\t\tdispatch: (options) => adapterCall.stream(options)\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\tregistration(provider) {\n\t\t\tconst registration = this.adapters.get(provider);\n\t\t\tif (!registration) throw new LlmError(`no adapter registered for provider \"${provider}\"`, \"NO_ADAPTER\");\n\t\t\treturn registration;\n\t\t}\n\t\t/** Remove replay state whose historical route is owned by another adapter. */\n\t\tforAdapter(options, adapter) {\n\t\t\tconst messages = options.messages.map((message) => {\n\t\t\t\tconst source = message.source;\n\t\t\t\tif (message.role !== \"assistant\" || source.kind !== \"model\" || source.replayState === void 0) return message;\n\t\t\t\tif (this.adapters.get(source.provider)?.adapter === adapter) return message;\n\t\t\t\treturn freezeMessage({\n\t\t\t\t\t...message,\n\t\t\t\t\tsource: {\n\t\t\t\t\t\tkind: \"model\",\n\t\t\t\t\t\tprovider: source.provider,\n\t\t\t\t\t\tmodel: source.model\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t\tif (messages.every((message, index) => message === options.messages[index])) return options;\n\t\t\tconst filtered = {\n\t\t\t\t...options,\n\t\t\t\tmessages\n\t\t\t};\n\t\t\treturn Object.isFrozen(options) ? deepFreeze(filtered) : filtered;\n\t\t}\n\t\t/**\n\t\t* Resolve the current execution-world read path of one durable file\n\t\t* reference through the mounted attachment and filesystem providers.\n\t\t*/\n\t\tfileReadPath(ref) {\n\t\t\tlet hostPath;\n\t\t\ttry {\n\t\t\t\thostPath = this.ctx.get(\"attachments\")?.fileHostPath(ref);\n\t\t\t} catch {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (hostPath === void 0) return void 0;\n\t\t\treturn this.ctx.get(\"fs\")?.processPathFromHostPath(hostPath);\n\t\t}\n\t\t/**\n\t\t* Final adapter boundary. Adapter selection, dispatch, iterator construction,\n\t\t* and iteration failures become one terminal failure chunk. Middleware and\n\t\t* downstream consumer failures remain thrown plugin or consumer errors.\n\t\t*/\n\t\tasync *adapterStream(options, prepared) {\n\t\t\tlet iterator;\n\t\t\ttry {\n\t\t\t\tconst registration = prepared?.registration ?? this.registration(options.provider);\n\t\t\t\tconst adapter = registration.adapter;\n\t\t\t\tlet modelInfo;\n\t\t\t\tlet resolvedConfig;\n\t\t\t\tlet dispatch;\n\t\t\t\tif (prepared === void 0) {\n\t\t\t\t\tconst adapterCall = await adapter.prepareCall(options.provider, options.model, options.signal);\n\t\t\t\t\tmodelInfo = this.normalizeModelInfo(registration, options.model, adapterCall.model);\n\t\t\t\t\tresolvedConfig = this.resolveCallWithInfo(options, modelInfo).config;\n\t\t\t\t\tdispatch = (options) => adapterCall.stream(options);\n\t\t\t\t} else {\n\t\t\t\t\tmodelInfo = prepared.modelInfo;\n\t\t\t\t\tresolvedConfig = prepared.config;\n\t\t\t\t\tdispatch = prepared.dispatch;\n\t\t\t\t}\n\t\t\t\tif (prepared !== void 0 && !callConfigEquals(options, resolvedConfig)) throw new LlmError(\"prepared LLM call config changed before adapter dispatch\", \"INVALID_PREPARED_CALL\");\n\t\t\t\tconst resolvedOptions = callConfigEquals(options, resolvedConfig) ? options : Object.isFrozen(options) ? deepFreeze({\n\t\t\t\t\t...options,\n\t\t\t\t\t...resolvedConfig\n\t\t\t\t}) : {\n\t\t\t\t\t...options,\n\t\t\t\t\t...resolvedConfig\n\t\t\t\t};\n\t\t\t\tlet projectedMessages = resolvedOptions.messages;\n\t\t\t\tif (projectedMessages.some((message) => contentHasFile(message.content))) projectedMessages = projectFilesToText(projectedMessages, (ref) => this.fileReadPath(ref));\n\t\t\t\tif (modelInfo.inputModalities !== void 0 && !modelInfo.inputModalities.includes(\"image\") && projectedMessages.some((message) => contentHasImage(message.content))) projectedMessages = projectImagesForTextModel(projectedMessages);\n\t\t\t\tconst projectedOptions = projectedMessages === resolvedOptions.messages ? resolvedOptions : Object.isFrozen(resolvedOptions) ? deepFreeze({\n\t\t\t\t\t...resolvedOptions,\n\t\t\t\t\tmessages: projectedMessages\n\t\t\t\t}) : {\n\t\t\t\t\t...resolvedOptions,\n\t\t\t\t\tmessages: projectedMessages\n\t\t\t\t};\n\t\t\t\titerator = dispatch(this.forAdapter(projectedOptions, adapter))[Symbol.asyncIterator]();\n\t\t\t} catch (error) {\n\t\t\t\tyield adapterFailureChunk(error, options.signal);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tlet completed = false;\n\t\t\ttry {\n\t\t\t\twhile (true) {\n\t\t\t\t\tlet item;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst next = await iterator.next();\n\t\t\t\t\t\titem = next.done ? { done: true } : {\n\t\t\t\t\t\t\tdone: false,\n\t\t\t\t\t\t\tvalue: next.value\n\t\t\t\t\t\t};\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tcompleted = true;\n\t\t\t\t\t\tyield adapterFailureChunk(error, options.signal);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (item.done) {\n\t\t\t\t\t\tcompleted = true;\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tyield item.value;\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tif (!completed) {\n\t\t\t\t\tconst close = iterator.return?.bind(iterator);\n\t\t\t\t\tif (close) await close();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t/**\n\t\t* Stream one model call as raw chunks (token-level deltas). Replay state is\n\t\t* retained only when the same adapter instance owns its historical provider\n\t\t* and the target provider. Final adapter selection remains fixed through\n\t\t* asynchronous exact-model resolution and dispatch. Adapter selection,\n\t\t* dispatch, and iteration failures become terminal `error` or `aborted`\n\t\t* finish chunks; middleware, nested-call, cleanup, and consumer failures\n\t\t* remain thrown.\n\t\t* @param options - the full request; `options.provider` selects the adapter.\n\t\t* @returns the chunk stream, possibly wrapped by `llm/stream` listeners.\n\t\t*/\n\t\tstream(options) {\n\t\t\treturn this.streamWithRegistration(options);\n\t\t}\n\t\tstreamWithRegistration(options, prepared) {\n\t\t\treturn this.ctx.waterfall(this, \"llm/stream\", options, () => this.adapterStream(options, prepared));\n\t\t}\n\t};\n})();\n/** Convert one adapter throw into the stream protocol's terminal outcome. */\nfunction adapterFailureChunk(error, signal) {\n\tconst failure = normalizeLlmFailure(error);\n\treturn {\n\t\ttype: \"finish\",\n\t\treason: signal?.aborted || failure.code === \"ABORTED\" ? {\n\t\t\tkind: \"aborted\",\n\t\t\tfailure\n\t\t} : {\n\t\t\tkind: \"error\",\n\t\t\tfailure\n\t\t}\n\t};\n}\n//#endregion\nexport { APP_IDENTITY, AssistantStreamAccumulator, BlockAssembler, CONTEXT_SUMMARY_MAX_CHARS, CONTEXT_WINDOW_EXCEEDED_CODE, EMPTY_RESPONSE_CODE, HarnessError, INVALID_CREDENTIAL_CODE, LlmAdapter, LlmAttemptId, LlmError, LlmRuntime, LlmRuntime as default, MessageId, ProviderRequestId, QUOTA_EXCEEDED_CODE, ReasoningEffortId, RetryPolicySchema, ToolCallId, assembleAssistantStream, assertUsableApiKey, assistantStreamChunks, assistantStreamFirstTokenTime, assistantStreamHasVisibleContent, assistantStreamHasVisibleText, attributionHeaders, boundContextSummary, callConfigEquals, chunkHasVisibleText, contentHasFile, contentHasImage, createAssistantMessage, createMessage, createSystemMessage, createToolResultMessage, createUserMessage, errorChain, expandAssistantStream, fileHandleText, freezeMessage, isAgentLoopRequest, isContextWindowExceededError, isHarnessError, isQuotaExceededError, isTokenDelta, isVisibleChunk, joinAssistantStreamText, lastAssistantStreamChunk, markAgentLoopRequest, normalizeApiKey, offloadRequestImagesWithPolicy, offloadedImagePrefixCount, offloadedImageText, projectFilesToText, projectImagesForTextModel, requestImageHandleText, resolveImageAttachmentAccess, resolveRetryPolicy, runFirstTokenTime, runFirstVisibleTime, textOnlyImageText, userAgent };\n","import type { Context } from '@deepseek-ai/cordis'\nimport { createUserMessage } from '@deepseek-ai/dsh-llm'\nimport type {} from '@deepseek-ai/dsh-host-webserver'\nimport {\n sharedWorkspaceInstructionStore,\n sharedSessionInstructionSnapshotStore,\n type SessionInstructionSnapshot,\n type WorkspaceInstructionRecord,\n} from './workspace-instructions.js'\n\nconst SYSTEM_REMINDER_OPEN = '<system-reminder>'\nconst SYSTEM_REMINDER_CLOSE = '</system-reminder>'\nconst INSTRUCTION_INTRO =\n 'The following project instructions are managed by the user for this DSH workspace. Follow them as persistent workspace guidance. They take precedence over repository-provided workspace guidance. System, developer, and direct user instructions take precedence over these project instructions.'\n\nexport interface InstructionSnapshotResult {\n snapshot: SessionInstructionSnapshot\n message: ReturnType<typeof createUserMessage> | undefined\n}\n\nexport function escapeInstructionFrameBody(body: string): string {\n return body.replaceAll(SYSTEM_REMINDER_CLOSE, '<\\\\/system-reminder>')\n}\n\nexport function renderInstructionMessageText(workspaceTitle: string, text: string): string {\n const escaped = escapeInstructionFrameBody(text)\n return `${SYSTEM_REMINDER_OPEN}\\n${INSTRUCTION_INTRO}\\n\\nInstructions for workspace: ${workspaceTitle}\\n\\n${escaped}\\n${SYSTEM_REMINDER_CLOSE}`\n}\n\nexport function createInstructionMessage(\n workspaceId: string,\n workspaceTitle: string,\n snapshot: SessionInstructionSnapshot,\n): ReturnType<typeof createUserMessage> {\n const text = renderInstructionMessageText(workspaceTitle, snapshot.text)\n return createUserMessage({\n content: [{ type: 'text', text }],\n source: {\n kind: 'dshb-workspace-instructions',\n form: 'instructions',\n workspaceId,\n revision: snapshot.workspaceRevision,\n digest: snapshot.digest,\n snapshot: true,\n } as never,\n })\n}\n\ninterface AgentLike {\n session: {\n id: string\n header: { cwd: string }\n surface?: { nodes?: number[] }\n eventAt?: (seq: number) => { type: string; data: { source: { kind: string } } } | undefined\n }\n}\n\ninterface MessageLike {\n id: string\n role: string\n source: { kind: string }\n}\n\ninterface WorkspaceRegistryLike {\n resolveByPath(path: string): Promise<{ id: string; path: string; title: string } | undefined>\n get(id: string): { id: string; path: string; title: string } | undefined\n}\n\nfunction hasDirectUserMessage(messages: MessageLike[]): boolean {\n return messages.some((m) => m.role === 'user' && m.source.kind === 'user')\n}\n\nfunction hasOwnInstructionMessage(agent: AgentLike): boolean {\n const nodes = agent.session.surface?.nodes\n if (!nodes) return false\n for (const seq of nodes) {\n const event = agent.session.eventAt?.(seq)\n if (event?.type === 'user/message' && event.data.source.kind === 'dshb-workspace-instructions') {\n return true\n }\n }\n return false\n}\n\nexport async function resolveSnapshotForSession(\n agent: AgentLike,\n messages: MessageLike[],\n workspaceStore = sharedWorkspaceInstructionStore(),\n snapshotStore = sharedSessionInstructionSnapshotStore(),\n registry?: WorkspaceRegistryLike,\n): Promise<SessionInstructionSnapshot | undefined> {\n const sessionId = agent.session.id\n const existing = snapshotStore.get(sessionId)\n if (existing) return existing\n\n const isFirstDirect = hasDirectUserMessage(messages) && !hasOwnInstructionMessage(agent)\n if (!isFirstDirect) return undefined\n\n let workspaceId: string | undefined\n let workspaceTitle = 'Unknown'\n const cwd = agent.session.header.cwd\n if (registry && cwd) {\n try {\n const ws = await registry.resolveByPath(cwd)\n if (ws) {\n workspaceId = ws.id\n workspaceTitle = ws.title\n }\n } catch {\n // path 不可解析时创建无工作区空快照\n }\n }\n\n const record: WorkspaceInstructionRecord | undefined = workspaceId\n ? workspaceStore.get(workspaceId)\n : undefined\n\n if (!record || record.text.length === 0) {\n return snapshotStore.createIfAbsent(sessionId, {\n kind: 'empty',\n workspaceId,\n })\n }\n\n return snapshotStore.createIfAbsent(sessionId, {\n kind: 'workspace',\n record,\n workspaceId: workspaceId!,\n })\n}\n\nexport function registerWorkspaceInstructionInjector(ctx: Context): void {\n if (typeof (ctx as { on?: unknown }).on !== 'function') return\n const workspaceStore = sharedWorkspaceInstructionStore()\n const snapshotStore = sharedSessionInstructionSnapshotStore()\n\n ;(ctx as unknown as { on: (event: string, handler: (arg: { agent: AgentLike; messages: MessageLike[]; signal: AbortSignal }, next: () => Promise<{ kind: string; messages: MessageLike[] }>) => Promise<unknown>) => void }).on('agent/pre-step', async ({ agent, messages, signal }, next) => {\n const decision = await next()\n if (decision.kind === 'reject') return decision\n signal.throwIfAborted()\n\n const agentLike = agent as unknown as AgentLike\n const messagesLike = messages as unknown as MessageLike[]\n\n const registry = ctx.get('workspaceRegistry') as WorkspaceRegistryLike | undefined\n\n let snapshot = snapshotStore.get(agentLike.session.id)\n if (!snapshot) {\n snapshot = await resolveSnapshotForSession(\n agentLike,\n messagesLike,\n workspaceStore,\n snapshotStore,\n registry,\n )\n }\n signal.throwIfAborted()\n if (!snapshot || snapshot.text.length === 0) return decision\n\n if (hasOwnInstructionMessage(agentLike)) return decision\n\n const workspaceId = snapshot.workspaceId\n if (!workspaceId) return decision\n const ws = registry?.get(workspaceId)\n const workspaceTitle = ws?.title ?? 'Unknown'\n\n const message = createInstructionMessage(workspaceId, workspaceTitle, snapshot)\n const lastClaimedIndex = decision.messages.findLastIndex((m) =>\n (messages as unknown as MessageLike[]).includes(m as unknown as MessageLike),\n )\n const entered = decision.messages.toSpliced(lastClaimedIndex + 1, 0, message)\n return {\n ...decision,\n messages: entered,\n }\n })\n\n try {\n ;(ctx as { on?: (event: string, handler: (sessionId: string) => void) => void }).on?.('session/deleted', (sessionId: string) => {\n snapshotStore.remove(sessionId)\n })\n } catch {\n // session/deleted event may not exist in this DSH version\n }\n}\n\nexport const name = 'dshb-workspace-instruction-injector'\nexport const inject = ['workspaceRegistry']\n"],"x_google_ignoreList":[0,1,2,3,4,5,6,7],"mappings":";;;;;;;;;;;;AAUA,IAAI,cAAc,cAAc,MAAM;CACrC;CACA;;CAEA,mBAAmB;;;;;;;CAOnB,YAAY,MAAM,SAAS,SAAS,SAAS;EAC5C,MAAM,SAAS,OAAO;EACtB,KAAK,OAAO;EACZ,KAAK,UAAU;EACf,KAAK,OAAO;CACb;AACD;;;;;;;AAmBA,MAAM,gCAAgC;;;;;;AAMtC,SAAS,sBAAsB,OAAO;CACrC,OAAO,UAAU,OAAO,UAAU,QAAQ,8BAA8B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AAO;EAC5E,OAAO;GACL,GAAG;GACH,UAAU;EACZ;CACF,CAAC;CAED,IAAI;EACD,IAAgF,KAAK,oBAAoB,cAAsB;GAC9H,cAAc,OAAO,SAAS;EAChC,CAAC;CACH,QAAQ,CAER;AACF;AAEA,MAAa,OAAO;AACpB,MAAa,SAAS,CAAC,mBAAmB"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@artenx/dshb",
3
- "version": "0.1.2",
4
- "description": "Routes DSH filesystem, shell, subprocess, and PTY operations to local, SSH, and Docker execution nodes, with a node registry, an authentication gate, and a mobile-aware management UI.",
3
+ "version": "0.1.4",
4
+ "description": "Routes DSH filesystem, shell, subprocess, and PTY operations to local, SSH, and Docker execution nodes, with a node registry, an authentication gate, a mobile-aware management UI, and per-workspace custom project instructions.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -26,6 +26,9 @@
26
26
  "./core/ssh-config": "./lib/core/ssh-config.js",
27
27
  "./core/known-hosts": "./lib/core/known-hosts.js",
28
28
  "./core/workspace-bindings": "./lib/core/workspace-bindings.js",
29
+ "./core/workspace-instructions": "./lib/core/workspace-instructions.js",
30
+ "./core/workspace-instruction-routes": "./lib/core/workspace-instruction-routes.js",
31
+ "./core/workspace-instruction-context": "./lib/core/workspace-instruction-context.js",
29
32
  "./core/workspaces": "./lib/core/workspaces.js",
30
33
  "./core/audit": "./lib/core/audit.js",
31
34
  "./router": "./lib/router/index.js",