dsh-boost 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +41 -18
- package/README.md +34 -17
- package/dist/http/mount.js +5 -3
- package/dist/http/mount.js.map +1 -1
- package/dist/http/state.js +8 -1
- package/dist/http/state.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/scope/doc.js +8 -0
- package/dist/scope/doc.js.map +1 -1
- package/dist/scope/store.js +5 -4
- package/dist/scope/store.js.map +1 -1
- package/dist/tools/boost.js +8 -0
- package/dist/tools/boost.js.map +1 -1
- package/lib/client.js +122 -106
- package/locale/en.json +4 -2
- package/locale/zh.json +4 -2
- package/package.json +1 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE3C,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAA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,CAAC,GAAG;oBACjB,KAAK,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE,CAC5B,QAAQ,CAAC;wBACP,GAAG,SAAS;wBACZ,8DAA8D;wBAC9D,+DAA+D;wBAC/D,wDAAwD;wBACxD,IAAI,EAAE;4BACJ,GAAG,EAAE,WAAW;4BAChB,IAAI;4BACJ,GAAG,CAAC,OAAO,YAAY,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;yBAC9D;qBACF,CAAC;iBACL,EACD,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,CACvC,CAAA;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,CAChB,4EAA4E,SAAS,CAAC,KAAK,CAAC,GAAG,CAChG,CAAA;YACH,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,uEAAuE;YACvE,uCAAuC;YACvC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,CAChB,+EAA+E,SAAS,CAAC,KAAK,CAAC,EAAE,CAClG,CAAA;QACH,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,yCAAyC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IACjF,CAAC;AACH,CAAC","sourcesContent":["/**\n * dsh-boost cordis plugin entry point.\n *\n * The plugin is a plain function plugin: cordis reads `name` and `inject` from\n * the module and calls `apply(ctx, config)`. Only the production assembly lives\n * here — configuration resolution, the two stores the hooks and the control\n * tool share, the hook mounts, the lifecycle events that warm visibility,\n * drive the clock, flush receipts at turn end and clean up on session\n * disposal, and the `boost` tool, all wired once per plugin instance.\n *\n * Wiring failures are contained: a host that lacks the services a mount point\n * lives on must load the plugin with a warning, not die loading it. The data\n * root is `<dshHome>/boost` (`config.dshHome` when the row supplies it, else\n * `$DSH_HOME`), falling back to `~/.dsh/boost`.\n *\n * ## Why the mount disposers are dropped\n *\n * `ctx.on`, `ctx.systemPrompt.section` and `ctx.tools.register` all return a\n * disposer. Every one is deliberately discarded. A cordis plugin entry is\n * mounted in its own context, and disposing that entry tears down everything\n * registered through it; a retained disposer would add nothing except the\n * chance that a stale closure removes a mount owned by a later instance. The\n * assumption is exactly that per-entry ownership — if this plugin is ever\n * mounted into a context it does not own (a shared host context), the\n * disposers, or an explicit teardown, become required (review row 76).\n *\n * @module dsh-boost\n */\nimport { readFileSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport type { ToolDefinition } from '@deepseek-ai/dsh-tools'\nimport { measureBoostFixedOverhead } from './tools/boost.js'\nimport { RuntimeStepHorizon, StepBudget } from './admission/ledger.js'\nimport { RetrievalLedger } from './admission/retrieval.js'\nimport { UsageLedger } from './admission/usage.js'\nimport { resolveConfig } from './config.js'\nimport { AnchorStore } from './gate/invalidate.js'\nimport type { Plan } from './gate/plan.js'\nimport { resolveBoostRoot } from './host/root.js'\nimport { clearSession, SessionRuntime } from './hooks/llm-stream.js'\nimport { TurnClock } from './hooks/clock.js'\nimport { PendingQueue } from './hooks/pending.js'\nimport { clearAcceptedDispatch, registerHooks } from './hooks/post-execute.js'\nimport type { HookDeps, SelectorRoute } from './hooks/post-execute.js'\nimport type { SpillBackend } from './projection/apply.js'\nimport { ProjectionCounters } from './projection/counters.js'\nimport { PROTOCOL_NAME, PROTOCOL_TEXT } from './prompt/protocol.js'\nimport { ReceiptStore } from './receipts/store.js'\nimport type { LlmLike } from './selector/jev.js'\nimport { resolveWorkspace } from './scope/resolve.js'\nimport type { WorkspaceRegistry } from './scope/resolve.js'\nimport { ScopeStore } from './scope/store.js'\nimport { boostTool, runBoost } from './tools/boost.js'\nimport { registerHttpApi } from './http/mount.js'\nimport { listWorkspaces } from './http/state.js'\nimport type { BoostDeps, BoostHostFacts } from './tools/boost.js'\nimport type { PluginContext } from './types.js'\n\nexport const name = 'dsh-boost'\n\n/**\n * Required host services.\n *\n * `llm` is deliberately absent: projection and admission use no model, and\n * only the selector does. A hard injection would leave the whole plugin\n * pending — no hooks, no tool, no warning — on a composition without the LLM\n * runtime, even though it could still project. The selector resolves `llm`\n * lazily and fails closed with `selector-unavailable` when it is absent.\n */\nexport const inject = ['tools', 'systemPrompt'] as const\n\n/** Whether the host exposes both services the hook mounts attach to. */\nfunction canRegister(ctx: PluginContext): boolean {\n return typeof ctx.on === 'function' && typeof ctx.systemPrompt?.section === 'function'\n}\n\n/** One-line detail for a contained wiring failure. */\nfunction messageOf(error: unknown): string {\n return error instanceof Error ? error.message : String(error)\n}\n\n/** The dsh host line this build was verified against (`engines.dsh`). */\nconst VERIFIED_HOST_VERSION = '0.2.2-rc.4'\n\n/**\n * Whether a reported version names the verified release, ignoring build\n * metadata.\n *\n * The host's compatibility preflight compares with\n * `semver.satisfies(version, range, { includePrerelease: true })`, and semver\n * ignores `+build` metadata on both sides. String equality would warn on\n * `0.2.2-rc.4+build.5` — a build the host itself accepts — so the comparison\n * strips everything from the first `+` (review row 34).\n */\nfunction isVerifiedHostVersion(version: string): boolean {\n const core = (value: string): string => {\n const build = value.indexOf('+')\n return build === -1 ? value : value.slice(0, build)\n }\n return core(version) === core(VERIFIED_HOST_VERSION)\n}\n\n/** One parsed semantic version; build metadata is discarded. */\ntype SemVer = {\n major: number\n minor: number\n patch: number\n prerelease: readonly (string | number)[]\n}\n\n/**\n * Parse the semver subset a declared `engines.dsh` range uses.\n *\n * The host's compatibility preflight runs `semver.satisfies(..., {\n * includePrerelease: true })`. This module cannot import `semver` at runtime\n * (it is a dev dependency, and the published graph must stay host-free), so the\n * guard implements only what the manifest's range needs: `major.minor.patch`,\n * an optional prerelease, and the comparison operators. Anything else is\n * unparsable, and an unparsable range makes the guard advisory rather than\n * wrong.\n */\nfunction parseSemVer(value: string): SemVer | undefined {\n const match = /^v?(\\d+)\\.(\\d+)\\.(\\d+)(?:-([0-9A-Za-z.-]+))?(?:\\+[0-9A-Za-z.-]+)?$/.exec(\n value.trim(),\n )\n if (match === null) return undefined\n const majorText = match[1]\n const minorText = match[2]\n const patchText = match[3]\n if (majorText === undefined || minorText === undefined || patchText === undefined) {\n return undefined\n }\n const major = Number(majorText)\n const minor = Number(minorText)\n const patch = Number(patchText)\n if (!Number.isSafeInteger(major) || !Number.isSafeInteger(minor) || !Number.isSafeInteger(patch)) {\n return undefined\n }\n const prerelease: (string | number)[] = []\n const prereleaseText = match[4]\n if (prereleaseText !== undefined) {\n for (const identifier of prereleaseText.split('.')) {\n if (/^\\d+$/.test(identifier)) {\n const numeric = Number(identifier)\n if (!Number.isSafeInteger(numeric)) return undefined\n prerelease.push(numeric)\n } else {\n prerelease.push(identifier)\n }\n }\n }\n return { major, minor, patch, prerelease }\n}\n\n/** Semver precedence for one prerelease identifier (numeric sorts first). */\nfunction compareIdentifier(left: string | number, right: string | number): number {\n if (typeof left === 'number' && typeof right === 'number') return left - right\n if (typeof left === 'number') return -1\n if (typeof right === 'number') return 1\n return left < right ? -1 : left > right ? 1 : 0\n}\n\n/** Semver precedence: negative when `left` is older, positive when newer. */\nfunction compareSemVer(left: SemVer, right: SemVer): number {\n for (const key of ['major', 'minor', 'patch'] as const) {\n const delta = left[key] - right[key]\n if (delta !== 0) return delta\n }\n if (left.prerelease.length === 0 && right.prerelease.length === 0) return 0\n // A release outranks every prerelease of the same core version.\n if (left.prerelease.length === 0) return 1\n if (right.prerelease.length === 0) return -1\n const length = Math.max(left.prerelease.length, right.prerelease.length)\n for (let index = 0; index < length; index += 1) {\n const leftPart = left.prerelease[index]\n const rightPart = right.prerelease[index]\n // A shorter identifier list is lower when every shared part is equal.\n if (leftPart === undefined) return -1\n if (rightPart === undefined) return 1\n const delta = compareIdentifier(leftPart, rightPart)\n if (delta !== 0) return delta\n }\n return 0\n}\n\n/**\n * Whether `version` satisfies `range`, or `undefined` when either cannot be\n * parsed.\n *\n * Supports the space-separated AND comparators (`>=`, `>`, `<=`, `<`, `=`, or\n * bare) and `||` alternatives. An unevaluable range is not a mismatch: the\n * guard is advisory, and warning on a range it does not understand would be\n * worse than staying quiet.\n */\nfunction satisfiesRange(version: string, range: string): boolean | undefined {\n const parsed = parseSemVer(version)\n if (parsed === undefined) return undefined\n let evaluable = false\n for (const alternative of range.split('||')) {\n const comparators = alternative.trim().split(/\\s+/).filter(token => token !== '')\n if (comparators.length === 0) continue\n let matched = true\n let valid = true\n for (const token of comparators) {\n const match = /^(>=|<=|>|<|=)?(.+)$/.exec(token)\n const bound = match === null ? undefined : parseSemVer(match[2] ?? '')\n if (match === null || bound === undefined) {\n valid = false\n break\n }\n const order = compareSemVer(parsed, bound)\n const operator = match[1] ?? '='\n const satisfied =\n operator === '>='\n ? order >= 0\n : operator === '<='\n ? order <= 0\n : operator === '>'\n ? order > 0\n : operator === '<'\n ? order < 0\n : order === 0\n if (!satisfied) {\n matched = false\n break\n }\n }\n if (!valid) continue\n evaluable = true\n if (matched) return true\n }\n return evaluable ? false : undefined\n}\n\n/**\n * The `engines.dsh` range this build declares, read from the package manifest.\n *\n * The manifest is the one authority for \"hosts this plugin accepts\": the host's\n * preflight reads the same field, so a guard with a hard-coded range would drift\n * from the declaration it is supposed to enforce (review row 51). Memoised; a\n * missing or malformed manifest makes the guard advisory.\n */\nlet declaredHostRange: string | undefined | null = null\n\nfunction declaredHostRangeOf(): string | undefined {\n if (declaredHostRange !== null) return declaredHostRange\n try {\n const manifest = JSON.parse(\n readFileSync(new URL('../package.json', import.meta.url), 'utf8'),\n ) as { engines?: { dsh?: unknown } }\n const range = manifest.engines?.dsh\n declaredHostRange = typeof range === 'string' && range.trim() !== '' ? range.trim() : undefined\n } catch {\n declaredHostRange = undefined\n }\n return declaredHostRange\n}\n\n/**\n * Stable host code: the resolved host version is not the verified one.\n *\n * A warning, never a hard failure: an unverified version is a risk, not proof\n * that an API this build uses has moved. It belongs to the `ERR_HOST_*` family\n * this module already logs (`ERR_HOST_NO_AGENT_REQUEST`,\n * `ERR_HOST_COMPLETE_SECTION`).\n */\nconst ERR_HOST_VERSION_MISMATCH = 'ERR_HOST_VERSION_MISMATCH'\n\n/**\n * Stable host code: `system-prompt/assemble` was never observed.\n *\n * `ctx.on` accepts any string, so a renamed event registers successfully and\n * then never fires. This module needs assemble to warm the visibility cache\n * before section text resolves (design D4). The host runs assemble before\n * `agent/pre-step`, so the first pre-step without a single observed assemble is\n * proof the seam is gone. Raised once per process, on the first step that\n * needed it; the only signal is \"never fired\", so the event name also joins\n * `missingMounts`, and `status.degraded` reports `ERR_BOOST_PARTIAL_MOUNT`\n * (the per-event code is carried by the warning and the mount list, which is\n * the reachable status channel without a new status-side mapping).\n */\nconst ERR_HOST_NO_SYSTEM_PROMPT_ASSEMBLE = 'ERR_HOST_NO_SYSTEM_PROMPT_ASSEMBLE'\n\n/**\n * Stable host code: `agent/pre-step` was never observed.\n *\n * Raised once, on the first main `llm/stream` request for a session whose step\n * clock was never driven. Without pre-step the turn is unknown, so every\n * pending substitution is abandoned; the warning says why instead of leaving\n * `status` healthy. Auxiliary (`purpose`-tagged) streams do not need the clock\n * and do not raise it. As with assemble, the event name joins `missingMounts`\n * and the per-event code is carried by the one-shot warning.\n */\nconst ERR_HOST_NO_AGENT_PRE_STEP = 'ERR_HOST_NO_AGENT_PRE_STEP'\n\n/**\n * Stable host code: the selector route had to come from `agent/request`.\n *\n * `agent/pre-step` carries `modelSelection` and is the non-deprecated source.\n * When a host leaves it empty, the deprecated `agent/request` resolved config\n * is the only route left; the selector can still run, but the dependency is\n * reported once because that event is marked `@deprecated`. Absence of\n * `agent/request` itself is non-fatal and is reported separately by\n * `ERR_HOST_NO_AGENT_REQUEST`.\n */\nconst ERR_HOST_NO_MODEL_SELECTION = 'ERR_HOST_NO_MODEL_SELECTION'\n\n/** The app-boot package whose version IS the dsh runtime version. */\nconst HOST_VERSION_PACKAGE = '@deepseek-ai/dsh-app-boot'\n\n/** The host's package resolver (`pluginPackages` in a profile process). */\ntype PackageResolver = {\n packageOf?(specifier: string, parentURL: string): { version?: unknown } | undefined\n}\n\n/** Node's resolver, used only when the host service is unavailable. */\nconst requireFromHere = createRequire(import.meta.url)\n\n/**\n * The resolved dsh host version, or `undefined` when it cannot be determined.\n *\n * `dsh-app-boot`'s own manifest is the runtime version the compatibility\n * preflight compares `engines.dsh` against, so it is the authority here too.\n * The profile's `pluginPackages` service is preferred because it resolves\n * through the same runtime interception the host used (a linked or mixed tree\n * reports the version actually loaded); a plain Node resolve from this module\n * is the fallback for an embedded composition without that service. Reading a\n * manifest is not a host import: the package is never loaded, and nothing in\n * `dist/` statically imports it.\n *\n * Never throws: an absent service, an unresolvable package and a malformed\n * manifest all mean \"unknown\", which is logged but not warned about.\n */\nfunction hostVersionOf(ctx: PluginContext): string | undefined {\n try {\n const packages = serviceOf<PackageResolver>(ctx, 'pluginPackages')\n const pkg = packages?.packageOf?.(HOST_VERSION_PACKAGE, import.meta.url)\n if (typeof pkg?.version === 'string' && pkg.version !== '') return pkg.version\n } catch {\n // A foreign resolver is the same as no resolver.\n }\n try {\n const manifest = requireFromHere.resolve(`${HOST_VERSION_PACKAGE}/package.json`)\n const parsed = JSON.parse(readFileSync(manifest, 'utf8')) as { version?: unknown }\n return typeof parsed.version === 'string' && parsed.version !== '' ? parsed.version : undefined\n } catch {\n return undefined\n }\n}\n\n/**\n * Log the resolved host version once, warning only outside `engines.dsh`.\n *\n * The version guard is deliberately advisory. npm does not read `engines.dsh`;\n * the host enforces it only through the managed-install compatibility preflight,\n * which does not run for every composition. A warning here is the only signal\n * an embedded or mixed tree gets, and it must never stop the plugin: a version\n * this build did not verify may still work.\n *\n * The check is against the **declared range**, not exact equality (review row\n * 51): `engines.dsh` is `>=0.2.2-rc.4 <0.2.3-0`, and the host's preflight\n * accepts rc.5 and the 0.2.2 release. Warning on those told operators to\n * distrust a host the manifest itself accepts. Inside the range but not the\n * verified build is an informational note; outside it is the warning.\n */\nfunction reportHostVersion(ctx: PluginContext): void {\n const version = hostVersionOf(ctx)\n const range = declaredHostRangeOf()\n if (version === undefined) {\n ctx.logger?.info?.(\n `dsh-boost: dsh host version unknown (verified against ${VERIFIED_HOST_VERSION}${range === undefined ? '' : `; declared range ${range}`}); compatibility cannot be checked`,\n )\n return\n }\n if (range === undefined) {\n ctx.logger?.info?.(\n `dsh-boost: dsh host ${version}; the package declares no engines.dsh range, so compatibility cannot be checked`,\n )\n return\n }\n const accepted = satisfiesRange(version, range)\n if (accepted === undefined) {\n ctx.logger?.info?.(\n `dsh-boost: dsh host ${version}; the declared range ${range} is not a semver range this guard understands, so compatibility cannot be checked`,\n )\n return\n }\n if (!accepted) {\n ctx.logger?.warn?.(\n `dsh-boost: ${ERR_HOST_VERSION_MISMATCH}: this build is verified against dsh ${VERIFIED_HOST_VERSION} (declared range ${range}), but the host reports ${version}, which is outside it; continuing, but a renamed host API may make the plugin inert`,\n )\n return\n }\n if (isVerifiedHostVersion(version)) {\n ctx.logger?.info?.(`dsh-boost: dsh host ${version} (verified)`)\n return\n }\n // Inside the range the manifest accepts, so this is not a mismatch — just not\n // the exact build the plugin was exercised against.\n ctx.logger?.info?.(\n `dsh-boost: dsh host ${version} is within the declared range ${range}, but not the exact build this was verified against (${VERIFIED_HOST_VERSION}); continuing`,\n )\n}\n\n/**\n * Duplicate applies observed in this process.\n *\n * The host exposes no stable duplicate-mount code for a prompt section, so the\n * only evidence is the plain Error's message. A throw counts as \"this plugin is\n * already wired\" only when that message names OUR section and says it is\n * already registered; every other failure is a wiring error with its own code\n * (see `isDuplicateSectionError`). The counter makes repeated applies visible\n * in the log without changing the mounts.\n */\nlet duplicateMountAttempts = 0\n\n/**\n * Whether a section-registration throw is the host's genuine duplicate error.\n *\n * `dsh-system-prompt` builds a plain `Error` whose message starts with\n * `prompt section \"<name>\" is already registered` (global and scoped variants\n * both start that way) and exposes no code. The message alone proves only that\n * *some* plugin owns the name — another plugin using `dsh-boost` produces the\n * same text — so it is combined with {@link ownSectionRegistries}, the mount\n * marker this module owns (review row 32). A duplicate from a foreign owner is\n * a section-mount failure, not \"this plugin is already wired\": the remaining\n * hooks and the control tool must still mount.\n */\nfunction isDuplicateSectionError(error: unknown): boolean {\n return (\n error instanceof Error &&\n error.message.startsWith(`prompt section \"${PROTOCOL_NAME}\" is already registered`)\n )\n}\n\n/**\n * Read a soft host service through `ctx.get`.\n *\n * `workspaceRegistry`, `spillStore` and `tokenMeter` are optional peers: a\n * static injection would make the plugin fail to load on a host that does not\n * provide them, so they are fetched, never declared in `inject`. A host whose\n * `get` throws is the same as one without the service (the plugin-load test\n * pins that the data root is never resolved this way).\n */\nfunction serviceOf<T>(ctx: PluginContext, name: string): T | undefined {\n try {\n if (typeof ctx.get !== 'function') return undefined\n return ctx.get<T>(name) ?? undefined\n } catch {\n return undefined\n }\n}\n\n/**\n * A memoising, retrying service getter with explicit invalidation.\n *\n * `ctx.get(name, strict=true)` answers `undefined` until the provider fiber is\n * ACTIVE, and cordis starts sibling plugin entries concurrently, so a service\n * read once in `apply` may simply not exist yet. A success is memoised; an\n * absence is never cached, because the provider may become active one tick\n * later. Every call site reads the getter, so the plugin recovers on the next\n * request instead of staying inert for the process lifetime.\n *\n * A first success is not a permanent binding (review row 6). `reset()` drops\n * the memo, and `refresh()` re-reads `ctx.get` and replaces the memo with the\n * current binding. Callers use `reset()` after a point-of-use failure (a\n * spill store whose `saveText` rejects, a registry whose `list()` throws, an\n * LLM whose stream fails); `refresh()` is the pre-write re-confirmation the\n * spill path needs, because a provider can be replaced between the decision\n * that resolved it and the write that uses it. `apply` also drops all three\n * memos when the owning cordis fiber unloads.\n */\ntype LazyService<T> = (() => T | undefined) & {\n reset(): void\n /** Re-read `ctx.get` and replace the memo with the current binding. */\n refresh(): T | undefined\n}\n\nfunction lazyService<T>(ctx: PluginContext, name: string): LazyService<T> {\n let resolved: T | undefined\n const get = (() => {\n if (resolved !== undefined) return resolved\n resolved = serviceOf<T>(ctx, name)\n return resolved\n }) as LazyService<T>\n get.reset = () => {\n resolved = undefined\n }\n get.refresh = () => {\n resolved = serviceOf<T>(ctx, name)\n return resolved\n }\n return get\n}\n\n/**\n * The cordis disposal seam (`ctx.effect`), optional for structural fake hosts.\n *\n * Cordis has no `dispose` event; a plugin owns its fiber and `ctx.effect`\n * registers a disposer that runs when that fiber unloads (`fiber.ts`: effects\n * are collected and run in reverse order on unload). The real context exposes\n * it on the proxy, but `PluginContext` stays the narrower structural host this\n * package can type without a cordis dependency, so the read is optional.\n */\ntype EffectContext = {\n effect?: (execute: () => () => void, label?: string) => unknown\n}\n\n/**\n * Run `invalidate` when the owning fiber unloads.\n *\n * Used for the three soft-service memos: a disposed provider must not leave a\n * stale binding behind for a later provider that reuses the same name (review\n * row 6). A host without the effect seam is not a failure: the point-of-use\n * resets still recover, only the disposal edge is missed.\n */\nfunction onDispose(ctx: PluginContext, invalidate: () => void): void {\n try {\n const effect = (ctx as PluginContext & EffectContext).effect\n if (typeof effect !== 'function') return\n effect.call(ctx, () => invalidate, 'dsh-boost: soft service bindings')\n } catch {\n // A host that rejects the effect still gets the per-use resets.\n }\n}\n\n/**\n * The session id behind an agent or a `Session`.\n *\n * An agent exposes `session.header.id`; the `session/disposed` payload is the\n * `Session` itself and exposes `header.id` (and `id`). Anything else is\n * `undefined`, which makes every caller fail closed.\n */\nfunction sessionIdOf(value: unknown): string | undefined {\n const carrier = value as\n | {\n session?: { header?: { id?: unknown } }\n header?: { id?: unknown }\n id?: unknown\n }\n | undefined\n const agentId = carrier?.session?.header?.id\n if (typeof agentId === 'string') return agentId\n const headerId = carrier?.header?.id\n if (typeof headerId === 'string') return headerId\n return typeof carrier?.id === 'string' ? carrier.id : undefined\n}\n\n/**\n * The host token meter's synchronous message estimator, resolved lazily.\n *\n * `ctx.tokenMeter` is a cordis service with a synchronous `estimateMessage`\n * method, so `ctx.get('tokenMeter')` is a real synchronous seam. Like every\n * soft service it may become active after this plugin's `apply`, so the\n * estimator is probed on first use and re-probed while absent; a success is\n * memoised. Presence is not capability: a service that throws or returns a\n * non-finite number is a broken meter, not a meter, and substitution is\n * refused exactly as when no service exists (review R5). A broken meter is not\n * memoised either, so a provider that finishes wiring its meter later can\n * still recover.\n *\n * The receipt label is `host` so the number is never mistaken for a provider\n * measurement; the only other label would be a fabricated `chars/4` fallback,\n * which this assembly deliberately does not implement.\n *\n * Memoisation covers the *binding*, not the answer. `kind()` probes the\n * memoised estimator on every call, because a meter that answered once is not\n * a meter forever: after it starts returning `NaN`, projection receipts already\n * record `estimate:'unknown'` for that assembly, and a cached `host` label\n * would contradict them in the same `boost status` output.\n */\nconst METER_PROBE = 'dsh-boost meter probe'\n\nfunction meterSeamOf(ctx: PluginContext): {\n estimate(): ((text: string) => number) | undefined\n kind(): 'host' | 'unknown'\n} {\n let estimator: ((text: string) => number) | undefined\n /** One probe through a raw host estimator; a throw or non-number is failure. */\n const probe = (estimate: (message: unknown) => number): boolean => {\n try {\n const value = estimate({\n role: 'user',\n content: [{ type: 'text', text: METER_PROBE }],\n })\n return typeof value === 'number' && Number.isFinite(value)\n } catch {\n return false\n }\n }\n const resolve = (): ((text: string) => number) | undefined => {\n if (estimator !== undefined) return estimator\n const meter = serviceOf<{ estimateMessage?: (message: unknown) => number }>(ctx, 'tokenMeter')\n if (meter === undefined || typeof meter.estimateMessage !== 'function') return undefined\n const estimate = meter.estimateMessage.bind(meter)\n if (!probe(estimate)) return undefined\n estimator = (text: string): number => {\n try {\n const value = estimate({ role: 'user', content: [{ type: 'text', text }] })\n return typeof value === 'number' && Number.isFinite(value) ? value : Number.NaN\n } catch {\n return Number.NaN\n }\n }\n return estimator\n }\n return {\n estimate: resolve,\n kind: () => {\n const estimate = resolve()\n if (estimate === undefined) return 'unknown'\n // Probe through the memoised wrapper, so the label prices the same\n // pipeline every receipt uses. `resolve()` alone cannot answer: it\n // returns a cached binding even after the meter stopped answering.\n return Number.isFinite(estimate(METER_PROBE)) ? 'host' : 'unknown'\n },\n }\n}\n\n/** How many disposed session ids the runtime facade remembers (FIFO). */\nconst MAX_DISPOSED_RUNTIME_SESSIONS = 256\n\n/**\n * `SessionRuntime` that refuses to recreate state for a disposed session.\n *\n * `clearSession` drops a session's runtime entry, but a `post-execute` that was\n * already in flight (a selector call can take 20 s) lands after disposal and\n * calls `clockFor`/`budgetFor`/`usageFor` again; the base class would create a\n * fresh entry nothing ever clears. The facade returns throwaway primitives for\n * disposed ids instead: the late hook records nothing, and the map cannot grow\n * after session end. The id set is FIFO-bounded so a long process cannot grow\n * it without limit.\n */\nclass DisposalAwareSessionRuntime extends SessionRuntime {\n private readonly disposed = new Set<string>()\n private readonly disposedOrder: string[] = []\n\n /** Mark a session disposed and drop whatever the base class still holds. */\n markDisposed(sessionId: string): void {\n this.clear(sessionId)\n if (this.disposed.has(sessionId)) return\n this.disposed.add(sessionId)\n this.disposedOrder.push(sessionId)\n while (this.disposedOrder.length > MAX_DISPOSED_RUNTIME_SESSIONS) {\n const oldest = this.disposedOrder.shift()\n if (oldest !== undefined) this.disposed.delete(oldest)\n }\n }\n\n override clockFor(sessionId: string): TurnClock {\n return this.disposed.has(sessionId) ? new TurnClock() : super.clockFor(sessionId)\n }\n\n override budgetFor(sessionId: string): StepBudget {\n return this.disposed.has(sessionId) ? new StepBudget(0) : super.budgetFor(sessionId)\n }\n\n override usageFor(sessionId: string): UsageLedger {\n return this.disposed.has(sessionId) ? new UsageLedger() : super.usageFor(sessionId)\n }\n\n override onModelRequest(sessionId: string, turn: number, step?: number): void {\n if (!this.disposed.has(sessionId)) super.onModelRequest(sessionId, turn, step)\n }\n}\n\n/** The `agent/request` payload fields this assembly reads. */\ntype RequestPayload = {\n agent?: unknown\n turn?: unknown\n step?: unknown\n /** Captured step route on `agent/pre-step` (also the selector's inheritance source). */\n modelSelection?: unknown\n}\n\n/**\n * Warm the synchronous visibility cache and remember the canonical workspace.\n *\n * `resolveWorkspace` is the async answer and also writes `scope.judgement(key)`;\n * it prefers the registry's `resolveByPath`, so a symlinked or trailing-slash\n * cwd resolves to the same id the judgement used. The workspace id is kept even\n * when the answer is \"invisible\", so the resolver must consult the live\n * judgement rather than treating the map as the answer. A workspace disabled\n * after a commit therefore stops resolving before the next synthesized turn.\n */\nasync function warmVisibility(\n scope: ScopeStore,\n registry: () => WorkspaceRegistry | undefined,\n agent: unknown,\n sessionId: string,\n workspaces: Map<string, string>,\n): Promise<boolean> {\n try {\n const result = await resolveWorkspace(scope, agent, registry())\n // The map carries identity, `scope.judgement` carries visibility: cache the\n // id even when the answer is \"invisible\", and let the resolver combine the\n // two. A stale id therefore cannot outlive a visibility change.\n if (typeof result.workspaceId === 'string') workspaces.set(sessionId, result.workspaceId)\n else workspaces.delete(sessionId)\n return result.visible\n } catch {\n // `resolveWorkspace` is total; this contains a foreign registry.\n return false\n }\n}\n\n/** Remember the effective route the selector call must inherit. */\nfunction rememberRoute(\n routes: Map<string, SelectorRoute>,\n sessionId: string,\n config: unknown,\n): void {\n const resolved = config as\n | { provider?: unknown; model?: unknown; reasoningEffort?: unknown }\n | undefined\n if (resolved == null) return\n if (typeof resolved.provider !== 'string' || typeof resolved.model !== 'string') return\n const route: SelectorRoute = { provider: resolved.provider, model: resolved.model }\n if (typeof resolved.reasoningEffort === 'string') route.reasoningEffort = resolved.reasoningEffort\n routes.set(sessionId, route)\n}\n\n/**\n * Replace the protocol section's already-resolved text with the fresh answer.\n *\n * This runs *after* the assemble waterfall, so it rewrites text a section\n * provider already produced. That is deliberate and does not contradict D4\n * (\"persistent, stable content\"): every agent has its own prompt prefix and\n * its own context window, so changing this section cannot invalidate another\n * agent's cached prefix. Within one agent the answer changes only when its\n * resolved visibility changes (a workspace edit/`scope-set`), which is exactly\n * the point at which the prefix must change; every other assembly reproduces\n * the same bytes. The alternative — a section whose text is fixed at\n * registration — would either leak one agent's visibility to every other or\n * require a second provider to read a cache this listener has not warmed yet.\n */\nfunction patchProtocolSection(assembly: unknown, visible: boolean): unknown {\n const value = assembly as { sections?: unknown } | undefined\n if (value === undefined || value === null || !Array.isArray(value.sections)) return assembly\n const sections = value.sections.map((section) => {\n const entry = section as { name?: unknown } | null\n return entry?.name === PROTOCOL_NAME\n ? { ...(entry as Record<string, unknown>), text: visible ? PROTOCOL_TEXT : '' }\n : section\n })\n return { ...(value as Record<string, unknown>), sections }\n}\n\n/** The marker every protocol text carries; a system prompt without it lost the section. */\nconst PROTOCOL_PROBE = '<CHISEL_PLAN>'\n\n/**\n * The system-role text of one model request, or `undefined` when the request\n * carries no system prompt at all.\n *\n * Loop-built requests put the rendered prompt in the leading system-role\n * message (``GenerateOptions.messages``); one-shot callers use `system`. A\n * request with neither is a diagnostic that cannot tell us whether the section\n * landed, so it is not evidence of a complete-section swallow.\n */\nfunction systemTextOf(options: unknown): string | undefined {\n const source = options as { messages?: unknown; system?: unknown } | null | undefined\n if (typeof source?.system === 'string' && source.system.length > 0) return source.system\n const messages = source?.messages\n if (!Array.isArray(messages)) return undefined\n let seen = false\n let text = ''\n for (const message of messages) {\n const entry = message as { role?: unknown; content?: unknown } | null\n if (entry?.role !== 'system') continue\n seen = true\n if (typeof entry.content === 'string') {\n text += entry.content\n continue\n }\n if (!Array.isArray(entry.content)) continue\n for (const block of entry.content) {\n const part = block as { type?: unknown; text?: unknown } | null\n if (part?.type === 'text' && typeof part.text === 'string') text += part.text\n }\n }\n return seen ? text : undefined\n}\n\n/**\n * Mount the host events the assembly owns.\n *\n * ## Why `system-prompt/assemble` owns the warm\n *\n * The host's preStep is `tools.resolve` -> `systemPrompt.assemble` ->\n * `agent/pre-step`; section text resolves inside `assemble`, and\n * `agent/request` fires only later in `step()`. A warm driven from\n * `agent/request` therefore misses request 1 (the gate can never act on step\n * 1) and then flips the system prompt on request 2, invalidating the whole\n * cached prefix (design D4). This listener runs inside the awaited assemble\n * waterfall, after sections resolve, with `context.scope` being the agent: it\n * warms the judgement and then rewrites our section's text from that fresh\n * answer. Request 1 is correct and request 2 reproduces the same bytes.\n *\n * The tool-level `when` was the alternative early seam; it is worse here\n * because it never runs when `tools.resolve` is unavailable or the boost tool\n * is filtered out, and it cannot await `resolveByPath` without making a\n * synchronous visibility predicate asynchronous. The assemble listener also\n * costs nothing on tool-listing paths.\n *\n * `agent/pre-step` is the non-deprecated clock seam (`agent/request` is\n * marked `@deprecated`); it fires once per proposed step with the host\n * `turn`/`step`, and it already carries the captured `modelSelection`. The\n * selector route is read from there first; `agent/request`'s resolved config\n * is only the compatibility path for a host whose pre-step does not populate\n * `modelSelection`, and it warns once when it is used. The visibility warm\n * stays at `assemble` (D4); `agent/pre-step` warms only when `assemble` never\n * fired, so no session's visibility depends on the deprecated event. A model\n * request that reaches `llm/stream` without any observed `agent/request` is\n * still reported once with `ERR_HOST_NO_AGENT_REQUEST`; the route itself does\n * not depend on it.\n *\n * ## Every mount is attributed\n *\n * `ctx.on` accepts any string (`cordis/src/events.ts`), so a renamed host\n * event registers successfully and then never fires. Registration failures and\n * \"never observed\" are therefore different signals, and both must reach the\n * operator:\n *\n * - Each listener is mounted in its own try/catch. A throw names that event in\n * `missingMounts`, and the remaining listeners still mount. Before this, one\n * bare catch around the whole wiring left `status.degraded` empty and lost\n * `session/disposed` (per-session state leaked for the process lifetime).\n * - `ERR_HOST_NO_SYSTEM_PROMPT_ASSEMBLE` is raised once when the first\n * `agent/pre-step` arrives without a single observed assemble. The host\n * order guarantees assemble first, so its absence is a renamed/removed\n * event. Its only evidence is \"never observed\"; the event name also joins\n * `missingMounts`, so `status.degraded` reports `ERR_BOOST_PARTIAL_MOUNT`\n * (the per-event code exists in the warning and the mount list).\n * - `ERR_HOST_NO_AGENT_PRE_STEP` is raised once when the first main\n * `llm/stream` request arrives without any observed pre-step for that\n * session. The step clock cannot advance without it, so substitution is\n * impossible; auxiliary (`purpose`-tagged) streams do not need it and do not\n * raise the warning.\n *\n * `session/event` (`turn/end`), `session/flush` and `session/disposed` call\n * `ReceiptStore.flush()` so the turn-end durability the design promises is\n * real. `session/disposed` also drops every per-session map the assembly owns\n * and tells the stores to evict their state.\n */\nfunction wireSessionEvents(\n ctx: PluginContext,\n deps: HookDeps,\n scope: ScopeStore,\n registry: () => WorkspaceRegistry | undefined,\n sessions: DisposalAwareSessionRuntime,\n horizon: RuntimeStepHorizon,\n workspaces: Map<string, string>,\n routes: Map<string, SelectorRoute>,\n counters: ProjectionCounters,\n missing: Set<string>,\n ownsSection: boolean,\n): void {\n /** Session ids seen at `agent/pre-step`; a `llm/stream` without a request is drift. */\n const preStepSeen = new Set<string>()\n /** Session ids observed on `agent/request`. */\n const requestSeen = new Set<string>()\n let assembleSeen = false\n let warnedMissingRequest = false\n let warnedCompleteSection = false\n let warnedNoAssemble = false\n let warnedNoPreStep = false\n let warnedRouteFallback = false\n\n /**\n * Mount one listener in its own try/catch.\n *\n * A failure names the event and is recorded in `missingMounts`; it never\n * stops the next listener. `true` means the registration itself succeeded,\n * which is not proof the host ever emits the event (see the never-observed\n * warnings below).\n */\n const mount = (\n event: string,\n handler: (...args: any[]) => unknown,\n options?: { prepend?: boolean },\n ): boolean => {\n try {\n ctx.on(event, handler, options)\n return true\n } catch (error) {\n missing.add(event)\n ctx.logger?.warn?.(\n `dsh-boost: ERR_BOOST_PARTIAL_MOUNT: ${event} mount failed (${messageOf(error)})`,\n )\n return false\n }\n }\n\n // `system-prompt/assemble` stays first: it is the seam that resolves the\n // section text every later step sees (design D4).\n const assembleMounted = mount('system-prompt/assemble', async (_assembly: unknown, context: unknown, next: () => unknown) => {\n assembleSeen = true\n const resolved = await next()\n try {\n // `dsh-agent` augments `AssembleContext` with the real `Agent`; `scope`\n // is an opaque `ScopeKey` and is never read as an Agent (review row 11).\n // A diagnostic assembly has no agent: the documented no-scope view, so\n // the section is suppressed and counted rather than keyed on a guess.\n const carrier = (context ?? {}) as { agent?: unknown }\n const agent = carrier.agent\n const sessionId = sessionIdOf(agent)\n if (sessionId === undefined) {\n // The provider has nothing to key the judgement on and returns '';\n // clear the section explicitly so a stale provider answer cannot leak\n // into an assembly with no agent. Count the decision, not the\n // section's presence — design §5.5:378 asks for every assembly to be\n // judged.\n if (ownsSection) counters.protocolSuppressed()\n return ownsSection ? patchProtocolSection(resolved, false) : resolved\n }\n const visible = await warmVisibility(scope, registry, agent, sessionId, workspaces)\n // A foreign plugin owns the section name (row 32): warm the judgement the\n // decision path needs, but never rewrite another plugin's text.\n if (!ownsSection) return resolved\n // Same rule for an invisible workspace: the section is suppressed for\n // this assembly, so the operator gets a live signal in `boost status`.\n // A visible one never increments, so the count stays a failure count.\n if (!visible) counters.protocolSuppressed()\n return patchProtocolSection(resolved, visible)\n } catch {\n return resolved\n }\n })\n\n const preStepMounted = mount('agent/pre-step', async (payload: unknown, next: () => unknown) => {\n const request = (payload ?? {}) as RequestPayload\n const sessionId = sessionIdOf(request.agent)\n if (sessionId !== undefined) {\n preStepSeen.add(sessionId)\n // Row 8: assemble runs before pre-step in the host's own order. If it\n // has never run by the first step, the event was renamed or removed and\n // the protocol section cannot be warmed or patched.\n if (!assembleSeen && !warnedNoAssemble && assembleMounted) {\n warnedNoAssemble = true\n missing.add('system-prompt/assemble')\n ctx.logger?.warn?.(\n `${ERR_HOST_NO_SYSTEM_PROMPT_ASSEMBLE}: system-prompt/assemble was not observed before the first agent/pre-step; the protocol section cannot be warmed or patched (the event may have been renamed or removed)`,\n )\n }\n try {\n sessions.onModelRequest(\n sessionId,\n typeof request.turn === 'number' ? request.turn : Number(request.turn),\n typeof request.step === 'number' ? request.step : undefined,\n )\n } catch {\n // A clock that cannot be driven must not break the step.\n }\n try {\n horizon.observe(\n sessionId,\n typeof request.turn === 'number' ? request.turn : Number(request.turn),\n typeof request.step === 'number' ? request.step : Number(request.step),\n )\n } catch {\n // History is an estimate; a bad observation is not a step failure.\n }\n // `agent/pre-step` already carries the captured step selection. It is\n // the non-deprecated source for the selector route; `agent/request`'s\n // resolved config remains a compatibility fallback for hosts that only\n // populate it there. A later request overwrites with the same route.\n rememberRoute(routes, sessionId, request.modelSelection)\n // The warm belongs to `system-prompt/assemble` (D4). This is the\n // fallback for a host that skipped or renamed assemble: pre-step is the\n // non-deprecated seam, so visibility no longer depends on the\n // deprecated `agent/request` event.\n if (!assembleSeen) {\n await warmVisibility(scope, registry, request.agent, sessionId, workspaces)\n }\n }\n return next()\n })\n\n mount('agent/request', async (payload: unknown, next: () => unknown) => {\n const request = (payload ?? {}) as RequestPayload\n const sessionId = sessionIdOf(request.agent)\n if (sessionId !== undefined) {\n requestSeen.add(sessionId)\n // Compatibility only: when pre-step is present it already drove the\n // clock and the horizon. This branch exists for a host that still emits\n // the deprecated event but not the non-deprecated one.\n if (!preStepSeen.has(sessionId)) {\n try {\n sessions.onModelRequest(\n sessionId,\n typeof request.turn === 'number' ? request.turn : Number(request.turn),\n typeof request.step === 'number' ? request.step : undefined,\n )\n } catch {\n // A clock that cannot be driven must not break the model request.\n }\n try {\n horizon.observe(\n sessionId,\n typeof request.turn === 'number' ? request.turn : Number(request.turn),\n typeof request.step === 'number' ? request.step : Number(request.step),\n )\n } catch {\n // Same as the pre-step observation: history is an estimate.\n }\n if (!assembleSeen) {\n await warmVisibility(scope, registry, request.agent, sessionId, workspaces)\n }\n }\n }\n const config = await next()\n // Capability check (row 22): the non-deprecated pre-step carries\n // `modelSelection`; when it did, this event must not overwrite the route.\n // When it did not, the resolved config is the only source left, and the\n // deprecated path warns once.\n if (sessionId !== undefined && routes.get(sessionId) === undefined) {\n rememberRoute(routes, sessionId, config)\n if (routes.get(sessionId) !== undefined && !warnedRouteFallback) {\n warnedRouteFallback = true\n ctx.logger?.warn?.(\n `${ERR_HOST_NO_MODEL_SELECTION}: agent/pre-step carried no modelSelection; the selector route came from the deprecated agent/request event, which may be removed`,\n )\n }\n }\n return config\n })\n\n // The deprecated event's disappearance would otherwise disable the selector\n // route silently. A session that reached `llm/stream` after a pre-step but\n // never saw `agent/request` is proof enough; the model request itself is\n // passed through untouched. The route now comes from pre-step, so this is a\n // compatibility warning, not a correctness dependency.\n //\n // This listener is also the complete-section detector, and it MUST be\n // outermost: the synthesizer mounted by `registerHooks` consumes a queued\n // entry synchronously, so a detector registered after it would only mark the\n // session unsubstitutable *after* the first affected request had already been\n // substituted. Cordis runs the first-registered listener outermost\n // (`events.ts` unshifts on `prepend`), so `prepend: true` is what puts the\n // detector before the synthesizer regardless of mount order (finding 4).\n mount(\n 'llm/stream',\n (options: unknown, next: () => unknown) => {\n try {\n const request = (options ?? {}) as { sessionId?: unknown; purpose?: unknown }\n const sessionId = request.sessionId\n // Row 8: a main request needs the step clock, which only pre-step\n // drives. An auxiliary (`purpose`) stream carries its own prompt and\n // never needs it, so it is not evidence the seam is missing.\n if (\n !warnedNoPreStep &&\n preStepMounted &&\n request.purpose === undefined &&\n typeof sessionId === 'string' &&\n !preStepSeen.has(sessionId)\n ) {\n warnedNoPreStep = true\n missing.add('agent/pre-step')\n ctx.logger?.warn?.(\n `${ERR_HOST_NO_AGENT_PRE_STEP}: agent/pre-step was not observed before the first main llm/stream request; the step clock cannot advance (the event may have been renamed or removed)`,\n )\n }\n if (\n !warnedMissingRequest &&\n typeof sessionId === 'string' &&\n preStepSeen.has(sessionId) &&\n !requestSeen.has(sessionId)\n ) {\n warnedMissingRequest = true\n ctx.logger?.warn?.(\n 'ERR_HOST_NO_AGENT_REQUEST: agent/request was not observed before llm/stream; the deprecated event may have been removed (the selector route is captured from agent/pre-step modelSelection)',\n )\n }\n\n // A `complete: true` prompt section replaces every other section after\n // the assembly waterfall, so the protocol text\n // `system-prompt/assemble` patched in is gone from the request the\n // model actually receives. The host exposes no code or flag for that\n // restoration; the outgoing system prompt is the first place it is\n // observable. Detect it, count it, and fail closed: without the\n // protocol there is nothing to teach the plan grammar, so substitution\n // (and the projection that shares the same visibility gate) must not\n // act for this request (review row 12).\n //\n // Only a main-agent request is evidence. Every auxiliary stream — the\n // selector, compaction, and the default-on session-title provider —\n // sets `purpose` and carries its own summariser prompt, which never\n // contains the protocol section. Treating one as a swallow would count\n // a suppression that never happened, flip the session's cached\n // visibility off, and leave `ERR_HOST_COMPLETE_SECTION` in `status`\n // for the rest of the process (review row 1). This is the same rule the\n // synthesizer applies (`llm-stream.ts`: any `purpose` is auxiliary).\n if (\n request.purpose === undefined &&\n typeof sessionId === 'string' &&\n scope.judgement(sessionId)\n ) {\n const systemText = systemTextOf(options)\n if (systemText !== undefined && !systemText.includes(PROTOCOL_PROBE)) {\n counters.protocolSuppressed()\n counters.protocolMissing()\n scope.remember(sessionId, false)\n if (!warnedCompleteSection) {\n warnedCompleteSection = true\n ctx.logger?.warn?.(\n 'ERR_HOST_COMPLETE_SECTION: the final system prompt does not carry the dsh-boost protocol section (a complete prompt section replaced the assembly); substitution is disabled for affected requests',\n )\n }\n }\n }\n } catch {\n // Detection must never break the model request.\n }\n return next()\n },\n { prepend: true },\n )\n\n // `session/event` carries a plain `type` string, so `turn/end` is matched by\n // value, not by a stable code. That match is a convenience: it flushes early\n // on the common path, but it is not the durability boundary. The host does\n // not await this listener, so a process exit immediately after `turn/end`\n // can drop the flush; the awaited `session/flush` below is what the\n // persistence contract rests on, and `session/disposed` flushes again after\n // the last hook for the id. Receipts are evidence, so an early flush that\n // does not happen costs latency, never correctness.\n mount('session/event', (_session: unknown, event: unknown) => {\n const type = (event as { type?: unknown } | undefined)?.type\n if (type === 'turn/end') {\n // Fire-and-forget on the real host; `flush()` never rejects.\n return deps.receipts.flush()\n }\n return undefined\n })\n\n mount('session/flush', () => deps.receipts.flush())\n\n mount('session/disposed', async (session: unknown) => {\n const sessionId = sessionIdOf(session)\n if (sessionId === undefined) return\n try {\n clearSession(deps, sessionId)\n } catch {\n // Session end owns no tool result; a failed clear must not throw here.\n }\n sessions.markDisposed(sessionId)\n workspaces.delete(sessionId)\n routes.delete(sessionId)\n requestSeen.delete(sessionId)\n preStepSeen.delete(sessionId)\n horizon.clear(sessionId)\n scope.forget(sessionId)\n // Flush this session's buffered lines before evicting its state, then make\n // every later hook for the id a no-op.\n try {\n await deps.receipts.flush()\n } catch {\n // Flush is total; a foreign store must not break session end.\n }\n deps.receipts.disposeSession(sessionId)\n })\n\n if (missing.size > 0) {\n ctx.logger?.warn?.(\n `dsh-boost: ERR_BOOST_PARTIAL_MOUNT: missing mount(s): ${[...missing].join(', ')}; the plugin is partially wired and boost status reports this code`,\n )\n }\n}\n\n/**\n * Register the `boost` tool family.\n *\n * After T19 the family is just this one tool. The tool itself is scope-exempt\n * (`when: () => true`) because it is the only way a user can enable a workspace\n * that is not enabled yet — gating it on the scope document would make\n * `selected + []` impossible to leave. The protocol section is not exempt; T17\n * already handles it.\n *\n * No step-`when` capability probe is needed: the condition is constant-true, so\n * a host that ignored the registration options would register it\n * unconditionally — exactly the behaviour this build wants. The old probe only\n * tested `typeof tools.register === 'function'`, which every host since\n * 0.2.2-rc.1 satisfies, so the branch it fed could never run; it was removed\n * rather than left as a claim that can never be false.\n */\nfunction registerBoostTool(ctx: PluginContext, deps: BoostDeps): void {\n // Annotating with the host's ToolDefinition makes a host-side tightening a\n // build error instead of a runtime registration failure. The tool is\n // scope-exempt by design (`when: () => true`), so it needs no registry: the\n // registry is only the visibility warm's input, wired above.\n const definition: ToolDefinition = boostTool(deps)\n\n ctx.tools.register(definition, { when: () => true })\n}\n\n/**\n * Section registries this module successfully registered into.\n *\n * The mount marker this module owns (review row 32). The host's duplicate\n * message is generic: another plugin registering `dsh-boost` produces exactly\n * the same text. A duplicate therefore counts as \"this plugin is already\n * wired\" only when the same prompt registry object received this module's\n * section earlier in the process. A foreign owner is a section-mount failure:\n * the remaining hooks and the control tool still mount, and the foreign text\n * is never rewritten.\n */\nconst ownSectionRegistries = new WeakSet<object>()\n\n/**\n * Prompt registries this module already mounted its hooks and tool against.\n *\n * Separate from {@link ownSectionRegistries}: a foreign section owner means\n * this module does not own the section text, but a second apply over the same\n * registry must still not mount the hooks twice. Marked once a non-duplicate\n * apply has finished mounting, and consulted only for the duplicate decision.\n */\nconst mountedRegistries = new WeakSet<object>()\n\n/** What {@link mountHooks} established about the section and the other mounts. */\ntype MountOutcome = {\n /** A previous apply of this plugin owns the mounts; register nothing else. */\n alreadyMounted: boolean\n /** This apply registered the prompt section (so its text may be patched). */\n ownsSection: boolean\n}\n\n/** The mount label the prompt section reports when it cannot be registered. */\nconst MOUNT_SECTION = 'systemPrompt.section'\n\n/** One event listener recorded by {@link mountHooks} before it is mounted. */\ntype DeferredMount = {\n event: Parameters<PluginContext['on']>[0]\n handler: Parameters<PluginContext['on']>[1]\n options?: Parameters<PluginContext['on']>[2]\n}\n\n/**\n * Mount the four integration points, attributing each failure.\n *\n * `registerHooks` mounts the prompt section first and aborts on its failure, so\n * handing it the real context would lose the three event mounts whenever the\n * section is rejected — while `apply` logged \"continuing with the remaining\n * mounts\" and `status` still reported `degraded: []` (review row 2). It is\n * called with a recording context instead: the section is registered\n * immediately (its duplicate check must happen before anything else is\n * mounted), a rejection is recorded rather than rethrown so `registerHooks`\n * still describes the three event mounts, and those are then mounted one by one\n * so a failure names the mount that failed and lands in `missing`.\n *\n * Returns `alreadyMounted` only when the section error is the host's\n * duplicate-registration error AND this module registered that same registry\n * earlier (the mount marker): a previous apply owns every mount and this one\n * must register nothing. A duplicate from another plugin is a section-mount\n * failure, so the remaining mounts still happen (review row 32).\n */\nfunction mountHooks(ctx: PluginContext, deps: HookDeps, missing: Set<string>): MountOutcome {\n const deferred: DeferredMount[] = []\n let sectionError: unknown\n let registrationError: unknown\n\n const recording = {\n logger: ctx.logger,\n on(\n event: Parameters<PluginContext['on']>[0],\n handler: Parameters<PluginContext['on']>[1],\n options?: Parameters<PluginContext['on']>[2],\n ): void {\n deferred.push({ event, handler, options })\n },\n systemPrompt: {\n section(section: Parameters<PluginContext['systemPrompt']['section']>[0]): void {\n try {\n ctx.systemPrompt.section(section)\n } catch (error) {\n // Record, do not rethrow: `registerHooks` aborts on a throwing\n // section, and the other three mounts must still be described.\n sectionError = error\n }\n },\n },\n } as unknown as PluginContext\n\n try {\n registerHooks(recording, deps)\n } catch (error) {\n registrationError = error\n }\n\n let ownsSection = false\n const registry = ctx.systemPrompt as object | undefined\n if (sectionError !== undefined && isDuplicateSectionError(sectionError)) {\n if (registry !== undefined && mountedRegistries.has(registry)) {\n duplicateMountAttempts += 1\n ctx.logger?.warn?.(\n `dsh-boost: ERR_BOOST_ALREADY_MOUNTED: duplicate apply #${duplicateMountAttempts} found an existing mount; registration skipped (${messageOf(sectionError)})`,\n )\n return {\n alreadyMounted: true,\n ownsSection: registry !== undefined && ownSectionRegistries.has(registry),\n }\n }\n // The name is taken, but not by this module: the message alone cannot tell\n // our previous apply from another plugin using the same section name.\n missing.add(MOUNT_SECTION)\n ctx.logger?.warn?.(\n `dsh-boost: ERR_BOOST_SECTION_REGISTER_FAILED: prompt section \"${PROTOCOL_NAME}\" is registered by another plugin; mounting the remaining hooks independently (${messageOf(sectionError)})`,\n )\n } else if (sectionError !== undefined) {\n missing.add(MOUNT_SECTION)\n ctx.logger?.warn?.(\n `dsh-boost: ERR_BOOST_SECTION_REGISTER_FAILED: prompt section registration failed; mounting the remaining hooks independently (${messageOf(sectionError)})`,\n )\n } else {\n ownsSection = true\n // Record the marker only after the host accepted the section: this is the\n // one registry object a later duplicate may be attributed to.\n if (ctx.systemPrompt !== undefined && typeof ctx.systemPrompt === 'object') {\n ownSectionRegistries.add(ctx.systemPrompt)\n }\n if (registrationError !== undefined) {\n // The section did not throw, so this is an assembly bug: an unknown mount\n // is missing even though no specific one can be named.\n missing.add('hooks')\n ctx.logger?.warn?.(\n `dsh-boost: ERR_BOOST_PARTIAL_MOUNT: hook assembly failed (${messageOf(registrationError)})`,\n )\n }\n }\n\n for (const mount of deferred) {\n try {\n ctx.on(mount.event, mount.handler, mount.options)\n } catch (error) {\n missing.add(mount.event)\n ctx.logger?.warn?.(\n `dsh-boost: ERR_BOOST_PARTIAL_MOUNT: ${mount.event} mount failed (${messageOf(error)})`,\n )\n }\n }\n\n if (missing.size > 0) {\n ctx.logger?.warn?.(\n `dsh-boost: ERR_BOOST_PARTIAL_MOUNT: missing mount(s): ${[...missing].join(', ')}; the plugin is partially wired and boost status reports this code`,\n )\n }\n // A later apply over this registry is a duplicate even when the section name\n // belonged to another plugin: the hooks and the tool are ours either way.\n if (registry !== undefined) mountedRegistries.add(registry)\n return { alreadyMounted: false, ownsSection }\n}\n\nexport function apply(ctx: PluginContext, config: unknown): void {\n const repairs: string[] = []\n const cfg = resolveConfig(config, message => {\n repairs.push(message)\n ctx.logger?.warn?.(message)\n })\n // The effective-config line serialises `resolveConfig`'s output, which never\n // carries `dshHome` (that override is resolved by `resolveBoostRoot`). Log\n // the resolved root with it, once, so the operator can see the state root in\n // use — including the `$DSH_HOME`/`~/.dsh` fallback and the cwd resolution of\n // a relative override.\n let root: string\n try {\n root = resolveBoostRoot(config)\n } catch (error) {\n ctx.logger?.warn?.(`dsh-boost: cannot resolve the state root: ${messageOf(error)}`)\n return\n }\n // One line with the effective values (not only the keys this module happens\n // to use): an operator can see every clamp and fallback instead of guessing.\n ctx.logger?.info?.(\n `dsh-boost loaded (stepsPerTurn=${cfg.stepsPerTurn}, horizonSteps=${cfg.horizonSteps}); effective config=${JSON.stringify(cfg)}; root=${root}`,\n )\n if (repairs.length > 0) {\n ctx.logger?.info?.(`dsh-boost: ${repairs.length} configuration value(s) repaired`)\n }\n // The only version guard outside the managed-install preflight. Advisory:\n // an unverified host is a warning, never a refusal to load.\n reportHostVersion(ctx)\n\n if (!canRegister(ctx)) {\n ctx.logger?.warn?.('dsh-boost: host hook services unavailable; registration skipped')\n return\n }\n\n try {\n // The root was resolved above (D4) so the log can show it; both stores use\n // the same value. `resolveBoostRoot` is the only root rule (design §10), so\n // `apply` and the hook stores cannot diverge.\n const scope = new ScopeStore(root, { warn: (message: string) => ctx.logger?.warn?.(message) })\n const receipts = new ReceiptStore(root)\n const anchors = new AnchorStore()\n const queue = new PendingQueue()\n const plans = new Map<string, Plan>()\n const sessions = new DisposalAwareSessionRuntime(cfg.stepsPerTurn)\n const horizon = new RuntimeStepHorizon(cfg.horizonSteps, cfg.historyTurns)\n const retrievals = new RetrievalLedger()\n /** Session id → workspace id, populated by the visibility warm. */\n const workspaces = new Map<string, string>()\n /** Session id → the route the selector call inherits. */\n const routes = new Map<string, SelectorRoute>()\n\n // Soft host services. Cordis activates sibling providers concurrently, so\n // these getters retry until the provider fiber is ACTIVE; an absence is\n // never memoised. The workspace registry is the `resolveByPath`/`list()`\n // seam; the spill store is the projection backend; the token meter prices\n // projections and admission. A first success is not a permanent binding:\n // each point of use resets the memo on failure, and the plugin's fiber\n // disposal drops all three (review row 6).\n const registry = lazyService<WorkspaceRegistry>(ctx, 'workspaceRegistry')\n const spillService = lazyService<SpillBackend>(ctx, 'spillStore')\n // `llm` is soft (see `inject`): projection and admission never need it, and\n // the selector checks it at call time. A getter keeps a provider that\n // becomes active after `apply` reachable on the next decision.\n const llm = lazyService<LlmLike>(ctx, 'llm')\n\n /**\n * The workspace registry the visibility warm uses, with a failure re-probe.\n *\n * `list()` and `resolveByPath()` are total in the resolver (they swallow\n * their own throws), so this wrapper is the only place a replaced or\n * disposed provider is observable. A throw drops the memo; the next warm\n * asks `ctx.get` again and picks up the live binding.\n */\n const registryBackend = (): WorkspaceRegistry | undefined => {\n const backend = registry()\n if (backend === undefined) return undefined\n const resolveByPath = backend.resolveByPath\n const wrapper: WorkspaceRegistry = {\n list: () => {\n try {\n return backend.list()\n } catch (error) {\n registry.reset()\n throw error\n }\n },\n }\n if (typeof resolveByPath === 'function') {\n wrapper.resolveByPath = async (path) => {\n try {\n return await resolveByPath.call(backend, path)\n } catch (error) {\n registry.reset()\n throw error\n }\n }\n }\n return wrapper\n }\n\n /**\n * The spill backend the decision path uses, with a pre-write re-confirmation.\n *\n * A store that resolved is not a store that still exists: the provider may\n * be replaced or disposed between the decision that resolved it and the\n * write. Every write re-reads `ctx.get` through `refresh()` and uses the\n * current binding. A rejection drops the memo too, so a dead backend cannot\n * keep every later projection pointed at it while `hasSpill` stays true\n * (review rows 6 and 31).\n */\n const spillBackend = (): SpillBackend | undefined => {\n if (spillService() === undefined) return undefined\n return {\n saveText: async (input) => {\n const current = spillService.refresh()\n if (current === undefined) {\n // The store disappeared mid-turn: the projection path records this\n // as `projection-skipped:spill-failed`, not as a crash.\n throw new Error('spillStore disappeared before the write')\n }\n try {\n return await current.saveText(input)\n } catch (error) {\n spillService.reset()\n throw error\n }\n },\n }\n }\n\n /**\n * The LLM seam the selector uses, with a failure re-probe.\n *\n * The selector turns any failure into an abstention, so a provider that is\n * replaced after one successful call would otherwise be used for the rest\n * of the process. A synchronous throw or a throw while the stream is\n * consumed drops the memo; the next selection asks `ctx.get` again.\n */\n const llmBackend = (): LlmLike | undefined => {\n const backend = llm()\n if (backend === undefined) return undefined\n return {\n stream: (options) => {\n try {\n const stream = backend.stream(options)\n return (async function* () {\n try {\n yield* stream\n } catch (error) {\n llm.reset()\n throw error\n }\n })()\n } catch (error) {\n llm.reset()\n throw error\n }\n },\n }\n }\n\n // A disposed provider must not leave a stale binding behind for a later\n // provider that reuses the name. Cordis has no `dispose` event; the effect\n // seam is the fiber-unload hook (see `onDispose`).\n onDispose(ctx, () => {\n registry.reset()\n spillService.reset()\n llm.reset()\n })\n\n const meter = meterSeamOf(ctx)\n const projectionCounters = new ProjectionCounters()\n\n // Host capabilities `status` renders as stable codes. Getters keep them\n // facts about the host *now*: a service that appears after `apply` must not\n // leave a permanent `ERR_HOST_NO_*`. The fixed-cost probe starts here\n // (startup time) and is awaited only by `status` — it is deliberately not\n // on any request path.\n const hostFacts: BoostHostFacts = {\n get hasTokenMeter() {\n return meter.kind() === 'host'\n },\n get hasSpill() {\n // `refresh`, not the memo: a status call reports the host *now*, so a\n // provider that was replaced or disposed since the last write must not\n // keep `hasSpill` true (review rows 6 and 50).\n return spillService.refresh() !== undefined\n },\n get spillUsable() {\n // Presence is not capability: `{}` resolves, so `hasSpill` alone would\n // report a healthy projection path until the first `saveText` fails\n // (review row 50). Probe the method shape, never call it — a status\n // read must not write a spill artifact. A broken binding is dropped so\n // a replaced provider is picked up by the next status.\n try {\n const backend = spillService.refresh()\n if (backend === undefined) return false\n if (typeof backend.saveText === 'function') return true\n spillService.reset()\n return false\n } catch {\n spillService.reset()\n return false\n }\n },\n get hasWorkspaceRegistry() {\n // Live fact: a registry that appeared, disappeared or was replaced\n // since `apply` must be reported as it is now.\n return registry.refresh() !== undefined\n },\n get workspaceRegistryBroken() {\n // `resolve.ts` swallows a throwing `list()` per call by design: one\n // invisible session must not crash a hook. That swallow is exactly why\n // the failure needs a status-time probe, or every session is judged\n // invisible while `degraded` stays empty (review row 6). A non-array is\n // the same fail-closed answer in the resolver, so it is the same\n // degradation here. `refresh` re-reads the binding so a repaired\n // provider clears the code on the very next status.\n try {\n const backend = registry.refresh()\n if (backend === undefined) return false\n if (Array.isArray(backend.list())) return false\n registry.reset()\n return true\n } catch {\n registry.reset()\n return true\n }\n },\n }\n const fixedOverhead = measureBoostFixedOverhead()\n\n // The hook reads this synchronously, so it only ever returns the warmed\n // answer. The map alone is not the answer: a workspace disabled between\n // commit and synthesis leaves the id behind but flips `judgement` to false.\n const resolveSession = (sessionId: string): string | undefined => {\n try {\n if (!scope.judgement(sessionId)) return undefined\n return workspaces.get(sessionId)\n } catch {\n return undefined\n }\n }\n\n // `deps` MUST stay the same object `registerHooks` receives: it publishes\n // the created `ReceiptSessionState` onto `deps.sessionState`, and\n // `clearSession(deps, id)` can only reach it through that reference.\n const deps: HookDeps = {\n config: cfg,\n scope,\n receipts,\n anchors,\n resolveSession,\n queue,\n plans,\n sessions,\n // Getters, not snapshots: the hook reads them per decision, so a service\n // that becomes active after `apply` is picked up on the next call.\n get spill() {\n return spillBackend()\n },\n retrievals,\n get estimateText() {\n return meter.estimate()\n },\n get estimateKind() {\n return meter.kind()\n },\n projectionCounters,\n // The live horizon, so a projection receipt pins the value its own\n // decision was made under instead of whatever the cross-session minimum\n // happens to be when an operator runs `boost status` (design §5.3).\n horizonFor: (sessionId) => horizon.remainingFor(sessionId),\n // The dispatch mirror lives in the post-execute module and `clearSession`\n // lives in the stream module; this is the seam that lets a disposal drop\n // the mirror instead of leaking one entry per disposed session.\n clearAcceptedDispatch: (sessionId) => clearAcceptedDispatch(deps, sessionId),\n get llm() {\n return llmBackend()\n },\n selectorRoute: (sessionId) => routes.get(sessionId),\n }\n // The section mount is the first thing `registerHooks` touches. Only the\n // host's genuine duplicate error means a previous apply already owns the\n // mounts; every other throw is a wiring failure that must be named, must\n // not take the other three mounts (or the control tool) down with it, and\n // must be visible in `status` as `ERR_BOOST_PARTIAL_MOUNT` (review row 2).\n const missingMounts = new Set<string>()\n const mounts = mountHooks(ctx, deps, missingMounts)\n if (mounts.alreadyMounted) return\n\n // The clock/visibility warm and the session-end cleanup. Wired separately\n // so a host that cannot accept these events still gets the tool below.\n // `wireSessionEvents` mounts each listener in its own try/catch: a throw at\n // the first one cannot drop the other six (in particular\n // `session/disposed`, whose loss leaks per-session state for the process\n // lifetime), and every failure is named in `missingMounts`.\n try {\n wireSessionEvents(\n ctx,\n deps,\n scope,\n registryBackend,\n sessions,\n horizon,\n workspaces,\n routes,\n projectionCounters,\n missingMounts,\n mounts.ownsSection,\n )\n } catch (error) {\n // Only an assembly bug reaches here; each listener mount is contained.\n missingMounts.add('session-events')\n ctx.logger?.warn?.(\n `dsh-boost: ERR_BOOST_PARTIAL_MOUNT: session wiring failed (${messageOf(error)})`,\n )\n }\n\n // After the hooks: a genuine duplicate aborts above before it can register\n // the tool twice. A different section failure still reaches here, and so\n // does a tool registration failure of its own — neither may be swallowed\n // behind the other's diagnosis.\n try {\n const boostDeps: BoostDeps = {\n scope,\n receipts,\n host: hostFacts,\n fixedOverhead: () => fixedOverhead,\n get estimateKind() {\n return meter.kind()\n },\n // Design §5.3's runtime horizon: min(config horizon, mean of the last\n // `historyTurns` completed turns) over live sessions. `runBoost` spreads\n // the deps when it is called, so this getter is read at status time.\n get horizonSteps() {\n return horizon.remaining()\n },\n locatorEvictions: () => retrievals.evictions(),\n receiptReadErrors: () => receipts.readErrors(),\n receiptsTruncated: () => receipts.scanTruncated(),\n unknownFamilies: () => projectionCounters.unknownFamilies(),\n unknownTools: () => projectionCounters.unknownToolCounts(),\n protocolSuppressed: () => projectionCounters.protocolSuppressions(),\n completeSectionSuppressions: () => projectionCounters.protocolMissings(),\n partialMounts: () => [...missingMounts],\n }\n registerBoostTool(ctx, boostDeps)\n // The settings page reads through this plugin's own route, and it reads\n // through `boostDeps` — the same object the tool spreads — so `boost\n // status` and the page can never disagree about the same workspace.\n //\n // Its own try: the catch below reports a failed *tool* registration, and\n // a route that could not mount is a different fault with a different\n // remedy (the tool is the control surface; the route is only the page).\n try {\n registerHttpApi(\n ctx,\n {\n status: () => runBoost({ ...boostDeps, args: { cmd: 'status' } }),\n scope: () => runBoost({ ...boostDeps, args: { cmd: 'scope-get' } }),\n workspaces: () => listWorkspaces(registryBackend()),\n config: () => cfg,\n write: (body, baseRevision) =>\n runBoost({\n ...boostDeps,\n // The wire is untrusted: a non-number is \"no revision given\",\n // which the command already rejects with its own code. Passing\n // it through as-is would only move the type error here.\n args: {\n cmd: 'scope-set',\n body,\n ...(typeof baseRevision === 'number' ? { baseRevision } : {}),\n },\n }),\n },\n message => ctx.logger?.warn?.(message),\n )\n } catch (error) {\n ctx.logger?.warn?.(\n `dsh-boost: ERR_BOOST_HTTP_MOUNT_FAILED: settings page has no data route (${messageOf(error)})`,\n )\n }\n } catch (error) {\n // The tool is the user's only control surface; its failure is reported\n // on its own, never as a hook failure.\n ctx.logger?.warn?.(\n `dsh-boost: boost tool registration failed (ERR_BOOST_TOOL_REGISTER_FAILED): ${messageOf(error)}`,\n )\n }\n } catch (error) {\n ctx.logger?.warn?.(`dsh-boost: hook registration skipped: ${messageOf(error)}`)\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE3C,OAAO,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,MAAM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CAClG,CAAA;QACH,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,yCAAyC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IACjF,CAAC;AACH,CAAC","sourcesContent":["/**\n * dsh-boost cordis plugin entry point.\n *\n * The plugin is a plain function plugin: cordis reads `name` and `inject` from\n * the module and calls `apply(ctx, config)`. Only the production assembly lives\n * here — configuration resolution, the two stores the hooks and the control\n * tool share, the hook mounts, the lifecycle events that warm visibility,\n * drive the clock, flush receipts at turn end and clean up on session\n * disposal, and the `boost` tool, all wired once per plugin instance.\n *\n * Wiring failures are contained: a host that lacks the services a mount point\n * lives on must load the plugin with a warning, not die loading it. The data\n * root is `<dshHome>/boost` (`config.dshHome` when the row supplies it, else\n * `$DSH_HOME`), falling back to `~/.dsh/boost`.\n *\n * ## Why the mount disposers are dropped\n *\n * `ctx.on`, `ctx.systemPrompt.section` and `ctx.tools.register` all return a\n * disposer. Every one is deliberately discarded. A cordis plugin entry is\n * mounted in its own context, and disposing that entry tears down everything\n * registered through it; a retained disposer would add nothing except the\n * chance that a stale closure removes a mount owned by a later instance. The\n * assumption is exactly that per-entry ownership — if this plugin is ever\n * mounted into a context it does not own (a shared host context), the\n * disposers, or an explicit teardown, become required (review row 76).\n *\n * @module dsh-boost\n */\nimport { readFileSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport type { ToolDefinition } from '@deepseek-ai/dsh-tools'\nimport { ERR_BOOST_HTTP_MOUNT_FAILED, measureBoostFixedOverhead } from './tools/boost.js'\nimport { RuntimeStepHorizon, StepBudget } from './admission/ledger.js'\nimport { RetrievalLedger } from './admission/retrieval.js'\nimport { UsageLedger } from './admission/usage.js'\nimport { resolveConfig } from './config.js'\nimport { AnchorStore } from './gate/invalidate.js'\nimport type { Plan } from './gate/plan.js'\nimport { resolveBoostRoot } from './host/root.js'\nimport { clearSession, SessionRuntime } from './hooks/llm-stream.js'\nimport { TurnClock } from './hooks/clock.js'\nimport { PendingQueue } from './hooks/pending.js'\nimport { clearAcceptedDispatch, registerHooks } from './hooks/post-execute.js'\nimport type { HookDeps, SelectorRoute } from './hooks/post-execute.js'\nimport type { SpillBackend } from './projection/apply.js'\nimport { ProjectionCounters } from './projection/counters.js'\nimport { PROTOCOL_NAME, PROTOCOL_TEXT } from './prompt/protocol.js'\nimport { ReceiptStore } from './receipts/store.js'\nimport type { LlmLike } from './selector/jev.js'\nimport { resolveWorkspace } from './scope/resolve.js'\nimport type { WorkspaceRegistry } from './scope/resolve.js'\nimport { ScopeStore } from './scope/store.js'\nimport { boostTool, runBoost } from './tools/boost.js'\nimport { registerHttpApi } from './http/mount.js'\nimport { listWorkspaces } from './http/state.js'\nimport type { BoostDeps, BoostHostFacts } from './tools/boost.js'\nimport type { PluginContext } from './types.js'\n\nexport const name = 'dsh-boost'\n\n/**\n * Required host services.\n *\n * `llm` is deliberately absent: projection and admission use no model, and\n * only the selector does. A hard injection would leave the whole plugin\n * pending — no hooks, no tool, no warning — on a composition without the LLM\n * runtime, even though it could still project. The selector resolves `llm`\n * lazily and fails closed with `selector-unavailable` when it is absent.\n */\nexport const inject = ['tools', 'systemPrompt'] as const\n\n/** Whether the host exposes both services the hook mounts attach to. */\nfunction canRegister(ctx: PluginContext): boolean {\n return typeof ctx.on === 'function' && typeof ctx.systemPrompt?.section === 'function'\n}\n\n/** One-line detail for a contained wiring failure. */\nfunction messageOf(error: unknown): string {\n return error instanceof Error ? error.message : String(error)\n}\n\n/** The dsh host line this build was verified against (`engines.dsh`). */\nconst VERIFIED_HOST_VERSION = '0.2.2-rc.4'\n\n/**\n * Whether a reported version names the verified release, ignoring build\n * metadata.\n *\n * The host's compatibility preflight compares with\n * `semver.satisfies(version, range, { includePrerelease: true })`, and semver\n * ignores `+build` metadata on both sides. String equality would warn on\n * `0.2.2-rc.4+build.5` — a build the host itself accepts — so the comparison\n * strips everything from the first `+` (review row 34).\n */\nfunction isVerifiedHostVersion(version: string): boolean {\n const core = (value: string): string => {\n const build = value.indexOf('+')\n return build === -1 ? value : value.slice(0, build)\n }\n return core(version) === core(VERIFIED_HOST_VERSION)\n}\n\n/** One parsed semantic version; build metadata is discarded. */\ntype SemVer = {\n major: number\n minor: number\n patch: number\n prerelease: readonly (string | number)[]\n}\n\n/**\n * Parse the semver subset a declared `engines.dsh` range uses.\n *\n * The host's compatibility preflight runs `semver.satisfies(..., {\n * includePrerelease: true })`. This module cannot import `semver` at runtime\n * (it is a dev dependency, and the published graph must stay host-free), so the\n * guard implements only what the manifest's range needs: `major.minor.patch`,\n * an optional prerelease, and the comparison operators. Anything else is\n * unparsable, and an unparsable range makes the guard advisory rather than\n * wrong.\n */\nfunction parseSemVer(value: string): SemVer | undefined {\n const match = /^v?(\\d+)\\.(\\d+)\\.(\\d+)(?:-([0-9A-Za-z.-]+))?(?:\\+[0-9A-Za-z.-]+)?$/.exec(\n value.trim(),\n )\n if (match === null) return undefined\n const majorText = match[1]\n const minorText = match[2]\n const patchText = match[3]\n if (majorText === undefined || minorText === undefined || patchText === undefined) {\n return undefined\n }\n const major = Number(majorText)\n const minor = Number(minorText)\n const patch = Number(patchText)\n if (!Number.isSafeInteger(major) || !Number.isSafeInteger(minor) || !Number.isSafeInteger(patch)) {\n return undefined\n }\n const prerelease: (string | number)[] = []\n const prereleaseText = match[4]\n if (prereleaseText !== undefined) {\n for (const identifier of prereleaseText.split('.')) {\n if (/^\\d+$/.test(identifier)) {\n const numeric = Number(identifier)\n if (!Number.isSafeInteger(numeric)) return undefined\n prerelease.push(numeric)\n } else {\n prerelease.push(identifier)\n }\n }\n }\n return { major, minor, patch, prerelease }\n}\n\n/** Semver precedence for one prerelease identifier (numeric sorts first). */\nfunction compareIdentifier(left: string | number, right: string | number): number {\n if (typeof left === 'number' && typeof right === 'number') return left - right\n if (typeof left === 'number') return -1\n if (typeof right === 'number') return 1\n return left < right ? -1 : left > right ? 1 : 0\n}\n\n/** Semver precedence: negative when `left` is older, positive when newer. */\nfunction compareSemVer(left: SemVer, right: SemVer): number {\n for (const key of ['major', 'minor', 'patch'] as const) {\n const delta = left[key] - right[key]\n if (delta !== 0) return delta\n }\n if (left.prerelease.length === 0 && right.prerelease.length === 0) return 0\n // A release outranks every prerelease of the same core version.\n if (left.prerelease.length === 0) return 1\n if (right.prerelease.length === 0) return -1\n const length = Math.max(left.prerelease.length, right.prerelease.length)\n for (let index = 0; index < length; index += 1) {\n const leftPart = left.prerelease[index]\n const rightPart = right.prerelease[index]\n // A shorter identifier list is lower when every shared part is equal.\n if (leftPart === undefined) return -1\n if (rightPart === undefined) return 1\n const delta = compareIdentifier(leftPart, rightPart)\n if (delta !== 0) return delta\n }\n return 0\n}\n\n/**\n * Whether `version` satisfies `range`, or `undefined` when either cannot be\n * parsed.\n *\n * Supports the space-separated AND comparators (`>=`, `>`, `<=`, `<`, `=`, or\n * bare) and `||` alternatives. An unevaluable range is not a mismatch: the\n * guard is advisory, and warning on a range it does not understand would be\n * worse than staying quiet.\n */\nfunction satisfiesRange(version: string, range: string): boolean | undefined {\n const parsed = parseSemVer(version)\n if (parsed === undefined) return undefined\n let evaluable = false\n for (const alternative of range.split('||')) {\n const comparators = alternative.trim().split(/\\s+/).filter(token => token !== '')\n if (comparators.length === 0) continue\n let matched = true\n let valid = true\n for (const token of comparators) {\n const match = /^(>=|<=|>|<|=)?(.+)$/.exec(token)\n const bound = match === null ? undefined : parseSemVer(match[2] ?? '')\n if (match === null || bound === undefined) {\n valid = false\n break\n }\n const order = compareSemVer(parsed, bound)\n const operator = match[1] ?? '='\n const satisfied =\n operator === '>='\n ? order >= 0\n : operator === '<='\n ? order <= 0\n : operator === '>'\n ? order > 0\n : operator === '<'\n ? order < 0\n : order === 0\n if (!satisfied) {\n matched = false\n break\n }\n }\n if (!valid) continue\n evaluable = true\n if (matched) return true\n }\n return evaluable ? false : undefined\n}\n\n/**\n * The `engines.dsh` range this build declares, read from the package manifest.\n *\n * The manifest is the one authority for \"hosts this plugin accepts\": the host's\n * preflight reads the same field, so a guard with a hard-coded range would drift\n * from the declaration it is supposed to enforce (review row 51). Memoised; a\n * missing or malformed manifest makes the guard advisory.\n */\nlet declaredHostRange: string | undefined | null = null\n\nfunction declaredHostRangeOf(): string | undefined {\n if (declaredHostRange !== null) return declaredHostRange\n try {\n const manifest = JSON.parse(\n readFileSync(new URL('../package.json', import.meta.url), 'utf8'),\n ) as { engines?: { dsh?: unknown } }\n const range = manifest.engines?.dsh\n declaredHostRange = typeof range === 'string' && range.trim() !== '' ? range.trim() : undefined\n } catch {\n declaredHostRange = undefined\n }\n return declaredHostRange\n}\n\n/**\n * Stable host code: the resolved host version is not the verified one.\n *\n * A warning, never a hard failure: an unverified version is a risk, not proof\n * that an API this build uses has moved. It belongs to the `ERR_HOST_*` family\n * this module already logs (`ERR_HOST_NO_AGENT_REQUEST`,\n * `ERR_HOST_COMPLETE_SECTION`).\n */\nconst ERR_HOST_VERSION_MISMATCH = 'ERR_HOST_VERSION_MISMATCH'\n\n/**\n * Stable host code: `system-prompt/assemble` was never observed.\n *\n * `ctx.on` accepts any string, so a renamed event registers successfully and\n * then never fires. This module needs assemble to warm the visibility cache\n * before section text resolves (design D4). The host runs assemble before\n * `agent/pre-step`, so the first pre-step without a single observed assemble is\n * proof the seam is gone. Raised once per process, on the first step that\n * needed it; the only signal is \"never fired\", so the event name also joins\n * `missingMounts`, and `status.degraded` reports `ERR_BOOST_PARTIAL_MOUNT`\n * (the per-event code is carried by the warning and the mount list, which is\n * the reachable status channel without a new status-side mapping).\n */\nconst ERR_HOST_NO_SYSTEM_PROMPT_ASSEMBLE = 'ERR_HOST_NO_SYSTEM_PROMPT_ASSEMBLE'\n\n/**\n * Stable host code: `agent/pre-step` was never observed.\n *\n * Raised once, on the first main `llm/stream` request for a session whose step\n * clock was never driven. Without pre-step the turn is unknown, so every\n * pending substitution is abandoned; the warning says why instead of leaving\n * `status` healthy. Auxiliary (`purpose`-tagged) streams do not need the clock\n * and do not raise it. As with assemble, the event name joins `missingMounts`\n * and the per-event code is carried by the one-shot warning.\n */\nconst ERR_HOST_NO_AGENT_PRE_STEP = 'ERR_HOST_NO_AGENT_PRE_STEP'\n\n/**\n * Stable host code: the selector route had to come from `agent/request`.\n *\n * `agent/pre-step` carries `modelSelection` and is the non-deprecated source.\n * When a host leaves it empty, the deprecated `agent/request` resolved config\n * is the only route left; the selector can still run, but the dependency is\n * reported once because that event is marked `@deprecated`. Absence of\n * `agent/request` itself is non-fatal and is reported separately by\n * `ERR_HOST_NO_AGENT_REQUEST`.\n */\nconst ERR_HOST_NO_MODEL_SELECTION = 'ERR_HOST_NO_MODEL_SELECTION'\n\n/** The app-boot package whose version IS the dsh runtime version. */\nconst HOST_VERSION_PACKAGE = '@deepseek-ai/dsh-app-boot'\n\n/** The host's package resolver (`pluginPackages` in a profile process). */\ntype PackageResolver = {\n packageOf?(specifier: string, parentURL: string): { version?: unknown } | undefined\n}\n\n/** Node's resolver, used only when the host service is unavailable. */\nconst requireFromHere = createRequire(import.meta.url)\n\n/**\n * The resolved dsh host version, or `undefined` when it cannot be determined.\n *\n * `dsh-app-boot`'s own manifest is the runtime version the compatibility\n * preflight compares `engines.dsh` against, so it is the authority here too.\n * The profile's `pluginPackages` service is preferred because it resolves\n * through the same runtime interception the host used (a linked or mixed tree\n * reports the version actually loaded); a plain Node resolve from this module\n * is the fallback for an embedded composition without that service. Reading a\n * manifest is not a host import: the package is never loaded, and nothing in\n * `dist/` statically imports it.\n *\n * Never throws: an absent service, an unresolvable package and a malformed\n * manifest all mean \"unknown\", which is logged but not warned about.\n */\nfunction hostVersionOf(ctx: PluginContext): string | undefined {\n try {\n const packages = serviceOf<PackageResolver>(ctx, 'pluginPackages')\n const pkg = packages?.packageOf?.(HOST_VERSION_PACKAGE, import.meta.url)\n if (typeof pkg?.version === 'string' && pkg.version !== '') return pkg.version\n } catch {\n // A foreign resolver is the same as no resolver.\n }\n try {\n const manifest = requireFromHere.resolve(`${HOST_VERSION_PACKAGE}/package.json`)\n const parsed = JSON.parse(readFileSync(manifest, 'utf8')) as { version?: unknown }\n return typeof parsed.version === 'string' && parsed.version !== '' ? parsed.version : undefined\n } catch {\n return undefined\n }\n}\n\n/**\n * Log the resolved host version once, warning only outside `engines.dsh`.\n *\n * The version guard is deliberately advisory. npm does not read `engines.dsh`;\n * the host enforces it only through the managed-install compatibility preflight,\n * which does not run for every composition. A warning here is the only signal\n * an embedded or mixed tree gets, and it must never stop the plugin: a version\n * this build did not verify may still work.\n *\n * The check is against the **declared range**, not exact equality (review row\n * 51): `engines.dsh` is `>=0.2.2-rc.4 <0.2.3-0`, and the host's preflight\n * accepts rc.5 and the 0.2.2 release. Warning on those told operators to\n * distrust a host the manifest itself accepts. Inside the range but not the\n * verified build is an informational note; outside it is the warning.\n */\nfunction reportHostVersion(ctx: PluginContext): void {\n const version = hostVersionOf(ctx)\n const range = declaredHostRangeOf()\n if (version === undefined) {\n ctx.logger?.info?.(\n `dsh-boost: dsh host version unknown (verified against ${VERIFIED_HOST_VERSION}${range === undefined ? '' : `; declared range ${range}`}); compatibility cannot be checked`,\n )\n return\n }\n if (range === undefined) {\n ctx.logger?.info?.(\n `dsh-boost: dsh host ${version}; the package declares no engines.dsh range, so compatibility cannot be checked`,\n )\n return\n }\n const accepted = satisfiesRange(version, range)\n if (accepted === undefined) {\n ctx.logger?.info?.(\n `dsh-boost: dsh host ${version}; the declared range ${range} is not a semver range this guard understands, so compatibility cannot be checked`,\n )\n return\n }\n if (!accepted) {\n ctx.logger?.warn?.(\n `dsh-boost: ${ERR_HOST_VERSION_MISMATCH}: this build is verified against dsh ${VERIFIED_HOST_VERSION} (declared range ${range}), but the host reports ${version}, which is outside it; continuing, but a renamed host API may make the plugin inert`,\n )\n return\n }\n if (isVerifiedHostVersion(version)) {\n ctx.logger?.info?.(`dsh-boost: dsh host ${version} (verified)`)\n return\n }\n // Inside the range the manifest accepts, so this is not a mismatch — just not\n // the exact build the plugin was exercised against.\n ctx.logger?.info?.(\n `dsh-boost: dsh host ${version} is within the declared range ${range}, but not the exact build this was verified against (${VERIFIED_HOST_VERSION}); continuing`,\n )\n}\n\n/**\n * Duplicate applies observed in this process.\n *\n * The host exposes no stable duplicate-mount code for a prompt section, so the\n * only evidence is the plain Error's message. A throw counts as \"this plugin is\n * already wired\" only when that message names OUR section and says it is\n * already registered; every other failure is a wiring error with its own code\n * (see `isDuplicateSectionError`). The counter makes repeated applies visible\n * in the log without changing the mounts.\n */\nlet duplicateMountAttempts = 0\n\n/**\n * Whether a section-registration throw is the host's genuine duplicate error.\n *\n * `dsh-system-prompt` builds a plain `Error` whose message starts with\n * `prompt section \"<name>\" is already registered` (global and scoped variants\n * both start that way) and exposes no code. The message alone proves only that\n * *some* plugin owns the name — another plugin using `dsh-boost` produces the\n * same text — so it is combined with {@link ownSectionRegistries}, the mount\n * marker this module owns (review row 32). A duplicate from a foreign owner is\n * a section-mount failure, not \"this plugin is already wired\": the remaining\n * hooks and the control tool must still mount.\n */\nfunction isDuplicateSectionError(error: unknown): boolean {\n return (\n error instanceof Error &&\n error.message.startsWith(`prompt section \"${PROTOCOL_NAME}\" is already registered`)\n )\n}\n\n/**\n * Read a soft host service through `ctx.get`.\n *\n * `workspaceRegistry`, `spillStore` and `tokenMeter` are optional peers: a\n * static injection would make the plugin fail to load on a host that does not\n * provide them, so they are fetched, never declared in `inject`. A host whose\n * `get` throws is the same as one without the service (the plugin-load test\n * pins that the data root is never resolved this way).\n */\nfunction serviceOf<T>(ctx: PluginContext, name: string): T | undefined {\n try {\n if (typeof ctx.get !== 'function') return undefined\n return ctx.get<T>(name) ?? undefined\n } catch {\n return undefined\n }\n}\n\n/**\n * A memoising, retrying service getter with explicit invalidation.\n *\n * `ctx.get(name, strict=true)` answers `undefined` until the provider fiber is\n * ACTIVE, and cordis starts sibling plugin entries concurrently, so a service\n * read once in `apply` may simply not exist yet. A success is memoised; an\n * absence is never cached, because the provider may become active one tick\n * later. Every call site reads the getter, so the plugin recovers on the next\n * request instead of staying inert for the process lifetime.\n *\n * A first success is not a permanent binding (review row 6). `reset()` drops\n * the memo, and `refresh()` re-reads `ctx.get` and replaces the memo with the\n * current binding. Callers use `reset()` after a point-of-use failure (a\n * spill store whose `saveText` rejects, a registry whose `list()` throws, an\n * LLM whose stream fails); `refresh()` is the pre-write re-confirmation the\n * spill path needs, because a provider can be replaced between the decision\n * that resolved it and the write that uses it. `apply` also drops all three\n * memos when the owning cordis fiber unloads.\n */\ntype LazyService<T> = (() => T | undefined) & {\n reset(): void\n /** Re-read `ctx.get` and replace the memo with the current binding. */\n refresh(): T | undefined\n}\n\nfunction lazyService<T>(ctx: PluginContext, name: string): LazyService<T> {\n let resolved: T | undefined\n const get = (() => {\n if (resolved !== undefined) return resolved\n resolved = serviceOf<T>(ctx, name)\n return resolved\n }) as LazyService<T>\n get.reset = () => {\n resolved = undefined\n }\n get.refresh = () => {\n resolved = serviceOf<T>(ctx, name)\n return resolved\n }\n return get\n}\n\n/**\n * The cordis disposal seam (`ctx.effect`), optional for structural fake hosts.\n *\n * Cordis has no `dispose` event; a plugin owns its fiber and `ctx.effect`\n * registers a disposer that runs when that fiber unloads (`fiber.ts`: effects\n * are collected and run in reverse order on unload). The real context exposes\n * it on the proxy, but `PluginContext` stays the narrower structural host this\n * package can type without a cordis dependency, so the read is optional.\n */\ntype EffectContext = {\n effect?: (execute: () => () => void, label?: string) => unknown\n}\n\n/**\n * Run `invalidate` when the owning fiber unloads.\n *\n * Used for the three soft-service memos: a disposed provider must not leave a\n * stale binding behind for a later provider that reuses the same name (review\n * row 6). A host without the effect seam is not a failure: the point-of-use\n * resets still recover, only the disposal edge is missed.\n */\nfunction onDispose(ctx: PluginContext, invalidate: () => void): void {\n try {\n const effect = (ctx as PluginContext & EffectContext).effect\n if (typeof effect !== 'function') return\n effect.call(ctx, () => invalidate, 'dsh-boost: soft service bindings')\n } catch {\n // A host that rejects the effect still gets the per-use resets.\n }\n}\n\n/**\n * The session id behind an agent or a `Session`.\n *\n * An agent exposes `session.header.id`; the `session/disposed` payload is the\n * `Session` itself and exposes `header.id` (and `id`). Anything else is\n * `undefined`, which makes every caller fail closed.\n */\nfunction sessionIdOf(value: unknown): string | undefined {\n const carrier = value as\n | {\n session?: { header?: { id?: unknown } }\n header?: { id?: unknown }\n id?: unknown\n }\n | undefined\n const agentId = carrier?.session?.header?.id\n if (typeof agentId === 'string') return agentId\n const headerId = carrier?.header?.id\n if (typeof headerId === 'string') return headerId\n return typeof carrier?.id === 'string' ? carrier.id : undefined\n}\n\n/**\n * The host token meter's synchronous message estimator, resolved lazily.\n *\n * `ctx.tokenMeter` is a cordis service with a synchronous `estimateMessage`\n * method, so `ctx.get('tokenMeter')` is a real synchronous seam. Like every\n * soft service it may become active after this plugin's `apply`, so the\n * estimator is probed on first use and re-probed while absent; a success is\n * memoised. Presence is not capability: a service that throws or returns a\n * non-finite number is a broken meter, not a meter, and substitution is\n * refused exactly as when no service exists (review R5). A broken meter is not\n * memoised either, so a provider that finishes wiring its meter later can\n * still recover.\n *\n * The receipt label is `host` so the number is never mistaken for a provider\n * measurement; the only other label would be a fabricated `chars/4` fallback,\n * which this assembly deliberately does not implement.\n *\n * Memoisation covers the *binding*, not the answer. `kind()` probes the\n * memoised estimator on every call, because a meter that answered once is not\n * a meter forever: after it starts returning `NaN`, projection receipts already\n * record `estimate:'unknown'` for that assembly, and a cached `host` label\n * would contradict them in the same `boost status` output.\n */\nconst METER_PROBE = 'dsh-boost meter probe'\n\nfunction meterSeamOf(ctx: PluginContext): {\n estimate(): ((text: string) => number) | undefined\n kind(): 'host' | 'unknown'\n} {\n let estimator: ((text: string) => number) | undefined\n /** One probe through a raw host estimator; a throw or non-number is failure. */\n const probe = (estimate: (message: unknown) => number): boolean => {\n try {\n const value = estimate({\n role: 'user',\n content: [{ type: 'text', text: METER_PROBE }],\n })\n return typeof value === 'number' && Number.isFinite(value)\n } catch {\n return false\n }\n }\n const resolve = (): ((text: string) => number) | undefined => {\n if (estimator !== undefined) return estimator\n const meter = serviceOf<{ estimateMessage?: (message: unknown) => number }>(ctx, 'tokenMeter')\n if (meter === undefined || typeof meter.estimateMessage !== 'function') return undefined\n const estimate = meter.estimateMessage.bind(meter)\n if (!probe(estimate)) return undefined\n estimator = (text: string): number => {\n try {\n const value = estimate({ role: 'user', content: [{ type: 'text', text }] })\n return typeof value === 'number' && Number.isFinite(value) ? value : Number.NaN\n } catch {\n return Number.NaN\n }\n }\n return estimator\n }\n return {\n estimate: resolve,\n kind: () => {\n const estimate = resolve()\n if (estimate === undefined) return 'unknown'\n // Probe through the memoised wrapper, so the label prices the same\n // pipeline every receipt uses. `resolve()` alone cannot answer: it\n // returns a cached binding even after the meter stopped answering.\n return Number.isFinite(estimate(METER_PROBE)) ? 'host' : 'unknown'\n },\n }\n}\n\n/** How many disposed session ids the runtime facade remembers (FIFO). */\nconst MAX_DISPOSED_RUNTIME_SESSIONS = 256\n\n/**\n * `SessionRuntime` that refuses to recreate state for a disposed session.\n *\n * `clearSession` drops a session's runtime entry, but a `post-execute` that was\n * already in flight (a selector call can take 20 s) lands after disposal and\n * calls `clockFor`/`budgetFor`/`usageFor` again; the base class would create a\n * fresh entry nothing ever clears. The facade returns throwaway primitives for\n * disposed ids instead: the late hook records nothing, and the map cannot grow\n * after session end. The id set is FIFO-bounded so a long process cannot grow\n * it without limit.\n */\nclass DisposalAwareSessionRuntime extends SessionRuntime {\n private readonly disposed = new Set<string>()\n private readonly disposedOrder: string[] = []\n\n /** Mark a session disposed and drop whatever the base class still holds. */\n markDisposed(sessionId: string): void {\n this.clear(sessionId)\n if (this.disposed.has(sessionId)) return\n this.disposed.add(sessionId)\n this.disposedOrder.push(sessionId)\n while (this.disposedOrder.length > MAX_DISPOSED_RUNTIME_SESSIONS) {\n const oldest = this.disposedOrder.shift()\n if (oldest !== undefined) this.disposed.delete(oldest)\n }\n }\n\n override clockFor(sessionId: string): TurnClock {\n return this.disposed.has(sessionId) ? new TurnClock() : super.clockFor(sessionId)\n }\n\n override budgetFor(sessionId: string): StepBudget {\n return this.disposed.has(sessionId) ? new StepBudget(0) : super.budgetFor(sessionId)\n }\n\n override usageFor(sessionId: string): UsageLedger {\n return this.disposed.has(sessionId) ? new UsageLedger() : super.usageFor(sessionId)\n }\n\n override onModelRequest(sessionId: string, turn: number, step?: number): void {\n if (!this.disposed.has(sessionId)) super.onModelRequest(sessionId, turn, step)\n }\n}\n\n/** The `agent/request` payload fields this assembly reads. */\ntype RequestPayload = {\n agent?: unknown\n turn?: unknown\n step?: unknown\n /** Captured step route on `agent/pre-step` (also the selector's inheritance source). */\n modelSelection?: unknown\n}\n\n/**\n * Warm the synchronous visibility cache and remember the canonical workspace.\n *\n * `resolveWorkspace` is the async answer and also writes `scope.judgement(key)`;\n * it prefers the registry's `resolveByPath`, so a symlinked or trailing-slash\n * cwd resolves to the same id the judgement used. The workspace id is kept even\n * when the answer is \"invisible\", so the resolver must consult the live\n * judgement rather than treating the map as the answer. A workspace disabled\n * after a commit therefore stops resolving before the next synthesized turn.\n */\nasync function warmVisibility(\n scope: ScopeStore,\n registry: () => WorkspaceRegistry | undefined,\n agent: unknown,\n sessionId: string,\n workspaces: Map<string, string>,\n): Promise<boolean> {\n try {\n const result = await resolveWorkspace(scope, agent, registry())\n // The map carries identity, `scope.judgement` carries visibility: cache the\n // id even when the answer is \"invisible\", and let the resolver combine the\n // two. A stale id therefore cannot outlive a visibility change.\n if (typeof result.workspaceId === 'string') workspaces.set(sessionId, result.workspaceId)\n else workspaces.delete(sessionId)\n return result.visible\n } catch {\n // `resolveWorkspace` is total; this contains a foreign registry.\n return false\n }\n}\n\n/** Remember the effective route the selector call must inherit. */\nfunction rememberRoute(\n routes: Map<string, SelectorRoute>,\n sessionId: string,\n config: unknown,\n): void {\n const resolved = config as\n | { provider?: unknown; model?: unknown; reasoningEffort?: unknown }\n | undefined\n if (resolved == null) return\n if (typeof resolved.provider !== 'string' || typeof resolved.model !== 'string') return\n const route: SelectorRoute = { provider: resolved.provider, model: resolved.model }\n if (typeof resolved.reasoningEffort === 'string') route.reasoningEffort = resolved.reasoningEffort\n routes.set(sessionId, route)\n}\n\n/**\n * Replace the protocol section's already-resolved text with the fresh answer.\n *\n * This runs *after* the assemble waterfall, so it rewrites text a section\n * provider already produced. That is deliberate and does not contradict D4\n * (\"persistent, stable content\"): every agent has its own prompt prefix and\n * its own context window, so changing this section cannot invalidate another\n * agent's cached prefix. Within one agent the answer changes only when its\n * resolved visibility changes (a workspace edit/`scope-set`), which is exactly\n * the point at which the prefix must change; every other assembly reproduces\n * the same bytes. The alternative — a section whose text is fixed at\n * registration — would either leak one agent's visibility to every other or\n * require a second provider to read a cache this listener has not warmed yet.\n */\nfunction patchProtocolSection(assembly: unknown, visible: boolean): unknown {\n const value = assembly as { sections?: unknown } | undefined\n if (value === undefined || value === null || !Array.isArray(value.sections)) return assembly\n const sections = value.sections.map((section) => {\n const entry = section as { name?: unknown } | null\n return entry?.name === PROTOCOL_NAME\n ? { ...(entry as Record<string, unknown>), text: visible ? PROTOCOL_TEXT : '' }\n : section\n })\n return { ...(value as Record<string, unknown>), sections }\n}\n\n/** The marker every protocol text carries; a system prompt without it lost the section. */\nconst PROTOCOL_PROBE = '<CHISEL_PLAN>'\n\n/**\n * The system-role text of one model request, or `undefined` when the request\n * carries no system prompt at all.\n *\n * Loop-built requests put the rendered prompt in the leading system-role\n * message (``GenerateOptions.messages``); one-shot callers use `system`. A\n * request with neither is a diagnostic that cannot tell us whether the section\n * landed, so it is not evidence of a complete-section swallow.\n */\nfunction systemTextOf(options: unknown): string | undefined {\n const source = options as { messages?: unknown; system?: unknown } | null | undefined\n if (typeof source?.system === 'string' && source.system.length > 0) return source.system\n const messages = source?.messages\n if (!Array.isArray(messages)) return undefined\n let seen = false\n let text = ''\n for (const message of messages) {\n const entry = message as { role?: unknown; content?: unknown } | null\n if (entry?.role !== 'system') continue\n seen = true\n if (typeof entry.content === 'string') {\n text += entry.content\n continue\n }\n if (!Array.isArray(entry.content)) continue\n for (const block of entry.content) {\n const part = block as { type?: unknown; text?: unknown } | null\n if (part?.type === 'text' && typeof part.text === 'string') text += part.text\n }\n }\n return seen ? text : undefined\n}\n\n/**\n * Mount the host events the assembly owns.\n *\n * ## Why `system-prompt/assemble` owns the warm\n *\n * The host's preStep is `tools.resolve` -> `systemPrompt.assemble` ->\n * `agent/pre-step`; section text resolves inside `assemble`, and\n * `agent/request` fires only later in `step()`. A warm driven from\n * `agent/request` therefore misses request 1 (the gate can never act on step\n * 1) and then flips the system prompt on request 2, invalidating the whole\n * cached prefix (design D4). This listener runs inside the awaited assemble\n * waterfall, after sections resolve, with `context.scope` being the agent: it\n * warms the judgement and then rewrites our section's text from that fresh\n * answer. Request 1 is correct and request 2 reproduces the same bytes.\n *\n * The tool-level `when` was the alternative early seam; it is worse here\n * because it never runs when `tools.resolve` is unavailable or the boost tool\n * is filtered out, and it cannot await `resolveByPath` without making a\n * synchronous visibility predicate asynchronous. The assemble listener also\n * costs nothing on tool-listing paths.\n *\n * `agent/pre-step` is the non-deprecated clock seam (`agent/request` is\n * marked `@deprecated`); it fires once per proposed step with the host\n * `turn`/`step`, and it already carries the captured `modelSelection`. The\n * selector route is read from there first; `agent/request`'s resolved config\n * is only the compatibility path for a host whose pre-step does not populate\n * `modelSelection`, and it warns once when it is used. The visibility warm\n * stays at `assemble` (D4); `agent/pre-step` warms only when `assemble` never\n * fired, so no session's visibility depends on the deprecated event. A model\n * request that reaches `llm/stream` without any observed `agent/request` is\n * still reported once with `ERR_HOST_NO_AGENT_REQUEST`; the route itself does\n * not depend on it.\n *\n * ## Every mount is attributed\n *\n * `ctx.on` accepts any string (`cordis/src/events.ts`), so a renamed host\n * event registers successfully and then never fires. Registration failures and\n * \"never observed\" are therefore different signals, and both must reach the\n * operator:\n *\n * - Each listener is mounted in its own try/catch. A throw names that event in\n * `missingMounts`, and the remaining listeners still mount. Before this, one\n * bare catch around the whole wiring left `status.degraded` empty and lost\n * `session/disposed` (per-session state leaked for the process lifetime).\n * - `ERR_HOST_NO_SYSTEM_PROMPT_ASSEMBLE` is raised once when the first\n * `agent/pre-step` arrives without a single observed assemble. The host\n * order guarantees assemble first, so its absence is a renamed/removed\n * event. Its only evidence is \"never observed\"; the event name also joins\n * `missingMounts`, so `status.degraded` reports `ERR_BOOST_PARTIAL_MOUNT`\n * (the per-event code exists in the warning and the mount list).\n * - `ERR_HOST_NO_AGENT_PRE_STEP` is raised once when the first main\n * `llm/stream` request arrives without any observed pre-step for that\n * session. The step clock cannot advance without it, so substitution is\n * impossible; auxiliary (`purpose`-tagged) streams do not need it and do not\n * raise the warning.\n *\n * `session/event` (`turn/end`), `session/flush` and `session/disposed` call\n * `ReceiptStore.flush()` so the turn-end durability the design promises is\n * real. `session/disposed` also drops every per-session map the assembly owns\n * and tells the stores to evict their state.\n */\nfunction wireSessionEvents(\n ctx: PluginContext,\n deps: HookDeps,\n scope: ScopeStore,\n registry: () => WorkspaceRegistry | undefined,\n sessions: DisposalAwareSessionRuntime,\n horizon: RuntimeStepHorizon,\n workspaces: Map<string, string>,\n routes: Map<string, SelectorRoute>,\n counters: ProjectionCounters,\n missing: Set<string>,\n ownsSection: boolean,\n): void {\n /** Session ids seen at `agent/pre-step`; a `llm/stream` without a request is drift. */\n const preStepSeen = new Set<string>()\n /** Session ids observed on `agent/request`. */\n const requestSeen = new Set<string>()\n let assembleSeen = false\n let warnedMissingRequest = false\n let warnedCompleteSection = false\n let warnedNoAssemble = false\n let warnedNoPreStep = false\n let warnedRouteFallback = false\n\n /**\n * Mount one listener in its own try/catch.\n *\n * A failure names the event and is recorded in `missingMounts`; it never\n * stops the next listener. `true` means the registration itself succeeded,\n * which is not proof the host ever emits the event (see the never-observed\n * warnings below).\n */\n const mount = (\n event: string,\n handler: (...args: any[]) => unknown,\n options?: { prepend?: boolean },\n ): boolean => {\n try {\n ctx.on(event, handler, options)\n return true\n } catch (error) {\n missing.add(event)\n ctx.logger?.warn?.(\n `dsh-boost: ERR_BOOST_PARTIAL_MOUNT: ${event} mount failed (${messageOf(error)})`,\n )\n return false\n }\n }\n\n // `system-prompt/assemble` stays first: it is the seam that resolves the\n // section text every later step sees (design D4).\n const assembleMounted = mount('system-prompt/assemble', async (_assembly: unknown, context: unknown, next: () => unknown) => {\n assembleSeen = true\n const resolved = await next()\n try {\n // `dsh-agent` augments `AssembleContext` with the real `Agent`; `scope`\n // is an opaque `ScopeKey` and is never read as an Agent (review row 11).\n // A diagnostic assembly has no agent: the documented no-scope view, so\n // the section is suppressed and counted rather than keyed on a guess.\n const carrier = (context ?? {}) as { agent?: unknown }\n const agent = carrier.agent\n const sessionId = sessionIdOf(agent)\n if (sessionId === undefined) {\n // The provider has nothing to key the judgement on and returns '';\n // clear the section explicitly so a stale provider answer cannot leak\n // into an assembly with no agent. Count the decision, not the\n // section's presence — design §5.5:378 asks for every assembly to be\n // judged.\n if (ownsSection) counters.protocolSuppressed()\n return ownsSection ? patchProtocolSection(resolved, false) : resolved\n }\n const visible = await warmVisibility(scope, registry, agent, sessionId, workspaces)\n // A foreign plugin owns the section name (row 32): warm the judgement the\n // decision path needs, but never rewrite another plugin's text.\n if (!ownsSection) return resolved\n // Same rule for an invisible workspace: the section is suppressed for\n // this assembly, so the operator gets a live signal in `boost status`.\n // A visible one never increments, so the count stays a failure count.\n if (!visible) counters.protocolSuppressed()\n return patchProtocolSection(resolved, visible)\n } catch {\n return resolved\n }\n })\n\n const preStepMounted = mount('agent/pre-step', async (payload: unknown, next: () => unknown) => {\n const request = (payload ?? {}) as RequestPayload\n const sessionId = sessionIdOf(request.agent)\n if (sessionId !== undefined) {\n preStepSeen.add(sessionId)\n // Row 8: assemble runs before pre-step in the host's own order. If it\n // has never run by the first step, the event was renamed or removed and\n // the protocol section cannot be warmed or patched.\n if (!assembleSeen && !warnedNoAssemble && assembleMounted) {\n warnedNoAssemble = true\n missing.add('system-prompt/assemble')\n ctx.logger?.warn?.(\n `${ERR_HOST_NO_SYSTEM_PROMPT_ASSEMBLE}: system-prompt/assemble was not observed before the first agent/pre-step; the protocol section cannot be warmed or patched (the event may have been renamed or removed)`,\n )\n }\n try {\n sessions.onModelRequest(\n sessionId,\n typeof request.turn === 'number' ? request.turn : Number(request.turn),\n typeof request.step === 'number' ? request.step : undefined,\n )\n } catch {\n // A clock that cannot be driven must not break the step.\n }\n try {\n horizon.observe(\n sessionId,\n typeof request.turn === 'number' ? request.turn : Number(request.turn),\n typeof request.step === 'number' ? request.step : Number(request.step),\n )\n } catch {\n // History is an estimate; a bad observation is not a step failure.\n }\n // `agent/pre-step` already carries the captured step selection. It is\n // the non-deprecated source for the selector route; `agent/request`'s\n // resolved config remains a compatibility fallback for hosts that only\n // populate it there. A later request overwrites with the same route.\n rememberRoute(routes, sessionId, request.modelSelection)\n // The warm belongs to `system-prompt/assemble` (D4). This is the\n // fallback for a host that skipped or renamed assemble: pre-step is the\n // non-deprecated seam, so visibility no longer depends on the\n // deprecated `agent/request` event.\n if (!assembleSeen) {\n await warmVisibility(scope, registry, request.agent, sessionId, workspaces)\n }\n }\n return next()\n })\n\n mount('agent/request', async (payload: unknown, next: () => unknown) => {\n const request = (payload ?? {}) as RequestPayload\n const sessionId = sessionIdOf(request.agent)\n if (sessionId !== undefined) {\n requestSeen.add(sessionId)\n // Compatibility only: when pre-step is present it already drove the\n // clock and the horizon. This branch exists for a host that still emits\n // the deprecated event but not the non-deprecated one.\n if (!preStepSeen.has(sessionId)) {\n try {\n sessions.onModelRequest(\n sessionId,\n typeof request.turn === 'number' ? request.turn : Number(request.turn),\n typeof request.step === 'number' ? request.step : undefined,\n )\n } catch {\n // A clock that cannot be driven must not break the model request.\n }\n try {\n horizon.observe(\n sessionId,\n typeof request.turn === 'number' ? request.turn : Number(request.turn),\n typeof request.step === 'number' ? request.step : Number(request.step),\n )\n } catch {\n // Same as the pre-step observation: history is an estimate.\n }\n if (!assembleSeen) {\n await warmVisibility(scope, registry, request.agent, sessionId, workspaces)\n }\n }\n }\n const config = await next()\n // Capability check (row 22): the non-deprecated pre-step carries\n // `modelSelection`; when it did, this event must not overwrite the route.\n // When it did not, the resolved config is the only source left, and the\n // deprecated path warns once.\n if (sessionId !== undefined && routes.get(sessionId) === undefined) {\n rememberRoute(routes, sessionId, config)\n if (routes.get(sessionId) !== undefined && !warnedRouteFallback) {\n warnedRouteFallback = true\n ctx.logger?.warn?.(\n `${ERR_HOST_NO_MODEL_SELECTION}: agent/pre-step carried no modelSelection; the selector route came from the deprecated agent/request event, which may be removed`,\n )\n }\n }\n return config\n })\n\n // The deprecated event's disappearance would otherwise disable the selector\n // route silently. A session that reached `llm/stream` after a pre-step but\n // never saw `agent/request` is proof enough; the model request itself is\n // passed through untouched. The route now comes from pre-step, so this is a\n // compatibility warning, not a correctness dependency.\n //\n // This listener is also the complete-section detector, and it MUST be\n // outermost: the synthesizer mounted by `registerHooks` consumes a queued\n // entry synchronously, so a detector registered after it would only mark the\n // session unsubstitutable *after* the first affected request had already been\n // substituted. Cordis runs the first-registered listener outermost\n // (`events.ts` unshifts on `prepend`), so `prepend: true` is what puts the\n // detector before the synthesizer regardless of mount order (finding 4).\n mount(\n 'llm/stream',\n (options: unknown, next: () => unknown) => {\n try {\n const request = (options ?? {}) as { sessionId?: unknown; purpose?: unknown }\n const sessionId = request.sessionId\n // Row 8: a main request needs the step clock, which only pre-step\n // drives. An auxiliary (`purpose`) stream carries its own prompt and\n // never needs it, so it is not evidence the seam is missing.\n if (\n !warnedNoPreStep &&\n preStepMounted &&\n request.purpose === undefined &&\n typeof sessionId === 'string' &&\n !preStepSeen.has(sessionId)\n ) {\n warnedNoPreStep = true\n missing.add('agent/pre-step')\n ctx.logger?.warn?.(\n `${ERR_HOST_NO_AGENT_PRE_STEP}: agent/pre-step was not observed before the first main llm/stream request; the step clock cannot advance (the event may have been renamed or removed)`,\n )\n }\n if (\n !warnedMissingRequest &&\n typeof sessionId === 'string' &&\n preStepSeen.has(sessionId) &&\n !requestSeen.has(sessionId)\n ) {\n warnedMissingRequest = true\n ctx.logger?.warn?.(\n 'ERR_HOST_NO_AGENT_REQUEST: agent/request was not observed before llm/stream; the deprecated event may have been removed (the selector route is captured from agent/pre-step modelSelection)',\n )\n }\n\n // A `complete: true` prompt section replaces every other section after\n // the assembly waterfall, so the protocol text\n // `system-prompt/assemble` patched in is gone from the request the\n // model actually receives. The host exposes no code or flag for that\n // restoration; the outgoing system prompt is the first place it is\n // observable. Detect it, count it, and fail closed: without the\n // protocol there is nothing to teach the plan grammar, so substitution\n // (and the projection that shares the same visibility gate) must not\n // act for this request (review row 12).\n //\n // Only a main-agent request is evidence. Every auxiliary stream — the\n // selector, compaction, and the default-on session-title provider —\n // sets `purpose` and carries its own summariser prompt, which never\n // contains the protocol section. Treating one as a swallow would count\n // a suppression that never happened, flip the session's cached\n // visibility off, and leave `ERR_HOST_COMPLETE_SECTION` in `status`\n // for the rest of the process (review row 1). This is the same rule the\n // synthesizer applies (`llm-stream.ts`: any `purpose` is auxiliary).\n if (\n request.purpose === undefined &&\n typeof sessionId === 'string' &&\n scope.judgement(sessionId)\n ) {\n const systemText = systemTextOf(options)\n if (systemText !== undefined && !systemText.includes(PROTOCOL_PROBE)) {\n counters.protocolSuppressed()\n counters.protocolMissing()\n scope.remember(sessionId, false)\n if (!warnedCompleteSection) {\n warnedCompleteSection = true\n ctx.logger?.warn?.(\n 'ERR_HOST_COMPLETE_SECTION: the final system prompt does not carry the dsh-boost protocol section (a complete prompt section replaced the assembly); substitution is disabled for affected requests',\n )\n }\n }\n }\n } catch {\n // Detection must never break the model request.\n }\n return next()\n },\n { prepend: true },\n )\n\n // `session/event` carries a plain `type` string, so `turn/end` is matched by\n // value, not by a stable code. That match is a convenience: it flushes early\n // on the common path, but it is not the durability boundary. The host does\n // not await this listener, so a process exit immediately after `turn/end`\n // can drop the flush; the awaited `session/flush` below is what the\n // persistence contract rests on, and `session/disposed` flushes again after\n // the last hook for the id. Receipts are evidence, so an early flush that\n // does not happen costs latency, never correctness.\n mount('session/event', (_session: unknown, event: unknown) => {\n const type = (event as { type?: unknown } | undefined)?.type\n if (type === 'turn/end') {\n // Fire-and-forget on the real host; `flush()` never rejects.\n return deps.receipts.flush()\n }\n return undefined\n })\n\n mount('session/flush', () => deps.receipts.flush())\n\n mount('session/disposed', async (session: unknown) => {\n const sessionId = sessionIdOf(session)\n if (sessionId === undefined) return\n try {\n clearSession(deps, sessionId)\n } catch {\n // Session end owns no tool result; a failed clear must not throw here.\n }\n sessions.markDisposed(sessionId)\n workspaces.delete(sessionId)\n routes.delete(sessionId)\n requestSeen.delete(sessionId)\n preStepSeen.delete(sessionId)\n horizon.clear(sessionId)\n scope.forget(sessionId)\n // Flush this session's buffered lines before evicting its state, then make\n // every later hook for the id a no-op.\n try {\n await deps.receipts.flush()\n } catch {\n // Flush is total; a foreign store must not break session end.\n }\n deps.receipts.disposeSession(sessionId)\n })\n\n if (missing.size > 0) {\n ctx.logger?.warn?.(\n `dsh-boost: ERR_BOOST_PARTIAL_MOUNT: missing mount(s): ${[...missing].join(', ')}; the plugin is partially wired and boost status reports this code`,\n )\n }\n}\n\n/**\n * Register the `boost` tool family.\n *\n * After T19 the family is just this one tool. The tool itself is scope-exempt\n * (`when: () => true`) because it is the only way a user can enable a workspace\n * that is not enabled yet — gating it on the scope document would make\n * `selected + []` impossible to leave. The protocol section is not exempt; T17\n * already handles it.\n *\n * No step-`when` capability probe is needed: the condition is constant-true, so\n * a host that ignored the registration options would register it\n * unconditionally — exactly the behaviour this build wants. The old probe only\n * tested `typeof tools.register === 'function'`, which every host since\n * 0.2.2-rc.1 satisfies, so the branch it fed could never run; it was removed\n * rather than left as a claim that can never be false.\n */\nfunction registerBoostTool(ctx: PluginContext, deps: BoostDeps): void {\n // Annotating with the host's ToolDefinition makes a host-side tightening a\n // build error instead of a runtime registration failure. The tool is\n // scope-exempt by design (`when: () => true`), so it needs no registry: the\n // registry is only the visibility warm's input, wired above.\n const definition: ToolDefinition = boostTool(deps)\n\n ctx.tools.register(definition, { when: () => true })\n}\n\n/**\n * Section registries this module successfully registered into.\n *\n * The mount marker this module owns (review row 32). The host's duplicate\n * message is generic: another plugin registering `dsh-boost` produces exactly\n * the same text. A duplicate therefore counts as \"this plugin is already\n * wired\" only when the same prompt registry object received this module's\n * section earlier in the process. A foreign owner is a section-mount failure:\n * the remaining hooks and the control tool still mount, and the foreign text\n * is never rewritten.\n */\nconst ownSectionRegistries = new WeakSet<object>()\n\n/**\n * Prompt registries this module already mounted its hooks and tool against.\n *\n * Separate from {@link ownSectionRegistries}: a foreign section owner means\n * this module does not own the section text, but a second apply over the same\n * registry must still not mount the hooks twice. Marked once a non-duplicate\n * apply has finished mounting, and consulted only for the duplicate decision.\n */\nconst mountedRegistries = new WeakSet<object>()\n\n/** What {@link mountHooks} established about the section and the other mounts. */\ntype MountOutcome = {\n /** A previous apply of this plugin owns the mounts; register nothing else. */\n alreadyMounted: boolean\n /** This apply registered the prompt section (so its text may be patched). */\n ownsSection: boolean\n}\n\n/** The mount label the prompt section reports when it cannot be registered. */\nconst MOUNT_SECTION = 'systemPrompt.section'\n\n/** One event listener recorded by {@link mountHooks} before it is mounted. */\ntype DeferredMount = {\n event: Parameters<PluginContext['on']>[0]\n handler: Parameters<PluginContext['on']>[1]\n options?: Parameters<PluginContext['on']>[2]\n}\n\n/**\n * Mount the four integration points, attributing each failure.\n *\n * `registerHooks` mounts the prompt section first and aborts on its failure, so\n * handing it the real context would lose the three event mounts whenever the\n * section is rejected — while `apply` logged \"continuing with the remaining\n * mounts\" and `status` still reported `degraded: []` (review row 2). It is\n * called with a recording context instead: the section is registered\n * immediately (its duplicate check must happen before anything else is\n * mounted), a rejection is recorded rather than rethrown so `registerHooks`\n * still describes the three event mounts, and those are then mounted one by one\n * so a failure names the mount that failed and lands in `missing`.\n *\n * Returns `alreadyMounted` only when the section error is the host's\n * duplicate-registration error AND this module registered that same registry\n * earlier (the mount marker): a previous apply owns every mount and this one\n * must register nothing. A duplicate from another plugin is a section-mount\n * failure, so the remaining mounts still happen (review row 32).\n */\nfunction mountHooks(ctx: PluginContext, deps: HookDeps, missing: Set<string>): MountOutcome {\n const deferred: DeferredMount[] = []\n let sectionError: unknown\n let registrationError: unknown\n\n const recording = {\n logger: ctx.logger,\n on(\n event: Parameters<PluginContext['on']>[0],\n handler: Parameters<PluginContext['on']>[1],\n options?: Parameters<PluginContext['on']>[2],\n ): void {\n deferred.push({ event, handler, options })\n },\n systemPrompt: {\n section(section: Parameters<PluginContext['systemPrompt']['section']>[0]): void {\n try {\n ctx.systemPrompt.section(section)\n } catch (error) {\n // Record, do not rethrow: `registerHooks` aborts on a throwing\n // section, and the other three mounts must still be described.\n sectionError = error\n }\n },\n },\n } as unknown as PluginContext\n\n try {\n registerHooks(recording, deps)\n } catch (error) {\n registrationError = error\n }\n\n let ownsSection = false\n const registry = ctx.systemPrompt as object | undefined\n if (sectionError !== undefined && isDuplicateSectionError(sectionError)) {\n if (registry !== undefined && mountedRegistries.has(registry)) {\n duplicateMountAttempts += 1\n ctx.logger?.warn?.(\n `dsh-boost: ERR_BOOST_ALREADY_MOUNTED: duplicate apply #${duplicateMountAttempts} found an existing mount; registration skipped (${messageOf(sectionError)})`,\n )\n return {\n alreadyMounted: true,\n ownsSection: registry !== undefined && ownSectionRegistries.has(registry),\n }\n }\n // The name is taken, but not by this module: the message alone cannot tell\n // our previous apply from another plugin using the same section name.\n missing.add(MOUNT_SECTION)\n ctx.logger?.warn?.(\n `dsh-boost: ERR_BOOST_SECTION_REGISTER_FAILED: prompt section \"${PROTOCOL_NAME}\" is registered by another plugin; mounting the remaining hooks independently (${messageOf(sectionError)})`,\n )\n } else if (sectionError !== undefined) {\n missing.add(MOUNT_SECTION)\n ctx.logger?.warn?.(\n `dsh-boost: ERR_BOOST_SECTION_REGISTER_FAILED: prompt section registration failed; mounting the remaining hooks independently (${messageOf(sectionError)})`,\n )\n } else {\n ownsSection = true\n // Record the marker only after the host accepted the section: this is the\n // one registry object a later duplicate may be attributed to.\n if (ctx.systemPrompt !== undefined && typeof ctx.systemPrompt === 'object') {\n ownSectionRegistries.add(ctx.systemPrompt)\n }\n if (registrationError !== undefined) {\n // The section did not throw, so this is an assembly bug: an unknown mount\n // is missing even though no specific one can be named.\n missing.add('hooks')\n ctx.logger?.warn?.(\n `dsh-boost: ERR_BOOST_PARTIAL_MOUNT: hook assembly failed (${messageOf(registrationError)})`,\n )\n }\n }\n\n for (const mount of deferred) {\n try {\n ctx.on(mount.event, mount.handler, mount.options)\n } catch (error) {\n missing.add(mount.event)\n ctx.logger?.warn?.(\n `dsh-boost: ERR_BOOST_PARTIAL_MOUNT: ${mount.event} mount failed (${messageOf(error)})`,\n )\n }\n }\n\n if (missing.size > 0) {\n ctx.logger?.warn?.(\n `dsh-boost: ERR_BOOST_PARTIAL_MOUNT: missing mount(s): ${[...missing].join(', ')}; the plugin is partially wired and boost status reports this code`,\n )\n }\n // A later apply over this registry is a duplicate even when the section name\n // belonged to another plugin: the hooks and the tool are ours either way.\n if (registry !== undefined) mountedRegistries.add(registry)\n return { alreadyMounted: false, ownsSection }\n}\n\nexport function apply(ctx: PluginContext, config: unknown): void {\n const repairs: string[] = []\n const cfg = resolveConfig(config, message => {\n repairs.push(message)\n ctx.logger?.warn?.(message)\n })\n // The effective-config line serialises `resolveConfig`'s output, which never\n // carries `dshHome` (that override is resolved by `resolveBoostRoot`). Log\n // the resolved root with it, once, so the operator can see the state root in\n // use — including the `$DSH_HOME`/`~/.dsh` fallback and the cwd resolution of\n // a relative override.\n let root: string\n try {\n root = resolveBoostRoot(config)\n } catch (error) {\n ctx.logger?.warn?.(`dsh-boost: cannot resolve the state root: ${messageOf(error)}`)\n return\n }\n // One line with the effective values (not only the keys this module happens\n // to use): an operator can see every clamp and fallback instead of guessing.\n ctx.logger?.info?.(\n `dsh-boost loaded (stepsPerTurn=${cfg.stepsPerTurn}, horizonSteps=${cfg.horizonSteps}); effective config=${JSON.stringify(cfg)}; root=${root}`,\n )\n if (repairs.length > 0) {\n ctx.logger?.info?.(`dsh-boost: ${repairs.length} configuration value(s) repaired`)\n }\n // The only version guard outside the managed-install preflight. Advisory:\n // an unverified host is a warning, never a refusal to load.\n reportHostVersion(ctx)\n\n if (!canRegister(ctx)) {\n ctx.logger?.warn?.('dsh-boost: host hook services unavailable; registration skipped')\n return\n }\n\n try {\n // The root was resolved above (D4) so the log can show it; both stores use\n // the same value. `resolveBoostRoot` is the only root rule (design §10), so\n // `apply` and the hook stores cannot diverge.\n const scope = new ScopeStore(root, { warn: (message: string) => ctx.logger?.warn?.(message) })\n const receipts = new ReceiptStore(root)\n const anchors = new AnchorStore()\n const queue = new PendingQueue()\n const plans = new Map<string, Plan>()\n const sessions = new DisposalAwareSessionRuntime(cfg.stepsPerTurn)\n const horizon = new RuntimeStepHorizon(cfg.horizonSteps, cfg.historyTurns)\n const retrievals = new RetrievalLedger()\n /** Session id → workspace id, populated by the visibility warm. */\n const workspaces = new Map<string, string>()\n /** Session id → the route the selector call inherits. */\n const routes = new Map<string, SelectorRoute>()\n\n // Soft host services. Cordis activates sibling providers concurrently, so\n // these getters retry until the provider fiber is ACTIVE; an absence is\n // never memoised. The workspace registry is the `resolveByPath`/`list()`\n // seam; the spill store is the projection backend; the token meter prices\n // projections and admission. A first success is not a permanent binding:\n // each point of use resets the memo on failure, and the plugin's fiber\n // disposal drops all three (review row 6).\n const registry = lazyService<WorkspaceRegistry>(ctx, 'workspaceRegistry')\n const spillService = lazyService<SpillBackend>(ctx, 'spillStore')\n // `llm` is soft (see `inject`): projection and admission never need it, and\n // the selector checks it at call time. A getter keeps a provider that\n // becomes active after `apply` reachable on the next decision.\n const llm = lazyService<LlmLike>(ctx, 'llm')\n\n /**\n * The workspace registry the visibility warm uses, with a failure re-probe.\n *\n * `list()` and `resolveByPath()` are total in the resolver (they swallow\n * their own throws), so this wrapper is the only place a replaced or\n * disposed provider is observable. A throw drops the memo; the next warm\n * asks `ctx.get` again and picks up the live binding.\n */\n const registryBackend = (): WorkspaceRegistry | undefined => {\n const backend = registry()\n if (backend === undefined) return undefined\n const resolveByPath = backend.resolveByPath\n const wrapper: WorkspaceRegistry = {\n list: () => {\n try {\n return backend.list()\n } catch (error) {\n registry.reset()\n throw error\n }\n },\n }\n if (typeof resolveByPath === 'function') {\n wrapper.resolveByPath = async (path) => {\n try {\n return await resolveByPath.call(backend, path)\n } catch (error) {\n registry.reset()\n throw error\n }\n }\n }\n return wrapper\n }\n\n /**\n * The spill backend the decision path uses, with a pre-write re-confirmation.\n *\n * A store that resolved is not a store that still exists: the provider may\n * be replaced or disposed between the decision that resolved it and the\n * write. Every write re-reads `ctx.get` through `refresh()` and uses the\n * current binding. A rejection drops the memo too, so a dead backend cannot\n * keep every later projection pointed at it while `hasSpill` stays true\n * (review rows 6 and 31).\n */\n const spillBackend = (): SpillBackend | undefined => {\n if (spillService() === undefined) return undefined\n return {\n saveText: async (input) => {\n const current = spillService.refresh()\n if (current === undefined) {\n // The store disappeared mid-turn: the projection path records this\n // as `projection-skipped:spill-failed`, not as a crash.\n throw new Error('spillStore disappeared before the write')\n }\n try {\n return await current.saveText(input)\n } catch (error) {\n spillService.reset()\n throw error\n }\n },\n }\n }\n\n /**\n * The LLM seam the selector uses, with a failure re-probe.\n *\n * The selector turns any failure into an abstention, so a provider that is\n * replaced after one successful call would otherwise be used for the rest\n * of the process. A synchronous throw or a throw while the stream is\n * consumed drops the memo; the next selection asks `ctx.get` again.\n */\n const llmBackend = (): LlmLike | undefined => {\n const backend = llm()\n if (backend === undefined) return undefined\n return {\n stream: (options) => {\n try {\n const stream = backend.stream(options)\n return (async function* () {\n try {\n yield* stream\n } catch (error) {\n llm.reset()\n throw error\n }\n })()\n } catch (error) {\n llm.reset()\n throw error\n }\n },\n }\n }\n\n // A disposed provider must not leave a stale binding behind for a later\n // provider that reuses the name. Cordis has no `dispose` event; the effect\n // seam is the fiber-unload hook (see `onDispose`).\n onDispose(ctx, () => {\n registry.reset()\n spillService.reset()\n llm.reset()\n })\n\n const meter = meterSeamOf(ctx)\n const projectionCounters = new ProjectionCounters()\n\n // Host capabilities `status` renders as stable codes. Getters keep them\n // facts about the host *now*: a service that appears after `apply` must not\n // leave a permanent `ERR_HOST_NO_*`. The fixed-cost probe starts here\n // (startup time) and is awaited only by `status` — it is deliberately not\n // on any request path.\n const hostFacts: BoostHostFacts = {\n get hasTokenMeter() {\n return meter.kind() === 'host'\n },\n get hasSpill() {\n // `refresh`, not the memo: a status call reports the host *now*, so a\n // provider that was replaced or disposed since the last write must not\n // keep `hasSpill` true (review rows 6 and 50).\n return spillService.refresh() !== undefined\n },\n get spillUsable() {\n // Presence is not capability: `{}` resolves, so `hasSpill` alone would\n // report a healthy projection path until the first `saveText` fails\n // (review row 50). Probe the method shape, never call it — a status\n // read must not write a spill artifact. A broken binding is dropped so\n // a replaced provider is picked up by the next status.\n try {\n const backend = spillService.refresh()\n if (backend === undefined) return false\n if (typeof backend.saveText === 'function') return true\n spillService.reset()\n return false\n } catch {\n spillService.reset()\n return false\n }\n },\n get hasWorkspaceRegistry() {\n // Live fact: a registry that appeared, disappeared or was replaced\n // since `apply` must be reported as it is now.\n return registry.refresh() !== undefined\n },\n get workspaceRegistryBroken() {\n // `resolve.ts` swallows a throwing `list()` per call by design: one\n // invisible session must not crash a hook. That swallow is exactly why\n // the failure needs a status-time probe, or every session is judged\n // invisible while `degraded` stays empty (review row 6). A non-array is\n // the same fail-closed answer in the resolver, so it is the same\n // degradation here. `refresh` re-reads the binding so a repaired\n // provider clears the code on the very next status.\n try {\n const backend = registry.refresh()\n if (backend === undefined) return false\n if (Array.isArray(backend.list())) return false\n registry.reset()\n return true\n } catch {\n registry.reset()\n return true\n }\n },\n }\n const fixedOverhead = measureBoostFixedOverhead()\n\n // The hook reads this synchronously, so it only ever returns the warmed\n // answer. The map alone is not the answer: a workspace disabled between\n // commit and synthesis leaves the id behind but flips `judgement` to false.\n const resolveSession = (sessionId: string): string | undefined => {\n try {\n if (!scope.judgement(sessionId)) return undefined\n return workspaces.get(sessionId)\n } catch {\n return undefined\n }\n }\n\n // `deps` MUST stay the same object `registerHooks` receives: it publishes\n // the created `ReceiptSessionState` onto `deps.sessionState`, and\n // `clearSession(deps, id)` can only reach it through that reference.\n const deps: HookDeps = {\n config: cfg,\n scope,\n receipts,\n anchors,\n resolveSession,\n queue,\n plans,\n sessions,\n // Getters, not snapshots: the hook reads them per decision, so a service\n // that becomes active after `apply` is picked up on the next call.\n get spill() {\n return spillBackend()\n },\n retrievals,\n get estimateText() {\n return meter.estimate()\n },\n get estimateKind() {\n return meter.kind()\n },\n projectionCounters,\n // The live horizon, so a projection receipt pins the value its own\n // decision was made under instead of whatever the cross-session minimum\n // happens to be when an operator runs `boost status` (design §5.3).\n horizonFor: (sessionId) => horizon.remainingFor(sessionId),\n // The dispatch mirror lives in the post-execute module and `clearSession`\n // lives in the stream module; this is the seam that lets a disposal drop\n // the mirror instead of leaking one entry per disposed session.\n clearAcceptedDispatch: (sessionId) => clearAcceptedDispatch(deps, sessionId),\n get llm() {\n return llmBackend()\n },\n selectorRoute: (sessionId) => routes.get(sessionId),\n }\n // The section mount is the first thing `registerHooks` touches. Only the\n // host's genuine duplicate error means a previous apply already owns the\n // mounts; every other throw is a wiring failure that must be named, must\n // not take the other three mounts (or the control tool) down with it, and\n // must be visible in `status` as `ERR_BOOST_PARTIAL_MOUNT` (review row 2).\n const missingMounts = new Set<string>()\n const mounts = mountHooks(ctx, deps, missingMounts)\n if (mounts.alreadyMounted) return\n\n // The clock/visibility warm and the session-end cleanup. Wired separately\n // so a host that cannot accept these events still gets the tool below.\n // `wireSessionEvents` mounts each listener in its own try/catch: a throw at\n // the first one cannot drop the other six (in particular\n // `session/disposed`, whose loss leaks per-session state for the process\n // lifetime), and every failure is named in `missingMounts`.\n try {\n wireSessionEvents(\n ctx,\n deps,\n scope,\n registryBackend,\n sessions,\n horizon,\n workspaces,\n routes,\n projectionCounters,\n missingMounts,\n mounts.ownsSection,\n )\n } catch (error) {\n // Only an assembly bug reaches here; each listener mount is contained.\n missingMounts.add('session-events')\n ctx.logger?.warn?.(\n `dsh-boost: ERR_BOOST_PARTIAL_MOUNT: session wiring failed (${messageOf(error)})`,\n )\n }\n\n // After the hooks: a genuine duplicate aborts above before it can register\n // the tool twice. A different section failure still reaches here, and so\n // does a tool registration failure of its own — neither may be swallowed\n // behind the other's diagnosis.\n try {\n const boostDeps: BoostDeps = {\n scope,\n receipts,\n host: hostFacts,\n fixedOverhead: () => fixedOverhead,\n get estimateKind() {\n return meter.kind()\n },\n // Design §5.3's runtime horizon: min(config horizon, mean of the last\n // `historyTurns` completed turns) over live sessions. `runBoost` spreads\n // the deps when it is called, so this getter is read at status time.\n get horizonSteps() {\n return horizon.remaining()\n },\n locatorEvictions: () => retrievals.evictions(),\n receiptReadErrors: () => receipts.readErrors(),\n receiptsTruncated: () => receipts.scanTruncated(),\n unknownFamilies: () => projectionCounters.unknownFamilies(),\n unknownTools: () => projectionCounters.unknownToolCounts(),\n protocolSuppressed: () => projectionCounters.protocolSuppressions(),\n completeSectionSuppressions: () => projectionCounters.protocolMissings(),\n partialMounts: () => [...missingMounts],\n }\n registerBoostTool(ctx, boostDeps)\n // The settings page reads through this plugin's own route, and it reads\n // through `boostDeps` — the same object the tool spreads — so `boost\n // status` and the page can never disagree about the same workspace.\n //\n // Its own try: the catch below reports a failed *tool* registration, and\n // a route that could not mount is a different fault with a different\n // remedy (the tool is the control surface; the route is only the page).\n try {\n registerHttpApi(\n ctx,\n {\n status: () => runBoost({ ...boostDeps, args: { cmd: 'status' } }),\n scope: () => runBoost({ ...boostDeps, args: { cmd: 'scope-get' } }),\n workspaces: () => listWorkspaces(registryBackend()),\n config: () => cfg,\n write: (body, baseRevision) =>\n runBoost({\n ...boostDeps,\n // The wire is untrusted: a non-number is \"no revision given\",\n // which the command already rejects with its own code. Passing\n // it through as-is would only move the type error here.\n args: {\n cmd: 'scope-set',\n body,\n ...(typeof baseRevision === 'number' ? { baseRevision } : {}),\n },\n }),\n },\n message => ctx.logger?.warn?.(message),\n )\n } catch (error) {\n ctx.logger?.warn?.(\n `dsh-boost: ${ERR_BOOST_HTTP_MOUNT_FAILED}: settings page has no data route (${messageOf(error)})`,\n )\n }\n } catch (error) {\n // The tool is the user's only control surface; its failure is reported\n // on its own, never as a hook failure.\n ctx.logger?.warn?.(\n `dsh-boost: boost tool registration failed (ERR_BOOST_TOOL_REGISTER_FAILED): ${messageOf(error)}`,\n )\n }\n } catch (error) {\n ctx.logger?.warn?.(`dsh-boost: hook registration skipped: ${messageOf(error)}`)\n }\n}\n"]}
|
package/dist/scope/doc.js
CHANGED
|
@@ -11,6 +11,14 @@ export const ERR_SCOPE_FUTURE_VERSION = 'ERR_SCOPE_FUTURE_VERSION';
|
|
|
11
11
|
export const ERR_SCOPE_PARSE_FAILED = 'ERR_SCOPE_PARSE_FAILED';
|
|
12
12
|
/** Stable rejection code: the file exists but could not be read. */
|
|
13
13
|
export const ERR_SCOPE_READ_FAILED = 'ERR_SCOPE_READ_FAILED';
|
|
14
|
+
/**
|
|
15
|
+
* Stable rejection code: the document could not be written.
|
|
16
|
+
*
|
|
17
|
+
* Distinct from `ERR_SCOPE_READ_FAILED` on purpose: the caller still holds a
|
|
18
|
+
* valid baseline, so "re-read" is the wrong advice and would throw away a
|
|
19
|
+
* draft that is perfectly good.
|
|
20
|
+
*/
|
|
21
|
+
export const ERR_SCOPE_WRITE_FAILED = 'ERR_SCOPE_WRITE_FAILED';
|
|
14
22
|
/** Stable rejection code: the write's base revision is stale. */
|
|
15
23
|
export const ERR_SCOPE_REVISION_CONFLICT = 'ERR_SCOPE_REVISION_CONFLICT';
|
|
16
24
|
/** Stable rejection code: another writer holds the scope lock. */
|