@acryldev/harness-runtime 0.2.11 → 0.2.13

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/lib/index.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["require","require","resolveDshBin","PROTECTED_PLUGIN_ENTRY_REASON","PluginLifecycleError","AcrPluginLifecycleService","PREVIEW_TTL_MS","MAX_PREVIEWS","NPM_PACKAGE_NAME_PATTERN","ID","resolvePackageImports","require","dshInstallAnchor","profileRoot","describe"],"sources":["../src/coding-capabilities.ts","../src/session-bridge.ts","../src/session-log-exporter.ts","../src/instance/offline-lock.ts","../src/instance/app-instance.ts","../src/instance/registry.ts","../src/instance/select.ts","../src/instance/announce-self.ts","../src/instance/online-secret.ts","../src/acryl-home.ts","../src/engine-host.ts","../src/web-favicon-data.ts","../src/web-favicon.ts","../src/engine-tools.ts","../src/pinned-pnpm.ts","../src/profile-layout.ts","../src/cli-market-install.ts","../src/plugin-lifecycle-state.ts","../src/plugin-lifecycle.ts","../src/cli-market-plugins.ts","../src/plugin-acryl-workspace-status.ts","../src/blueprint/brand-identity.ts","../src/blueprint/blueprint.ts","../src/blueprint/compose.ts","../src/blueprint/definition.ts","../src/blueprint/manifest.ts","../src/blueprint/selection.ts","../src/web-port.ts","../src/profile-owner.ts","../src/module-hooks.ts","../src/profile-resolution/moved-framework.ts","../src/profile-resolution/resolver.ts","../src/profile-resolution/service.ts","../src/web-market-install.ts","../src/web-market-plugins.ts","../src/engine-dsh.ts","../src/package-overlay.ts","../src/module-resolution.ts","../src/plugin-doctor.ts","../src/system-prompt-capture.ts","../src/profile-repair/backup.ts","../src/profile-repair/findings.ts","../src/profile-repair/inspector.ts","../src/profile-repair/repair.ts","../src/app/new-app.ts","../src/app/start-source.ts","../src/index.ts"],"sourcesContent":["/**\n * The Blueprint vocabulary of ACRYL's coding capabilities: which capability ids exist, which product surfaces each one declares itself for,\n * and which of them need the framework router. Blueprint parsing and the built-in IDE Blueprint are runtime domain and read this table.\n *\n * How a capability composes on a surface (its Loader rows, the packages the surface must make resolvable, the shell-mode split) lives in\n * `@acryldev/coding-capabilities`, which the surfaces compose from: the runtime decides what a Blueprint may name, the surface decides what\n * runs. The two tables must name the same ids; the composition package's test asserts it both ways (spec 051 T021).\n *\n * @module @acryldev/harness-runtime/coding-capabilities\n */\n\nexport type AcrylSurface = 'tui' | 'web' | 'desktop'\n\nexport type AcrylCodingCapabilityId =\n | 'persona'\n | 'agent-roster'\n | 'session-stats'\n | 'authorization'\n | 'acryl-settings'\n | 'workspace'\n | 'plugin-admin'\n | 'sign-in'\n | 'launcher-screen'\n | 'account-callback'\n | 'support'\n | 'agent-control-ui'\n | 'advanced-shell'\n\n/**\n * The shell a surface renders the coding UI in. `advanced` replaces the stock DSH frame with the ACRYL\n * shell (Projects list, tabbed canvas, right panel); `compatibility` keeps the stock frame. Desktop lets\n * the user choose; Web always runs `advanced`, so both surfaces share one workspace.\n */\nexport type AcrylShellMode = 'compatibility' | 'advanced'\n\n/** One capability as a Blueprint names it. Its composition (rows and packages) is `@acryldev/coding-capabilities`'. */\nexport interface AcrylCodingCapabilityDeclaration {\n readonly id: AcrylCodingCapabilityId\n /**\n * The capability serves its HTTP through the framework's router (`ctx.router`, `ctx.routerHttp`), which the `framework-kit` row brings.\n * Without that row its plugin waits PENDING with nothing said, so a Blueprint that composes it must also compose the kit.\n */\n readonly needsRouter?: boolean\n}\n\n/** Every capability a Blueprint may name, and which of them need the framework router. */\nexport const ACRYL_CODING_CAPABILITIES: readonly AcrylCodingCapabilityDeclaration[] = [\n { id: 'persona' },\n { id: 'agent-roster' },\n { id: 'session-stats' },\n { id: 'authorization' },\n { id: 'acryl-settings' },\n { id: 'workspace', needsRouter: true },\n { id: 'plugin-admin', needsRouter: true },\n { id: 'sign-in', needsRouter: true },\n { id: 'launcher-screen', needsRouter: true },\n { id: 'account-callback' },\n { id: 'support', needsRouter: true },\n { id: 'agent-control-ui', needsRouter: true },\n { id: 'advanced-shell' },\n]\n","import type { Context } from '@deepseek-ai/cordis'\nimport { installModelSelection, type Agent, type AgentHandle, type AssistantStreamFrame, type ModelSelectionRef } from '@deepseek-ai/dsh-agent'\nimport { createUserMessage } from '@deepseek-ai/dsh-llm'\nimport { SessionId, type SessionEvent } from '@deepseek-ai/dsh-session'\nimport type {} from '@deepseek-ai/dsh-agent-default-model'\nimport type {} from '@deepseek-ai/dsh-session-persistence'\n\nexport type { AssistantStreamFrame }\nimport type {\n AcrylSessionAttachment,\n AcrylSessionSnapshot,\n AcrylSessionSubscription,\n AcrylToolProjection,\n AcrylTranscriptItem,\n} from '@acryldev/control'\n\nexport interface AcrylSessionBridgeOptions {\n readonly profile: string\n readonly generationId: string\n readonly attachment: AcrylSessionAttachment\n readonly cwd: string\n}\n\nexport interface AcrylSessionEventSubscription {\n dispose(): Promise<void>\n}\n\nexport interface AcrylSessionBridge {\n open(resumeSessionId?: string): Promise<string>\n snapshot(sessionId: string): Promise<AcrylSessionSnapshot>\n /** The full durable event log for one session — the surface's replay/seed source. */\n events(sessionId: string): readonly SessionEvent[]\n subscribe(\n sessionId: string,\n listener: (snapshot: AcrylSessionSnapshot) => void,\n onError?: (error: Error) => void,\n ): Promise<AcrylSessionSubscription>\n /** Live durable-log events for one active session (streaming presentation seam). */\n subscribeEvents(\n sessionId: string,\n listener: (event: SessionEvent) => void,\n ): Promise<AcrylSessionEventSubscription>\n /**\n * Process-local live assistant-stream frames (start/chunk/end) for one\n * active session. Session format v2 no longer persists per-token\n * `assistant/chunk` events in the durable log — `agent/assistant-stream`\n * is the intentionally process-local replacement for in-progress-typing\n * presentation; the durable `assistant/message`/`assistant/attempt`\n * settlement (delivered via `subscribeEvents`) carries the same stream\n * for replay once the attempt settles.\n */\n subscribeAssistantStream(\n sessionId: string,\n listener: (frame: AssistantStreamFrame) => void,\n ): Promise<AcrylSessionEventSubscription>\n submitPrompt(input: { readonly sessionId: string; readonly text: string }): Promise<void>\n /**\n * Switch an already-open session's live model. `agentOptions.provider`/`model`\n * are a one-time construction input to `ctx.agents.create` — not a live\n * setting — so this is the only thing that changes what a running session\n * sends its next request to (`ModelSelectionRef` installed on the agent's\n * own scoped context via `installModelSelection`, per-step prompt assembly\n * reads it fresh).\n */\n selectModel(input: { readonly sessionId: string; readonly provider: string; readonly model: string }): Promise<void>\n cancel(sessionId: string): Promise<void>\n dispose(): Promise<void>\n}\n\nfunction contentText(content: readonly { readonly type: string; readonly text?: string }[]): string {\n return content\n .filter((block): block is { readonly type: 'text'; readonly text: string } => {\n return block.type === 'text' && typeof block.text === 'string'\n })\n .map(block => block.text)\n .join('')\n}\n\nfunction transcript(events: readonly SessionEvent[]): readonly AcrylTranscriptItem[] {\n const items: AcrylTranscriptItem[] = []\n for (const event of events) {\n if (event.type === 'user/message' && event.data.source.kind === 'user') {\n const text = contentText(event.data.content)\n if (text !== '') items.push(Object.freeze({ id: `event-${event.seq}`, author: 'user', text }))\n }\n if (event.type === 'assistant/message') {\n const text = contentText(event.data.message.content)\n if (text !== '') items.push(Object.freeze({ id: `event-${event.seq}`, author: 'assistant', text }))\n }\n }\n return Object.freeze(items)\n}\n\nfunction tools(events: readonly SessionEvent[]): readonly AcrylToolProjection[] {\n const current = new Map<string, AcrylToolProjection>()\n for (const event of events) {\n if (event.type === 'tool/call') {\n current.set(event.data.callId, Object.freeze({\n callId: event.data.callId,\n name: event.data.name,\n status: 'running',\n }))\n }\n if (event.type === 'tool/result') {\n const callId = event.data.message.source.callId\n const existing = current.get(callId)\n if (existing !== undefined) {\n current.set(callId, Object.freeze({ ...existing, status: 'succeeded' }))\n }\n }\n }\n return Object.freeze([...current.values()])\n}\n\nfunction status(agent: Agent): AcrylSessionSnapshot['agentStatus'] {\n return agent.status === 'running' ? 'running' : 'idle'\n}\n\n/**\n * Runtime-owned adapter over one native DSH agent/session. It creates or resumes\n * the native agent and derives every presentation value from its durable log.\n */\nexport function createAcrylSessionBridge(\n ctx: Context,\n options: AcrylSessionBridgeOptions,\n): AcrylSessionBridge {\n const handles = new Map<string, AgentHandle>()\n const modelSelections = new Map<string, ModelSelectionRef>()\n const modelSelectionDisposers = new Map<string, () => void>()\n const subscribers = new Map<string, Set<(snapshot: AcrylSessionSnapshot) => void>>()\n const eventListeners = new Map<string, Set<(event: SessionEvent) => void>>()\n const assistantStreamListeners = new Map<string, Set<(frame: AssistantStreamFrame) => void>>()\n let disposed = false\n\n const notify = (sessionId: string): void => {\n const listeners = subscribers.get(sessionId)\n if (listeners === undefined) return\n void snapshot(sessionId).then((next) => {\n for (const listener of listeners) {\n try {\n listener(next)\n } catch {\n // A presentation listener cannot disrupt durable session delivery.\n }\n }\n })\n }\n const offSessionEvent = ctx.on('session/event', (session, event) => {\n if (!handles.has(session.id)) return\n notify(session.id)\n const listeners = eventListeners.get(session.id)\n if (listeners === undefined) return\n for (const listener of listeners) {\n try {\n listener(event)\n } catch {\n // A presentation listener cannot disrupt durable session delivery.\n }\n }\n })\n // `agent/assistant-stream` is process-local and dispatched per-agent by\n // `@deepseek-ai/dsh-scope`; `{ global: true }` receives every agent's\n // frames and this bridge filters to the sessions it owns, matching the\n // pattern `dsh-api-session-controller`'s own history/follow code uses for\n // the same event.\n const offAssistantStream = ctx.on('agent/assistant-stream', ({ agent, frame }) => {\n if (!handles.has(agent.session.id)) return\n const listeners = assistantStreamListeners.get(agent.session.id)\n if (listeners === undefined) return\n for (const listener of listeners) {\n try {\n listener(frame)\n } catch {\n // A presentation listener cannot disrupt durable session delivery.\n }\n }\n }, { global: true })\n // The agent's idle/running transition is not a durable event: a turn's last event is written while the agent is still running, and the\n // return to idle follows with nothing logged, so a subscriber refreshed only on events kept showing \"running\" after every turn.\n const offAgentStatus = ctx.on('agent/status', ({ agent }) => {\n if (handles.has(agent.session.id)) notify(agent.session.id)\n }, { global: true })\n\n const snapshot = async (sessionId: string): Promise<AcrylSessionSnapshot> => {\n const agent = agentFor(sessionId)\n return Object.freeze({\n profile: options.profile,\n generationId: options.generationId,\n attachment: options.attachment,\n sessionId: agent.id,\n agentStatus: status(agent),\n transcript: transcript(agent.session.snapshotEvents()),\n tools: tools(agent.session.snapshotEvents()),\n })\n }\n\n const agentFor = (sessionId: string): Agent => {\n if (disposed) throw new Error('ACRYL session bridge is disposed')\n const handle = handles.get(sessionId)\n if (handle === undefined) throw new Error(`ACRYL session ${sessionId} is not active`)\n return handle.agent\n }\n\n return Object.freeze({\n async open(resumeSessionId?: string): Promise<string> {\n if (disposed) throw new Error('ACRYL session bridge is disposed')\n if (handles.size !== 0) throw new Error('ACRYL session bridge already has an active session')\n const defaultModel = ctx.get('agentDefaultModel')\n if (defaultModel === undefined) throw new Error('ACRYL profile has no default agent model')\n const selection = defaultModel.currentSelection()\n const handle = resumeSessionId === undefined\n ? await ctx.agents.create({\n sessionId: SessionId(`acryl-session-${crypto.randomUUID()}`),\n meta: { cwd: options.cwd },\n agentOptions: { provider: selection.provider, model: selection.model },\n })\n : await ctx.agents.resume({\n resumeSessionId: SessionId(resumeSessionId),\n agentOptions: { provider: selection.provider, model: selection.model },\n })\n handles.set(handle.agent.id, handle)\n const ref: ModelSelectionRef = { current: undefined, assembled: undefined }\n modelSelectionDisposers.set(handle.agent.id, installModelSelection(handle.agent.ctx, ref))\n modelSelections.set(handle.agent.id, ref)\n return handle.agent.id\n },\n snapshot,\n events(sessionId: string): readonly SessionEvent[] {\n return agentFor(sessionId).session.snapshotEvents()\n },\n async subscribe(\n sessionId: string,\n listener: (snapshot: AcrylSessionSnapshot) => void,\n _onError?: (error: Error) => void,\n ): Promise<AcrylSessionSubscription> {\n agentFor(sessionId)\n const listeners = subscribers.get(sessionId) ?? new Set()\n subscribers.set(sessionId, listeners)\n listeners.add(listener)\n try {\n listener(await snapshot(sessionId))\n } catch {\n // Presentation listeners cannot disrupt durable session delivery.\n }\n let active = true\n return Object.freeze({\n whenError(): Promise<Error> { return new Promise<Error>(() => {}) },\n async dispose(): Promise<void> {\n if (!active) return\n active = false\n listeners.delete(listener)\n if (listeners.size === 0) subscribers.delete(sessionId)\n },\n })\n },\n async subscribeEvents(\n sessionId: string,\n listener: (event: SessionEvent) => void,\n ): Promise<AcrylSessionEventSubscription> {\n agentFor(sessionId)\n const listeners = eventListeners.get(sessionId) ?? new Set()\n eventListeners.set(sessionId, listeners)\n listeners.add(listener)\n let active = true\n return Object.freeze({\n async dispose(): Promise<void> {\n if (!active) return\n active = false\n listeners.delete(listener)\n if (listeners.size === 0) eventListeners.delete(sessionId)\n },\n })\n },\n async subscribeAssistantStream(\n sessionId: string,\n listener: (frame: AssistantStreamFrame) => void,\n ): Promise<AcrylSessionEventSubscription> {\n agentFor(sessionId)\n const listeners = assistantStreamListeners.get(sessionId) ?? new Set()\n assistantStreamListeners.set(sessionId, listeners)\n listeners.add(listener)\n let active = true\n return Object.freeze({\n async dispose(): Promise<void> {\n if (!active) return\n active = false\n listeners.delete(listener)\n if (listeners.size === 0) assistantStreamListeners.delete(sessionId)\n },\n })\n },\n async submitPrompt(input: { readonly sessionId: string; readonly text: string }): Promise<void> {\n const agent = agentFor(input.sessionId)\n if (input.text.trim() === '') throw new Error('ACRYL prompt must not be empty')\n const accepted = new Promise<void>((resolve) => {\n const off = ctx.on('session/event', (session, event) => {\n if (session !== agent.session || event.type !== 'user/message') return\n off()\n resolve()\n })\n })\n agent.followup(createUserMessage({\n content: [{ type: 'text', text: input.text }],\n source: { kind: 'user' },\n }))\n await accepted\n },\n async selectModel(input: { readonly sessionId: string; readonly provider: string; readonly model: string }): Promise<void> {\n agentFor(input.sessionId)\n const ref = modelSelections.get(input.sessionId)\n if (ref === undefined) throw new Error(`ACRYL session ${input.sessionId} has no installed model selection`)\n ref.current = { provider: input.provider, model: input.model }\n },\n async cancel(sessionId: string): Promise<void> {\n agentFor(sessionId).cancel({ kind: 'user' })\n },\n async dispose(): Promise<void> {\n if (disposed) return\n disposed = true\n offSessionEvent()\n offAssistantStream()\n offAgentStatus()\n subscribers.clear()\n eventListeners.clear()\n assistantStreamListeners.clear()\n for (const dispose of modelSelectionDisposers.values()) dispose()\n modelSelectionDisposers.clear()\n modelSelections.clear()\n // Durable continuity: idle the turn, checkpoint the session log, then\n // release the native handle. Mirror of Tomo's shutdown sequence, owned\n // here so every surface gets the same durability guarantee.\n const activeHandles = [...handles.values()]\n handles.clear()\n const sessions = ctx.get('sessions')\n for (const handle of activeHandles) {\n try {\n await handle.agent.whenIdle()\n } catch {\n // A disposing agent has no obligation to be idle; proceed to release.\n }\n try {\n await sessions?.flush(handle.agent.session)\n } catch {\n // Flush is best-effort on dispose; persistence already ran per event.\n }\n }\n await Promise.all(activeHandles.map(handle => handle.dispose()))\n },\n })\n}\n","/**\n * A durable, cross-surface debug log for ACRYL sessions.\n *\n * Cordis's own `ctx.logger` already carries every structured log record any\n * plugin emits, but nothing in this stack persisted it anywhere — a failure\n * like a vendored provider's OAuth error only ever reached the terminal\n * transcript, gone the moment the pane scrolled or the process exited. This\n * registers one JSONL file exporter on `ctx.logger` per surface (CLI/TUI,\n * web, and — once wired there too — the desktop GUI), so `error`/`warn`\n * records (and everything, when `ACRYL_LOG_LEVEL=debug`) survive the session\n * and can be read back after the fact instead of re-derived from a\n * screenshot.\n *\n * @module @acryldev/harness-runtime/session-log-exporter\n */\n\nimport { appendFileSync, mkdirSync } from 'node:fs'\nimport { join } from 'node:path'\nimport type { Context } from '@deepseek-ai/cordis'\n\nexport interface InstallSessionLogExporterOptions {\n /** Which ACRYL surface this process is (`tui`, `web`, `desktop`) — becomes part of the log filename. */\n readonly surface: string\n /** The app instance's harness home (`instance.dshHome`): where `logs/` lives. Always explicit, never resolved from the environment here. */\n readonly dshHome: string\n}\n\nconst LOGGER_LEVEL_WARN = 2\nconst LOGGER_LEVEL_DEBUG = 3\n\n/**\n * Register the file exporter for this process's lifetime. `ctx.logger.exporter()`\n * already ties its own disposal to the fiber that registers it (see\n * `LoggerService.exporter` in `@deepseek-ai/cordis`), so this needs no extra\n * `ctx.effect()` wrapper of its own.\n * @param ctx - the plugin context whose `ctx.logger` gains the exporter.\n * @param options - which surface/home this log file belongs to.\n */\nexport function installSessionLogExporter(ctx: Context, options: InstallSessionLogExporterOptions): void {\n const { dshHome } = options\n const logDir = join(dshHome, 'logs')\n try {\n mkdirSync(logDir, { recursive: true, mode: 0o700 })\n } catch {\n return // best-effort diagnostics only; a session must never fail to start over this\n }\n const day = new Date().toISOString().slice(0, 10)\n const logFile = join(logDir, `acryl-${options.surface}-${day}.jsonl`)\n const threshold = process.env.ACRYL_LOG_LEVEL === 'debug' ? LOGGER_LEVEL_DEBUG : LOGGER_LEVEL_WARN\n\n ctx.logger.exporter({\n export(message) {\n if (message.level > threshold) return\n try {\n appendFileSync(logFile, `${JSON.stringify({\n ts: new Date(message.ts).toISOString(),\n type: message.type,\n name: message.name,\n args: message.args.map(arg => (arg instanceof Error\n ? { message: arg.message, stack: arg.stack, name: arg.name }\n : arg)),\n })}\\n`, { mode: 0o600 })\n } catch {\n // best-effort: a write failure here must never take a session down\n }\n },\n })\n}\n","/**\n * Pessimistic Offline Lock (Patterns of Enterprise Application Architecture), with the book's conditions met: ownership is visible (the file says who\n * holds it), and a stale lock (its holder's process is gone) is taken over instead of blocking forever. Used for \"one live process per app\" and \"one live\n * installation per profile\".\n *\n * @module @acryldev/harness-runtime/instance/offline-lock\n */\n\nimport { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'\nimport { dirname } from 'node:path'\n\nexport interface LockHolder {\n readonly pid: number\n readonly since: string\n readonly [detail: string]: unknown\n}\n\nexport class LockHeldError extends Error {\n readonly holder: LockHolder\n constructor(message: string, holder: LockHolder) {\n super(message)\n this.name = 'LockHeldError'\n this.holder = holder\n }\n}\n\nexport function processIsAlive(pid: number): boolean {\n try {\n process.kill(pid, 0)\n return true\n } catch (error) {\n return (error as NodeJS.ErrnoException).code === 'EPERM'\n }\n}\n\nexport function readLock(file: string): LockHolder | undefined {\n if (!existsSync(file)) return undefined\n try {\n const value = JSON.parse(readFileSync(file, 'utf8')) as Partial<LockHolder>\n return Number.isInteger(value.pid) ? value as LockHolder : undefined\n } catch {\n return undefined\n }\n}\n\n/**\n * Take the lock for `pid`. Refused (LockHeldError, with a message built by `describe`) when a live holder exists that `compatible` does not accept.\n * `compatible` lets a lock admit its own kind (the same installation, the same process).\n */\nexport function acquireLock(\n file: string,\n holder: Omit<LockHolder, 'since'>,\n options: {\n readonly alive?: (pid: number) => boolean\n readonly compatible?: (current: LockHolder) => boolean\n readonly describe?: (current: LockHolder) => string\n } = {},\n): void {\n const alive = options.alive ?? processIsAlive\n const current = readLock(file)\n if (current !== undefined && current.pid !== holder.pid && alive(current.pid) && options.compatible?.(current) !== true) {\n throw new LockHeldError(options.describe?.(current) ?? `${file} is held by pid ${String(current.pid)}`, current)\n }\n mkdirSync(dirname(file), { recursive: true, mode: 0o700 })\n writeFileSync(file, `${JSON.stringify({ ...holder, since: new Date().toISOString() }, null, 2)}\\n`, { mode: 0o600 })\n}\n\n/** Release only our own hold: never remove a lock a newer holder took after ours went stale. */\nexport function releaseLock(file: string, pid: number = process.pid): void {\n if (readLock(file)?.pid === pid) rmSync(file, { force: true })\n}\n","/**\n * AppInstance: everything one running ACRYL app owns on this machine, as one consistent family (spec 036, \"Self-containment\").\n *\n * Patterns, by the books in the repo's engineering rules:\n * - **Bulkhead** (Release It!): each app is a sealed compartment; nothing it owns is reachable from another app.\n * - **Abstract Factory** (refactoring.guru): the factories below produce a whole family of resources (home, engine home, port, Electron user data, run lock,\n * project scope) that always belong together; a caller cannot mix one app's home with another app's port.\n * - **Deep module / information hiding** (A Philosophy of Software Design): \"where an app keeps things\" is decided here and nowhere else.\n * - The instance is chosen once, in the composition root (Clean Architecture's Main), by `select.ts`, the only code that reads the environment or the OS home.\n *\n * Pure: no I/O. Paths are built, never checked; `select.ts` does the few filesystem checks that choose a factory.\n *\n * @module @acryldev/harness-runtime/instance/app-instance\n */\n\nimport { createHash } from 'node:crypto'\nimport { basename, join } from 'node:path'\n\n/** How the instance was chosen. Only `default` may use the shared `~/.acryl`. */\nexport type AppInstanceKind = 'default' | 'development' | 'worktree' | 'app' | 'managed' | 'pinned'\n\nexport interface AppInstance {\n readonly kind: AppInstanceKind\n /** Unique on this machine: it seeds the port, names the Electron user data and namespaces project folders. */\n readonly id: string\n /** Human name (the folder name for an app). */\n readonly name: string\n /** The ACRYL home: settings, sessions, profiles (under `dshHome`), global extensions, runtime state. */\n readonly home: string\n /** The DSH engine home the pinned harness reads (`DSH_HOME`). */\n readonly dshHome: string\n /** First Web port to try, and whether to move to the next free one when it is taken. */\n readonly webPort: { readonly start: number, readonly scan: boolean }\n /**\n * Who may reach the Web server: the address it listens on (loopback unless a caller such as a container entry point asks for `0.0.0.0`) and the extra\n * names a browser reaches it by (a proxy's public host). Non-loopback names must be listed, or DSH's connection refuses the request.\n */\n readonly webAccess: WebAccess\n /** Electron's product name for this instance, and the name of its user-data folder before it moved into the home (read once, to carry that data over). */\n readonly userDataName: string\n /**\n * Electron's user data (window state, storage, logs, crash evidence, the single-instance lock), inside the app's own home like everything else it keeps,\n * never in an OS application-data folder: one predictable place on every OS (`~/.acryl/desktop-data` for the installed app).\n */\n readonly userDataDir: string\n /** Namespace for folders this app writes inside a project it opens; undefined keeps the classic shared locations. */\n readonly projectScope?: string\n /**\n * Where the chat creates its first workspace, when this app must not use the OS user's Documents folder. DSH asks the operating system for that folder\n * (not `$HOME`), so an isolated app would otherwise write its first project into the real one. Only the default instance, which is the user's installed\n * app, uses the OS Documents folder; every other instance keeps it inside its own home.\n */\n readonly documentsDirectory?: string\n /** The app definition (`blend.yaml`) when this is an app folder. */\n readonly definitionFile?: string\n /** The pessimistic offline lock that makes one live process per instance. */\n readonly runLockFile: string\n}\n\n/** See {@link AppInstance.webAccess}. */\nexport interface WebAccess {\n readonly host: string\n readonly trustedHosts: readonly string[]\n}\n\nexport const LOOPBACK_WEB_HOST = '127.0.0.1'\n/** Bind addresses a caller may choose: loopback, or every interface (a container, where the network boundary is the container's own). */\nexport const WEB_HOSTS: readonly string[] = Object.freeze([LOOPBACK_WEB_HOST, '0.0.0.0', '::1', '::'])\nexport const DEFAULT_WEB_PORT = 3080\nexport const WORKTREE_WEB_PORT = 3081\nexport const APP_PORT_BASE = 3100\nexport const APP_PORT_SPAN = 900\nexport const APP_DEFINITION_FILE = 'blend.yaml'\nexport const RUN_LOCK_FILE = 'instance.json'\nexport const USER_DATA_DIR_NAME = 'desktop-data'\nexport const ENGINE_DIR_NAME = '.dsh'\nexport const DEFAULT_HOME_DIR_NAME = '.acryl'\nexport const DEVELOPMENT_HOME_DIR_NAME = '.acryl-dev'\nexport const WORKTREE_HOMES_DIR_NAME = '.acryl-worktrees'\nexport const MANAGED_HOMES_DIR_NAME = '.acryl-instances'\n\nconst NAME = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u\n/** A project-scope id (the extension pack validates the same shape before building a path from it). */\nexport const PROJECT_SCOPE = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u\nexport const PROJECT_SCOPE_MAX = 64\nconst TRUSTED_HOST = /^[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?(?::\\d{1,5})?$/u\nconst LOOPBACK_ACCESS: WebAccess = Object.freeze({ host: LOOPBACK_WEB_HOST, trustedHosts: Object.freeze([]) })\n\nexport class AppInstanceError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'AppInstanceError'\n }\n}\n\n/** A plain app name: lowercase letters, digits and dashes, at most 32. It becomes a folder, an app name and a port seed. */\nexport function appName(value: unknown): string {\n if (typeof value !== 'string' || !NAME.test(value) || value.length > 32) throw new AppInstanceError(`an app name is lowercase letters, digits and dashes (at most 32), got ${JSON.stringify(value)}`)\n return value\n}\n\n/** FNV-1a over the id: stable across runs and platforms, spreads ids over the app port range. */\nexport function stablePort(id: string): number {\n let hash = 0x811c9dc5\n for (const character of id) {\n hash ^= character.codePointAt(0) ?? 0\n hash = Math.imul(hash, 0x01000193) >>> 0\n }\n return APP_PORT_BASE + (hash % APP_PORT_SPAN)\n}\n\nfunction family(input: {\n kind: AppInstanceKind\n id: string\n name: string\n home: string\n dshHome?: string\n webPort: AppInstance['webPort']\n userDataName: string\n projectScope?: string\n definitionFile?: string\n}): AppInstance {\n return Object.freeze({\n kind: input.kind,\n id: input.id,\n name: input.name,\n home: input.home,\n dshHome: input.dshHome ?? join(input.home, ENGINE_DIR_NAME),\n webPort: Object.freeze({ ...input.webPort }),\n webAccess: LOOPBACK_ACCESS,\n userDataName: input.userDataName,\n userDataDir: join(input.home, USER_DATA_DIR_NAME),\n ...(input.projectScope === undefined ? {} : { projectScope: input.projectScope }),\n ...(input.kind === 'default' ? {} : { documentsDirectory: join(input.home, 'documents') }),\n ...(input.definitionFile === undefined ? {} : { definitionFile: input.definitionFile }),\n runLockFile: join(input.home, RUN_LOCK_FILE),\n })\n}\n\n/** Plain ACRYL, nothing configured: the one instance allowed to use the shared `~/.acryl`. */\nexport function defaultInstance(osHome: string): AppInstance {\n return family({ kind: 'default', id: 'acryl', name: 'acryl', home: join(osHome, DEFAULT_HOME_DIR_NAME), webPort: { start: DEFAULT_WEB_PORT, scan: false }, userDataName: 'ACRYL' })\n}\n\n/** The isolated local development app of the main checkout (`pnpm run dev`). */\nexport function developmentInstance(osHome: string): AppInstance {\n return family({ kind: 'development', id: 'acryl-dev', name: 'acryl-dev', home: join(osHome, DEVELOPMENT_HOME_DIR_NAME), webPort: { start: DEFAULT_WEB_PORT, scan: true }, userDataName: 'ACRYL Development' })\n}\n\n/** A second checkout (a git worktree): never the main checkout's home, port or Electron app. */\nexport function worktreeInstance(osHome: string, checkoutRoot: string): AppInstance {\n const folder = basename(checkoutRoot).replace(/[^A-Za-z0-9._-]+/gu, '-')\n const scope = `worktree-${folder.toLowerCase().replace(/[^a-z0-9]+/gu, '-').replace(/^-+|-+$/gu, '')}`.slice(0, PROJECT_SCOPE_MAX).replace(/-+$/u, '')\n return family({ kind: 'worktree', id: scope, name: folder, home: join(osHome, WORKTREE_HOMES_DIR_NAME, folder), webPort: { start: WORKTREE_WEB_PORT, scan: true }, userDataName: `ACRYL Development ${folder}`, projectScope: scope })\n}\n\n/**\n * An app folder (`acryl new`): the folder is the home. Two folders may share a name, so a folder's id carries a short digest of its real path; a managed app\n * (kept under `~/.acryl-instances/<name>`) is unique by name.\n */\nexport function appFolderInstance(realFolder: string, managed: boolean): AppInstance {\n const name = appName(basename(realFolder))\n const id = managed ? name : `${name}-${createHash('sha1').update(realFolder).digest('hex').slice(0, 4)}`\n return family({ kind: managed ? 'managed' : 'app', id, name, home: realFolder, webPort: { start: stablePort(id), scan: true }, userDataName: `ACRYL ${id}`, projectScope: id, definitionFile: join(realFolder, APP_DEFINITION_FILE) })\n}\n\n/** A home a caller pinned explicitly (ACRYL_HOME without an app definition, or a legacy DSH_HOME): honoured as given. */\nexport function pinnedInstance(home: string, dshHome?: string): AppInstance {\n const name = basename(home).replace(/^\\.+/u, '') || 'acryl'\n return family({ kind: 'pinned', id: `pinned-${createHash('sha1').update(home).digest('hex').slice(0, 6)}`, name, home, ...(dshHome === undefined ? {} : { dshHome }), webPort: { start: DEFAULT_WEB_PORT, scan: false }, userDataName: 'ACRYL' })\n}\n\n/** The same family with an explicit port preference (ACRYL_WEB_PORT). Explicit always scans: the caller asked for a start, not a fight. */\nexport function withWebPort(instance: AppInstance, start: number): AppInstance {\n if (!Number.isInteger(start) || start < 1024 || start > 65_535) throw new AppInstanceError(`the web port must be a port number from 1024 to 65535, got ${String(start)}`)\n return Object.freeze({ ...instance, webPort: Object.freeze({ start, scan: true }) })\n}\n\n/**\n * The same family reachable beyond loopback (ACRYL_WEB_HOST, ACRYL_WEB_TRUSTED_HOSTS). The trusted names are checked again, strictly, by DSH's connection\n * plugin at load; this only refuses what is plainly not a host name so the mistake surfaces at selection, with the variable's name.\n */\nexport function withWebAccess(instance: AppInstance, host: string, trustedHosts: readonly string[]): AppInstance {\n if (!WEB_HOSTS.includes(host)) throw new AppInstanceError(`the web host must be one of ${WEB_HOSTS.join(', ')}, got ${JSON.stringify(host)}`)\n for (const name of trustedHosts) {\n if (!TRUSTED_HOST.test(name)) throw new AppInstanceError(`a trusted web host is a host name with an optional port (such as ws-1.example.com or ws-1.example.com:443), got ${JSON.stringify(name)}`)\n }\n return Object.freeze({ ...instance, webAccess: Object.freeze({ host, trustedHosts: Object.freeze([...trustedHosts]) }) })\n}\n\n/** A project-scope override (ACRYL_INSTANCE) for a pinned home. */\nexport function withProjectScope(instance: AppInstance, scope: string): AppInstance {\n if (!PROJECT_SCOPE.test(scope) || scope.length > PROJECT_SCOPE_MAX) throw new AppInstanceError(`a project scope is lowercase letters, digits and dashes (at most ${String(PROJECT_SCOPE_MAX)}), got ${JSON.stringify(scope)}`)\n return Object.freeze({ ...instance, projectScope: scope })\n}\n\n/**\n * The environment contract that hands an instance to a child process or to the pinned harness. It is the ONLY way an instance crosses a process\n * boundary: the child's `select.ts` reads these exact values back into the same family.\n */\nexport function instanceEnvironment(instance: AppInstance): Record<string, string> {\n // The default instance is what a child derives with nothing set, so it adds nothing (and never pins the shared home by accident).\n if (instance.kind === 'default') return {}\n // A home pinned only through a legacy DSH_HOME round-trips as DSH_HOME alone: an ACRYL_HOME would outrank it and nest a different engine home.\n const engineOnly = instance.kind === 'pinned' && instance.dshHome !== join(instance.home, ENGINE_DIR_NAME)\n return {\n ...(engineOnly ? {} : { ACRYL_HOME: instance.home }),\n DSH_HOME: instance.dshHome,\n ...(instance.webPort.scan ? { ACRYL_WEB_PORT: String(instance.webPort.start) } : {}),\n ...(instance.webAccess.host === LOOPBACK_WEB_HOST ? {} : { ACRYL_WEB_HOST: instance.webAccess.host }),\n ...(instance.webAccess.trustedHosts.length === 0 ? {} : { ACRYL_WEB_TRUSTED_HOSTS: instance.webAccess.trustedHosts.join(',') }),\n ACRYL_LOCAL_PRODUCT_NAME: instance.userDataName,\n ...(instance.projectScope === undefined ? {} : { ACRYL_INSTANCE: instance.projectScope }),\n }\n}\n\nexport function profileDir(instance: AppInstance, profileName: string): string {\n return join(instance.dshHome, 'profiles', profileName)\n}\n\n/**\n * The run lock file that owns a given engine home, for a caller that was handed a `dshHome` directly (the CLI\n * rescue tools, `--home`) rather than a full `AppInstance`. Inverts `family()`'s default nesting\n * (`dshHome = join(home, ENGINE_DIR_NAME)`): when `dshHome`'s last segment is `.dsh`, its app home is the parent;\n * otherwise `dshHome` was handed in as the home itself (a pinned instance may point `dshHome` anywhere), so it is\n * its own app home. Pure path math, no I/O: it does not choose an instance, only locates the lock file for one\n * a caller already resolved, so it does not compete with `select.ts` for \"the one place an app is chosen\".\n */\nexport function runLockFileForDshHome(dshHome: string): string {\n const home = basename(dshHome) === ENGINE_DIR_NAME ? join(dshHome, '..') : dshHome\n return join(home, RUN_LOCK_FILE)\n}\n\nconst USER_DATA_NAME = /^[A-Za-z0-9.][A-Za-z0-9._ -]{0,63}$/u\n\n/** The Electron user-data name (ACRYL_LOCAL_PRODUCT_NAME): a plain folder name, never a path, so it cannot escape the user-data root. */\nexport function withUserDataName(instance: AppInstance, name: string): AppInstance {\n if (!USER_DATA_NAME.test(name) || name.includes('..')) throw new AppInstanceError(`the Electron user-data name must be a plain folder name, got ${JSON.stringify(name)}`)\n return Object.freeze({ ...instance, userDataName: name })\n}\n","/**\n * Registry (Patterns of Enterprise Application Architecture) of running apps: each running app announces itself with one small file, so `ps` finds apps\n * wherever their folders are. An announcement whose process is gone is dropped when read. The registry lives in the OS user's `~/.acryl-instances/.running`\n * and holds only pointers (id, folder, pid, surface, port), never app data.\n *\n * @module @acryldev/harness-runtime/instance/registry\n */\n\nimport { existsSync, mkdirSync, readdirSync, rmSync, writeFileSync } from 'node:fs'\nimport { join } from 'node:path'\nimport { MANAGED_HOMES_DIR_NAME, type AppInstance } from './app-instance.ts'\nimport { processIsAlive, readLock } from './offline-lock.ts'\n\nexport interface RunningApp {\n readonly id: string\n readonly name: string\n readonly home: string\n readonly pid: number\n readonly surface?: string\n readonly definition?: string\n readonly port?: number\n readonly since?: string\n}\n\nexport function registryDir(osHome: string): string {\n return join(osHome, MANAGED_HOMES_DIR_NAME, '.running')\n}\n\nexport function announce(osHome: string, instance: AppInstance, info: { readonly pid: number, readonly surface?: string, readonly port?: number }): void {\n const dir = registryDir(osHome)\n mkdirSync(dir, { recursive: true, mode: 0o700 })\n const entry = { id: instance.id, name: instance.name, home: instance.home, ...(instance.definitionFile === undefined ? {} : { definition: instance.definitionFile }), ...info, since: new Date().toISOString() }\n writeFileSync(join(dir, `${instance.id}.json`), `${JSON.stringify(entry, null, 2)}\\n`, { mode: 0o600 })\n}\n\nexport function withdraw(osHome: string, instance: AppInstance, pid: number = process.pid): void {\n const file = join(registryDir(osHome), `${instance.id}.json`)\n if (readLock(file)?.pid === pid) rmSync(file, { force: true })\n}\n\nexport function listRunning(osHome: string, alive: (pid: number) => boolean = processIsAlive): readonly RunningApp[] {\n const dir = registryDir(osHome)\n if (!existsSync(dir)) return []\n const running: RunningApp[] = []\n for (const entry of readdirSync(dir)) {\n const file = join(dir, entry)\n const value = readLock(file) as unknown as RunningApp | undefined\n if (value === undefined) continue\n if (!alive(value.pid)) { rmSync(file, { force: true }); continue }\n running.push(value)\n }\n return running.sort((a, b) => a.id.localeCompare(b.id))\n}\n","/**\n * The composition-root selector: the ONLY code in ACRYL that reads the environment or the OS home to decide where an app lives (a test enforces it).\n * Everything else receives an `AppInstance`, or reads it from the `appInstance` Cordis service.\n *\n * Precedence, highest first:\n * ACRYL_HOME with a `blend.yaml` an app folder (managed when it sits in ~/.acryl-instances)\n * ACRYL_HOME a pinned home\n * DSH_HOME (legacy) a pinned engine home; the ACRYL home is its parent when it is named `.dsh`\n * checkout is a git worktree the worktree's own home\n * development requested ~/.acryl-dev (the main checkout's `pnpm run dev`)\n * nothing the default ~/.acryl\n * then ACRYL_WEB_PORT (explicit start port), ACRYL_WEB_HOST and ACRYL_WEB_TRUSTED_HOSTS (reachable beyond loopback, comma-separated names), ACRYL_INSTANCE (explicit project scope) and ACRYL_LOCAL_PRODUCT_NAME (Electron user data) refine the\n * chosen family: they are how `instanceEnvironment` hands a family to a child process.\n *\n * @module @acryldev/harness-runtime/instance/select\n */\n\nimport { existsSync, realpathSync, statSync } from 'node:fs'\nimport { homedir } from 'node:os'\nimport { basename, dirname, join, resolve } from 'node:path'\nimport {\n APP_DEFINITION_FILE,\n DEFAULT_HOME_DIR_NAME,\n DEVELOPMENT_HOME_DIR_NAME,\n ENGINE_DIR_NAME,\n MANAGED_HOMES_DIR_NAME,\n WORKTREE_HOMES_DIR_NAME,\n appFolderInstance,\n appName,\n defaultInstance,\n withWebAccess,\n developmentInstance,\n pinnedInstance,\n withProjectScope,\n withUserDataName,\n withWebPort,\n worktreeInstance,\n type AppInstance,\n} from './app-instance.ts'\n\nexport interface SelectInstanceOptions {\n readonly env?: Readonly<Record<string, string | undefined>>\n readonly osHome?: string\n /** The checkout a development launcher runs from; a git worktree gets its own instance. */\n readonly checkout?: string\n /** The main checkout's isolated development app (`pnpm run dev`) rather than the default. */\n readonly development?: boolean\n}\n\n/**\n * Set by a gate, a smoke or a live-run launcher: this process tree must run in an explicitly isolated home. With it set, `selectInstance` refuses (fails\n * closed) to choose a home that is not pinned by the caller or that lies inside a real ACRYL or DSH home of the OS user, so a forgotten override ends in an\n * error naming the fix, never in a write to the installed app's data.\n */\nexport const REQUIRE_ISOLATED_HOME_ENV = 'ACRYL_REQUIRE_ISOLATED_HOME'\n\nexport class IsolationRequiredError extends Error {\n constructor(detail: string) {\n super(`${REQUIRE_ISOLATED_HOME_ENV} is set, so this run needs an explicitly isolated home: ${detail}. Pin ACRYL_HOME (and DSH_HOME) to a throwaway folder outside the OS user's real ACRYL and DSH homes.`)\n this.name = 'IsolationRequiredError'\n }\n}\n\nconst REAL_HOME_FOLDERS = [DEFAULT_HOME_DIR_NAME, DEVELOPMENT_HOME_DIR_NAME, WORKTREE_HOMES_DIR_NAME, MANAGED_HOMES_DIR_NAME, ENGINE_DIR_NAME]\n\nconst inside = (path: string, folder: string): boolean => path === folder || path.startsWith(`${folder}/`) || path.startsWith(`${folder}\\\\`)\n\nfunction assertIsolated(instance: AppInstance, osHome: string): void {\n if (instance.kind !== 'pinned' && instance.kind !== 'app') throw new IsolationRequiredError(`the ${instance.kind} instance would use ${instance.home}`)\n const realHomes = REAL_HOME_FOLDERS.map(folder => real(join(osHome, folder)))\n for (const [label, path] of [['home', instance.home], ['engine home', instance.dshHome]] as const) {\n const resolved = real(path)\n const hit = realHomes.find(folder => inside(resolved, folder))\n if (hit !== undefined) throw new IsolationRequiredError(`the ${label} ${resolved} lies inside the real ${hit}`)\n }\n}\n\nconst set = (value: string | undefined): value is string => value !== undefined && value.trim() !== ''\n\nfunction real(path: string): string {\n try { return realpathSync(path) } catch { return resolve(path) }\n}\n\n/** Is this checkout a git worktree (its `.git` is a file pointing at the main repository)? */\nexport function isGitWorktree(checkoutRoot: string): boolean {\n const git = join(checkoutRoot, '.git')\n return existsSync(git) && statSync(git).isFile()\n}\n\n/** The OS user's home directory: exported only so the dev launchers need not read it themselves. */\nexport function osHomeDirectory(): string {\n return homedir()\n}\n\n/** An app folder given by path (`bin/acryl`, `--dir`), whether or not it is the environment's choice. */\nexport function appFolder(folder: string, osHome: string = homedir()): AppInstance {\n const root = real(folder)\n const managedRoot = real(join(osHome, MANAGED_HOMES_DIR_NAME))\n return appFolderInstance(root, dirname(root) === managedRoot)\n}\n\n/** A managed app by name: `~/.acryl-instances/<name>`. */\nexport function managedApp(name: string, osHome: string = homedir()): AppInstance {\n // Validate before building a path: a name such as `../x` must never reach outside the managed root.\n return appFolderInstance(join(osHome, MANAGED_HOMES_DIR_NAME, appName(name)), true)\n}\n\nexport function selectInstance(options: SelectInstanceOptions = {}): AppInstance {\n const env = options.env ?? process.env\n const osHome = options.osHome ?? homedir()\n let chosen: AppInstance\n if (set(env.ACRYL_HOME)) {\n const home = resolve(env.ACRYL_HOME.trim())\n chosen = existsSync(join(home, APP_DEFINITION_FILE)) ? appFolder(home, osHome) : pinnedInstance(home)\n } else if (set(env.DSH_HOME)) {\n const dshHome = resolve(env.DSH_HOME.trim())\n chosen = pinnedInstance(basename(dshHome) === ENGINE_DIR_NAME ? dirname(dshHome) : dshHome, dshHome)\n } else if (options.checkout !== undefined && isGitWorktree(options.checkout)) {\n chosen = worktreeInstance(osHome, options.checkout)\n } else if (options.development === true) {\n chosen = developmentInstance(osHome)\n } else {\n chosen = defaultInstance(osHome)\n }\n if (set(env.ACRYL_WEB_PORT)) chosen = withWebPort(chosen, Number(env.ACRYL_WEB_PORT.trim()))\n if (set(env.ACRYL_WEB_HOST) || set(env.ACRYL_WEB_TRUSTED_HOSTS)) {\n const trusted = (env.ACRYL_WEB_TRUSTED_HOSTS ?? '').split(',').map(name => name.trim()).filter(name => name.length > 0)\n chosen = withWebAccess(chosen, set(env.ACRYL_WEB_HOST) ? env.ACRYL_WEB_HOST.trim() : chosen.webAccess.host, trusted)\n }\n if (set(env.ACRYL_INSTANCE) && chosen.kind === 'pinned') chosen = withProjectScope(chosen, env.ACRYL_INSTANCE.trim())\n if (set(env.ACRYL_LOCAL_PRODUCT_NAME)) chosen = withUserDataName(chosen, env.ACRYL_LOCAL_PRODUCT_NAME.trim())\n if (set(env[REQUIRE_ISOLATED_HOME_ENV])) assertIsolated(chosen, osHome)\n return chosen\n}\n","/**\n * A composition root's own claim and announcement (spec 048 T011). The process that serves an app takes the app's run lock and writes its Registry entry\n * once it knows the address it really listens on, and gives both back when it exits; `acryl control list` then finds every running app, whichever launcher\n * started it. A launcher that only spawns the app (scripts/blank.mjs, the dev runners) no longer holds the lock: the process that serves the app does, so a\n * stop signal reaches it directly and the port in the Registry is the bound one, not the one that was asked for.\n *\n * @module @acryldev/harness-runtime/instance/announce-self\n */\n\nimport type { AppInstance } from './app-instance.ts'\nimport { acquireLock, LockHeldError, releaseLock } from './offline-lock.ts'\nimport { announce, withdraw } from './registry.ts'\nimport { osHomeDirectory } from './select.ts'\n\n/** What the running process tells the Registry about itself. */\nexport interface SelfAnnouncementInfo {\n /** The surface serving the app: `web`, `desktop` or `cli`. */\n readonly surface: string\n /** The port it is listening on, when the surface serves one. */\n readonly port?: number\n /** The announcing process; defaults to this one. */\n readonly pid?: number\n /** The OS user's home holding the Registry; defaults to the real one (the selector is the only reader of it). */\n readonly osHome?: string\n /** How to tell whether a holder is still alive; defaults to the process table. */\n readonly alive?: (pid: number) => boolean\n}\n\n/** The claim and announcement this process holds, and the one call that gives them back. */\nexport interface SelfAnnouncement {\n readonly id: string\n readonly port?: number\n /** Take the announcement and the lock back. Idempotent, and it never removes another process's claim. */\n release(): void\n}\n\n/** Refused because another live process already runs this app. */\nexport class InstanceAnnounceError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'InstanceAnnounceError'\n }\n}\n\nfunction describeHolder(instance: AppInstance, holder: { readonly pid: number, readonly [key: string]: unknown }): string {\n const surface = typeof holder.surface === 'string' ? `, ${holder.surface}` : ''\n const port = typeof holder.port === 'number' ? `, port ${String(holder.port)}` : ''\n return `app \"${instance.id}\" is already running (pid ${String(holder.pid)}${surface}${port}). Stop it (node scripts/instances.mjs stop ${instance.id}) or start another app.`\n}\n\n/**\n * Claim `instance` for this process and announce it, with the real port. Throws {@link InstanceAnnounceError} when a different live process already holds\n * the app; a stale lock (its holder is gone) is taken over, as everywhere else in the instance module.\n */\nexport function announceSelf(instance: AppInstance, info: SelfAnnouncementInfo): SelfAnnouncement {\n const pid = info.pid ?? process.pid\n const osHome = info.osHome ?? osHomeDirectory()\n const entry = {\n id: instance.id,\n home: instance.home,\n pid,\n surface: info.surface,\n ...(info.port === undefined ? {} : { port: info.port }),\n }\n try {\n acquireLock(instance.runLockFile, entry, {\n ...(info.alive === undefined ? {} : { alive: info.alive }),\n // This process re-announcing (an engine swap under one root) keeps its own claim; any other live process is refused.\n compatible: current => current.pid === pid,\n describe: current => describeHolder(instance, current),\n })\n } catch (error) {\n if (error instanceof LockHeldError) throw new InstanceAnnounceError(error.message)\n throw error\n }\n announce(osHome, instance, entry)\n let released = false\n return Object.freeze({\n id: instance.id,\n ...(info.port === undefined ? {} : { port: info.port }),\n release(): void {\n if (released) return\n released = true\n withdraw(osHome, instance, pid)\n releaseLock(instance.runLockFile, pid)\n },\n })\n}\n","/**\n * The online channel's per-instance secret (spec 041 TB30, following TB03's threat model): a random token\n * written next to the instance's own run lock, readable only by the OS user that started the app (`0o600`,\n * the same directory mode the Registry and the offline lock already use). An external CLI operator on the\n * same machine, as the same OS user, can simply read it - no handshake, matching how Docker's own CLI trusts\n * a local socket it can open, and how Jupyter's own token file works. A different OS user is refused by\n * filesystem permissions alone; this adds no stronger boundary than that on purpose (TB03).\n *\n * Lives beside `offline-lock.ts` and `registry.ts` (not in `@acryldev/agent-control`) so both the Host plugin that\n * writes it and the CLI that reads it depend on the same shared package, neither on the other.\n *\n * @module @acryldev/harness-runtime/instance/online-secret\n */\n\nimport { randomBytes } from 'node:crypto'\nimport { chmodSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\n\n/** Plain file name, next to the run lock in the instance's own home. */\nexport const ONLINE_SECRET_FILE_NAME = 'agent-control-secret'\n\nexport function onlineSecretPath(appHome: string): string {\n return join(appHome, ONLINE_SECRET_FILE_NAME)\n}\n\n/**\n * Write a fresh secret for this run. Tied to the process, not persisted across restarts (a crashed app's\n * secret is orphaned the same way its run lock is; a fresh start writes a fresh one - TB03's rotation note).\n * @returns the secret, hex-encoded.\n */\nexport function writeOnlineSecret(appHome: string): string {\n const path = onlineSecretPath(appHome)\n mkdirSync(dirname(path), { recursive: true, mode: 0o700 })\n const secret = randomBytes(24).toString('hex')\n writeFileSync(path, secret, { mode: 0o600 })\n chmodSync(path, 0o600)\n return secret\n}\n\n/** Remove this run's secret; a caller can no longer authenticate to an instance that has shut down. */\nexport function removeOnlineSecret(appHome: string): void {\n rmSync(onlineSecretPath(appHome), { force: true })\n}\n\n/**\n * Read a running instance's secret (the CLI's own side, TB31): same OS user, so a plain read, no handshake.\n * @returns the secret, or undefined when the instance has no online channel (older version, or not yet started).\n */\nexport function readOnlineSecret(appHome: string): string | undefined {\n try {\n return readFileSync(onlineSecretPath(appHome), 'utf8').trim()\n } catch {\n return undefined\n }\n}\n","/**\n * ACRYL's own data root, nested one level above the DSH engine home it\n * composes.\n *\n * The stock DSH Desktop app (from dshdesktop.com) uses plain `~/.dsh`, and so\n * did every ACRYL surface until now — sharing that root made the two\n * genuinely different products silently share credentials/settings/sessions,\n * which is both confusing and useless for comparing ACRYL against a stock\n * DSH Desktop install side by side. ACRYL now owns `~/.acryl` and nests each\n * engine's artifacts under it by engine name:\n *\n * ```txt\n * ~/.acryl/ ACRYL's own root — everything not engine-specific\n * ~/.acryl/.dsh/ the DSH engine home (what DSH_HOME resolves to)\n * ~/.acryl/.pi/ reserved for a future pi.dev engine\n * ```\n *\n * `$ACRYL_HOME`, if a caller has set it, is authoritative: it is the\n * product-level root, so the DSH engine home becomes `<ACRYL_HOME>/.dsh`\n * regardless of any ambient `$DSH_HOME`. That is what makes\n * `ACRYL_HOME=/tmp/x acryl ...` a complete isolation switch. When\n * `$ACRYL_HOME` is unset, an explicit `$DSH_HOME` is still honored, and with\n * neither set the default is `<~/.acryl>/.dsh` rather than the harness's own\n * bare `~/.dsh`.\n *\n * @module @acryldev/harness-runtime/acryl-home\n */\n\nimport { developmentInstance, instanceEnvironment, osHomeDirectory, selectInstance } from './instance/index.ts'\n\n/** ACRYL's own root directory name under the OS home. */\nexport const ACRYL_HOME_DIR_NAME = '.acryl'\n\n/** The DSH engine's directory name, nested under ACRYL's root. */\nexport const ACRYL_DSH_ENGINE_DIR_NAME = '.dsh'\n\n\n/** ACRYL's own root — `~/.acryl` unless `$ACRYL_HOME` overrides it. */\nexport function resolveAcrylHome(env: Record<string, string | undefined> = process.env): string {\n // Delegates to the one selector (instance/select.ts). A legacy DSH_HOME now also moves the ACRYL home (its parent when it is named `.dsh`), so state that\n // lives beside the engine home (the pinned pnpm shim, global extensions) is isolated with it instead of landing in the shared ~/.acryl.\n return selectInstance({ env }).home\n}\n\n/**\n * The DSH engine home ACRYL boots against. Precedence, highest first:\n *\n * 1. `$ACRYL_HOME` set -> `<acrylHome>/.dsh`. ACRYL is the product that owns\n * the root and engines nest inside it, so pinning ACRYL's root is a\n * **complete** isolation switch.\n * 2. `$DSH_HOME` set (and `$ACRYL_HOME` unset) -> that value, for callers\n * pointing ACRYL at an existing DSH home.\n * 3. Neither -> `<~/.acryl>/.dsh`, never the harness's own bare `~/.dsh`.\n *\n * An ambient `$DSH_HOME` must NOT outrank an explicit `$ACRYL_HOME`. That\n * ordering used to invert these, which made isolation silently unenforceable:\n * `DSH_HOME` is commonly exported in a developer shell (and set by the DSH\n * Desktop app), so `ACRYL_HOME=/tmp/x` would read and write the operator's\n * real `~/.dsh` unchanged - credentials, sessions and all. A cold-start or\n * clean-room test written that way passes while never being isolated.\n */\nexport function resolveAcrylDshHome(env: Record<string, string | undefined> = process.env): string {\n return selectInstance({ env }).dshHome\n}\n\n/**\n * The isolated local-dev DSH home (`~/.acryl-dev/.dsh`) — a third root,\n * deliberately sibling to (not nested inside) both `resolveAcrylDshHome`'s\n * packaged-install default (`~/.acryl/.dsh`) and the stock DSH Desktop's\n * plain `~/.dsh`, so a dev run never collides with either.\n *\n * `scripts/dev-local.mjs` at the repo root is this value's one canonical,\n * hand-written definition (it runs before any workspace package builds, so\n * it cannot import this module) and is what actually sets `$DSH_HOME` for\n * `pnpm run dev`. Every *other* desktop dev-mode entry point - `apps/\n * acryl-desktop/scripts/launch-dev.mjs`, `verify-loader-boot.mjs`,\n * `verify-profile-boot.mjs` - runs strictly after that package already\n * built, so they import this exported copy instead of re-deriving it, and\n * default `$DSH_HOME` to it when unset. That is what makes running the\n * desktop package's own script directly (`pnpm --filter acryl-desktop run\n * dev`, bypassing the root orchestrator) resolve the identical isolated\n * home rather than silently falling back to `resolveAcrylDshHome`'s\n * packaged-install default - a real, reproduced footgun (2026-09-14) that\n * this function exists to close for good.\n */\nexport const ACRYL_DEV_HOME_DIR_NAME = '.acryl-dev'\n\n/** The isolated local-dev DSH home - see {@link ACRYL_DEV_HOME_DIR_NAME}'s doc comment. */\nexport function resolveAcrylDevDshHome(): string {\n return developmentInstance(osHomeDirectory()).dshHome\n}\n\n/**\n * Default `$DSH_HOME` (in-place, on the given env) to the isolated\n * local-dev home when neither `$ACRYL_HOME` nor `$DSH_HOME` is already set.\n * Call this once, at the very top of a desktop dev-mode script, before\n * anything else reads the environment.\n */\nexport function applyIsolatedDevHomeDefault(env: Record<string, string | undefined> = process.env): void {\n // Nothing chosen yet (the default instance): become the isolated development app, the same family `scripts/dev-local.mjs` launches.\n if (selectInstance({ env }).kind !== 'default') return\n Object.assign(env, instanceEnvironment(developmentInstance(osHomeDirectory())))\n}\n","import { dirname } from 'node:path'\nimport { fileURLToPath, pathToFileURL } from 'node:url'\nimport { Context } from '@deepseek-ai/cordis'\nimport { Group, Loader } from '@deepseek-ai/cordis-plugin-loader'\nimport { selectInstance } from './instance/index.ts'\n\nconst ENGINE_ENTRY_ID = 'acryl-engine'\n\n/**\n * Fallback resolution base for the host root's own Loader entries (the\n * \"acryl-engine-<id>\" row and mountRootInclude's sibling \"cordis:include\"\n * row - see the `ctx.baseUrl` assignment below for why). Never read for a\n * real client bundle - `dsh-client-modules` finds no client export at this\n * location and skips, exactly as it does for any other non-client entry -\n * so its value need not track a specific engine's own profile location.\n */\nconst HOST_ROOT_BASE_URL = pathToFileURL(dirname(fileURLToPath(import.meta.url))).href + '/'\n\ntype CordisPlugin = Parameters<Context['plugin']>[0]\n\nexport interface AcrylEngineDefinition {\n readonly id: string\n readonly plugin: CordisPlugin\n readonly config?: Record<string, unknown>\n}\n\nexport interface AcrylEngineHost {\n readonly ctx: Context\n currentEngine(): string\n select(id: string): Promise<void>\n dispose(): Promise<void>\n}\n\n/**\n * Own the one Cordis root that selects an engine provider. Individual engines\n * are Loader entries beneath this host, so replacing a provider keeps the host\n * and its consumers alive while Cordis performs ordinary dependency rebinding.\n */\nexport async function createAcrylEngineHost(input: {\n readonly engines: readonly AcrylEngineDefinition[]\n readonly initialEngine: string\n /**\n * Register surface-owned services on the bare root before any engine\n * mounts - mirrors `boot()`'s own `prepare` timing exactly (Loader is\n * plugged, no config-tree entry has mounted yet), so a surface with its\n * own non-engine capabilities (e.g. Desktop's profile/market/plugin-\n * lifecycle services) can provide them ahead of an engine's Loader entries\n * that `ctx.inject`/`ctx.get` them.\n */\n readonly prepare?: (ctx: Context) => Promise<void> | void\n}): Promise<AcrylEngineHost> {\n const engines = new Map<string, AcrylEngineDefinition>()\n for (const engine of input.engines) {\n if (engine.id.trim() === '') throw new Error('ACRYL engine id must not be empty')\n if (engines.has(engine.id)) throw new Error(`duplicate ACRYL engine: ${engine.id}`)\n engines.set(engine.id, engine)\n }\n const initial = engines.get(input.initialEngine)\n if (initial === undefined) throw new Error(`unknown ACRYL engine: ${input.initialEngine}`)\n // Choose the app instance before anything mounts. Engines resolve their home inside plugin fibers, where a refusal (an invalid port, or the\n // isolation a gate or live run requires: `IsolationRequiredError`) would only fail that plugin and leave an app that boots without its profile and\n // exits 0. Here it stops the host, for every surface.\n selectInstance()\n\n const ctx = new Context()\n // `EntryTree`'s constructor snapshots `ctx.baseUrl` once, as an own\n // property (`ctx.extend({ baseUrl: ctx.baseUrl })`) - not a live read - at\n // the moment the Loader plugin constructs its root tree, i.e. exactly this\n // `ctx.plugin(Loader)` call below. Every entry created directly on this\n // root (the \"acryl-engine-<id>\" row this function creates, and\n // mountRootInclude's sibling \"cordis:include\" row - see engine-dsh.ts)\n // permanently inherits whatever `ctx.baseUrl` was at this line; setting it\n // later (inside an engine's own plugin, or even inside `prepare` below,\n // which also runs after this line) cannot reach that already-taken\n // snapshot. Reproduced directly: Desktop's real composition failed with\n // \"loader entry cordis:acryl-engine-dsh has no resolution base URL\" from\n // `dsh-client-modules` (Desktop composes client bundles; CLI/TUI does not,\n // which is why no automated test caught this) before this assignment\n // existed - confirmed via `entry.parent.tree.ctx.baseUrl` reading\n // `undefined` for exactly these two entries, and every entry nested one\n // level deeper (inside the profile's own composed tree, constructed later\n // from a ctx that does have baseUrl set) reading correctly.\n ctx.baseUrl = HOST_ROOT_BASE_URL\n await ctx.plugin(Loader)\n const entryFor = (engine: AcrylEngineDefinition) => ({\n id: ENGINE_ENTRY_ID,\n name: `cordis:acryl-engine-${engine.id}`,\n ...(engine.config === undefined ? {} : { config: engine.config }),\n })\n try {\n await input.prepare?.(ctx)\n ctx.loader.builtins.group = Group\n for (const engine of engines.values()) ctx.loader.builtins[`acryl-engine-${engine.id}`] = engine.plugin\n await ctx.loader.create(entryFor(initial))\n await ctx.loader.await()\n } catch (error) {\n await ctx.fiber.dispose()\n throw error\n }\n\n let active = initial.id\n let disposed = false\n\n return Object.freeze({\n ctx,\n currentEngine: () => active,\n async select(id: string): Promise<void> {\n if (disposed) throw new Error('ACRYL engine host is disposed')\n const next = engines.get(id)\n if (next === undefined) throw new Error(`unknown ACRYL engine: ${id}`)\n if (next.id === active) return\n // Loader 1.0.5 (Cordis family of DSH 0.2) re-imports a row only when it is created: `Entry.update` on a running row applies a\n // changed `config` but ignores a changed plugin `name`. So a swap removes the row (waiting for its fiber to finish\n // disposing, so the old engine's effects stop before the new one's start) and creates it again under the same stable id.\n const previous = ctx.loader.resolve(ENGINE_ENTRY_ID).fiber\n ctx.loader.remove(ENGINE_ENTRY_ID)\n await previous?.dispose()\n await ctx.loader.create(entryFor(next))\n await ctx.loader.await()\n active = next.id\n },\n async dispose(): Promise<void> {\n if (disposed) return\n disposed = true\n await ctx.fiber.dispose()\n },\n })\n}\n","/** Generated by scripts/generate-web-favicon.mjs from assets/brand/favicon/ (smooth, black on white). Do not edit. */\n\nexport const FAVICON_ICO_BASE64 = 'AAABAAMAMDAAAAEAIACoJQAANgAAACAgAAABACAAqBAAAN4lAAAQEAAAAQAgAGgEAACGNgAAKAAAADAAAABgAAAAAQAgAAAAAAAAJAAA6AMAAOgDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAMgAAAIkAAADOAAAA8QAAAP0AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/A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m6H1JVqoGoW14i/1h/ABMT2W6Y03dl4ksC+nmM6DW4XYm6Yx2yLlmnrNtrE3WdSs8VhP0PzYWN64PVzZ4AAAAASUVORK5CYII='\n","/**\n * The ACRYL tab icons for the Web surface: the smooth black-on-white logo in the sizes browsers ask for\n * (ICO, 16, 32 and the Apple touch icon), inlined as data URLs so serving them needs no route and no file\n * next to the bundle. Sources live in `assets/brand/favicon/`; `scripts/generate-web-favicon.mjs` regenerates the data.\n */\n\nimport { APPLE_TOUCH_ICON_BASE64, FAVICON_16_BASE64, FAVICON_32_BASE64, FAVICON_ICO_BASE64 } from './web-favicon-data.ts'\n\n/** The `<link>` tags that replace the pinned frontend's DeepSeek icon links. */\nexport const WEB_FAVICON_LINKS = [\n `<link rel=\"icon\" href=\"data:image/x-icon;base64,${FAVICON_ICO_BASE64}\" sizes=\"any\">`,\n `<link rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"data:image/png;base64,${FAVICON_32_BASE64}\">`,\n `<link rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"data:image/png;base64,${FAVICON_16_BASE64}\">`,\n `<link rel=\"apple-touch-icon\" sizes=\"180x180\" href=\"data:image/png;base64,${APPLE_TOUCH_ICON_BASE64}\">`,\n].join('')\n\nconst ICON_LINK = /<link\\b[^>]*\\brel=[\"'](?:shortcut icon|icon|apple-touch-icon)[\"'][^>]*>\\s*/gi\n\n/** @param html - the served index; drops any existing icon links, then adds ACRYL's before `</head>`. */\nexport function applyWebFavicon(html: string): string {\n return html.replace(ICON_LINK, '').replace(/<\\/head>/i, `${WEB_FAVICON_LINKS}</head>`)\n}\n\nconst escapeHtml = (text: string): string => text.replace(/[&<>\"']/gu, character => `&#${String(character.charCodeAt(0))};`)\n\n/** What the served page needs to know about its brand. */\nexport interface WebIndexBrand {\n /** The product name the page title carries; `ACRYL` when absent. */\n readonly productName?: string\n /** The stock ACRYL brand (not a Blueprint's own): it wears the ACRYL icon. A custom brand ships its own icon (@acryldev/brand). */\n readonly stockBrand?: boolean\n}\n\n/**\n * @param html - the served index of the pinned frontend.\n * @param brand - whose page this is.\n * @returns the index with the brand's title, and for the stock ACRYL brand the ACRYL icon in place of DeepSeek's. A composition that names neither\n * a product nor a brand kind is the stock one.\n */\nexport function brandWebIndex(html: string, brand: WebIndexBrand): string {\n const titled = html.replace(/<title>[^<]*<\\/title>/i, () => `<title>${escapeHtml(brand.productName ?? 'ACRYL')}</title>`)\n return brand.stockBrand === true || (brand.productName === undefined && brand.stockBrand === undefined) ? applyWebFavicon(titled) : titled\n}\n","/**\n * The `acrylTools` provider: ACRYL's tools port (`@acryldev/control`) answered by DeepSeek Harness's tool registry today. A thin delegate: a tool defined\n * through the port is an ordinary Harness tool (same `defineTool`, same registry), a call through `execute` runs the registry's whole pipeline, and a\n * policy registered through `policy` is a `tools/pre-execute` hook like any other. When the registry is replaced the adapter and its consumers unload\n * together and register again.\n *\n * @module @acryldev/harness-runtime/engine-tools\n */\n\nimport type { Context } from '@deepseek-ai/cordis'\nimport { defineTool } from '@deepseek-ai/dsh-tools'\nimport type { AcrylTools } from '@acryldev/control'\n\n/** Provide `acrylTools` on `ctx`, which must be able to see `tools` (call it inside `ctx.inject(['tools'], ...)`). */\nexport function provideAcrylTools(ctx: Context): void {\n const port: AcrylTools = {\n register: definition => ctx.tools.register(defineTool(definition as never)),\n get: name => ctx.tools.get(name) as ReturnType<AcrylTools['get']>,\n execute: input => ctx.tools.execute(input as never) as Promise<Awaited<ReturnType<AcrylTools['execute']>>>,\n policy: handler => ctx.on('tools/pre-execute', handler as never),\n }\n ctx.effect(() => {\n const dispose = ctx.reflect.provide('acrylTools', port)\n return () => { void dispose() }\n }, '@acryldev/harness-runtime: acrylTools')\n}\n","/**\n * One pnpm for every surface. `dsh plugin add` shells out to a bare `pnpm` found on PATH, so the Web and CLI surfaces used whatever pnpm\n * the user's machine had (measured: 12.4.2 against a repository pinned to 11.8.0 and a profile created by pnpm 9), and a different major\n * refuses an existing modules directory (ERR_PNPM_PUBLIC_HOIST_PATTERN_DIFF). Desktop already bundles the pinned pnpm behind its own PATH\n * shim; this gives Web and CLI the same: the `pnpm` package this runtime depends on, exposed as a `pnpm` shim first on the PATH of the\n * spawned `dsh plugin` process. When the package cannot be resolved the environment is returned unchanged, so a broken install degrades to\n * the previous behavior instead of failing.\n */\nimport { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport { delimiter, dirname, join } from 'node:path'\nimport { resolveAcrylHome } from './acryl-home.ts'\n\nconst require = createRequire(import.meta.url)\n\nexport interface PinnedPnpm {\n /** Absolute path of the pinned pnpm entry (`bin/pnpm.mjs`). */\n readonly entry: string\n /** The pinned version (`package.json` of the resolved `pnpm` package). */\n readonly version: string\n}\n\n/** The pnpm this runtime depends on, or undefined when it is not installed. */\nexport function resolvePinnedPnpm(): PinnedPnpm | undefined {\n try {\n // The package exports only `.` (its package.json), so resolving the bare name yields the manifest path.\n const manifestPath = require.resolve('pnpm')\n const manifest = JSON.parse(readFileSync(manifestPath, 'utf8')) as { version?: string }\n const entry = join(dirname(manifestPath), 'bin', 'pnpm.mjs')\n return existsSync(entry) && typeof manifest.version === 'string' ? { entry, version: manifest.version } : undefined\n } catch {\n return undefined\n }\n}\n\nfunction writeIfChanged(path: string, content: string, mode: number): void {\n if (existsSync(path) && readFileSync(path, 'utf8') === content) return\n writeFileSync(path, content, { mode })\n chmodSync(path, mode)\n}\n\n/**\n * Environment for a spawned `dsh plugin` process with the pinned pnpm first on PATH.\n * @param env - the parent environment.\n * @param binDir - where the shim lives (default: `<acryl home>/runtime/pnpm-bin`).\n * @param platform - target platform (tests).\n */\nexport function pinnedPnpmEnv(\n env: NodeJS.ProcessEnv = process.env,\n binDir: string = join(resolveAcrylHome(env), 'runtime', 'pnpm-bin'),\n platform: NodeJS.Platform = process.platform,\n): NodeJS.ProcessEnv {\n const pinned = resolvePinnedPnpm()\n if (pinned === undefined) return env\n try {\n mkdirSync(binDir, { recursive: true, mode: 0o700 })\n if (platform === 'win32') {\n writeIfChanged(join(binDir, 'pnpm.cmd'), `@echo off\\r\\n\"${process.execPath}\" \"${pinned.entry}\" %*\\r\\n`, 0o600)\n } else {\n writeIfChanged(join(binDir, 'pnpm'), `#!/bin/sh\\nexec \"${process.execPath}\" \"${pinned.entry}\" \"$@\"\\n`, 0o755)\n }\n } catch {\n return env\n }\n const pathKey = platform === 'win32' ? (Object.keys(env).find(key => key.toLowerCase() === 'path') ?? 'Path') : 'PATH'\n return { ...env, [pathKey]: [binDir, env[pathKey]].filter(Boolean).join(delimiter) }\n}\n","/**\n * Keep a profile's recorded pnpm layout authoritative before any pnpm operation.\n *\n * A profile's `node_modules/.modules.yaml` records the `nodeLinker` and\n * `publicHoistPattern` its dependencies were installed with. The profile's\n * `pnpm-workspace.yaml` may say something else (a profile created by pnpm 9\n * ignored `nodeLinker: hoisted`; pnpm >= 10 honors it). When they differ, pnpm\n * silently relinks the whole tree - measured: a hoisted relink exposed stale\n * top-level `@deepseek-ai/*` packages that shadowed the harness's and stopped\n * the app from starting. Pinning the recorded values into the workspace file\n * makes every pnpm (pinned 11.x, or whatever is on PATH) keep the layout that\n * is already on disk. Only a deliberate, human-run reinstall changes layout.\n */\nimport { existsSync, readFileSync, renameSync, writeFileSync } from 'node:fs'\nimport { join } from 'node:path'\nimport { isMap, parse, parseDocument } from 'yaml'\n\nconst NODE_LINKERS = ['isolated', 'hoisted', 'pnp'] as const\ntype NodeLinker = (typeof NODE_LINKERS)[number]\n\n/** Which profile a pnpm service operates on. */\nexport interface PnpmProfileConfig {\n readonly name: string\n readonly dir: string\n}\n\n/** What a reconcile changed; empty when the workspace file already agreed. */\nexport interface LayoutChange {\n readonly key: 'nodeLinker' | 'publicHoistPattern'\n readonly from: unknown\n readonly to: unknown\n}\n\ninterface RecordedLayout {\n readonly nodeLinker?: NodeLinker\n readonly publicHoistPattern?: readonly string[]\n}\n\nfunction readRecorded(modulesFile: string): RecordedLayout {\n let raw: unknown\n try { raw = parse(readFileSync(modulesFile, 'utf8')) } catch { return {} }\n if (raw === null || typeof raw !== 'object') return {}\n const record = raw as Record<string, unknown>\n const linker = NODE_LINKERS.find(value => value === record['nodeLinker'])\n const pattern = record['publicHoistPattern']\n return {\n ...(linker === undefined ? {} : { nodeLinker: linker }),\n ...(Array.isArray(pattern) && pattern.every(item => typeof item === 'string') ? { publicHoistPattern: pattern as string[] } : {}),\n }\n}\n\nconst sameList = (a: unknown, b: readonly string[]): boolean =>\n Array.isArray(a) && a.length === b.length && a.every((item, index) => item === b[index])\n\n/**\n * Pin the recorded `nodeLinker` / `publicHoistPattern` into the profile's `pnpm-workspace.yaml`.\n * A profile with no installed `node_modules` (or no workspace file) has no layout to protect and is left alone.\n * @returns the changes made (empty when nothing needed pinning)\n */\nexport function reconcileProfileLayout(profileDir: string): LayoutChange[] {\n const modulesFile = join(profileDir, 'node_modules', '.modules.yaml')\n const workspaceFile = join(profileDir, 'pnpm-workspace.yaml')\n if (!existsSync(modulesFile) || !existsSync(workspaceFile)) return []\n const recorded = readRecorded(modulesFile)\n const document = parseDocument(readFileSync(workspaceFile, 'utf8'))\n if (!isMap(document.contents)) return []\n\n const changes: LayoutChange[] = []\n if (recorded.nodeLinker !== undefined) {\n const declared: unknown = document.get('nodeLinker') ?? 'isolated'\n if (declared !== recorded.nodeLinker) {\n changes.push({ key: 'nodeLinker', from: declared, to: recorded.nodeLinker })\n document.set('nodeLinker', recorded.nodeLinker)\n }\n }\n if (recorded.publicHoistPattern !== undefined) {\n const declared: unknown = document.get('publicHoistPattern')\n // Absent means \"pnpm's own default\", which differs across majors (9: eslint/prettier, 12: empty).\n if (!sameList(isMapValue(declared), recorded.publicHoistPattern)) {\n changes.push({ key: 'publicHoistPattern', from: isMapValue(declared), to: recorded.publicHoistPattern })\n document.set('publicHoistPattern', recorded.publicHoistPattern)\n }\n }\n if (changes.length === 0) return []\n const temp = `${workspaceFile}.acryl-tmp`\n writeFileSync(temp, document.toString())\n renameSync(temp, workspaceFile)\n return changes\n}\n\n/** `document.get` returns a YAML node wrapper for collections; unwrap to plain JSON. */\nfunction isMapValue(value: unknown): unknown {\n if (value !== null && typeof value === 'object' && 'toJSON' in value && typeof value.toJSON === 'function') {\n return (value as { toJSON(): unknown }).toJSON()\n }\n return value\n}\n","/**\n * CLI/TUI's own `desktopProfiles`/`desktopPnpm` capabilities (spec 034,\n * completing T006 for the third surface) - what `@acryldev/cordis-plugin-market`'s\n * install service needs for a CLI-driven Market install/uninstall to do a\n * real package operation, instead of the \"ACRYL is required\" gate it shows\n * without them.\n *\n * Adapted directly from `web-market-install.ts` - see that file's own doc\n * comment for why this is deliberately not a port of Desktop's much larger\n * `pnpm.ts`/`install-recovery.ts` (a crash-recovery WAL built around\n * Electron's own generation-restart cycle, which neither Web nor a CLI\n * process has an equivalent of). The one real difference from Web: the CLI\n * has more than one named profile (Web's is always `web`), so the profile\n * name is a constructor parameter here, not a literal.\n *\n * Install mechanics reuse `dsh plugin --profile <name> add/remove`, the same\n * path a human operator already uses - confirmed (like Web) to have no\n * `--profile` restriction, unlike Desktop's packaged CLI.\n */\n\nimport { spawn } from 'node:child_process'\nimport { createRequire } from 'node:module'\nimport { dirname, join } from 'node:path'\nimport { PassThrough, Readable } from 'node:stream'\nimport { type Context, Service } from '@deepseek-ai/cordis'\nimport { pinnedPnpmEnv } from './pinned-pnpm.ts'\nimport { reconcileProfileLayout, type PnpmProfileConfig } from './profile-layout.ts'\n\n/** Matches `@acryldev/cordis-plugin-market`'s own `MarketDesktopProfile` shape. */\nexport interface CliMarketProfile {\n readonly name: string\n readonly dir: string\n}\n\n/** Matches `@acryldev/cordis-plugin-market`'s own `MarketDesktopPnpmOutcome` shape. */\nexport interface CliMarketPnpmOutcome {\n readonly exitCode: number | null\n readonly signal: NodeJS.Signals | null\n}\n\n/** Matches `@acryldev/cordis-plugin-market`'s own `MarketDesktopPnpmHandle` shape. */\nexport interface CliMarketPnpmHandle {\n readonly stdout: Readable\n readonly stderr: Readable\n readonly done: Promise<CliMarketPnpmOutcome>\n cancel(): void\n}\n\n// No `declare module '@deepseek-ai/cordis'` augmentation here - same reason\n// as web-market-install.ts: acryl-desktop's own pnpm.ts/desktop-plugins.ts\n// already declare these names on Context with their own, richer types, and\n// `Service`'s constructor takes a plain string name, not `keyof Context`, so\n// providing under these exact names needs no static declaration at all.\n\n/** Matches `@acryldev/cordis-plugin-market`'s own `MarketDesktopPnpm` shape exactly. */\nexport interface CliMarketPnpm {\n runPlugin(args: readonly string[], invokingDir: string, signal?: AbortSignal): CliMarketPnpmHandle\n installPlugin(request: {\n readonly pnpmOptions?: readonly string[]\n readonly invokingDir: string\n readonly recovery: { readonly packageName: string; readonly packageVersion: string; readonly receiptId: string }\n readonly signal?: AbortSignal\n }): Promise<CliMarketPnpmHandle>\n recoveredInstallReceiptIds(): Promise<readonly string[]>\n acknowledgeRecoveredInstall(receiptId: string): Promise<void>\n rollbackPluginInstall(receiptId: string): Promise<boolean>\n acknowledgeLiveInstall(packageName: string): Promise<void>\n}\n\nconst require = createRequire(import.meta.url)\n\n/** Absolute path to the pinned `@deepseek-ai/dsh` CLI's own compiled entry. */\nfunction resolveDshBin(): string {\n const manifestPath = require.resolve('@deepseek-ai/dsh/package.json')\n return join(dirname(manifestPath), 'lib/bin.js')\n}\n\n/** The one profile this TUI process actually booted. */\nexport class CliProfilesService extends Service {\n constructor(ctx: Context, private readonly profile: CliMarketProfile) {\n super(ctx, 'desktopProfiles')\n }\n\n get current(): CliMarketProfile {\n return this.profile\n }\n}\n\n/**\n * Runs `dsh plugin --profile <name> <verb> <...args>` as a real child\n * process, inheriting this process's own `DSH_HOME` - `-w` included for\n * pnpm's own workspace-root safety check on a profile's single-package pnpm\n * workspace (identical reproduction to Web's and Desktop's own install path).\n */\nexport class CliPnpmService extends Service implements CliMarketPnpm {\n private readonly dshBin: string\n private readonly profileName: string\n private readonly profileDir: string\n\n constructor(ctx: Context, config: PnpmProfileConfig) {\n super(ctx, 'desktopPnpm')\n this.profileName = config.name\n this.profileDir = config.dir\n this.dshBin = resolveDshBin()\n }\n\n runPlugin(args: readonly string[], _invokingDir: string, signal?: AbortSignal): CliMarketPnpmHandle {\n // Never let a pnpm relink a profile another pnpm laid out (see profile-layout.ts).\n reconcileProfileLayout(this.profileDir)\n const child = spawn(process.execPath, [this.dshBin, 'plugin', '--profile', this.profileName, ...args, '-w'], {\n // The pinned pnpm, not whatever the machine has on PATH (see pinned-pnpm.ts).\n env: pinnedPnpmEnv(process.env),\n signal,\n })\n const stdout = new PassThrough()\n const stderr = new PassThrough()\n child.stdout?.pipe(stdout)\n child.stderr?.pipe(stderr)\n // 'close', not 'exit': 'exit' can fire before the piped stdout/stderr\n // have finished draining into `stdout`/`stderr` above, which raced a\n // real caller reading `stderr` after `done` resolved - a fast failure\n // (this profile's dsh wrapper prints one line and exits immediately)\n // showed a near-empty stderr capture because the pipe hadn't flushed\n // yet. 'close' is Node's own guarantee that both streams have ended.\n const done = new Promise<CliMarketPnpmOutcome>((resolve, reject) => {\n child.once('error', reject)\n child.once('close', (exitCode, exitSignal) => resolve({ exitCode, signal: exitSignal }))\n })\n return {\n stdout,\n stderr,\n done,\n cancel: () => { child.kill() },\n }\n }\n\n async installPlugin(request: {\n readonly pnpmOptions?: readonly string[]\n readonly invokingDir: string\n readonly recovery: { readonly packageName: string; readonly packageVersion: string; readonly receiptId: string }\n readonly signal?: AbortSignal\n }): Promise<CliMarketPnpmHandle> {\n const target = `${request.recovery.packageName}@${request.recovery.packageVersion}`\n const options = request.pnpmOptions === undefined ? [] : [...request.pnpmOptions]\n // A version of ACRYL's own tooling published minutes before an install\n // attempt is the normal case here (Market installs are how a person\n // actually picks up a just-published plugin), not the untrusted-fresh-\n // package scenario pnpm's own `minimumReleaseAge` supply-chain default\n // guards against - reproduced directly: a real install of a package\n // this session had itself published minutes earlier failed with\n // `ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION` on a pnpm whose default\n // enables the policy. Overridden only for this one `add` invocation,\n // not the user's global pnpm config, which stays untouched.\n return this.runPlugin(['add', '--config.minimum-release-age=0', ...options, target], request.invokingDir, request.signal)\n }\n\n // No crash-recovery WAL (see this module's own doc comment) - there is\n // never anything to report as recovered, acknowledge, or roll back.\n async recoveredInstallReceiptIds(): Promise<readonly string[]> {\n return []\n }\n\n async acknowledgeRecoveredInstall(_receiptId: string): Promise<void> {}\n\n async rollbackPluginInstall(_receiptId: string): Promise<boolean> {\n return false\n }\n\n async acknowledgeLiveInstall(_packageName: string): Promise<void> {}\n}\n\n/**\n * Provide `desktopProfiles`/`desktopPnpm` on the host root for this CLI\n * process's own booted profile.\n * @param ctx - the host root.\n * @param profile - the profile this TUI process actually composed.\n */\nexport function provideCliMarketInstall(ctx: Context, profile: CliMarketProfile): void {\n ctx.plugin(CliProfilesService, profile)\n ctx.plugin(CliPnpmService, { name: profile.name, dir: profile.dir })\n}\n","/**\n * The one persistent store of plugin enablement overrides, keyed by profile.\n *\n * Every surface that offers plugin enable/disable - Desktop's Lifecycle tab,\n * the Web panel, `acryl plugin enable` on the CLI - reads and writes the same\n * `plugin-lifecycle/state.json`, so a disable applies to the whole profile the\n * next time it boots no matter which surface asked for it.\n *\n * @module @acryldev/harness-runtime/plugin-lifecycle-state\n */\n\nimport { readFileSync } from 'node:fs'\nimport { chmod, lstat, mkdir, readFile } from 'node:fs/promises'\nimport { dirname, join } from 'node:path'\nimport { PROFILE_PATCH_FILENAME, resolveProfileDir } from '@deepseek-ai/dsh-app-boot'\nimport { isMap, isScalar, isSeq, parseDocument } from 'yaml'\nimport { withFileLock, writeFileAtomic } from './engine-files.ts'\nimport { resolveAcrylDshHome } from './acryl-home.ts'\n\nconst STATE_VERSION = 1\nconst STATE_FILE_MODE = 0o600\nconst STATE_DIRECTORY_MODE = 0o700\nconst MAX_STATE_BYTES = 64 * 1024\nconst MAX_PROFILES = 64\nconst MAX_OVERRIDES = 256\nconst MAX_PROFILE_NAME_BYTES = 255\n\n/** A well-formed runtime Loader entry id (`include:<row>` or a bare row id). */\nconst ENTRY_ID_PATTERN = /^(?:include:)?[a-z0-9](?:[a-z0-9._:@/-]{0,190}[a-z0-9])?$/iu\n\n/** Rejects a profile name, in the words of the surface that owns the rule. */\nexport type ProfileNameValidator = (profileName: string) => void\n\n/**\n * The portable rule: a profile name must be usable as one profile directory\n * under the harness home. A surface whose profiles are named by other rules\n * (Desktop's CLI accepts localized names) supplies its own validator instead.\n */\nexport function assertProfileName(name: string): void {\n if (typeof name !== 'string' || name.length === 0\n || name.includes('/') || name.includes('\\\\') || name === '.' || name === '..'\n || name === 'node_modules' || Buffer.byteLength(name, 'utf8') > MAX_PROFILE_NAME_BYTES\n || /[\\0-\\x1f\\x7f-\\x9f]/.test(name)\n || /[<>:\"|?*]/.test(name) || /[. ]$/.test(name)\n || /^(?:CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(?:\\..*)?$/i.test(name)) {\n throw new Error(`invalid profile name ${JSON.stringify(name)}`)\n }\n resolveProfileDir(name, '/')\n}\n\n/**\n * Persistence inputs: enough to read and write the override file for one\n * profile.\n */\nexport interface PluginLifecycleStatePersistence {\n readonly profileName: string\n readonly statePath: string\n /** Overrides {@link assertProfileName} when a surface names profiles its own way. */\n readonly validateProfileName?: ProfileNameValidator\n}\n\n/**\n * The one override file every surface reads and writes, inside the engine home\n * whose profiles these overrides describe.\n *\n * The overrides are a property of a profile, and the profiles themselves live\n * under the engine home - so the store shares their root, their lifetime, and\n * their isolation switch. It is deliberately not a surface's private data\n * directory (the Electron userData path it used to be), because then\n * `acryl plugin disable x` and the Desktop panel would give two different\n * answers about one profile: the defect spec 034 exists to fix.\n *\n * The engine home, not a bare `~/.acryl`, is also what keeps an isolated run\n * isolated: `resolveAcrylHome()` ignores `$DSH_HOME`, so a dev or throwaway\n * `DSH_HOME=~/.acryl-dev/.dsh` would otherwise read and write overrides in the\n * operator's real install. Every surface already agrees on this root - each one\n * boots through `resolveAcrylDshHome()`.\n *\n * @param dshHome - the engine home this process booted; defaults to the one\n * `$ACRYL_HOME` / `$DSH_HOME` resolve to.\n */\nexport function resolvePluginLifecycleStatePath(dshHome: string = resolveAcrylDshHome()): string {\n return join(dshHome, 'plugin-lifecycle', 'state.json')\n}\n\n/** Runtime entry id -> the patch-local row id it disables during composition. */\nexport function entryPatchId(entryId: string): string {\n return entryId.startsWith('include:') ? entryId.slice('include:'.length) : entryId\n}\n\n/** Whether a persisted disabled-entry id is structurally a Loader entry id. */\nexport function isPluginLifecycleEntryId(value: unknown): value is string {\n return typeof value === 'string' && value.length > 0 && value.length <= 200 && ENTRY_ID_PATTERN.test(value)\n}\n\n/**\n * A Loader row that was renamed before this state format settled: a disable kept under the old entry id applies to the row by its current id.\n * The Development Canvas row `desktop-development-canvas` took its package name `acryl-development-canvas` under the row-id rule (spec 048 T014).\n */\nconst RENAMED_ENTRY_IDS: Readonly<Record<string, string>> = Object.freeze({\n 'include:desktop-development-canvas': 'include:acryl-development-canvas',\n 'desktop-development-canvas': 'acryl-development-canvas',\n})\n\n/** Base-template bundles: never user-mutable. Every other profile bundle is. */\nexport const BASE_TEMPLATE_BUNDLE_NAMES: ReadonlySet<string> = new Set([\n '@deepseek-ai/dsh-base',\n '@deepseek-ai/dsh-web-app',\n])\n\ninterface ProfileState {\n readonly profileName: string\n readonly disabledEntries: readonly string[]\n}\n\ninterface PluginLifecycleStateV1 {\n readonly version: 1\n readonly profiles: readonly ProfileState[]\n}\n\nfunction emptyState(): PluginLifecycleStateV1 {\n return { version: STATE_VERSION, profiles: [] }\n}\n\nfunction stableCompare(left: string, right: string): number {\n return left < right ? -1 : left > right ? 1 : 0\n}\n\nfunction hasExactKeys(record: Record<string, unknown>, keys: readonly string[]): boolean {\n const actual = Object.keys(record).sort(stableCompare)\n const expected = [...keys].sort(stableCompare)\n return actual.length === expected.length\n && actual.every((key, index) => key === expected[index])\n}\n\nfunction parseState(value: unknown, validateProfileName: ProfileNameValidator): PluginLifecycleStateV1 {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) {\n throw new Error('plugin lifecycle state root must be an object')\n }\n const root = value as Record<string, unknown>\n if (!hasExactKeys(root, ['version', 'profiles'])\n || root.version !== STATE_VERSION\n || !Array.isArray(root.profiles)) {\n throw new Error('plugin lifecycle state version or profiles list is invalid')\n }\n if (root.profiles.length > MAX_PROFILES) {\n throw new Error('plugin lifecycle state contains too many profiles')\n }\n const names = new Set<string>()\n const profiles: ProfileState[] = []\n for (const raw of root.profiles) {\n if (raw === null || typeof raw !== 'object' || Array.isArray(raw)) {\n throw new Error('plugin lifecycle profile state must be an object')\n }\n const profile = raw as Record<string, unknown>\n if (!hasExactKeys(profile, ['profileName', 'disabledEntries'])\n || typeof profile.profileName !== 'string') {\n throw new Error('plugin lifecycle profile name is invalid')\n }\n validateProfileName(profile.profileName)\n if (names.has(profile.profileName)) {\n throw new Error(`duplicate plugin lifecycle profile ${JSON.stringify(profile.profileName)}`)\n }\n names.add(profile.profileName)\n if (!Array.isArray(profile.disabledEntries)\n || profile.disabledEntries.length > MAX_OVERRIDES\n || profile.disabledEntries.some(entryId => typeof entryId !== 'string')) {\n throw new Error(`disabledEntries for profile ${JSON.stringify(profile.profileName)} is invalid`)\n }\n // Any structurally valid Loader entry id is kept - the mutable set is\n // derived at runtime from the profile bundle list, not this file. A\n // malformed string, or one for an entry that no longer exists, is dropped\n // rather than treated as corruption: composition emits a disable patch by\n // id, and the Loader treats an unknown-id patch as a warning, not a fault.\n profiles.push({\n profileName: profile.profileName,\n disabledEntries: [...new Set((profile.disabledEntries as unknown[]).filter(isPluginLifecycleEntryId).map(entryId => entryId))]\n .sort(stableCompare),\n })\n }\n profiles.sort((left, right) => stableCompare(left.profileName, right.profileName))\n return { version: STATE_VERSION, profiles }\n}\n\nfunction validatorOf(persistence: PluginLifecycleStatePersistence): ProfileNameValidator {\n return persistence.validateProfileName ?? assertProfileName\n}\n\nfunction readState(persistence: PluginLifecycleStatePersistence): PluginLifecycleStateV1 {\n let source: string\n try {\n source = readFileSync(persistence.statePath, 'utf8')\n } catch (cause) {\n if ((cause as NodeJS.ErrnoException).code === 'ENOENT') return emptyState()\n throw cause\n }\n if (Buffer.byteLength(source, 'utf8') > MAX_STATE_BYTES) {\n throw new Error('plugin lifecycle state is too large')\n }\n return parseState(JSON.parse(source) as unknown, validatorOf(persistence))\n}\n\nfunction renderState(state: PluginLifecycleStateV1): string {\n return `${JSON.stringify(state, null, 2)}\\n`\n}\n\n/** Read disabled Loader entry ids for one profile. */\nexport function readDisabledPluginLifecycleEntries(\n persistence: PluginLifecycleStatePersistence,\n): ReadonlySet<string> {\n validatorOf(persistence)(persistence.profileName)\n const profile = readState(persistence).profiles\n .find(candidate => candidate.profileName === persistence.profileName)\n return new Set((profile?.disabledEntries ?? []).map(entry => RENAMED_ENTRY_IDS[entry] ?? entry))\n}\n\n/**\n * User-added profile bundles from `dsh.profile.bundles`, minus the base\n * template. Each such package's inserted Loader row is user-mutable. A missing\n * or malformed manifest yields an empty set (nothing user-mutable by bundle).\n */\nexport function readUserMutableBundleNames(profileDir: string): ReadonlySet<string> {\n let manifest: unknown\n try {\n manifest = JSON.parse(readFileSync(join(profileDir, 'package.json'), 'utf8'))\n } catch {\n return new Set()\n }\n const bundles = (manifest as { dsh?: { profile?: { bundles?: unknown } } })?.dsh?.profile?.bundles\n if (!Array.isArray(bundles)) return new Set()\n return new Set(\n bundles.filter((name): name is string =>\n typeof name === 'string' && !BASE_TEMPLATE_BUNDLE_NAMES.has(name)),\n )\n}\n\nasync function ensurePrivateStateDirectory(statePath: string): Promise<void> {\n const directory = dirname(statePath)\n await mkdir(directory, { recursive: true, mode: STATE_DIRECTORY_MODE })\n const stat = await lstat(directory)\n if (!stat.isDirectory() || stat.isSymbolicLink()) {\n throw new Error('plugin lifecycle state directory is not private')\n }\n await chmod(directory, STATE_DIRECTORY_MODE)\n}\n\n/** Persist one desired entry enablement with locking and atomic replace. */\nexport async function setPluginLifecycleEntryEnabled(\n persistence: PluginLifecycleStatePersistence,\n entryId: string,\n enabled: boolean,\n): Promise<void> {\n validatorOf(persistence)(persistence.profileName)\n if (!isPluginLifecycleEntryId(entryId)) throw new Error('plugin lifecycle entry id is malformed')\n await ensurePrivateStateDirectory(persistence.statePath)\n await withFileLock(persistence.statePath, async () => {\n const state = readState(persistence)\n const current = state.profiles.find(profile => profile.profileName === persistence.profileName)\n const disabled = new Set(current?.disabledEntries ?? [])\n if (enabled) disabled.delete(entryId)\n else disabled.add(entryId)\n const profiles = state.profiles.filter(profile => profile.profileName !== persistence.profileName)\n if (disabled.size > 0) {\n profiles.push({\n profileName: persistence.profileName,\n disabledEntries: [...disabled].sort(stableCompare),\n })\n }\n profiles.sort((left, right) => stableCompare(left.profileName, right.profileName))\n const next = parseState({ version: STATE_VERSION, profiles }, validatorOf(persistence))\n const rendered = renderState(next)\n if (Buffer.byteLength(rendered, 'utf8') > MAX_STATE_BYTES) {\n throw new Error('plugin lifecycle state is too large')\n }\n await writeFileAtomic(persistence.statePath, rendered, {\n mode: STATE_FILE_MODE,\n dirMode: STATE_DIRECTORY_MODE,\n })\n })\n}\n\n/**\n * Remove a disable DSH's own Plugins page wrote for one row into the profile's patch file (`{ id, disabled: true }`,\n * `plugin-manager/src/patch.ts`), keeping every comment and every other key. Before spec 001 T089 both pages wrote, each\n * to its own store, and a disable in either kept the row off however the other was set; now every toggle of a row ACRYL\n * admits goes through this lifecycle (DSH's page too, through ACRYL's plugin manager), and an enable clears the old\n * page's disable here, so the override file stays the row's only store. An entry left with only `id` (and `name`) is\n * removed; one with other keys keeps them.\n *\n * @returns whether the patch file changed.\n */\nexport async function clearProfilePatchDisable(profileDir: string, patchId: string): Promise<boolean> {\n const path = join(profileDir, PROFILE_PATCH_FILENAME)\n return withFileLock(path, async () => {\n let text: string\n try {\n text = await readFile(path, 'utf8')\n } catch (cause) {\n if ((cause as NodeJS.ErrnoException).code === 'ENOENT') return false\n throw cause\n }\n const document = parseDocument(text, { customTags: [{ tag: 'tag:yaml.org,2002:js', resolve: (value: string) => value }] })\n if (document.errors.length > 0 || !isSeq(document.contents)) return false\n const items = document.contents.items\n let changed = false\n for (let index = items.length - 1; index >= 0; index -= 1) {\n const item = items[index]\n if (!isMap(item) || item.has('insert') || document.getIn([index, 'id']) !== patchId || document.getIn([index, 'disabled']) !== true) continue\n item.delete('disabled')\n if (item.items.every(pair => ['id', 'name'].includes(String(isScalar(pair.key) ? pair.key.value : pair.key)))) {\n // A comment written above the removed entry stays, above whatever follows it.\n const comment = item.commentBefore\n items.splice(index, 1)\n if (comment !== undefined && comment !== null) {\n const next = items[index] as { commentBefore?: string | null } | undefined\n if (next !== undefined && next !== null && typeof next === 'object') next.commentBefore = next.commentBefore ? `${comment}\\n${next.commentBefore}` : comment\n else document.comment = document.comment ? `${document.comment}\\n${comment}` : comment\n }\n }\n changed = true\n }\n if (changed) await writeFileAtomic(path, String(document), { mode: STATE_FILE_MODE })\n return changed\n })\n}\n\n/**\n * Convert persisted overrides into profile overlay rows for the rows this\n * composition has. A disable patch matches its target by id only - no `name`,\n * so a row whose id and package name differ (e.g. `dsh-editor` /\n * `acryl-dsh-editor-plugin`) still disables. A disable whose row is not\n * composed (its plugin was uninstalled) yields no patch, so the Loader does not\n * warn on every boot; it stays stored, applies again when the plugin comes\n * back, and `acryl plugin doctor` reports it as a stale override.\n * @param persistence - the override file and profile to read.\n * @param composedRowIds - the Loader row ids the composition already has.\n * @returns one disable patch per stored disable whose row is composed.\n */\nexport function pluginLifecyclePatches(\n persistence: PluginLifecycleStatePersistence,\n composedRowIds: ReadonlySet<string>,\n): readonly { readonly id: string; readonly disabled: true }[] {\n return [...readDisabledPluginLifecycleEntries(persistence)]\n .map(entryPatchId)\n .filter(id => composedRowIds.has(id))\n .map(id => ({ id, disabled: true as const }))\n}\n","/**\n * The DSH-profile plugin lifecycle: one host policy, mounted as one Cordis\n * service, for every ACRYL surface (spec 034, T005).\n *\n * The lifecycle mechanics live in `@acryldev/control`'s host-neutral controller.\n * What is left here is the part that is the same on the Desktop, the Web host,\n * and the CLI: which rows a DSH profile admits to user control, where the\n * override file lives, and how a just-installed profile bundle inserts its row.\n * A surface that needs more (Desktop's Blend rows and market bookkeeping)\n * passes it in through the options rather than forking the policy.\n *\n * @module @acryldev/harness-runtime/plugin-lifecycle\n */\n\nimport { readFileSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport { dirname, join } from 'node:path'\nimport type { Context } from '@deepseek-ai/cordis'\nimport type { EntryGroup } from '@deepseek-ai/cordis-plugin-loader'\nimport { loadOverlayPatches } from '@deepseek-ai/dsh-app-boot'\nimport {\n AcrPluginLifecycleController,\n AcrPluginLifecycleService,\n PROTECTED_PLUGIN_ENTRY_REASON,\n PluginLifecycleError,\n type PluginLifecycleEntryRef,\n type PluginLifecycleHost,\n} from '@acryldev/control'\nimport {\n clearProfilePatchDisable,\n entryPatchId,\n readUserMutableBundleNames,\n setPluginLifecycleEntryEnabled,\n type PluginLifecycleStatePersistence,\n type ProfileNameValidator,\n} from './plugin-lifecycle-state.ts'\n\n/** Options every surface's DSH-profile lifecycle host is built from. */\nexport interface DshPluginLifecycleOptions {\n /** Profile whose override list this host reads and writes. */\n readonly profileName: string\n /** Profile directory - the source of the user-installed bundle list. */\n readonly profileDir: string\n /** Absolute path of the shared `plugin-lifecycle/state.json`. */\n readonly statePath: string\n /**\n * Loader row ids this surface itself admits to user control, in their runtime\n * spelling (`include:<row>` when the row is composed through an include).\n * Called on every policy read, so a surface may derive it lazily; the rows of\n * the profile's own `dsh.profile.bundles` are admitted on top of it.\n */\n readonly mutableEntryIds?: () => ReadonlySet<string>\n /** Name this host's bundle-patch diagnostics attribute a failure to. */\n readonly binName?: string\n /** Explanation shown for a non-mutable entry. */\n readonly protectedReason?: string\n /** Bookkeeping after a package leaves the Loader tree. Best effort. */\n readonly afterDeactivate?: (packageName: string) => Promise<void>\n /** Narrower reload-all sweep, when restarting every mutable entry is too much. */\n readonly reloadAllEntryIds?: () => ReadonlySet<string>\n /**\n * Resolves a bare module specifier from the profile's own module base (a\n * profile's `node_modules`, where a user-installed bundle lives) - normally\n * just `require.resolve`/`createRequire(...).resolve` bound to that base.\n * Despite the parameter's own name, `createDshPluginLifecycleHost`'s\n * internal caller always passes the full `\"<packageName>/package.json\"`\n * specifier already, never the bare package name - do not re-append\n * `/package.json` inside this callback (a real, reproduced bug: doing so\n * throws `ERR_PACKAGE_PATH_NOT_EXPORTED` on a literal\n * `package.json/package.json` subpath). Defaults to the context's base URL,\n * which is the profile directory for a surface that boots the profile\n * itself and is not for one whose root is elsewhere - the CLI composes the\n * profile under its own engine host, so it passes the profile-resolving\n * form explicitly.\n */\n readonly resolvePackageJson?: (specifier: string) => string\n /** Reports a best-effort failure that must not throw to its caller. */\n readonly warn?: (message: string) => void\n /** Profile-name rule, when this surface names profiles its own way. */\n readonly validateProfileName?: ProfileNameValidator\n}\n\ninterface BundleManifest {\n readonly name?: unknown\n readonly dsh?: { readonly bundle?: { readonly patch?: unknown } }\n}\n\n/**\n * Build the host policy for one DSH profile.\n *\n * @param ctx - the context whose Loader tree is being steered and whose\n * base URL resolves installed packages.\n * @param options - which profile, and whatever this surface adds to the\n * shared bundle policy.\n */\nexport function createDshPluginLifecycleHost(\n ctx: Context,\n options: DshPluginLifecycleOptions,\n): PluginLifecycleHost {\n const binName = options.binName ?? 'acryl'\n const resolveManifest = options.resolvePackageJson\n ?? (ctx.baseUrl === undefined ? undefined : createRequire(ctx.baseUrl).resolve)\n const resolvePackageJson = resolveManifest === undefined\n ? undefined\n : (packageName: string) => resolveManifest(`${packageName}/package.json`)\n const persistence: PluginLifecycleStatePersistence = {\n profileName: options.profileName,\n statePath: options.statePath,\n ...(options.validateProfileName === undefined\n ? {}\n : { validateProfileName: options.validateProfileName }),\n }\n // Re-read on every mutation, never cached across one: a package manager\n // writes `dsh.profile.bundles` milliseconds before it asks for a live mount.\n let userBundleNames = readUserMutableBundleNames(options.profileDir)\n\n const protectedReason = options.protectedReason ?? PROTECTED_PLUGIN_ENTRY_REASON\n const warn = options.warn ?? ((message: string) => { ctx.logger?.warn?.(message) })\n\n const isBundlePackage = (packageName: string): boolean => userBundleNames.has(packageName)\n\n /** The `{ id, name }` a profile bundle inserts, read from its own patch. */\n function bundleInsertRow(packageName: string): { readonly id: string; readonly name: string } {\n if (resolvePackageJson === undefined) {\n throw new PluginLifecycleError(\n 'lifecycle-failed',\n 'Package resolution is unavailable in this context.',\n )\n }\n const packageDir = dirname(resolvePackageJson(packageName))\n const manifest = JSON.parse(\n readFileSync(join(packageDir, 'package.json'), 'utf8'),\n ) as BundleManifest\n const patchRel = manifest.dsh?.bundle?.patch\n if (typeof patchRel !== 'string') {\n throw new PluginLifecycleError(\n 'lifecycle-failed',\n `Package ${packageName} declares no dsh.bundle.patch.`,\n )\n }\n const patches = loadOverlayPatches(binName, join(packageDir, patchRel)) as ReadonlyArray<{\n readonly insert?: ReadonlyArray<{ readonly id?: unknown; readonly name?: unknown }>\n }>\n const row = patches.find(patch => Array.isArray(patch.insert))?.insert?.[0]\n if (typeof row?.id !== 'string' || typeof row.name !== 'string') {\n throw new PluginLifecycleError(\n 'lifecycle-failed',\n `Package ${packageName} bundle patch has no insert row.`,\n )\n }\n return { id: row.id, name: row.name }\n }\n\n return {\n isMutable(entry: PluginLifecycleEntryRef): boolean {\n if (entry.group) return false\n if (options.mutableEntryIds?.().has(entry.entryId) === true) return true\n return isBundlePackage(entry.moduleName)\n },\n protectedReason: () => protectedReason,\n refresh(): void {\n userBundleNames = readUserMutableBundleNames(options.profileDir)\n },\n async setEnabled(entryId: string, enabled: boolean): Promise<void> {\n await setPluginLifecycleEntryEnabled(persistence, entryId, enabled)\n // One store per row (spec 001 T089): a disable DSH's page once wrote into the profile patch would keep the row off.\n if (enabled) await clearProfilePatchDisable(options.profileDir, entryPatchId(entryId))\n },\n bundleRow(packageName: string) {\n if (!isBundlePackage(packageName)) {\n throw new PluginLifecycleError(\n 'protected-entry',\n `Package ${packageName} is not a profile bundle in the active profile.`,\n )\n }\n return bundleInsertRow(packageName)\n },\n bundleGroup(): EntryGroup {\n const sibling = [...ctx.loader.entries()]\n .find(entry => !entry.options.group && entry.id.startsWith('include:'))\n if (sibling === undefined) {\n throw new PluginLifecycleError(\n 'lifecycle-failed',\n 'The profile include group is not available.',\n )\n }\n return sibling.parent\n },\n warn,\n ...(options.afterDeactivate === undefined ? {} : { afterDeactivate: options.afterDeactivate }),\n ...(options.reloadAllEntryIds === undefined ? {} : { reloadAllEntryIds: options.reloadAllEntryIds }),\n }\n}\n\n/**\n * Build the lifecycle authority for one context: the one controller every\n * surface drives. Publishes nothing, so a surface that composes its own\n * capabilities (Desktop) can build it before deciding what to register.\n *\n * @param ctx - the context whose Loader tree it steers.\n * @param options - that surface's DSH-profile lifecycle host options.\n */\nexport function createAcrylPluginLifecycle(\n ctx: Context,\n options: DshPluginLifecycleOptions,\n): AcrPluginLifecycleController {\n return new AcrPluginLifecycleController(ctx, createDshPluginLifecycleHost(ctx, options))\n}\n\n/**\n * Publish that authority on `ctx.acrPluginLifecycle` for the caller's fiber\n * lifetime. Every surface renders its own view of the snapshot; none of them\n * re-implements enable, disable, or reload.\n *\n * @param ctx - the plugin context the service belongs to.\n * @param options - that surface's DSH-profile lifecycle host options.\n */\nexport function mountAcrylPluginLifecycle(\n ctx: Context,\n options: DshPluginLifecycleOptions,\n): AcrPluginLifecycleService {\n return new AcrPluginLifecycleService(ctx, createAcrylPluginLifecycle(ctx, options))\n}\n","/**\n * CLI/TUI's own `desktopPlugins` + `livePluginActivation` capabilities (spec\n * 034, completing T006 for the third surface) - the package-name-shaped view\n * `@acryldev/cordis-plugin-market`'s install service needs, plus real live activation\n * so an install through the TUI's own `/plugins` command takes effect\n * without restarting the process.\n *\n * Adapted directly from `web-market-plugins.ts` - not a new lifecycle\n * implementation. It wraps the same shared `AcrPluginLifecycleController`\n * (spec 034 T005) the CLI's own `acryl plugin enable/disable` and Desktop's\n * Lifecycle tab already drive.\n */\n\nimport { randomUUID } from 'node:crypto'\nimport { type Context, Service } from '@deepseek-ai/cordis'\nimport type { AcrPluginLifecycleController } from '@acryldev/control'\nimport {\n mountAcrylPluginLifecycle,\n type DshPluginLifecycleOptions,\n} from './plugin-lifecycle.ts'\n\nexport interface CliMarketPluginBundle {\n readonly bundleId: string\n readonly packageName: string\n readonly status: 'active' | 'disabled'\n readonly mutable: boolean\n}\n\ninterface PreviewEntry {\n readonly entryId: string\n readonly packageName: string\n readonly targetEnabled: boolean\n readonly expiresAt: number\n}\n\n// No `declare module '@deepseek-ai/cordis'` augmentation here - same reason\n// as web-market-plugins.ts.\n\nconst PREVIEW_TTL_MS = 5 * 60 * 1000\nconst MAX_PREVIEWS = 256\n/** Matches @acryldev/cordis-plugin-market's own PACKAGE_NAME_PATTERN. */\nconst NPM_PACKAGE_NAME_PATTERN = /^(?:@[a-z0-9][a-z0-9._-]*\\/)?[a-z0-9][a-z0-9._-]*$/u\n\n/** Matches `@acryldev/cordis-plugin-market`'s own `MarketDesktopPlugins` shape exactly. */\nexport class CliPluginsService extends Service {\n private readonly previews = new Map<string, PreviewEntry>()\n\n private readonly controller: AcrPluginLifecycleController\n private readonly profileName: string\n\n constructor(ctx: Context, options: { readonly controller: AcrPluginLifecycleController; readonly profileName: string }) {\n super(ctx, 'desktopPlugins')\n this.controller = options.controller\n this.profileName = options.profileName\n }\n\n list(): readonly CliMarketPluginBundle[] {\n return this.controller.snapshot().entries\n .filter(entry => NPM_PACKAGE_NAME_PATTERN.test(entry.moduleName))\n .map(entry => ({\n bundleId: entry.entryId,\n packageName: entry.moduleName,\n status: entry.enabled ? 'active' : 'disabled',\n mutable: entry.mutable,\n }))\n }\n\n disabledPackageNames(): readonly string[] {\n return this.controller.snapshot().entries\n .filter(entry => !entry.enabled && NPM_PACKAGE_NAME_PATTERN.test(entry.moduleName))\n .map(entry => entry.moduleName)\n }\n\n isDisabled(packageName: string): boolean {\n return this.disabledPackageNames().includes(packageName)\n }\n\n private mintPreview(bundleId: string, targetEnabled: boolean): { readonly previewId: string; readonly profileName: string; readonly packageName: string; readonly expiresAt: string } {\n const entry = this.controller.snapshot().entries.find(candidate => candidate.entryId === bundleId)\n if (entry === undefined) throw new Error(`cli plugins: no such bundle ${JSON.stringify(bundleId)}`)\n if (!entry.mutable) throw new Error(`cli plugins: bundle ${JSON.stringify(bundleId)} is not user-mutable`)\n const expectedCurrent = !targetEnabled\n if (entry.enabled !== expectedCurrent) {\n throw new Error(`cli plugins: bundle ${JSON.stringify(bundleId)} is already ${entry.enabled ? 'enabled' : 'disabled'}`)\n }\n if (this.previews.size >= MAX_PREVIEWS) {\n const oldest = this.previews.keys().next().value\n if (oldest !== undefined) this.previews.delete(oldest)\n }\n const previewId = randomUUID()\n const expiresAt = Date.now() + PREVIEW_TTL_MS\n this.previews.set(previewId, { entryId: bundleId, packageName: entry.moduleName, targetEnabled, expiresAt })\n return { previewId, profileName: this.profileName, packageName: entry.moduleName, expiresAt: new Date(expiresAt).toISOString() }\n }\n\n previewDisable(bundleId: string) {\n return this.mintPreview(bundleId, false)\n }\n\n previewEnable(bundleId: string) {\n return this.mintPreview(bundleId, true)\n }\n\n // Same reasoning as WebPluginsService.execute() (web-market-plugins.ts):\n // `controller.setEnabled()` applies live via Cordis' reactive Loader before\n // resolving, so a resolved call always means `live: true`. Omitting this\n // field left `MarketDesktopPlugins.executeEnable/executeDisable`'s\n // `restartRequired` computation (@acryldev/cordis-plugin-market/src/host/routes.ts)\n // permanently `true` for CLI too - same copy-pasted gap as Web had.\n private async execute(previewId: string, targetEnabled: boolean): Promise<{ readonly packageName: string; readonly live: boolean }> {\n const preview = this.previews.get(previewId)\n if (preview === undefined || preview.targetEnabled !== targetEnabled) {\n throw new Error('cli plugins: preview not found or expired')\n }\n this.previews.delete(previewId)\n if (Date.now() > preview.expiresAt) throw new Error('cli plugins: preview expired')\n await this.controller.setEnabled(preview.entryId, targetEnabled)\n return { packageName: preview.packageName, live: true }\n }\n\n executeDisable(previewId: string): Promise<{ readonly packageName: string; readonly live: boolean }> {\n return this.execute(previewId, false)\n }\n\n executeEnable(previewId: string): Promise<{ readonly packageName: string; readonly live: boolean }> {\n return this.execute(previewId, true)\n }\n}\n\n/**\n * Live activation for a CLI/TUI process - the same shared\n * `AcrPluginLifecycleController` Web and Desktop already drive, mounting a\n * just-installed package into the live Loader tree without a process\n * restart. The TUI's own `/plugins` command calls this directly after a\n * successful install and then refreshes its own dynamic slash-command list\n * (spec 034 T009) - there is no separate renderer process to reload here,\n * unlike Web's `location.reload()` or Desktop's Client webContents reload.\n */\nexport class CliLiveActivationService extends Service {\n constructor(ctx: Context, private readonly controller: AcrPluginLifecycleController) {\n super(ctx, 'livePluginActivation')\n }\n\n async activate(packageName: string): Promise<void> {\n await this.controller.activate(packageName)\n }\n\n async deactivate(packageName: string): Promise<void> {\n await this.controller.deactivate(packageName)\n }\n\n requireModules(owner: string, modules: readonly string[]): Promise<void> {\n return this.controller.requireModules(owner, modules)\n }\n\n setEnabled(packageName: string, enabled: boolean): Promise<boolean> {\n return this.controller.setEnabledByPackageName(packageName, enabled)\n }\n\n statusOf(packageName: string): 'active' | 'disabled' | undefined {\n return this.controller.statusOfPackage(packageName)\n }\n}\n\n/**\n * Mount the shared plugin lifecycle for this CLI process and provide the\n * market-shaped view over it, plus live activation.\n * @param ctx - the host root.\n * @param options - the same options shape the CLI's own `plugin-command.ts` already builds.\n */\nexport function provideCliMarketPlugins(ctx: Context, options: DshPluginLifecycleOptions): AcrPluginLifecycleController {\n const lifecycle = mountAcrylPluginLifecycle(ctx, options)\n ctx.plugin(CliPluginsService, { controller: lifecycle.controller, profileName: options.profileName })\n ctx.plugin(CliLiveActivationService, lifecycle.controller)\n return lifecycle.controller\n}\n","/**\n * ACRYL's first real model-facing tool, registered as an ordinary Cordis plugin\n * on the native `ctx.tools` seam.\n *\n * @module @acryldev/harness-runtime/acryl-workspace-status\n *\n * This is the ACRYL hard gate: a genuine model-facing Tool that injects `tools`,\n * registers via `ctx.tools.register(defineTool(...))`, declares a canonical\n * typed `output.schema` and a separate `render(...)` for model-facing content,\n * honours `exec.signal`, and disposes cleanly when its owning Fiber unloads.\n * It is ACRYL-owned context (the workspace/profile the agent is running in) and\n * deliberately does NOT re-implement a DSH file/shell/web tool.\n */\n\nimport type { Context } from '@deepseek-ai/cordis'\nimport { defineTool } from '@deepseek-ai/dsh-tools'\nimport type { ContentBlock } from '@deepseek-ai/dsh-llm'\nimport { selectInstance } from './instance/index.ts'\n\n/** Cordis plugin name used by loader diagnostics. */\nexport const name = 'acryl-workspace-status'\n\n/** Services required: the tool registry. */\nexport const inject = ['tools']\n\n/** Canonical tool name exposed to the model. */\nexport const TOOL_NAME = 'acryl_workspace_status'\n\ninterface AcrylWorkspaceContext {\n readonly cwd: string\n readonly dshHome: string\n readonly profile: string\n readonly surface: string\n}\n\n/** Read the ACRYL workspace/profile context the agent is running under. */\nfunction readWorkspaceContext(): AcrylWorkspaceContext {\n return {\n cwd: process.cwd(),\n dshHome: selectInstance().dshHome,\n profile: process.env.ACRYL_PROFILE ?? '',\n surface: process.env.ACRYL_SURFACE ?? '',\n }\n}\n\n/** Render one line of the model-facing text from the canonical context value. */\nfunction fmt(\n label: string,\n value: string,\n prefix: string,\n): string {\n return `${prefix} ${label}: ${value}`\n}\n\n/** Register the `acryl_workspace_status` tool on `ctx.tools`. Returns a disposer. */\nexport function installAcrylWorkspaceStatusTool(ctx: Context): () => void {\n const tool = defineTool({\n name: TOOL_NAME,\n description:\n 'Report the ACRYL workspace context the agent is operating in: current working '\n + 'directory, DSH home, active ACRYL profile, and presentation surface. Use it to '\n + 'confirm which project/profile a session is bound to before acting.',\n parameters: {},\n output: {\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n cwd: { type: 'string', required: true },\n dshHome: { type: 'string', required: true },\n profile: { type: 'string', required: true },\n surface: { type: 'string', required: true },\n },\n },\n render(_args: unknown, value: unknown): ContentBlock[] {\n const v = value as AcrylWorkspaceContext\n const head = 'ACRYL workspace context:'\n const lines = [\n fmt('cwd', v.cwd, '-'),\n fmt('dshHome', v.dshHome || '<unset>', '-'),\n fmt('profile', v.profile || '<default>', '-'),\n fmt('surface', v.surface || '<unknown>', '-'),\n ]\n return [{ type: 'text', text: [head, ...lines].join('\\n') }]\n },\n },\n async execute(_args: unknown, _exec): Promise<AcrylWorkspaceContext> {\n // Same-process, zero-resource: no async work beyond a microtask so the\n // tool still honours the call/cancellation pipeline and quiesces.\n return readWorkspaceContext()\n },\n })\n return ctx.tools.register(tool)\n}\n\n/** Cordis plugin entry point for idiomatic composition via a Loader row. */\nexport function apply(ctx: Context): void {\n installAcrylWorkspaceStatusTool(ctx)\n}\n","/**\n * BrandIdentity: the value object a Blueprint carries so anyone who builds on ACRYL can ship it under their own name\n * (a private, closed-source product or an internal tool). Pure: no I/O, no framework types. Every invariant is\n * enforced at construction, so a Blueprint can never hold a brand the client cannot render.\n *\n * @module @acryldev/harness-runtime/blueprint/brand-identity\n */\n\nconst HEX_COLOR = /^#[0-9a-fA-F]{6}$/u\nconst MAX_NAME = 40\nconst MAX_TAGLINE = 120\nconst MAX_FONT_FAMILY = 200\nconst MAX_MARK = 3\n\nexport interface BrandIdentity {\n /** Product name shown in the sidebar, the tab or window title and the agent's own identity line. */\n readonly name: string\n readonly tagline?: string\n /** Accent color as `#rrggbb`; `accentDark` is the dark-mode variant (defaults to `accent`). */\n readonly accent?: string\n readonly accentDark?: string\n /** A CSS font-family list. */\n readonly fontFamily?: string\n /** One to three characters drawn as the logo mark when no image is supplied (defaults to the name's first letter). */\n readonly mark?: string\n}\n\nexport class InvalidBrandIdentityError extends Error {\n constructor(detail: string) {\n super(`Invalid brand identity: ${detail}`)\n this.name = 'InvalidBrandIdentityError'\n }\n}\n\nfunction optionalText(record: Record<string, unknown>, key: string, max: number): string | undefined {\n const value = record[key]\n if (value === undefined) return undefined\n if (typeof value !== 'string' || value.trim() === '' || value.length > max) {\n throw new InvalidBrandIdentityError(`\"${key}\" must be a non-empty string of at most ${String(max)} characters`)\n }\n return value.trim()\n}\n\nfunction optionalColor(record: Record<string, unknown>, key: string): string | undefined {\n const value = optionalText(record, key, 7)\n if (value !== undefined && !HEX_COLOR.test(value)) throw new InvalidBrandIdentityError(`\"${key}\" must be a #rrggbb color`)\n return value\n}\n\n/** Validate untrusted input (a YAML row config, an environment value) into a BrandIdentity. */\nexport function brandIdentity(input: unknown): BrandIdentity {\n if (input === null || typeof input !== 'object' || Array.isArray(input)) throw new InvalidBrandIdentityError('expected an object')\n const record = input as Record<string, unknown>\n const name = optionalText(record, 'name', MAX_NAME)\n if (name === undefined) throw new InvalidBrandIdentityError('\"name\" is required')\n const tagline = optionalText(record, 'tagline', MAX_TAGLINE)\n const accent = optionalColor(record, 'accent')\n const accentDark = optionalColor(record, 'accentDark')\n const fontFamily = optionalText(record, 'fontFamily', MAX_FONT_FAMILY)\n const mark = optionalText(record, 'mark', MAX_MARK)\n return {\n name,\n ...(tagline === undefined ? {} : { tagline }),\n ...(accent === undefined ? {} : { accent }),\n ...(accentDark === undefined ? {} : { accentDark }),\n ...(fontFamily === undefined ? {} : { fontFamily }),\n ...(mark === undefined ? {} : { mark }),\n }\n}\n\n/** The agent's opening identity line under this brand (what the system prompt says the agent is). */\nexport function identityLine(brand: BrandIdentity): string {\n // Domain-neutral on purpose: the app may be a music editor, an accounting tool or an IDE. It is the user's product, so it is named, not ACRYL.\n return `You are the assistant inside ${brand.name}. You help its users with what they ask, and you can extend ${brand.name} itself from the inside: when asked, you build, change and remove its plugins (tools, screens, commands) while it runs, and you can read files, run commands and write code to do so.`\n}\n","/**\n * Blueprint: a named, minimal starting composition of ACRYL. The stem cell of the framework: `blank` is the smallest\n * thing that is still a working agent, and everything else is grown from it by adding Cordis plugins (locally first,\n * published when worth sharing). `acryl.ide`, the agentic coding IDE the team ships, is not a separate product: it is one\n * Blend grown from `acryl.blank` (the flagship example of what the framework builds), and `grewFrom` records that lineage.\n *\n * A Blueprint is pure data, keyed by the ubiquitous language of the Blends spec: it names capabilities and optional\n * rows, never Loader mechanics. Turning it into Loader patches is `compose.ts`; choosing one is `selection.ts`.\n * Nothing here is special-cased in the runtime: every row a Blueprint names is an ordinary Cordis plugin, so adding\n * one later, or disabling one, is the same reversible row edit for a human, an agent or a Blend file.\n *\n * @module @acryldev/harness-runtime/blueprint/blueprint\n */\n\nimport { ACRYL_CODING_CAPABILITIES, type AcrylCodingCapabilityId, type AcrylShellMode } from '../coding-capabilities.ts'\nimport { brandIdentity, type BrandIdentity } from './brand-identity.ts'\n\n/** ACRYL-owned rows a Blueprint may include on top of the capabilities. Each is one independently replaceable plugin. */\nexport type BlueprintRowId =\n | 'plugin-context'\n | 'system-prompt'\n | 'ui-library'\n | 'community-market'\n | 'shortcuts'\n | 'mount-anchors'\n | 'app-save'\n | 'plugin-hub'\n | 'app-shell'\n | 'framework-kit'\n | 'command-reply'\n\n/** Every row id, as data: what a Blueprint file may name. Kept next to the type so the two cannot drift (a test asserts it). */\nexport const BLUEPRINT_ROW_IDS: readonly BlueprintRowId[] = ['plugin-context', 'system-prompt', 'ui-library', 'app-save', 'plugin-hub', 'community-market', 'shortcuts', 'mount-anchors', 'app-shell', 'framework-kit', 'command-reply']\n\n/** Row ids a Blueprint file once used, read as their current names (spec 044 step 1b); never written. */\nexport const RENAMED_BLUEPRINT_ROW_IDS: Readonly<Record<string, BlueprintRowId>> = Object.freeze({ 'extension-context': 'plugin-context' })\n\n/** `acryl`: the stock ACRYL brand plugin. `custom`: the configurable `@acryldev/brand` plugin carrying this identity. */\nexport type BlueprintBrand =\n | { readonly kind: 'acryl' }\n | { readonly kind: 'custom', readonly identity: BrandIdentity }\n\nexport interface Blueprint {\n readonly id: string\n readonly name: string\n readonly description: string\n readonly capabilities: readonly AcrylCodingCapabilityId[]\n readonly rows: readonly BlueprintRowId[]\n readonly brand: BlueprintBrand\n readonly shell: AcrylShellMode\n /**\n * Whether the DeepSeek Harness chat (its agent loop and model providers) is part of this composition. Off, the app keeps its frame\n * (tab stripe, workspaces, canvas, terminals, Agent Control) and other agents work in it; the DSH chat is one agent, not the foundation.\n * Applies to the Web and Desktop surfaces: the terminal UI is the DSH chat.\n */\n readonly dshChat: boolean\n /** The Blueprint this one was grown from, when it is a Blend of another (the IDE grew from the blank canvas). */\n readonly grewFrom?: string\n}\n\nfunction freezeBlueprint(blueprint: Blueprint): Blueprint {\n return Object.freeze(blueprint)\n}\n\n/**\n * The stem cell: an agent to talk to, a model chooser (authorization), an input, and the plugin context pack so the agent can\n * grow the rest. No workspace, no Market, no admin panel. The brand is configurable so it can be renamed without code.\n */\nexport const BLANK_BLUEPRINT: Blueprint = freezeBlueprint({\n id: 'acryl.blank',\n name: 'Blank',\n description: 'The smallest working agent that can grow itself: chat, model choice, and the plugin context pack.',\n // `@acryldev/settings` is essential: surface plugins (Desktop's shell, notifications) keep their preferences there.\n capabilities: ['persona', 'agent-roster', 'session-stats', 'authorization', 'acryl-settings'],\n rows: ['plugin-context', 'system-prompt', 'ui-library', 'app-save', 'plugin-hub', 'framework-kit', 'command-reply'],\n brand: { kind: 'custom', identity: brandIdentity({ name: 'Blank', tagline: 'Ask for what you need. It builds it.', accent: '#3b6ef5', accentDark: '#7c9dff' }) },\n shell: 'compatibility',\n dshChat: true,\n})\n\n/**\n * ACRYL the agentic coding IDE: the blank canvas grown into a development environment (workspace, plugin admin, Market, shortcuts, mount anchors, the\n * advanced shell, the ACRYL brand). Written as blank plus what it added, so the lineage is the definition, not a comment. Still the default when no\n * Blueprint is selected, because it is what ACRYL's own installs are.\n */\nexport const IDE_BLUEPRINT: Blueprint = freezeBlueprint({\n id: 'acryl.ide',\n name: 'ACRYL',\n description: 'The agentic coding IDE: a Blend grown from acryl.blank with the workspace, Market, plugin admin, shortcuts and mount anchors.',\n // Every declared capability, derived so a capability added to the table is part of the IDE without a second edit here.\n capabilities: ACRYL_CODING_CAPABILITIES.map(capability => capability.id),\n rows: [...BLANK_BLUEPRINT.rows, 'community-market', 'shortcuts', 'mount-anchors'],\n brand: { kind: 'acryl' },\n shell: 'advanced',\n dshChat: true,\n grewFrom: BLANK_BLUEPRINT.id,\n})\n\n/**\n * The IDE for people who bring their own agents: the same frame and rows, with the DeepSeek Harness chat switched off. Claude Code, Codex or any\n * agent in a terminal tab (or driving the page through Agent Control) works in it; turning the chat back on is one row edit, not a rebuild.\n */\nexport const AGENTS_BLUEPRINT: Blueprint = freezeBlueprint({\n ...IDE_BLUEPRINT,\n id: 'acryl.agents',\n name: 'ACRYL (bring your own agents)',\n description: 'The agentic coding IDE with the DeepSeek Harness chat off: the frame, workspaces, canvas, terminals and Agent Control, for other agents.',\n dshChat: false,\n grewFrom: IDE_BLUEPRINT.id,\n})\n\n/** Read-only port: where Blueprints come from. Built-ins today; a hub, a Blend lock or a private registry later. */\nexport interface BlueprintCatalog {\n get(id: string): Blueprint | undefined\n list(): readonly Blueprint[]\n}\n\nexport function builtInCatalog(): BlueprintCatalog {\n const all = [BLANK_BLUEPRINT, IDE_BLUEPRINT, AGENTS_BLUEPRINT]\n return { get: id => all.find(blueprint => blueprint.id === id), list: () => all }\n}\n\nexport class UnknownBlueprintError extends Error {\n constructor(id: string, known: readonly Blueprint[]) {\n super(`Unknown blueprint ${JSON.stringify(id)}. Known: ${known.map(blueprint => blueprint.id).join(', ')}`)\n this.name = 'UnknownBlueprintError'\n }\n}\n\n/** Use case: pick the Blueprint a surface boots with. No selection means the IDE, what ACRYL's own installs are. */\nexport function selectBlueprint(id: string | undefined, catalog: BlueprintCatalog = builtInCatalog()): Blueprint {\n if (id === undefined || id.trim() === '') return IDE_BLUEPRINT\n const found = catalog.get(id.trim())\n if (found === undefined) throw new UnknownBlueprintError(id, catalog.list())\n return found\n}\n\n/** A copy of a Blueprint under a different brand. Immutable: the original is untouched. */\nexport function withBrand(blueprint: Blueprint, identity: BrandIdentity): Blueprint {\n return freezeBlueprint({ ...blueprint, brand: { kind: 'custom', identity } })\n}\n","/**\n * Compose: the pure translation from a Blueprint to what a surface's Loader needs: which ACRYL-owned packages must be\n * resolvable, and which Loader patches to apply. No I/O and no framework handles; the composition root\n * (`engine-dsh.ts`) does the materializing and mounting. The row table below is the single place a row's package, id\n * and surfaces are declared, in the order the rows must mount (the shortcut registry before anything that reads it).\n *\n * @module @acryldev/harness-runtime/blueprint/compose\n */\n\nimport type { PatchOptions } from '@deepseek-ai/cordis-plugin-include'\nimport type { AcrylSurface } from '../coding-capabilities.ts'\nimport { identityLine } from './brand-identity.ts'\nimport type { Blueprint, BlueprintRowId } from './blueprint.ts'\n\n/** One Loader row: its id, the module it loads (`name`), and the package that module lives in, which the profile must resolve. */\ninterface RowModule {\n readonly rowId: string\n readonly module: string\n readonly packageName: string\n}\n\ninterface RowDeclaration extends RowModule {\n readonly id: BlueprintRowId\n readonly surfaces: readonly AcrylSurface[]\n /** A library a plugin imports rather than mounts: the package must resolve, but there is no Loader row. */\n readonly libraryOnly?: readonly AcrylSurface[]\n /**\n * Rows this row's plugin injects services from, mounted just before it (and once, however many rows name them). They are not\n * Blueprint rows of their own: a Blueprint names capabilities, and which plugin provides a service is this table's business.\n */\n readonly needs?: readonly RowModule[]\n}\n\n/** The framework's package (spec 049 slice 17): its Cordis plugins are subpaths. The package moved into the scope (spec 051 T038); row ids stay as they were. */\nconst FRAMEWORK_PACKAGE = '@acryldev/blends'\n/** The framework's package name before spec 051 T038: a row id is persisted, so it keeps this name while the module moves. */\nconst LEGACY_FRAMEWORK_PACKAGE = 'acrylblends'\n\nfunction frameworkRow(plugin: string): RowModule {\n const module = `${FRAMEWORK_PACKAGE}/cordis/${plugin}`\n return { rowId: `${LEGACY_FRAMEWORK_PACKAGE}/cordis/${plugin}`, module, packageName: FRAMEWORK_PACKAGE }\n}\n\n/**\n * The row id each package-backed row had before spec 051 T038 renamed the packages: a row id is persisted (a composition\n * override names it), so it keeps the name the row was mounted under while the module it loads moves to the scoped package.\n */\nconst LEGACY_PACKAGE_ROW_IDS: Readonly<Record<string, string>> = Object.freeze({\n '@acryldev/plugin-context': 'acryl-plugin-context',\n '@acryldev/system-prompt': 'acryl-system-prompt',\n '@acryldev/ui': '@acryl/ui',\n '@acryldev/app-save': 'acryl-app-save',\n '@acryldev/plugin-hub': 'acryl-plugin-hub',\n '@acryldev/shortcuts': 'acryl-shortcuts',\n '@acryldev/mount-anchors': 'acryl-mount-anchors',\n '@acryldev/command-reply': 'acryl-command-reply',\n '@acryldev/app-shell': 'acryl-app-shell',\n})\n\n/** A row whose module is its own package, under the package's name; its row id is the one it had before the rename. */\nfunction packageRow(packageName: string): RowModule {\n return { rowId: LEGACY_PACKAGE_ROW_IDS[packageName] ?? packageName, module: packageName, packageName }\n}\n\n/** The router (`ctx.router`) and its Web adapter (`ctx.routerHttp`), which the Market injects (spec 046). */\nconst ROUTER_ROWS: readonly RowModule[] = [frameworkRow('router'), frameworkRow('router-http')]\n\n/** The framework base kit (spec 046): routes, shared state and the inspector, served over HTTP on the Web surface. The inspector row pulls in the rest. */\nconst FRAMEWORK_NEEDS: readonly RowModule[] = [...ROUTER_ROWS, frameworkRow('state')]\n\n/** Declaration order is mount order. The Market is Web-only here: Desktop owns its own provider switch. */\nconst ROWS: readonly RowDeclaration[] = [\n { id: 'community-market', surfaces: ['web'], rowId: 'community-market', module: '@acryldev/cordis-plugin-market', packageName: '@acryldev/cordis-plugin-market', needs: ROUTER_ROWS },\n { id: 'framework-kit', surfaces: ['web', 'desktop'], ...frameworkRow('inspect'), needs: FRAMEWORK_NEEDS },\n { id: 'plugin-context', surfaces: ['tui', 'web', 'desktop'], ...packageRow('@acryldev/plugin-context') },\n { id: 'system-prompt', surfaces: ['tui', 'web', 'desktop'], ...packageRow('@acryldev/system-prompt') },\n { id: 'ui-library', surfaces: ['tui', 'web', 'desktop'], ...packageRow('@acryldev/ui'), libraryOnly: ['tui'] },\n // Saving an app to its own repository (/app save, /app connect): a command, so it works on every surface.\n { id: 'app-save', surfaces: ['tui', 'web', 'desktop'], ...packageRow('@acryldev/app-save') },\n // Saving, sharing and pulling plugins (spec 044): the pluginHub service and /plugin, part of every Blend's base kit.\n { id: 'plugin-hub', surfaces: ['tui', 'web', 'desktop'], ...packageRow('@acryldev/plugin-hub') },\n // ACRYL's keyboard commands on DSH 0.2's own shortcut service (`ctx.shortcuts.register`): upstream owns the registry, persisted rebinding and the\n // editor, so this package no longer provides a service of its own (a second provider fails the client boot).\n { id: 'shortcuts', surfaces: ['web', 'desktop'], ...packageRow('@acryldev/shortcuts') },\n { id: 'mount-anchors', surfaces: ['web', 'desktop'], ...packageRow('@acryldev/mount-anchors') },\n // A host command's reply on the start page, where the conversation that would show it is not drawn yet (spec 049 T002).\n { id: 'command-reply', surfaces: ['web', 'desktop'], ...packageRow('@acryldev/command-reply') },\n // The three-column app frame a domain plugin claims for its own main UI (`desktop.main`), with the conversation beside it, instead of the stock\n // chat frame (blend-instance-design.md 0a). The IDE composes the same frame through its coding capabilities.\n { id: 'app-shell', surfaces: ['web', 'desktop'], ...packageRow('@acryldev/app-shell') },\n]\n\n/**\n * The DSH rows that make it a chat: the agent, the model registry and the pi-ai provider. Disabling them leaves the web server, the session\n * store, the client and every ACRYL row running; Cordis parks the consumers that need them as PENDING (measured on 0.2.0-rc.2: 17 rows, among them\n * the chat session controller and the model providers) and reactivates them when the rows come back.\n */\nexport const DSH_CHAT_ROW_IDS: readonly string[] = ['agent', 'llm', 'llm-pi-ai']\n\n/** DSH's base-bundle row providing `pluginManager`, and the hub's row that takes its place (its id is its module, by the row-naming rule). */\nexport const DSH_PLUGIN_MANAGER_ROW_ID = 'plugin-manager'\n/** The plugin manager row's id, from before the rename (persisted); the module it mounts is the scoped package's subpath. */\nexport const PLUGIN_MANAGER_ROW_ID = 'acryl-plugin-hub/manager'\nconst PLUGIN_MANAGER_MODULE = '@acryldev/plugin-hub/manager'\n\n/** The terminal library is a differently named package than the browser one. */\nconst TUI_LIBRARY_PACKAGE = '@acryldev/ui-tui'\n\n/**\n * Modules a Blend once named, read as their current names and never written: `@acryldev/plugin-context`'s old name (spec 044 step 1b), and the\n * framework packages that became subpaths of `acrylblends` when the framework moved to its own repository (spec 049 slice 17).\n */\nexport const RENAMED_MODULES: Readonly<Record<string, string>> = Object.freeze({\n 'acryl-extension-context': '@acryldev/plugin-context',\n '@acryldev/router': frameworkRow('router').module,\n '@acryldev/router-http': frameworkRow('router-http').module,\n '@acryldev/state': frameworkRow('state').module,\n '@acryldev/inspect': frameworkRow('inspect').module,\n '@acryldev/node-server': frameworkRow('node-server').module,\n '@acryldev/door': frameworkRow('door').module,\n '@acryldev/db': frameworkRow('db').module,\n '@acryldev/db-sqlite': frameworkRow('db-sqlite').module,\n '@acryldev/kv': frameworkRow('kv').module,\n '@acryldev/kv-json': frameworkRow('kv-json').module,\n '@acryldev/kv-db': frameworkRow('kv-db').module,\n})\n\n/** A module as it is named today: a renamed one under its current name, anything else unchanged. */\nexport function currentModule(module: string): string {\n return RENAMED_MODULES[module] ?? module\n}\n\n/** The package a module specifier lives in: `acrylblends/cordis/router` is in `acrylblends`, `@acryldev/ui` in itself. */\nexport function packageOfModule(module: string): string {\n const parts = module.split('/')\n return module.startsWith('@') ? parts.slice(0, 2).join('/') : parts[0] ?? module\n}\n\n/** Which Blueprint row a module is, if it is one of ACRYL's own rows (used to read a Blends manifest's rows back into a Blueprint). */\nexport function blueprintRowForModule(module: string): BlueprintRowId | undefined {\n const current = currentModule(module)\n return ROWS.find(row => row.module === current)?.id\n}\n\n/** The row that fills a Blueprint row (used to write a Blueprint as a Blends manifest). */\nexport function rowForBlueprintRow(id: BlueprintRowId): RowModule {\n const row = ROWS.find(candidate => candidate.id === id)\n if (row === undefined) throw new Error(`no row declaration for ${id}`)\n return { rowId: row.rowId, module: row.module, packageName: row.packageName }\n}\n\nexport interface BlueprintComposition {\n /** ACRYL-owned packages to make resolvable from the profile. */\n readonly packages: readonly string[]\n readonly patches: readonly PatchOptions[]\n}\n\n/**\n * The ACRYL-owned rows and brand for one surface. `existingRowIds` are rows the profile's own bundle already composes:\n * an `insert` of the same id would throw at boot, so those rows are skipped rather than composed twice.\n */\nexport function composeBlueprintRows(\n blueprint: Blueprint,\n surface: AcrylSurface,\n existingRowIds: ReadonlySet<string> = new Set(),\n /** The rows the advanced shell replaces, from the surface's composition (`@acryldev/coding-capabilities`' `ADVANCED_SHELL_PATCHES`). */\n appFramePatches: readonly PatchOptions[] = [],\n): BlueprintComposition {\n const packages: string[] = []\n const patches: PatchOptions[] = []\n const mountedNeeds = new Set<string>()\n\n // Brand first: it swaps the stock identity row and must exist before any client row reads it.\n if (surface === 'web' || surface === 'desktop') {\n if (blueprint.brand.kind === 'acryl') {\n packages.push('@acryldev/brand-client')\n patches.push(\n { id: 'ui-brand-official', disabled: true },\n { insert: [{ id: 'ui-acryl', name: '@acryldev/brand-client', disabled: false }] },\n )\n } else {\n packages.push('@acryldev/brand')\n patches.push(\n { id: 'ui-brand-official', disabled: true },\n { insert: [{ id: 'brand', name: '@acryldev/brand', config: { ...blueprint.brand.identity } }] },\n )\n }\n }\n\n // After the brand and before ACRYL's own rows: a disabled stock row must not be re-enabled by anything composed later.\n if (!blueprint.dshChat && (surface === 'web' || surface === 'desktop')) {\n for (const id of DSH_CHAT_ROW_IDS) patches.push({ id, disabled: true })\n }\n\n for (const row of ROWS) {\n if (!blueprint.rows.includes(row.id) || !row.surfaces.includes(surface)) continue\n if (row.libraryOnly?.includes(surface) === true) {\n packages.push(TUI_LIBRARY_PACKAGE)\n continue\n }\n for (const need of row.needs ?? []) {\n if (existingRowIds.has(need.rowId) || mountedNeeds.has(need.rowId)) continue\n mountedNeeds.add(need.rowId)\n packages.push(need.packageName)\n patches.push({ insert: [{ id: need.rowId, name: need.module }] })\n }\n if (existingRowIds.has(row.rowId)) continue\n packages.push(row.packageName)\n const identityConfig = row.id === 'system-prompt' && blueprint.brand.kind === 'custom'\n ? { config: { identity: identityLine(blueprint.brand.identity) } }\n : {}\n patches.push({ insert: [{ id: row.rowId, name: row.module, ...identityConfig }] })\n }\n // A Blend that owns its frame turns the stock layout off and the sidebar and conversation rows on, for its domain plugin to render into.\n if (blueprint.rows.includes('app-shell') && (surface === 'web' || surface === 'desktop')) patches.push(...appFramePatches)\n // With the plugin hub, DSH's own plugin manager is replaced by the hub's subclass of it, so DSH's \"Add plugin\" box installs a git address as\n // that repository's released, checked version (spec 044 D7). Swapped, never doubled: Cordis refuses a second `pluginManager` provider.\n if (blueprint.rows.includes('plugin-hub') && !existingRowIds.has(PLUGIN_MANAGER_ROW_ID)) {\n patches.push({ id: DSH_PLUGIN_MANAGER_ROW_ID, disabled: true }, { insert: [{ id: PLUGIN_MANAGER_ROW_ID, name: PLUGIN_MANAGER_MODULE }] })\n }\n return { packages: [...new Set(packages)], patches: structuredClone(patches) }\n}\n","/**\n * Blueprint definition: the pure translation from untrusted data (a parsed YAML or JSON file) into a Blueprint, so a team can\n * define its own starter and brand it without writing code. No I/O here; `selection.ts` reads the file.\n *\n * ```yaml\n * id: acme.notes\n * name: Acme Notes\n * extends: acryl.blank # optional: start from a known Blueprint, then override\n * brand: { name: Acme Notes, accent: '#0a7d4b' }\n * rows: [plugin-context, system-prompt, ui-library, community-market]\n * ```\n *\n * Unknown keys, unknown capabilities and unknown rows are rejected, so a typo is an error at start-up, not a silently missing feature.\n *\n * @module @acryldev/harness-runtime/blueprint/definition\n */\n\nimport { ACRYL_CODING_CAPABILITIES, type AcrylCodingCapabilityId, type AcrylShellMode } from '../coding-capabilities.ts'\nimport { brandIdentity } from './brand-identity.ts'\nimport { BLUEPRINT_ROW_IDS, builtInCatalog, RENAMED_BLUEPRINT_ROW_IDS, type Blueprint, type BlueprintCatalog, type BlueprintRowId } from './blueprint.ts'\n\nconst ID = /^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$/u\nconst KEYS = new Set(['id', 'name', 'description', 'extends', 'capabilities', 'rows', 'brand', 'shell', 'dshChat'])\nconst SHELLS: readonly AcrylShellMode[] = ['compatibility', 'advanced']\n\nexport class InvalidBlueprintError extends Error {\n constructor(detail: string) {\n super(`Invalid blueprint: ${detail}`)\n this.name = 'InvalidBlueprintError'\n }\n}\n\nfunction text(record: Record<string, unknown>, key: string, max: number): string | undefined {\n const value = record[key]\n if (value === undefined) return undefined\n if (typeof value !== 'string' || value.trim() === '' || value.length > max) throw new InvalidBlueprintError(`\"${key}\" must be a non-empty string of at most ${String(max)} characters`)\n return value.trim()\n}\n\nfunction oneOf<T extends string>(record: Record<string, unknown>, key: string, allowed: readonly T[]): readonly T[] | undefined {\n const value = record[key]\n if (value === undefined) return undefined\n if (!Array.isArray(value)) throw new InvalidBlueprintError(`\"${key}\" must be a list`)\n const unknown = value.filter(entry => typeof entry !== 'string' || !allowed.includes(entry as T))\n if (unknown.length > 0) throw new InvalidBlueprintError(`\"${key}\" names ${unknown.map(entry => JSON.stringify(entry)).join(', ')}; known: ${allowed.join(', ')}`)\n return [...new Set(value as T[])]\n}\n\n/** Turn parsed data into a Blueprint. `extends` resolves against `catalog` (built-ins by default). */\nexport function parseBlueprint(input: unknown, catalog: BlueprintCatalog = builtInCatalog()): Blueprint {\n if (input === null || typeof input !== 'object' || Array.isArray(input)) throw new InvalidBlueprintError('expected an object')\n const record = input as Record<string, unknown>\n const stray = Object.keys(record).filter(key => !KEYS.has(key))\n if (stray.length > 0) throw new InvalidBlueprintError(`unknown key ${stray.map(key => JSON.stringify(key)).join(', ')}; known: ${[...KEYS].join(', ')}`)\n\n const id = text(record, 'id', 80)\n if (id === undefined || !ID.test(id)) throw new InvalidBlueprintError('\"id\" is required and must look like acme.notes (lowercase letters, digits, dots and dashes)')\n const parentId = text(record, 'extends', 80)\n const parent = parentId === undefined ? undefined : catalog.get(parentId)\n if (parentId !== undefined && parent === undefined) throw new InvalidBlueprintError(`\"extends\" names ${JSON.stringify(parentId)}, which is not a known blueprint`)\n\n const capabilities = oneOf(record, 'capabilities', ACRYL_CODING_CAPABILITIES.map(capability => capability.id) as readonly AcrylCodingCapabilityId[])\n // A renamed row is read as its current name, so a Blueprint written before the rename still loads.\n const rows = oneOf({ rows: Array.isArray(record.rows) ? record.rows.map(row => RENAMED_BLUEPRINT_ROW_IDS[String(row)] ?? row) : record.rows }, 'rows', BLUEPRINT_ROW_IDS as readonly BlueprintRowId[])\n const shell = text(record, 'shell', 20)\n if (shell !== undefined && !SHELLS.includes(shell as AcrylShellMode)) throw new InvalidBlueprintError(`\"shell\" must be one of ${SHELLS.join(', ')}`)\n if (record.dshChat !== undefined && typeof record.dshChat !== 'boolean') throw new InvalidBlueprintError('\"dshChat\" must be true or false')\n const brand = record.brand === undefined\n ? undefined\n : { kind: 'custom', identity: brandIdentity(record.brand) } as const\n\n const base: Blueprint = parent ?? {\n id, name: id, description: '', capabilities: ['authorization', 'acryl-settings'], rows: ['plugin-context', 'system-prompt'], brand: { kind: 'acryl' }, shell: 'compatibility', dshChat: true,\n }\n const composedCapabilities = capabilities ?? base.capabilities\n const composedRows = rows ?? base.rows\n // A capability that serves its routes through the router needs the framework kit, which brings it; without it the plugin would wait (PENDING) silently.\n const needsRouter = ACRYL_CODING_CAPABILITIES.find(capability => capability.needsRouter === true && composedCapabilities.includes(capability.id))\n if (needsRouter !== undefined && !composedRows.includes('framework-kit')) {\n throw new InvalidBlueprintError(`the ${JSON.stringify(needsRouter.id)} capability needs the \"framework-kit\" row, which serves its routes`)\n }\n return Object.freeze({\n id,\n name: text(record, 'name', 80) ?? (parent === undefined ? base.name : id),\n description: text(record, 'description', 300) ?? base.description,\n capabilities: composedCapabilities,\n rows: composedRows,\n brand: brand ?? base.brand,\n shell: (shell as AcrylShellMode | undefined) ?? base.shell,\n dshChat: record.dshChat === undefined ? base.dshChat : record.dshChat,\n })\n}\n","/**\n * The app definition file (`blend.yaml`) is a Blends manifest (`blends.acryl.dev/v1alpha1`), so one file is both what the Blends tooling reads, captures\n * and publishes and what this runtime boots from. The format itself (schema, structural rules, lineage) is validated by `@acryldev/blends-core`, the one\n * reader of the format; this module is only the translation between the two vocabularies, pure and in both directions:\n *\n * manifest -> Blueprint `kind: Blend` grows from `spec.lineage.blueprint` (a known Blueprint); `kind: Blueprint` names one. Rows whose package is one of\n * ACRYL's own rows turn that capability on (or off with `disabled: true`); the `@acryldev/brand` row's config is the brand. Any other\n * row is an app plugin: it lives in the app's `extensions/` and loads from there, so the Blueprint does not compose it.\n * Blueprint -> manifest what `acryl new` writes.\n *\n * @module @acryldev/harness-runtime/blueprint/manifest\n */\n\nimport { validateDefinition } from '@acryldev/blends-core'\nimport { brandIdentity, type BrandIdentity } from './brand-identity.ts'\nimport { builtInCatalog, type Blueprint, type BlueprintCatalog, type BlueprintRowId } from './blueprint.ts'\nimport { blueprintRowForModule, rowForBlueprintRow } from './compose.ts'\nimport { InvalidBlueprintError } from './definition.ts'\n\nexport const BLENDS_API_VERSION = 'blends.acryl.dev/v1alpha1'\nexport const BRAND_PACKAGE = '@acryldev/brand'\n\nconst ID = /^[a-z][a-z0-9-]*(?:\\.[a-z0-9][a-z0-9-]*)+$/u\n\ninterface ManifestRow {\n readonly id: string\n readonly name: string\n readonly config?: Record<string, unknown>\n readonly disabled?: boolean\n}\n\nexport function isBlendsManifest(input: unknown): boolean {\n return input !== null && typeof input === 'object' && (input as Record<string, unknown>).apiVersion === BLENDS_API_VERSION\n}\n\nfunction record(value: unknown, what: string): Record<string, unknown> {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) throw new InvalidBlueprintError(`${what} must be an object`)\n return value as Record<string, unknown>\n}\n\nfunction rowsOf(spec: Record<string, unknown>): readonly ManifestRow[] {\n const rows = spec.rows\n if (rows === undefined) return []\n if (!Array.isArray(rows)) throw new InvalidBlueprintError('\"spec.rows\" must be a list')\n return rows.map((row, index) => {\n const entry = record(row, `spec.rows[${String(index)}]`)\n if (typeof entry.id !== 'string' || typeof entry.name !== 'string') throw new InvalidBlueprintError(`spec.rows[${String(index)}] needs a string id and name`)\n return entry as unknown as ManifestRow\n })\n}\n\n/** Turn a parsed Blends manifest into the Blueprint this runtime boots. */\nexport function blueprintFromManifest(input: unknown, catalog: BlueprintCatalog = builtInCatalog()): Blueprint {\n const document = record(input, 'the manifest')\n if (document.apiVersion !== BLENDS_API_VERSION) throw new InvalidBlueprintError(`apiVersion must be ${BLENDS_API_VERSION}`)\n // The format's own rules first (schema, row ids, lineage), from the format package; `distribution` also refuses executable `!!js` values in an app definition.\n const problems = validateDefinition(input, 'distribution')\n if (problems.length > 0) throw new InvalidBlueprintError(problems.map(problem => `${problem.path}: ${problem.message}`).join('; '))\n const metadata = record(document.metadata, '\"metadata\"')\n const spec = record(document.spec, '\"spec\"')\n const id = metadata.id\n if (typeof id !== 'string' || !ID.test(id)) throw new InvalidBlueprintError('\"metadata.id\" must be a dot-namespaced id such as acryl.blank.orbit')\n const kind = document.kind\n let base: Blueprint | undefined\n if (kind === 'Blueprint') {\n // A built-in Blueprint (the blank canvas), or a starter kit that extends one: accounting, sound stage, video editor...\n // A starter resolves through its parent; only a Blueprint without `extends` is looked up by its own id (a built-in).\n if (typeof spec.extends === 'string') {\n base = catalog.get(spec.extends)\n if (base === undefined) throw new InvalidBlueprintError(`\"spec.extends\" names ${JSON.stringify(spec.extends)}, which is not a known blueprint (a starter's parent must be built in or kept in the app's blueprints/ folder)`)\n } else base = catalog.get(id)\n } else if (kind === 'Blend') {\n const lineage = record(spec.lineage, '\"spec.lineage\"')\n if (typeof lineage.blueprint !== 'string') throw new InvalidBlueprintError('\"spec.lineage.blueprint\" is required for a Blend')\n base = catalog.get(lineage.blueprint)\n if (base === undefined) throw new InvalidBlueprintError(`\"spec.lineage.blueprint\" names ${JSON.stringify(lineage.blueprint)}, which is not a known blueprint (a project keeps the starter it grew from in its blueprints/ folder)`)\n } else throw new InvalidBlueprintError('\"kind\" must be Blueprint or Blend')\n if (base === undefined) throw new InvalidBlueprintError(`${JSON.stringify(id)} is not a known blueprint: a starter names its parent with spec.extends, a project names what it grew from with kind: Blend and spec.lineage`)\n\n const rows = new Set<BlueprintRowId>(base.rows)\n let brand: Blueprint['brand'] = base.brand\n for (const row of rowsOf(spec)) {\n if (row.name === BRAND_PACKAGE) {\n brand = row.disabled === true ? { kind: 'acryl' } : { kind: 'custom', identity: brandIdentity(row.config ?? {}) }\n continue\n }\n const known = blueprintRowForModule(row.name)\n if (known === undefined) continue // an app plugin: loaded from the app's plugins/, not composed here\n if (row.disabled === true) rows.delete(known)\n else rows.add(known)\n }\n return Object.freeze({\n ...base,\n id,\n name: typeof metadata.name === 'string' && metadata.name.trim() !== '' ? metadata.name.trim() : base.name,\n description: typeof metadata.description === 'string' ? metadata.description : base.description,\n rows: [...rows],\n brand,\n })\n}\n\n/** The manifest `acryl new` writes: a Blend grown from `blueprint`, carrying the brand as a row. */\nexport function appManifest(input: { id: string, name: string, blueprint: Blueprint, brand: BrandIdentity, description?: string }): Record<string, unknown> {\n const brandRow = { id: 'brand', name: BRAND_PACKAGE, config: { ...input.brand } }\n return {\n apiVersion: BLENDS_API_VERSION,\n kind: 'Blend',\n // Private and proprietary until the owner says otherwise: saving refuses a public remote for a private app, and a registry refuses to list it.\n metadata: { id: input.id, name: input.name, version: '0.1.0', description: input.description ?? `${input.name}, grown from ${input.blueprint.id}.`, license: 'Proprietary', visibility: 'private' },\n spec: {\n runtime: 'cordis',\n lineage: { blueprint: input.blueprint.id, blueprintVersion: '0.1.0' },\n rows: [brandRow, ...input.blueprint.rows.map(id => { const row = rowForBlueprintRow(id); return { id: row.rowId, name: row.module } })],\n },\n }\n}\n\n/**\n * The Blueprints an app can grow from: the built-ins, plus the starter definitions it keeps in its `blueprints/` folder (`acryl new --from <starter>` copies\n * the starter there, like a lock of the parent). A starter may extend another starter; each is resolved on first use, and a cycle is refused.\n */\nexport function catalogWithStarters(starters: ReadonlyArray<{ readonly id: string, readonly document: unknown }>, base: BlueprintCatalog = builtInCatalog()): BlueprintCatalog {\n const resolved = new Map<string, Blueprint>()\n const resolving = new Set<string>()\n const byId = new Map(starters.map(starter => [starter.id, starter.document]))\n const catalog: BlueprintCatalog = {\n get(id) {\n const builtIn = base.get(id)\n if (builtIn !== undefined) return builtIn\n const cached = resolved.get(id)\n if (cached !== undefined) return cached\n const document = byId.get(id)\n if (document === undefined) return undefined\n if (resolving.has(id)) throw new InvalidBlueprintError(`the starters in blueprints/ extend each other in a cycle (${[...resolving, id].join(' -> ')})`)\n resolving.add(id)\n try {\n const blueprint = blueprintFromManifest(document, catalog)\n resolved.set(id, blueprint)\n return blueprint\n } finally { resolving.delete(id) }\n },\n list() { return [...base.list(), ...starters.map(starter => catalog.get(starter.id)).filter((entry): entry is Blueprint => entry !== undefined)] },\n }\n return catalog\n}\n","/**\n * The boundary that reads the environment to choose a Blueprint. Kept apart from the pure domain modules so the only\n * `process.env` access in the blueprint context is in one named place.\n *\n * `ACRYL_BLUEPRINT` names a built-in Blueprint id (`acryl.blank`, `acryl.ide`) or a `.yaml`, `.yml` or `.json` file that defines one\n * (see `definition.ts`); unset means `acryl.ide`.\n * `ACRYL_BRAND_NAME` (and the other `ACRYL_BRAND_*` values) rebrand the selected Blueprint without editing any file.\n *\n * @module @acryldev/harness-runtime/blueprint/selection\n */\n\nimport { existsSync, readFileSync, readdirSync } from 'node:fs'\nimport { dirname, extname, join } from 'node:path'\nimport { parse } from 'yaml'\nimport { brandIdentity } from './brand-identity.ts'\nimport { selectBlueprint, withBrand, type Blueprint } from './blueprint.ts'\nimport { InvalidBlueprintError, parseBlueprint } from './definition.ts'\nimport { blueprintFromManifest, catalogWithStarters, isBlendsManifest } from './manifest.ts'\n\nconst BRAND_ENV: readonly (readonly [string, string])[] = [\n ['ACRYL_BRAND_NAME', 'name'],\n ['ACRYL_BRAND_TAGLINE', 'tagline'],\n ['ACRYL_BRAND_ACCENT', 'accent'],\n ['ACRYL_BRAND_ACCENT_DARK', 'accentDark'],\n ['ACRYL_BRAND_FONT', 'fontFamily'],\n ['ACRYL_BRAND_MARK', 'mark'],\n]\n\nconst BLUEPRINT_FILE_EXTENSIONS = new Set(['.yaml', '.yml', '.json'])\n\n/** Read and validate a Blueprint file. A missing or malformed file fails loudly: a silent fallback would boot the wrong product. */\nexport function readBlueprintFile(path: string): Blueprint {\n let source: string\n try {\n source = readFileSync(path, 'utf8')\n } catch (cause) {\n throw new InvalidBlueprintError(`cannot read ${path}: ${cause instanceof Error ? cause.message : String(cause)}`)\n }\n let data: unknown\n try {\n data = parse(source)\n } catch (cause) {\n throw new InvalidBlueprintError(`${path} is not valid YAML: ${cause instanceof Error ? cause.message.split('\\n')[0] : String(cause)}`)\n }\n // An app's `blend.yaml` is a Blends manifest (with the starters it grew from kept beside it in blueprints/); a short runtime definition is also accepted.\n return isBlendsManifest(data) ? blueprintFromManifest(data, catalogWithStarters(readStarters(join(dirname(path), 'blueprints')))) : parseBlueprint(data)\n}\n\n/** The starter definitions an app keeps in its `blueprints/` folder, each a Blends manifest of kind Blueprint. */\nexport function readStarters(folder: string): Array<{ id: string, document: unknown }> {\n if (!existsSync(folder)) return []\n return readdirSync(folder).filter(file => /\\.ya?ml$/u.test(file)).map(file => {\n const path = join(folder, file)\n let document: unknown\n try { document = parse(readFileSync(path, 'utf8')) } catch (cause) { throw new InvalidBlueprintError(`${path} is not valid YAML: ${cause instanceof Error ? cause.message.split('\\n')[0] : String(cause)}`) }\n const id = (document as { metadata?: { id?: unknown } } | null)?.metadata?.id\n if (typeof id !== 'string') throw new InvalidBlueprintError(`${path} has no metadata.id`)\n return { id, document }\n })\n}\n\nexport function blueprintFromEnvironment(env: NodeJS.ProcessEnv = process.env): Blueprint {\n const selected = env.ACRYL_BLUEPRINT?.trim()\n const chosen = selected !== undefined && BLUEPRINT_FILE_EXTENSIONS.has(extname(selected).toLowerCase())\n ? readBlueprintFile(selected)\n : selectBlueprint(env.ACRYL_BLUEPRINT)\n const overrides = Object.fromEntries(BRAND_ENV.flatMap(([variable, field]) => {\n const value = env[variable]\n return value === undefined || value === '' ? [] : [[field, value]]\n }))\n if (Object.keys(overrides).length === 0) return chosen\n const base = chosen.brand.kind === 'custom' ? chosen.brand.identity : { name: chosen.name }\n return withBrand(chosen, brandIdentity({ ...base, ...overrides }))\n}\n","/**\n * Finding and applying the Web port of an app. Which port an app starts from is part of its instance family (`instance/`, which also reads\n * `ACRYL_WEB_PORT`); this module only scans for a free loopback port from there and turns it into the web server's Loader patch.\n *\n * @module @acryldev/harness-runtime/web-port\n */\n\nimport { createServer } from 'node:net'\nimport { isRestrictedPort } from '@acryldev/blends/cordis/node-server'\nimport type { PatchOptions } from '@deepseek-ai/cordis-plugin-include'\n\nconst HOST = '127.0.0.1'\n\n/** The Loader patch that moves the web server to `port`, on `host` (loopback unless the instance's web access says otherwise). */\nexport function webPortPatch(port: number, host: string = HOST): PatchOptions {\n return { id: 'webserver', config: { host, port } }\n}\n\n/** How many consecutive ports are tried before giving up. */\nexport const WEB_PORT_ATTEMPTS = 32\n\n/** Can something listen on this port right now (on loopback, or on `host`)? A probe, so a race with another process is possible but narrow. */\nexport function loopbackPortIsFree(port: number, host: string = HOST): Promise<boolean> {\n return new Promise(resolve => {\n const server = createServer()\n server.once('error', () => resolve(false))\n server.listen({ host, port, exclusive: true }, () => server.close(() => resolve(true)))\n })\n}\n\n/** The first free port at or after `start` that a browser may open (the Fetch standard's bad ports are skipped; an app's stable port is hashed into 3100..3999, which holds 3659). `probe` is injectable so the scan is testable without sockets. */\nexport async function findFreeWebPort(start: number, probe: (port: number) => Promise<boolean> = loopbackPortIsFree, attempts = WEB_PORT_ATTEMPTS): Promise<number> {\n for (let offset = 0; offset < attempts; offset += 1) {\n const port = start + offset\n if (port > 65_535) break\n if (!isRestrictedPort(port) && await probe(port)) return port\n }\n throw new Error(`no free web port from ${String(start)} to ${String(Math.min(start + attempts - 1, 65_535))}; set ACRYL_WEB_PORT to another starting port`)\n}\n","/**\n * One profile, one live installation (spec 036, \"Self-containment\"): a Protection Proxy in front of the one resource two installations can still point at.\n *\n * A Web or CLI profile links ACRYL's own packages into its `node_modules` from the installation that boots it. Two installations (a main checkout and a\n * worktree, a dev build and an installed app) booting the SAME profile silently re-point each other's links, and the one still running then serves the\n * other's code: that is how a worktree run blanked a running main-branch app. So every write to a profile goes through this guard, which holds the profile\n * with a Pessimistic Offline Lock (`instance/offline-lock.ts`): the same installation is always admitted, another is refused while the holder is alive,\n * and a stopped holder is taken over.\n *\n * @module @acryldev/harness-runtime/profile-owner\n */\n\nimport { realpathSync } from 'node:fs'\nimport { join } from 'node:path'\nimport { LockHeldError, acquireLock } from './instance/index.ts'\n\nexport const PROFILE_OWNER_FILE = '.acryl-owner.json'\n\nexport interface ProfileOwner {\n readonly installRoot: string\n readonly pid: number\n readonly since: string\n}\n\nexport class ProfileInUseError extends Error {\n constructor(profileDir: string, owner: { installRoot: unknown, pid: number }, installRoot: string) {\n super(\n `ACRYL profile ${profileDir} is in use by another ACRYL installation (${String(owner.installRoot)}, pid ${String(owner.pid)}). `\n + `This one (${installRoot}) would re-link its packages under the running app. Stop that app, or run this one in its own home `\n + '(set ACRYL_HOME, or start an app created with `acryl new` through its bin/acryl).',\n )\n this.name = 'ProfileInUseError'\n }\n}\n\nfunction canonical(path: string): string {\n try { return realpathSync(path) } catch { return path }\n}\n\n/** Take the profile for this installation, or throw naming the live installation that holds it. */\nexport function claimProfile(profileDir: string, installRoot: string, pid: number = process.pid, alive?: (pid: number) => boolean): void {\n const root = canonical(installRoot)\n try {\n acquireLock(join(profileDir, PROFILE_OWNER_FILE), { pid, installRoot: root }, {\n ...(alive === undefined ? {} : { alive }),\n compatible: holder => typeof holder.installRoot === 'string' && canonical(holder.installRoot) === root,\n })\n } catch (error) {\n if (error instanceof LockHeldError) throw new ProfileInUseError(profileDir, { installRoot: error.holder.installRoot, pid: error.holder.pid }, root)\n throw error\n }\n}\n","/**\n * The one way this runtime registers Node module hooks. Profile package routing (the overlay resolver and the DSH engine's profile\n * resolution) needs the public `module.registerHooks`; a Node or Electron build without it fails here with a message that names the\n * runtime, instead of a bare TypeError deep inside a boot.\n */\n\nimport Module, { type ModuleHooks, type RegisterHooksOptions } from 'node:module'\n\nexport class ModuleHooksUnavailableError extends Error {\n override readonly name = 'ModuleHooksUnavailableError'\n}\n\n/** The running Node, and the Electron around it when there is one, for a message. */\nfunction runtimeName(): string {\n const electron = process.versions.electron\n return electron === undefined ? `Node ${process.versions.node}` : `Electron ${electron} (Node ${process.versions.node})`\n}\n\n/**\n * The public `module.registerHooks`, checked before a caller patches anything it would have to undo.\n * @throws {ModuleHooksUnavailableError} when this Node has none (it needs Node 22.15, 23.5 or newer).\n */\nexport function requireModuleHooks(): (options: RegisterHooksOptions) => ModuleHooks {\n // Read from the default export at call time, so a test can remove it and an older runtime reaches the message below.\n const register = (Module as { registerHooks?: (options: RegisterHooksOptions) => ModuleHooks }).registerHooks\n if (typeof register !== 'function') {\n throw new ModuleHooksUnavailableError(\n `DSH provider unavailable on ${runtimeName()}: profile packages load through module.registerHooks, which this runtime lacks `\n + '(Node 22.15, 23.5 or newer has it)',\n )\n }\n return register\n}\n\n/**\n * Register synchronous module hooks on Node's default loaders.\n * @throws {ModuleHooksUnavailableError} when this Node has no `module.registerHooks`.\n */\nexport function registerModuleHooks(options: RegisterHooksOptions): ModuleHooks {\n return requireModuleHooks()(options)\n}\n","/**\n * The framework packages that moved into `acrylblends` (spec 049 slice 17). An app plugin written before the move imports them by\n * their old names, which no longer resolve; there is no alias, because `@acryldev/router/middleware` maps to one subpath per middleware\n * and an alias would hide that. This module names what to import instead, and `movedFrameworkImports` registers a resolve hook\n * that adds it to the \"cannot find package\" error a boot would otherwise end on.\n *\n * @module @acryldev/harness-runtime/profile-resolution/moved-framework\n */\n\nimport type { ModuleHooks } from 'node:module'\nimport { registerModuleHooks } from '../module-hooks.ts'\n\n/** Each old specifier and what replaces it. */\nexport const MOVED_FRAMEWORK_IMPORTS: Readonly<Record<string, string>> = Object.freeze({\n '@acryldev/router': \"'acrylblends' (Acryl, Context and the types), '@acryldev/blends/http-exception' (HTTPException) and '@acryldev/blends/cordis/router' (the Cordis plugin, connectionOf, and the ctx.router type)\",\n '@acryldev/router/middleware': \"one subpath per middleware: '@acryldev/blends/body-limit', '@acryldev/blends/loopback-only', '@acryldev/blends/method-not-allowed', '@acryldev/blends/trailing-slash', '@acryldev/blends/bearer-auth' and the others under their names\",\n '@acryldev/router/helpers': \"'@acryldev/blends/streaming' (streamSSE) and '@acryldev/blends/schema-validator' (schemaValidator)\",\n '@acryldev/router-http': \"'@acryldev/blends/cordis/router-http'\",\n '@acryldev/state': \"'@acryldev/blends/cordis/state'\",\n '@acryldev/inspect': \"'@acryldev/blends/cordis/inspect'\",\n '@acryldev/node-server': \"'@acryldev/blends/node-server' (serve) or '@acryldev/blends/cordis/node-server' (the Cordis plugin)\",\n '@acryldev/door': \"'@acryldev/blends/cordis/door'\",\n '@acryldev/door/protocol': \"'@acryldev/blends/door/protocol'\",\n '@acryldev/door/host': \"'@acryldev/blends/door/host'\",\n '@acryldev/door/page': \"'@acryldev/blends/door/page'\",\n '@acryldev/db': \"'@acryldev/blends/db'\",\n '@acryldev/db/cordis': \"'@acryldev/blends/cordis/db'\",\n '@acryldev/db/conformance': \"'@acryldev/blends/db/conformance'\",\n '@acryldev/db-sqlite': \"'@acryldev/blends/db/sqlite' or '@acryldev/blends/cordis/db-sqlite' (the Cordis plugin)\",\n '@acryldev/kv': \"'@acryldev/blends/kv'\",\n '@acryldev/kv-json': \"'@acryldev/blends/kv/json' or '@acryldev/blends/cordis/kv-json' (the Cordis plugin)\",\n '@acryldev/kv-db': \"'@acryldev/blends/kv/db' or '@acryldev/blends/cordis/kv-db' (the Cordis plugin)\",\n})\n\n/** What replaces an old framework import, or undefined for any other specifier. */\nexport function movedFrameworkImport(specifier: string): string | undefined {\n return MOVED_FRAMEWORK_IMPORTS[specifier]\n}\n\n/** The message for an old framework import that did not resolve. */\nexport function movedFrameworkMessage(specifier: string, original: string): string {\n return `${original}\\n'${specifier}' is part of acrylblends since the framework moved to its own repository: import ${MOVED_FRAMEWORK_IMPORTS[specifier] ?? \"from '@acryldev/blends'\"} instead.`\n}\n\n/**\n * A resolve hook that names the replacement when an old framework import does not resolve. Registered after the profile's own\n * resolution, so it sees that resolution's failure; anything that resolves, and every other error, passes through unchanged.\n * @returns the hooks, for the caller to deregister with the resolution it wraps.\n */\nexport function registerMovedFrameworkImports(): ModuleHooks {\n return registerModuleHooks({\n resolve(specifier, context, nextResolve) {\n try {\n return nextResolve(specifier, context)\n } catch (error) {\n const code = (error as NodeJS.ErrnoException).code\n if (error instanceof Error && movedFrameworkImport(specifier) !== undefined && (code === 'ERR_MODULE_NOT_FOUND' || code === 'MODULE_NOT_FOUND')) {\n error.message = movedFrameworkMessage(specifier, error.message)\n }\n throw error\n }\n },\n })\n}\n","/*\n * Ported from DeepSeek Harness, packages/boot/app-boot/src/profile-resolution/resolver.ts at dsh-v0.2.0-rc.2 (639ed01539, MIT,\n * Copyright (c) 2026 DeepSeek; see THIRD_PARTY_NOTICES.md). The routing is the original's, unchanged. Deviation: the original reaches\n * Node's internal ESM loader, CommonJS helpers and ESM resolver through the native node-addon-require-builtin add-on, which Electron\n * builds after 44.0.0 refuse to load; this port uses Node's public module hooks instead (`registerHooks` for ESM resolution,\n * `Module._resolveFilename` for CommonJS, the conditions a hook call reports), and resolves a CommonJS package-imports target with the\n * CommonJS resolver from the anchor rather than the internal ESM `defaultResolve` (the two choose the same `exports` target). The\n * port check in tests/profile-resolution-port.spec.ts fails when the original changes, so a DeepSeek Harness bump re-ports it.\n */\n/** In-memory profile package routing for Node's default ESM and CommonJS loaders. */\n\nimport { existsSync, readFileSync, realpathSync, statSync } from 'node:fs'\nimport Module, { createRequire, isBuiltin, type ResolveFnOutput, type ResolveHookContext } from 'node:module'\nimport { basename, dirname, join, resolve, sep } from 'node:path'\nimport { fileURLToPath, pathToFileURL } from 'node:url'\nimport { getEnvironmentData, setEnvironmentData } from 'node:worker_threads'\nimport { imports as resolvePackageImports, type Package as ResolvePackageManifest } from 'resolve.exports'\nimport type { RuntimeResolution, RuntimeResolutionEntry } from '@deepseek-ai/dsh-app-boot'\nimport { requireModuleHooks } from '../module-hooks.ts'\n\nconst WORKER_RESOLUTION_KEY = '@deepseek-ai/dsh-app-boot/profile-resolution'\n\ninterface CommonJsParent {\n filename?: string | null\n parent?: CommonJsParent | null\n paths?: string[]\n}\n\ninterface CommonJsOptions {\n paths?: string[]\n conditions?: ReadonlySet<string>\n}\n\ninterface CommonJsModule {\n new(id?: string, parent?: CommonJsParent): CommonJsParent\n _nodeModulePaths(path: string): string[]\n _resolveFilename(\n request: string, parent: CommonJsParent | null | undefined, isMain: boolean, options?: CommonJsOptions,\n ): string\n}\n\n/** One resolve step of Node's public module hooks: the next hook, or Node's default resolver. */\ntype NextResolve = (specifier: string, context?: Partial<ResolveHookContext>) => ResolveFnOutput\n\n/**\n * Where Node continues a scoped bare request. `native` keeps the importer's own lookup: the chain is\n * answered below the interception layer. `interception` answers at the interception layer from the\n * entry's declaring manifest; `after` anchors Node's chain above the layer for a CommonJS subpath the\n * entry lacks. `native-after-interception` resumes Node's chain from `parent`: the interception layer for a\n * name without an entry, or the layer above it after an `interception` subpath miss.\n */\ntype ResolutionRoute =\n | { readonly kind: 'interception'; readonly entry: RuntimeResolutionEntry; readonly after: string }\n | { readonly kind: 'native-after-interception'; readonly parent: string }\n | { readonly kind: 'native'; readonly packageDir?: string }\n\ninterface ResolutionRouteState {\n readonly route: ResolutionRoute\n packageDir?: string\n esm?: ResolveFnOutput\n cjs?: string\n}\n\ninterface CommonJsLookup {\n readonly cacheable: boolean\n resolveNative(searchPaths: readonly string[]): string\n resolveEntry(entry: RuntimeResolutionEntry, after: string): string\n}\n\n/** The lookup positions that one interception layer fixes on an importer's ancestor chain. */\ninterface LayerPositions {\n /** Search paths with this prefix lie below the layer and are answered by their physical content. */\n readonly localPrefix: string\n /** Manifest anchoring Node's lookup at the layer's physical directory. */\n readonly nativeAfter: string\n /** Manifest anchoring Node's lookup above the layer after a CommonJS subpath miss. */\n readonly after: string\n}\n\n/**\n * The interception layer of one importer. A profile's layer is its parent's node_modules and answers every entry\n * for the active profile. Linked importers apply current peer declarations at each ancestor node_modules\n * position without memoizing the selected route.\n */\ntype InterceptionLayer =\n | LayerPositions & { readonly kind: 'profile'; readonly active: boolean }\n | { readonly kind: 'linked' }\n\ninterface ParentRoutes {\n readonly parent: string\n readonly layer: InterceptionLayer\n readonly requests: Map<string, ResolutionRouteState>\n selfReferenceName?: string | false | null\n}\n\ntype ResolutionRoutes = Map<string, ParentRoutes | false>\n\ninterface CompiledResolution {\n readonly entries: ReadonlyMap<string, RuntimeResolutionEntry>\n readonly profilesDir: string\n readonly profileDir: string | undefined\n readonly profilePaths: readonly string[]\n readonly profile: readonly string[]\n readonly installationPaths: readonly string[]\n readonly linkedPaths: readonly string[]\n readonly localPackageNames: ReadonlySet<string>\n readonly esmRoutes: ResolutionRoutes\n readonly cjsRoutes: ResolutionRoutes\n}\n\n/** Active interception in one Node isolate. */\nexport interface RuntimeInterception {\n /**\n * Locate a bare package without requiring one of its exports.\n * A package subpath selects its package directory without resolving or validating the requested file.\n * @param specifier - bare package or package-subpath specifier.\n * @param parentURL - file URL whose lookup order applies.\n * @returns selected package directory, or undefined when it is absent.\n */\n packageDir(specifier: string, parentURL: string): string | undefined\n /**\n * Atomically publish a complete successor and fresh caches. Linked roots may be added or removed.\n * Removed roots stop intercepting uncovered directories; existing modules and Node caches remain intact.\n * @param successor - fully constructed generation retaining existing package mappings and local names.\n * @throws when the profile scope or existing mappings change, local names are removed or override\n * existing mappings, or a previously published link name selects a different real directory.\n */\n replace(successor: RuntimeResolution): void\n /** Restore the native resolver methods. Interceptions dispose in reverse order. */\n dispose(): void\n}\n\n/**\n * Split a bare request into its package name without allocating path segments.\n * @param request - module specifier to classify.\n * @returns the bare package name, or undefined for non-package requests.\n */\nexport function barePackageName(request: string): string | undefined {\n if (!request || request[0] === '.' || request[0] === '/' || request[0] === '\\\\'\n || request[0] === '#' || request.includes(':') || isBuiltin(request)) return\n const first = request.indexOf('/')\n if (request[0] !== '@') return first < 0 ? request : request.slice(0, first)\n if (first < 0) return\n const second = request.indexOf('/', first + 1)\n return second < 0 ? request : request.slice(0, second)\n}\n\nfunction canonicalPath(path: string): string {\n try {\n return realpathSync(path)\n } catch {\n // A runtime resolution may name a profile scope before that directory is materialized.\n return resolve(path)\n }\n}\n\nfunction prefixes(path: string): readonly string[] {\n const configured = resolve(path) + sep\n const canonical = canonicalPath(path) + sep\n return canonical === configured ? [configured] : [configured, canonical]\n}\n\nfunction compileResolution(resolution: RuntimeResolution): CompiledResolution {\n return {\n entries: new Map(resolution.entries.map(entry => [entry.name, entry])),\n profilesDir: resolution.profilesDir,\n profileDir: resolution.profileDir,\n profilePaths: prefixes(resolution.profilesDir),\n profile: resolution.profileDir === undefined ? [] : prefixes(resolution.profileDir),\n installationPaths: [...new Set(resolution.entries\n .filter(entry => entry.scope === 'installation')\n .flatMap(entry => prefixes(entry.packageDir)))],\n linkedPaths: resolution.linkedRoots.flatMap(root => prefixes(root.realPath)),\n localPackageNames: new Set(resolution.localPackageNames),\n esmRoutes: new Map(),\n cjsRoutes: new Map(),\n }\n}\n\n/**\n * The interception layer of a profile is `<profileParent>/node_modules`: an entry occupies its name there, so its\n * subpath misses continue above it, and a name without an entry continues at it.\n */\nfunction computeProfileLayer(dir: string, active: boolean): InterceptionLayer {\n const profileParent = dirname(dir)\n return {\n kind: 'profile', active,\n localPrefix: dir + sep,\n nativeAfter: join(profileParent, 'package.json'),\n after: join(dirname(profileParent), 'package.json'),\n }\n}\n\n/** The interception layer of a module path: from its profile directory inside a profiles tree, or its linked root. */\nfunction findInterceptionLayer(path: string, resolution: CompiledResolution): InterceptionLayer | undefined {\n const treeRoot = resolution.profilePaths.find(prefix => path.startsWith(prefix))\n const activeProfile = resolution.profile.find(prefix => path.startsWith(prefix))\n const dir = treeRoot !== undefined ? profileChild(path, treeRoot) : activeProfile?.slice(0, -1)\n if (dir !== undefined) return computeProfileLayer(dir, activeProfile !== undefined)\n if (!startsWithin(path, resolution.linkedPaths)) return undefined\n if (startsWithin(path, resolution.installationPaths)) return undefined\n return { kind: 'linked' }\n}\n\n/** Package names a directory's current manifest lists as peers; an unreadable manifest lists none. */\nfunction readPeerNames(directory: string): ReadonlySet<string> {\n try {\n const manifest = JSON.parse(readFileSync(join(directory, 'package.json'), 'utf8')) as {\n peerDependencies?: unknown\n }\n const peers = manifest.peerDependencies\n return new Set(peers !== null && typeof peers === 'object' ? Object.keys(peers) : [])\n } catch (_error) {\n // Node reports the unreadable or invalid manifest itself when it resolves the package's own imports.\n return new Set()\n }\n}\n\nfunction startsWithin(path: string, roots: readonly string[]): boolean {\n for (const root of roots) {\n if (path.startsWith(root)) return true\n }\n return false\n}\n\n/**\n * The profile directory owning a module inside the profiles tree: the first path segment below the tree root.\n * @param path - module path below `treePrefix`.\n * @param treePrefix - profiles directory with a trailing separator.\n * @returns the profile directory without a trailing separator.\n */\nfunction profileChild(path: string, treePrefix: string): string {\n const rest = path.slice(treePrefix.length)\n const end = rest.indexOf(sep)\n return treePrefix + (end < 0 ? rest : rest.slice(0, end))\n}\n\nfunction nativePackageDir(parent: string, name: string): string | undefined {\n for (const searchPath of createRequire(parent).resolve.paths(name) as string[]) {\n const candidate = join(searchPath, name)\n if (existsSync(join(candidate, 'package.json'))) return candidate\n }\n return undefined\n}\n\nfunction localPackageCandidate(searchPath: string, name: string, flavor: 'esm' | 'cjs'): string | undefined {\n const candidate = join(searchPath, name)\n const stat = statSync(candidate, { throwIfNoEntry: false })\n const found = flavor === 'esm'\n ? stat?.isDirectory() === true\n : stat !== undefined\n || ['.js', '.json', '.node'].some(extension => existsSync(candidate + extension))\n return found ? candidate : undefined\n}\n\nfunction selfReferenceName(parent: string): string | false | null {\n let current = dirname(parent)\n while (true) {\n const manifestPath = join(current, 'package.json')\n if (existsSync(manifestPath)) {\n let manifest: Record<string, unknown>\n try {\n manifest = JSON.parse(readFileSync(manifestPath, 'utf8')) as Record<string, unknown>\n } catch (_error) {\n // Only Node decides whether this request consumes an invalid package manifest.\n return null\n }\n return typeof manifest.name === 'string' && manifest.exports != null\n ? manifest.name\n : false\n }\n /* v8 ignore next -- scoped module requests normally find an owning manifest before node_modules. */\n if (basename(current) === 'node_modules') return false\n const next = dirname(current)\n if (next === current) return false\n current = next\n }\n}\n\nfunction packageImportsTarget(\n parent: string, request: string, conditions: Iterable<string>,\n): { specifier: string; parentURL: string } | undefined {\n let current = dirname(parent)\n while (true) {\n const manifestPath = join(current, 'package.json')\n if (existsSync(manifestPath)) {\n let manifest: ResolvePackageManifest\n try {\n manifest = JSON.parse(readFileSync(manifestPath, 'utf8')) as ResolvePackageManifest\n } catch (_error) {\n // The native resolver retains invalid package-target and manifest diagnostics.\n /* v8 ignore next -- native resolution cannot report MODULE_NOT_FOUND after an invalid scope manifest */\n return undefined\n }\n try {\n const target = resolvePackageImports(manifest, request, {\n conditions: [...conditions],\n unsafe: true,\n })?.[0]\n return target !== undefined && barePackageName(target) !== undefined\n ? { specifier: target, parentURL: pathToFileURL(manifestPath).href }\n : undefined\n } catch (_error) {\n // The native resolver retains missing mappings and unmatched-condition diagnostics.\n /* v8 ignore next -- native resolution cannot report MODULE_NOT_FOUND before selecting a valid mapping */\n return undefined\n }\n }\n if (basename(current) === 'node_modules') return undefined\n const next = dirname(current)\n /* v8 ignore next -- a MODULE_NOT_FOUND package-import target always has an owning package scope */\n if (next === current) return undefined\n current = next\n }\n}\n\nfunction packageSearchPaths(\n entry: RuntimeResolutionEntry, request: string, cjs: CommonJsModule,\n): string[] {\n const name = barePackageName(request)\n /* v8 ignore next -- interception routes are created only for bare package requests */\n if (name === undefined) return cjs._nodeModulePaths(dirname(entry.declarer))\n const suffix = sep + name.split('/').join(sep)\n return entry.packageDir.endsWith(suffix)\n ? [entry.packageDir.slice(0, -suffix.length)]\n : cjs._nodeModulePaths(dirname(entry.declarer))\n}\n\nfunction localCandidateOwnsResolution(candidate: string, resolved: string, request: string, name: string): boolean {\n if (startsWithin(resolved, prefixes(candidate))) return true\n if (sameResolution(candidate, resolved)) return true\n if (['.js', '.json', '.node'].some(extension => sameResolution(candidate + extension, resolved))) return true\n /* v8 ignore next -- a bounded native lookup can escape a candidate only through its root legacy main */\n if (request !== name) return false\n try {\n const manifest = JSON.parse(readFileSync(join(candidate, 'package.json'), 'utf8')) as Record<string, unknown>\n /* v8 ignore next -- a bounded native lookup outside the package directory requires a legacy main */\n if (typeof manifest.main !== 'string') return false\n const main = createRequire(join(candidate, 'package.json')).resolve(resolve(candidate, manifest.main))\n return sameResolution(main, resolved)\n } catch (_error) {\n // Native resolution already owns malformed manifests and missing legacy entries.\n /* v8 ignore next -- this helper runs only after the same native resolution succeeded */\n return false\n }\n}\n\nfunction isUnselectedPackageMiss(error: unknown): boolean {\n const failure = error as NodeJS.ErrnoException & { path?: unknown }\n return failure.code === 'MODULE_NOT_FOUND' && failure.path === undefined\n}\n\nfunction sameResolution(left: string, right: string): boolean {\n if (left === right) return true\n return canonicalPath(left) === canonicalPath(right)\n}\n\n/** One mutable pointer to the immutable runtime resolution. */\nclass ResolutionRouter {\n private current: CompiledResolution\n private readonly linkedTargets: Map<string, string>\n\n constructor(resolution: RuntimeResolution, private readonly nodeModulePaths: (directory: string) => string[]) {\n this.current = compileResolution(resolution)\n this.linkedTargets = new Map(resolution.linkedRoots.map(root => [root.name, root.realPath]))\n }\n\n replace(successor: RuntimeResolution): void {\n const entries = new Map(successor.entries.map(entry => [entry.name, entry]))\n if (successor.profilesDir !== this.current.profilesDir\n || successor.profileDir !== this.current.profileDir) {\n throw new Error('profile resolution: a successor cannot change its profile scope')\n }\n for (const [name, current] of this.current.entries) {\n const next = entries.get(name)\n if (next === undefined\n || !sameResolution(current.packageDir, next.packageDir)\n || !sameResolution(current.declarer, next.declarer)\n || current.version !== next.version\n || current.scope !== next.scope) {\n throw new Error(`profile resolution: replacing ${JSON.stringify(name)} requires a process restart`)\n }\n }\n const localPackageNames = new Set(successor.localPackageNames)\n for (const name of this.current.localPackageNames) {\n if (!localPackageNames.has(name)) {\n throw new Error(`profile resolution: removing local package ${JSON.stringify(name)} requires a process restart`)\n }\n }\n for (const name of localPackageNames) {\n if (!this.current.localPackageNames.has(name) && this.current.entries.has(name)) {\n throw new Error(`profile resolution: overriding ${JSON.stringify(name)} locally requires a process restart`)\n }\n }\n // Node retains realpath caches after a root leaves the interception scope.\n for (const root of successor.linkedRoots) {\n const previous = this.linkedTargets.get(root.name)\n if (previous !== undefined && !sameResolution(previous, root.realPath)) {\n throw new Error(`profile resolution: relinking ${JSON.stringify(root.name)} requires a process restart`)\n }\n }\n const next = compileResolution(successor)\n for (const { name, realPath } of successor.linkedRoots) {\n if (!this.linkedTargets.has(name)) this.linkedTargets.set(name, realPath)\n }\n this.current = next\n }\n\n /** Whether a module path has an interception layer: it lies in the profiles tree, the active profile, or a linked root. */\n hasInterceptionLayerForPath(path: string): boolean {\n return findInterceptionLayer(path, this.current) !== undefined\n }\n\n /** Whether an importer URL is scoped; the answer is memoized with the importer's routes. */\n hasInterceptionLayerForUrl(parentURL: string): boolean {\n return this.getOrCreateParentRoutesForUrl(parentURL) !== false\n }\n\n private createParentRoutes(parent: string, resolution: CompiledResolution): ParentRoutes | undefined {\n const layer = findInterceptionLayer(parent, resolution)\n return layer === undefined ? undefined : { parent, layer, requests: new Map() }\n }\n\n private getOrCreateParentRoutesForUrl(parentURL: string): ParentRoutes | false {\n const resolution = this.current\n let parentRoutes = resolution.esmRoutes.get(parentURL)\n if (parentRoutes !== undefined) return parentRoutes\n let parent: string | undefined\n try {\n parent = fileURLToPath(parentURL)\n } catch {\n // Only file URLs can lie inside a profile tree or linked root.\n parent = undefined\n }\n parentRoutes = parent === undefined ? false : this.createParentRoutes(parent, resolution) ?? false\n resolution.esmRoutes.set(parentURL, parentRoutes)\n return parentRoutes\n }\n\n private routeScoped(\n request: string,\n parentRoutes: ParentRoutes,\n resolution: CompiledResolution,\n flavor: 'esm' | 'cjs',\n cjs?: CommonJsLookup,\n ): ResolutionRouteState | undefined {\n const { parent, layer, requests } = parentRoutes\n const memo = layer.kind === 'profile' && (cjs === undefined || cjs.cacheable)\n const name = barePackageName(request)\n if (name === undefined) return undefined\n\n if (parentRoutes.selfReferenceName === undefined || !memo) {\n parentRoutes.selfReferenceName = selfReferenceName(parent)\n }\n if (parentRoutes.selfReferenceName === name || parentRoutes.selfReferenceName === null) {\n const state = { route: { kind: 'native' as const } }\n if (memo) requests.set(request, state)\n return state\n }\n\n if (layer.kind === 'linked') return this.routeLinked(request, name, parent, resolution, flavor, cjs)\n\n const target = resolution.entries.get(name)\n const candidates: string[] = []\n const localSearchPaths: string[] = []\n for (const searchPath of createRequire(parent).resolve.paths(name) as string[]) {\n if (!searchPath.startsWith(layer.localPrefix)) break\n localSearchPaths.push(searchPath)\n const candidate = localPackageCandidate(searchPath, name, flavor)\n if (candidate !== undefined) candidates.push(candidate)\n }\n if (candidates.length > 0) {\n if (cjs !== undefined) {\n try {\n const resolved = cjs.resolveNative(localSearchPaths)\n const selected = candidates.find(candidate => (\n localCandidateOwnsResolution(candidate, resolved, request, name)\n ))\n if (selected !== undefined) {\n const state = {\n route: { kind: 'native' as const, packageDir: selected },\n packageDir: selected,\n cjs: resolved,\n }\n if (memo) requests.set(request, state)\n return state\n }\n } catch (error) {\n if (!isUnselectedPackageMiss(error)) throw error\n }\n } else {\n const selected = candidates[0] as string\n const state = {\n route: { kind: 'native' as const, packageDir: selected },\n packageDir: selected,\n }\n requests.set(request, state)\n return state\n }\n }\n\n const route: ResolutionRoute = target !== undefined\n && (target.scope === 'installation' || layer.active)\n ? { kind: 'interception', entry: target, after: layer.after }\n : { kind: 'native-after-interception', parent: layer.nativeAfter }\n const state: ResolutionRouteState = { route }\n if (route.kind === 'interception' && memo) requests.set(request, state)\n return state\n }\n\n private routeLinked(\n request: string, name: string, parent: string, resolution: CompiledResolution,\n flavor: 'esm' | 'cjs', cjs: CommonJsLookup | undefined,\n ): ResolutionRouteState {\n const target = resolution.entries.get(name)\n if (target === undefined) return { route: { kind: 'native' } }\n const ancestors = this.nodeModulePaths(dirname(parent))\n const ancestorSet = new Set(ancestors)\n const searchPaths = flavor === 'esm' ? ancestors : createRequire(parent).resolve.paths(name) as string[]\n for (const searchPath of searchPaths) {\n const directory = dirname(searchPath)\n if (ancestorSet.has(searchPath) && readPeerNames(directory).has(name)) {\n const route: ResolutionRoute = { kind: 'interception', entry: target, after: join(dirname(directory), 'package.json') }\n if (cjs === undefined) return { route }\n try {\n const resolved = cjs.resolveEntry(target, route.after)\n if (localCandidateOwnsResolution(target.packageDir, resolved, request, name)) {\n return { route, packageDir: target.packageDir, cjs: resolved }\n }\n } catch (error) {\n if (!isUnselectedPackageMiss(error)) throw error\n }\n // This position is occupied even when a legacy CommonJS subpath is absent from the supplied package.\n continue\n }\n const candidate = localPackageCandidate(searchPath, name, flavor)\n if (candidate === undefined) continue\n if (cjs === undefined) return { route: { kind: 'native', packageDir: candidate }, packageDir: candidate }\n try {\n const resolved = cjs.resolveNative([searchPath])\n if (localCandidateOwnsResolution(candidate, resolved, request, name)) {\n return { route: { kind: 'native', packageDir: candidate }, packageDir: candidate, cjs: resolved }\n }\n } catch (error) {\n if (!isUnselectedPackageMiss(error)) throw error\n }\n }\n // An exhausted CommonJS lookup must not retry the physical copies at occupied peer positions.\n return cjs === undefined ? { route: { kind: 'native' } } : { route: { kind: 'native' }, cjs: cjs.resolveNative([]) }\n }\n\n private routeLocalPackage(\n request: string, parentRoutes: ParentRoutes, resolution: CompiledResolution,\n ): ResolutionRouteState | undefined {\n const name = barePackageName(request)\n const { layer } = parentRoutes\n if (name === undefined || layer.kind !== 'profile' || !layer.active || !resolution.localPackageNames.has(name)) return undefined\n const state = { route: { kind: 'native' as const } }\n parentRoutes.requests.set(request, state)\n return state\n }\n\n routeUrl(request: string, parentURL: string): ResolutionRouteState | undefined {\n const resolution = this.current\n const parentRoutes = this.getOrCreateParentRoutesForUrl(parentURL)\n if (parentRoutes === false) return undefined\n const cached = parentRoutes.requests.get(request)\n if (cached !== undefined) return cached\n const local = this.routeLocalPackage(request, parentRoutes, resolution)\n if (local !== undefined) return local\n return this.routeScoped(request, parentRoutes, resolution, 'esm')\n }\n\n routePath(\n request: string, parent: string, cjs: CommonJsLookup,\n ): ResolutionRouteState | undefined {\n const resolution = this.current\n let parentRoutes = resolution.cjsRoutes.get(parent)\n if (parentRoutes === false) return undefined\n const cached = cjs.cacheable ? parentRoutes?.requests.get(request) : undefined\n if (cached !== undefined) return cached\n if (parentRoutes === undefined) {\n parentRoutes = this.createParentRoutes(parent, resolution) ?? false\n resolution.cjsRoutes.set(parent, parentRoutes)\n if (parentRoutes === false) return undefined\n }\n return this.routeScoped(request, parentRoutes, resolution, 'cjs', cjs)\n }\n\n packageDir(specifier: string, parentURL: string): string | undefined {\n const name = barePackageName(specifier)\n if (name === undefined) return undefined\n const state = this.routeUrl(name, parentURL)\n if (state?.route.kind === 'interception') return state.route.entry.packageDir\n if (state?.packageDir !== undefined) return state.packageDir\n let parent: string\n try {\n parent = state?.route.kind === 'native-after-interception' ? state.route.parent : fileURLToPath(parentURL)\n } catch {\n return undefined\n }\n const found = nativePackageDir(parent, name)\n if (state !== undefined && found !== undefined) state.packageDir = found\n return found\n }\n}\n\n/**\n * The conditions Node's CommonJS loader applies when a call names none: `require`, `node`, `node-addons` unless addons are off,\n * `module-sync` when `require(esm)` is on, and every `--conditions`/`-C` flag. A `require()` passing through the module hooks reports its\n * exact set, which {@link installRuntimeInterception} uses; this is the set for a direct `Module._resolveFilename` call.\n */\nfunction defaultCommonJsConditions(): ReadonlySet<string> {\n const flags = [...process.execArgv, ...(process.env.NODE_OPTIONS ?? '').split(/\\s+/u).filter(flag => flag !== '')]\n const user: string[] = []\n for (let at = 0; at < flags.length; at += 1) {\n const flag = flags[at] as string\n const inline = /^(?:--conditions|-C)=(.+)$/u.exec(flag)\n if (inline !== null) user.push(inline[1] as string)\n else if ((flag === '--conditions' || flag === '-C') && flags[at + 1] !== undefined) user.push(flags[(at += 1)] as string)\n }\n const addons = !flags.includes('--no-addons')\n const requireModule = (process.features as { require_module?: boolean }).require_module === true\n return new Set(['require', 'node', ...(addons ? ['node-addons'] : []), ...user, ...(requireModule ? ['module-sync'] : [])])\n}\n\n/**\n * Replace a resolver error's message and the same text in its stack.\n * Node's module-hooks thread serializes errors and returns the stack accessor as a read-only configurable\n * data property, so a rejected stack assignment redefines the property value.\n * @param error - resolver error to update in place.\n * @param message - replacement message.\n */\nfunction replaceErrorMessage(error: Error, message: string): void {\n const { message: originalMessage, stack } = error\n error.message = message\n /* v8 ignore next -- Node's resolver errors always carry a stack */\n if (stack === undefined) return\n const replaced = stack.replace(originalMessage, message)\n if (!Reflect.set(error, 'stack', replaced)) Object.defineProperty(error, 'stack', { value: replaced })\n}\n\nfunction throwWithImporter(error: unknown, routedParent: string, parent: string): never {\n const code = (error as NodeJS.ErrnoException).code\n if (error instanceof Error && (code === 'ERR_MODULE_NOT_FOUND' || code === 'ERR_PACKAGE_PATH_NOT_EXPORTED')) {\n const routedPath = fileURLToPath(routedParent)\n const parentPath = fileURLToPath(parent)\n replaceErrorMessage(error, error.message.replaceAll(routedParent, parent).replaceAll(routedPath, parentPath))\n }\n throw error\n}\n\nfunction throwWithoutCjsAnchor(error: unknown, anchor: string): never {\n const resolved = error as NodeJS.ErrnoException & { requireStack?: string[] }\n const requireStack = resolved.requireStack\n if (error instanceof Error\n && resolved.code === 'MODULE_NOT_FOUND'\n && requireStack?.[0] !== undefined\n && sameResolution(requireStack[0], anchor)) {\n const originalMessage = error.message\n const originalBlock = `\\nRequire stack:\\n${requireStack.map(path => `- ${path}`).join('\\n')}`\n const remaining = requireStack.slice(1)\n /* v8 ignore next -- routed calls always retain the original importing module */\n const replacement = remaining.length === 0\n ? ''\n : `\\nRequire stack:\\n${remaining.map(path => `- ${path}`).join('\\n')}`\n error.message = originalMessage.replace(originalBlock, replacement)\n resolved.requireStack = remaining\n const stack = error.stack\n /* v8 ignore next -- Node's resolver errors always carry a stack */\n if (stack !== undefined) error.stack = stack.replace(originalMessage, error.message)\n }\n throw error\n}\n\n/**\n * Install one runtime resolution as the interception on Node's default ESM and CommonJS resolvers.\n * @param resolution - complete package table and profile scope.\n * @returns an interception that publishes a successor or restores the native methods.\n */\nexport function installRuntimeInterception(\n resolution: RuntimeResolution,\n): RuntimeInterception {\n // Before anything is built or patched, so a runtime without module hooks fails with the message and leaves nothing behind.\n const registerHooks = requireModuleHooks()\n const cjs = Module as unknown as CommonJsModule\n const router = new ResolutionRouter(resolution, directory => cjs._nodeModulePaths(directory))\n // The conditions of the require() in flight: the module hooks see them first and Node then calls `_resolveFilename` inside `nextResolve`.\n let requireConditions: readonly string[] | undefined\n\n /** One ESM resolve, routed when its importer has an interception layer; `next` is the rest of the hook chain. */\n const resolveEsm = (request: string, context: ResolveHookContext, next: NextResolve): ResolveFnOutput => {\n const parent = context.parentURL\n const native = (parentURL: string | undefined): ResolveFnOutput => next(request, { ...context, parentURL })\n if (parent === undefined || !router.hasInterceptionLayerForUrl(parent)) return native(parent)\n const state = router.routeUrl(request, parent)\n if (state === undefined) {\n const target = request[0] === '#' ? packageImportsTarget(fileURLToPath(parent), request, context.conditions) : undefined\n if (target === undefined) return native(parent)\n try {\n return resolveEsm(target.specifier, { ...context, parentURL: target.parentURL }, next)\n } catch (error) {\n return throwWithImporter(error, target.parentURL, parent)\n }\n }\n const cacheable = Object.keys(context.importAttributes).length === 0\n // A hook that answers without calling the rest of the chain must say so.\n if (cacheable && state.esm !== undefined) return { ...state.esm, shortCircuit: true }\n const route = state.route\n if (route.kind === 'native') {\n const result = native(parent)\n if (cacheable) state.esm = result\n return result\n }\n const routedParent = pathToFileURL(route.kind === 'interception' ? route.entry.declarer : route.parent).href\n let result: ResolveFnOutput\n try {\n result = native(routedParent)\n } catch (error) {\n return throwWithImporter(error, routedParent, parent)\n }\n if (cacheable) state.esm = result\n return result\n }\n\n const hooks = registerHooks({\n resolve(specifier, context, nextResolve) {\n // A require() is routed by the `_resolveFilename` wrapper Node calls inside nextResolve; only its conditions are taken from here.\n if (context.conditions.includes('require') && !context.conditions.includes('import')) {\n const previous = requireConditions\n requireConditions = context.conditions\n try {\n return nextResolve(specifier, context)\n } finally {\n requireConditions = previous\n }\n }\n return resolveEsm(specifier, context, nextResolve)\n },\n })\n\n const originalFilename = Reflect.get(cjs, '_resolveFilename')\n let delegatedCjs = 0\n const resolveRoutedCjs = (\n request: string, routed: Exclude<ResolutionRoute, { kind: 'native' }>,\n parent: CommonJsParent, main: boolean, options?: CommonJsOptions,\n ): string => {\n const anchor = routed.kind === 'interception' ? routed.entry.declarer : routed.parent\n const synthetic = new cjs(anchor)\n // Late parent assignment preserves Node's require stack without publishing this routing anchor in parent.children.\n synthetic.parent = parent\n synthetic.filename = anchor\n synthetic.paths = routed.kind === 'interception'\n ? packageSearchPaths(routed.entry, request, cjs)\n : cjs._nodeModulePaths(dirname(anchor))\n try {\n return originalFilename.call(cjs, request, synthetic, main, options)\n } catch (error) {\n return throwWithoutCjsAnchor(error, anchor)\n }\n }\n const resolveNativeCjs = (\n request: string, searchPaths: readonly string[], parent: CommonJsParent,\n parentFilename: string, main: boolean, conditions: ReadonlySet<string> | undefined,\n ): string => {\n const synthetic = new cjs(parentFilename)\n if (parent.parent !== undefined) synthetic.parent = parent.parent\n synthetic.filename = parentFilename\n synthetic.paths = [...searchPaths]\n const options = conditions === undefined ? undefined : { conditions }\n return originalFilename.call(cjs, request, synthetic, main, options)\n }\n const resolvePackageImportCjs = (\n target: { specifier: string; parentURL: string }, conditions: Iterable<string>,\n ): string => {\n const state = router.routeUrl(target.specifier, target.parentURL)\n // Node resolves a package-imports target with its ESM package resolver; the public equivalent is the CommonJS resolver from a\n // synthetic module at the anchor with the same conditions, which selects the same `exports` target.\n const resolveFrom = (parentURL: string): string => {\n const anchor = fileURLToPath(parentURL)\n const synthetic = new cjs(anchor)\n synthetic.filename = anchor\n synthetic.paths = cjs._nodeModulePaths(dirname(anchor))\n delegatedCjs++\n try {\n return originalFilename.call(cjs, target.specifier, synthetic, false, { conditions: new Set(conditions) })\n } finally {\n delegatedCjs--\n }\n }\n /* v8 ignore next -- the target manifest was found inside the established profile scope */\n if (state === undefined) return resolveFrom(target.parentURL)\n if (state.route.kind === 'native') return resolveFrom(target.parentURL)\n const route = state.route\n if (route.kind === 'native-after-interception') return resolveFrom(pathToFileURL(route.parent).href)\n return resolveFrom(pathToFileURL(route.entry.declarer).href)\n }\n const wrappedFilename: CommonJsModule['_resolveFilename'] = (request, parent, main, options) => {\n if (delegatedCjs || !parent?.filename || options?.paths !== undefined) {\n return originalFilename.call(cjs, request, parent, main, options)\n }\n const parentFilename = parent.filename\n const cacheable = options?.conditions === undefined\n const routedOptions = options?.conditions === undefined ? undefined : { conditions: options.conditions }\n const state = router.routePath(request, parentFilename, {\n cacheable,\n resolveNative: searchPaths => resolveNativeCjs(request, searchPaths, parent, parentFilename, main, options?.conditions),\n resolveEntry: (entry, after) => {\n delegatedCjs++\n try {\n return resolveRoutedCjs(request, { kind: 'interception', entry, after }, parent, main, routedOptions)\n } finally {\n delegatedCjs--\n }\n },\n })\n if (state === undefined) {\n const scoped = router.hasInterceptionLayerForPath(parentFilename)\n const conditions = options?.conditions ?? (requireConditions === undefined ? defaultCommonJsConditions() : new Set(requireConditions))\n const target = request[0] === '#' && scoped\n ? packageImportsTarget(parentFilename, request, conditions)\n : undefined\n if (target === undefined) return originalFilename.call(cjs, request, parent, main, options)\n return resolvePackageImportCjs(target, conditions)\n }\n if (state.cjs !== undefined) return state.cjs\n const route = state.route\n if (route.kind === 'native') {\n const result = originalFilename.call(cjs, request, parent, main, options)\n if (cacheable) state.cjs = result\n return result\n }\n delegatedCjs++\n try {\n let expected: string\n try {\n expected = resolveRoutedCjs(request, route, parent, main, routedOptions)\n } catch (error) {\n if (route.kind !== 'interception' || !isUnselectedPackageMiss(error)) throw error\n expected = resolveRoutedCjs(\n request, { kind: 'native-after-interception', parent: route.after }, parent, main, routedOptions,\n )\n }\n if (cacheable) state.cjs = expected\n return expected\n } finally {\n delegatedCjs--\n }\n }\n cjs._resolveFilename = wrappedFilename\n\n return {\n packageDir(specifier, parentURL) {\n return router.packageDir(specifier, parentURL)\n },\n replace(next) { router.replace(next) },\n dispose() {\n /* v8 ignore else -- interceptions are disposed in reverse installation order */\n if (cjs._resolveFilename === wrappedFilename) cjs._resolveFilename = originalFilename\n hooks.deregister()\n },\n }\n}\n\n/**\n * Publish one runtime resolution for Harness-owned Workers.\n * @param resolution - complete package table and profile scope.\n * @returns a disposer restoring the previous thread environment data.\n */\nexport function registerWorkerResolution(\n resolution: RuntimeResolution,\n): () => void {\n const previous = getEnvironmentData(WORKER_RESOLUTION_KEY)\n setEnvironmentData(WORKER_RESOLUTION_KEY, { resolution })\n return () => { setEnvironmentData(WORKER_RESOLUTION_KEY, previous) }\n}\n","/*\n * Ported from DeepSeek Harness, packages/boot/app-boot/src/profile-resolution/service.ts at dsh-v0.2.0-rc.2 (639ed01539, MIT,\n * Copyright (c) 2026 DeepSeek; see THIRD_PARTY_NOTICES.md). Deviation: the class extends the original `PluginPackages`, so every\n * consumer of the `pluginPackages` service (the plugin inventories, the plugin manager, the typert loader) keeps its type and its\n * inherited `metaOf`, and constructs it with no resolution, so the original installs nothing; the interception is the port's in\n * ./resolver.ts, which needs no native add-on. Second deviation: a resolve hook registered after the interception names what replaces a\n * framework import from before the framework moved to acrylblends (./moved-framework.ts), and is deregistered with it.\n */\n\n/** Package metadata resolved through one runtime interception. */\n\nimport { existsSync, readFileSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport { join } from 'node:path'\nimport type { Context } from '@deepseek-ai/cordis'\nimport { PluginPackages, type PluginPackage, type PluginPackagesConfig, type RuntimeResolution } from '@deepseek-ai/dsh-app-boot'\nimport { registerMovedFrameworkImports } from './moved-framework.ts'\nimport {\n barePackageName,\n installRuntimeInterception,\n registerWorkerResolution,\n type RuntimeInterception,\n} from './resolver.ts'\n\nfunction readPackage(dir: string, fallbackName: string): PluginPackage | undefined {\n const manifestPath = join(dir, 'package.json')\n if (!existsSync(manifestPath)) return undefined\n const manifest = JSON.parse(readFileSync(manifestPath, 'utf8')) as Record<string, unknown>\n const name = manifest.name\n const version = manifest.version\n return {\n name: typeof name === 'string' ? name : fallbackName,\n version: typeof version === 'string' ? version : undefined,\n dir,\n manifestPath,\n manifest,\n }\n}\n\n/** Package lookup shared by metadata consumers in one profile process, on Node's public module hooks. */\nexport class ProfilePluginPackages extends PluginPackages {\n private table = new Map<string, PluginPackage | undefined>()\n private readonly routing: RuntimeInterception | undefined\n private disposeWorkers: (() => void) | undefined\n\n constructor(ctx: Context, config: PluginPackagesConfig = {}) {\n super(ctx, {})\n if (config.resolution === undefined) return\n const interception = installRuntimeInterception(config.resolution)\n this.disposeWorkers = registerWorkerResolution(config.resolution)\n this.routing = interception\n // Registered after the interception, so an old framework import that the profile cannot resolve fails with what replaces it.\n const movedImports = registerMovedFrameworkImports()\n ctx.effect(() => () => {\n movedImports.deregister()\n this.disposeWorkers?.()\n interception.dispose()\n }, 'profile package resolution')\n }\n\n /**\n * Publish a complete successor generation for this process and subsequently created Workers.\n * Linked roots may be removed without unloading modules or clearing Node caches.\n * @param successor - fully constructed generation accepted by {@link RuntimeInterception.replace}.\n */\n override replace(successor: RuntimeResolution): void {\n if (this.routing === undefined) throw new Error('plugin-packages: runtime resolution is not installed')\n this.routing.replace(successor)\n this.table = new Map()\n this.disposeWorkers?.()\n this.disposeWorkers = registerWorkerResolution(successor)\n }\n\n /**\n * Locate the package named by a specifier without requiring a package export.\n * @param specifier - module specifier whose package owns the requested module.\n * @param parentURL - URL whose Node lookup order applies.\n * @returns the parsed package, or undefined when no package owns the request.\n */\n override packageOf(specifier: string, parentURL: string): PluginPackage | undefined {\n const name = barePackageName(specifier)\n if (name === undefined) return undefined\n const dir = this.routing === undefined\n ? packageDirFromParent(name, parentURL)\n : this.routing.packageDir(name, parentURL)\n if (dir === undefined) return undefined\n const key = JSON.stringify({ dir, name })\n if (!this.table.has(key)) this.table.set(key, readPackage(dir, name))\n return this.table.get(key)\n }\n}\n\nfunction packageDirFromParent(name: string, parentURL: string): string | undefined {\n for (const searchPath of createRequire(parentURL).resolve.paths(name) as string[]) {\n const candidate = join(searchPath, name)\n if (existsSync(join(candidate, 'package.json'))) return candidate\n }\n return undefined\n}\n","/**\n * Web's own `desktopProfiles`/`desktopPnpm` capabilities (spec 034 T006,\n * scoped v1) - what `@acryldev/cordis-plugin-market`'s install service needs to make\n * its Installed-tab Install/Uninstall buttons do a real package operation on\n * Web, instead of the \"ACRYL is required\" gate it shows without them.\n *\n * Deliberately NOT a port of Desktop's own `pnpm.ts`/`install-recovery.ts`\n * (1,500+ lines together): that size is almost entirely a crash-recovery\n * write-ahead-log built around Electron's own generation-restart cycle - if\n * the whole app crashes mid-install, the WAL lets the next launch detect and\n * roll back a half-finished operation. Web has no equivalent \"the whole\n * process restarts and we verify it came back healthy\" cycle to protect\n * against: a `dsh plugin add` child process either finishes within this one\n * request or it doesn't, with no separate \"recovered after restart\" state to\n * track. So this file's own `recoveredInstallReceiptIds`/\n * `acknowledgeRecoveredInstall`/`rollbackPluginInstall`/\n * `acknowledgeLiveInstall` are trivial - there is no WAL for them to manage.\n *\n * Also deliberately does NOT attempt `livePluginActivation` (activating a\n * freshly-installed row without a process restart) - `specs/032-universal-\n * hot-reload` documents real, hard-to-diagnose crashes from an earlier\n * attempt at exactly that class of live-Loader-mutation-plus-client-reload\n * change on Desktop. The market's own install flow already degrades\n * gracefully without it (a restart prompt), so v1 leans on that rather than\n * re-attempting a proven-risky mechanism under time pressure.\n *\n * The install mechanics themselves reuse `dsh plugin --profile web add/\n * remove`, the exact same CLI path a human operator already uses - not a\n * reimplementation of pnpm invocation and `dsh.profile.bundles`\n * reconciliation from scratch (which Desktop's own version needs only\n * because Electron's packaged `dsh` CLI hard-rejects `--profile desktop`;\n * confirmed directly that `--profile web` has no such restriction).\n */\n\nimport { spawn } from 'node:child_process'\nimport { createRequire } from 'node:module'\nimport { dirname, join } from 'node:path'\nimport { PassThrough, Readable } from 'node:stream'\nimport { type Context, Service } from '@deepseek-ai/cordis'\nimport { pinnedPnpmEnv } from './pinned-pnpm.ts'\nimport { reconcileProfileLayout, type PnpmProfileConfig } from './profile-layout.ts'\n\n/** Matches `@acryldev/cordis-plugin-market`'s own `MarketDesktopProfile` shape (`src/install/service.ts`). */\nexport interface WebMarketProfile {\n readonly name: string\n readonly dir: string\n}\n\n/** Matches `@acryldev/cordis-plugin-market`'s own `MarketDesktopPnpmOutcome` shape. */\nexport interface WebMarketPnpmOutcome {\n readonly exitCode: number | null\n readonly signal: NodeJS.Signals | null\n}\n\n/** Matches `@acryldev/cordis-plugin-market`'s own `MarketDesktopPnpmHandle` shape. */\nexport interface WebMarketPnpmHandle {\n readonly stdout: Readable\n readonly stderr: Readable\n readonly done: Promise<WebMarketPnpmOutcome>\n cancel(): void\n}\n\n// No `declare module '@deepseek-ai/cordis'` augmentation here on purpose:\n// acryl-desktop's own pnpm.ts/desktop-plugins.ts already declare\n// `desktopProfiles`/`desktopPnpm`/`desktopPlugins` on Context with their own\n// (richer, Electron-specific) types. `Service`'s own constructor signature is\n// `(ctx: Context, name: string)` - a plain string, not `keyof Context` - so\n// providing under these exact names needs no static declaration here at all;\n// adding one anyway would be two different packages both augmenting the same\n// ambient property with structurally different types, which the TypeScript\n// compiler correctly refuses to merge (reproduced directly: acryl-desktop's\n// own typecheck failed with \"Subsequent property declarations must have the\n// same type\" the moment this block existed). This file only ever *provides*\n// these services; it never reads `ctx.get('desktopProfiles' | 'desktopPnpm')`\n// itself, so the missing consumer-side typing costs it nothing.\n\n/** Matches `@acryldev/cordis-plugin-market`'s own `MarketDesktopPnpm` shape exactly - the six methods it actually calls. */\nexport interface WebMarketPnpm {\n runPlugin(args: readonly string[], invokingDir: string, signal?: AbortSignal): WebMarketPnpmHandle\n installPlugin(request: {\n readonly pnpmOptions?: readonly string[]\n readonly invokingDir: string\n readonly recovery: { readonly packageName: string; readonly packageVersion: string; readonly receiptId: string }\n readonly signal?: AbortSignal\n }): Promise<WebMarketPnpmHandle>\n recoveredInstallReceiptIds(): Promise<readonly string[]>\n acknowledgeRecoveredInstall(receiptId: string): Promise<void>\n rollbackPluginInstall(receiptId: string): Promise<boolean>\n acknowledgeLiveInstall(packageName: string): Promise<void>\n}\n\nconst require = createRequire(import.meta.url)\n\n/** Absolute path to the pinned `@deepseek-ai/dsh` CLI's own compiled entry - resolved once, from this package's own installation, not guessed. */\nfunction resolveDshBin(): string {\n const manifestPath = require.resolve('@deepseek-ai/dsh/package.json')\n return join(dirname(manifestPath), 'lib/bin.js')\n}\n\n/** Web's single profile is always named `web` - unlike Desktop, there is no multi-profile picker to resolve against. */\nexport class WebProfilesService extends Service {\n constructor(ctx: Context, private readonly profileDir: string) {\n super(ctx, 'desktopProfiles')\n }\n\n get current(): WebMarketProfile {\n return { name: 'web', dir: this.profileDir }\n }\n}\n\n/**\n * Runs `dsh plugin --profile web <verb> <...args>` as a real child process,\n * inheriting this server's own `DSH_HOME` (already set correctly by\n * `resolveWebEngineComposition` before this service is ever constructed) -\n * the exact command a human operator already runs by hand, `-w` included for\n * pnpm's own workspace-root safety check on a profile's single-package\n * pnpm workspace.\n */\nexport class WebPnpmService extends Service implements WebMarketPnpm {\n private readonly dshBin: string\n private readonly profileName: string\n private readonly profileDir: string\n\n constructor(ctx: Context, config: PnpmProfileConfig) {\n super(ctx, 'desktopPnpm')\n this.profileName = config.name\n this.profileDir = config.dir\n this.dshBin = resolveDshBin()\n }\n\n runPlugin(args: readonly string[], _invokingDir: string, signal?: AbortSignal): WebMarketPnpmHandle {\n // Never let a pnpm relink a profile another pnpm laid out (see profile-layout.ts).\n reconcileProfileLayout(this.profileDir)\n const child = spawn(process.execPath, [this.dshBin, 'plugin', '--profile', this.profileName, ...args, '-w'], {\n // The pinned pnpm, not whatever the machine has on PATH (see pinned-pnpm.ts).\n env: pinnedPnpmEnv(process.env),\n signal,\n })\n // The market resumes/discards these itself (`handle.stdout.resume()`) -\n // pass real streams through rather than buffering, matching Desktop's\n // own handle shape.\n const stdout = new PassThrough()\n const stderr = new PassThrough()\n child.stdout?.pipe(stdout)\n child.stderr?.pipe(stderr)\n // 'close', not 'exit' - see the identical fix and its own doc comment\n // in cli-market-install.ts's runPlugin: 'exit' can race ahead of the\n // piped stdout/stderr actually draining into the streams above.\n const done = new Promise<WebMarketPnpmOutcome>((resolve, reject) => {\n child.once('error', reject)\n child.once('close', (exitCode, exitSignal) => resolve({ exitCode, signal: exitSignal }))\n })\n return {\n stdout,\n stderr,\n done,\n cancel: () => { child.kill() },\n }\n }\n\n async installPlugin(request: {\n readonly pnpmOptions?: readonly string[]\n readonly invokingDir: string\n readonly recovery: { readonly packageName: string; readonly packageVersion: string; readonly receiptId: string }\n readonly signal?: AbortSignal\n }): Promise<WebMarketPnpmHandle> {\n // No recovery WAL to open here (see this module's own doc comment) - the\n // exact npm target still comes from `recovery`, matching Desktop's own\n // `installPlugin` (never trust `pnpmOptions` alone to carry the target).\n const target = `${request.recovery.packageName}@${request.recovery.packageVersion}`\n const options = request.pnpmOptions === undefined ? [] : [...request.pnpmOptions]\n // See the identical override and its own doc comment in\n // cli-market-install.ts's installPlugin: a Market install of a plugin\n // published minutes earlier is the normal case here, not the untrusted-\n // fresh-package scenario pnpm's `minimumReleaseAge` default guards\n // against. Overridden only for this one `add` invocation.\n return this.runPlugin(['add', '--config.minimum-release-age=0', ...options, target], request.invokingDir, request.signal)\n }\n\n // No WAL (see this module's own doc comment): nothing was ever recorded as\n // \"awaiting restart\", so there is never anything to report as recovered,\n // acknowledge, or roll back.\n async recoveredInstallReceiptIds(): Promise<readonly string[]> {\n return []\n }\n\n async acknowledgeRecoveredInstall(_receiptId: string): Promise<void> {}\n\n async rollbackPluginInstall(_receiptId: string): Promise<boolean> {\n return false\n }\n\n async acknowledgeLiveInstall(_packageName: string): Promise<void> {}\n}\n\n/**\n * Provide `desktopProfiles`/`desktopPnpm` on the host root, before\n * `@acryldev/cordis-plugin-market`'s own row mounts - matching the same `prepare`-hook\n * timing `createWebEngineDefinition`'s brand/market row materialization\n * already relies on.\n * @param profileDir - the web profile's own directory (`resolveWebEngineComposition`'s `profile.dir`).\n */\nexport function provideWebMarketInstall(ctx: Context, profileDir: string): void {\n ctx.plugin(WebProfilesService, profileDir)\n ctx.plugin(WebPnpmService, { name: 'web', dir: profileDir })\n}\n","/**\n * Web's own `desktopPlugins` capability (spec 034 T006, scoped v1) - the\n * package-name/preview-token-shaped adapter `@acryldev/cordis-plugin-market`'s install\n * service needs for `disabledPackageNames()` (a hard requirement even for a\n * plain install - `previewInstall` checks a target isn't already disabled),\n * plus real enable/disable for its Installed tab.\n *\n * Not a new lifecycle implementation: wraps the SAME shared\n * `AcrPluginLifecycleController` (spec 034 T005) the CLI's own `acryl\n * plugin enable/disable` and Desktop's Lifecycle tab already drive - this\n * file is only the market-shaped view over it, matching how\n * `acryl-desktop/src/plugins/desktop-plugins.ts` is Desktop's own view over the\n * identical shared controller.\n *\n * `bundleId` here is simply the Loader `entryId` - Web owns both sides of\n * this contract, so there is no need for a second opaque identifier layer\n * the way Desktop's own richer bundle-tracking might want one.\n */\n\nimport { randomUUID } from 'node:crypto'\nimport { type Context, Service } from '@deepseek-ai/cordis'\nimport type { AcrPluginLifecycleController } from '@acryldev/control'\nimport {\n mountAcrylPluginLifecycle,\n type DshPluginLifecycleOptions,\n} from './plugin-lifecycle.ts'\n\nexport interface WebMarketPluginBundle {\n readonly bundleId: string\n readonly packageName: string\n readonly status: 'active' | 'disabled'\n readonly mutable: boolean\n}\n\ninterface PreviewEntry {\n readonly entryId: string\n readonly packageName: string\n readonly targetEnabled: boolean\n readonly expiresAt: number\n}\n\n// No `declare module '@deepseek-ai/cordis'` augmentation here - see the\n// identical note in web-market-install.ts. acryl-desktop's own\n// desktop-plugins.ts already declares `desktopPlugins` on Context with its\n// own type; a second, differently-shaped declaration for the same name is a\n// hard TypeScript merge conflict across packages, not something either side\n// can quietly win. `Service`'s constructor takes a plain `name: string`, so\n// providing under this exact name needs no static declaration at all.\n\nconst PREVIEW_TTL_MS = 5 * 60 * 1000\nconst MAX_PREVIEWS = 256\n/** Matches @acryldev/cordis-plugin-market's own PACKAGE_NAME_PATTERN - it rejects the whole list if even one entry isn't a real npm package name. */\nconst NPM_PACKAGE_NAME_PATTERN = /^(?:@[a-z0-9][a-z0-9._-]*\\/)?[a-z0-9][a-z0-9._-]*$/u\n\n/** Matches `@acryldev/cordis-plugin-market`'s own `MarketDesktopPlugins` shape exactly - the six methods it actually calls. */\nexport class WebPluginsService extends Service {\n private readonly previews = new Map<string, PreviewEntry>()\n\n private readonly controller: AcrPluginLifecycleController\n private readonly profileName: string\n\n constructor(ctx: Context, options: { readonly controller: AcrPluginLifecycleController; readonly profileName: string }) {\n super(ctx, 'desktopPlugins')\n this.controller = options.controller\n this.profileName = options.profileName\n }\n\n list(): readonly WebMarketPluginBundle[] {\n return this.controller.snapshot().entries\n // A Loader row's own `moduleName` is often not npm-package-shaped at\n // all (`cordis:group`, `cordis:include`, ...) - the market validates\n // every name it receives against exactly this npm-package pattern\n // (`@acryldev/cordis-plugin-market`'s own PACKAGE_NAME_PATTERN) and hard-rejects\n // the whole list if even one entry fails, so this filter isn't\n // optional cosmetics.\n .filter(entry => NPM_PACKAGE_NAME_PATTERN.test(entry.moduleName))\n .map(entry => ({\n bundleId: entry.entryId,\n packageName: entry.moduleName,\n status: entry.enabled ? 'active' : 'disabled',\n mutable: entry.mutable,\n }))\n }\n\n disabledPackageNames(): readonly string[] {\n return this.controller.snapshot().entries\n .filter(entry => !entry.enabled && NPM_PACKAGE_NAME_PATTERN.test(entry.moduleName))\n .map(entry => entry.moduleName)\n }\n\n isDisabled(packageName: string): boolean {\n return this.disabledPackageNames().includes(packageName)\n }\n\n private mintPreview(bundleId: string, targetEnabled: boolean): { readonly previewId: string; readonly profileName: string; readonly packageName: string; readonly expiresAt: string } {\n const entry = this.controller.snapshot().entries.find(candidate => candidate.entryId === bundleId)\n if (entry === undefined) throw new Error(`web plugins: no such bundle ${JSON.stringify(bundleId)}`)\n if (!entry.mutable) throw new Error(`web plugins: bundle ${JSON.stringify(bundleId)} is not user-mutable`)\n const expectedCurrent = !targetEnabled\n if (entry.enabled !== expectedCurrent) {\n throw new Error(`web plugins: bundle ${JSON.stringify(bundleId)} is already ${entry.enabled ? 'enabled' : 'disabled'}`)\n }\n // Bounded like Desktop's own preview cache - a preview is a short-lived\n // confirmation token, not persisted state; dropping the oldest on\n // overflow is an acceptable, simple eviction for a purely defensive cap.\n if (this.previews.size >= MAX_PREVIEWS) {\n const oldest = this.previews.keys().next().value\n if (oldest !== undefined) this.previews.delete(oldest)\n }\n const previewId = randomUUID()\n const expiresAt = Date.now() + PREVIEW_TTL_MS\n this.previews.set(previewId, { entryId: bundleId, packageName: entry.moduleName, targetEnabled, expiresAt })\n return { previewId, profileName: this.profileName, packageName: entry.moduleName, expiresAt: new Date(expiresAt).toISOString() }\n }\n\n previewDisable(bundleId: string) {\n return this.mintPreview(bundleId, false)\n }\n\n previewEnable(bundleId: string) {\n return this.mintPreview(bundleId, true)\n }\n\n // `controller.setEnabled()` applies the change through Cordis' own reactive\n // Loader (`entry.update({ disabled: ... })`, spec 032's hot-reload\n // mechanism) before resolving - a resolved call has already taken effect\n // live, so success here always means `live: true`. `MarketDesktopPlugins`\n // (@acryldev/cordis-plugin-market/src/host/routes.ts) requires this field to decide\n // `restartRequired`; omitting it left `restartRequired` permanently `true`\n // for Web regardless of whether the toggle actually applied live.\n private async execute(previewId: string, targetEnabled: boolean): Promise<{ readonly packageName: string; readonly live: boolean }> {\n const preview = this.previews.get(previewId)\n if (preview === undefined || preview.targetEnabled !== targetEnabled) {\n throw new Error('web plugins: preview not found or expired')\n }\n this.previews.delete(previewId)\n if (Date.now() > preview.expiresAt) throw new Error('web plugins: preview expired')\n await this.controller.setEnabled(preview.entryId, targetEnabled)\n return { packageName: preview.packageName, live: true }\n }\n\n executeDisable(previewId: string): Promise<{ readonly packageName: string; readonly live: boolean }> {\n return this.execute(previewId, false)\n }\n\n executeEnable(previewId: string): Promise<{ readonly packageName: string; readonly live: boolean }> {\n return this.execute(previewId, true)\n }\n}\n\n/**\n * Web's own `livePluginActivation` (spec 034 T006 follow-up, prompted by a\n * real user hitting the gap: installing through the Market left the new\n * plugin inactive until a full server-process restart). Matches Desktop's\n * own `LivePluginActivationService` (`acryl-desktop/src/plugins/lifecycle/plugin-lifecycle-\n * controller.ts`) almost line for line - both are thin wrappers over the\n * exact same shared `AcrPluginLifecycleController` (spec 034 T005), whose\n * `activate()`/`deactivate()`/`setEnabledByPackageName()`/`statusOfPackage()`\n * are already fully generic: `activate()` resolves the just-installed\n * package's own Loader row through `PluginLifecycleHost.bundleRow()` (backed\n * here by the same `resolvePackageJson` this file's own `provideWebMarketPlugins`\n * already wires up) and mounts it into the *live* Loader tree via\n * `ctx.loader.create()` - the same proven, still-shipped host-side hot-mount\n * mechanism `specs/032-universal-hot-reload`'s T1/T2/T4/T5 already landed and\n * use elsewhere. Nothing new or risky is built here; this is reuse.\n *\n * `@acryldev/cordis-plugin-market`'s own install service calls `activate()`\n * automatically right after a successful install when this service is\n * present (`liveActivate` in `@acryldev/cordis-plugin-market/src/index.ts`), then\n * `acknowledgeLiveInstall()` (already implemented as a no-op above - no WAL\n * to acknowledge). The market's own client finishes with a full page\n * `location.reload()` - the same safe mechanism Desktop's Client half uses\n * (a renderer/webContent reload, not a process restart); Web's `location` IS\n * the browser tab, so this is the exact same operation for both surfaces,\n * not something this file needs to build separately.\n */\nexport class WebLiveActivationService extends Service {\n constructor(ctx: Context, private readonly controller: AcrPluginLifecycleController) {\n super(ctx, 'livePluginActivation')\n }\n\n async activate(packageName: string): Promise<void> {\n await this.controller.activate(packageName)\n }\n\n async deactivate(packageName: string): Promise<void> {\n await this.controller.deactivate(packageName)\n }\n\n requireModules(owner: string, modules: readonly string[]): Promise<void> {\n return this.controller.requireModules(owner, modules)\n }\n\n setEnabled(packageName: string, enabled: boolean): Promise<boolean> {\n return this.controller.setEnabledByPackageName(packageName, enabled)\n }\n\n statusOf(packageName: string): 'active' | 'disabled' | undefined {\n return this.controller.statusOfPackage(packageName)\n }\n}\n\n/**\n * Mount the shared plugin lifecycle for Web (not yet done anywhere in this\n * surface before this file) and provide the market-shaped view over it,\n * plus live activation so a Market install/uninstall takes effect without a\n * server-process restart.\n * @param ctx - the host root (matching `provideWebMarketInstall`'s own timing/scope).\n * @param options - the same options shape the CLI's own `plugin-command.ts` already builds.\n */\nexport function provideWebMarketPlugins(ctx: Context, options: DshPluginLifecycleOptions): void {\n const lifecycle = mountAcrylPluginLifecycle(ctx, options)\n ctx.plugin(WebPluginsService, { controller: lifecycle.controller, profileName: options.profileName })\n ctx.plugin(WebLiveActivationService, lifecycle.controller)\n}\n","/**\n * The `dsh` engine provider (spec 028): mounts the pinned Harness profile as\n * one Loader row under `createAcrylEngineHost`'s persistent root, instead of\n * the second Cordis root `boot()`/`bootAcrylHarnessProfile` creates. Performs\n * the identical composition - the HMR guard, workspace-status/session-log-\n * exporter wiring - so selecting `dsh` behaves exactly like today's direct\n * boot (SC-004).\n *\n * Two entry points share the mounting primitive (`mountDshEngine`) but differ\n * in where the composition comes from: {@link createDshEngineDefinition} is\n * the CLI/TUI flavor, resolving a named profile through this package's own\n * profile system; {@link createDshEngineDefinitionFromComposition} takes an\n * already-resolved `{rootConfig, patches, bareModuleBaseUrl}` a surface with\n * its own profile pipeline (Desktop's `prepareDesktopProfile()`) produced\n * itself. Neither does the other's job.\n *\n * `mountRootInclude` (unlike `boot()`) composes onto an already-initialized\n * Loader rather than creating its own, but it does not scope the Include row\n * it creates to the calling plugin's own fiber - this plugin owns and\n * removes it explicitly via `ctx.effect()`. Verified with a real Loader\n * activation in `tests/engine-host-mount-root-include.spec.ts` before this\n * file trusted the pattern.\n */\n\nimport { brandWebIndex } from './web-favicon.ts'\nimport { existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, realpathSync, rmSync, symlinkSync, writeFileSync } from 'node:fs'\nimport { createRequire, findPackageJSON } from 'node:module'\nimport { basename, dirname, join } from 'node:path'\nimport { fileURLToPath, pathToFileURL } from 'node:url'\nimport type { Context } from '@deepseek-ai/cordis'\nimport type { PatchOptions } from '@deepseek-ai/cordis-plugin-include'\nimport {\n DEFAULT_PROFILE_BUNDLES,\n PROFILE_TEMPLATES,\n composeEntries,\n createRuntimeResolution,\n initProfile,\n loadOverlayPatches,\n loadProfile,\n removeLinkProjections,\n mountRootInclude,\n resolveProfileDir,\n type Profile,\n type ProfileContext,\n type RuntimeResolution,\n} from '@deepseek-ai/dsh-app-boot'\nimport { dshHomePath } from '@deepseek-ai/dsh-home-paths'\nimport { homePluginsDir } from '@acryldev/plugin-hub-core'\nimport { provideAcrylTools } from './engine-tools.ts'\nimport * as acrylWebService from '@acryldev/web'\nimport type {} from '@deepseek-ai/dsh-host-webserver'\n\nimport { provideCliMarketInstall } from './cli-market-install.ts'\nimport { provideCliMarketPlugins } from './cli-market-plugins.ts'\nimport type { AcrylCodingCapabilityId, AcrylShellMode, AcrylSurface } from './coding-capabilities.ts'\nimport type { AcrylEngineDefinition } from './engine-host.ts'\nimport { installAcrylWorkspaceStatusTool } from './plugin-acryl-workspace-status.ts'\nimport { blueprintFromEnvironment, composeBlueprintRows, currentModule, packageOfModule } from './blueprint/index.ts'\nimport { findFreeWebPort, loopbackPortIsFree, webPortPatch } from './web-port.ts'\nimport { LOOPBACK_WEB_HOST, selectInstance, type AppInstance } from './instance/index.ts'\nimport { claimProfile } from './profile-owner.ts'\nimport { pluginLifecyclePatches, readUserMutableBundleNames, resolvePluginLifecycleStatePath } from './plugin-lifecycle-state.ts'\nimport { ProfilePluginPackages } from './profile-resolution/service.ts'\nimport { installSessionLogExporter } from './session-log-exporter.ts'\nimport { provideWebMarketInstall } from './web-market-install.ts'\nimport { provideWebMarketPlugins } from './web-market-plugins.ts'\n\nconst require = createRequire(import.meta.url)\nconst dshInstallAnchor = require.resolve('@deepseek-ai/dsh/package.json')\nconst profileRoot = '[]\\n'\n\n/** The agent presets DSH 0.2 ships, in roster order. */\nconst SHIPPED_PRESET_NAMES: readonly string[] = ['standard', 'ptc', 'minimal', 'cordis']\n\n/**\n * The terminal's agent presets. DSH 0.2 declares each preset as a bundle patch of `dsh-web-app` (`presets/<name>.patch.yml`\n * inserts a `preset-<name>` row) and has no terminal app bundle, so a terminal profile on `dsh-base` alone has an empty roster.\n * ACRYL layers the same four files in, skipping any preset row the profile already composes (a Web-shaped profile booted by the CLI).\n */\nfunction terminalPresetPatches(existingRowIds: ReadonlySet<string>): PatchOptions[] {\n const presetsDir = join(dirname(require.resolve('@deepseek-ai/dsh-web-app/package.json')), 'presets')\n const presets = SHIPPED_PRESET_NAMES.flatMap(name => loadOverlayPatches('acryl', join(presetsDir, `${name}.patch.yml`)).flatMap((patch) => {\n if (!('insert' in patch) || patch.insert === undefined) return [patch]\n const insert = patch.insert.filter(row => row.id === undefined || !existingRowIds.has(row.id))\n return insert.length === 0 ? [] : [{ ...patch, insert }]\n }))\n // The presets' delegation tools run with `modelSelectionSettings: true`, which requires the settings row `dsh-web-app` itself composes\n // next to them; without it every preset's subagent tool failed to load in the terminal.\n return existingRowIds.has(SUBAGENT_MODEL_SETTINGS_ROW.id) ? presets : [{ insert: [SUBAGENT_MODEL_SETTINGS_ROW] }, ...presets]\n}\n\n/** `dsh-web-app`'s Host row that the presets' `modelSelectionSettings` delegation tools require. */\nconst SUBAGENT_MODEL_SETTINGS_ROW = { id: 'subagent-model-selection-settings', name: '@deepseek-ai/dsh-tool-subagent/model-selection-settings' } as const\n\n/** An already-resolved dsh composition: what one surface's own profile pipeline produced. */\nexport interface DshEngineComposition {\n readonly rootConfig: string\n readonly patches: readonly PatchOptions[]\n /** Resolves worker-only bare-module URLs (e.g. `/plugins/...`); omitted when the surface serves no such URLs. */\n readonly bareModuleBaseUrl?: string\n /** Which ACRYL surface this is (`tui`, `web`, `desktop`) - becomes part of the durable session-log filename. */\n readonly surface: string\n /** The product name the page title carries (the Blueprint's brand); defaults to `ACRYL`. */\n readonly productName?: string\n /** The stock ACRYL brand (not a Blueprint's own): the served page wears the ACRYL icon. */\n readonly stockBrand?: boolean\n /** The app this composition belongs to; provided to plugins as the `appInstance` service. Chosen by the surface's composition root. */\n readonly instance?: AppInstance\n /** File URL of the surface's own `package.json` (where ACRYL-owned workspace packages resolve from); provided to plugins\n * as the `acrylFrameworkPackages` service. Omitted where materializing an ACRYL framework package into a local\n * extension's profile does not apply (for example, a composition root with its own separate profile pipeline). */\n readonly installPackageUrl?: string\n /**\n * The package table `@deepseek-ai/dsh-app-boot` computes for this profile (DSH 0.2). Since 0.2 a profile no longer carries link\n * projections of the installation's packages; the `pluginPackages` service (ACRYL's `ProfilePluginPackages`) answers every bare-package import from this table, so\n * the engine mounts it before the profile include. Compute it with {@link createProfileRuntimeResolution} after every\n * ACRYL-owned package has been materialized into the profile.\n */\n readonly runtimeResolution?: RuntimeResolution\n /**\n * The profile facts DSH 0.2 reads for live configuration. `config-editor`, `settings` (the Models page, where credentials are\n * entered) and the plugin manager are only enabled while a `profileContext` exists, exactly as stock `dsh` provides one.\n * Never named `desktop`: that name would also switch on upstream's product telemetry rows.\n */\n readonly profileContext?: ProfileContext\n}\n/**\n * The surface's coding-capability composition, handed to an engine definition by the app that owns it: the plugins package for the\n * rows, the package names, the anchor they resolve from, and the rows the advanced shell replaces. `@acryldev/coding-capabilities` is\n * the one implementation; the runtime never imports it (its Blueprint vocabulary lives in `coding-capabilities.ts`).\n */\nexport interface CodingCapabilities {\n /** Installations whose `node_modules` may hold a package the composition names, in order (the surface's, then the composition package's). */\n readonly anchors: readonly string[]\n patches(surface: ReadonlySet<AcrylSurface>, existingRowIds: ReadonlySet<string>, only: ReadonlySet<AcrylCodingCapabilityId>): readonly PatchOptions[]\n shellPatches(surface: ReadonlySet<AcrylSurface>, shellMode: AcrylShellMode, existingRowIds: ReadonlySet<string>, only: ReadonlySet<AcrylCodingCapabilityId>): readonly PatchOptions[]\n /** The ACRYL-owned packages a surface must make resolvable for the capabilities it composes. */\n packages(surface: ReadonlySet<AcrylSurface>, only: ReadonlySet<AcrylCodingCapabilityId>): readonly string[]\n /** The rows the advanced shell replaces (`ADVANCED_SHELL_PATCHES`), for a Blueprint with an `app-shell` row. */\n readonly appFramePatches: readonly PatchOptions[]\n}\n\n\n/**\n * ACRYL's own patches out of a composed list laid out as `[bundle layers..., ACRYL additions..., profile's own patches..., later ACRYL\n * additions...]`. DSH 0.2's live configuration (`config-editor`, `hmr`) rebuilds the Loader from stock sources (bundle layers, the\n * profile file, the home file) plus `ProfileContext.overlays`; ACRYL's capability rows, blueprint rows, presets and plugin-lifecycle\n * toggles exist only in memory, so they must be handed over as overlays or the first edit would reload them away and be rolled back.\n */\nfunction acrylAdditions(\n patches: readonly PatchOptions[],\n layout: { readonly layerPatches: number, readonly userPatches: number, readonly composedBeforeLater: number },\n): PatchOptions[] {\n const userStart = layout.composedBeforeLater - layout.userPatches\n return [...patches.slice(layout.layerPatches, userStart), ...patches.slice(layout.composedBeforeLater)]\n}\n\n/** Module HMR is never wanted (see `mountDshEngine`); it has to be part of every reload as well as of the first mount. */\nconst HMR_OFF: PatchOptions = { id: 'hmr', disabled: true }\n\n/**\n * DeepSeek's own product analytics, which DSH's Web bundle switches on for any profile named `desktop` (Desktop's profile is) and which report\n * to DeepSeek's collector. ACRYL is not that product: they are off on every surface, at the first mount and at every reload, instead of\n * depending on a profile name. Mounted, the Host row also failed its config at every start, since only DeepSeek's shell sets its\n * `serviceVersion` (`DSH_CLIENT_VERSION`).\n */\nexport const UPSTREAM_PRODUCT_ANALYTICS_OFF: readonly PatchOptions[] = Object.freeze([\n { id: 'desktop-product-telemetry', disabled: true },\n { id: 'product-analytics', disabled: true },\n])\n\n/**\n * The patches an app instance contributes to every composition: an instance that must not use the OS user's Documents folder points the chat's first\n * workspace at its own `documents` folder. A patch for a row the surface does not compose (the terminal has no workspace controller) is ignored.\n */\nexport function instancePatches(instance: AppInstance | undefined): readonly PatchOptions[] {\n return instance?.documentsDirectory === undefined ? [] : [{ id: 'workspace-controller', config: { documentsDirectory: instance.documentsDirectory } }]\n}\n\n/** The profile facts a launcher hands to DSH's live configuration (stock `dsh`: `profile-boot`, `runProfile`). */\nexport function createProfileContext(\n profile: Profile,\n options: {\n readonly installAnchor?: string\n readonly home: string\n readonly packageManager?: ProfileContext['packageManager']\n /** ACRYL's in-memory patches that a configuration reload must keep applying (see {@link acrylAdditions}). */\n readonly overlays?: readonly PatchOptions[]\n /** The app instance, whose own patches (see {@link instancePatches}) a reload must keep applying as well. */\n readonly instance?: AppInstance\n },\n): ProfileContext {\n return {\n name: profile.name,\n ...(options.packageManager === undefined ? {} : { packageManager: options.packageManager }),\n dir: profile.dir,\n patchPath: profile.patchPath,\n installAnchor: options.installAnchor ?? dshInstallAnchor,\n cwd: process.cwd(),\n home: options.home,\n startedBundles: profile.layers.map(layer => layer.packageName),\n overlays: [...(options.overlays ?? []), HMR_OFF, ...UPSTREAM_PRODUCT_ANALYTICS_OFF, ...instancePatches(options.instance)],\n telemetryDisabledEnv: process.env.DSH_TELEMETRY_DISABLED,\n }\n}\n\n/**\n * The runtime resolution for a loaded profile, as stock `dsh` computes it (`profile-boot`: `composeProfile`).\n * @param installAnchor - the `package.json` whose dependency closure the profile may import from. Defaults to the `dsh`\n * package; a surface that ships ACRYL-owned packages (Desktop) passes its own, so those resolve like any dependency.\n */\nexport function createProfileRuntimeResolution(profile: Profile, installAnchor: string = dshInstallAnchor): Promise<RuntimeResolution> {\n return createRuntimeResolution({ installAnchor, profile })\n}\n\n/**\n * Mount an already-resolved dsh composition under the given already-\n * initialized Loader `ctx`. Does no profile resolution of its own - the\n * caller (a CLI `--profile` name resolved via `resolveProfileDir`/\n * `loadProfile`, or Desktop's own `prepareDesktopProfile()`) already\n * produced `rootConfig`/`patches`/`bareModuleBaseUrl`.\n */\nasync function mountDshEngine(ctx: Context, composition: DshEngineComposition): Promise<void> {\n // DSH 0.2 enables the `hmr` row whenever a `profileContext` exists. It only watches the profile files for edits made outside the app\n // (and needs Loader internals plus a launcher readiness signal); in-app edits (`config-editor`, Settings, Models) reconcile the Loader\n // themselves. ACRYL activates and reloads plugins through Loader entries and `livePluginActivation`, so every composition switches it off.\n // Left on, it also stalls engine disposal after a swap (its queued reload waits on a tree that is unloading).\n const patches: PatchOptions[] = [...composition.patches, HMR_OFF, ...UPSTREAM_PRODUCT_ANALYTICS_OFF, ...instancePatches(composition.instance ?? selectInstance())]\n // This assignment feeds mountRootInclude's own nested composition tree\n // (constructed below, from this ctx) - not the host root's own top-level\n // tree, whose baseUrl is a one-time snapshot taken when `createAcrylEngineHost`\n // calls `ctx.plugin(Loader)`, long before this plugin function ever runs\n // (see engine-host.ts's `HOST_ROOT_BASE_URL`). Setting `ctx.baseUrl` here\n // reaches only entries nested inside mountRootInclude's own subtree (the\n // real DSH profile plugins) - the \"acryl-engine-<id>\" and sibling\n // \"cordis:include\" rows at the host's own top level are unaffected by\n // anything this function does.\n ctx.baseUrl = pathToFileURL(dirname(composition.rootConfig)).href + '/'\n // mountRootInclude's Include entry lands as a sibling of this plugin's own\n // entry in the shared host Loader tree, not a descendant of it (the same\n // fact behind the disposal fix above) - ctx.provide() on this plugin's own\n // forked ctx would not be an ancestor of that sibling's consumers.\n // ctx.root is the one scope every entry in the tree shares. dshHomePath is\n // a static, engine-agnostic value (home-path resolution helpers, not\n // per-engine state), so it is provided once and left on the host's root\n // rather than disposed per engine swap - re-providing it on a later\n // re-mount of `dsh` would otherwise throw \"service already registered\".\n if (ctx.root.get('dshHomePath') === undefined) ctx.root.provide('dshHomePath', dshHomePath)\n // The app's resource family (instance/): plugins read where their app keeps things from here, never from the environment or the OS home.\n const provided = ctx.root.get('appInstance' as never) as AppInstance | undefined\n const instance = provided ?? composition.instance ?? selectInstance()\n if (provided === undefined) ctx.root.provide('appInstance', instance)\n if (composition.installPackageUrl !== undefined && ctx.root.get('acrylFrameworkPackages' as never) === undefined) {\n ctx.root.provide('acrylFrameworkPackages', createAcrylFrameworkPackages(ctx, composition.installPackageUrl))\n }\n // Owned by this engine's fiber (not the root), so an engine swap releases the interception with the profile it served.\n if (composition.runtimeResolution !== undefined) await ctx.plugin(ProfilePluginPackages, { resolution: composition.runtimeResolution })\n if (composition.profileContext !== undefined && ctx.root.get('profileContext' as never) === undefined) ctx.root.provide('profileContext', composition.profileContext)\n // The include is recorded under the context it is mounted on, and DSH's profile reload (`config-editor`, `hmr`) looks it up on the\n // root context, so mount it there: a reload then finds \"the root Include entry\" and an edit can be applied and kept.\n const entry = await mountRootInclude(ctx.root, composition.rootConfig, patches, composition.bareModuleBaseUrl)\n // mountRootInclude creates its Include row at the Loader's own top level -\n // it has no `parent` parameter and is not scoped to this plugin's own\n // fiber the way ctx.effect() resources are. Without this, an engine swap\n // away from `dsh` would leave the whole profile tree mounted forever.\n if (entry !== undefined) {\n // Loader 1.0.5's `remove` starts the row's disposal without waiting for it, so wait for the include's fiber here:\n // a swap away from `dsh` must not return while the profile's services are still registered.\n ctx.effect(() => async () => {\n const fiber = entry.fiber\n ctx.loader.remove(entry.options.id)\n // On a swap the root stays up and the caller must see the profile gone; when the whole root is disposing, the include goes with it\n // and waiting on it here would wait on the very disposal that is running this effect.\n if (ctx.root.fiber.state === 2) await fiber?.dispose()\n })\n }\n // Do not call ctx.loader.await() here: this function is itself running as\n // part of one Loader entry's activation, and awaiting the same loader from\n // inside it deadlocks. createAcrylEngineHost's own ctx.loader.await(),\n // called from outside any entry after ctx.loader.create()/update()\n // resolves, already settles this nested tree too - proven in\n // tests/engine-host-mount-root-include.spec.ts.\n //\n // installAcrylWorkspaceStatusTool does bare ctx.tools property access,\n // which is topology-sensitive and requires a declared injection (not\n // satisfied by this plugin's own forked ctx, for the same sibling-not-\n // descendant reason as the dshHomePath fix above). ctx.inject(['tools'])\n // resolves that safely. Neither installAcrylWorkspaceStatusTool nor its\n // own `apply()` Cordis-plugin form wraps ctx.tools.register()'s returned\n // disposer in ctx.effect() (true of its other two callers too, harmless\n // there only because they own a whole process-lifetime root) - this\n // plugin must own that disposer itself, or an engine swap away from and\n // back to `dsh` would double-register the tool.\n // Guarded exactly like bootAcrylHarnessProfile's original check - some\n // profile variants legitimately have no ctx.tools at all (SC-004: this\n // extraction must not change that behavior).\n if (ctx.get('tools') !== undefined) {\n ctx.inject(['tools'], toolsCtx => {\n const disposeTool = installAcrylWorkspaceStatusTool(toolsCtx)\n ctx.effect(() => disposeTool)\n })\n }\n // ctx.logger is an ambient Cordis primitive, not a topology-sensitive\n // injected service (unlike ctx.tools), and ctx.logger.exporter() already\n // ties its own disposal to the ctx that registers it (see\n // installSessionLogExporter's own doc comment) - this plugin's own ctx is\n // correct here, unlike the two cases above.\n installSessionLogExporter(ctx, { surface: composition.surface, dshHome: instance.dshHome })\n // Web only: the shell HTML dsh-web-app serves is a pinned\n // @deepseek-ai/dsh-web-frontend build artifact with a hardcoded\n // \"DeepSeek Harness\" <title> - not part of the pluggable Cordis Client\n // slot system the brand-swap patch (resolveWebEngineComposition) actually\n // covers, so swapping ui-brand-official for ui-acryl alone leaves the\n // visible browser-tab title wrong. Reproduced directly: a real served\n // index still read \"<title>DeepSeek Harness</title>\" after the brand-swap\n // patch landed. Desktop does not have this gap - electron-shell-\n // generation.ts already suppresses page-title-updated and keeps its\n // native window title fixed at the OS level, so this vendored HTML's\n // <title> never reaches anything the user sees there; Web has no native\n // window, so this served HTML's own <title> IS the visible artifact.\n // dsh-host-webserver's WebServer service exposes tapIndex(transform) as\n // its own designed escape hatch for exactly this class of rewrite (\"no\n // IndexInjection row exists for this\", per its own doc comment) -\n // registering a tap here, rather than editing the vendored\n // dsh-web-frontend package, which the project's own repo rules forbid.\n // The same tap swaps the favicon for the ACRYL logo, inlined as a data URL\n // (web-favicon.ts), so no route or static asset is needed.\n // The web port ACRYL's own plugins depend on (instead of DSH's `webServer`): Web and Desktop have a page, the terminal has none.\n // The same plugin every Blends app mounts (row acryl-web); it waits for webServer by its own inject.\n if (composition.surface !== 'tui') ctx.plugin(acrylWebService)\n // The tools port every surface can offer (the terminal's chat has the same registry).\n ctx.inject(['tools'], toolsCtx => { provideAcrylTools(toolsCtx) })\n if (composition.surface === 'web') {\n ctx.inject(['webServer'], webServerCtx => {\n // A custom brand ships its own favicon (@acryldev/brand); only the stock ACRYL brand gets the ACRYL logo (`productName` is always set, so it cannot tell).\n const disposeTap = webServerCtx.webServer.tapIndex(html => brandWebIndex(html, composition))\n ctx.effect(() => disposeTap)\n })\n // Web's own desktopPlugins/livePluginActivation (spec 034 T006) - mounted\n // BEFORE desktopProfiles/desktopPnpm below on purpose. dsh-community-\n // market's own ctx.inject(['desktopProfiles', 'desktopPnpm'], ...) reads\n // ctx.get('livePluginActivation') exactly once, opportunistically, the\n // moment that inject's dependencies first resolve - not reactively, so a\n // livePluginActivation provided AFTER that moment is captured as\n // `undefined` for the fiber's whole life. Reproduced directly: with the\n // reverse order, a real install through the Market succeeded but the\n // installed plugin never became active without a full process restart -\n // no error anywhere, just a silently-missed live-activation opportunity.\n // Web has no shared plugin-lifecycle mount at all before this - CLI's and\n // Desktop's own each mount it separately, so this is the first time Web\n // gets one. Guarded like dshHomePath above: an engine swap away from and\n // back to `dsh` must not re-provide an already-registered service.\n if (ctx.root.get('desktopPlugins') === undefined) {\n const profileDir = dirname(composition.rootConfig)\n provideWebMarketPlugins(ctx.root, {\n profileName: 'web',\n profileDir,\n statePath: resolvePluginLifecycleStatePath(),\n binName: 'acryl-web',\n // `createDshPluginLifecycleHost`'s own internal wrapper already\n // appends \"/package.json\" before calling this callback - despite the\n // option's own parameter being named `packageName`, what actually\n // arrives here is the full \"<packageName>/package.json\" specifier\n // already. Reproduced directly: a real live-activation attempt threw\n // ERR_PACKAGE_PATH_NOT_EXPORTED on a literal \"package.json/package.json\"\n // subpath before this fix - the same latent bug exists in acryl-cli's\n // own plugin-command.ts, just never exercised there (the CLI has no\n // install/live-activation path yet, spec 034 T006).\n resolvePackageJson: specifier => createRequire(pathToFileURL(join(profileDir, 'package.json'))).resolve(specifier),\n })\n }\n // Web's own desktopProfiles/desktopPnpm (spec 034 T006, scoped v1) - what\n // @acryldev/cordis-plugin-market's install service needs for its Install/Uninstall\n // buttons to do a real operation instead of showing \"ACRYL is required\".\n // Both are stateless besides this one profile's own fixed name/directory,\n // so - also like dshHomePath - never disposed; there is nothing to\n // invalidate by leaving them registered for the process's whole life.\n if (ctx.root.get('desktopProfiles') === undefined) {\n provideWebMarketInstall(ctx.root, dirname(composition.rootConfig))\n }\n }\n // CLI/TUI's own desktopPlugins/livePluginActivation + desktopProfiles/\n // desktopPnpm (spec 034 T006, completing the third surface) - same\n // ordering constraint as Web above (mount desktopPlugins first, since\n // @acryldev/cordis-plugin-market's own ctx.inject(['desktopProfiles', 'desktopPnpm'])\n // reads ctx.get('livePluginActivation') exactly once, opportunistically).\n // Unlike Web, the CLI has more than one named profile, so the profile name\n // comes from this composition's own directory rather than a literal - see\n // dsh-app-boot's own `$DSH_HOME/profiles/<name>` layout contract.\n if (composition.surface === 'tui') {\n const profileDir = dirname(composition.rootConfig)\n const profileName = basename(profileDir)\n if (ctx.root.get('desktopPlugins') === undefined) {\n provideCliMarketPlugins(ctx.root, {\n profileName,\n profileDir,\n statePath: resolvePluginLifecycleStatePath(),\n binName: 'acryl',\n // Same double-append trap as web-market-plugins.ts's own resolvePackageJson\n // and acryl-cli's own plugin-command.ts: createDshPluginLifecycleHost's\n // internal wrapper already appends \"/package.json\" before calling this.\n resolvePackageJson: specifier => createRequire(pathToFileURL(join(profileDir, 'package.json'))).resolve(specifier),\n })\n }\n if (ctx.root.get('desktopProfiles') === undefined) {\n provideCliMarketInstall(ctx.root, { name: profileName, dir: profileDir })\n }\n }\n}\n\n/** An app folder's own definition is its Blueprint unless one was chosen explicitly. */\nfunction instanceBlueprintEnvironment(instance: AppInstance): NodeJS.ProcessEnv {\n const explicit = process.env.ACRYL_BLUEPRINT\n return explicit === undefined || explicit.trim() === '' ? { ...process.env, ...(instance.definitionFile === undefined ? {} : { ACRYL_BLUEPRINT: instance.definitionFile }) } : process.env\n}\n\n/** Resolve the pinned Harness `acryl` profile by name into a mountable composition (the CLI/TUI flavor). */\nasync function resolveDshEngineComposition(profileName: string, capabilities: CodingCapabilities | undefined): Promise<DshEngineComposition> {\n // The composition root for the CLI surface: the app instance is chosen here, once. The pinned harness reads its home from DSH_HOME, so the instance is\n // handed across that boundary through the environment.\n const instance = selectInstance()\n process.env.DSH_HOME = instance.dshHome\n // Read by `acryl_workspace_status`: the agent must learn the real surface and profile, not a fallback label.\n process.env.ACRYL_SURFACE = 'tui'\n process.env.ACRYL_PROFILE = profileName\n const profileDirectory = resolveProfileDir(profileName)\n initProfile(profileDirectory, DEFAULT_PROFILE_BUNDLES)\n removeLinkProjections(profileDirectory)\n const profile = loadProfile('acryl', profileName, dshInstallAnchor)\n const rootConfig = join(profile.dir, 'cordis.yml')\n // Refuse to re-link a profile another live ACRYL installation is running from (profile-owner.ts).\n claimProfile(profile.dir, installationRoot(import.meta.url))\n writeFileSync(rootConfig, profileRoot)\n const profileLayerPatches = profile.layers.flatMap(layer => layer.patches)\n // A profile directory booted through this CLI/TUI flavor is not necessarily\n // tui-shaped: `--profile <name>` can point at one created by Desktop/Web's\n // own richer template, whose bundle already composes agent-presets/persona/\n // session-stats natively. Without this, ACRYL's own tui-only insert of the\n // same row ids collides at boot (spec 034 T008).\n const existingRowIds = new Set(composeEntries([profileLayerPatches]).map(entry => entry.id))\n const blueprint = blueprintFromEnvironment(instanceBlueprintEnvironment(instance))\n process.env.ACRYL_BLUEPRINT_ID = blueprint.id\n process.env.ACRYL_BLUEPRINT_NAME = blueprint.name\n const rowsComposition = composeBlueprintRows(blueprint, 'tui', existingRowIds, capabilities?.appFramePatches ?? [])\n const patches = structuredClone([\n ...profileLayerPatches,\n ...(capabilities?.patches(new Set(['tui']), existingRowIds, new Set(blueprint.capabilities)) ?? []),\n ...profile.patches,\n ])\n const composedBeforeLater = patches.length\n // The Blueprint's ACRYL-owned rows (extension pack, prompt shaping) and the terminal UI library (a plain library a\n // terminal plugin imports, so it is only made resolvable). Rows the profile's own bundle already composes are skipped\n // by `composeBlueprintRows` (a Desktop/Web-shaped profile booted through the CLI).\n // The ACRYL packages the terminal's coding capabilities name (`@acryldev/settings`), resolvable from this profile like the Web surface's.\n const tuiCapabilityPackages = capabilities?.packages(new Set(['tui'] as const), new Set(blueprint.capabilities)) ?? []\n for (const packageName of [...tuiCapabilityPackages, ...rowsComposition.packages]) materializeFrom(profile.dir, packageName, [...(capabilities?.anchors ?? []), import.meta.url])\n patches.push(...rowsComposition.patches)\n patches.push(...terminalPresetPatches(existingRowIds))\n // The profile's own user overrides come from the shared store, not from this\n // surface: `acryl plugin disable` on a TUI writes the same file the Desktop\n // panel and the Web surface read, so the next boot of any of them composes\n // the same plugin set.\n patches.push(...pluginLifecyclePatches({\n profileName,\n statePath: resolvePluginLifecycleStatePath(),\n }, rowIdsOf(patches)))\n return { rootConfig, patches, surface: 'tui', instance, installPackageUrl: import.meta.url, runtimeResolution: await createProfileRuntimeResolution(profile), profileContext: createProfileContext(profile, { home: instance.dshHome, instance, overlays: acrylAdditions(patches, { layerPatches: profileLayerPatches.length, userPatches: profile.patches.length, composedBeforeLater }) }) }\n}\n\n/**\n * Build the `dsh` engine definition for `createAcrylEngineHost`, bound to\n * one profile name resolved at host-creation time (a CLI `--profile`\n * argument, not something an engine swap changes later).\n */\nexport function createDshEngineDefinition(profileName: string, capabilities?: CodingCapabilities): AcrylEngineDefinition {\n if (profileName.trim() === '') throw new Error('ACRYL dsh engine profile must not be empty')\n return {\n id: 'dsh',\n plugin: async (ctx: Context) => mountDshEngine(ctx, await resolveDshEngineComposition(profileName, capabilities)),\n }\n}\n\n/**\n * Add one declared dependency to a Loader row's `inject` metadata. A patch\n * replaces the whole value, so the row's own declaration is preserved in either\n * the list or the map form Cordis accepts.\n */\nfunction withDeclaredDependency(inject: unknown, name: string): string[] | Record<string, unknown> {\n if (Array.isArray(inject)) return inject.includes(name) ? [...inject] : [...inject, name]\n if (inject !== null && typeof inject === 'object') {\n const declared = inject as Record<string, unknown>\n return name in declared ? { ...declared } : { ...declared, [name]: null }\n }\n return [name]\n}\n\n/**\n * Symlink one ACRYL-owned package into a profile's own `node_modules`, so\n * Node's ordinary bare-specifier resolution - the only mechanism\n * `HostResolvedRootInclude`'s composed rows use, verified directly by\n * logging every `resolve()` call: `context.parentURL` is always the\n * profile's own `package.json`, never `@deepseek-ai/cordis-plugin-loader`'s\n * own entry - can find it. A resolution-hook overlay (matching\n * `acryl-desktop`'s `installProfilePackageResolver`) cannot help here: it\n * only intercepts imports whose parent is the Loader's own entry module,\n * which this composition style never uses. Idempotent: replaces a stale\n * symlink pointing elsewhere, leaves an already-correct one untouched.\n *\n * The \"stale\" case is not hypothetical - it is the actual CI failure mode.\n * `release-cli.yml`'s `web` job runs the test suite and\n * `verify-npm-web-entrypoint.mjs` *before* building and smoke-testing the\n * release archive, in the same job, against the same shared\n * `~/.acryl/.dsh` home. Both earlier steps materialize this exact symlink\n * pointing at their own temporary staging directories, then delete those\n * directories in their own cleanup - leaving a **dangling** symlink behind\n * in the shared profile, not a missing one. The later archive-smoke step's\n * own `materializeProfilePackage` call then hits `EEXIST` (something is\n * there) and, before this fix, called `realpathSync.native` on it to\n * decide whether to replace it - which throws `ENOENT` on a dangling\n * symlink instead of returning a comparable path, crashing where the\n * function should simply have replaced the stale link. (An earlier pass\n * misdiagnosed this as an N-way in-process race and added a same-process\n * memo guard; that guard was harmless but irrelevant - every reproduction\n * that actually matched CI's real symptom involved *no* concurrency at\n * all, just one process inheriting another, earlier process's leftover\n * dangling link.)\n */\n/**\n * Materialize one package from the first anchor that has it: an ACRYL capability package comes from the surface's composition\n * (`@acryldev/coding-capabilities`), while the Blueprint's framework-kit packages (`acrylblends`, `@acryldev/ui`) come from the runtime's own\n * installation. Either anchor is a real installation; the first that resolves wins (spec 051 T021).\n */\nfunction materializeFrom(profileDir: string, packageName: string, anchors: readonly (string | undefined)[]): void {\n let failure: unknown\n for (const anchor of anchors) {\n if (anchor === undefined) continue\n try {\n materializeProfilePackage(profileDir, packageName, anchor)\n return\n } catch (error) {\n failure = error\n }\n }\n throw failure\n}\n\n/** The installation a module belongs to: the directory of its nearest package.json (the runtime or surface package of that checkout or install). */\nfunction installationRoot(moduleUrl: string): string {\n const manifest = findPackageJSON(moduleUrl)\n return manifest === undefined ? fileURLToPath(moduleUrl) : dirname(manifest)\n}\n\nexport function materializeProfilePackage(profileDir: string, packageName: string, installPackageUrl: string): void {\n const manifestPath = findPackageJSON(packageName, installPackageUrl)\n if (manifestPath === undefined) {\n throw new Error(`ACRYL web profile: cannot resolve package ${JSON.stringify(packageName)} from the acryl-web installation`)\n }\n const sourceDir = dirname(manifestPath)\n const linkPath = join(profileDir, 'node_modules', packageName)\n mkdirSync(dirname(linkPath), { recursive: true })\n // `lstatSync` (not `existsSync`/`realpathSync`, both of which follow the\n // symlink and would throw or report \"missing\" for a dangling one) is the\n // only one of the three that answers \"is there a filesystem entry at\n // this exact path at all\" without caring whether it resolves.\n const hasEntry = (() => {\n try {\n lstatSync(linkPath)\n return true\n } catch {\n return false\n }\n })()\n if (hasEntry) {\n // realpathSync throws on a dangling symlink rather than returning a\n // comparable path - that case means \"stale\", exactly like a mismatch.\n let existingTarget: string | undefined\n try {\n existingTarget = realpathSync.native(linkPath)\n } catch {\n existingTarget = undefined\n }\n if (existingTarget === realpathSync.native(sourceDir)) return\n rmSync(linkPath, { force: true, recursive: true })\n }\n symlinkSync(sourceDir, linkPath, 'dir')\n}\n\n/**\n * Resolves an ACRYL-owned workspace package by name into its live on-disk install and symlinks it into a\n * profile, the same way the Blueprint's own fixed rows do ({@link materializeProfilePackage}) - these\n * packages are not published, so a local extension's `package.json` cannot name one as an ordinary npm\n * dependency. Consumed by `@acryldev/plugin-context`'s local-plugin install path (`dsh.requiresAcrylPackages`\n * in an extension's `package.json`), which also activates the materialized package as a live Loader entry\n * through the existing `livePluginActivation` service - this object only makes the package resolvable.\n */\nexport interface AcrylFrameworkPackages {\n /** Symlink the package of module `name` (read under its current name) into `profileDir`'s `node_modules`, replacing a stale link; throws if it does not resolve from this installation. */\n materialize(profileDir: string, name: string): void\n /**\n * What a required name is today: its module, the package that module lives in, and whether a Loader row of that module is mounted\n * and enabled now. A module inside a package (`acrylblends/cordis/router`) is not a DSH bundle of its own, so it can only be used\n * live when it is already mounted; a plugin in the app's `plugins/` folder that declares it gets the row at the next start.\n */\n describe(name: string): RequiredFrameworkModule\n}\n\nexport interface RequiredFrameworkModule {\n readonly module: string\n readonly packageName: string\n readonly mounted: boolean\n}\n\nfunction createAcrylFrameworkPackages(ctx: Context, installPackageUrl: string): AcrylFrameworkPackages {\n return {\n materialize: (profileDir, name) => { materializeProfilePackage(profileDir, packageOfModule(currentModule(name)), installPackageUrl) },\n describe: (name) => {\n const module = currentModule(name)\n // Read at call time: the service outlives an engine swap, and the live tree is what a plugin will run against.\n const mounted = [...ctx.root.loader.entries()].some(entry => entry.options.name === module && entry.options.disabled !== true)\n return { module, packageName: packageOfModule(module), mounted }\n },\n }\n}\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n /** Resolves an ACRYL-owned workspace package by name for a local extension to depend on (see {@link AcrylFrameworkPackages}). */\n acrylFrameworkPackages: AcrylFrameworkPackages\n }\n}\n\n/**\n * ACRYL-owned framework packages the app's own committed plugins (`<app home>/plugins/*`, `homePluginsDir`) declare\n * through `dsh.requiresAcrylPackages` in their `package.json`. Read at compose time, not through\n * `@acryldev/plugin-context`'s dynamic agent-runtime install path: `livePluginActivation.activate()`'s group\n * resolution (`PluginLifecycleController`'s `bundleGroup()`, a fixed-point-free heuristic over the live Loader\n * tree) failed a real, reproduced activation of `@acryldev/app-shell` through that path (\"invalid plugin... received\n * object\") for reasons that trace into vendored Cordis internals this repo does not edit. A static row, inserted\n * the same way the Blueprint's own fixed rows are (`composeBlueprintRows`/`materializeProfilePackage`), sidesteps\n * dynamic activation entirely and is what every one of those fixed rows already relies on successfully.\n * Never throws: a missing or malformed `package.json` is skipped, not fatal to boot.\n */\nexport function pluginRequiredFrameworkPackages(appHome: string): readonly string[] {\n const pluginsDir = homePluginsDir(appHome)\n if (!existsSync(pluginsDir)) return []\n const names = new Set<string>()\n for (const entry of readdirSync(pluginsDir, { withFileTypes: true })) {\n if (entry.isDirectory()) for (const module of requiredModulesOf(join(pluginsDir, entry.name, 'package.json'))) names.add(module)\n }\n return [...names]\n}\n\n/**\n * The modules inside a package (`acrylblends/cordis/state`) that the plugins installed in a profile (its user bundles) declare through\n * `dsh.requiresAcrylPackages`. A running app mounts such a module's row when one of them is installed (spec 049 T001); composing the same\n * rows at start keeps the next start's tree what the running one had. A whole package a plugin requires is a profile bundle of its own and\n * composes as one, so it is not listed here. Never throws: an unreadable manifest is skipped.\n */\nexport function profileRequiredFrameworkModules(profileDir: string): readonly string[] {\n const modules = new Set<string>()\n for (const bundle of readUserMutableBundleNames(profileDir)) {\n for (const module of requiredModulesOf(join(profileDir, 'node_modules', bundle, 'package.json'))) {\n if (module !== packageOfModule(module)) modules.add(module)\n }\n }\n return [...modules]\n}\n\n/** The modules one plugin's `package.json` declares in `dsh.requiresAcrylPackages`, by today's names; none when it is missing or malformed. */\nfunction requiredModulesOf(manifestPath: string): readonly string[] {\n if (!existsSync(manifestPath)) return []\n try {\n const manifest = JSON.parse(readFileSync(manifestPath, 'utf8')) as { dsh?: { requiresAcrylPackages?: unknown } }\n const required = manifest.dsh?.requiresAcrylPackages\n // Each entry is a module, mounted as its own row; a name from before the framework moved to acrylblends is read as today's module.\n return Array.isArray(required) ? required.filter((name): name is string => typeof name === 'string').map(currentModule) : []\n } catch { return [] /* a malformed plugin package.json is the plugin's own problem, reported when it installs, not here */ }\n}\n\n/** Resolve the pinned Harness `web` profile into a mountable composition (the Web flavor). */\nasync function resolveWebEngineComposition(installPackageUrl: string, capabilities: CodingCapabilities | undefined): Promise<DshEngineComposition> {\n const profileName = 'web'\n // The composition root for the Web surface: the app instance is chosen here, once (see the CLI flavor above).\n const instance = selectInstance()\n process.env.DSH_HOME = instance.dshHome\n process.env.ACRYL_SURFACE = 'web'\n process.env.ACRYL_PROFILE = profileName\n const profileDirectory = resolveProfileDir(profileName)\n // The shipped `web` template (PROFILE_TEMPLATES.web) bundles dsh-web-app\n // (dsh-client-connection, webStartup, the auth-gated index) on top of\n // dsh-base - DEFAULT_PROFILE_BUNDLES is only ['@deepseek-ai/dsh-base'], the\n // generic fallback loadProfile() uses for a *custom-named* profile with no\n // shipped template (the CLI/TUI flavor's own 'acryl'/'--profile' names).\n // initProfile() only writes package.json when one doesn't exist yet, so\n // calling it here with the wrong (too-minimal) bundle list on a profile\n // loadProfile() would otherwise auto-initialize correctly *pre-empts* that\n // correct initialization - a fresh 'web' profile then permanently has no\n // dsh-web-app bundle, so ctx.get('connection')/ctx.get('webStartup') never\n // exist and the served index falls back to its own \"authentication\n // required\" client-side message rather than ever serving the app.\n // Reproduced directly: a fresh profile's Loader entries contained no\n // \"connection\" or \"web-startup\" row at all (not pending, not failed -\n // absent) before this fix.\n const webTemplate = PROFILE_TEMPLATES.web\n initProfile(profileDirectory, webTemplate?.bundles ?? DEFAULT_PROFILE_BUNDLES)\n removeLinkProjections(profileDirectory)\n const profile = loadProfile('web', profileName, dshInstallAnchor)\n const rootConfig = join(profile.dir, 'cordis.yml')\n claimProfile(profile.dir, installationRoot(installPackageUrl))\n writeFileSync(rootConfig, profileRoot)\n const profileLayerPatches = profile.layers.flatMap(layer => layer.patches)\n // Same reasoning as the CLI/TUI flavor above: this profile's own bundle may\n // already compose a row ACRYL's own capability table would otherwise insert\n // a second time (spec 034 T008).\n const existingRowIds = new Set(composeEntries([profileLayerPatches]).map(entry => entry.id))\n // Web runs the same ACRYL shell and workspace Desktop does (spec 040, \"Surface sharing\"): both come from the\n // shared capability declarations, and the ACRYL packages they name are made resolvable from this profile.\n const blueprint = blueprintFromEnvironment(instanceBlueprintEnvironment(instance))\n process.env.ACRYL_BLUEPRINT_ID = blueprint.id\n process.env.ACRYL_BLUEPRINT_NAME = blueprint.name\n const webSurfaces = new Set(['web'] as const)\n const enabledCapabilities = new Set(blueprint.capabilities)\n const rowsComposition = composeBlueprintRows(blueprint, 'web', existingRowIds, capabilities?.appFramePatches ?? [])\n for (const packageName of [...(capabilities?.packages(webSurfaces, enabledCapabilities) ?? []), ...rowsComposition.packages]) {\n materializeFrom(profile.dir, packageName, [...(capabilities?.anchors ?? []), installPackageUrl])\n }\n // The app's own committed plugins may each need an ACRYL-owned framework package (see\n // `pluginRequiredFrameworkPackages`'s own doc comment for why this is a static row, not the dynamic\n // agent-runtime install path `@acryldev/plugin-context` otherwise uses), and a plugin installed into the\n // profile may need a module whose row the running app mounted for it (`profileRequiredFrameworkModules`).\n const composedRowIds = new Set(rowsComposition.patches.flatMap(patch => patch.insert ?? []).map(row => row.id))\n const requiredFrameworkPackages = [...new Set([...pluginRequiredFrameworkPackages(instance.home), ...profileRequiredFrameworkModules(profile.dir)])]\n .filter(module => !existingRowIds.has(module) && !composedRowIds.has(module))\n for (const module of requiredFrameworkPackages) materializeProfilePackage(profile.dir, packageOfModule(module), installPackageUrl)\n // A Blueprint that never enables the IDE's own `workspace` capability (every Blank-grown project) keeps the\n // stock `ui-layout` row active, because the advanced-shell capability's disabling patch is gated behind\n // `ACRYL_CODING_CAPABILITIES`' own capability table, which a third-party extension cannot opt into - it is\n // the IDE's, not a general extension mechanism. An extension that requires `@acryldev/app-shell` is claiming the\n // advanced shell exactly the same way that capability does, so it needs the identical row toggle (measured\n // live: without it, `@acryldev/app-shell`'s own layout service and the still-active stock one both try to\n // register the `layout` service and the Loader throws \"service \\\"layout\\\" has been registered\").\n const claimsAdvancedShell = requiredFrameworkPackages.includes('@acryldev/app-shell')\n const patches = structuredClone([\n ...profileLayerPatches,\n ...(capabilities?.patches(webSurfaces, existingRowIds, enabledCapabilities) ?? []),\n ...(capabilities?.shellPatches(webSurfaces, 'advanced', existingRowIds, enabledCapabilities) ?? []),\n ...requiredFrameworkPackages.map(name => ({ insert: [{ id: name, name }] })),\n ...(claimsAdvancedShell ? [{ id: 'ui-layout', disabled: true }, { id: 'ui-sidebar', disabled: false }, { id: 'ui-conversation', disabled: false }] : []),\n ...profile.patches,\n ])\n const composedBeforeLater = patches.length\n // Brand swap: same technique and same row id as acryl-desktop's own\n // (independent) brand swap in profile.ts - the stock DeepSeek Harness\n // identity (`@deepseek-ai/dsh-client-ui-brand-official`, already composed\n // by the base dsh-web-app bundle at row id `ui-brand-official`) and\n // `@acryldev/brand-client` are standalone, independently swappable\n // Cordis Client plugins carrying the same slot contract\n // (`sidebar.brand.mark`/`.name`, `conversation.hero.brand.mark`) - exactly\n // one is ever enabled. Validated against the real composed row (not\n // assumed) so a future dsh-web-app bundle change that renames or removes\n // this row fails loud here instead of silently keeping the DeepSeek brand.\n const officialBrandRow = composeEntries([patches]).find(entry => entry.id === 'ui-brand-official')\n if (officialBrandRow?.name !== '@deepseek-ai/dsh-client-ui-brand-official') {\n throw new Error('ACRYL web profile must use @deepseek-ai/dsh-client-ui-brand-official in the ui-brand-official row')\n }\n // `@deepseek-ai/dsh-client-connection` resolves `webServer` from the Context\n // its own row was built with while registering a caller's\n // `connection.rpc.handle(...)` channel. Cordis resolves an undeclared name\n // only along the provider's fiber chain, and the web server row is a sibling\n // of the connection row, so any third-party profile plugin (for example\n // acryl-dsh-editor-plugin) failed the whole tree with `cannot get property\n // \"webServer\" without inject`. Same declaration acryl-desktop's\n // prepareDesktopProfile makes for the same row.\n const connectionRow = composeEntries([patches]).find(entry => entry.id === 'connection')\n if (connectionRow?.name === '@deepseek-ai/dsh-client-connection') {\n patches.push({\n id: 'connection',\n name: connectionRow.name,\n inject: withDeclaredDependency(connectionRow.inject, 'webServer'),\n // A patch replaces the row's whole config, so the trusted names (a proxy's public host, from the instance's web access) merge into what the\n // profile already set rather than dropping its recovery or cookie settings.\n ...(instance.webAccess.trustedHosts.length === 0 ? {} : { config: { ...connectionConfig(connectionRow.config), trustedHosts: [...instance.webAccess.trustedHosts] } }),\n })\n }\n // Every ACRYL-owned row (brand, Market, extension pack, prompt shaping, UI library, shortcuts, mount anchors) comes from\n // the selected Blueprint (spec 036): the row table lives in `blueprint/compose.ts`, and the packages were made resolvable\n // from this profile above (they are ACRYL-owned workspace packages outside @deepseek-ai/dsh's dependency closure, so\n // `healProfilesModuleFallback` cannot find them; see `materializeProfilePackage`).\n patches.push(...rowsComposition.patches)\n // A second instance beside one on the default port (spec 036): ACRYL_WEB_PORT moves the server.\n // The port is part of the app's family: a stable start, and the next free one when it is taken (never a fight with another app).\n // The listening address is part of it too: loopback, unless a container entry point asked for every interface (ACRYL_WEB_HOST).\n const webHost = instance.webAccess.host\n if (instance.webPort.scan) {\n const webPort = await findFreeWebPort(instance.webPort.start, port => loopbackPortIsFree(port, webHost))\n if (webPort !== instance.webPort.start) process.stdout.write(`ACRYL: port ${String(instance.webPort.start)} is in use, using ${String(webPort)}\\n`)\n patches.push(webPortPatch(webPort, webHost))\n } else if (webHost !== LOOPBACK_WEB_HOST) {\n patches.push(webPortPatch(instance.webPort.start, webHost))\n }\n // Last, so a user override beats every composition decision above it - the\n // same shared store the CLI and the Desktop panel write (spec 034).\n patches.push(...pluginLifecyclePatches({\n profileName,\n statePath: resolvePluginLifecycleStatePath(),\n }, rowIdsOf(patches)))\n return { rootConfig, patches, surface: 'web', instance, installPackageUrl, runtimeResolution: await createProfileRuntimeResolution(profile), profileContext: createProfileContext(profile, { home: instance.dshHome, instance, overlays: acrylAdditions(patches, { layerPatches: profileLayerPatches.length, userPatches: profile.patches.length, composedBeforeLater }) }), productName: blueprint.brand.kind === 'custom' ? blueprint.brand.identity.name : 'ACRYL', stockBrand: blueprint.brand.kind === 'acryl' }\n}\n\n/** The Loader row ids a list of patches composes, for overrides that apply only to rows that exist. */\nfunction rowIdsOf(patches: readonly PatchOptions[]): ReadonlySet<string> {\n return new Set(composeEntries([[...patches]]).flatMap(row => (typeof row.id === 'string' ? [row.id] : [])))\n}\n\n/** A Loader row's config as a plain object to merge into, or an empty one when the profile set none. */\nfunction connectionConfig(config: unknown): Record<string, unknown> {\n return typeof config === 'object' && config !== null && !Array.isArray(config) ? { ...(config as Record<string, unknown>) } : {}\n}\n\n/**\n * Build the `dsh` engine definition for the Web surface's `web` profile\n * (`dsh-base` + `dsh-web-app`) - the same shared `mountDshEngine` primitive\n * as {@link createDshEngineDefinition}, resolved through this package's own\n * profile system like the CLI flavor (Web has no external profile pipeline\n * of its own, unlike Desktop's `prepareDesktopProfile()`).\n * @param installPackageUrl - file URL of `acryl-web`'s own `package.json`,\n * used to materialize `@acryldev/brand-client` and `@acryldev/cordis-plugin-market`\n * into the profile (see {@link resolveWebEngineComposition}'s own comments\n * for why that is needed).\n */\nexport function createWebEngineDefinition(installPackageUrl: string, capabilities?: CodingCapabilities): AcrylEngineDefinition {\n return {\n id: 'dsh',\n plugin: async (ctx: Context) => mountDshEngine(ctx, await resolveWebEngineComposition(installPackageUrl, capabilities)),\n }\n}\n\n/**\n * Build the `dsh` engine definition from a composition a surface already\n * resolved itself (Desktop's `prepareDesktopProfile()`: its own profile\n * selection, market/editor/BLEND patch layering, and worker bare-module base\n * URL). Performs no profile resolution of its own - unlike\n * {@link createDshEngineDefinition}, which is the CLI/TUI flavor that\n * resolves a profile by name through `@acryldev/harness-runtime`'s own profile\n * system. Handing an already-resolved composition to that function would\n * silently discard it and resolve a different profile instead.\n */\nexport function createDshEngineDefinitionFromComposition(\n composition: DshEngineComposition,\n): AcrylEngineDefinition {\n if (composition.surface.trim() === '') throw new Error('ACRYL dsh engine surface must not be empty')\n return {\n id: 'dsh',\n plugin: (ctx: Context) => mountDshEngine(ctx, composition),\n }\n}\n","/**\n * Deterministic package selection between one surface's own installation and\n * one Profile - shared by every surface with a persistent, user-mutable\n * profile directory (Desktop's Market-installed plugins, or any surface's\n * own ACRYL-only packages a shipped DSH profile has no dependency path to).\n * Extracted verbatim from acryl-desktop's own package-overlay.ts (first\n * built and proven there); `binName` is the one parameter that varies per\n * caller, keeping every message and this module's own behavior otherwise\n * identical to what Desktop already shipped.\n */\n\nimport { findPackageJSON } from 'node:module'\nimport { readFileSync, statSync } from 'node:fs'\nimport { dirname } from 'node:path'\nimport { compare, valid } from 'semver'\n\nconst MAX_MANIFEST_BYTES = 1024 * 1024\nconst MAX_VERSION_LENGTH = 128\n\nexport type PackageOverlaySource = 'install' | 'profile'\n\nexport interface PackageOverlayCandidate {\n readonly packageName: string\n readonly packageDir: string\n readonly manifestPath: string\n readonly version?: string\n readonly source: PackageOverlaySource\n}\n\nexport interface PackageOverlaySelection {\n readonly packageName: string\n readonly selected: PackageOverlayCandidate\n readonly install?: PackageOverlayCandidate\n readonly profile?: PackageOverlayCandidate\n}\n\nexport interface PackageOverlayOptions {\n /** Diagnostic prefix on thrown errors - the calling surface's own bin name. */\n readonly binName: string\n /** File URL inside the exact calling surface's own installation dependency graph. */\n readonly installPackageUrl: string\n /** File URL for the active Profile package.json. */\n readonly profilePackageUrl: string\n}\n\nexport class PackageOverlayNotFoundError extends Error {\n constructor(binName: string, packageName: string) {\n super(`${binName}: cannot resolve package ${JSON.stringify(packageName)} from the ${binName} installation or active Profile`)\n this.name = 'PackageOverlayNotFoundError'\n }\n}\n\nfunction missingPackage(cause: unknown): boolean {\n return (cause as NodeJS.ErrnoException | null)?.code === 'ERR_MODULE_NOT_FOUND'\n}\n\nfunction readCandidate(\n binName: string,\n packageName: string,\n packageUrl: string,\n source: PackageOverlaySource,\n): PackageOverlayCandidate | undefined {\n let manifestPath: string | undefined\n try {\n manifestPath = findPackageJSON(packageName, packageUrl)\n } catch (cause) {\n if (missingPackage(cause)) return undefined\n throw cause\n }\n if (manifestPath === undefined) return undefined\n const size = statSync(manifestPath).size\n if (size > MAX_MANIFEST_BYTES) {\n throw new Error(`${binName}: ${source} package manifest is too large for ${packageName}`)\n }\n let manifest: unknown\n try {\n manifest = JSON.parse(readFileSync(manifestPath, 'utf8')) as unknown\n } catch (cause) {\n throw new Error(\n `${binName}: cannot read ${source} package manifest for ${packageName}: ${cause instanceof Error ? cause.message : String(cause)}`,\n )\n }\n if (manifest === null || typeof manifest !== 'object' || Array.isArray(manifest)\n || (manifest as { name?: unknown }).name !== packageName) {\n throw new Error(`${binName}: ${source} package identity is invalid for ${packageName}`)\n }\n const version = (manifest as { version?: unknown }).version\n const comparableVersion = typeof version === 'string' && version.length > 0\n && version.length <= MAX_VERSION_LENGTH && valid(version) !== null\n ? version\n : undefined\n return {\n packageName,\n packageDir: dirname(manifestPath),\n manifestPath,\n source,\n ...(comparableVersion === undefined ? {} : { version: comparableVersion }),\n }\n}\n\n/** Extract an npm package root from one Loader bare specifier. */\nexport function packageNameFromSpecifier(specifier: string): string | undefined {\n if (specifier.length === 0 || specifier.startsWith('.') || specifier.startsWith('/')\n || specifier.startsWith('#') || URL.canParse(specifier)) return undefined\n const parts = specifier.split('/')\n if (specifier.startsWith('@')) {\n if (parts.length < 2 || parts[0]?.length === 0 || parts[1]?.length === 0) return undefined\n return `${parts[0]}/${parts[1]}`\n }\n return parts[0]?.length === 0 ? undefined : parts[0]\n}\n\n/** Find one package root using the installation/Profile overlay rule. */\nexport function findOverlayPackage(\n packageName: string,\n options: PackageOverlayOptions,\n): PackageOverlaySelection | undefined {\n if (packageNameFromSpecifier(packageName) !== packageName) {\n throw new Error(`${options.binName}: package overlay requires one exact npm package name`)\n }\n const install = readCandidate(options.binName, packageName, options.installPackageUrl, 'install')\n let profile: PackageOverlayCandidate | undefined\n try {\n profile = readCandidate(options.binName, packageName, options.profilePackageUrl, 'profile')\n } catch (cause) {\n // A valid installation package is the stable fallback when a stale\n // Profile copy has unreadable identity/version metadata. Invalid\n // installation metadata still fails before this branch and is never\n // hidden by the Profile.\n if (install === undefined) throw cause\n return { packageName, selected: install, install }\n }\n if (install === undefined && profile === undefined) return\n const selected = install === undefined\n ? profile!\n : profile === undefined\n ? install\n // Equal SemVer precedence, including build-only differences, keeps the\n // installation copy as the deterministic tie-break. A missing or\n // non-SemVer version on either side is not comparable and also keeps\n // the installation copy.\n : profile.version !== undefined && install.version !== undefined\n && compare(profile.version, install.version) > 0 ? profile : install\n return {\n packageName,\n selected,\n ...(install === undefined ? {} : { install }),\n ...(profile === undefined ? {} : { profile }),\n }\n}\n\n/** Resolve one package root, failing when neither overlay side provides it. */\nexport function resolveOverlayPackage(\n packageName: string,\n options: PackageOverlayOptions,\n): PackageOverlaySelection {\n const selection = findOverlayPackage(packageName, options)\n if (selection === undefined) throw new PackageOverlayNotFoundError(options.binName, packageName)\n return selection\n}\n","/**\n * Profile-relative package resolution for a Node runtime with a persistent,\n * user-mutable profile directory.\n *\n * Extracted verbatim from acryl-desktop's own module-resolution.ts (first\n * built and proven there against Electron's restricted runtime) - the two\n * anchors that varied per surface (the calling installation's own entry\n * module and its own package.json) are now parameters\n * ({@link InstallProfilePackageResolverOptions}) instead of hardcoded\n * Desktop paths; every other line, including the two-layer CJS/ESM hook\n * strategy and its comments, is unchanged. Desktop's own module-resolution.ts\n * is now a thin wrapper supplying its Electron-specific anchors (unpacked\n * ASAR paths) to this function - its own behavior is unaffected.\n */\n\nimport Module, { isBuiltin } from 'node:module'\nimport { basename, dirname, isAbsolute, join } from 'node:path'\nimport { fileURLToPath, pathToFileURL } from 'node:url'\nimport { requireModuleHooks } from './module-hooks.ts'\nimport {\n findOverlayPackage,\n packageNameFromSpecifier,\n resolveOverlayPackage,\n} from './package-overlay.ts'\n\ninterface CommonJsModuleResolver {\n _resolveFilename(\n request: string,\n parent: { filename?: string } | null | undefined,\n isMain: boolean | undefined,\n options?: unknown,\n ): string\n}\n\n/** Node's CommonJS package lookup list for a directory: every ancestor's node_modules, nearest first. */\nfunction nodeModulePaths(directory: string): string[] {\n const paths: string[] = []\n for (let current = directory; ; current = dirname(current)) {\n if (basename(current) !== 'node_modules') paths.push(join(current, 'node_modules'))\n if (dirname(current) === current) return paths\n }\n}\n\nfunction packageNameFromManifestSpecifier(specifier: string): string | undefined {\n const suffix = '/package.json'\n if (!specifier.endsWith(suffix)) return undefined\n const packageName = specifier.slice(0, -suffix.length)\n return packageNameFromSpecifier(packageName) === packageName ? packageName : undefined\n}\n\n/** Return whether a Loader request needs Node package resolution. */\nfunction isBareSpecifier(specifier: string): boolean {\n return !specifier.startsWith('.') && !specifier.startsWith('/') && !URL.canParse(specifier)\n}\n\nexport interface InstallProfilePackageResolverOptions {\n /** Diagnostic prefix on thrown errors - the calling surface's own bin name. */\n readonly binName: string\n /** File URL of the calling installation's own package.json. */\n readonly installPackageUrl: string\n /** File URL of the calling installation's own compiled entry module. */\n readonly installEntryUrl: string\n /** File URL resolved by `import.meta.resolve('@deepseek-ai/cordis-plugin-loader')`. */\n readonly loaderEntryUrl: string\n}\n\n/**\n * Resolve Cordis Loader bare imports from the selected persistent profile.\n * @param profileBaseUrl - file URL inside the profile that owns plugin dependencies.\n * @param options - the calling installation's own resolution anchors.\n * @returns an idempotent hook disposer.\n */\nexport function installProfilePackageResolver(\n profileBaseUrl: string,\n options: InstallProfilePackageResolverOptions,\n): () => void {\n // Before `_resolveFilename` is wrapped, so a runtime without module hooks leaves nothing behind.\n const registerHooks = requireModuleHooks()\n const { binName, installPackageUrl, installEntryUrl, loaderEntryUrl } = options\n const profileManifestPath = fileURLToPath(profileBaseUrl)\n // Directory-derived `createRequire` bases (e.g. `new URL('.', profileBaseUrl)`)\n // yield a synthetic `noop.js` module as the require parent; the manifest\n // anchor yields the manifest path itself. Both live inside the profile\n // directory, so treat any parent anchored there as profile-owned.\n const profileDirPath = fileURLToPath(new URL('.', profileBaseUrl))\n\n // ClientModuleRegistry intentionally uses createRequire(ctx.baseUrl) to\n // resolve each browser bundle from the config tree. Node's ESM resolve hook\n // does not observe that CommonJS manifest lookup, so without this narrow\n // bridge the Loader can activate the installation's own copy while the\n // browser receives an older Profile copy of the same package. Intercept\n // only package manifests requested from a parent anchored in this Profile\n // (the manifest itself or a synthetic module under the profile directory);\n // every other CJS resolution remains untouched.\n // Track the module graph rooted at every overlay-selected Loader package.\n const overlayModuleUrls = new Set<string>()\n const commonJsModule = Module as unknown as CommonJsModuleResolver\n const previousResolveFilename = commonJsModule._resolveFilename\n // The parent an installation-selected package resolves from: the installation's own manifest, with Node's node_modules lookup\n // list from its directory upwards (what `Module._nodeModulePaths` computes). Made on first use, so installing the resolver converts no path.\n let installParent: { filename: string, id: string, paths: string[] } | undefined\n const installParentModule = () => {\n if (installParent !== undefined) return installParent\n const installManifestPath = fileURLToPath(installPackageUrl)\n installParent = { filename: installManifestPath, id: installManifestPath, paths: nodeModulePaths(dirname(installManifestPath)) }\n return installParent\n }\n const overlayResolveFilename: CommonJsModuleResolver['_resolveFilename'] = function (\n this: CommonJsModuleResolver,\n request,\n parent,\n isMain,\n resolveOptions,\n ) {\n const profileAnchored = parent?.filename !== undefined\n && (parent.filename === profileManifestPath || parent.filename.startsWith(profileDirPath))\n const manifestPackage = profileAnchored ? packageNameFromManifestSpecifier(request) : undefined\n // A bare plugin import from the Profile anchor (dsh-app-boot's root Include resolves every Loader row this way) takes the\n // same overlay: a package the Profile does not hold, or holds at an older version, comes from the installation. Without\n // this, a fresh Profile (no node_modules since DSH 0.2 removed the link projections) resolved no plugin at all.\n const packageName = manifestPackage\n ?? (profileAnchored && isBareSpecifier(request) && !isBuiltin(request) ? packageNameFromSpecifier(request) : undefined)\n if (packageName !== undefined) {\n const overlay = findOverlayPackage(packageName, {\n binName,\n installPackageUrl,\n profilePackageUrl: profileBaseUrl,\n })\n if (overlay !== undefined) {\n if (manifestPackage !== undefined) return overlay.selected.manifestPath\n const target = previousResolveFilename.call(\n this, request, overlay.selected.source === 'install' ? installParentModule() : parent, isMain, resolveOptions)\n // The Loader imports this file next: its graph gets the Profile fallback for dependencies, as a Loader import through the ESM hook does.\n if (isAbsolute(target)) overlayModuleUrls.add(pathToFileURL(target).href)\n return target\n }\n }\n return previousResolveFilename.call(this, request, parent, isMain, resolveOptions)\n }\n commonJsModule._resolveFilename = overlayResolveFilename\n const hooks = registerHooks({\n resolve(specifier, context, nextResolve) {\n const fromLoader = context.parentURL === loaderEntryUrl\n const packageName = fromLoader ? packageNameFromSpecifier(specifier) : undefined\n if (packageName !== undefined) {\n const overlay = resolveOverlayPackage(packageName, {\n binName,\n installPackageUrl,\n profilePackageUrl: profileBaseUrl,\n })\n const resolved = nextResolve(specifier, {\n ...context,\n parentURL: overlay.selected.source === 'profile' ? profileBaseUrl : installEntryUrl,\n })\n overlayModuleUrls.add(resolved.url)\n return resolved\n }\n if (context.parentURL === undefined || !overlayModuleUrls.has(context.parentURL)) {\n return nextResolve(specifier, context)\n }\n if (!isBareSpecifier(specifier)) {\n const resolved = nextResolve(specifier, context)\n if (specifier.startsWith('.')) overlayModuleUrls.add(resolved.url)\n return resolved\n }\n try {\n const resolved = nextResolve(specifier, context)\n overlayModuleUrls.add(resolved.url)\n return resolved\n } catch (cause) {\n if ((cause as NodeJS.ErrnoException).code !== 'ERR_MODULE_NOT_FOUND') throw cause\n const resolved = nextResolve(specifier, { ...context, parentURL: profileBaseUrl })\n overlayModuleUrls.add(resolved.url)\n return resolved\n }\n },\n })\n let active = true\n return () => {\n if (!active) return\n active = false\n hooks.deregister()\n if (commonJsModule._resolveFilename === overlayResolveFilename) {\n commonJsModule._resolveFilename = previousResolveFilename\n }\n }\n}\n","/**\n * Read-only health of one profile's plugin layer (spec 034, FR-001).\n *\n * `acryl plugin doctor` prints this and the Web panel can render the same\n * report; the diagnosis itself is neither surface's code, because \"why is my\n * plugin missing\" has the same answers everywhere: the override file does not\n * parse, an override outlived the row it names, a bundle is installed but\n * composes nothing, or a bundle the profile lists cannot be resolved at all.\n *\n * Nothing here mutates: the caller passes the live snapshot it already has and\n * gets findings back.\n *\n * @module @acryldev/harness-runtime/plugin-doctor\n */\n\nimport type { PluginLifecycleSnapshot } from '@acryldev/control'\nimport {\n entryPatchId,\n readDisabledPluginLifecycleEntries,\n readUserMutableBundleNames,\n type PluginLifecycleStatePersistence,\n} from './plugin-lifecycle-state.ts'\n\nexport type PluginHealthSeverity = 'error' | 'warning'\n\nexport type PluginHealthCode =\n | 'state-unreadable'\n | 'stale-override'\n | 'unmanaged-override'\n | 'bundle-not-composed'\n | 'bundle-missing'\n\nexport interface PluginHealthFinding {\n /** `error` means the profile is broken; `warning` means it is surprising. */\n readonly severity: PluginHealthSeverity\n readonly code: PluginHealthCode\n readonly message: string\n /** The entry or package a finding is about, when it names one. */\n readonly entryId?: string\n}\n\nexport interface PluginHealthReport {\n readonly profileName: string\n readonly profileDir: string\n readonly statePath: string\n /** Composed Loader rows in the snapshot, mutable and protected alike. */\n readonly pluginCount: number\n readonly findings: readonly PluginHealthFinding[]\n}\n\nexport interface PluginHealthInput extends PluginLifecycleStatePersistence {\n readonly profileDir: string\n readonly snapshot: PluginLifecycleSnapshot\n /**\n * Resolves an installed package's manifest path, or throws when it is not\n * resolvable from this profile. Omitted when the caller has no resolution\n * base (the bundle is then only checked for a composed row).\n */\n readonly resolvePackageJson?: (packageName: string) => string\n}\n\nfunction describe(cause: unknown): string {\n return cause instanceof Error ? cause.message : String(cause)\n}\n\n/**\n * Diagnose one profile against its own snapshot and override file. Returns\n * findings in a stable order: state, then overrides, then bundles.\n */\nexport function diagnosePluginLifecycle(input: PluginHealthInput): PluginHealthReport {\n const findings: PluginHealthFinding[] = []\n let disabled: ReadonlySet<string> = new Set()\n try {\n disabled = readDisabledPluginLifecycleEntries(input)\n } catch (cause) {\n findings.push({\n severity: 'error',\n code: 'state-unreadable',\n message: `plugin override file ${input.statePath} could not be read: ${describe(cause)}`,\n })\n }\n\n const byEntryId = new Map(input.snapshot.entries.map(entry => [entry.entryId, entry]))\n const byPatchId = new Map(input.snapshot.entries.map(entry => [entryPatchId(entry.entryId), entry]))\n for (const overrideId of [...disabled].sort()) {\n const entry = byEntryId.get(overrideId) ?? byPatchId.get(entryPatchId(overrideId))\n if (entry === undefined) {\n findings.push({\n severity: 'warning',\n code: 'stale-override',\n entryId: overrideId,\n message: `${overrideId} is recorded as disabled, but this profile composes no such entry`,\n })\n continue\n }\n if (!entry.mutable) {\n findings.push({\n severity: 'warning',\n code: 'unmanaged-override',\n entryId: overrideId,\n message: `${overrideId} is disabled by the override file but is not a user-controlled plugin`,\n })\n }\n }\n\n const bundles = readUserMutableBundleNames(input.profileDir)\n const composesPackage = (packageName: string): boolean =>\n input.snapshot.entries.some(entry =>\n entry.moduleName === packageName || entry.moduleName.startsWith(`${packageName}/`))\n for (const bundle of [...bundles].sort()) {\n if (input.resolvePackageJson !== undefined) {\n try {\n input.resolvePackageJson(bundle)\n } catch (cause) {\n findings.push({\n severity: 'error',\n code: 'bundle-missing',\n entryId: bundle,\n message: `profile bundle ${bundle} is listed in dsh.profile.bundles but does not resolve from this profile: ${describe(cause)}`,\n })\n continue\n }\n }\n if (!composesPackage(bundle)) {\n findings.push({\n severity: 'warning',\n code: 'bundle-not-composed',\n entryId: bundle,\n message: `profile bundle ${bundle} is installed but composes no entry in this process; a restart applies a freshly installed bundle`,\n })\n }\n }\n\n return Object.freeze({\n profileName: input.profileName,\n profileDir: input.profileDir,\n statePath: input.statePath,\n pluginCount: input.snapshot.entries.length,\n findings: Object.freeze(findings),\n })\n}\n","/**\n * Capture and render the system prompt and tool list the model actually receives on the first turn of a new session. Development aid\n * behind `docs/system-prompt/current/*.md`: it drives one real session on a composed runtime with a dummy provider key, so the request\n * fails after the loop has already logged the assembled system message and the request header, which is all this reads. No model is\n * called successfully.\n */\nimport { mkdtempSync, realpathSync, rmSync } from 'node:fs'\nimport { tmpdir } from 'node:os'\nimport { join } from 'node:path'\nimport type { Context } from '@deepseek-ai/cordis'\nimport { SessionId } from '@deepseek-ai/dsh-session'\nimport { createAcrylSessionBridge } from './session-bridge.ts'\n\nexport interface CapturedSystemPrompt {\n /** The assembled system prompt text. */\n system: string\n /** The tool definitions sent after it. */\n tools: Array<{ name: string; description: string; /** The whole definition as sent (schema included). */ definition: Record<string, unknown> }>\n /** `provider/model` of the request. */\n model: string\n}\n\nexport interface CaptureSystemPromptOptions {\n /** Bridge profile name for the composed runtime (`web`, `desktop`, or the CLI profile). */\n profile: string\n /** Select the `standard` agent preset first, as the browser client does for a new session. */\n selectStandardPreset: boolean\n /** Paths to replace with a placeholder, longest first. */\n scrub?: Array<[string, string]>\n}\n\n/**\n * Run one session on `ctx` and return what the model would receive.\n * @param ctx - a composed runtime root (web, desktop or CLI engine).\n * @param options - profile name, preset selection and path scrubbing.\n */\nexport async function captureSystemPrompt(ctx: Context, options: CaptureSystemPromptOptions): Promise<CapturedSystemPrompt> {\n const workspace = realpathSync(mkdtempSync(join(tmpdir(), 'acryl-prompt-ws-')))\n const bridge = createAcrylSessionBridge(ctx, { profile: options.profile, generationId: 'prompt-capture', attachment: 'owner', cwd: workspace })\n const captured: CapturedSystemPrompt = { system: '', tools: [], model: '' }\n try {\n const sessionId = await bridge.open()\n await bridge.selectModel({ sessionId, provider: 'deepseek-official', model: 'deepseek-v4-flash' })\n if (options.selectStandardPreset) {\n const presets = ctx.get('agentPresets' as never) as unknown as { select(agent: unknown, id: string): Promise<string> }\n const agent = (ctx as unknown as { agents: { get(id: unknown): unknown } }).agents.get(SessionId(sessionId))\n await presets.select(agent, 'standard')\n }\n let ended: () => void = () => {}\n const done = new Promise<void>(resolve => { ended = resolve })\n await bridge.subscribeEvents(sessionId, event => {\n const { type, data } = event as { type: string; data?: Record<string, unknown> }\n if (type === 'system/message' && captured.system === '') {\n const content = (data?.message as { content?: Array<{ text?: string }> } | undefined)?.content ?? []\n captured.system = content.map(block => block.text ?? '').join('')\n }\n if (type === 'request/header' && captured.tools.length === 0) {\n const header = data?.header as { tools?: Array<{ name: string; description: string } & Record<string, unknown>>; config?: { provider?: string; model?: string } } | undefined\n captured.tools = (header?.tools ?? []).map(tool => ({ name: tool.name, description: tool.description, definition: tool }))\n captured.model = `${header?.config?.provider ?? ''}/${header?.config?.model ?? ''}`\n }\n if (type === 'turn/end') ended()\n })\n await bridge.submitPrompt({ sessionId, text: 'hello' })\n await Promise.race([done, new Promise(resolve => setTimeout(resolve, 60_000))])\n } finally {\n await bridge.dispose()\n rmSync(workspace, { recursive: true, force: true })\n }\n const replacements: Array<[string, string]> = [[workspace, '<workspace>'], ...(options.scrub ?? [])]\n const scrub = (text: string): string => replacements.reduce((acc, [from, to]) => (from === '' ? acc : acc.replaceAll(from, to)), text)\n return { system: scrub(captured.system), tools: captured.tools.map(tool => ({ name: tool.name, description: scrub(tool.description), definition: JSON.parse(scrub(JSON.stringify(tool.definition))) as Record<string, unknown> })), model: captured.model }\n}\n\n/** Markdown for one surface's captured prompt. */\nexport function renderSystemPromptDoc(surface: string, description: string, captured: CapturedSystemPrompt): string {\n const stamp = new Date().toISOString().slice(0, 10)\n return [\n `# Current system prompt: ${surface}`,\n '',\n `<!-- Generated on ${stamp} by the system-prompt capture (see ../README.md). Do not edit; regenerate. -->`,\n '',\n `What the model receives on the first turn of a new session on the ${surface} surface (${description}), after path scrubbing.`,\n 'Temporary paths are shown as `<workspace>`, `<dsh-home>` and `<acryl-repo>`. The tool list follows the system prompt.',\n '',\n '## System prompt',\n '',\n '```text',\n captured.system.trimEnd(),\n '```',\n '',\n `## Tools (${captured.tools.length})`,\n '',\n '| Tool | Description (first line) |',\n '| --- | --- |',\n ...captured.tools.map(tool => `| \\`${tool.name}\\` | ${tool.description.split('\\n')[0]?.replaceAll('|', '\\\\|').slice(0, 160) ?? ''} |`),\n '',\n ].join('\\n')\n}\n","/**\n * Pre-image backups for repairs: every file a repair may change is copied first, so a repair can be undone\n * and an interrupted one can be rolled back.\n *\n * A backup is complete only when its manifest exists, and the manifest is written last and atomically, so a\n * repair killed halfway through making the backup leaves nothing that looks valid.\n */\n\nimport { createHash, randomBytes } from 'node:crypto'\nimport { existsSync, mkdirSync, readdirSync, readFileSync, rmSync } from 'node:fs'\nimport { basename, dirname, isAbsolute, join, relative, resolve } from 'node:path'\nimport { writeFileAtomic } from '../engine-files.ts'\n\nconst BACKUPS_DIR = 'repair-backups'\nconst MANIFEST = 'manifest.json'\n\nexport interface BackupEntry {\n readonly path: string\n /** False when the file did not exist, so undoing the repair removes it. */\n readonly existed: boolean\n /** The pre-image's name inside the backup directory. */\n readonly stored?: string\n readonly sha256?: string\n}\n\nexport interface BackupManifest {\n readonly id: string\n readonly createdAt: string\n readonly profileName: string\n readonly recipes: readonly string[]\n readonly entries: readonly BackupEntry[]\n}\n\nconst sha = (data: Buffer): string => createHash('sha256').update(data).digest('hex')\n\n/** A file a backup may touch must lie inside the engine home. */\nfunction assertInside(dshHome: string, path: string): void {\n const rel = relative(resolve(dshHome), resolve(path))\n if (rel === '' || rel.startsWith('..') || isAbsolute(rel)) throw new Error(`refusing to back up or restore a file outside the ACRYL home: ${path}`)\n}\n\nexport const backupsDir = (dshHome: string): string => join(dshHome, BACKUPS_DIR)\n\n/** Copy each file's current content aside. @returns the manifest of the new backup. */\nexport async function createBackup(input: {\n readonly dshHome: string\n readonly profileName: string\n readonly recipes: readonly string[]\n readonly files: readonly string[]\n readonly now?: () => Date\n}): Promise<BackupManifest> {\n const now = (input.now ?? (() => new Date()))()\n const id = `${now.toISOString().replace(/[-:]/g, '').replace(/\\.\\d+Z$/, 'Z')}-${randomBytes(3).toString('hex')}`\n const dir = join(backupsDir(input.dshHome), id)\n mkdirSync(dir, { recursive: true, mode: 0o700 })\n const entries: BackupEntry[] = []\n let index = 0\n for (const file of input.files) {\n assertInside(input.dshHome, file)\n if (!existsSync(file)) { entries.push({ path: file, existed: false }); continue }\n const data = readFileSync(file)\n const stored = `${String(index)}-${basename(file)}`\n index += 1\n await writeFileAtomic(join(dir, stored), data.toString('utf8'), { mode: 0o600, dirMode: 0o700 })\n entries.push({ path: file, existed: true, stored, sha256: sha(data) })\n }\n const manifest: BackupManifest = { id, createdAt: now.toISOString(), profileName: input.profileName, recipes: [...input.recipes], entries }\n // Last, so a backup that was interrupted before this point is not mistaken for a complete one.\n await writeFileAtomic(join(dir, MANIFEST), `${JSON.stringify(manifest, null, 2)}\\n`, { mode: 0o600, dirMode: 0o700 })\n return manifest\n}\n\n/** Complete backups, newest first; incomplete or damaged ones are skipped. */\nexport function listBackups(dshHome: string): BackupManifest[] {\n let ids: string[]\n try {\n ids = readdirSync(backupsDir(dshHome))\n } catch {\n return []\n }\n const found: BackupManifest[] = []\n for (const id of ids) {\n try {\n const manifest = JSON.parse(readFileSync(join(backupsDir(dshHome), id, MANIFEST), 'utf8')) as BackupManifest\n if (manifest.id === id && Array.isArray(manifest.entries)) found.push(manifest)\n } catch {\n // No manifest, or an unreadable one: not a usable backup.\n }\n }\n return found.sort((a, b) => (a.createdAt < b.createdAt ? 1 : a.createdAt > b.createdAt ? -1 : b.id.localeCompare(a.id)))\n}\n\n/** The pre-image bytes of one stored file, verified against its recorded hash. */\nexport function readPreImage(dshHome: string, manifest: BackupManifest, entry: BackupEntry): Buffer {\n if (entry.stored === undefined) throw new Error('that backup entry has no stored content')\n const data = readFileSync(join(backupsDir(dshHome), manifest.id, entry.stored))\n if (entry.sha256 !== undefined && sha(data) !== entry.sha256) throw new Error(`the backup of ${entry.path} is damaged (checksum mismatch)`)\n return data\n}\n\n/** Put every file back as it was: restore what existed, remove what the repair created. */\nexport async function restoreBackup(dshHome: string, id: string): Promise<BackupManifest> {\n const manifest = listBackups(dshHome).find(candidate => candidate.id === id)\n if (manifest === undefined) throw new Error(`no complete backup named ${id}`)\n // Verify everything first, so a damaged backup changes nothing.\n const restores = manifest.entries.map((entry) => {\n assertInside(dshHome, entry.path)\n return { entry, data: entry.existed ? readPreImage(dshHome, manifest, entry) : undefined }\n })\n for (const { entry, data } of restores) {\n if (data !== undefined) {\n mkdirSync(dirname(entry.path), { recursive: true })\n await writeFileAtomic(entry.path, data.toString('utf8'), { mode: 0o600, dirMode: 0o700 })\n } else if (existsSync(entry.path)) {\n rmSync(entry.path, { force: true })\n }\n }\n return manifest\n}\n","/** What a static diagnosis of a profile can say, and what repairs exist for it. */\n\nexport type ProfileFindingCode =\n | 'profile-missing'\n | 'state-unreadable'\n | 'profile-manifest-unreadable'\n | 'bundle-missing'\n | 'pnpm-layout-mismatch'\n | 'plugin-activation-failed'\n | 'pnpm-store-mismatch'\n\n/**\n * The repairs that may ever run without a person choosing each step. The list is short on purpose: it grows\n * only by a reviewed change (spec 041, question 6).\n */\nexport const SAFE_RECIPES = ['restore-override-file', 'disable-failing-row'] as const\nexport type RecipeId = (typeof SAFE_RECIPES)[number]\n\nexport interface ProfileFinding {\n /** `error` means the profile is broken; `warning` means it is surprising or degraded. */\n readonly severity: 'error' | 'warning'\n readonly code: ProfileFindingCode\n readonly message: string\n /** The file the finding is about. */\n readonly file?: string\n /** The Loader row or package it is about. */\n readonly entryId?: string\n /** The safe recipe that addresses it, when there is one. */\n readonly recipe?: RecipeId\n /** What a person should do when no safe recipe applies. */\n readonly guidance?: string\n}\n\nexport interface ProfileDiagnosis {\n readonly profileName: string\n readonly profileDir: string\n readonly dshHome: string\n readonly findings: readonly ProfileFinding[]\n}\n\nexport function isSafeRecipe(value: string): value is RecipeId {\n return (SAFE_RECIPES as readonly string[]).includes(value)\n}\n","/**\n * Static diagnosis of a profile: files, manifests and logs only. It never starts the app, never imports a\n * plugin, and never writes anything, so it works when the app is too broken to launch (spec 041, Scope B).\n */\n\nimport { existsSync, readdirSync, readFileSync, statSync } from 'node:fs'\nimport { join } from 'node:path'\nimport { resolveProfileDir } from '@deepseek-ai/dsh-app-boot'\nimport { parse } from 'yaml'\nimport {\n readDisabledPluginLifecycleEntries,\n readUserMutableBundleNames,\n resolvePluginLifecycleStatePath,\n} from '../plugin-lifecycle-state.ts'\nimport type { ProfileDiagnosis, ProfileFinding } from './findings.ts'\n\n/** Loader rows that are infrastructure, not plugins: a failure inside one is not fixed by disabling it. */\nconst INFRASTRUCTURE_ROWS: ReadonlySet<string> = new Set(['acryl-engine', 'include', 'webserver'])\n/** How much of each recent log to read, and how many logs. */\nconst LOG_TAIL_BYTES = 256 * 1024\nconst RECENT_LOGS = 3\n\nexport interface InspectOptions {\n readonly dshHome: string\n readonly profileName: string\n}\n\nconst describe = (cause: unknown): string => (cause instanceof Error ? cause.message : String(cause))\n\nfunction recentLogFiles(dshHome: string): string[] {\n const dir = join(dshHome, 'logs')\n let names: string[]\n try {\n names = readdirSync(dir)\n } catch {\n return []\n }\n return names\n .filter(name => /\\.(?:log|jsonl)$/.test(name))\n .flatMap((name) => {\n try {\n const path = join(dir, name)\n const stats = statSync(path)\n return stats.isFile() ? [{ path, modifiedAt: stats.mtimeMs }] : []\n } catch {\n return []\n }\n })\n .sort((a, b) => b.modifiedAt - a.modifiedAt)\n .slice(0, RECENT_LOGS)\n .map(file => file.path)\n}\n\nfunction tailOf(path: string): string {\n try {\n const text = readFileSync(path, 'utf8')\n return text.length > LOG_TAIL_BYTES ? text.slice(text.length - LOG_TAIL_BYTES) : text\n } catch {\n return ''\n }\n}\n\nconst ACTIVATION_FAILURE = /failed to apply loader entry ([A-Za-z0-9@/._:-]+)/g\n\n/** The innermost failing Loader row of each log line: the outer rows only say \"my child failed\". */\nfunction activationFailures(text: string): Array<{ entryId: string; cause: string }> {\n const found = new Map<string, string>()\n for (const line of text.split('\\n')) {\n let last: RegExpExecArray | undefined\n ACTIVATION_FAILURE.lastIndex = 0\n for (let match = ACTIVATION_FAILURE.exec(line); match !== null; match = ACTIVATION_FAILURE.exec(line)) last = match\n if (last === undefined) continue\n const entryId = last[1] ?? ''\n const rest = line.slice(last.index + last[0].length).replace(/^[^:]*\\):\\s*/, '').trim()\n if (!found.has(entryId)) found.set(entryId, rest.slice(0, 200))\n }\n return [...found].map(([entryId, cause]) => ({ entryId, cause }))\n}\n\nfunction layoutFinding(profileDir: string): ProfileFinding | undefined {\n const modules = join(profileDir, 'node_modules', '.modules.yaml')\n const workspace = join(profileDir, 'pnpm-workspace.yaml')\n if (!existsSync(modules) || !existsSync(workspace)) return undefined\n try {\n const recorded = (parse(readFileSync(modules, 'utf8')) as { nodeLinker?: unknown } | null)?.nodeLinker\n const declared = (parse(readFileSync(workspace, 'utf8')) as { nodeLinker?: unknown } | null)?.nodeLinker ?? 'isolated'\n if (typeof recorded === 'string' && recorded !== declared) {\n return {\n severity: 'warning', code: 'pnpm-layout-mismatch', file: workspace,\n message: `the profile's dependencies were installed with nodeLinker \"${recorded}\" but pnpm-workspace.yaml says \"${String(declared)}\"; a reinstall would relink the whole tree`,\n guidance: 'Do not reinstall by hand. Run the profile through ACRYL, which pins the recorded layout before any package operation.',\n }\n }\n } catch {\n // An unreadable YAML file is reported by the boot itself; it is not a layout finding.\n }\n return undefined\n}\n\n/** Diagnose a profile from its files and recent logs. Never throws for a broken profile: that is the finding. */\nexport function inspectProfile(options: InspectOptions): ProfileDiagnosis {\n const profileDir = resolveProfileDir(options.profileName, options.dshHome)\n const findings: ProfileFinding[] = []\n if (!existsSync(profileDir)) {\n findings.push({ severity: 'error', code: 'profile-missing', file: profileDir, message: `profile ${JSON.stringify(options.profileName)} has no directory at ${profileDir}`, guidance: 'Check the profile name with `acryl plugin list --profile <name>`; ACRYL creates a profile on first use.' })\n return { profileName: options.profileName, profileDir, dshHome: options.dshHome, findings }\n }\n\n const statePath = resolvePluginLifecycleStatePath(options.dshHome)\n if (existsSync(statePath)) {\n try {\n readDisabledPluginLifecycleEntries({ profileName: options.profileName, statePath })\n } catch (cause) {\n findings.push({ severity: 'error', code: 'state-unreadable', file: statePath, recipe: 'restore-override-file', message: `the plugin override file ${statePath} cannot be read: ${describe(cause)}` })\n }\n }\n\n const manifest = join(profileDir, 'package.json')\n if (existsSync(manifest)) {\n try {\n JSON.parse(readFileSync(manifest, 'utf8'))\n } catch (cause) {\n findings.push({ severity: 'error', code: 'profile-manifest-unreadable', file: manifest, message: `the profile manifest ${manifest} is not valid JSON: ${describe(cause)}`, guidance: 'Restore it from a backup or from another profile\\'s copy; it lists the profile\\'s bundles.' })\n }\n for (const bundle of [...readUserMutableBundleNames(profileDir)].sort()) {\n if (!existsSync(join(profileDir, 'node_modules', ...bundle.split('/'), 'package.json'))) {\n findings.push({ severity: 'error', code: 'bundle-missing', entryId: bundle, file: manifest, message: `the profile lists ${bundle} but it is not installed in ${join(profileDir, 'node_modules')}`, guidance: `Reinstall it with \\`acryl plugin add ${bundle}\\`, or remove it from dsh.profile.bundles.` })\n }\n }\n }\n\n const layout = layoutFinding(profileDir)\n if (layout !== undefined) findings.push(layout)\n\n const seen = new Set<string>()\n let storeMismatch = false\n for (const log of recentLogFiles(options.dshHome)) {\n const text = tailOf(log)\n for (const failure of activationFailures(text)) {\n if (seen.has(failure.entryId)) continue\n seen.add(failure.entryId)\n const infrastructure = INFRASTRUCTURE_ROWS.has(failure.entryId)\n findings.push({\n severity: 'error', code: 'plugin-activation-failed', entryId: failure.entryId, file: log,\n message: `${failure.entryId} failed to activate${failure.cause === '' ? '' : `: ${failure.cause}`}`,\n ...(infrastructure ? { guidance: `${failure.entryId} is part of the engine, not a plugin; disabling it would not fix this. Fix the cause named above.` } : { recipe: 'disable-failing-row' as const }),\n })\n }\n if (/package manager did not complete successfully/i.test(text)) storeMismatch = true\n }\n if (storeMismatch) {\n findings.push({ severity: 'warning', code: 'pnpm-store-mismatch', message: 'the package manager did not complete a recent install; this is the known symptom of a pnpm store made by a different pnpm version', guidance: 'Use the pnpm ACRYL pins (through the Lifecycle tab or `acryl plugin`), not the one on PATH, and do not delete the profile to fix it.' })\n }\n\n return { profileName: options.profileName, profileDir, dshHome: options.dshHome, findings }\n}\n","/**\n * Repair recipes and the plan that runs them.\n *\n * A recipe is a named step with a precondition, a dry-run description that names the exact files it will\n * change, and an undo through the pre-image backup. Nothing is guessed: with no matching finding a recipe does\n * not exist in the plan. There are only two recipes and they can only grow by a reviewed change.\n */\n\nimport { rmSync, writeFileSync } from 'node:fs'\nimport { join } from 'node:path'\nimport { writeFileAtomic } from '../engine-files.ts'\nimport {\n entryPatchId,\n readDisabledPluginLifecycleEntries,\n resolvePluginLifecycleStatePath,\n setPluginLifecycleEntryEnabled,\n} from '../plugin-lifecycle-state.ts'\nimport { createBackup, listBackups, readPreImage, restoreBackup, type BackupManifest } from './backup.ts'\nimport { SAFE_RECIPES, type ProfileDiagnosis, type ProfileFinding, type RecipeId } from './findings.ts'\n\nexport interface RepairStep {\n readonly recipe: RecipeId\n /** What will change, in words, naming the file or row. */\n readonly description: string\n /** Every file the step may write; each is backed up first. */\n readonly files: readonly string[]\n /** The finding that made this step applicable. */\n readonly because: ProfileFinding\n}\n\nexport interface RepairPlan {\n readonly profileName: string\n readonly dshHome: string\n readonly steps: readonly RepairStep[]\n}\n\nexport interface RepairResult {\n readonly backupId: string\n readonly applied: readonly RecipeId[]\n}\n\nconst EMPTY_STATE = `${JSON.stringify({ version: 1, profiles: [] }, null, 2)}\\n`\n\n/** Whether a stored override file still parses under the current rules. */\nfunction isValidState(dshHome: string, profileName: string, text: string): boolean {\n const probe = join(dshHome, '.repair-probe-state.json')\n try {\n // The reader takes a path, so a parseable copy is judged through the same function the app uses.\n writeFileSync(probe, text)\n readDisabledPluginLifecycleEntries({ profileName, statePath: probe })\n return true\n } catch {\n return false\n } finally {\n rmSync(probe, { force: true })\n }\n}\n\n\n/** The newest backed-up copy of the override file that is valid, if any. */\nfunction lastValidOverride(dshHome: string, profileName: string, statePath: string): string | undefined {\n for (const manifest of listBackups(dshHome)) {\n for (const entry of manifest.entries) {\n if (entry.path !== statePath || !entry.existed) continue\n try {\n const text = readPreImage(dshHome, manifest, entry).toString('utf8')\n if (isValidState(dshHome, profileName, text)) return text\n } catch {\n // A damaged backup is skipped; an older one may be fine.\n }\n }\n }\n return undefined\n}\n\n/**\n * Build the plan for the chosen recipes.\n * @param recipes - the recipes to include; only ones with a matching finding are planned.\n */\nexport function planRepairs(diagnosis: ProfileDiagnosis, recipes: readonly RecipeId[] = SAFE_RECIPES): RepairPlan {\n const statePath = resolvePluginLifecycleStatePath(diagnosis.dshHome)\n const steps: RepairStep[] = []\n for (const finding of diagnosis.findings) {\n if (finding.recipe === undefined || !recipes.includes(finding.recipe)) continue\n if (finding.recipe === 'restore-override-file') {\n const previous = lastValidOverride(diagnosis.dshHome, diagnosis.profileName, statePath)\n steps.push({\n recipe: 'restore-override-file', because: finding, files: [statePath],\n description: previous === undefined\n ? `Replace the unreadable ${statePath} with an empty override file (no plugin is recorded as disabled). The damaged file is kept in the backup.`\n : `Replace the unreadable ${statePath} with the last valid copy from a backup. The damaged file is kept in the new backup.`,\n })\n } else if (finding.entryId !== undefined) {\n steps.push({\n recipe: 'disable-failing-row', because: finding, files: [statePath],\n description: `Record ${finding.entryId} as disabled for profile ${JSON.stringify(diagnosis.profileName)} in ${statePath}, so the app starts without it. Nothing is uninstalled.`,\n })\n }\n }\n // The override file must be readable before a row can be recorded in it.\n steps.sort((a, b) => Number(b.recipe === 'restore-override-file') - Number(a.recipe === 'restore-override-file'))\n return { profileName: diagnosis.profileName, dshHome: diagnosis.dshHome, steps }\n}\n\n/** Back up, then apply every step; on any failure the backup is put back and the error is thrown. */\nexport async function applyRepairPlan(plan: RepairPlan): Promise<RepairResult> {\n if (plan.steps.length === 0) throw new Error('there is nothing to repair')\n const statePath = resolvePluginLifecycleStatePath(plan.dshHome)\n const files = [...new Set(plan.steps.flatMap(step => step.files))]\n const backup: BackupManifest = await createBackup({ dshHome: plan.dshHome, profileName: plan.profileName, recipes: plan.steps.map(step => step.recipe), files })\n try {\n for (const step of plan.steps) {\n if (step.recipe === 'restore-override-file') {\n const previous = lastValidOverride(plan.dshHome, plan.profileName, statePath)\n await writeFileAtomic(statePath, previous ?? EMPTY_STATE, { mode: 0o600, dirMode: 0o700 })\n } else if (step.because.entryId !== undefined) {\n await setPluginLifecycleEntryEnabled({ profileName: plan.profileName, statePath }, entryPatchId(step.because.entryId), false)\n }\n }\n } catch (cause) {\n await restoreBackup(plan.dshHome, backup.id)\n throw new Error(`the repair failed and was rolled back: ${cause instanceof Error ? cause.message : String(cause)}`)\n }\n return { backupId: backup.id, applied: plan.steps.map(step => step.recipe) }\n}\n\n/** Undo a repair by putting its pre-images back. */\nexport async function undoRepair(dshHome: string, backupId: string): Promise<BackupManifest> {\n return restoreBackup(dshHome, backupId)\n}\n\n/** The plan as readable text, for a dry run or a confirmation. */\nexport function describePlan(plan: RepairPlan): string {\n if (plan.steps.length === 0) return 'Nothing to repair.'\n return plan.steps.map((step, index) => `${String(index + 1)}. [${step.recipe}] ${step.description}`).join('\\n')\n}\n\n","/**\n * `acryl new <dir>`: create an ACRYL Blends app, the way `rails new` creates a Rails app. Convention over configuration: every app has the same shape, so\n * the builder inside it (the agent) and every tool know where everything is without being told.\n *\n * <app>/blend.yaml what the app is: a Blends manifest (name, brand, the Blueprint it grew from) commit\n * <app>/plugins/ the app's own plugins; the agent inside builds them here; they load at every start commit (not plugins/.store/)\n * <app>/AGENTS.md the conventions, read by the agent inside at the start of every session commit\n * <app>/bin/acryl start it: bin/acryl web | desktop | cli\n * <app>/.dsh/ what the runtime keeps (sessions, settings, profile) ignored\n * <app>/desktop-data/ the desktop window's own data (window state, storage, logs, crash evidence) ignored\n *\n * The app folder is the app's ACRYL home, so an app is self-contained like a container: it can be copied, committed, run beside any other app and deleted\n * without touching anything else. It is the user's project from the first second: nothing in it is ACRYL-branded, it gets its own git repository, and its\n * license is the user's choice (closed source and commercial included; the framework and the harness it uses are MIT). Pure file planning plus one write boundary.\n *\n * @module @acryldev/harness-runtime/app/new-app\n */\n\nimport { spawnSync } from 'node:child_process'\nimport { chmodSync, cpSync, existsSync, mkdirSync, readdirSync, writeFileSync } from 'node:fs'\nimport { basename, dirname, join, resolve } from 'node:path'\nimport { manifestDigest } from '@acryldev/blends-core'\nimport { HOME_PLUGINS_FOLDER, STORE_FOLDER } from '@acryldev/plugin-hub-core'\nimport { isMap, isSeq, parseDocument, stringify } from 'yaml'\nimport { brandIdentity, type BrandIdentity } from '../blueprint/brand-identity.ts'\nimport { builtInCatalog, type Blueprint } from '../blueprint/blueprint.ts'\nimport { appManifest } from '../blueprint/manifest.ts'\n\nexport const APP_MANIFEST_FILE = 'blend.yaml'\nexport const APP_PLUGINS_DIR = HOME_PLUGINS_FOLDER\n\nconst APP_NAME = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u\n\nexport class NewAppError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'NewAppError'\n }\n}\n\nexport interface NewAppOptions {\n /** Display name; defaults to the folder name. */\n readonly title?: string\n /** Blueprint the app grows from; `acryl.blank` by default. */\n readonly blueprint?: string\n readonly brand?: Partial<Omit<BrandIdentity, 'name'>>\n /** Absolute path of the launcher `bin/acryl` hands off to (the framework's `scripts/blank.mjs`). */\n readonly launcher: string\n /**\n * Create the app from an existing app or captured Blend (its `blend.yaml`, and its `blend.lock.json` when it has one) instead of a Blueprint: the new\n * app keeps what the source grew (rows, brand, lineage) under its own name and id. Its `plugins/` are copied by `writeNewApp`.\n */\n readonly from?: { readonly manifestText: string, readonly lockText?: string }\n}\n\nexport interface PlannedApp {\n readonly root: string\n readonly name: string\n readonly blueprint: Blueprint\n readonly files: Readonly<Record<string, string>>\n}\n\n/** Pure: everything `acryl new` would write, by relative path. */\nexport function planNewApp(dir: string, options: NewAppOptions): PlannedApp {\n const root = resolve(dir)\n const name = basename(root)\n if (!APP_NAME.test(name) || name.length > 32) throw new NewAppError(`an app folder name is lowercase letters, digits and dashes (at most 32), got ${JSON.stringify(name)}`)\n const blueprintId = options.blueprint ?? 'acryl.blank'\n const blueprint = builtInCatalog().get(blueprintId)\n if (blueprint === undefined) throw new NewAppError(`unknown blueprint ${JSON.stringify(blueprintId)}; known: ${builtInCatalog().list().map(entry => entry.id).join(', ')}`)\n const title = options.title?.trim() || name\n const brand = brandIdentity({ ...(blueprint.brand.kind === 'custom' ? blueprint.brand.identity : {}), ...options.brand, name: title })\n const derived = options.from === undefined ? undefined : fromExistingApp(options.from, `app.${name}`, title, options.brand)\n const manifestText = derived?.manifestText\n ?? `# ${title}: what this app is (name, brand, what it grew from). Edit it and restart. Format: blends.acryl.dev/v1alpha1.\\n${stringify(appManifest({ id: `app.${name}`, name: title, blueprint, brand }), { lineWidth: 0 })}`\n const files: Record<string, string> = {\n [APP_MANIFEST_FILE]: manifestText,\n ...(derived?.lockText === undefined ? {} : { 'blend.lock.json': derived.lockText }),\n ...(derived?.starter === undefined ? {} : { [`blueprints/${derived.starter.id}.yaml`]: derived.starter.text }),\n ...(derived?.notice === undefined ? {} : { 'THIRD-PARTY.md': derived.notice }),\n [`${APP_PLUGINS_DIR}/README.md`]: `# plugins\\n\\nThis app's own plugins, one folder each. The agent inside the app builds them here when you ask for something\\n(\"add a to-do list\"), and every folder here loads when the app starts. Delete a folder to remove that plugin.\\n`,\n 'AGENTS.md': agentsMd(title),\n 'bin/acryl': `#!/usr/bin/env bash\\n# Start ${title}: bin/acryl web | desktop | cli (flags: --port 3105)\\nset -euo pipefail\\napp=\"$(cd \"$(dirname \"$0\")/..\" && pwd)\"\\nexec node ${JSON.stringify(options.launcher)} \"\\${1:-web}\" --dir \"$app\" \"\\${@:2}\"\\n`,\n // The plugin store (`plugins/.store/`) is runtime data like `.dsh/`: pulled plugins are reproduced from the Blend's lock; the app's own plugins beside it are committed.\n '.gitignore': `# what the runtime keeps for this app\\n.dsh/\\ninstance.json\\ndesktop-data/\\n${APP_PLUGINS_DIR}/${STORE_FOLDER}/\\n`,\n '.github/workflows/app.yml': appWorkflow(title),\n 'README.md': `# ${title}\n\n\\`\\`\\`bash\nbin/acryl web # or desktop, cli\n\\`\\`\\`\n\nTell the assistant inside what to build; it adds plugins to \\`plugins/\\` while the app runs. \\`blend.yaml\\` is the app's definition (name, brand,\nwhat it grew from). Runtime data stays in \\`.dsh/\\` and is not committed. The app has its own port and its own window, so it runs beside any other.\n\n## License\n\nThis project is yours: license it however you want, including closed source. It runs on the ACRYL Blends framework and DeepSeek Harness, both MIT\nlicensed; if you distribute a copy of the framework (for example a carried \\`runtime/\\`), keep their license notices with it.\n`,\n }\n return { root, name, blueprint, files }\n}\n\n/**\n * A new project from an existing starter or project (the three levels: the blank canvas, a Blueprint starter kit, a project). The source's rows, brand\n * colors and plugins are kept; the identity becomes the new project's, which is the user's own work: private and Proprietary until they say otherwise.\n *\n * from a starter (kind: Blueprint, spec.extends) -> a Blend whose lineage names the starter; the starter is kept in blueprints/<id>.yaml\n * from a project (kind: Blend, spec.lineage) -> a Blend with the same lineage; the source's blueprints/ travel with it\n *\n * Comments are kept, and the lock is re-pinned to the new definition with the format's digest (local module digests stay valid: plugins/ is copied as is).\n */\nfunction fromExistingApp(source: { readonly manifestText: string, readonly lockText?: string }, id: string, title: string, brand: Partial<Omit<BrandIdentity, 'name'>> | undefined): { manifestText: string, lockText?: string, starter?: { id: string, text: string }, notice?: string } {\n const document = parseDocument(source.manifestText)\n const parsed = document.toJS() as { kind?: unknown, metadata?: { id?: unknown, version?: unknown, license?: unknown, name?: unknown }, spec?: { lineage?: { blueprint?: unknown }, extends?: unknown } } | null\n const sourceId = typeof parsed?.metadata?.id === 'string' ? parsed.metadata.id : undefined\n const sourceVersion = typeof parsed?.metadata?.version === 'string' ? parsed.metadata.version : '0.1.0'\n let starter: { id: string, text: string } | undefined\n if (parsed?.kind === 'Blueprint' && sourceId !== undefined && builtInCatalog().get(sourceId) === undefined) {\n if (typeof parsed.spec?.extends !== 'string') throw new NewAppError(`the starter ${sourceId} names no parent (spec.extends)`)\n starter = { id: sourceId, text: source.manifestText }\n document.set('kind', 'Blend')\n document.deleteIn(['spec', 'extends'])\n document.setIn(['spec', 'lineage'], document.createNode({ blueprint: sourceId, blueprintVersion: sourceVersion }))\n } else if (parsed?.kind !== 'Blend' || typeof parsed.spec?.lineage?.blueprint !== 'string') {\n throw new NewAppError('--from needs a starter (kind: Blueprint with spec.extends) or a project (kind: Blend with spec.lineage)')\n }\n document.setIn(['metadata', 'id'], id)\n document.setIn(['metadata', 'name'], title)\n document.setIn(['metadata', 'description'], `${title}, created from ${sourceId ?? 'another app'}.`)\n document.setIn(['metadata', 'license'], 'Proprietary')\n document.setIn(['metadata', 'visibility'], 'private')\n const rows = document.getIn(['spec', 'rows'])\n if (isSeq(rows)) {\n for (const row of rows.items) {\n if (isMap(row) && row.get('name') === '@acryldev/brand') {\n row.setIn(['config', 'name'], title)\n for (const [key, value] of Object.entries(brand ?? {})) if (value !== undefined) row.setIn(['config', key], value)\n }\n }\n }\n // The source's comments are kept; the header names the app it describes, so it takes the new app's name. Before the lock digests the text.\n const manifestText = String(document).replace(/^# .*?: what this app is/u, `# ${title}: what this app is`)\n const sourceLicense = typeof parsed.metadata?.license === 'string' ? parsed.metadata.license : undefined\n // The source's code (its plugins) keeps its own license: its notice travels with the copy.\n const notice = sourceLicense === undefined || sourceLicense === 'Proprietary' ? undefined\n : `# Third-party code\\n\\nThis project was created from ${sourceId ?? 'another app'}${typeof parsed.metadata?.name === 'string' ? ` (${parsed.metadata.name})` : ''}, licensed ${sourceLicense}. Code copied from it into\\nplugins/ remains under that license; keep this notice, and the source's license text where it requires one, with any copy you distribute.\\n`\n const extra = { ...(starter === undefined ? {} : { starter }), ...(notice === undefined ? {} : { notice }) }\n if (source.lockText === undefined) return { manifestText, ...extra }\n const lock = JSON.parse(source.lockText) as { origin?: Record<string, unknown> }\n lock.origin = { ...lock.origin, id, kind: 'Blend', digest: manifestDigest(manifestText) }\n return { manifestText, lockText: `${JSON.stringify(lock, null, 2)}\\n`, ...extra }\n}\n\n/**\n * CI from the first commit (spec 036, T019): on every push and pull request the app definition must validate the way the engine and the registry validate it,\n * and no tracked file may hold a secret (the same check \\`acryl save\\` runs, so a key committed outside ACRYL is caught too). Pinned to the published tools.\n */\nfunction appWorkflow(title: string): string {\n return `name: ${JSON.stringify(title)}\n\non:\n push:\n pull_request:\n\npermissions:\n contents: read\n\njobs:\n check:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: actions/setup-node@v4\n with:\n node-version: 24\n - name: The app definition is valid\n run: npx --yes --package @acryldev/blends-core@0.1 blends-validate blend.yaml\n - name: No secrets in the repository\n run: npx --yes --package @acryldev/app-persistence@0.1 acryl-secret-check .\n`\n}\n\nfunction agentsMd(title: string): string {\n return `# ${title}: conventions for the builder inside\n\nYou are the builder inside ${title}. The user asks for what they want; you build it here, as plugins, while the app runs. The project and its git repository\nbelong to the user: commit with clear messages when a change works and the user agrees, never push unless asked.\n\n- **Where things go.** Every capability you add is one plugin in \\`plugins/<name>/\\` of this app (the app's own folder, which is its ACRYL home). Install it with\n \\`acryl_install_plugin\\` using its absolute path; it goes live without a restart and loads at every start. Never put the app's plugins anywhere else.\n- **What the app is.** \\`blend.yaml\\` is the app's definition (name, brand, the Blueprint it grew from). Change the brand there when the user asks to rename or restyle the app.\n- **Data.** A plugin keeps its data in the app folder (\\`data/<plugin>.json\\`) or in the project the user opens, never inside its own code folder.\n- **Capture.** \\`/blend snapshot\\` records what the app has become so it can be re-created; publishing is the user's decision.\n- **How.** Your ACRYL plugin docs (in your system prompt) have a routed doc and a verified example for every kind of plugin; read the nearest one before writing.\n`\n}\n\n/** Write the app. The folder must not exist or must be empty: `new` never overwrites. `runtimeDir` hands the app its own Web runtime (see below). */\n/** A file of the launcher an app carries: copied from the framework, or written with the given content. */\nexport type LauncherFile = { readonly from: string } | { readonly content: string }\n\nexport function writeNewApp(planned: PlannedApp, options: { readonly runtimeDir?: string, readonly launcherFiles?: Readonly<Record<string, LauncherFile>>, readonly git?: boolean, readonly pluginsFrom?: string, readonly blueprintsFrom?: string } = {}): { readonly git: 'initialized' | 'skipped' | 'unavailable' } {\n if (existsSync(planned.root) && readdirSync(planned.root).length > 0) throw new NewAppError(`${planned.root} is not empty; acryl new only creates a new app`)\n if (options.runtimeDir !== undefined && !existsSync(join(options.runtimeDir, 'lib', 'bin.js'))) throw new NewAppError(`${options.runtimeDir} is not an ACRYL Web runtime (no lib/bin.js)`)\n for (const [relative, content] of Object.entries(planned.files)) {\n const target = join(planned.root, relative)\n mkdirSync(dirname(target), { recursive: true })\n writeFileSync(target, content)\n }\n chmodSync(join(planned.root, 'bin', 'acryl'), 0o755)\n // An app created from another brings that app's own plugins, verbatim so the lock's digests still hold (never its node_modules or git history).\n // The starters the source itself grew from travel with it, so the whole chain back to a built-in Blueprint resolves in the new app.\n if (options.blueprintsFrom !== undefined && existsSync(options.blueprintsFrom)) {\n cpSync(options.blueprintsFrom, join(planned.root, 'blueprints'), { recursive: true, force: false, errorOnExist: false })\n }\n if (options.pluginsFrom !== undefined && existsSync(options.pluginsFrom)) {\n // The source app's own plugins, not its store: pulled plugins are runtime data, reproduced from the lock.\n cpSync(options.pluginsFrom, join(planned.root, APP_PLUGINS_DIR), { recursive: true, filter: source => !['node_modules', '.git', STORE_FOLDER].includes(basename(source)) })\n }\n if (options.runtimeDir !== undefined) {\n // The app carries its own runtime: it then starts with nothing of the framework but Node. Symlinks stay relative to the copy.\n cpSync(options.runtimeDir, join(planned.root, 'runtime'), { recursive: true, verbatimSymlinks: true })\n for (const [relative, file] of Object.entries(options.launcherFiles ?? {})) {\n const target = join(planned.root, '.app', relative)\n mkdirSync(dirname(target), { recursive: true })\n if ('from' in file) cpSync(file.from, target)\n else writeFileSync(target, file.content)\n }\n writeFileSync(join(planned.root, 'bin', 'acryl'), `#!/usr/bin/env bash\\n# Start this app: bin/acryl web\\nset -euo pipefail\\napp=\"$(cd \"$(dirname \"$0\")/..\" && pwd)\"\\nexec node \"$app/.app/launch.mjs\" \"\\${1:-web}\" --dir \"$app\" \"\\${@:2}\"\\n`)\n chmodSync(join(planned.root, 'bin', 'acryl'), 0o755)\n }\n // Like `rails new`: the app starts as its own repository (no commit is made for the user). The carried runtime is large and rebuildable, so it is not tracked.\n if (options.git === false) return { git: 'skipped' }\n if (options.runtimeDir !== undefined) writeFileSync(join(planned.root, '.gitignore'), `${planned.files['.gitignore'] ?? ''}runtime/\\n`)\n const init = spawnSync('git', ['init', '--quiet', planned.root], { stdio: 'ignore' })\n return { git: init.status === 0 ? 'initialized' : 'unavailable' }\n}\n","/**\n * Where a new app starts from (`acryl new --from`, spec 036 `persistence-and-registries.md`): an app or captured Blend folder, a git repository (public or\n * private, reached with the user's own git credentials), or a starter id in a registry (a git repository or folder with `index.json`). Everything is\n * resolved to a local folder that has `blend.yaml`, which `planNewApp` / `writeNewApp` take from there.\n *\n * Git is a port (`GitClone`): the rules here are pure; `gitClone` below is the adapter that shells out to the user's git, never prompting for credentials.\n *\n * @module @acryldev/harness-runtime/app/start-source\n */\n\nimport { spawnSync } from 'node:child_process'\nimport { existsSync, mkdtempSync, readFileSync, rmSync, statSync } from 'node:fs'\nimport { tmpdir } from 'node:os'\nimport { join, resolve } from 'node:path'\nimport { parseRegistryIndex } from '@acryldev/blends-core'\n\n/** The public registry: a folder of the acrylblends.github.io repository. `#<folder>` names the folder inside a repository. */\nexport const PUBLIC_REGISTRY = 'https://github.com/acrylblends/acrylblends.github.io.git#registry'\n\nexport type StartSource =\n | { readonly kind: 'folder', readonly path: string }\n | { readonly kind: 'git', readonly url: string, readonly subdir?: string }\n | { readonly kind: 'registry', readonly id: string }\n\nexport class StartSourceError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'StartSourceError'\n }\n}\n\n/** Clone `url` (shallow) into `into`. Throws with git's own message on failure. */\nexport type GitClone = (url: string, into: string) => void\n\nconst GIT_URL = /^(?:https?:\\/\\/|ssh:\\/\\/|git@|file:\\/\\/)|\\.git(?:#.*)?$/u\nconst STARTER_ID = /^[a-z][a-z0-9-]*(?:\\.[a-z0-9][a-z0-9-]*)+$/u\n\nfunction splitSubdir(reference: string): { url: string, subdir?: string } {\n const hash = reference.lastIndexOf('#')\n if (hash <= 0) return { url: reference }\n const subdir = reference.slice(hash + 1)\n if (subdir === '' || subdir.split('/').some(part => part === '..' || part === '')) throw new StartSourceError(`\"${subdir}\" is not a folder inside the repository`)\n return { url: reference.slice(0, hash), subdir }\n}\n\n/** Pure: what `--from` names. A path that exists is a folder; a git URL is a repository; a dotted id is a registry starter. */\nexport function classifyStartSource(from: string, isDirectory: (path: string) => boolean): StartSource {\n if (isDirectory(from)) return { kind: 'folder', path: resolve(from) }\n if (GIT_URL.test(from)) return { kind: 'git', ...splitSubdir(from) }\n if (STARTER_ID.test(from)) return { kind: 'registry', id: from }\n throw new StartSourceError(`--from \"${from}\" is not a folder, a git URL or a starter id (such as acme.accounting)`)\n}\n\n/** The adapter: the user's git, shallow, and never waiting on a credentials prompt (a private repository needs the user's own git login). */\nexport const gitClone: GitClone = (url, into) => {\n const result = spawnSync('git', ['clone', '--depth', '1', '--quiet', url, into], { env: { ...process.env, GIT_TERMINAL_PROMPT: '0' }, encoding: 'utf8' })\n if (result.error !== undefined) throw new StartSourceError(`git is not available: ${result.error.message}`)\n if (result.status !== 0) throw new StartSourceError(`git could not clone ${url}: ${(result.stderr || '').trim().split('\\n').at(-1) ?? 'failed'}. A private repository needs your own git login (for GitHub: gh auth login).`)\n}\n\nconst isDirectory = (path: string): boolean => existsSync(path) && statSync(path).isDirectory()\n\nexport interface ResolvedStartSource {\n /** A local folder with `blend.yaml`. */\n readonly folder: string\n /** Where it came from, for the new app's description and the user's report. */\n readonly origin: string\n /** Remove the temporary clone, if any. */\n dispose(): void\n}\n\n/**\n * Resolve `--from` to a local folder. `registry` is a folder or git URL (`#<folder>` allowed) holding `index.json`; the public registry by default.\n * The caller disposes the result when the new app is written.\n */\nexport function resolveStartSource(from: string, options: { readonly registry?: string, readonly clone?: GitClone } = {}): ResolvedStartSource {\n const clone = options.clone ?? gitClone\n const temporary: string[] = []\n const dispose = (): void => { for (const dir of temporary.splice(0)) rmSync(dir, { recursive: true, force: true }) }\n const fetch = (reference: string): string => {\n const { url, subdir } = splitSubdir(reference)\n if (isDirectory(url)) return subdir === undefined ? resolve(url) : join(resolve(url), subdir)\n const into = mkdtempSync(join(tmpdir(), 'acryl-source-'))\n temporary.push(into)\n clone(url, join(into, 'repo'))\n return subdir === undefined ? join(into, 'repo') : join(into, 'repo', subdir)\n }\n try {\n const source = classifyStartSource(from, isDirectory)\n let folder: string\n let origin: string\n if (source.kind === 'folder') { folder = source.path; origin = source.path }\n else if (source.kind === 'git') { folder = fetch(source.subdir === undefined ? source.url : `${source.url}#${source.subdir}`); origin = source.url }\n else {\n const registry = options.registry ?? PUBLIC_REGISTRY\n const root = fetch(registry)\n const indexFile = join(root, 'index.json')\n if (!existsSync(indexFile)) throw new StartSourceError(`${registry} has no index.json; it is not a registry`)\n const entry = parseRegistryIndex(readFileSync(indexFile, 'utf8')).entries.find(candidate => candidate.id === source.id)\n if (entry === undefined) throw new StartSourceError(`${registry} has no starter \"${source.id}\"`)\n folder = join(root, entry.path)\n origin = `${source.id} (${registry})`\n }\n if (!existsSync(join(folder, 'blend.yaml'))) throw new StartSourceError(`${origin} has no blend.yaml; it is not an app or a starter`)\n return { folder, origin, dispose }\n } catch (error) {\n dispose()\n throw error\n }\n}\n","export {\n ACRYL_CODING_CAPABILITIES,\n type AcrylCodingCapabilityDeclaration,\n type AcrylCodingCapabilityId,\n type AcrylShellMode,\n type AcrylSurface,\n} from './coding-capabilities.ts'\nexport type { CodingCapabilities } from './engine-dsh.ts'\nexport type {\n DurableSessionMessage,\n DurableSessionMessagePort,\n DurableSessionMessageReceipt,\n} from './durable-message.ts'\nexport {\n createAcrylSessionBridge,\n type AcrylSessionBridge,\n type AcrylSessionBridgeOptions,\n} from './session-bridge.ts'\nexport {\n installSessionLogExporter,\n type InstallSessionLogExporterOptions,\n} from './session-log-exporter.ts'\nexport {\n ACRYL_DEV_HOME_DIR_NAME,\n ACRYL_DSH_ENGINE_DIR_NAME,\n ACRYL_HOME_DIR_NAME,\n applyIsolatedDevHomeDefault,\n resolveAcrylDevDshHome,\n resolveAcrylDshHome,\n resolveAcrylHome,\n} from './acryl-home.ts'\nexport {\n createAcrylEngineHost,\n type AcrylEngineDefinition,\n type AcrylEngineHost,\n} from './engine-host.ts'\nexport {\n createDshEngineDefinition,\n createDshEngineDefinitionFromComposition,\n createProfileContext,\n createProfileRuntimeResolution,\n createWebEngineDefinition,\n pluginRequiredFrameworkPackages,\n profileRequiredFrameworkModules,\n materializeProfilePackage,\n UPSTREAM_PRODUCT_ANALYTICS_OFF,\n type AcrylFrameworkPackages,\n type DshEngineComposition,\n} from './engine-dsh.ts'\nexport {\n PackageOverlayNotFoundError,\n findOverlayPackage,\n packageNameFromSpecifier,\n resolveOverlayPackage,\n type PackageOverlayCandidate,\n type PackageOverlayOptions,\n type PackageOverlaySelection,\n type PackageOverlaySource,\n} from './package-overlay.ts'\nexport {\n installProfilePackageResolver,\n type InstallProfilePackageResolverOptions,\n} from './module-resolution.ts'\nexport {\n provideWebMarketInstall,\n WebPnpmService,\n WebProfilesService,\n type WebMarketPnpm,\n type WebMarketPnpmHandle,\n type WebMarketPnpmOutcome,\n type WebMarketProfile,\n} from './web-market-install.ts'\nexport {\n provideWebMarketPlugins,\n WebLiveActivationService,\n WebPluginsService,\n type WebMarketPluginBundle,\n} from './web-market-plugins.ts'\nexport {\n provideCliMarketInstall,\n CliPnpmService,\n CliProfilesService,\n type CliMarketPnpm,\n type CliMarketPnpmHandle,\n type CliMarketPnpmOutcome,\n type CliMarketProfile,\n} from './cli-market-install.ts'\nexport {\n provideCliMarketPlugins,\n CliLiveActivationService,\n CliPluginsService,\n type CliMarketPluginBundle,\n} from './cli-market-plugins.ts'\nexport {\n createAcrylPluginLifecycle,\n createDshPluginLifecycleHost,\n mountAcrylPluginLifecycle,\n type DshPluginLifecycleOptions,\n} from './plugin-lifecycle.ts'\nexport {\n BASE_TEMPLATE_BUNDLE_NAMES,\n assertProfileName,\n entryPatchId,\n isPluginLifecycleEntryId,\n pluginLifecyclePatches,\n readDisabledPluginLifecycleEntries,\n readUserMutableBundleNames,\n resolvePluginLifecycleStatePath,\n setPluginLifecycleEntryEnabled,\n type PluginLifecycleStatePersistence,\n type ProfileNameValidator,\n} from './plugin-lifecycle-state.ts'\nexport {\n diagnosePluginLifecycle,\n type PluginHealthCode,\n type PluginHealthFinding,\n type PluginHealthInput,\n type PluginHealthReport,\n type PluginHealthSeverity,\n} from './plugin-doctor.ts'\n// The lifecycle vocabulary itself belongs to `@acryldev/control`, the domain\n// package. Surfaces depend on this runtime, not on the domain package, so the\n// shared contract is re-exported here rather than duplicated per surface; one\n// `PluginLifecycleError` class has to be the one every surface throws and\n// catches, or its `code` stops crossing a route boundary.\nexport {\n AcrPluginLifecycleService,\n PROTECTED_PLUGIN_ENTRY_REASON,\n PluginLifecycleError,\n type AcrPluginLifecycle,\n type AcrPluginLifecycleController,\n type PluginLifecycleAction,\n type PluginLifecycleEntryRef,\n type PluginLifecycleEntryView,\n type PluginLifecycleErrorCode,\n type PluginLifecycleFiberPhase,\n type PluginLifecycleHost,\n type PluginLifecycleMountedStatus,\n type PluginLifecycleReceipt,\n type PluginLifecycleSnapshot,\n} from '@acryldev/control'\n\nimport { writeFileSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport { join } from 'node:path'\nimport type { Context } from '@deepseek-ai/cordis'\nimport { provideCmdline } from '@deepseek-ai/dsh-cmdline'\nimport {\n DEFAULT_PROFILE_BUNDLES,\n PROFILE_TEMPLATES,\n boot,\n composeEntries,\n initProfile,\n loadProfile,\n removeLinkProjections,\n resolveProfileDir,\n type RuntimeResolution,\n} from '@deepseek-ai/dsh-app-boot'\n\nimport { createProfileRuntimeResolution } from './engine-dsh.ts'\nimport { selectInstance, type AppInstance } from './instance/index.ts'\nimport { materializeProfilePackage, type CodingCapabilities } from './engine-dsh.ts'\nimport { installAcrylWorkspaceStatusTool } from './plugin-acryl-workspace-status.ts'\nimport { ProfilePluginPackages } from './profile-resolution/service.ts'\nimport { installSessionLogExporter } from './session-log-exporter.ts'\n\nconst require = createRequire(import.meta.url)\nconst dshInstallAnchor = require.resolve('@deepseek-ai/dsh/package.json')\nconst profileRoot = '[]\\n'\n\nexport interface BootAcrylHarnessProfileOptions {\n readonly profile: string\n /** The surface's capability composition (`@acryldev/coding-capabilities`); without it only the profile's own rows compose. */\n readonly capabilities?: CodingCapabilities\n readonly prepare?: (ctx: Context) => Promise<void> | void\n}\n\n/**\n * Provide the chosen app instance and the profile's package table (DSH 0.2 answers every bare-package import from it, as stock\n * `dsh` mounts it in its own boot step) before any profile entry mounts, then run the caller's own host setup.\n */\nfunction withAppInstance(\n instance: AppInstance,\n resolution: RuntimeResolution,\n prepare?: (ctx: Context) => Promise<void> | void,\n): (ctx: Context) => Promise<void> {\n return async ctx => {\n ctx.provide('appInstance', instance)\n await ctx.plugin(ProfilePluginPackages, { resolution })\n await prepare?.(ctx)\n }\n}\n\nexport interface AcrylHarnessRuntime {\n readonly ctx: Context\n readonly profileDirectory: string\n dispose(): Promise<void>\n}\n\n/** Boot one normal pinned-Harness ACRYL profile in a single Cordis root. */\nexport async function bootAcrylHarnessProfile(\n options: BootAcrylHarnessProfileOptions,\n): Promise<AcrylHarnessRuntime> {\n if (options.profile.trim() === '') throw new Error('ACRYL Harness profile must not be empty')\n // This boot is its own composition root: it chooses the app instance once and provides it to plugins (runtime instance/).\n const instance = selectInstance()\n process.env.DSH_HOME = instance.dshHome\n const profileDirectory = resolveProfileDir(options.profile)\n initProfile(profileDirectory, DEFAULT_PROFILE_BUNDLES)\n removeLinkProjections(profileDirectory)\n const profile = loadProfile('acryl', options.profile, dshInstallAnchor)\n const rootConfig = join(profile.dir, 'cordis.yml')\n writeFileSync(rootConfig, profileRoot)\n // The terminal capabilities' ACRYL packages, resolvable from this profile as the CLI and Web boots make them; without it their rows\n // fail to import (`@acryldev/settings`, the account sign-in callback).\n const tuiSurfaces = new Set(['tui'] as const)\n for (const packageName of options.capabilities?.packages(tuiSurfaces, new Set()) ?? [])\n materializeProfilePackage(profile.dir, packageName, options.capabilities?.anchors[0] ?? import.meta.url)\n const patches = structuredClone([\n ...profile.layers.flatMap(layer => layer.patches),\n ...(options.capabilities?.patches(tuiSurfaces, new Set(), new Set()) ?? []),\n ...profile.patches,\n ])\n const hmr = composeEntries([patches]).find(entry => entry.id === 'hmr')\n if (hmr?.disabled !== true && !process.execArgv.includes('--expose-internals')) {\n throw new Error(\n 'ACRYL profile enables Cordis HMR and must be launched with Node --expose-internals',\n )\n }\n const ctx = await boot('acryl', rootConfig, patches, withAppInstance(instance, await createProfileRuntimeResolution(profile), options.prepare))\n if ((ctx as { tools?: unknown }).tools) installAcrylWorkspaceStatusTool(ctx)\n installSessionLogExporter(ctx, { surface: 'tui', dshHome: instance.dshHome })\n let disposed = false\n return Object.freeze({\n ctx,\n profileDirectory: profile.dir,\n async dispose() {\n if (disposed) return\n disposed = true\n await ctx.fiber.dispose()\n },\n })\n}\n\nexport interface BootAcrylWebProfileOptions {\n /** Inner arguments handed to the web-startup provider (e.g. `['--port', '4000']`). Defaults to no flags. */\n readonly cmdlineArgs?: readonly string[]\n /** The surface's capability composition (`@acryldev/coding-capabilities`); without it only the profile's own rows compose. */\n readonly capabilities?: CodingCapabilities\n /** Host setup run after Loader installation and before any config-tree entry mounts. */\n readonly prepare?: (ctx: Context) => Promise<void> | void\n}\n\nexport interface AcrylWebRuntime {\n readonly ctx: Context\n /** The canonical bind URL, e.g. `http://127.0.0.1:3080`. */\n readonly url: string\n readonly profileDirectory: string\n dispose(): Promise<void>\n}\n\n/**\n * Boot the DSH browser surface (the `web` profile: `dsh-base` + `dsh-web-app`)\n * as one normal ACRYL runtime, so `pnpm acryl-web` serves the same DSH\n * HTTP/WebSocket seam the web surface always uses. The shipped Web profile\n * already owns its system prompt, agent-preset roster, and session stats, so\n * the shared factory contributes only the missing authorization seam here.\n */\nexport async function bootAcrylWebProfile(\n options: BootAcrylWebProfileOptions = {},\n): Promise<AcrylWebRuntime> {\n const profileName = 'web'\n // This boot is its own composition root: it chooses the app instance once and provides it to plugins (runtime instance/).\n const instance = selectInstance()\n process.env.DSH_HOME = instance.dshHome\n const profileDirectory = resolveProfileDir(profileName)\n // See engine-dsh.ts's resolveWebEngineComposition for the full rationale:\n // DEFAULT_PROFILE_BUNDLES (dsh-base only) pre-empts loadProfile()'s own\n // correct PROFILE_TEMPLATES.web-based auto-init (dsh-base + dsh-web-app),\n // leaving a fresh 'web' profile with no dsh-client-connection/webStartup -\n // ctx.get('connection') and ctx.get('webStartup') are never defined, and\n // the served index falls back to its own \"authentication required\" message.\n const webTemplate = PROFILE_TEMPLATES.web\n initProfile(profileDirectory, webTemplate?.bundles ?? DEFAULT_PROFILE_BUNDLES)\n removeLinkProjections(profileDirectory)\n const profile = loadProfile('web', profileName, dshInstallAnchor)\n const rootConfig = join(profile.dir, 'cordis.yml')\n writeFileSync(rootConfig, profileRoot)\n // Same composition as the engine-host Web path: the shared workspace and shell declarations, with the ACRYL\n // packages they name made resolvable from this profile.\n const webSurfaces = new Set(['web'] as const)\n for (const packageName of options.capabilities?.packages(webSurfaces, new Set()) ?? []) {\n materializeProfilePackage(profile.dir, packageName, options.capabilities?.anchors[0] ?? import.meta.url)\n }\n const patches = structuredClone([\n ...profile.layers.flatMap(layer => layer.patches),\n ...(options.capabilities?.patches(webSurfaces, new Set(), new Set()) ?? []),\n ...(options.capabilities?.shellPatches(webSurfaces, 'advanced', new Set(), new Set()) ?? []),\n ...profile.patches,\n ])\n const cmdlineArgs = options.cmdlineArgs ?? []\n const ctx = await boot('web', rootConfig, patches, withAppInstance(instance, await createProfileRuntimeResolution(profile), hostCtx => {\n provideCmdline(hostCtx, { args: [...cmdlineArgs], exit: code => { process.exitCode = code } })\n return options.prepare?.(hostCtx)\n }))\n if ((ctx as { tools?: unknown }).tools) installAcrylWorkspaceStatusTool(ctx)\n installSessionLogExporter(ctx, { surface: 'web', dshHome: instance.dshHome })\n const startup = ctx.get('webStartup') as { host?: string; port?: number } | undefined\n const host = startup?.host ?? '127.0.0.1'\n const port = startup?.port ?? instance.webPort.start\n const url = `http://${host}:${port}`\n let disposed = false\n return Object.freeze({\n ctx,\n url,\n profileDirectory: profile.dir,\n async dispose() {\n if (disposed) return\n disposed = true\n await ctx.fiber.dispose()\n },\n })\n}\nexport {\n captureSystemPrompt,\n renderSystemPromptDoc,\n type CaptureSystemPromptOptions,\n type CapturedSystemPrompt,\n} from './system-prompt-capture.ts'\nexport { pinnedPnpmEnv, resolvePinnedPnpm, type PinnedPnpm } from './pinned-pnpm.ts'\nexport { reconcileProfileLayout, type LayoutChange } from './profile-layout.ts'\nexport {\n AGENTS_BLUEPRINT,\n BLANK_BLUEPRINT,\n DSH_CHAT_ROW_IDS,\n DSH_PLUGIN_MANAGER_ROW_ID,\n PLUGIN_MANAGER_ROW_ID,\n IDE_BLUEPRINT,\n BLUEPRINT_ROW_IDS,\n InvalidBlueprintError,\n InvalidBrandIdentityError,\n UnknownBlueprintError,\n appManifest,\n blueprintFromManifest,\n catalogWithStarters,\n isBlendsManifest,\n parseBlueprint,\n readBlueprintFile,\n readStarters,\n blueprintFromEnvironment,\n brandIdentity,\n builtInCatalog,\n composeBlueprintRows,\n currentModule,\n identityLine,\n packageOfModule,\n selectBlueprint,\n withBrand,\n type Blueprint,\n type BlueprintBrand,\n type BlueprintCatalog,\n type BlueprintComposition,\n type BlueprintRowId,\n type BrandIdentity,\n} from './blueprint/index.ts'\nexport {\n SAFE_RECIPES,\n applyRepairPlan,\n backupsDir,\n createBackup,\n describePlan,\n inspectProfile,\n isSafeRecipe,\n listBackups,\n planRepairs,\n restoreBackup,\n undoRepair,\n} from './profile-repair/index.ts'\nexport type {\n BackupEntry,\n BackupManifest,\n InspectOptions,\n ProfileDiagnosis,\n ProfileFinding,\n ProfileFindingCode,\n RecipeId,\n RepairPlan,\n RepairResult,\n RepairStep,\n} from './profile-repair/index.ts'\nexport { WEB_PORT_ATTEMPTS, findFreeWebPort, loopbackPortIsFree, webPortPatch } from './web-port.ts'\nexport { APP_MANIFEST_FILE, APP_PLUGINS_DIR, NewAppError, planNewApp, writeNewApp, type LauncherFile, type NewAppOptions, type PlannedApp } from './app/new-app.ts'\nexport { PROFILE_OWNER_FILE, ProfileInUseError, claimProfile, type ProfileOwner } from './profile-owner.ts'\nexport {\n APP_DEFINITION_FILE,\n AppInstanceError,\n LockHeldError,\n acquireLock,\n announce,\n announceSelf,\n appFolder,\n appFolderInstance,\n appName,\n defaultInstance,\n developmentInstance,\n instanceEnvironment,\n IsolationRequiredError,\n isGitWorktree,\n listRunning,\n managedApp,\n ONLINE_SECRET_FILE_NAME,\n onlineSecretPath,\n osHomeDirectory,\n pinnedInstance,\n processIsAlive,\n profileDir,\n readLock,\n readOnlineSecret,\n releaseLock,\n removeOnlineSecret,\n REQUIRE_ISOLATED_HOME_ENV,\n runLockFileForDshHome,\n selectInstance,\n stablePort,\n withdraw,\n worktreeInstance,\n writeOnlineSecret,\n InstanceAnnounceError,\n type AppInstance,\n type AppInstanceKind,\n type LockHolder,\n type RunningApp,\n type SelfAnnouncement,\n type SelectInstanceOptions,\n} from './instance/index.ts'\nexport { PUBLIC_REGISTRY, StartSourceError, classifyStartSource, gitClone, resolveStartSource, type GitClone, type ResolvedStartSource, type StartSource } from './app/start-source.ts'\n"],"mapp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AS;EAAO,SAAS,SAAS;CAAQ,CAAC;CAC5E,MAAM,UAAU,IAAI,IAAI,YAAY;CAGpC,MAAM,MAAM,UAFC,SAAS,QAAQ,YAEH,GADd,SAAS,QAAQ,SAAS,QAAQ;CAE/C,IAAI,WAAW;CACf,OAAO,OAAO,OAAO;EACnB;EACA;EACA,kBAAkB,QAAQ;EAC1B,MAAM,UAAU;GACd,IAAI,UAAU;GACd,WAAW;GACX,MAAM,IAAI,MAAM,QAAQ;EAC1B;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"index.mjs","names":["require","require","resolveDshBin","PROTECTED_PLUGIN_ENTRY_REASON","PluginLifecycleError","AcrPluginLifecycleService","PREVIEW_TTL_MS","MAX_PREVIEWS","NPM_PACKAGE_NAME_PATTERN","ID","resolvePackageImports","require","dshInstallAnchor","profileRoot","describe"],"sources":["../src/coding-capabilities.ts","../src/session-bridge.ts","../src/session-log-exporter.ts","../src/instance/offline-lock.ts","../src/instance/app-instance.ts","../src/instance/registry.ts","../src/instance/select.ts","../src/instance/announce-self.ts","../src/instance/online-secret.ts","../src/acryl-home.ts","../src/engine-host.ts","../src/web-favicon-data.ts","../src/web-favicon.ts","../src/engine-tools.ts","../src/pinned-pnpm.ts","../src/profile-layout.ts","../src/cli-market-install.ts","../src/plugin-lifecycle-state.ts","../src/plugin-lifecycle.ts","../src/cli-market-plugins.ts","../src/plugin-acryl-workspace-status.ts","../src/blueprint/brand-identity.ts","../src/blueprint/blueprint.ts","../src/blueprint/compose.ts","../src/blueprint/definition.ts","../src/blueprint/manifest.ts","../src/blueprint/selection.ts","../src/web-port.ts","../src/profile-owner.ts","../src/module-hooks.ts","../src/profile-resolution/moved-framework.ts","../src/profile-resolution/resolver.ts","../src/profile-resolution/service.ts","../src/web-market-install.ts","../src/web-market-plugins.ts","../src/engine-dsh.ts","../src/package-overlay.ts","../src/module-resolution.ts","../src/plugin-doctor.ts","../src/system-prompt-capture.ts","../src/profile-repair/backup.ts","../src/profile-repair/findings.ts","../src/profile-repair/inspector.ts","../src/profile-repair/repair.ts","../src/app/new-app.ts","../src/app/start-source.ts","../src/index.ts"],"sourcesContent":["/**\n * The Blueprint vocabulary of ACRYL's coding capabilities: which capability ids exist, which product surfaces each one declares itself for,\n * and which of them need the framework router. Blueprint parsing and the built-in IDE Blueprint are runtime domain and read this table.\n *\n * How a capability composes on a surface (its Loader rows, the packages the surface must make resolvable, the shell-mode split) lives in\n * `@acryldev/coding-capabilities`, which the surfaces compose from: the runtime decides what a Blueprint may name, the surface decides what\n * runs. The two tables must name the same ids; the composition package's test asserts it both ways (spec 051 T021).\n *\n * @module @acryldev/harness-runtime/coding-capabilities\n */\n\nexport type AcrylSurface = 'tui' | 'web' | 'desktop'\n\nexport type AcrylCodingCapabilityId =\n | 'persona'\n | 'agent-roster'\n | 'session-stats'\n | 'authorization'\n | 'acryl-settings'\n | 'workspace'\n | 'plugin-admin'\n | 'sign-in'\n | 'launcher-screen'\n | 'account-callback'\n | 'support'\n | 'agent-control-ui'\n | 'advanced-shell'\n\n/**\n * The shell a surface renders the coding UI in. `advanced` replaces the stock DSH frame with the ACRYL\n * shell (Projects list, tabbed canvas, right panel); `compatibility` keeps the stock frame. Desktop lets\n * the user choose; Web always runs `advanced`, so both surfaces share one workspace.\n */\nexport type AcrylShellMode = 'compatibility' | 'advanced'\n\n/** One capability as a Blueprint names it. Its composition (rows and packages) is `@acryldev/coding-capabilities`'. */\nexport interface AcrylCodingCapabilityDeclaration {\n readonly id: AcrylCodingCapabilityId\n /**\n * The capability serves its HTTP through the framework's router (`ctx.router`, `ctx.routerHttp`), which the `framework-kit` row brings.\n * Without that row its plugin waits PENDING with nothing said, so a Blueprint that composes it must also compose the kit.\n */\n readonly needsRouter?: boolean\n}\n\n/** Every capability a Blueprint may name, and which of them need the framework router. */\nexport const ACRYL_CODING_CAPABILITIES: readonly AcrylCodingCapabilityDeclaration[] = [\n { id: 'persona' },\n { id: 'agent-roster' },\n { id: 'session-stats' },\n { id: 'authorization' },\n { id: 'acryl-settings' },\n { id: 'workspace', needsRouter: true },\n { id: 'plugin-admin', needsRouter: true },\n { id: 'sign-in', needsRouter: true },\n { id: 'launcher-screen', needsRouter: true },\n { id: 'account-callback' },\n { id: 'support', needsRouter: true },\n { id: 'agent-control-ui', needsRouter: true },\n { id: 'advanced-shell' },\n]\n","import type { Context } from '@deepseek-ai/cordis'\nimport { installModelSelection, type Agent, type AgentHandle, type AssistantStreamFrame, type ModelSelectionRef } from '@deepseek-ai/dsh-agent'\nimport { createUserMessage } from '@deepseek-ai/dsh-llm'\nimport { SessionId, type SessionEvent } from '@deepseek-ai/dsh-session'\nimport type {} from '@deepseek-ai/dsh-agent-default-model'\nimport type {} from '@deepseek-ai/dsh-session-persistence'\n\nexport type { AssistantStreamFrame }\nimport type {\n AcrylSessionAttachment,\n AcrylSessionSnapshot,\n AcrylSessionSubscription,\n AcrylToolProjection,\n AcrylTranscriptItem,\n} from '@acryldev/control'\n\nexport interface AcrylSessionBridgeOptions {\n readonly profile: string\n readonly generationId: string\n readonly attachment: AcrylSessionAttachment\n readonly cwd: string\n}\n\nexport interface AcrylSessionEventSubscription {\n dispose(): Promise<void>\n}\n\nexport interface AcrylSessionBridge {\n open(resumeSessionId?: string): Promise<string>\n snapshot(sessionId: string): Promise<AcrylSessionSnapshot>\n /** The full durable event log for one session — the surface's replay/seed source. */\n events(sessionId: string): readonly SessionEvent[]\n subscribe(\n sessionId: string,\n listener: (snapshot: AcrylSessionSnapshot) => void,\n onError?: (error: Error) => void,\n ): Promise<AcrylSessionSubscription>\n /** Live durable-log events for one active session (streaming presentation seam). */\n subscribeEvents(\n sessionId: string,\n listener: (event: SessionEvent) => void,\n ): Promise<AcrylSessionEventSubscription>\n /**\n * Process-local live assistant-stream frames (start/chunk/end) for one\n * active session. Session format v2 no longer persists per-token\n * `assistant/chunk` events in the durable log — `agent/assistant-stream`\n * is the intentionally process-local replacement for in-progress-typing\n * presentation; the durable `assistant/message`/`assistant/attempt`\n * settlement (delivered via `subscribeEvents`) carries the same stream\n * for replay once the attempt settles.\n */\n subscribeAssistantStream(\n sessionId: string,\n listener: (frame: AssistantStreamFrame) => void,\n ): Promise<AcrylSessionEventSubscription>\n submitPrompt(input: { readonly sessionId: string; readonly text: string }): Promise<void>\n /**\n * Switch an already-open session's live model. `agentOptions.provider`/`model`\n * are a one-time construction input to `ctx.agents.create` — not a live\n * setting — so this is the only thing that changes what a running session\n * sends its next request to (`ModelSelectionRef` installed on the agent's\n * own scoped context via `installModelSelection`, per-step prompt assembly\n * reads it fresh).\n */\n selectModel(input: { readonly sessionId: string; readonly provider: string; readonly model: string }): Promise<void>\n cancel(sessionId: string): Promise<void>\n dispose(): Promise<void>\n}\n\nfunction contentText(content: readonly { readonly type: string; readonly text?: string }[]): string {\n return content\n .filter((block): block is { readonly type: 'text'; readonly text: string } => {\n return block.type === 'text' && typeof block.text === 'string'\n })\n .map(block => block.text)\n .join('')\n}\n\nfunction transcript(events: readonly SessionEvent[]): readonly AcrylTranscriptItem[] {\n const items: AcrylTranscriptItem[] = []\n for (const event of events) {\n if (event.type === 'user/message' && event.data.source.kind === 'user') {\n const text = contentText(event.data.content)\n if (text !== '') items.push(Object.freeze({ id: `event-${event.seq}`, author: 'user', text }))\n }\n if (event.type === 'assistant/message') {\n const text = contentText(event.data.message.content)\n if (text !== '') items.push(Object.freeze({ id: `event-${event.seq}`, author: 'assistant', text }))\n }\n }\n return Object.freeze(items)\n}\n\nfunction tools(events: readonly SessionEvent[]): readonly AcrylToolProjection[] {\n const current = new Map<string, AcrylToolProjection>()\n for (const event of events) {\n if (event.type === 'tool/call') {\n current.set(event.data.callId, Object.freeze({\n callId: event.data.callId,\n name: event.data.name,\n status: 'running',\n }))\n }\n if (event.type === 'tool/result') {\n const callId = event.data.message.source.callId\n const existing = current.get(callId)\n if (existing !== undefined) {\n current.set(callId, Object.freeze({ ...existing, status: 'succeeded' }))\n }\n }\n }\n return Object.freeze([...current.values()])\n}\n\nfunction status(agent: Agent): AcrylSessionSnapshot['agentStatus'] {\n return agent.status === 'running' ? 'running' : 'idle'\n}\n\n/**\n * Runtime-owned adapter over one native DSH agent/session. It creates or resumes\n * the native agent and derives every presentation value from its durable log.\n */\nexport function createAcrylSessionBridge(\n ctx: Context,\n options: AcrylSessionBridgeOptions,\n): AcrylSessionBridge {\n const handles = new Map<string, AgentHandle>()\n const modelSelections = new Map<string, ModelSelectionRef>()\n const modelSelectionDisposers = new Map<string, () => void>()\n const subscribers = new Map<string, Set<(snapshot: AcrylSessionSnapshot) => void>>()\n const eventListeners = new Map<string, Set<(event: SessionEvent) => void>>()\n const assistantStreamListeners = new Map<string, Set<(frame: AssistantStreamFrame) => void>>()\n let disposed = false\n\n const notify = (sessionId: string): void => {\n const listeners = subscribers.get(sessionId)\n if (listeners === undefined) return\n void snapshot(sessionId).then((next) => {\n for (const listener of listeners) {\n try {\n listener(next)\n } catch {\n // A presentation listener cannot disrupt durable session delivery.\n }\n }\n })\n }\n const offSessionEvent = ctx.on('session/event', (session, event) => {\n if (!handles.has(session.id)) return\n notify(session.id)\n const listeners = eventListeners.get(session.id)\n if (listeners === undefined) return\n for (const listener of listeners) {\n try {\n listener(event)\n } catch {\n // A presentation listener cannot disrupt durable session delivery.\n }\n }\n })\n // `agent/assistant-stream` is process-local and dispatched per-agent by\n // `@deepseek-ai/dsh-scope`; `{ global: true }` receives every agent's\n // frames and this bridge filters to the sessions it owns, matching the\n // pattern `dsh-api-session-controller`'s own history/follow code uses for\n // the same event.\n const offAssistantStream = ctx.on('agent/assistant-stream', ({ agent, frame }) => {\n if (!handles.has(agent.session.id)) return\n const listeners = assistantStreamListeners.get(agent.session.id)\n if (listeners === undefined) return\n for (const listener of listeners) {\n try {\n listener(frame)\n } catch {\n // A presentation listener cannot disrupt durable session delivery.\n }\n }\n }, { global: true })\n // The agent's idle/running transition is not a durable event: a turn's last event is written while the agent is still running, and the\n // return to idle follows with nothing logged, so a subscriber refreshed only on events kept showing \"running\" after every turn.\n const offAgentStatus = ctx.on('agent/status', ({ agent }) => {\n if (handles.has(agent.session.id)) notify(agent.session.id)\n }, { global: true })\n\n const snapshot = async (sessionId: string): Promise<AcrylSessionSnapshot> => {\n const agent = agentFor(sessionId)\n return Object.freeze({\n profile: options.profile,\n generationId: options.generationId,\n attachment: options.attachment,\n sessionId: agent.id,\n agentStatus: status(agent),\n transcript: transcript(agent.session.snapshotEvents()),\n tools: tools(agent.session.snapshotEvents()),\n })\n }\n\n const agentFor = (sessionId: string): Agent => {\n if (disposed) throw new Error('ACRYL session bridge is disposed')\n const handle = handles.get(sessionId)\n if (handle === undefined) throw new Error(`ACRYL session ${sessionId} is not active`)\n return handle.agent\n }\n\n return Object.freeze({\n async open(resumeSessionId?: string): Promise<string> {\n if (disposed) throw new Error('ACRYL session bridge is disposed')\n if (handles.size !== 0) throw new Error('ACRYL session bridge already has an active session')\n const defaultModel = ctx.get('agentDefaultModel')\n if (defaultModel === undefined) throw new Error('ACRYL profile has no default agent model')\n const selection = defaultModel.currentSelection()\n const handle = resumeSessionId === undefined\n ? await ctx.agents.create({\n sessionId: SessionId(`acryl-session-${crypto.randomUUID()}`),\n meta: { cwd: options.cwd },\n agentOptions: { provider: selection.provider, model: selection.model },\n })\n : await ctx.agents.resume({\n resumeSessionId: SessionId(resumeSessionId),\n agentOptions: { provider: selection.provider, model: selection.model },\n })\n handles.set(handle.agent.id, handle)\n const ref: ModelSelectionRef = { current: undefined, assembled: undefined }\n modelSelectionDisposers.set(handle.agent.id, installModelSelection(handle.agent.ctx, ref))\n modelSelections.set(handle.agent.id, ref)\n return handle.agent.id\n },\n snapshot,\n events(sessionId: string): readonly SessionEvent[] {\n return agentFor(sessionId).session.snapshotEvents()\n },\n async subscribe(\n sessionId: string,\n listener: (snapshot: AcrylSessionSnapshot) => void,\n _onError?: (error: Error) => void,\n ): Promise<AcrylSessionSubscription> {\n agentFor(sessionId)\n const listeners = subscribers.get(sessionId) ?? new Set()\n subscribers.set(sessionId, listeners)\n listeners.add(listener)\n try {\n listener(await snapshot(sessionId))\n } catch {\n // Presentation listeners cannot disrupt durable session delivery.\n }\n let active = true\n return Object.freeze({\n whenError(): Promise<Error> { return new Promise<Error>(() => {}) },\n async dispose(): Promise<void> {\n if (!active) return\n active = false\n listeners.delete(listener)\n if (listeners.size === 0) subscribers.delete(sessionId)\n },\n })\n },\n async subscribeEvents(\n sessionId: string,\n listener: (event: SessionEvent) => void,\n ): Promise<AcrylSessionEventSubscription> {\n agentFor(sessionId)\n const listeners = eventListeners.get(sessionId) ?? new Set()\n eventListeners.set(sessionId, listeners)\n listeners.add(listener)\n let active = true\n return Object.freeze({\n async dispose(): Promise<void> {\n if (!active) return\n active = false\n listeners.delete(listener)\n if (listeners.size === 0) eventListeners.delete(sessionId)\n },\n })\n },\n async subscribeAssistantStream(\n sessionId: string,\n listener: (frame: AssistantStreamFrame) => void,\n ): Promise<AcrylSessionEventSubscription> {\n agentFor(sessionId)\n const listeners = assistantStreamListeners.get(sessionId) ?? new Set()\n assistantStreamListeners.set(sessionId, listeners)\n listeners.add(listener)\n let active = true\n return Object.freeze({\n async dispose(): Promise<void> {\n if (!active) return\n active = false\n listeners.delete(listener)\n if (listeners.size === 0) assistantStreamListeners.delete(sessionId)\n },\n })\n },\n async submitPrompt(input: { readonly sessionId: string; readonly text: string }): Promise<void> {\n const agent = agentFor(input.sessionId)\n if (input.text.trim() === '') throw new Error('ACRYL prompt must not be empty')\n const accepted = new Promise<void>((resolve) => {\n const off = ctx.on('session/event', (session, event) => {\n if (session !== agent.session || event.type !== 'user/message') return\n off()\n resolve()\n })\n })\n agent.followup(createUserMessage({\n content: [{ type: 'text', text: input.text }],\n source: { kind: 'user' },\n }))\n await accepted\n },\n async selectModel(input: { readonly sessionId: string; readonly provider: string; readonly model: string }): Promise<void> {\n agentFor(input.sessionId)\n const ref = modelSelections.get(input.sessionId)\n if (ref === undefined) throw new Error(`ACRYL session ${input.sessionId} has no installed model selection`)\n ref.current = { provider: input.provider, model: input.model }\n },\n async cancel(sessionId: string): Promise<void> {\n agentFor(sessionId).cancel({ kind: 'user' })\n },\n async dispose(): Promise<void> {\n if (disposed) return\n disposed = true\n offSessionEvent()\n offAssistantStream()\n offAgentStatus()\n subscribers.clear()\n eventListeners.clear()\n assistantStreamListeners.clear()\n for (const dispose of modelSelectionDisposers.values()) dispose()\n modelSelectionDisposers.clear()\n modelSelections.clear()\n // Durable continuity: idle the turn, checkpoint the session log, then\n // release the native handle. Mirror of Tomo's shutdown sequence, owned\n // here so every surface gets the same durability guarantee.\n const activeHandles = [...handles.values()]\n handles.clear()\n const sessions = ctx.get('sessions')\n for (const handle of activeHandles) {\n try {\n await handle.agent.whenIdle()\n } catch {\n // A disposing agent has no obligation to be idle; proceed to release.\n }\n try {\n await sessions?.flush(handle.agent.session)\n } catch {\n // Flush is best-effort on dispose; persistence already ran per event.\n }\n }\n await Promise.all(activeHandles.map(handle => handle.dispose()))\n },\n })\n}\n","/**\n * A durable, cross-surface debug log for ACRYL sessions.\n *\n * Cordis's own `ctx.logger` already carries every structured log record any\n * plugin emits, but nothing in this stack persisted it anywhere — a failure\n * like a vendored provider's OAuth error only ever reached the terminal\n * transcript, gone the moment the pane scrolled or the process exited. This\n * registers one JSONL file exporter on `ctx.logger` per surface (CLI/TUI,\n * web, and — once wired there too — the desktop GUI), so `error`/`warn`\n * records (and everything, when `ACRYL_LOG_LEVEL=debug`) survive the session\n * and can be read back after the fact instead of re-derived from a\n * screenshot.\n *\n * @module @acryldev/harness-runtime/session-log-exporter\n */\n\nimport { appendFileSync, mkdirSync } from 'node:fs'\nimport { join } from 'node:path'\nimport type { Context } from '@deepseek-ai/cordis'\n\nexport interface InstallSessionLogExporterOptions {\n /** Which ACRYL surface this process is (`tui`, `web`, `desktop`) — becomes part of the log filename. */\n readonly surface: string\n /** The app instance's harness home (`instance.dshHome`): where `logs/` lives. Always explicit, never resolved from the environment here. */\n readonly dshHome: string\n}\n\nconst LOGGER_LEVEL_WARN = 2\nconst LOGGER_LEVEL_DEBUG = 3\n\n/**\n * Register the file exporter for this process's lifetime. `ctx.logger.exporter()`\n * already ties its own disposal to the fiber that registers it (see\n * `LoggerService.exporter` in `@deepseek-ai/cordis`), so this needs no extra\n * `ctx.effect()` wrapper of its own.\n * @param ctx - the plugin context whose `ctx.logger` gains the exporter.\n * @param options - which surface/home this log file belongs to.\n */\nexport function installSessionLogExporter(ctx: Context, options: InstallSessionLogExporterOptions): void {\n const { dshHome } = options\n const logDir = join(dshHome, 'logs')\n try {\n mkdirSync(logDir, { recursive: true, mode: 0o700 })\n } catch {\n return // best-effort diagnostics only; a session must never fail to start over this\n }\n const day = new Date().toISOString().slice(0, 10)\n const logFile = join(logDir, `acryl-${options.surface}-${day}.jsonl`)\n const threshold = process.env.ACRYL_LOG_LEVEL === 'debug' ? LOGGER_LEVEL_DEBUG : LOGGER_LEVEL_WARN\n\n ctx.logger.exporter({\n export(message) {\n if (message.level > threshold) return\n try {\n appendFileSync(logFile, `${JSON.stringify({\n ts: new Date(message.ts).toISOString(),\n type: message.type,\n name: message.name,\n args: message.args.map(arg => (arg instanceof Error\n ? { message: arg.message, stack: arg.stack, name: arg.name }\n : arg)),\n })}\\n`, { mode: 0o600 })\n } catch {\n // best-effort: a write failure here must never take a session down\n }\n },\n })\n}\n","/**\n * Pessimistic Offline Lock (Patterns of Enterprise Application Architecture), with the book's conditions met: ownership is visible (the file says who\n * holds it), and a stale lock (its holder's process is gone) is taken over instead of blocking forever. Used for \"one live process per app\" and \"one live\n * installation per profile\".\n *\n * @module @acryldev/harness-runtime/instance/offline-lock\n */\n\nimport { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'\nimport { dirname } from 'node:path'\n\nexport interface LockHolder {\n readonly pid: number\n readonly since: string\n readonly [detail: string]: unknown\n}\n\nexport class LockHeldError extends Error {\n readonly holder: LockHolder\n constructor(message: string, holder: LockHolder) {\n super(message)\n this.name = 'LockHeldError'\n this.holder = holder\n }\n}\n\nexport function processIsAlive(pid: number): boolean {\n try {\n process.kill(pid, 0)\n return true\n } catch (error) {\n return (error as NodeJS.ErrnoException).code === 'EPERM'\n }\n}\n\nexport function readLock(file: string): LockHolder | undefined {\n if (!existsSync(file)) return undefined\n try {\n const value = JSON.parse(readFileSync(file, 'utf8')) as Partial<LockHolder>\n return Number.isInteger(value.pid) ? value as LockHolder : undefined\n } catch {\n return undefined\n }\n}\n\n/**\n * Take the lock for `pid`. Refused (LockHeldError, with a message built by `describe`) when a live holder exists that `compatible` does not accept.\n * `compatible` lets a lock admit its own kind (the same installation, the same process).\n */\nexport function acquireLock(\n file: string,\n holder: Omit<LockHolder, 'since'>,\n options: {\n readonly alive?: (pid: number) => boolean\n readonly compatible?: (current: LockHolder) => boolean\n readonly describe?: (current: LockHolder) => string\n } = {},\n): void {\n const alive = options.alive ?? processIsAlive\n const current = readLock(file)\n if (current !== undefined && current.pid !== holder.pid && alive(current.pid) && options.compatible?.(current) !== true) {\n throw new LockHeldError(options.describe?.(current) ?? `${file} is held by pid ${String(current.pid)}`, current)\n }\n mkdirSync(dirname(file), { recursive: true, mode: 0o700 })\n writeFileSync(file, `${JSON.stringify({ ...holder, since: new Date().toISOString() }, null, 2)}\\n`, { mode: 0o600 })\n}\n\n/** Release only our own hold: never remove a lock a newer holder took after ours went stale. */\nexport function releaseLock(file: string, pid: number = process.pid): void {\n if (readLock(file)?.pid === pid) rmSync(file, { force: true })\n}\n","/**\n * AppInstance: everything one running ACRYL app owns on this machine, as one consistent family (spec 036, \"Self-containment\").\n *\n * Patterns, by the books in the repo's engineering rules:\n * - **Bulkhead** (Release It!): each app is a sealed compartment; nothing it owns is reachable from another app.\n * - **Abstract Factory** (refactoring.guru): the factories below produce a whole family of resources (home, engine home, port, Electron user data, run lock,\n * project scope) that always belong together; a caller cannot mix one app's home with another app's port.\n * - **Deep module / information hiding** (A Philosophy of Software Design): \"where an app keeps things\" is decided here and nowhere else.\n * - The instance is chosen once, in the composition root (Clean Architecture's Main), by `select.ts`, the only code that reads the environment or the OS home.\n *\n * Pure: no I/O. Paths are built, never checked; `select.ts` does the few filesystem checks that choose a factory.\n *\n * @module @acryldev/harness-runtime/instance/app-instance\n */\n\nimport { createHash } from 'node:crypto'\nimport { basename, join } from 'node:path'\n\n/** How the instance was chosen. Only `default` may use the shared `~/.acryl`. */\nexport type AppInstanceKind = 'default' | 'development' | 'worktree' | 'app' | 'managed' | 'pinned'\n\nexport interface AppInstance {\n readonly kind: AppInstanceKind\n /** Unique on this machine: it seeds the port, names the Electron user data and namespaces project folders. */\n readonly id: string\n /** Human name (the folder name for an app). */\n readonly name: string\n /** The ACRYL home: settings, sessions, profiles (under `dshHome`), global extensions, runtime state. */\n readonly home: string\n /** The DSH engine home the pinned harness reads (`DSH_HOME`). */\n readonly dshHome: string\n /** First Web port to try, and whether to move to the next free one when it is taken. */\n readonly webPort: { readonly start: number, readonly scan: boolean }\n /**\n * Who may reach the Web server: the address it listens on (loopback unless a caller such as a container entry point asks for `0.0.0.0`) and the extra\n * names a browser reaches it by (a proxy's public host). Non-loopback names must be listed, or DSH's connection refuses the request.\n */\n readonly webAccess: WebAccess\n /** Electron's product name for this instance, and the name of its user-data folder before it moved into the home (read once, to carry that data over). */\n readonly userDataName: string\n /**\n * Electron's user data (window state, storage, logs, crash evidence, the single-instance lock), inside the app's own home like everything else it keeps,\n * never in an OS application-data folder: one predictable place on every OS (`~/.acryl/desktop-data` for the installed app).\n */\n readonly userDataDir: string\n /** Namespace for folders this app writes inside a project it opens; undefined keeps the classic shared locations. */\n readonly projectScope?: string\n /**\n * Where the chat creates its first workspace, when this app must not use the OS user's Documents folder. DSH asks the operating system for that folder\n * (not `$HOME`), so an isolated app would otherwise write its first project into the real one. Only the default instance, which is the user's installed\n * app, uses the OS Documents folder; every other instance keeps it inside its own home.\n */\n readonly documentsDirectory?: string\n /** The app definition (`blend.yaml`) when this is an app folder. */\n readonly definitionFile?: string\n /** The pessimistic offline lock that makes one live process per instance. */\n readonly runLockFile: string\n}\n\n/** See {@link AppInstance.webAccess}. */\nexport interface WebAccess {\n readonly host: string\n readonly trustedHosts: readonly string[]\n}\n\nexport const LOOPBACK_WEB_HOST = '127.0.0.1'\n/** Bind addresses a caller may choose: loopback, or every interface (a container, where the network boundary is the container's own). */\nexport const WEB_HOSTS: readonly string[] = Object.freeze([LOOPBACK_WEB_HOST, '0.0.0.0', '::1', '::'])\nexport const DEFAULT_WEB_PORT = 3080\nexport const WORKTREE_WEB_PORT = 3081\nexport const APP_PORT_BASE = 3100\nexport const APP_PORT_SPAN = 900\nexport const APP_DEFINITION_FILE = 'blend.yaml'\nexport const RUN_LOCK_FILE = 'instance.json'\nexport const USER_DATA_DIR_NAME = 'desktop-data'\nexport const ENGINE_DIR_NAME = '.dsh'\nexport const DEFAULT_HOME_DIR_NAME = '.acryl'\nexport const DEVELOPMENT_HOME_DIR_NAME = '.acryl-dev'\nexport const WORKTREE_HOMES_DIR_NAME = '.acryl-worktrees'\nexport const MANAGED_HOMES_DIR_NAME = '.acryl-instances'\n\nconst NAME = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u\n/** A project-scope id (the extension pack validates the same shape before building a path from it). */\nexport const PROJECT_SCOPE = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u\nexport const PROJECT_SCOPE_MAX = 64\nconst TRUSTED_HOST = /^[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?(?::\\d{1,5})?$/u\nconst LOOPBACK_ACCESS: WebAccess = Object.freeze({ host: LOOPBACK_WEB_HOST, trustedHosts: Object.freeze([]) })\n\nexport class AppInstanceError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'AppInstanceError'\n }\n}\n\n/** A plain app name: lowercase letters, digits and dashes, at most 32. It becomes a folder, an app name and a port seed. */\nexport function appName(value: unknown): string {\n if (typeof value !== 'string' || !NAME.test(value) || value.length > 32) throw new AppInstanceError(`an app name is lowercase letters, digits and dashes (at most 32), got ${JSON.stringify(value)}`)\n return value\n}\n\n/** FNV-1a over the id: stable across runs and platforms, spreads ids over the app port range. */\nexport function stablePort(id: string): number {\n let hash = 0x811c9dc5\n for (const character of id) {\n hash ^= character.codePointAt(0) ?? 0\n hash = Math.imul(hash, 0x01000193) >>> 0\n }\n return APP_PORT_BASE + (hash % APP_PORT_SPAN)\n}\n\nfunction family(input: {\n kind: AppInstanceKind\n id: string\n name: string\n home: string\n dshHome?: string\n webPort: AppInstance['webPort']\n userDataName: string\n projectScope?: string\n definitionFile?: string\n}): AppInstance {\n return Object.freeze({\n kind: input.kind,\n id: input.id,\n name: input.name,\n home: input.home,\n dshHome: input.dshHome ?? join(input.home, ENGINE_DIR_NAME),\n webPort: Object.freeze({ ...input.webPort }),\n webAccess: LOOPBACK_ACCESS,\n userDataName: input.userDataName,\n userDataDir: join(input.home, USER_DATA_DIR_NAME),\n ...(input.projectScope === undefined ? {} : { projectScope: input.projectScope }),\n ...(input.kind === 'default' ? {} : { documentsDirectory: join(input.home, 'documents') }),\n ...(input.definitionFile === undefined ? {} : { definitionFile: input.definitionFile }),\n runLockFile: join(input.home, RUN_LOCK_FILE),\n })\n}\n\n/** Plain ACRYL, nothing configured: the one instance allowed to use the shared `~/.acryl`. */\nexport function defaultInstance(osHome: string): AppInstance {\n return family({ kind: 'default', id: 'acryl', name: 'acryl', home: join(osHome, DEFAULT_HOME_DIR_NAME), webPort: { start: DEFAULT_WEB_PORT, scan: false }, userDataName: 'ACRYL' })\n}\n\n/** The isolated local development app of the main checkout (`pnpm run dev`). */\nexport function developmentInstance(osHome: string): AppInstance {\n return family({ kind: 'development', id: 'acryl-dev', name: 'acryl-dev', home: join(osHome, DEVELOPMENT_HOME_DIR_NAME), webPort: { start: DEFAULT_WEB_PORT, scan: true }, userDataName: 'ACRYL Development' })\n}\n\n/** A second checkout (a git worktree): never the main checkout's home, port or Electron app. */\nexport function worktreeInstance(osHome: string, checkoutRoot: string): AppInstance {\n const folder = basename(checkoutRoot).replace(/[^A-Za-z0-9._-]+/gu, '-')\n const scope = `worktree-${folder.toLowerCase().replace(/[^a-z0-9]+/gu, '-').replace(/^-+|-+$/gu, '')}`.slice(0, PROJECT_SCOPE_MAX).replace(/-+$/u, '')\n return family({ kind: 'worktree', id: scope, name: folder, home: join(osHome, WORKTREE_HOMES_DIR_NAME, folder), webPort: { start: WORKTREE_WEB_PORT, scan: true }, userDataName: `ACRYL Development ${folder}`, projectScope: scope })\n}\n\n/**\n * An app folder (`acryl new`): the folder is the home. Two folders may share a name, so a folder's id carries a short digest of its real path; a managed app\n * (kept under `~/.acryl-instances/<name>`) is unique by name.\n */\nexport function appFolderInstance(realFolder: string, managed: boolean): AppInstance {\n const name = appName(basename(realFolder))\n const id = managed ? name : `${name}-${createHash('sha1').update(realFolder).digest('hex').slice(0, 4)}`\n return family({ kind: managed ? 'managed' : 'app', id, name, home: realFolder, webPort: { start: stablePort(id), scan: true }, userDataName: `ACRYL ${id}`, projectScope: id, definitionFile: join(realFolder, APP_DEFINITION_FILE) })\n}\n\n/** A home a caller pinned explicitly (ACRYL_HOME without an app definition, or a legacy DSH_HOME): honoured as given. */\nexport function pinnedInstance(home: string, dshHome?: string): AppInstance {\n const name = basename(home).replace(/^\\.+/u, '') || 'acryl'\n return family({ kind: 'pinned', id: `pinned-${createHash('sha1').update(home).digest('hex').slice(0, 6)}`, name, home, ...(dshHome === undefined ? {} : { dshHome }), webPort: { start: DEFAULT_WEB_PORT, scan: false }, userDataName: 'ACRYL' })\n}\n\n/** The same family with an explicit port preference (ACRYL_WEB_PORT). Explicit always scans: the caller asked for a start, not a fight. */\nexport function withWebPort(instance: AppInstance, start: number): AppInstance {\n if (!Number.isInteger(start) || start < 1024 || start > 65_535) throw new AppInstanceError(`the web port must be a port number from 1024 to 65535, got ${String(start)}`)\n return Object.freeze({ ...instance, webPort: Object.freeze({ start, scan: true }) })\n}\n\n/**\n * The same family reachable beyond loopback (ACRYL_WEB_HOST, ACRYL_WEB_TRUSTED_HOSTS). The trusted names are checked again, strictly, by DSH's connection\n * plugin at load; this only refuses what is plainly not a host name so the mistake surfaces at selection, with the variable's name.\n */\nexport function withWebAccess(instance: AppInstance, host: string, trustedHosts: readonly string[]): AppInstance {\n if (!WEB_HOSTS.includes(host)) throw new AppInstanceError(`the web host must be one of ${WEB_HOSTS.join(', ')}, got ${JSON.stringify(host)}`)\n for (const name of trustedHosts) {\n if (!TRUSTED_HOST.test(name)) throw new AppInstanceError(`a trusted web host is a host name with an optional port (such as ws-1.example.com or ws-1.example.com:443), got ${JSON.stringify(name)}`)\n }\n return Object.freeze({ ...instance, webAccess: Object.freeze({ host, trustedHosts: Object.freeze([...trustedHosts]) }) })\n}\n\n/** A project-scope override (ACRYL_INSTANCE) for a pinned home. */\nexport function withProjectScope(instance: AppInstance, scope: string): AppInstance {\n if (!PROJECT_SCOPE.test(scope) || scope.length > PROJECT_SCOPE_MAX) throw new AppInstanceError(`a project scope is lowercase letters, digits and dashes (at most ${String(PROJECT_SCOPE_MAX)}), got ${JSON.stringify(scope)}`)\n return Object.freeze({ ...instance, projectScope: scope })\n}\n\n/**\n * The environment contract that hands an instance to a child process or to the pinned harness. It is the ONLY way an instance crosses a process\n * boundary: the child's `select.ts` reads these exact values back into the same family.\n */\nexport function instanceEnvironment(instance: AppInstance): Record<string, string> {\n // The default instance is what a child derives with nothing set, so it adds nothing (and never pins the shared home by accident).\n if (instance.kind === 'default') return {}\n // A home pinned only through a legacy DSH_HOME round-trips as DSH_HOME alone: an ACRYL_HOME would outrank it and nest a different engine home.\n const engineOnly = instance.kind === 'pinned' && instance.dshHome !== join(instance.home, ENGINE_DIR_NAME)\n return {\n ...(engineOnly ? {} : { ACRYL_HOME: instance.home }),\n DSH_HOME: instance.dshHome,\n ...(instance.webPort.scan ? { ACRYL_WEB_PORT: String(instance.webPort.start) } : {}),\n ...(instance.webAccess.host === LOOPBACK_WEB_HOST ? {} : { ACRYL_WEB_HOST: instance.webAccess.host }),\n ...(instance.webAccess.trustedHosts.length === 0 ? {} : { ACRYL_WEB_TRUSTED_HOSTS: instance.webAccess.trustedHosts.join(',') }),\n ACRYL_LOCAL_PRODUCT_NAME: instance.userDataName,\n ...(instance.projectScope === undefined ? {} : { ACRYL_INSTANCE: instance.projectScope }),\n }\n}\n\nexport function profileDir(instance: AppInstance, profileName: string): string {\n return join(instance.dshHome, 'profiles', profileName)\n}\n\n/**\n * The run lock file that owns a given engine home, for a caller that was handed a `dshHome` directly (the CLI\n * rescue tools, `--home`) rather than a full `AppInstance`. Inverts `family()`'s default nesting\n * (`dshHome = join(home, ENGINE_DIR_NAME)`): when `dshHome`'s last segment is `.dsh`, its app home is the parent;\n * otherwise `dshHome` was handed in as the home itself (a pinned instance may point `dshHome` anywhere), so it is\n * its own app home. Pure path math, no I/O: it does not choose an instance, only locates the lock file for one\n * a caller already resolved, so it does not compete with `select.ts` for \"the one place an app is chosen\".\n */\nexport function runLockFileForDshHome(dshHome: string): string {\n const home = basename(dshHome) === ENGINE_DIR_NAME ? join(dshHome, '..') : dshHome\n return join(home, RUN_LOCK_FILE)\n}\n\nconst USER_DATA_NAME = /^[A-Za-z0-9.][A-Za-z0-9._ -]{0,63}$/u\n\n/** The Electron user-data name (ACRYL_LOCAL_PRODUCT_NAME): a plain folder name, never a path, so it cannot escape the user-data root. */\nexport function withUserDataName(instance: AppInstance, name: string): AppInstance {\n if (!USER_DATA_NAME.test(name) || name.includes('..')) throw new AppInstanceError(`the Electron user-data name must be a plain folder name, got ${JSON.stringify(name)}`)\n return Object.freeze({ ...instance, userDataName: name })\n}\n","/**\n * Registry (Patterns of Enterprise Application Architecture) of running apps: each running app announces itself with one small file, so `ps` finds apps\n * wherever their folders are. An announcement whose process is gone is dropped when read. The registry lives in the OS user's `~/.acryl-instances/.running`\n * and holds only pointers (id, folder, pid, surface, port), never app data.\n *\n * @module @acryldev/harness-runtime/instance/registry\n */\n\nimport { existsSync, mkdirSync, readdirSync, rmSync, writeFileSync } from 'node:fs'\nimport { join } from 'node:path'\nimport { MANAGED_HOMES_DIR_NAME, type AppInstance } from './app-instance.ts'\nimport { processIsAlive, readLock } from './offline-lock.ts'\n\nexport interface RunningApp {\n readonly id: string\n readonly name: string\n readonly home: string\n readonly pid: number\n readonly surface?: string\n readonly definition?: string\n readonly port?: number\n readonly since?: string\n}\n\nexport function registryDir(osHome: string): string {\n return join(osHome, MANAGED_HOMES_DIR_NAME, '.running')\n}\n\nexport function announce(osHome: string, instance: AppInstance, info: { readonly pid: number, readonly surface?: string, readonly port?: number }): void {\n const dir = registryDir(osHome)\n mkdirSync(dir, { recursive: true, mode: 0o700 })\n const entry = { id: instance.id, name: instance.name, home: instance.home, ...(instance.definitionFile === undefined ? {} : { definition: instance.definitionFile }), ...info, since: new Date().toISOString() }\n writeFileSync(join(dir, `${instance.id}.json`), `${JSON.stringify(entry, null, 2)}\\n`, { mode: 0o600 })\n}\n\nexport function withdraw(osHome: string, instance: AppInstance, pid: number = process.pid): void {\n const file = join(registryDir(osHome), `${instance.id}.json`)\n if (readLock(file)?.pid === pid) rmSync(file, { force: true })\n}\n\nexport function listRunning(osHome: string, alive: (pid: number) => boolean = processIsAlive): readonly RunningApp[] {\n const dir = registryDir(osHome)\n if (!existsSync(dir)) return []\n const running: RunningApp[] = []\n for (const entry of readdirSync(dir)) {\n const file = join(dir, entry)\n const value = readLock(file) as unknown as RunningApp | undefined\n if (value === undefined) continue\n if (!alive(value.pid)) { rmSync(file, { force: true }); continue }\n running.push(value)\n }\n return running.sort((a, b) => a.id.localeCompare(b.id))\n}\n","/**\n * The composition-root selector: the ONLY code in ACRYL that reads the environment or the OS home to decide where an app lives (a test enforces it).\n * Everything else receives an `AppInstance`, or reads it from the `appInstance` Cordis service.\n *\n * Precedence, highest first:\n * ACRYL_HOME with a `blend.yaml` an app folder (managed when it sits in ~/.acryl-instances)\n * ACRYL_HOME a pinned home\n * DSH_HOME (legacy) a pinned engine home; the ACRYL home is its parent when it is named `.dsh`\n * checkout is a git worktree the worktree's own home\n * development requested ~/.acryl-dev (the main checkout's `pnpm run dev`)\n * nothing the default ~/.acryl\n * then ACRYL_WEB_PORT (explicit start port), ACRYL_WEB_HOST and ACRYL_WEB_TRUSTED_HOSTS (reachable beyond loopback, comma-separated names), ACRYL_INSTANCE (explicit project scope) and ACRYL_LOCAL_PRODUCT_NAME (Electron user data) refine the\n * chosen family: they are how `instanceEnvironment` hands a family to a child process.\n *\n * @module @acryldev/harness-runtime/instance/select\n */\n\nimport { existsSync, realpathSync, statSync } from 'node:fs'\nimport { homedir } from 'node:os'\nimport { basename, dirname, join, resolve } from 'node:path'\nimport {\n APP_DEFINITION_FILE,\n DEFAULT_HOME_DIR_NAME,\n DEVELOPMENT_HOME_DIR_NAME,\n ENGINE_DIR_NAME,\n MANAGED_HOMES_DIR_NAME,\n WORKTREE_HOMES_DIR_NAME,\n appFolderInstance,\n appName,\n defaultInstance,\n withWebAccess,\n developmentInstance,\n pinnedInstance,\n withProjectScope,\n withUserDataName,\n withWebPort,\n worktreeInstance,\n type AppInstance,\n} from './app-instance.ts'\n\nexport interface SelectInstanceOptions {\n readonly env?: Readonly<Record<string, string | undefined>>\n readonly osHome?: string\n /** The checkout a development launcher runs from; a git worktree gets its own instance. */\n readonly checkout?: string\n /** The main checkout's isolated development app (`pnpm run dev`) rather than the default. */\n readonly development?: boolean\n}\n\n/**\n * Set by a gate, a smoke or a live-run launcher: this process tree must run in an explicitly isolated home. With it set, `selectInstance` refuses (fails\n * closed) to choose a home that is not pinned by the caller or that lies inside a real ACRYL or DSH home of the OS user, so a forgotten override ends in an\n * error naming the fix, never in a write to the installed app's data.\n */\nexport const REQUIRE_ISOLATED_HOME_ENV = 'ACRYL_REQUIRE_ISOLATED_HOME'\n\nexport class IsolationRequiredError extends Error {\n constructor(detail: string) {\n super(`${REQUIRE_ISOLATED_HOME_ENV} is set, so this run needs an explicitly isolated home: ${detail}. Pin ACRYL_HOME (and DSH_HOME) to a throwaway folder outside the OS user's real ACRYL and DSH homes.`)\n this.name = 'IsolationRequiredError'\n }\n}\n\nconst REAL_HOME_FOLDERS = [DEFAULT_HOME_DIR_NAME, DEVELOPMENT_HOME_DIR_NAME, WORKTREE_HOMES_DIR_NAME, MANAGED_HOMES_DIR_NAME, ENGINE_DIR_NAME]\n\nconst inside = (path: string, folder: string): boolean => path === folder || path.startsWith(`${folder}/`) || path.startsWith(`${folder}\\\\`)\n\nfunction assertIsolated(instance: AppInstance, osHome: string): void {\n if (instance.kind !== 'pinned' && instance.kind !== 'app') throw new IsolationRequiredError(`the ${instance.kind} instance would use ${instance.home}`)\n const realHomes = REAL_HOME_FOLDERS.map(folder => real(join(osHome, folder)))\n for (const [label, path] of [['home', instance.home], ['engine home', instance.dshHome]] as const) {\n const resolved = real(path)\n const hit = realHomes.find(folder => inside(resolved, folder))\n if (hit !== undefined) throw new IsolationRequiredError(`the ${label} ${resolved} lies inside the real ${hit}`)\n }\n}\n\nconst set = (value: string | undefined): value is string => value !== undefined && value.trim() !== ''\n\nfunction real(path: string): string {\n try { return realpathSync(path) } catch { return resolve(path) }\n}\n\n/** Is this checkout a git worktree (its `.git` is a file pointing at the main repository)? */\nexport function isGitWorktree(checkoutRoot: string): boolean {\n const git = join(checkoutRoot, '.git')\n return existsSync(git) && statSync(git).isFile()\n}\n\n/** The OS user's home directory: exported only so the dev launchers need not read it themselves. */\nexport function osHomeDirectory(): string {\n return homedir()\n}\n\n/** An app folder given by path (`bin/acryl`, `--dir`), whether or not it is the environment's choice. */\nexport function appFolder(folder: string, osHome: string = homedir()): AppInstance {\n const root = real(folder)\n const managedRoot = real(join(osHome, MANAGED_HOMES_DIR_NAME))\n return appFolderInstance(root, dirname(root) === managedRoot)\n}\n\n/** A managed app by name: `~/.acryl-instances/<name>`. */\nexport function managedApp(name: string, osHome: string = homedir()): AppInstance {\n // Validate before building a path: a name such as `../x` must never reach outside the managed root.\n return appFolderInstance(join(osHome, MANAGED_HOMES_DIR_NAME, appName(name)), true)\n}\n\nexport function selectInstance(options: SelectInstanceOptions = {}): AppInstance {\n const env = options.env ?? process.env\n const osHome = options.osHome ?? homedir()\n let chosen: AppInstance\n if (set(env.ACRYL_HOME)) {\n const home = resolve(env.ACRYL_HOME.trim())\n chosen = existsSync(join(home, APP_DEFINITION_FILE)) ? appFolder(home, osHome) : pinnedInstance(home)\n } else if (set(env.DSH_HOME)) {\n const dshHome = resolve(env.DSH_HOME.trim())\n chosen = pinnedInstance(basename(dshHome) === ENGINE_DIR_NAME ? dirname(dshHome) : dshHome, dshHome)\n } else if (options.checkout !== undefined && isGitWorktree(options.checkout)) {\n chosen = worktreeInstance(osHome, options.checkout)\n } else if (options.development === true) {\n chosen = developmentInstance(osHome)\n } else {\n chosen = defaultInstance(osHome)\n }\n if (set(env.ACRYL_WEB_PORT)) chosen = withWebPort(chosen, Number(env.ACRYL_WEB_PORT.trim()))\n if (set(env.ACRYL_WEB_HOST) || set(env.ACRYL_WEB_TRUSTED_HOSTS)) {\n const trusted = (env.ACRYL_WEB_TRUSTED_HOSTS ?? '').split(',').map(name => name.trim()).filter(name => name.length > 0)\n chosen = withWebAccess(chosen, set(env.ACRYL_WEB_HOST) ? env.ACRYL_WEB_HOST.trim() : chosen.webAccess.host, trusted)\n }\n if (set(env.ACRYL_INSTANCE) && chosen.kind === 'pinned') chosen = withProjectScope(chosen, env.ACRYL_INSTANCE.trim())\n if (set(env.ACRYL_LOCAL_PRODUCT_NAME)) chosen = withUserDataName(chosen, env.ACRYL_LOCAL_PRODUCT_NAME.trim())\n if (set(env[REQUIRE_ISOLATED_HOME_ENV])) assertIsolated(chosen, osHome)\n return chosen\n}\n","/**\n * A composition root's own claim and announcement (spec 048 T011). The process that serves an app takes the app's run lock and writes its Registry entry\n * once it knows the address it really listens on, and gives both back when it exits; `acryl control list` then finds every running app, whichever launcher\n * started it. A launcher that only spawns the app (scripts/blank.mjs, the dev runners) no longer holds the lock: the process that serves the app does, so a\n * stop signal reaches it directly and the port in the Registry is the bound one, not the one that was asked for.\n *\n * @module @acryldev/harness-runtime/instance/announce-self\n */\n\nimport type { AppInstance } from './app-instance.ts'\nimport { acquireLock, LockHeldError, releaseLock } from './offline-lock.ts'\nimport { announce, withdraw } from './registry.ts'\nimport { osHomeDirectory } from './select.ts'\n\n/** What the running process tells the Registry about itself. */\nexport interface SelfAnnouncementInfo {\n /** The surface serving the app: `web`, `desktop` or `cli`. */\n readonly surface: string\n /** The port it is listening on, when the surface serves one. */\n readonly port?: number\n /** The announcing process; defaults to this one. */\n readonly pid?: number\n /** The OS user's home holding the Registry; defaults to the real one (the selector is the only reader of it). */\n readonly osHome?: string\n /** How to tell whether a holder is still alive; defaults to the process table. */\n readonly alive?: (pid: number) => boolean\n}\n\n/** The claim and announcement this process holds, and the one call that gives them back. */\nexport interface SelfAnnouncement {\n readonly id: string\n readonly port?: number\n /** Take the announcement and the lock back. Idempotent, and it never removes another process's claim. */\n release(): void\n}\n\n/** Refused because another live process already runs this app. */\nexport class InstanceAnnounceError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'InstanceAnnounceError'\n }\n}\n\nfunction describeHolder(instance: AppInstance, holder: { readonly pid: number, readonly [key: string]: unknown }): string {\n const surface = typeof holder.surface === 'string' ? `, ${holder.surface}` : ''\n const port = typeof holder.port === 'number' ? `, port ${String(holder.port)}` : ''\n return `app \"${instance.id}\" is already running (pid ${String(holder.pid)}${surface}${port}). Stop it (node scripts/instances.mjs stop ${instance.id}) or start another app.`\n}\n\n/**\n * Claim `instance` for this process and announce it, with the real port. Throws {@link InstanceAnnounceError} when a different live process already holds\n * the app; a stale lock (its holder is gone) is taken over, as everywhere else in the instance module.\n */\nexport function announceSelf(instance: AppInstance, info: SelfAnnouncementInfo): SelfAnnouncement {\n const pid = info.pid ?? process.pid\n const osHome = info.osHome ?? osHomeDirectory()\n const entry = {\n id: instance.id,\n home: instance.home,\n pid,\n surface: info.surface,\n ...(info.port === undefined ? {} : { port: info.port }),\n }\n try {\n acquireLock(instance.runLockFile, entry, {\n ...(info.alive === undefined ? {} : { alive: info.alive }),\n // This process re-announcing (an engine swap under one root) keeps its own claim; any other live process is refused.\n compatible: current => current.pid === pid,\n describe: current => describeHolder(instance, current),\n })\n } catch (error) {\n if (error instanceof LockHeldError) throw new InstanceAnnounceError(error.message)\n throw error\n }\n announce(osHome, instance, entry)\n let released = false\n return Object.freeze({\n id: instance.id,\n ...(info.port === undefined ? {} : { port: info.port }),\n release(): void {\n if (released) return\n released = true\n withdraw(osHome, instance, pid)\n releaseLock(instance.runLockFile, pid)\n },\n })\n}\n","/**\n * The online channel's per-instance secret (spec 041 TB30, following TB03's threat model): a random token\n * written next to the instance's own run lock, readable only by the OS user that started the app (`0o600`,\n * the same directory mode the Registry and the offline lock already use). An external CLI operator on the\n * same machine, as the same OS user, can simply read it - no handshake, matching how Docker's own CLI trusts\n * a local socket it can open, and how Jupyter's own token file works. A different OS user is refused by\n * filesystem permissions alone; this adds no stronger boundary than that on purpose (TB03).\n *\n * Lives beside `offline-lock.ts` and `registry.ts` (not in `@acryldev/agent-control`) so both the Host plugin that\n * writes it and the CLI that reads it depend on the same shared package, neither on the other.\n *\n * @module @acryldev/harness-runtime/instance/online-secret\n */\n\nimport { randomBytes } from 'node:crypto'\nimport { chmodSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\n\n/** Plain file name, next to the run lock in the instance's own home. */\nexport const ONLINE_SECRET_FILE_NAME = 'agent-control-secret'\n\nexport function onlineSecretPath(appHome: string): string {\n return join(appHome, ONLINE_SECRET_FILE_NAME)\n}\n\n/**\n * Write a fresh secret for this run. Tied to the process, not persisted across restarts (a crashed app's\n * secret is orphaned the same way its run lock is; a fresh start writes a fresh one - TB03's rotation note).\n * @returns the secret, hex-encoded.\n */\nexport function writeOnlineSecret(appHome: string): string {\n const path = onlineSecretPath(appHome)\n mkdirSync(dirname(path), { recursive: true, mode: 0o700 })\n const secret = randomBytes(24).toString('hex')\n writeFileSync(path, secret, { mode: 0o600 })\n chmodSync(path, 0o600)\n return secret\n}\n\n/** Remove this run's secret; a caller can no longer authenticate to an instance that has shut down. */\nexport function removeOnlineSecret(appHome: string): void {\n rmSync(onlineSecretPath(appHome), { force: true })\n}\n\n/**\n * Read a running instance's secret (the CLI's own side, TB31): same OS user, so a plain read, no handshake.\n * @returns the secret, or undefined when the instance has no online channel (older version, or not yet started).\n */\nexport function readOnlineSecret(appHome: string): string | undefined {\n try {\n return readFileSync(onlineSecretPath(appHome), 'utf8').trim()\n } catch {\n return undefined\n }\n}\n","/**\n * ACRYL's own data root, nested one level above the DSH engine home it\n * composes.\n *\n * The stock DSH Desktop app (from dshdesktop.com) uses plain `~/.dsh`, and so\n * did every ACRYL surface until now — sharing that root made the two\n * genuinely different products silently share credentials/settings/sessions,\n * which is both confusing and useless for comparing ACRYL against a stock\n * DSH Desktop install side by side. ACRYL now owns `~/.acryl` and nests each\n * engine's artifacts under it by engine name:\n *\n * ```txt\n * ~/.acryl/ ACRYL's own root — everything not engine-specific\n * ~/.acryl/.dsh/ the DSH engine home (what DSH_HOME resolves to)\n * ~/.acryl/.pi/ reserved for a future pi.dev engine\n * ```\n *\n * `$ACRYL_HOME`, if a caller has set it, is authoritative: it is the\n * product-level root, so the DSH engine home becomes `<ACRYL_HOME>/.dsh`\n * regardless of any ambient `$DSH_HOME`. That is what makes\n * `ACRYL_HOME=/tmp/x acryl ...` a complete isolation switch. When\n * `$ACRYL_HOME` is unset, an explicit `$DSH_HOME` is still honored, and with\n * neither set the default is `<~/.acryl>/.dsh` rather than the harness's own\n * bare `~/.dsh`.\n *\n * @module @acryldev/harness-runtime/acryl-home\n */\n\nimport { selectInstance } from './instance/index.ts'\n\n/** ACRYL's own root directory name under the OS home. */\nexport const ACRYL_HOME_DIR_NAME = '.acryl'\n\n/** The DSH engine's directory name, nested under ACRYL's root. */\nexport const ACRYL_DSH_ENGINE_DIR_NAME = '.dsh'\n\n\n/** ACRYL's own root — `~/.acryl` unless `$ACRYL_HOME` overrides it. */\nexport function resolveAcrylHome(env: Record<string, string | undefined> = process.env): string {\n // Delegates to the one selector (instance/select.ts). A legacy DSH_HOME now also moves the ACRYL home (its parent when it is named `.dsh`), so state that\n // lives beside the engine home (the pinned pnpm shim, global extensions) is isolated with it instead of landing in the shared ~/.acryl.\n return selectInstance({ env }).home\n}\n\n/**\n * The DSH engine home ACRYL boots against. Precedence, highest first:\n *\n * 1. `$ACRYL_HOME` set -> `<acrylHome>/.dsh`. ACRYL is the product that owns\n * the root and engines nest inside it, so pinning ACRYL's root is a\n * **complete** isolation switch.\n * 2. `$DSH_HOME` set (and `$ACRYL_HOME` unset) -> that value, for callers\n * pointing ACRYL at an existing DSH home.\n * 3. Neither -> `<~/.acryl>/.dsh`, never the harness's own bare `~/.dsh`.\n *\n * An ambient `$DSH_HOME` must NOT outrank an explicit `$ACRYL_HOME`. That\n * ordering used to invert these, which made isolation silently unenforceable:\n * `DSH_HOME` is commonly exported in a developer shell (and set by the DSH\n * Desktop app), so `ACRYL_HOME=/tmp/x` would read and write the operator's\n * real `~/.dsh` unchanged - credentials, sessions and all. A cold-start or\n * clean-room test written that way passes while never being isolated.\n */\nexport function resolveAcrylDshHome(env: Record<string, string | undefined> = process.env): string {\n return selectInstance({ env }).dshHome\n}\n","import { dirname } from 'node:path'\nimport { fileURLToPath, pathToFileURL } from 'node:url'\nimport { Context } from '@deepseek-ai/cordis'\nimport { Group, Loader } from '@deepseek-ai/cordis-plugin-loader'\nimport { selectInstance } from './instance/index.ts'\n\nconst ENGINE_ENTRY_ID = 'acryl-engine'\n\n/**\n * Fallback resolution base for the host root's own Loader entries (the\n * \"acryl-engine-<id>\" row and mountRootInclude's sibling \"cordis:include\"\n * row - see the `ctx.baseUrl` assignment below for why). Never read for a\n * real client bundle - `dsh-client-modules` finds no client export at this\n * location and skips, exactly as it does for any other non-client entry -\n * so its value need not track a specific engine's own profile location.\n */\nconst HOST_ROOT_BASE_URL = pathToFileURL(dirname(fileURLToPath(import.meta.url))).href + '/'\n\ntype CordisPlugin = Parameters<Context['plugin']>[0]\n\nexport interface AcrylEngineDefinition {\n readonly id: string\n readonly plugin: CordisPlugin\n readonly config?: Record<string, unknown>\n}\n\nexport interface AcrylEngineHost {\n readonly ctx: Context\n currentEngine(): string\n select(id: string): Promise<void>\n dispose(): Promise<void>\n}\n\n/**\n * Own the one Cordis root that selects an engine provider. Individual engines\n * are Loader entries beneath this host, so replacing a provider keeps the host\n * and its consumers alive while Cordis performs ordinary dependency rebinding.\n */\nexport async function createAcrylEngineHost(input: {\n readonly engines: readonly AcrylEngineDefinition[]\n readonly initialEngine: string\n /**\n * Register surface-owned services on the bare root before any engine\n * mounts - mirrors `boot()`'s own `prepare` timing exactly (Loader is\n * plugged, no config-tree entry has mounted yet), so a surface with its\n * own non-engine capabilities (e.g. Desktop's profile/market/plugin-\n * lifecycle services) can provide them ahead of an engine's Loader entries\n * that `ctx.inject`/`ctx.get` them.\n */\n readonly prepare?: (ctx: Context) => Promise<void> | void\n}): Promise<AcrylEngineHost> {\n const engines = new Map<string, AcrylEngineDefinition>()\n for (const engine of input.engines) {\n if (engine.id.trim() === '') throw new Error('ACRYL engine id must not be empty')\n if (engines.has(engine.id)) throw new Error(`duplicate ACRYL engine: ${engine.id}`)\n engines.set(engine.id, engine)\n }\n const initial = engines.get(input.initialEngine)\n if (initial === undefined) throw new Error(`unknown ACRYL engine: ${input.initialEngine}`)\n // Choose the app instance before anything mounts. Engines resolve their home inside plugin fibers, where a refusal (an invalid port, or the\n // isolation a gate or live run requires: `IsolationRequiredError`) would only fail that plugin and leave an app that boots without its profile and\n // exits 0. Here it stops the host, for every surface.\n selectInstance()\n\n const ctx = new Context()\n // `EntryTree`'s constructor snapshots `ctx.baseUrl` once, as an own\n // property (`ctx.extend({ baseUrl: ctx.baseUrl })`) - not a live read - at\n // the moment the Loader plugin constructs its root tree, i.e. exactly this\n // `ctx.plugin(Loader)` call below. Every entry created directly on this\n // root (the \"acryl-engine-<id>\" row this function creates, and\n // mountRootInclude's sibling \"cordis:include\" row - see engine-dsh.ts)\n // permanently inherits whatever `ctx.baseUrl` was at this line; setting it\n // later (inside an engine's own plugin, or even inside `prepare` below,\n // which also runs after this line) cannot reach that already-taken\n // snapshot. Reproduced directly: Desktop's real composition failed with\n // \"loader entry cordis:acryl-engine-dsh has no resolution base URL\" from\n // `dsh-client-modules` (Desktop composes client bundles; CLI/TUI does not,\n // which is why no automated test caught this) before this assignment\n // existed - confirmed via `entry.parent.tree.ctx.baseUrl` reading\n // `undefined` for exactly these two entries, and every entry nested one\n // level deeper (inside the profile's own composed tree, constructed later\n // from a ctx that does have baseUrl set) reading correctly.\n ctx.baseUrl = HOST_ROOT_BASE_URL\n await ctx.plugin(Loader)\n const entryFor = (engine: AcrylEngineDefinition) => ({\n id: ENGINE_ENTRY_ID,\n name: `cordis:acryl-engine-${engine.id}`,\n ...(engine.config === undefined ? {} : { config: engine.config }),\n })\n try {\n await input.prepare?.(ctx)\n ctx.loader.builtins.group = Group\n for (const engine of engines.values()) ctx.loader.builtins[`acryl-engine-${engine.id}`] = engine.plugin\n await ctx.loader.create(entryFor(initial))\n await ctx.loader.await()\n } catch (error) {\n await ctx.fiber.dispose()\n throw error\n }\n\n let active = initial.id\n let disposed = false\n\n return Object.freeze({\n ctx,\n currentEngine: () => active,\n async select(id: string): Promise<void> {\n if (disposed) throw new Error('ACRYL engine host is disposed')\n const next = engines.get(id)\n if (next === undefined) throw new Error(`unknown ACRYL engine: ${id}`)\n if (next.id === active) return\n // Loader 1.0.5 (Cordis family of DSH 0.2) re-imports a row only when it is created: `Entry.update` on a running row applies a\n // changed `config` but ignores a changed plugin `name`. So a swap removes the row (waiting for its fiber to finish\n // disposing, so the old engine's effects stop before the new one's start) and creates it again under the same stable id.\n const previous = ctx.loader.resolve(ENGINE_ENTRY_ID).fiber\n ctx.loader.remove(ENGINE_ENTRY_ID)\n await previous?.dispose()\n await ctx.loader.create(entryFor(next))\n await ctx.loader.await()\n active = next.id\n },\n async dispose(): Promise<void> {\n if (disposed) return\n disposed = true\n await ctx.fiber.dispose()\n },\n })\n}\n","/** Generated by scripts/generate-web-favicon.mjs from assets/brand/favicon/ (smooth, black on white). Do not ed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7uwYvqaAhx8FeAL3hsQ1KPFi6pSrqXiTdQPhkvXT6IV7BdS0T0pXw2brpQlG8ouvKAvBcBGQtAJSHoNCKeHKwMLHDFqgVJA5f9ERRXgBxwb7EoUnW+8xeGI/JNZ2YvBhMxEENdUZIjAFNIzX0VFwUJoLYlIiao4ZCZ8UJ59aEgCgFQs3BBgATADRCBIzXufoAmK0HMuLCMSHbU56VuANIjUTS/gJgKID/ANgaAlIVCJSDrYm6H1JVqoGoW14i/1h/ABMT2W6Y03dl4ksC+nmM6DW4XYm6Yx2yLlmnrNtrE3WdSs8VhP0PzYWN64PVzZ4AAAAASUVORK5CYII='\n","/**\n * The ACRYL tab icons for the Web surface: the smooth black-on-white logo in the sizes browsers ask for\n * (ICO, 16, 32 and the Apple touch icon), inlined as data URLs so serving them needs no route and no file\n * next to the bundle. Sources live in `assets/brand/favicon/`; `scripts/generate-web-favicon.mjs` regenerates the data.\n */\n\nimport { APPLE_TOUCH_ICON_BASE64, FAVICON_16_BASE64, FAVICON_32_BASE64, FAVICON_ICO_BASE64 } from './web-favicon-data.ts'\n\n/** The `<link>` tags that replace the pinned frontend's DeepSeek icon links. */\nexport const WEB_FAVICON_LINKS = [\n `<link rel=\"icon\" href=\"data:image/x-icon;base64,${FAVICON_ICO_BASE64}\" sizes=\"any\">`,\n `<link rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"data:image/png;base64,${FAVICON_32_BASE64}\">`,\n `<link rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"data:image/png;base64,${FAVICON_16_BASE64}\">`,\n `<link rel=\"apple-touch-icon\" sizes=\"180x180\" href=\"data:image/png;base64,${APPLE_TOUCH_ICON_BASE64}\">`,\n].join('')\n\nconst ICON_LINK = /<link\\b[^>]*\\brel=[\"'](?:shortcut icon|icon|apple-touch-icon)[\"'][^>]*>\\s*/gi\n\n/** @param html - the served index; drops any existing icon links, then adds ACRYL's before `</head>`. */\nexport function applyWebFavicon(html: string): string {\n return html.replace(ICON_LINK, '').replace(/<\\/head>/i, `${WEB_FAVICON_LINKS}</head>`)\n}\n\nconst escapeHtml = (text: string): string => text.replace(/[&<>\"']/gu, character => `&#${String(character.charCodeAt(0))};`)\n\n/** What the served page needs to know about its brand. */\nexport interface WebIndexBrand {\n /** The product name the page title carries; `ACRYL` when absent. */\n readonly productName?: string\n /** The stock ACRYL brand (not a Blueprint's own): it wears the ACRYL icon. A custom brand ships its own icon (@acryldev/brand). */\n readonly stockBrand?: boolean\n}\n\n/**\n * @param html - the served index of the pinned frontend.\n * @param brand - whose page this is.\n * @returns the index with the brand's title, and for the stock ACRYL brand the ACRYL icon in place of DeepSeek's. A composition that names neither\n * a product nor a brand kind is the stock one.\n */\nexport function brandWebIndex(html: string, brand: WebIndexBrand): string {\n const titled = html.replace(/<title>[^<]*<\\/title>/i, () => `<title>${escapeHtml(brand.productName ?? 'ACRYL')}</title>`)\n return brand.stockBrand === true || (brand.productName === undefined && brand.stockBrand === undefined) ? applyWebFavicon(titled) : titled\n}\n","/**\n * The `acrylTools` provider: ACRYL's tools port (`@acryldev/control`) answered by DeepSeek Harness's tool registry today. A thin delegate: a tool defined\n * through the port is an ordinary Harness tool (same `defineTool`, same registry), a call through `execute` runs the registry's whole pipeline, and a\n * policy registered through `policy` is a `tools/pre-execute` hook like any other. When the registry is replaced the adapter and its consumers unload\n * together and register again.\n *\n * @module @acryldev/harness-runtime/engine-tools\n */\n\nimport type { Context } from '@deepseek-ai/cordis'\nimport { defineTool } from '@deepseek-ai/dsh-tools'\nimport type { AcrylTools } from '@acryldev/control'\n\n/** Provide `acrylTools` on `ctx`, which must be able to see `tools` (call it inside `ctx.inject(['tools'], ...)`). */\nexport function provideAcrylTools(ctx: Context): void {\n const port: AcrylTools = {\n register: definition => ctx.tools.register(defineTool(definition as never)),\n get: name => ctx.tools.get(name) as ReturnType<AcrylTools['get']>,\n execute: input => ctx.tools.execute(input as never) as Promise<Awaited<ReturnType<AcrylTools['execute']>>>,\n policy: handler => ctx.on('tools/pre-execute', handler as never),\n }\n ctx.effect(() => {\n const dispose = ctx.reflect.provide('acrylTools', port)\n return () => { void dispose() }\n }, '@acryldev/harness-runtime: acrylTools')\n}\n","/**\n * One pnpm for every surface. `dsh plugin add` shells out to a bare `pnpm` found on PATH, so the Web and CLI surfaces used whatever pnpm\n * the user's machine had (measured: 12.4.2 against a repository pinned to 11.8.0 and a profile created by pnpm 9), and a different major\n * refuses an existing modules directory (ERR_PNPM_PUBLIC_HOIST_PATTERN_DIFF). Desktop already bundles the pinned pnpm behind its own PATH\n * shim; this gives Web and CLI the same: the `pnpm` package this runtime depends on, exposed as a `pnpm` shim first on the PATH of the\n * spawned `dsh plugin` process. When the package cannot be resolved the environment is returned unchanged, so a broken install degrades to\n * the previous behavior instead of failing.\n */\nimport { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport { delimiter, dirname, join } from 'node:path'\nimport { resolveAcrylHome } from './acryl-home.ts'\n\nconst require = createRequire(import.meta.url)\n\nexport interface PinnedPnpm {\n /** Absolute path of the pinned pnpm entry (`bin/pnpm.mjs`). */\n readonly entry: string\n /** The pinned version (`package.json` of the resolved `pnpm` package). */\n readonly version: string\n}\n\n/** The pnpm this runtime depends on, or undefined when it is not installed. */\nexport function resolvePinnedPnpm(): PinnedPnpm | undefined {\n try {\n // The package exports only `.` (its package.json), so resolving the bare name yields the manifest path.\n const manifestPath = require.resolve('pnpm')\n const manifest = JSON.parse(readFileSync(manifestPath, 'utf8')) as { version?: string }\n const entry = join(dirname(manifestPath), 'bin', 'pnpm.mjs')\n return existsSync(entry) && typeof manifest.version === 'string' ? { entry, version: manifest.version } : undefined\n } catch {\n return undefined\n }\n}\n\nfunction writeIfChanged(path: string, content: string, mode: number): void {\n if (existsSync(path) && readFileSync(path, 'utf8') === content) return\n writeFileSync(path, content, { mode })\n chmodSync(path, mode)\n}\n\n/**\n * Environment for a spawned `dsh plugin` process with the pinned pnpm first on PATH.\n * @param env - the parent environment.\n * @param binDir - where the shim lives (default: `<acryl home>/runtime/pnpm-bin`).\n * @param platform - target platform (tests).\n */\nexport function pinnedPnpmEnv(\n env: NodeJS.ProcessEnv = process.env,\n binDir: string = join(resolveAcrylHome(env), 'runtime', 'pnpm-bin'),\n platform: NodeJS.Platform = process.platform,\n): NodeJS.ProcessEnv {\n const pinned = resolvePinnedPnpm()\n if (pinned === undefined) return env\n try {\n mkdirSync(binDir, { recursive: true, mode: 0o700 })\n if (platform === 'win32') {\n writeIfChanged(join(binDir, 'pnpm.cmd'), `@echo off\\r\\n\"${process.execPath}\" \"${pinned.entry}\" %*\\r\\n`, 0o600)\n } else {\n writeIfChanged(join(binDir, 'pnpm'), `#!/bin/sh\\nexec \"${process.execPath}\" \"${pinned.entry}\" \"$@\"\\n`, 0o755)\n }\n } catch {\n return env\n }\n const pathKey = platform === 'win32' ? (Object.keys(env).find(key => key.toLowerCase() === 'path') ?? 'Path') : 'PATH'\n return { ...env, [pathKey]: [binDir, env[pathKey]].filter(Boolean).join(delimiter) }\n}\n","/**\n * Keep a profile's recorded pnpm layout authoritative before any pnpm operation.\n *\n * A profile's `node_modules/.modules.yaml` records the `nodeLinker` and\n * `publicHoistPattern` its dependencies were installed with. The profile's\n * `pnpm-workspace.yaml` may say something else (a profile created by pnpm 9\n * ignored `nodeLinker: hoisted`; pnpm >= 10 honors it). When they differ, pnpm\n * silently relinks the whole tree - measured: a hoisted relink exposed stale\n * top-level `@deepseek-ai/*` packages that shadowed the harness's and stopped\n * the app from starting. Pinning the recorded values into the workspace file\n * makes every pnpm (pinned 11.x, or whatever is on PATH) keep the layout that\n * is already on disk. Only a deliberate, human-run reinstall changes layout.\n */\nimport { existsSync, readFileSync, renameSync, writeFileSync } from 'node:fs'\nimport { join } from 'node:path'\nimport { isMap, parse, parseDocument } from 'yaml'\n\nconst NODE_LINKERS = ['isolated', 'hoisted', 'pnp'] as const\ntype NodeLinker = (typeof NODE_LINKERS)[number]\n\n/** Which profile a pnpm service operates on. */\nexport interface PnpmProfileConfig {\n readonly name: string\n readonly dir: string\n}\n\n/** What a reconcile changed; empty when the workspace file already agreed. */\nexport interface LayoutChange {\n readonly key: 'nodeLinker' | 'publicHoistPattern'\n readonly from: unknown\n readonly to: unknown\n}\n\ninterface RecordedLayout {\n readonly nodeLinker?: NodeLinker\n readonly publicHoistPattern?: readonly string[]\n}\n\nfunction readRecorded(modulesFile: string): RecordedLayout {\n let raw: unknown\n try { raw = parse(readFileSync(modulesFile, 'utf8')) } catch { return {} }\n if (raw === null || typeof raw !== 'object') return {}\n const record = raw as Record<string, unknown>\n const linker = NODE_LINKERS.find(value => value === record['nodeLinker'])\n const pattern = record['publicHoistPattern']\n return {\n ...(linker === undefined ? {} : { nodeLinker: linker }),\n ...(Array.isArray(pattern) && pattern.every(item => typeof item === 'string') ? { publicHoistPattern: pattern as string[] } : {}),\n }\n}\n\nconst sameList = (a: unknown, b: readonly string[]): boolean =>\n Array.isArray(a) && a.length === b.length && a.every((item, index) => item === b[index])\n\n/**\n * Pin the recorded `nodeLinker` / `publicHoistPattern` into the profile's `pnpm-workspace.yaml`.\n * A profile with no installed `node_modules` (or no workspace file) has no layout to protect and is left alone.\n * @returns the changes made (empty when nothing needed pinning)\n */\nexport function reconcileProfileLayout(profileDir: string): LayoutChange[] {\n const modulesFile = join(profileDir, 'node_modules', '.modules.yaml')\n const workspaceFile = join(profileDir, 'pnpm-workspace.yaml')\n if (!existsSync(modulesFile) || !existsSync(workspaceFile)) return []\n const recorded = readRecorded(modulesFile)\n const document = parseDocument(readFileSync(workspaceFile, 'utf8'))\n if (!isMap(document.contents)) return []\n\n const changes: LayoutChange[] = []\n if (recorded.nodeLinker !== undefined) {\n const declared: unknown = document.get('nodeLinker') ?? 'isolated'\n if (declared !== recorded.nodeLinker) {\n changes.push({ key: 'nodeLinker', from: declared, to: recorded.nodeLinker })\n document.set('nodeLinker', recorded.nodeLinker)\n }\n }\n if (recorded.publicHoistPattern !== undefined) {\n const declared: unknown = document.get('publicHoistPattern')\n // Absent means \"pnpm's own default\", which differs across majors (9: eslint/prettier, 12: empty).\n if (!sameList(isMapValue(declared), recorded.publicHoistPattern)) {\n changes.push({ key: 'publicHoistPattern', from: isMapValue(declared), to: recorded.publicHoistPattern })\n document.set('publicHoistPattern', recorded.publicHoistPattern)\n }\n }\n if (changes.length === 0) return []\n const temp = `${workspaceFile}.acryl-tmp`\n writeFileSync(temp, document.toString())\n renameSync(temp, workspaceFile)\n return changes\n}\n\n/** `document.get` returns a YAML node wrapper for collections; unwrap to plain JSON. */\nfunction isMapValue(value: unknown): unknown {\n if (value !== null && typeof value === 'object' && 'toJSON' in value && typeof value.toJSON === 'function') {\n return (value as { toJSON(): unknown }).toJSON()\n }\n return value\n}\n","/**\n * CLI/TUI's own `desktopProfiles`/`desktopPnpm` capabilities (spec 034,\n * completing T006 for the third surface) - what `@acryldev/cordis-plugin-market`'s\n * install service needs for a CLI-driven Market install/uninstall to do a\n * real package operation, instead of the \"ACRYL is required\" gate it shows\n * without them.\n *\n * Adapted directly from `web-market-install.ts` - see that file's own doc\n * comment for why this is deliberately not a port of Desktop's much larger\n * `pnpm.ts`/`install-recovery.ts` (a crash-recovery WAL built around\n * Electron's own generation-restart cycle, which neither Web nor a CLI\n * process has an equivalent of). The one real difference from Web: the CLI\n * has more than one named profile (Web's is always `web`), so the profile\n * name is a constructor parameter here, not a literal.\n *\n * Install mechanics reuse `dsh plugin --profile <name> add/remove`, the same\n * path a human operator already uses - confirmed (like Web) to have no\n * `--profile` restriction, unlike Desktop's packaged CLI.\n */\n\nimport { spawn } from 'node:child_process'\nimport { createRequire } from 'node:module'\nimport { dirname, join } from 'node:path'\nimport { PassThrough, Readable } from 'node:stream'\nimport { type Context, Service } from '@deepseek-ai/cordis'\nimport { pinnedPnpmEnv } from './pinned-pnpm.ts'\nimport { reconcileProfileLayout, type PnpmProfileConfig } from './profile-layout.ts'\n\n/** Matches `@acryldev/cordis-plugin-market`'s own `MarketDesktopProfile` shape. */\nexport interface CliMarketProfile {\n readonly name: string\n readonly dir: string\n}\n\n/** Matches `@acryldev/cordis-plugin-market`'s own `MarketDesktopPnpmOutcome` shape. */\nexport interface CliMarketPnpmOutcome {\n readonly exitCode: number | null\n readonly signal: NodeJS.Signals | null\n}\n\n/** Matches `@acryldev/cordis-plugin-market`'s own `MarketDesktopPnpmHandle` shape. */\nexport interface CliMarketPnpmHandle {\n readonly stdout: Readable\n readonly stderr: Readable\n readonly done: Promise<CliMarketPnpmOutcome>\n cancel(): void\n}\n\n// No `declare module '@deepseek-ai/cordis'` augmentation here - same reason\n// as web-market-install.ts: acryl-desktop's own pnpm.ts/desktop-plugins.ts\n// already declare these names on Context with their own, richer types, and\n// `Service`'s constructor takes a plain string name, not `keyof Context`, so\n// providing under these exact names needs no static declaration at all.\n\n/** Matches `@acryldev/cordis-plugin-market`'s own `MarketDesktopPnpm` shape exactly. */\nexport interface CliMarketPnpm {\n runPlugin(args: readonly string[], invokingDir: string, signal?: AbortSignal): CliMarketPnpmHandle\n installPlugin(request: {\n readonly pnpmOptions?: readonly string[]\n readonly invokingDir: string\n readonly recovery: { readonly packageName: string; readonly packageVersion: string; readonly receiptId: string }\n readonly signal?: AbortSignal\n }): Promise<CliMarketPnpmHandle>\n recoveredInstallReceiptIds(): Promise<readonly string[]>\n acknowledgeRecoveredInstall(receiptId: string): Promise<void>\n rollbackPluginInstall(receiptId: string): Promise<boolean>\n acknowledgeLiveInstall(packageName: string): Promise<void>\n}\n\nconst require = createRequire(import.meta.url)\n\n/** Absolute path to the pinned `@deepseek-ai/dsh` CLI's own compiled entry. */\nfunction resolveDshBin(): string {\n const manifestPath = require.resolve('@deepseek-ai/dsh/package.json')\n return join(dirname(manifestPath), 'lib/bin.js')\n}\n\n/** The one profile this TUI process actually booted. */\nexport class CliProfilesService extends Service {\n constructor(ctx: Context, private readonly profile: CliMarketProfile) {\n super(ctx, 'desktopProfiles')\n }\n\n get current(): CliMarketProfile {\n return this.profile\n }\n}\n\n/**\n * Runs `dsh plugin --profile <name> <verb> <...args>` as a real child\n * process, inheriting this process's own `DSH_HOME` - `-w` included for\n * pnpm's own workspace-root safety check on a profile's single-package pnpm\n * workspace (identical reproduction to Web's and Desktop's own install path).\n */\nexport class CliPnpmService extends Service implements CliMarketPnpm {\n private readonly dshBin: string\n private readonly profileName: string\n private readonly profileDir: string\n\n constructor(ctx: Context, config: PnpmProfileConfig) {\n super(ctx, 'desktopPnpm')\n this.profileName = config.name\n this.profileDir = config.dir\n this.dshBin = resolveDshBin()\n }\n\n runPlugin(args: readonly string[], _invokingDir: string, signal?: AbortSignal): CliMarketPnpmHandle {\n // Never let a pnpm relink a profile another pnpm laid out (see profile-layout.ts).\n reconcileProfileLayout(this.profileDir)\n const child = spawn(process.execPath, [this.dshBin, 'plugin', '--profile', this.profileName, ...args, '-w'], {\n // The pinned pnpm, not whatever the machine has on PATH (see pinned-pnpm.ts).\n env: pinnedPnpmEnv(process.env),\n signal,\n })\n const stdout = new PassThrough()\n const stderr = new PassThrough()\n child.stdout?.pipe(stdout)\n child.stderr?.pipe(stderr)\n // 'close', not 'exit': 'exit' can fire before the piped stdout/stderr\n // have finished draining into `stdout`/`stderr` above, which raced a\n // real caller reading `stderr` after `done` resolved - a fast failure\n // (this profile's dsh wrapper prints one line and exits immediately)\n // showed a near-empty stderr capture because the pipe hadn't flushed\n // yet. 'close' is Node's own guarantee that both streams have ended.\n const done = new Promise<CliMarketPnpmOutcome>((resolve, reject) => {\n child.once('error', reject)\n child.once('close', (exitCode, exitSignal) => resolve({ exitCode, signal: exitSignal }))\n })\n return {\n stdout,\n stderr,\n done,\n cancel: () => { child.kill() },\n }\n }\n\n async installPlugin(request: {\n readonly pnpmOptions?: readonly string[]\n readonly invokingDir: string\n readonly recovery: { readonly packageName: string; readonly packageVersion: string; readonly receiptId: string }\n readonly signal?: AbortSignal\n }): Promise<CliMarketPnpmHandle> {\n const target = `${request.recovery.packageName}@${request.recovery.packageVersion}`\n const options = request.pnpmOptions === undefined ? [] : [...request.pnpmOptions]\n // A version of ACRYL's own tooling published minutes before an install\n // attempt is the normal case here (Market installs are how a person\n // actually picks up a just-published plugin), not the untrusted-fresh-\n // package scenario pnpm's own `minimumReleaseAge` supply-chain default\n // guards against - reproduced directly: a real install of a package\n // this session had itself published minutes earlier failed with\n // `ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION` on a pnpm whose default\n // enables the policy. Overridden only for this one `add` invocation,\n // not the user's global pnpm config, which stays untouched.\n return this.runPlugin(['add', '--config.minimum-release-age=0', ...options, target], request.invokingDir, request.signal)\n }\n\n // No crash-recovery WAL (see this module's own doc comment) - there is\n // never anything to report as recovered, acknowledge, or roll back.\n async recoveredInstallReceiptIds(): Promise<readonly string[]> {\n return []\n }\n\n async acknowledgeRecoveredInstall(_receiptId: string): Promise<void> {}\n\n async rollbackPluginInstall(_receiptId: string): Promise<boolean> {\n return false\n }\n\n async acknowledgeLiveInstall(_packageName: string): Promise<void> {}\n}\n\n/**\n * Provide `desktopProfiles`/`desktopPnpm` on the host root for this CLI\n * process's own booted profile.\n * @param ctx - the host root.\n * @param profile - the profile this TUI process actually composed.\n */\nexport function provideCliMarketInstall(ctx: Context, profile: CliMarketProfile): void {\n ctx.plugin(CliProfilesService, profile)\n ctx.plugin(CliPnpmService, { name: profile.name, dir: profile.dir })\n}\n","/**\n * The one persistent store of plugin enablement overrides, keyed by profile.\n *\n * Every surface that offers plugin enable/disable - Desktop's Lifecycle tab,\n * the Web panel, `acryl plugin enable` on the CLI - reads and writes the same\n * `plugin-lifecycle/state.json`, so a disable applies to the whole profile the\n * next time it boots no matter which surface asked for it.\n *\n * @module @acryldev/harness-runtime/plugin-lifecycle-state\n */\n\nimport { readFileSync } from 'node:fs'\nimport { chmod, lstat, mkdir, readFile } from 'node:fs/promises'\nimport { dirname, join } from 'node:path'\nimport { PROFILE_PATCH_FILENAME, resolveProfileDir } from '@deepseek-ai/dsh-app-boot'\nimport { isMap, isScalar, isSeq, parseDocument } from 'yaml'\nimport { withFileLock, writeFileAtomic } from './engine-files.ts'\nimport { resolveAcrylDshHome } from './acryl-home.ts'\n\nconst STATE_VERSION = 1\nconst STATE_FILE_MODE = 0o600\nconst STATE_DIRECTORY_MODE = 0o700\nconst MAX_STATE_BYTES = 64 * 1024\nconst MAX_PROFILES = 64\nconst MAX_OVERRIDES = 256\nconst MAX_PROFILE_NAME_BYTES = 255\n\n/** A well-formed runtime Loader entry id (`include:<row>` or a bare row id). */\nconst ENTRY_ID_PATTERN = /^(?:include:)?[a-z0-9](?:[a-z0-9._:@/-]{0,190}[a-z0-9])?$/iu\n\n/** Rejects a profile name, in the words of the surface that owns the rule. */\nexport type ProfileNameValidator = (profileName: string) => void\n\n/**\n * The portable rule: a profile name must be usable as one profile directory\n * under the harness home. A surface whose profiles are named by other rules\n * (Desktop's CLI accepts localized names) supplies its own validator instead.\n */\nexport function assertProfileName(name: string): void {\n if (typeof name !== 'string' || name.length === 0\n || name.includes('/') || name.includes('\\\\') || name === '.' || name === '..'\n || name === 'node_modules' || Buffer.byteLength(name, 'utf8') > MAX_PROFILE_NAME_BYTES\n || /[\\0-\\x1f\\x7f-\\x9f]/.test(name)\n || /[<>:\"|?*]/.test(name) || /[. ]$/.test(name)\n || /^(?:CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(?:\\..*)?$/i.test(name)) {\n throw new Error(`invalid profile name ${JSON.stringify(name)}`)\n }\n resolveProfileDir(name, '/')\n}\n\n/**\n * Persistence inputs: enough to read and write the override file for one\n * profile.\n */\nexport interface PluginLifecycleStatePersistence {\n readonly profileName: string\n readonly statePath: string\n /** Overrides {@link assertProfileName} when a surface names profiles its own way. */\n readonly validateProfileName?: ProfileNameValidator\n}\n\n/**\n * The one override file every surface reads and writes, inside the engine home\n * whose profiles these overrides describe.\n *\n * The overrides are a property of a profile, and the profiles themselves live\n * under the engine home - so the store shares their root, their lifetime, and\n * their isolation switch. It is deliberately not a surface's private data\n * directory (the Electron userData path it used to be), because then\n * `acryl plugin disable x` and the Desktop panel would give two different\n * answers about one profile: the defect spec 034 exists to fix.\n *\n * The engine home, not a bare `~/.acryl`, is also what keeps an isolated run\n * isolated: `resolveAcrylHome()` ignores `$DSH_HOME`, so a dev or throwaway\n * `DSH_HOME=~/.acryl-dev/.dsh` would otherwise read and write overrides in the\n * operator's real install. Every surface already agrees on this root - each one\n * boots through `resolveAcrylDshHome()`.\n *\n * @param dshHome - the engine home this process booted; defaults to the one\n * `$ACRYL_HOME` / `$DSH_HOME` resolve to.\n */\nexport function resolvePluginLifecycleStatePath(dshHome: string = resolveAcrylDshHome()): string {\n return join(dshHome, 'plugin-lifecycle', 'state.json')\n}\n\n/** Runtime entry id -> the patch-local row id it disables during composition. */\nexport function entryPatchId(entryId: string): string {\n return entryId.startsWith('include:') ? entryId.slice('include:'.length) : entryId\n}\n\n/** Whether a persisted disabled-entry id is structurally a Loader entry id. */\nexport function isPluginLifecycleEntryId(value: unknown): value is string {\n return typeof value === 'string' && value.length > 0 && value.length <= 200 && ENTRY_ID_PATTERN.test(value)\n}\n\n/**\n * A Loader row that was renamed before this state format settled: a disable kept under the old entry id applies to the row by its current id.\n * The Development Canvas row `desktop-development-canvas` took its package name `acryl-development-canvas` under the row-id rule (spec 048 T014).\n */\nconst RENAMED_ENTRY_IDS: Readonly<Record<string, string>> = Object.freeze({\n 'include:desktop-development-canvas': 'include:acryl-development-canvas',\n 'desktop-development-canvas': 'acryl-development-canvas',\n})\n\n/** Base-template bundles: never user-mutable. Every other profile bundle is. */\nexport const BASE_TEMPLATE_BUNDLE_NAMES: ReadonlySet<string> = new Set([\n '@deepseek-ai/dsh-base',\n '@deepseek-ai/dsh-web-app',\n])\n\ninterface ProfileState {\n readonly profileName: string\n readonly disabledEntries: readonly string[]\n}\n\ninterface PluginLifecycleStateV1 {\n readonly version: 1\n readonly profiles: readonly ProfileState[]\n}\n\nfunction emptyState(): PluginLifecycleStateV1 {\n return { version: STATE_VERSION, profiles: [] }\n}\n\nfunction stableCompare(left: string, right: string): number {\n return left < right ? -1 : left > right ? 1 : 0\n}\n\nfunction hasExactKeys(record: Record<string, unknown>, keys: readonly string[]): boolean {\n const actual = Object.keys(record).sort(stableCompare)\n const expected = [...keys].sort(stableCompare)\n return actual.length === expected.length\n && actual.every((key, index) => key === expected[index])\n}\n\nfunction parseState(value: unknown, validateProfileName: ProfileNameValidator): PluginLifecycleStateV1 {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) {\n throw new Error('plugin lifecycle state root must be an object')\n }\n const root = value as Record<string, unknown>\n if (!hasExactKeys(root, ['version', 'profiles'])\n || root.version !== STATE_VERSION\n || !Array.isArray(root.profiles)) {\n throw new Error('plugin lifecycle state version or profiles list is invalid')\n }\n if (root.profiles.length > MAX_PROFILES) {\n throw new Error('plugin lifecycle state contains too many profiles')\n }\n const names = new Set<string>()\n const profiles: ProfileState[] = []\n for (const raw of root.profiles) {\n if (raw === null || typeof raw !== 'object' || Array.isArray(raw)) {\n throw new Error('plugin lifecycle profile state must be an object')\n }\n const profile = raw as Record<string, unknown>\n if (!hasExactKeys(profile, ['profileName', 'disabledEntries'])\n || typeof profile.profileName !== 'string') {\n throw new Error('plugin lifecycle profile name is invalid')\n }\n validateProfileName(profile.profileName)\n if (names.has(profile.profileName)) {\n throw new Error(`duplicate plugin lifecycle profile ${JSON.stringify(profile.profileName)}`)\n }\n names.add(profile.profileName)\n if (!Array.isArray(profile.disabledEntries)\n || profile.disabledEntries.length > MAX_OVERRIDES\n || profile.disabledEntries.some(entryId => typeof entryId !== 'string')) {\n throw new Error(`disabledEntries for profile ${JSON.stringify(profile.profileName)} is invalid`)\n }\n // Any structurally valid Loader entry id is kept - the mutable set is\n // derived at runtime from the profile bundle list, not this file. A\n // malformed string, or one for an entry that no longer exists, is dropped\n // rather than treated as corruption: composition emits a disable patch by\n // id, and the Loader treats an unknown-id patch as a warning, not a fault.\n profiles.push({\n profileName: profile.profileName,\n disabledEntries: [...new Set((profile.disabledEntries as unknown[]).filter(isPluginLifecycleEntryId).map(entryId => entryId))]\n .sort(stableCompare),\n })\n }\n profiles.sort((left, right) => stableCompare(left.profileName, right.profileName))\n return { version: STATE_VERSION, profiles }\n}\n\nfunction validatorOf(persistence: PluginLifecycleStatePersistence): ProfileNameValidator {\n return persistence.validateProfileName ?? assertProfileName\n}\n\nfunction readState(persistence: PluginLifecycleStatePersistence): PluginLifecycleStateV1 {\n let source: string\n try {\n source = readFileSync(persistence.statePath, 'utf8')\n } catch (cause) {\n if ((cause as NodeJS.ErrnoException).code === 'ENOENT') return emptyState()\n throw cause\n }\n if (Buffer.byteLength(source, 'utf8') > MAX_STATE_BYTES) {\n throw new Error('plugin lifecycle state is too large')\n }\n return parseState(JSON.parse(source) as unknown, validatorOf(persistence))\n}\n\nfunction renderState(state: PluginLifecycleStateV1): string {\n return `${JSON.stringify(state, null, 2)}\\n`\n}\n\n/** Read disabled Loader entry ids for one profile. */\nexport function readDisabledPluginLifecycleEntries(\n persistence: PluginLifecycleStatePersistence,\n): ReadonlySet<string> {\n validatorOf(persistence)(persistence.profileName)\n const profile = readState(persistence).profiles\n .find(candidate => candidate.profileName === persistence.profileName)\n return new Set((profile?.disabledEntries ?? []).map(entry => RENAMED_ENTRY_IDS[entry] ?? entry))\n}\n\n/**\n * User-added profile bundles from `dsh.profile.bundles`, minus the base\n * template. Each such package's inserted Loader row is user-mutable. A missing\n * or malformed manifest yields an empty set (nothing user-mutable by bundle).\n */\nexport function readUserMutableBundleNames(profileDir: string): ReadonlySet<string> {\n let manifest: unknown\n try {\n manifest = JSON.parse(readFileSync(join(profileDir, 'package.json'), 'utf8'))\n } catch {\n return new Set()\n }\n const bundles = (manifest as { dsh?: { profile?: { bundles?: unknown } } })?.dsh?.profile?.bundles\n if (!Array.isArray(bundles)) return new Set()\n return new Set(\n bundles.filter((name): name is string =>\n typeof name === 'string' && !BASE_TEMPLATE_BUNDLE_NAMES.has(name)),\n )\n}\n\nasync function ensurePrivateStateDirectory(statePath: string): Promise<void> {\n const directory = dirname(statePath)\n await mkdir(directory, { recursive: true, mode: STATE_DIRECTORY_MODE })\n const stat = await lstat(directory)\n if (!stat.isDirectory() || stat.isSymbolicLink()) {\n throw new Error('plugin lifecycle state directory is not private')\n }\n await chmod(directory, STATE_DIRECTORY_MODE)\n}\n\n/** Persist one desired entry enablement with locking and atomic replace. */\nexport async function setPluginLifecycleEntryEnabled(\n persistence: PluginLifecycleStatePersistence,\n entryId: string,\n enabled: boolean,\n): Promise<void> {\n validatorOf(persistence)(persistence.profileName)\n if (!isPluginLifecycleEntryId(entryId)) throw new Error('plugin lifecycle entry id is malformed')\n await ensurePrivateStateDirectory(persistence.statePath)\n await withFileLock(persistence.statePath, async () => {\n const state = readState(persistence)\n const current = state.profiles.find(profile => profile.profileName === persistence.profileName)\n const disabled = new Set(current?.disabledEntries ?? [])\n if (enabled) disabled.delete(entryId)\n else disabled.add(entryId)\n const profiles = state.profiles.filter(profile => profile.profileName !== persistence.profileName)\n if (disabled.size > 0) {\n profiles.push({\n profileName: persistence.profileName,\n disabledEntries: [...disabled].sort(stableCompare),\n })\n }\n profiles.sort((left, right) => stableCompare(left.profileName, right.profileName))\n const next = parseState({ version: STATE_VERSION, profiles }, validatorOf(persistence))\n const rendered = renderState(next)\n if (Buffer.byteLength(rendered, 'utf8') > MAX_STATE_BYTES) {\n throw new Error('plugin lifecycle state is too large')\n }\n await writeFileAtomic(persistence.statePath, rendered, {\n mode: STATE_FILE_MODE,\n dirMode: STATE_DIRECTORY_MODE,\n })\n })\n}\n\n/**\n * Remove a disable DSH's own Plugins page wrote for one row into the profile's patch file (`{ id, disabled: true }`,\n * `plugin-manager/src/patch.ts`), keeping every comment and every other key. Before spec 001 T089 both pages wrote, each\n * to its own store, and a disable in either kept the row off however the other was set; now every toggle of a row ACRYL\n * admits goes through this lifecycle (DSH's page too, through ACRYL's plugin manager), and an enable clears the old\n * page's disable here, so the override file stays the row's only store. An entry left with only `id` (and `name`) is\n * removed; one with other keys keeps them.\n *\n * @returns whether the patch file changed.\n */\nexport async function clearProfilePatchDisable(profileDir: string, patchId: string): Promise<boolean> {\n const path = join(profileDir, PROFILE_PATCH_FILENAME)\n return withFileLock(path, async () => {\n let text: string\n try {\n text = await readFile(path, 'utf8')\n } catch (cause) {\n if ((cause as NodeJS.ErrnoException).code === 'ENOENT') return false\n throw cause\n }\n const document = parseDocument(text, { customTags: [{ tag: 'tag:yaml.org,2002:js', resolve: (value: string) => value }] })\n if (document.errors.length > 0 || !isSeq(document.contents)) return false\n const items = document.contents.items\n let changed = false\n for (let index = items.length - 1; index >= 0; index -= 1) {\n const item = items[index]\n if (!isMap(item) || item.has('insert') || document.getIn([index, 'id']) !== patchId || document.getIn([index, 'disabled']) !== true) continue\n item.delete('disabled')\n if (item.items.every(pair => ['id', 'name'].includes(String(isScalar(pair.key) ? pair.key.value : pair.key)))) {\n // A comment written above the removed entry stays, above whatever follows it.\n const comment = item.commentBefore\n items.splice(index, 1)\n if (comment !== undefined && comment !== null) {\n const next = items[index] as { commentBefore?: string | null } | undefined\n if (next !== undefined && next !== null && typeof next === 'object') next.commentBefore = next.commentBefore ? `${comment}\\n${next.commentBefore}` : comment\n else document.comment = document.comment ? `${document.comment}\\n${comment}` : comment\n }\n }\n changed = true\n }\n if (changed) await writeFileAtomic(path, String(document), { mode: STATE_FILE_MODE })\n return changed\n })\n}\n\n/**\n * Convert persisted overrides into profile overlay rows for the rows this\n * composition has. A disable patch matches its target by id only - no `name`,\n * so a row whose id and package name differ (e.g. `dsh-editor` /\n * `acryl-dsh-editor-plugin`) still disables. A disable whose row is not\n * composed (its plugin was uninstalled) yields no patch, so the Loader does not\n * warn on every boot; it stays stored, applies again when the plugin comes\n * back, and `acryl plugin doctor` reports it as a stale override.\n * @param persistence - the override file and profile to read.\n * @param composedRowIds - the Loader row ids the composition already has.\n * @returns one disable patch per stored disable whose row is composed.\n */\nexport function pluginLifecyclePatches(\n persistence: PluginLifecycleStatePersistence,\n composedRowIds: ReadonlySet<string>,\n): readonly { readonly id: string; readonly disabled: true }[] {\n return [...readDisabledPluginLifecycleEntries(persistence)]\n .map(entryPatchId)\n .filter(id => composedRowIds.has(id))\n .map(id => ({ id, disabled: true as const }))\n}\n","/**\n * The DSH-profile plugin lifecycle: one host policy, mounted as one Cordis\n * service, for every ACRYL surface (spec 034, T005).\n *\n * The lifecycle mechanics live in `@acryldev/control`'s host-neutral controller.\n * What is left here is the part that is the same on the Desktop, the Web host,\n * and the CLI: which rows a DSH profile admits to user control, where the\n * override file lives, and how a just-installed profile bundle inserts its row.\n * A surface that needs more (Desktop's Blend rows and market bookkeeping)\n * passes it in through the options rather than forking the policy.\n *\n * @module @acryldev/harness-runtime/plugin-lifecycle\n */\n\nimport { readFileSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport { dirname, join } from 'node:path'\nimport type { Context } from '@deepseek-ai/cordis'\nimport type { EntryGroup } from '@deepseek-ai/cordis-plugin-loader'\nimport { loadOverlayPatches } from '@deepseek-ai/dsh-app-boot'\nimport {\n AcrPluginLifecycleController,\n AcrPluginLifecycleService,\n PROTECTED_PLUGIN_ENTRY_REASON,\n PluginLifecycleError,\n type PluginLifecycleEntryRef,\n type PluginLifecycleHost,\n} from '@acryldev/control'\nimport {\n clearProfilePatchDisable,\n entryPatchId,\n readUserMutableBundleNames,\n setPluginLifecycleEntryEnabled,\n type PluginLifecycleStatePersistence,\n type ProfileNameValidator,\n} from './plugin-lifecycle-state.ts'\n\n/** Options every surface's DSH-profile lifecycle host is built from. */\nexport interface DshPluginLifecycleOptions {\n /** Profile whose override list this host reads and writes. */\n readonly profileName: string\n /** Profile directory - the source of the user-installed bundle list. */\n readonly profileDir: string\n /** Absolute path of the shared `plugin-lifecycle/state.json`. */\n readonly statePath: string\n /**\n * Loader row ids this surface itself admits to user control, in their runtime\n * spelling (`include:<row>` when the row is composed through an include).\n * Called on every policy read, so a surface may derive it lazily; the rows of\n * the profile's own `dsh.profile.bundles` are admitted on top of it.\n */\n readonly mutableEntryIds?: () => ReadonlySet<string>\n /** Name this host's bundle-patch diagnostics attribute a failure to. */\n readonly binName?: string\n /** Explanation shown for a non-mutable entry. */\n readonly protectedReason?: string\n /** Bookkeeping after a package leaves the Loader tree. Best effort. */\n readonly afterDeactivate?: (packageName: string) => Promise<void>\n /** Narrower reload-all sweep, when restarting every mutable entry is too much. */\n readonly reloadAllEntryIds?: () => ReadonlySet<string>\n /**\n * Resolves a bare module specifier from the profile's own module base (a\n * profile's `node_modules`, where a user-installed bundle lives) - normally\n * just `require.resolve`/`createRequire(...).resolve` bound to that base.\n * Despite the parameter's own name, `createDshPluginLifecycleHost`'s\n * internal caller always passes the full `\"<packageName>/package.json\"`\n * specifier already, never the bare package name - do not re-append\n * `/package.json` inside this callback (a real, reproduced bug: doing so\n * throws `ERR_PACKAGE_PATH_NOT_EXPORTED` on a literal\n * `package.json/package.json` subpath). Defaults to the context's base URL,\n * which is the profile directory for a surface that boots the profile\n * itself and is not for one whose root is elsewhere - the CLI composes the\n * profile under its own engine host, so it passes the profile-resolving\n * form explicitly.\n */\n readonly resolvePackageJson?: (specifier: string) => string\n /** Reports a best-effort failure that must not throw to its caller. */\n readonly warn?: (message: string) => void\n /** Profile-name rule, when this surface names profiles its own way. */\n readonly validateProfileName?: ProfileNameValidator\n}\n\ninterface BundleManifest {\n readonly name?: unknown\n readonly dsh?: { readonly bundle?: { readonly patch?: unknown } }\n}\n\n/**\n * Build the host policy for one DSH profile.\n *\n * @param ctx - the context whose Loader tree is being steered and whose\n * base URL resolves installed packages.\n * @param options - which profile, and whatever this surface adds to the\n * shared bundle policy.\n */\nexport function createDshPluginLifecycleHost(\n ctx: Context,\n options: DshPluginLifecycleOptions,\n): PluginLifecycleHost {\n const binName = options.binName ?? 'acryl'\n const resolveManifest = options.resolvePackageJson\n ?? (ctx.baseUrl === undefined ? undefined : createRequire(ctx.baseUrl).resolve)\n const resolvePackageJson = resolveManifest === undefined\n ? undefined\n : (packageName: string) => resolveManifest(`${packageName}/package.json`)\n const persistence: PluginLifecycleStatePersistence = {\n profileName: options.profileName,\n statePath: options.statePath,\n ...(options.validateProfileName === undefined\n ? {}\n : { validateProfileName: options.validateProfileName }),\n }\n // Re-read on every mutation, never cached across one: a package manager\n // writes `dsh.profile.bundles` milliseconds before it asks for a live mount.\n let userBundleNames = readUserMutableBundleNames(options.profileDir)\n\n const protectedReason = options.protectedReason ?? PROTECTED_PLUGIN_ENTRY_REASON\n const warn = options.warn ?? ((message: string) => { ctx.logger?.warn?.(message) })\n\n const isBundlePackage = (packageName: string): boolean => userBundleNames.has(packageName)\n\n /** The `{ id, name }` a profile bundle inserts, read from its own patch. */\n function bundleInsertRow(packageName: string): { readonly id: string; readonly name: string } {\n if (resolvePackageJson === undefined) {\n throw new PluginLifecycleError(\n 'lifecycle-failed',\n 'Package resolution is unavailable in this context.',\n )\n }\n const packageDir = dirname(resolvePackageJson(packageName))\n const manifest = JSON.parse(\n readFileSync(join(packageDir, 'package.json'), 'utf8'),\n ) as BundleManifest\n const patchRel = manifest.dsh?.bundle?.patch\n if (typeof patchRel !== 'string') {\n throw new PluginLifecycleError(\n 'lifecycle-failed',\n `Package ${packageName} declares no dsh.bundle.patch.`,\n )\n }\n const patches = loadOverlayPatches(binName, join(packageDir, patchRel)) as ReadonlyArray<{\n readonly insert?: ReadonlyArray<{ readonly id?: unknown; readonly name?: unknown }>\n }>\n const row = patches.find(patch => Array.isArray(patch.insert))?.insert?.[0]\n if (typeof row?.id !== 'string' || typeof row.name !== 'string') {\n throw new PluginLifecycleError(\n 'lifecycle-failed',\n `Package ${packageName} bundle patch has no insert row.`,\n )\n }\n return { id: row.id, name: row.name }\n }\n\n return {\n isMutable(entry: PluginLifecycleEntryRef): boolean {\n if (entry.group) return false\n if (options.mutableEntryIds?.().has(entry.entryId) === true) return true\n return isBundlePackage(entry.moduleName)\n },\n protectedReason: () => protectedReason,\n refresh(): void {\n userBundleNames = readUserMutableBundleNames(options.profileDir)\n },\n async setEnabled(entryId: string, enabled: boolean): Promise<void> {\n await setPluginLifecycleEntryEnabled(persistence, entryId, enabled)\n // One store per row (spec 001 T089): a disable DSH's page once wrote into the profile patch would keep the row off.\n if (enabled) await clearProfilePatchDisable(options.profileDir, entryPatchId(entryId))\n },\n bundleRow(packageName: string) {\n if (!isBundlePackage(packageName)) {\n throw new PluginLifecycleError(\n 'protected-entry',\n `Package ${packageName} is not a profile bundle in the active profile.`,\n )\n }\n return bundleInsertRow(packageName)\n },\n bundleGroup(): EntryGroup {\n const sibling = [...ctx.loader.entries()]\n .find(entry => !entry.options.group && entry.id.startsWith('include:'))\n if (sibling === undefined) {\n throw new PluginLifecycleError(\n 'lifecycle-failed',\n 'The profile include group is not available.',\n )\n }\n return sibling.parent\n },\n warn,\n ...(options.afterDeactivate === undefined ? {} : { afterDeactivate: options.afterDeactivate }),\n ...(options.reloadAllEntryIds === undefined ? {} : { reloadAllEntryIds: options.reloadAllEntryIds }),\n }\n}\n\n/**\n * Build the lifecycle authority for one context: the one controller every\n * surface drives. Publishes nothing, so a surface that composes its own\n * capabilities (Desktop) can build it before deciding what to register.\n *\n * @param ctx - the context whose Loader tree it steers.\n * @param options - that surface's DSH-profile lifecycle host options.\n */\nexport function createAcrylPluginLifecycle(\n ctx: Context,\n options: DshPluginLifecycleOptions,\n): AcrPluginLifecycleController {\n return new AcrPluginLifecycleController(ctx, createDshPluginLifecycleHost(ctx, options))\n}\n\n/**\n * Publish that authority on `ctx.acrPluginLifecycle` for the caller's fiber\n * lifetime. Every surface renders its own view of the snapshot; none of them\n * re-implements enable, disable, or reload.\n *\n * @param ctx - the plugin context the service belongs to.\n * @param options - that surface's DSH-profile lifecycle host options.\n */\nexport function mountAcrylPluginLifecycle(\n ctx: Context,\n options: DshPluginLifecycleOptions,\n): AcrPluginLifecycleService {\n return new AcrPluginLifecycleService(ctx, createAcrylPluginLifecycle(ctx, options))\n}\n","/**\n * CLI/TUI's own `desktopPlugins` + `livePluginActivation` capabilities (spec\n * 034, completing T006 for the third surface) - the package-name-shaped view\n * `@acryldev/cordis-plugin-market`'s install service needs, plus real live activation\n * so an install through the TUI's own `/plugins` command takes effect\n * without restarting the process.\n *\n * Adapted directly from `web-market-plugins.ts` - not a new lifecycle\n * implementation. It wraps the same shared `AcrPluginLifecycleController`\n * (spec 034 T005) the CLI's own `acryl plugin enable/disable` and Desktop's\n * Lifecycle tab already drive.\n */\n\nimport { randomUUID } from 'node:crypto'\nimport { type Context, Service } from '@deepseek-ai/cordis'\nimport type { AcrPluginLifecycleController } from '@acryldev/control'\nimport {\n mountAcrylPluginLifecycle,\n type DshPluginLifecycleOptions,\n} from './plugin-lifecycle.ts'\n\nexport interface CliMarketPluginBundle {\n readonly bundleId: string\n readonly packageName: string\n readonly status: 'active' | 'disabled'\n readonly mutable: boolean\n}\n\ninterface PreviewEntry {\n readonly entryId: string\n readonly packageName: string\n readonly targetEnabled: boolean\n readonly expiresAt: number\n}\n\n// No `declare module '@deepseek-ai/cordis'` augmentation here - same reason\n// as web-market-plugins.ts.\n\nconst PREVIEW_TTL_MS = 5 * 60 * 1000\nconst MAX_PREVIEWS = 256\n/** Matches @acryldev/cordis-plugin-market's own PACKAGE_NAME_PATTERN. */\nconst NPM_PACKAGE_NAME_PATTERN = /^(?:@[a-z0-9][a-z0-9._-]*\\/)?[a-z0-9][a-z0-9._-]*$/u\n\n/** Matches `@acryldev/cordis-plugin-market`'s own `MarketDesktopPlugins` shape exactly. */\nexport class CliPluginsService extends Service {\n private readonly previews = new Map<string, PreviewEntry>()\n\n private readonly controller: AcrPluginLifecycleController\n private readonly profileName: string\n\n constructor(ctx: Context, options: { readonly controller: AcrPluginLifecycleController; readonly profileName: string }) {\n super(ctx, 'desktopPlugins')\n this.controller = options.controller\n this.profileName = options.profileName\n }\n\n list(): readonly CliMarketPluginBundle[] {\n return this.controller.snapshot().entries\n .filter(entry => NPM_PACKAGE_NAME_PATTERN.test(entry.moduleName))\n .map(entry => ({\n bundleId: entry.entryId,\n packageName: entry.moduleName,\n status: entry.enabled ? 'active' : 'disabled',\n mutable: entry.mutable,\n }))\n }\n\n disabledPackageNames(): readonly string[] {\n return this.controller.snapshot().entries\n .filter(entry => !entry.enabled && NPM_PACKAGE_NAME_PATTERN.test(entry.moduleName))\n .map(entry => entry.moduleName)\n }\n\n isDisabled(packageName: string): boolean {\n return this.disabledPackageNames().includes(packageName)\n }\n\n private mintPreview(bundleId: string, targetEnabled: boolean): { readonly previewId: string; readonly profileName: string; readonly packageName: string; readonly expiresAt: string } {\n const entry = this.controller.snapshot().entries.find(candidate => candidate.entryId === bundleId)\n if (entry === undefined) throw new Error(`cli plugins: no such bundle ${JSON.stringify(bundleId)}`)\n if (!entry.mutable) throw new Error(`cli plugins: bundle ${JSON.stringify(bundleId)} is not user-mutable`)\n const expectedCurrent = !targetEnabled\n if (entry.enabled !== expectedCurrent) {\n throw new Error(`cli plugins: bundle ${JSON.stringify(bundleId)} is already ${entry.enabled ? 'enabled' : 'disabled'}`)\n }\n if (this.previews.size >= MAX_PREVIEWS) {\n const oldest = this.previews.keys().next().value\n if (oldest !== undefined) this.previews.delete(oldest)\n }\n const previewId = randomUUID()\n const expiresAt = Date.now() + PREVIEW_TTL_MS\n this.previews.set(previewId, { entryId: bundleId, packageName: entry.moduleName, targetEnabled, expiresAt })\n return { previewId, profileName: this.profileName, packageName: entry.moduleName, expiresAt: new Date(expiresAt).toISOString() }\n }\n\n previewDisable(bundleId: string) {\n return this.mintPreview(bundleId, false)\n }\n\n previewEnable(bundleId: string) {\n return this.mintPreview(bundleId, true)\n }\n\n // Same reasoning as WebPluginsService.execute() (web-market-plugins.ts):\n // `controller.setEnabled()` applies live via Cordis' reactive Loader before\n // resolving, so a resolved call always means `live: true`. Omitting this\n // field left `MarketDesktopPlugins.executeEnable/executeDisable`'s\n // `restartRequired` computation (@acryldev/cordis-plugin-market/src/host/routes.ts)\n // permanently `true` for CLI too - same copy-pasted gap as Web had.\n private async execute(previewId: string, targetEnabled: boolean): Promise<{ readonly packageName: string; readonly live: boolean }> {\n const preview = this.previews.get(previewId)\n if (preview === undefined || preview.targetEnabled !== targetEnabled) {\n throw new Error('cli plugins: preview not found or expired')\n }\n this.previews.delete(previewId)\n if (Date.now() > preview.expiresAt) throw new Error('cli plugins: preview expired')\n await this.controller.setEnabled(preview.entryId, targetEnabled)\n return { packageName: preview.packageName, live: true }\n }\n\n executeDisable(previewId: string): Promise<{ readonly packageName: string; readonly live: boolean }> {\n return this.execute(previewId, false)\n }\n\n executeEnable(previewId: string): Promise<{ readonly packageName: string; readonly live: boolean }> {\n return this.execute(previewId, true)\n }\n}\n\n/**\n * Live activation for a CLI/TUI process - the same shared\n * `AcrPluginLifecycleController` Web and Desktop already drive, mounting a\n * just-installed package into the live Loader tree without a process\n * restart. The TUI's own `/plugins` command calls this directly after a\n * successful install and then refreshes its own dynamic slash-command list\n * (spec 034 T009) - there is no separate renderer process to reload here,\n * unlike Web's `location.reload()` or Desktop's Client webContents reload.\n */\nexport class CliLiveActivationService extends Service {\n constructor(ctx: Context, private readonly controller: AcrPluginLifecycleController) {\n super(ctx, 'livePluginActivation')\n }\n\n async activate(packageName: string): Promise<void> {\n await this.controller.activate(packageName)\n }\n\n async deactivate(packageName: string): Promise<void> {\n await this.controller.deactivate(packageName)\n }\n\n requireModules(owner: string, modules: readonly string[]): Promise<void> {\n return this.controller.requireModules(owner, modules)\n }\n\n setEnabled(packageName: string, enabled: boolean): Promise<boolean> {\n return this.controller.setEnabledByPackageName(packageName, enabled)\n }\n\n statusOf(packageName: string): 'active' | 'disabled' | undefined {\n return this.controller.statusOfPackage(packageName)\n }\n}\n\n/**\n * Mount the shared plugin lifecycle for this CLI process and provide the\n * market-shaped view over it, plus live activation.\n * @param ctx - the host root.\n * @param options - the same options shape the CLI's own `plugin-command.ts` already builds.\n */\nexport function provideCliMarketPlugins(ctx: Context, options: DshPluginLifecycleOptions): AcrPluginLifecycleController {\n const lifecycle = mountAcrylPluginLifecycle(ctx, options)\n ctx.plugin(CliPluginsService, { controller: lifecycle.controller, profileName: options.profileName })\n ctx.plugin(CliLiveActivationService, lifecycle.controller)\n return lifecycle.controller\n}\n","/**\n * ACRYL's first real model-facing tool, registered as an ordinary Cordis plugin\n * on the native `ctx.tools` seam.\n *\n * @module @acryldev/harness-runtime/acryl-workspace-status\n *\n * This is the ACRYL hard gate: a genuine model-facing Tool that injects `tools`,\n * registers via `ctx.tools.register(defineTool(...))`, declares a canonical\n * typed `output.schema` and a separate `render(...)` for model-facing content,\n * honours `exec.signal`, and disposes cleanly when its owning Fiber unloads.\n * It is ACRYL-owned context (the workspace/profile the agent is running in) and\n * deliberately does NOT re-implement a DSH file/shell/web tool.\n */\n\nimport type { Context } from '@deepseek-ai/cordis'\nimport { defineTool } from '@deepseek-ai/dsh-tools'\nimport type { ContentBlock } from '@deepseek-ai/dsh-llm'\nimport { selectInstance } from './instance/index.ts'\n\n/** Cordis plugin name used by loader diagnostics. */\nexport const name = 'acryl-workspace-status'\n\n/** Services required: the tool registry. */\nexport const inject = ['tools']\n\n/** Canonical tool name exposed to the model. */\nexport const TOOL_NAME = 'acryl_workspace_status'\n\ninterface AcrylWorkspaceContext {\n readonly cwd: string\n readonly dshHome: string\n readonly profile: string\n readonly surface: string\n}\n\n/** Read the ACRYL workspace/profile context the agent is running under. */\nfunction readWorkspaceContext(): AcrylWorkspaceContext {\n return {\n cwd: process.cwd(),\n dshHome: selectInstance().dshHome,\n profile: process.env.ACRYL_PROFILE ?? '',\n surface: process.env.ACRYL_SURFACE ?? '',\n }\n}\n\n/** Render one line of the model-facing text from the canonical context value. */\nfunction fmt(\n label: string,\n value: string,\n prefix: string,\n): string {\n return `${prefix} ${label}: ${value}`\n}\n\n/** Register the `acryl_workspace_status` tool on `ctx.tools`. Returns a disposer. */\nexport function installAcrylWorkspaceStatusTool(ctx: Context): () => void {\n const tool = defineTool({\n name: TOOL_NAME,\n description:\n 'Report the ACRYL workspace context the agent is operating in: current working '\n + 'directory, DSH home, active ACRYL profile, and presentation surface. Use it to '\n + 'confirm which project/profile a session is bound to before acting.',\n parameters: {},\n output: {\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n cwd: { type: 'string', required: true },\n dshHome: { type: 'string', required: true },\n profile: { type: 'string', required: true },\n surface: { type: 'string', required: true },\n },\n },\n render(_args: unknown, value: unknown): ContentBlock[] {\n const v = value as AcrylWorkspaceContext\n const head = 'ACRYL workspace context:'\n const lines = [\n fmt('cwd', v.cwd, '-'),\n fmt('dshHome', v.dshHome || '<unset>', '-'),\n fmt('profile', v.profile || '<default>', '-'),\n fmt('surface', v.surface || '<unknown>', '-'),\n ]\n return [{ type: 'text', text: [head, ...lines].join('\\n') }]\n },\n },\n async execute(_args: unknown, _exec): Promise<AcrylWorkspaceContext> {\n // Same-process, zero-resource: no async work beyond a microtask so the\n // tool still honours the call/cancellation pipeline and quiesces.\n return readWorkspaceContext()\n },\n })\n return ctx.tools.register(tool)\n}\n\n/** Cordis plugin entry point for idiomatic composition via a Loader row. */\nexport function apply(ctx: Context): void {\n installAcrylWorkspaceStatusTool(ctx)\n}\n","/**\n * BrandIdentity: the value object a Blueprint carries so anyone who builds on ACRYL can ship it under their own name\n * (a private, closed-source product or an internal tool). Pure: no I/O, no framework types. Every invariant is\n * enforced at construction, so a Blueprint can never hold a brand the client cannot render.\n *\n * @module @acryldev/harness-runtime/blueprint/brand-identity\n */\n\nconst HEX_COLOR = /^#[0-9a-fA-F]{6}$/u\nconst MAX_NAME = 40\nconst MAX_TAGLINE = 120\nconst MAX_FONT_FAMILY = 200\nconst MAX_MARK = 3\n\nexport interface BrandIdentity {\n /** Product name shown in the sidebar, the tab or window title and the agent's own identity line. */\n readonly name: string\n readonly tagline?: string\n /** Accent color as `#rrggbb`; `accentDark` is the dark-mode variant (defaults to `accent`). */\n readonly accent?: string\n readonly accentDark?: string\n /** A CSS font-family list. */\n readonly fontFamily?: string\n /** One to three characters drawn as the logo mark when no image is supplied (defaults to the name's first letter). */\n readonly mark?: string\n}\n\nexport class InvalidBrandIdentityError extends Error {\n constructor(detail: string) {\n super(`Invalid brand identity: ${detail}`)\n this.name = 'InvalidBrandIdentityError'\n }\n}\n\nfunction optionalText(record: Record<string, unknown>, key: string, max: number): string | undefined {\n const value = record[key]\n if (value === undefined) return undefined\n if (typeof value !== 'string' || value.trim() === '' || value.length > max) {\n throw new InvalidBrandIdentityError(`\"${key}\" must be a non-empty string of at most ${String(max)} characters`)\n }\n return value.trim()\n}\n\nfunction optionalColor(record: Record<string, unknown>, key: string): string | undefined {\n const value = optionalText(record, key, 7)\n if (value !== undefined && !HEX_COLOR.test(value)) throw new InvalidBrandIdentityError(`\"${key}\" must be a #rrggbb color`)\n return value\n}\n\n/** Validate untrusted input (a YAML row config, an environment value) into a BrandIdentity. */\nexport function brandIdentity(input: unknown): BrandIdentity {\n if (input === null || typeof input !== 'object' || Array.isArray(input)) throw new InvalidBrandIdentityError('expected an object')\n const record = input as Record<string, unknown>\n const name = optionalText(record, 'name', MAX_NAME)\n if (name === undefined) throw new InvalidBrandIdentityError('\"name\" is required')\n const tagline = optionalText(record, 'tagline', MAX_TAGLINE)\n const accent = optionalColor(record, 'accent')\n const accentDark = optionalColor(record, 'accentDark')\n const fontFamily = optionalText(record, 'fontFamily', MAX_FONT_FAMILY)\n const mark = optionalText(record, 'mark', MAX_MARK)\n return {\n name,\n ...(tagline === undefined ? {} : { tagline }),\n ...(accent === undefined ? {} : { accent }),\n ...(accentDark === undefined ? {} : { accentDark }),\n ...(fontFamily === undefined ? {} : { fontFamily }),\n ...(mark === undefined ? {} : { mark }),\n }\n}\n\n/** The agent's opening identity line under this brand (what the system prompt says the agent is). */\nexport function identityLine(brand: BrandIdentity): string {\n // Domain-neutral on purpose: the app may be a music editor, an accounting tool or an IDE. It is the user's product, so it is named, not ACRYL.\n return `You are the assistant inside ${brand.name}. You help its users with what they ask, and you can extend ${brand.name} itself from the inside: when asked, you build, change and remove its plugins (tools, screens, commands) while it runs, and you can read files, run commands and write code to do so.`\n}\n","/**\n * Blueprint: a named, minimal starting composition of ACRYL. The stem cell of the framework: `blank` is the smallest\n * thing that is still a working agent, and everything else is grown from it by adding Cordis plugins (locally first,\n * published when worth sharing). `acryl.ide`, the agentic coding IDE the team ships, is not a separate product: it is one\n * Blend grown from `acryl.blank` (the flagship example of what the framework builds), and `grewFrom` records that lineage.\n *\n * A Blueprint is pure data, keyed by the ubiquitous language of the Blends spec: it names capabilities and optional\n * rows, never Loader mechanics. Turning it into Loader patches is `compose.ts`; choosing one is `selection.ts`.\n * Nothing here is special-cased in the runtime: every row a Blueprint names is an ordinary Cordis plugin, so adding\n * one later, or disabling one, is the same reversible row edit for a human, an agent or a Blend file.\n *\n * @module @acryldev/harness-runtime/blueprint/blueprint\n */\n\nimport { ACRYL_CODING_CAPABILITIES, type AcrylCodingCapabilityId, type AcrylShellMode } from '../coding-capabilities.ts'\nimport { brandIdentity, type BrandIdentity } from './brand-identity.ts'\n\n/** ACRYL-owned rows a Blueprint may include on top of the capabilities. Each is one independently replaceable plugin. */\nexport type BlueprintRowId =\n | 'plugin-context'\n | 'system-prompt'\n | 'ui-library'\n | 'community-market'\n | 'shortcuts'\n | 'mount-anchors'\n | 'app-save'\n | 'plugin-hub'\n | 'app-shell'\n | 'framework-kit'\n | 'command-reply'\n\n/** Every row id, as data: what a Blueprint file may name. Kept next to the type so the two cannot drift (a test asserts it). */\nexport const BLUEPRINT_ROW_IDS: readonly BlueprintRowId[] = ['plugin-context', 'system-prompt', 'ui-library', 'app-save', 'plugin-hub', 'community-market', 'shortcuts', 'mount-anchors', 'app-shell', 'framework-kit', 'command-reply']\n\n/** Row ids a Blueprint file once used, read as their current names (spec 044 step 1b); never written. */\nexport const RENAMED_BLUEPRINT_ROW_IDS: Readonly<Record<string, BlueprintRowId>> = Object.freeze({ 'extension-context': 'plugin-context' })\n\n/** `acryl`: the stock ACRYL brand plugin. `custom`: the configurable `@acryldev/brand` plugin carrying this identity. */\nexport type BlueprintBrand =\n | { readonly kind: 'acryl' }\n | { readonly kind: 'custom', readonly identity: BrandIdentity }\n\nexport interface Blueprint {\n readonly id: string\n readonly name: string\n readonly description: string\n readonly capabilities: readonly AcrylCodingCapabilityId[]\n readonly rows: readonly BlueprintRowId[]\n readonly brand: BlueprintBrand\n readonly shell: AcrylShellMode\n /**\n * Whether the DeepSeek Harness chat (its agent loop and model providers) is part of this composition. Off, the app keeps its frame\n * (tab stripe, workspaces, canvas, terminals, Agent Control) and other agents work in it; the DSH chat is one agent, not the foundation.\n * Applies to the Web and Desktop surfaces: the terminal UI is the DSH chat.\n */\n readonly dshChat: boolean\n /** The Blueprint this one was grown from, when it is a Blend of another (the IDE grew from the blank canvas). */\n readonly grewFrom?: string\n}\n\nfunction freezeBlueprint(blueprint: Blueprint): Blueprint {\n return Object.freeze(blueprint)\n}\n\n/**\n * The stem cell: an agent to talk to, a model chooser (authorization), an input, and the plugin context pack so the agent can\n * grow the rest. No workspace, no Market, no admin panel. The brand is configurable so it can be renamed without code.\n */\nexport const BLANK_BLUEPRINT: Blueprint = freezeBlueprint({\n id: 'acryl.blank',\n name: 'Blank',\n description: 'The smallest working agent that can grow itself: chat, model choice, and the plugin context pack.',\n // `@acryldev/settings` is essential: surface plugins (Desktop's shell, notifications) keep their preferences there.\n capabilities: ['persona', 'agent-roster', 'session-stats', 'authorization', 'acryl-settings'],\n rows: ['plugin-context', 'system-prompt', 'ui-library', 'app-save', 'plugin-hub', 'framework-kit', 'command-reply'],\n brand: { kind: 'custom', identity: brandIdentity({ name: 'Blank', tagline: 'Ask for what you need. It builds it.', accent: '#3b6ef5', accentDark: '#7c9dff' }) },\n shell: 'compatibility',\n dshChat: true,\n})\n\n/**\n * ACRYL the agentic coding IDE: the blank canvas grown into a development environment (workspace, plugin admin, Market, shortcuts, mount anchors, the\n * advanced shell, the ACRYL brand). Written as blank plus what it added, so the lineage is the definition, not a comment. Still the default when no\n * Blueprint is selected, because it is what ACRYL's own installs are.\n */\nexport const IDE_BLUEPRINT: Blueprint = freezeBlueprint({\n id: 'acryl.ide',\n name: 'ACRYL',\n description: 'The agentic coding IDE: a Blend grown from acryl.blank with the workspace, Market, plugin admin, shortcuts and mount anchors.',\n // Every declared capability, derived so a capability added to the table is part of the IDE without a second edit here.\n capabilities: ACRYL_CODING_CAPABILITIES.map(capability => capability.id),\n rows: [...BLANK_BLUEPRINT.rows, 'community-market', 'shortcuts', 'mount-anchors'],\n brand: { kind: 'acryl' },\n shell: 'advanced',\n dshChat: true,\n grewFrom: BLANK_BLUEPRINT.id,\n})\n\n/**\n * The IDE for people who bring their own agents: the same frame and rows, with the DeepSeek Harness chat switched off. Claude Code, Codex or any\n * agent in a terminal tab (or driving the page through Agent Control) works in it; turning the chat back on is one row edit, not a rebuild.\n */\nexport const AGENTS_BLUEPRINT: Blueprint = freezeBlueprint({\n ...IDE_BLUEPRINT,\n id: 'acryl.agents',\n name: 'ACRYL (bring your own agents)',\n description: 'The agentic coding IDE with the DeepSeek Harness chat off: the frame, workspaces, canvas, terminals and Agent Control, for other agents.',\n dshChat: false,\n grewFrom: IDE_BLUEPRINT.id,\n})\n\n/** Read-only port: where Blueprints come from. Built-ins today; a hub, a Blend lock or a private registry later. */\nexport interface BlueprintCatalog {\n get(id: string): Blueprint | undefined\n list(): readonly Blueprint[]\n}\n\nexport function builtInCatalog(): BlueprintCatalog {\n const all = [BLANK_BLUEPRINT, IDE_BLUEPRINT, AGENTS_BLUEPRINT]\n return { get: id => all.find(blueprint => blueprint.id === id), list: () => all }\n}\n\nexport class UnknownBlueprintError extends Error {\n constructor(id: string, known: readonly Blueprint[]) {\n super(`Unknown blueprint ${JSON.stringify(id)}. Known: ${known.map(blueprint => blueprint.id).join(', ')}`)\n this.name = 'UnknownBlueprintError'\n }\n}\n\n/** Use case: pick the Blueprint a surface boots with. No selection means the IDE, what ACRYL's own installs are. */\nexport function selectBlueprint(id: string | undefined, catalog: BlueprintCatalog = builtInCatalog()): Blueprint {\n if (id === undefined || id.trim() === '') return IDE_BLUEPRINT\n const found = catalog.get(id.trim())\n if (found === undefined) throw new UnknownBlueprintError(id, catalog.list())\n return found\n}\n\n/** A copy of a Blueprint under a different brand. Immutable: the original is untouched. */\nexport function withBrand(blueprint: Blueprint, identity: BrandIdentity): Blueprint {\n return freezeBlueprint({ ...blueprint, brand: { kind: 'custom', identity } })\n}\n","/**\n * Compose: the pure translation from a Blueprint to what a surface's Loader needs: which ACRYL-owned packages must be\n * resolvable, and which Loader patches to apply. No I/O and no framework handles; the composition root\n * (`engine-dsh.ts`) does the materializing and mounting. The row table below is the single place a row's package, id\n * and surfaces are declared, in the order the rows must mount (the shortcut registry before anything that reads it).\n *\n * @module @acryldev/harness-runtime/blueprint/compose\n */\n\nimport type { PatchOptions } from '@deepseek-ai/cordis-plugin-include'\nimport type { AcrylSurface } from '../coding-capabilities.ts'\nimport { identityLine } from './brand-identity.ts'\nimport type { Blueprint, BlueprintRowId } from './blueprint.ts'\n\n/** One Loader row: its id, the module it loads (`name`), and the package that module lives in, which the profile must resolve. */\ninterface RowModule {\n readonly rowId: string\n readonly module: string\n readonly packageName: string\n}\n\ninterface RowDeclaration extends RowModule {\n readonly id: BlueprintRowId\n readonly surfaces: readonly AcrylSurface[]\n /** A library a plugin imports rather than mounts: the package must resolve, but there is no Loader row. */\n readonly libraryOnly?: readonly AcrylSurface[]\n /**\n * Rows this row's plugin injects services from, mounted just before it (and once, however many rows name them). They are not\n * Blueprint rows of their own: a Blueprint names capabilities, and which plugin provides a service is this table's business.\n */\n readonly needs?: readonly RowModule[]\n}\n\n/** The framework's package (spec 049 slice 17): its Cordis plugins are subpaths. The package moved into the scope (spec 051 T038); row ids stay as they were. */\nconst FRAMEWORK_PACKAGE = '@acryldev/blends'\n/** The framework's package name before spec 051 T038: a row id is persisted, so it keeps this name while the module moves. */\nconst LEGACY_FRAMEWORK_PACKAGE = 'acrylblends'\n\nfunction frameworkRow(plugin: string): RowModule {\n const module = `${FRAMEWORK_PACKAGE}/cordis/${plugin}`\n return { rowId: `${LEGACY_FRAMEWORK_PACKAGE}/cordis/${plugin}`, module, packageName: FRAMEWORK_PACKAGE }\n}\n\n/**\n * The row id each package-backed row had before spec 051 T038 renamed the packages: a row id is persisted (a composition\n * override names it), so it keeps the name the row was mounted under while the module it loads moves to the scoped package.\n */\nconst LEGACY_PACKAGE_ROW_IDS: Readonly<Record<string, string>> = Object.freeze({\n '@acryldev/plugin-context': 'acryl-plugin-context',\n '@acryldev/system-prompt': 'acryl-system-prompt',\n '@acryldev/ui': '@acryl/ui',\n '@acryldev/app-save': 'acryl-app-save',\n '@acryldev/plugin-hub': 'acryl-plugin-hub',\n '@acryldev/shortcuts': 'acryl-shortcuts',\n '@acryldev/mount-anchors': 'acryl-mount-anchors',\n '@acryldev/command-reply': 'acryl-command-reply',\n '@acryldev/app-shell': 'acryl-app-shell',\n})\n\n/** A row whose module is its own package, under the package's name; its row id is the one it had before the rename. */\nfunction packageRow(packageName: string): RowModule {\n return { rowId: LEGACY_PACKAGE_ROW_IDS[packageName] ?? packageName, module: packageName, packageName }\n}\n\n/** The router (`ctx.router`) and its Web adapter (`ctx.routerHttp`), which the Market injects (spec 046). */\nconst ROUTER_ROWS: readonly RowModule[] = [frameworkRow('router'), frameworkRow('router-http')]\n\n/** The framework base kit (spec 046): routes, shared state and the inspector, served over HTTP on the Web surface. The inspector row pulls in the rest. */\nconst FRAMEWORK_NEEDS: readonly RowModule[] = [...ROUTER_ROWS, frameworkRow('state')]\n\n/** Declaration order is mount order. The Market is Web-only here: Desktop owns its own provider switch. */\nconst ROWS: readonly RowDeclaration[] = [\n { id: 'community-market', surfaces: ['web'], rowId: 'community-market', module: '@acryldev/cordis-plugin-market', packageName: '@acryldev/cordis-plugin-market', needs: ROUTER_ROWS },\n { id: 'framework-kit', surfaces: ['web', 'desktop'], ...frameworkRow('inspect'), needs: FRAMEWORK_NEEDS },\n { id: 'plugin-context', surfaces: ['tui', 'web', 'desktop'], ...packageRow('@acryldev/plugin-context') },\n { id: 'system-prompt', surfaces: ['tui', 'web', 'desktop'], ...packageRow('@acryldev/system-prompt') },\n { id: 'ui-library', surfaces: ['tui', 'web', 'desktop'], ...packageRow('@acryldev/ui'), libraryOnly: ['tui'] },\n // Saving an app to its own repository (/app save, /app connect): a command, so it works on every surface.\n { id: 'app-save', surfaces: ['tui', 'web', 'desktop'], ...packageRow('@acryldev/app-save') },\n // Saving, sharing and pulling plugins (spec 044): the pluginHub service and /plugin, part of every Blend's base kit.\n { id: 'plugin-hub', surfaces: ['tui', 'web', 'desktop'], ...packageRow('@acryldev/plugin-hub') },\n // ACRYL's keyboard commands on DSH 0.2's own shortcut service (`ctx.shortcuts.register`): upstream owns the registry, persisted rebinding and the\n // editor, so this package no longer provides a service of its own (a second provider fails the client boot).\n { id: 'shortcuts', surfaces: ['web', 'desktop'], ...packageRow('@acryldev/shortcuts') },\n { id: 'mount-anchors', surfaces: ['web', 'desktop'], ...packageRow('@acryldev/mount-anchors') },\n // A host command's reply on the start page, where the conversation that would show it is not drawn yet (spec 049 T002).\n { id: 'command-reply', surfaces: ['web', 'desktop'], ...packageRow('@acryldev/command-reply') },\n // The three-column app frame a domain plugin claims for its own main UI (`desktop.main`), with the conversation beside it, instead of the stock\n // chat frame (blend-instance-design.md 0a). The IDE composes the same frame through its coding capabilities.\n { id: 'app-shell', surfaces: ['web', 'desktop'], ...packageRow('@acryldev/app-shell') },\n]\n\n/**\n * The DSH rows that make it a chat: the agent, the model registry and the pi-ai provider. Disabling them leaves the web server, the session\n * store, the client and every ACRYL row running; Cordis parks the consumers that need them as PENDING (measured on 0.2.0-rc.2: 17 rows, among them\n * the chat session controller and the model providers) and reactivates them when the rows come back.\n */\nexport const DSH_CHAT_ROW_IDS: readonly string[] = ['agent', 'llm', 'llm-pi-ai']\n\n/** DSH's base-bundle row providing `pluginManager`, and the hub's row that takes its place (its id is its module, by the row-naming rule). */\nexport const DSH_PLUGIN_MANAGER_ROW_ID = 'plugin-manager'\n/** The plugin manager row's id, from before the rename (persisted); the module it mounts is the scoped package's subpath. */\nexport const PLUGIN_MANAGER_ROW_ID = 'acryl-plugin-hub/manager'\nconst PLUGIN_MANAGER_MODULE = '@acryldev/plugin-hub/manager'\n\n/** The terminal library is a differently named package than the browser one. */\nconst TUI_LIBRARY_PACKAGE = '@acryldev/ui-tui'\n\n/**\n * Modules a Blend once named, read as their current names and never written: `@acryldev/plugin-context`'s old name (spec 044 step 1b), and the\n * framework packages that became subpaths of `acrylblends` when the framework moved to its own repository (spec 049 slice 17).\n */\nexport const RENAMED_MODULES: Readonly<Record<string, string>> = Object.freeze({\n 'acryl-extension-context': '@acryldev/plugin-context',\n '@acryldev/router': frameworkRow('router').module,\n '@acryldev/router-http': frameworkRow('router-http').module,\n '@acryldev/state': frameworkRow('state').module,\n '@acryldev/inspect': frameworkRow('inspect').module,\n '@acryldev/node-server': frameworkRow('node-server').module,\n '@acryldev/door': frameworkRow('door').module,\n '@acryldev/db': frameworkRow('db').module,\n '@acryldev/db-sqlite': frameworkRow('db-sqlite').module,\n '@acryldev/kv': frameworkRow('kv').module,\n '@acryldev/kv-json': frameworkRow('kv-json').module,\n '@acryldev/kv-db': frameworkRow('kv-db').module,\n})\n\n/** A module as it is named today: a renamed one under its current name, anything else unchanged. */\nexport function currentModule(module: string): string {\n return RENAMED_MODULES[module] ?? module\n}\n\n/** The package a module specifier lives in: `acrylblends/cordis/router` is in `acrylblends`, `@acryldev/ui` in itself. */\nexport function packageOfModule(module: string): string {\n const parts = module.split('/')\n return module.startsWith('@') ? parts.slice(0, 2).join('/') : parts[0] ?? module\n}\n\n/** Which Blueprint row a module is, if it is one of ACRYL's own rows (used to read a Blends manifest's rows back into a Blueprint). */\nexport function blueprintRowForModule(module: string): BlueprintRowId | undefined {\n const current = currentModule(module)\n return ROWS.find(row => row.module === current)?.id\n}\n\n/** The row that fills a Blueprint row (used to write a Blueprint as a Blends manifest). */\nexport function rowForBlueprintRow(id: BlueprintRowId): RowModule {\n const row = ROWS.find(candidate => candidate.id === id)\n if (row === undefined) throw new Error(`no row declaration for ${id}`)\n return { rowId: row.rowId, module: row.module, packageName: row.packageName }\n}\n\nexport interface BlueprintComposition {\n /** ACRYL-owned packages to make resolvable from the profile. */\n readonly packages: readonly string[]\n readonly patches: readonly PatchOptions[]\n}\n\n/**\n * The ACRYL-owned rows and brand for one surface. `existingRowIds` are rows the profile's own bundle already composes:\n * an `insert` of the same id would throw at boot, so those rows are skipped rather than composed twice.\n */\nexport function composeBlueprintRows(\n blueprint: Blueprint,\n surface: AcrylSurface,\n existingRowIds: ReadonlySet<string> = new Set(),\n /** The rows the advanced shell replaces, from the surface's composition (`@acryldev/coding-capabilities`' `ADVANCED_SHELL_PATCHES`). */\n appFramePatches: readonly PatchOptions[] = [],\n): BlueprintComposition {\n const packages: string[] = []\n const patches: PatchOptions[] = []\n const mountedNeeds = new Set<string>()\n\n // Brand first: it swaps the stock identity row and must exist before any client row reads it.\n if (surface === 'web' || surface === 'desktop') {\n if (blueprint.brand.kind === 'acryl') {\n packages.push('@acryldev/brand-client')\n patches.push(\n { id: 'ui-brand-official', disabled: true },\n { insert: [{ id: 'ui-acryl', name: '@acryldev/brand-client', disabled: false }] },\n )\n } else {\n packages.push('@acryldev/brand')\n patches.push(\n { id: 'ui-brand-official', disabled: true },\n { insert: [{ id: 'brand', name: '@acryldev/brand', config: { ...blueprint.brand.identity } }] },\n )\n }\n }\n\n // After the brand and before ACRYL's own rows: a disabled stock row must not be re-enabled by anything composed later.\n if (!blueprint.dshChat && (surface === 'web' || surface === 'desktop')) {\n for (const id of DSH_CHAT_ROW_IDS) patches.push({ id, disabled: true })\n }\n\n for (const row of ROWS) {\n if (!blueprint.rows.includes(row.id) || !row.surfaces.includes(surface)) continue\n if (row.libraryOnly?.includes(surface) === true) {\n packages.push(TUI_LIBRARY_PACKAGE)\n continue\n }\n for (const need of row.needs ?? []) {\n if (existingRowIds.has(need.rowId) || mountedNeeds.has(need.rowId)) continue\n mountedNeeds.add(need.rowId)\n packages.push(need.packageName)\n patches.push({ insert: [{ id: need.rowId, name: need.module }] })\n }\n if (existingRowIds.has(row.rowId)) continue\n packages.push(row.packageName)\n const identityConfig = row.id === 'system-prompt' && blueprint.brand.kind === 'custom'\n ? { config: { identity: identityLine(blueprint.brand.identity) } }\n : {}\n patches.push({ insert: [{ id: row.rowId, name: row.module, ...identityConfig }] })\n }\n // A Blend that owns its frame turns the stock layout off and the sidebar and conversation rows on, for its domain plugin to render into.\n if (blueprint.rows.includes('app-shell') && (surface === 'web' || surface === 'desktop')) patches.push(...appFramePatches)\n // With the plugin hub, DSH's own plugin manager is replaced by the hub's subclass of it, so DSH's \"Add plugin\" box installs a git address as\n // that repository's released, checked version (spec 044 D7). Swapped, never doubled: Cordis refuses a second `pluginManager` provider.\n if (blueprint.rows.includes('plugin-hub') && !existingRowIds.has(PLUGIN_MANAGER_ROW_ID)) {\n patches.push({ id: DSH_PLUGIN_MANAGER_ROW_ID, disabled: true }, { insert: [{ id: PLUGIN_MANAGER_ROW_ID, name: PLUGIN_MANAGER_MODULE }] })\n }\n return { packages: [...new Set(packages)], patches: structuredClone(patches) }\n}\n","/**\n * Blueprint definition: the pure translation from untrusted data (a parsed YAML or JSON file) into a Blueprint, so a team can\n * define its own starter and brand it without writing code. No I/O here; `selection.ts` reads the file.\n *\n * ```yaml\n * id: acme.notes\n * name: Acme Notes\n * extends: acryl.blank # optional: start from a known Blueprint, then override\n * brand: { name: Acme Notes, accent: '#0a7d4b' }\n * rows: [plugin-context, system-prompt, ui-library, community-market]\n * ```\n *\n * Unknown keys, unknown capabilities and unknown rows are rejected, so a typo is an error at start-up, not a silently missing feature.\n *\n * @module @acryldev/harness-runtime/blueprint/definition\n */\n\nimport { ACRYL_CODING_CAPABILITIES, type AcrylCodingCapabilityId, type AcrylShellMode } from '../coding-capabilities.ts'\nimport { brandIdentity } from './brand-identity.ts'\nimport { BLUEPRINT_ROW_IDS, builtInCatalog, RENAMED_BLUEPRINT_ROW_IDS, type Blueprint, type BlueprintCatalog, type BlueprintRowId } from './blueprint.ts'\n\nconst ID = /^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$/u\nconst KEYS = new Set(['id', 'name', 'description', 'extends', 'capabilities', 'rows', 'brand', 'shell', 'dshChat'])\nconst SHELLS: readonly AcrylShellMode[] = ['compatibility', 'advanced']\n\nexport class InvalidBlueprintError extends Error {\n constructor(detail: string) {\n super(`Invalid blueprint: ${detail}`)\n this.name = 'InvalidBlueprintError'\n }\n}\n\nfunction text(record: Record<string, unknown>, key: string, max: number): string | undefined {\n const value = record[key]\n if (value === undefined) return undefined\n if (typeof value !== 'string' || value.trim() === '' || value.length > max) throw new InvalidBlueprintError(`\"${key}\" must be a non-empty string of at most ${String(max)} characters`)\n return value.trim()\n}\n\nfunction oneOf<T extends string>(record: Record<string, unknown>, key: string, allowed: readonly T[]): readonly T[] | undefined {\n const value = record[key]\n if (value === undefined) return undefined\n if (!Array.isArray(value)) throw new InvalidBlueprintError(`\"${key}\" must be a list`)\n const unknown = value.filter(entry => typeof entry !== 'string' || !allowed.includes(entry as T))\n if (unknown.length > 0) throw new InvalidBlueprintError(`\"${key}\" names ${unknown.map(entry => JSON.stringify(entry)).join(', ')}; known: ${allowed.join(', ')}`)\n return [...new Set(value as T[])]\n}\n\n/** Turn parsed data into a Blueprint. `extends` resolves against `catalog` (built-ins by default). */\nexport function parseBlueprint(input: unknown, catalog: BlueprintCatalog = builtInCatalog()): Blueprint {\n if (input === null || typeof input !== 'object' || Array.isArray(input)) throw new InvalidBlueprintError('expected an object')\n const record = input as Record<string, unknown>\n const stray = Object.keys(record).filter(key => !KEYS.has(key))\n if (stray.length > 0) throw new InvalidBlueprintError(`unknown key ${stray.map(key => JSON.stringify(key)).join(', ')}; known: ${[...KEYS].join(', ')}`)\n\n const id = text(record, 'id', 80)\n if (id === undefined || !ID.test(id)) throw new InvalidBlueprintError('\"id\" is required and must look like acme.notes (lowercase letters, digits, dots and dashes)')\n const parentId = text(record, 'extends', 80)\n const parent = parentId === undefined ? undefined : catalog.get(parentId)\n if (parentId !== undefined && parent === undefined) throw new InvalidBlueprintError(`\"extends\" names ${JSON.stringify(parentId)}, which is not a known blueprint`)\n\n const capabilities = oneOf(record, 'capabilities', ACRYL_CODING_CAPABILITIES.map(capability => capability.id) as readonly AcrylCodingCapabilityId[])\n // A renamed row is read as its current name, so a Blueprint written before the rename still loads.\n const rows = oneOf({ rows: Array.isArray(record.rows) ? record.rows.map(row => RENAMED_BLUEPRINT_ROW_IDS[String(row)] ?? row) : record.rows }, 'rows', BLUEPRINT_ROW_IDS as readonly BlueprintRowId[])\n const shell = text(record, 'shell', 20)\n if (shell !== undefined && !SHELLS.includes(shell as AcrylShellMode)) throw new InvalidBlueprintError(`\"shell\" must be one of ${SHELLS.join(', ')}`)\n if (record.dshChat !== undefined && typeof record.dshChat !== 'boolean') throw new InvalidBlueprintError('\"dshChat\" must be true or false')\n const brand = record.brand === undefined\n ? undefined\n : { kind: 'custom', identity: brandIdentity(record.brand) } as const\n\n const base: Blueprint = parent ?? {\n id, name: id, description: '', capabilities: ['authorization', 'acryl-settings'], rows: ['plugin-context', 'system-prompt'], brand: { kind: 'acryl' }, shell: 'compatibility', dshChat: true,\n }\n const composedCapabilities = capabilities ?? base.capabilities\n const composedRows = rows ?? base.rows\n // A capability that serves its routes through the router needs the framework kit, which brings it; without it the plugin would wait (PENDING) silently.\n const needsRouter = ACRYL_CODING_CAPABILITIES.find(capability => capability.needsRouter === true && composedCapabilities.includes(capability.id))\n if (needsRouter !== undefined && !composedRows.includes('framework-kit')) {\n throw new InvalidBlueprintError(`the ${JSON.stringify(needsRouter.id)} capability needs the \"framework-kit\" row, which serves its routes`)\n }\n return Object.freeze({\n id,\n name: text(record, 'name', 80) ?? (parent === undefined ? base.name : id),\n description: text(record, 'description', 300) ?? base.description,\n capabilities: composedCapabilities,\n rows: composedRows,\n brand: brand ?? base.brand,\n shell: (shell as AcrylShellMode | undefined) ?? base.shell,\n dshChat: record.dshChat === undefined ? base.dshChat : record.dshChat,\n })\n}\n","/**\n * The app definition file (`blend.yaml`) is a Blends manifest (`blends.acryl.dev/v1alpha1`), so one file is both what the Blends tooling reads, captures\n * and publishes and what this runtime boots from. The format itself (schema, structural rules, lineage) is validated by `@acryldev/blends-core`, the one\n * reader of the format; this module is only the translation between the two vocabularies, pure and in both directions:\n *\n * manifest -> Blueprint `kind: Blend` grows from `spec.lineage.blueprint` (a known Blueprint); `kind: Blueprint` names one. Rows whose package is one of\n * ACRYL's own rows turn that capability on (or off with `disabled: true`); the `@acryldev/brand` row's config is the brand. Any other\n * row is an app plugin: it lives in the app's `extensions/` and loads from there, so the Blueprint does not compose it.\n * Blueprint -> manifest what `acryl new` writes.\n *\n * @module @acryldev/harness-runtime/blueprint/manifest\n */\n\nimport { validateDefinition } from '@acryldev/blends-core'\nimport { brandIdentity, type BrandIdentity } from './brand-identity.ts'\nimport { builtInCatalog, type Blueprint, type BlueprintCatalog, type BlueprintRowId } from './blueprint.ts'\nimport { blueprintRowForModule, rowForBlueprintRow } from './compose.ts'\nimport { InvalidBlueprintError } from './definition.ts'\n\nexport const BLENDS_API_VERSION = 'blends.acryl.dev/v1alpha1'\nexport const BRAND_PACKAGE = '@acryldev/brand'\n\nconst ID = /^[a-z][a-z0-9-]*(?:\\.[a-z0-9][a-z0-9-]*)+$/u\n\ninterface ManifestRow {\n readonly id: string\n readonly name: string\n readonly config?: Record<string, unknown>\n readonly disabled?: boolean\n}\n\nexport function isBlendsManifest(input: unknown): boolean {\n return input !== null && typeof input === 'object' && (input as Record<string, unknown>).apiVersion === BLENDS_API_VERSION\n}\n\nfunction record(value: unknown, what: string): Record<string, unknown> {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) throw new InvalidBlueprintError(`${what} must be an object`)\n return value as Record<string, unknown>\n}\n\nfunction rowsOf(spec: Record<string, unknown>): readonly ManifestRow[] {\n const rows = spec.rows\n if (rows === undefined) return []\n if (!Array.isArray(rows)) throw new InvalidBlueprintError('\"spec.rows\" must be a list')\n return rows.map((row, index) => {\n const entry = record(row, `spec.rows[${String(index)}]`)\n if (typeof entry.id !== 'string' || typeof entry.name !== 'string') throw new InvalidBlueprintError(`spec.rows[${String(index)}] needs a string id and name`)\n return entry as unknown as ManifestRow\n })\n}\n\n/** Turn a parsed Blends manifest into the Blueprint this runtime boots. */\nexport function blueprintFromManifest(input: unknown, catalog: BlueprintCatalog = builtInCatalog()): Blueprint {\n const document = record(input, 'the manifest')\n if (document.apiVersion !== BLENDS_API_VERSION) throw new InvalidBlueprintError(`apiVersion must be ${BLENDS_API_VERSION}`)\n // The format's own rules first (schema, row ids, lineage), from the format package; `distribution` also refuses executable `!!js` values in an app definition.\n const problems = validateDefinition(input, 'distribution')\n if (problems.length > 0) throw new InvalidBlueprintError(problems.map(problem => `${problem.path}: ${problem.message}`).join('; '))\n const metadata = record(document.metadata, '\"metadata\"')\n const spec = record(document.spec, '\"spec\"')\n const id = metadata.id\n if (typeof id !== 'string' || !ID.test(id)) throw new InvalidBlueprintError('\"metadata.id\" must be a dot-namespaced id such as acryl.blank.orbit')\n const kind = document.kind\n let base: Blueprint | undefined\n if (kind === 'Blueprint') {\n // A built-in Blueprint (the blank canvas), or a starter kit that extends one: accounting, sound stage, video editor...\n // A starter resolves through its parent; only a Blueprint without `extends` is looked up by its own id (a built-in).\n if (typeof spec.extends === 'string') {\n base = catalog.get(spec.extends)\n if (base === undefined) throw new InvalidBlueprintError(`\"spec.extends\" names ${JSON.stringify(spec.extends)}, which is not a known blueprint (a starter's parent must be built in or kept in the app's blueprints/ folder)`)\n } else base = catalog.get(id)\n } else if (kind === 'Blend') {\n const lineage = record(spec.lineage, '\"spec.lineage\"')\n if (typeof lineage.blueprint !== 'string') throw new InvalidBlueprintError('\"spec.lineage.blueprint\" is required for a Blend')\n base = catalog.get(lineage.blueprint)\n if (base === undefined) throw new InvalidBlueprintError(`\"spec.lineage.blueprint\" names ${JSON.stringify(lineage.blueprint)}, which is not a known blueprint (a project keeps the starter it grew from in its blueprints/ folder)`)\n } else throw new InvalidBlueprintError('\"kind\" must be Blueprint or Blend')\n if (base === undefined) throw new InvalidBlueprintError(`${JSON.stringify(id)} is not a known blueprint: a starter names its parent with spec.extends, a project names what it grew from with kind: Blend and spec.lineage`)\n\n const rows = new Set<BlueprintRowId>(base.rows)\n let brand: Blueprint['brand'] = base.brand\n for (const row of rowsOf(spec)) {\n if (row.name === BRAND_PACKAGE) {\n brand = row.disabled === true ? { kind: 'acryl' } : { kind: 'custom', identity: brandIdentity(row.config ?? {}) }\n continue\n }\n const known = blueprintRowForModule(row.name)\n if (known === undefined) continue // an app plugin: loaded from the app's plugins/, not composed here\n if (row.disabled === true) rows.delete(known)\n else rows.add(known)\n }\n return Object.freeze({\n ...base,\n id,\n name: typeof metadata.name === 'string' && metadata.name.trim() !== '' ? metadata.name.trim() : base.name,\n description: typeof metadata.description === 'string' ? metadata.description : base.description,\n rows: [...rows],\n brand,\n })\n}\n\n/** The manifest `acryl new` writes: a Blend grown from `blueprint`, carrying the brand as a row. */\nexport function appManifest(input: { id: string, name: string, blueprint: Blueprint, brand: BrandIdentity, description?: string }): Record<string, unknown> {\n const brandRow = { id: 'brand', name: BRAND_PACKAGE, config: { ...input.brand } }\n return {\n apiVersion: BLENDS_API_VERSION,\n kind: 'Blend',\n // Private and proprietary until the owner says otherwise: saving refuses a public remote for a private app, and a registry refuses to list it.\n metadata: { id: input.id, name: input.name, version: '0.1.0', description: input.description ?? `${input.name}, grown from ${input.blueprint.id}.`, license: 'Proprietary', visibility: 'private' },\n spec: {\n runtime: 'cordis',\n lineage: { blueprint: input.blueprint.id, blueprintVersion: '0.1.0' },\n rows: [brandRow, ...input.blueprint.rows.map(id => { const row = rowForBlueprintRow(id); return { id: row.rowId, name: row.module } })],\n },\n }\n}\n\n/**\n * The Blueprints an app can grow from: the built-ins, plus the starter definitions it keeps in its `blueprints/` folder (`acryl new --from <starter>` copies\n * the starter there, like a lock of the parent). A starter may extend another starter; each is resolved on first use, and a cycle is refused.\n */\nexport function catalogWithStarters(starters: ReadonlyArray<{ readonly id: string, readonly document: unknown }>, base: BlueprintCatalog = builtInCatalog()): BlueprintCatalog {\n const resolved = new Map<string, Blueprint>()\n const resolving = new Set<string>()\n const byId = new Map(starters.map(starter => [starter.id, starter.document]))\n const catalog: BlueprintCatalog = {\n get(id) {\n const builtIn = base.get(id)\n if (builtIn !== undefined) return builtIn\n const cached = resolved.get(id)\n if (cached !== undefined) return cached\n const document = byId.get(id)\n if (document === undefined) return undefined\n if (resolving.has(id)) throw new InvalidBlueprintError(`the starters in blueprints/ extend each other in a cycle (${[...resolving, id].join(' -> ')})`)\n resolving.add(id)\n try {\n const blueprint = blueprintFromManifest(document, catalog)\n resolved.set(id, blueprint)\n return blueprint\n } finally { resolving.delete(id) }\n },\n list() { return [...base.list(), ...starters.map(starter => catalog.get(starter.id)).filter((entry): entry is Blueprint => entry !== undefined)] },\n }\n return catalog\n}\n","/**\n * The boundary that reads the environment to choose a Blueprint. Kept apart from the pure domain modules so the only\n * `process.env` access in the blueprint context is in one named place.\n *\n * `ACRYL_BLUEPRINT` names a built-in Blueprint id (`acryl.blank`, `acryl.ide`) or a `.yaml`, `.yml` or `.json` file that defines one\n * (see `definition.ts`); unset means `acryl.ide`.\n * `ACRYL_BRAND_NAME` (and the other `ACRYL_BRAND_*` values) rebrand the selected Blueprint without editing any file.\n *\n * @module @acryldev/harness-runtime/blueprint/selection\n */\n\nimport { existsSync, readFileSync, readdirSync } from 'node:fs'\nimport { dirname, extname, join } from 'node:path'\nimport { parse } from 'yaml'\nimport { brandIdentity } from './brand-identity.ts'\nimport { selectBlueprint, withBrand, type Blueprint } from './blueprint.ts'\nimport { InvalidBlueprintError, parseBlueprint } from './definition.ts'\nimport { blueprintFromManifest, catalogWithStarters, isBlendsManifest } from './manifest.ts'\n\nconst BRAND_ENV: readonly (readonly [string, string])[] = [\n ['ACRYL_BRAND_NAME', 'name'],\n ['ACRYL_BRAND_TAGLINE', 'tagline'],\n ['ACRYL_BRAND_ACCENT', 'accent'],\n ['ACRYL_BRAND_ACCENT_DARK', 'accentDark'],\n ['ACRYL_BRAND_FONT', 'fontFamily'],\n ['ACRYL_BRAND_MARK', 'mark'],\n]\n\nconst BLUEPRINT_FILE_EXTENSIONS = new Set(['.yaml', '.yml', '.json'])\n\n/** Read and validate a Blueprint file. A missing or malformed file fails loudly: a silent fallback would boot the wrong product. */\nexport function readBlueprintFile(path: string): Blueprint {\n let source: string\n try {\n source = readFileSync(path, 'utf8')\n } catch (cause) {\n throw new InvalidBlueprintError(`cannot read ${path}: ${cause instanceof Error ? cause.message : String(cause)}`)\n }\n let data: unknown\n try {\n data = parse(source)\n } catch (cause) {\n throw new InvalidBlueprintError(`${path} is not valid YAML: ${cause instanceof Error ? cause.message.split('\\n')[0] : String(cause)}`)\n }\n // An app's `blend.yaml` is a Blends manifest (with the starters it grew from kept beside it in blueprints/); a short runtime definition is also accepted.\n return isBlendsManifest(data) ? blueprintFromManifest(data, catalogWithStarters(readStarters(join(dirname(path), 'blueprints')))) : parseBlueprint(data)\n}\n\n/** The starter definitions an app keeps in its `blueprints/` folder, each a Blends manifest of kind Blueprint. */\nexport function readStarters(folder: string): Array<{ id: string, document: unknown }> {\n if (!existsSync(folder)) return []\n return readdirSync(folder).filter(file => /\\.ya?ml$/u.test(file)).map(file => {\n const path = join(folder, file)\n let document: unknown\n try { document = parse(readFileSync(path, 'utf8')) } catch (cause) { throw new InvalidBlueprintError(`${path} is not valid YAML: ${cause instanceof Error ? cause.message.split('\\n')[0] : String(cause)}`) }\n const id = (document as { metadata?: { id?: unknown } } | null)?.metadata?.id\n if (typeof id !== 'string') throw new InvalidBlueprintError(`${path} has no metadata.id`)\n return { id, document }\n })\n}\n\nexport function blueprintFromEnvironment(env: NodeJS.ProcessEnv = process.env): Blueprint {\n const selected = env.ACRYL_BLUEPRINT?.trim()\n const chosen = selected !== undefined && BLUEPRINT_FILE_EXTENSIONS.has(extname(selected).toLowerCase())\n ? readBlueprintFile(selected)\n : selectBlueprint(env.ACRYL_BLUEPRINT)\n const overrides = Object.fromEntries(BRAND_ENV.flatMap(([variable, field]) => {\n const value = env[variable]\n return value === undefined || value === '' ? [] : [[field, value]]\n }))\n if (Object.keys(overrides).length === 0) return chosen\n const base = chosen.brand.kind === 'custom' ? chosen.brand.identity : { name: chosen.name }\n return withBrand(chosen, brandIdentity({ ...base, ...overrides }))\n}\n","/**\n * Finding and applying the Web port of an app. Which port an app starts from is part of its instance family (`instance/`, which also reads\n * `ACRYL_WEB_PORT`); this module only scans for a free loopback port from there and turns it into the web server's Loader patch.\n *\n * @module @acryldev/harness-runtime/web-port\n */\n\nimport { createServer } from 'node:net'\nimport { isRestrictedPort } from '@acryldev/blends/cordis/node-server'\nimport type { PatchOptions } from '@deepseek-ai/cordis-plugin-include'\n\nconst HOST = '127.0.0.1'\n\n/** The Loader patch that moves the web server to `port`, on `host` (loopback unless the instance's web access says otherwise). */\nexport function webPortPatch(port: number, host: string = HOST): PatchOptions {\n return { id: 'webserver', config: { host, port } }\n}\n\n/** How many consecutive ports are tried before giving up. */\nexport const WEB_PORT_ATTEMPTS = 32\n\n/** Can something listen on this port right now (on loopback, or on `host`)? A probe, so a race with another process is possible but narrow. */\nexport function loopbackPortIsFree(port: number, host: string = HOST): Promise<boolean> {\n return new Promise(resolve => {\n const server = createServer()\n server.once('error', () => resolve(false))\n server.listen({ host, port, exclusive: true }, () => server.close(() => resolve(true)))\n })\n}\n\n/** The first free port at or after `start` that a browser may open (the Fetch standard's bad ports are skipped; an app's stable port is hashed into 3100..3999, which holds 3659). `probe` is injectable so the scan is testable without sockets. */\nexport async function findFreeWebPort(start: number, probe: (port: number) => Promise<boolean> = loopbackPortIsFree, attempts = WEB_PORT_ATTEMPTS): Promise<number> {\n for (let offset = 0; offset < attempts; offset += 1) {\n const port = start + offset\n if (port > 65_535) break\n if (!isRestrictedPort(port) && await probe(port)) return port\n }\n throw new Error(`no free web port from ${String(start)} to ${String(Math.min(start + attempts - 1, 65_535))}; set ACRYL_WEB_PORT to another starting port`)\n}\n","/**\n * One profile, one live installation (spec 036, \"Self-containment\"): a Protection Proxy in front of the one resource two installations can still point at.\n *\n * A Web or CLI profile links ACRYL's own packages into its `node_modules` from the installation that boots it. Two installations (a main checkout and a\n * worktree, a dev build and an installed app) booting the SAME profile silently re-point each other's links, and the one still running then serves the\n * other's code: that is how a worktree run blanked a running main-branch app. So every write to a profile goes through this guard, which holds the profile\n * with a Pessimistic Offline Lock (`instance/offline-lock.ts`): the same installation is always admitted, another is refused while the holder is alive,\n * and a stopped holder is taken over.\n *\n * @module @acryldev/harness-runtime/profile-owner\n */\n\nimport { realpathSync } from 'node:fs'\nimport { join } from 'node:path'\nimport { LockHeldError, acquireLock } from './instance/index.ts'\n\nexport const PROFILE_OWNER_FILE = '.acryl-owner.json'\n\nexport interface ProfileOwner {\n readonly installRoot: string\n readonly pid: number\n readonly since: string\n}\n\nexport class ProfileInUseError extends Error {\n constructor(profileDir: string, owner: { installRoot: unknown, pid: number }, installRoot: string) {\n super(\n `ACRYL profile ${profileDir} is in use by another ACRYL installation (${String(owner.installRoot)}, pid ${String(owner.pid)}). `\n + `This one (${installRoot}) would re-link its packages under the running app. Stop that app, or run this one in its own home `\n + '(set ACRYL_HOME, or start an app created with `acryl new` through its bin/acryl).',\n )\n this.name = 'ProfileInUseError'\n }\n}\n\nfunction canonical(path: string): string {\n try { return realpathSync(path) } catch { return path }\n}\n\n/** Take the profile for this installation, or throw naming the live installation that holds it. */\nexport function claimProfile(profileDir: string, installRoot: string, pid: number = process.pid, alive?: (pid: number) => boolean): void {\n const root = canonical(installRoot)\n try {\n acquireLock(join(profileDir, PROFILE_OWNER_FILE), { pid, installRoot: root }, {\n ...(alive === undefined ? {} : { alive }),\n compatible: holder => typeof holder.installRoot === 'string' && canonical(holder.installRoot) === root,\n })\n } catch (error) {\n if (error instanceof LockHeldError) throw new ProfileInUseError(profileDir, { installRoot: error.holder.installRoot, pid: error.holder.pid }, root)\n throw error\n }\n}\n","/**\n * The one way this runtime registers Node module hooks. Profile package routing (the overlay resolver and the DSH engine's profile\n * resolution) needs the public `module.registerHooks`; a Node or Electron build without it fails here with a message that names the\n * runtime, instead of a bare TypeError deep inside a boot.\n */\n\nimport Module, { type ModuleHooks, type RegisterHooksOptions } from 'node:module'\n\nexport class ModuleHooksUnavailableError extends Error {\n override readonly name = 'ModuleHooksUnavailableError'\n}\n\n/** The running Node, and the Electron around it when there is one, for a message. */\nfunction runtimeName(): string {\n const electron = process.versions.electron\n return electron === undefined ? `Node ${process.versions.node}` : `Electron ${electron} (Node ${process.versions.node})`\n}\n\n/**\n * The public `module.registerHooks`, checked before a caller patches anything it would have to undo.\n * @throws {ModuleHooksUnavailableError} when this Node has none (it needs Node 22.15, 23.5 or newer).\n */\nexport function requireModuleHooks(): (options: RegisterHooksOptions) => ModuleHooks {\n // Read from the default export at call time, so a test can remove it and an older runtime reaches the message below.\n const register = (Module as { registerHooks?: (options: RegisterHooksOptions) => ModuleHooks }).registerHooks\n if (typeof register !== 'function') {\n throw new ModuleHooksUnavailableError(\n `DSH provider unavailable on ${runtimeName()}: profile packages load through module.registerHooks, which this runtime lacks `\n + '(Node 22.15, 23.5 or newer has it)',\n )\n }\n return register\n}\n\n/**\n * Register synchronous module hooks on Node's default loaders.\n * @throws {ModuleHooksUnavailableError} when this Node has no `module.registerHooks`.\n */\nexport function registerModuleHooks(options: RegisterHooksOptions): ModuleHooks {\n return requireModuleHooks()(options)\n}\n","/**\n * The framework packages that moved into `acrylblends` (spec 049 slice 17). An app plugin written before the move imports them by\n * their old names, which no longer resolve; there is no alias, because `@acryldev/router/middleware` maps to one subpath per middleware\n * and an alias would hide that. This module names what to import instead, and `movedFrameworkImports` registers a resolve hook\n * that adds it to the \"cannot find package\" error a boot would otherwise end on.\n *\n * @module @acryldev/harness-runtime/profile-resolution/moved-framework\n */\n\nimport type { ModuleHooks } from 'node:module'\nimport { registerModuleHooks } from '../module-hooks.ts'\n\n/** Each old specifier and what replaces it. */\nexport const MOVED_FRAMEWORK_IMPORTS: Readonly<Record<string, string>> = Object.freeze({\n '@acryldev/router': \"'acrylblends' (Acryl, Context and the types), '@acryldev/blends/http-exception' (HTTPException) and '@acryldev/blends/cordis/router' (the Cordis plugin, connectionOf, and the ctx.router type)\",\n '@acryldev/router/middleware': \"one subpath per middleware: '@acryldev/blends/body-limit', '@acryldev/blends/loopback-only', '@acryldev/blends/method-not-allowed', '@acryldev/blends/trailing-slash', '@acryldev/blends/bearer-auth' and the others under their names\",\n '@acryldev/router/helpers': \"'@acryldev/blends/streaming' (streamSSE) and '@acryldev/blends/schema-validator' (schemaValidator)\",\n '@acryldev/router-http': \"'@acryldev/blends/cordis/router-http'\",\n '@acryldev/state': \"'@acryldev/blends/cordis/state'\",\n '@acryldev/inspect': \"'@acryldev/blends/cordis/inspect'\",\n '@acryldev/node-server': \"'@acryldev/blends/node-server' (serve) or '@acryldev/blends/cordis/node-server' (the Cordis plugin)\",\n '@acryldev/door': \"'@acryldev/blends/cordis/door'\",\n '@acryldev/door/protocol': \"'@acryldev/blends/door/protocol'\",\n '@acryldev/door/host': \"'@acryldev/blends/door/host'\",\n '@acryldev/door/page': \"'@acryldev/blends/door/page'\",\n '@acryldev/db': \"'@acryldev/blends/db'\",\n '@acryldev/db/cordis': \"'@acryldev/blends/cordis/db'\",\n '@acryldev/db/conformance': \"'@acryldev/blends/db/conformance'\",\n '@acryldev/db-sqlite': \"'@acryldev/blends/db/sqlite' or '@acryldev/blends/cordis/db-sqlite' (the Cordis plugin)\",\n '@acryldev/kv': \"'@acryldev/blends/kv'\",\n '@acryldev/kv-json': \"'@acryldev/blends/kv/json' or '@acryldev/blends/cordis/kv-json' (the Cordis plugin)\",\n '@acryldev/kv-db': \"'@acryldev/blends/kv/db' or '@acryldev/blends/cordis/kv-db' (the Cordis plugin)\",\n})\n\n/** What replaces an old framework import, or undefined for any other specifier. */\nexport function movedFrameworkImport(specifier: string): string | undefined {\n return MOVED_FRAMEWORK_IMPORTS[specifier]\n}\n\n/** The message for an old framework import that did not resolve. */\nexport function movedFrameworkMessage(specifier: string, original: string): string {\n return `${original}\\n'${specifier}' is part of acrylblends since the framework moved to its own repository: import ${MOVED_FRAMEWORK_IMPORTS[specifier] ?? \"from '@acryldev/blends'\"} instead.`\n}\n\n/**\n * A resolve hook that names the replacement when an old framework import does not resolve. Registered after the profile's own\n * resolution, so it sees that resolution's failure; anything that resolves, and every other error, passes through unchanged.\n * @returns the hooks, for the caller to deregister with the resolution it wraps.\n */\nexport function registerMovedFrameworkImports(): ModuleHooks {\n return registerModuleHooks({\n resolve(specifier, context, nextResolve) {\n try {\n return nextResolve(specifier, context)\n } catch (error) {\n const code = (error as NodeJS.ErrnoException).code\n if (error instanceof Error && movedFrameworkImport(specifier) !== undefined && (code === 'ERR_MODULE_NOT_FOUND' || code === 'MODULE_NOT_FOUND')) {\n error.message = movedFrameworkMessage(specifier, error.message)\n }\n throw error\n }\n },\n })\n}\n","/*\n * Ported from DeepSeek Harness, packages/boot/app-boot/src/profile-resolution/resolver.ts at dsh-v0.2.0-rc.2 (639ed01539, MIT,\n * Copyright (c) 2026 DeepSeek; see THIRD_PARTY_NOTICES.md). The routing is the original's, unchanged. Deviation: the original reaches\n * Node's internal ESM loader, CommonJS helpers and ESM resolver through the native node-addon-require-builtin add-on, which Electron\n * builds after 44.0.0 refuse to load; this port uses Node's public module hooks instead (`registerHooks` for ESM resolution,\n * `Module._resolveFilename` for CommonJS, the conditions a hook call reports), and resolves a CommonJS package-imports target with the\n * CommonJS resolver from the anchor rather than the internal ESM `defaultResolve` (the two choose the same `exports` target). The\n * port check in tests/profile-resolution-port.spec.ts fails when the original changes, so a DeepSeek Harness bump re-ports it.\n */\n/** In-memory profile package routing for Node's default ESM and CommonJS loaders. */\n\nimport { existsSync, readFileSync, realpathSync, statSync } from 'node:fs'\nimport Module, { createRequire, isBuiltin, type ResolveFnOutput, type ResolveHookContext } from 'node:module'\nimport { basename, dirname, join, resolve, sep } from 'node:path'\nimport { fileURLToPath, pathToFileURL } from 'node:url'\nimport { getEnvironmentData, setEnvironmentData } from 'node:worker_threads'\nimport { imports as resolvePackageImports, type Package as ResolvePackageManifest } from 'resolve.exports'\nimport type { RuntimeResolution, RuntimeResolutionEntry } from '@deepseek-ai/dsh-app-boot'\nimport { requireModuleHooks } from '../module-hooks.ts'\n\nconst WORKER_RESOLUTION_KEY = '@deepseek-ai/dsh-app-boot/profile-resolution'\n\ninterface CommonJsParent {\n filename?: string | null\n parent?: CommonJsParent | null\n paths?: string[]\n}\n\ninterface CommonJsOptions {\n paths?: string[]\n conditions?: ReadonlySet<string>\n}\n\ninterface CommonJsModule {\n new(id?: string, parent?: CommonJsParent): CommonJsParent\n _nodeModulePaths(path: string): string[]\n _resolveFilename(\n request: string, parent: CommonJsParent | null | undefined, isMain: boolean, options?: CommonJsOptions,\n ): string\n}\n\n/** One resolve step of Node's public module hooks: the next hook, or Node's default resolver. */\ntype NextResolve = (specifier: string, context?: Partial<ResolveHookContext>) => ResolveFnOutput\n\n/**\n * Where Node continues a scoped bare request. `native` keeps the importer's own lookup: the chain is\n * answered below the interception layer. `interception` answers at the interception layer from the\n * entry's declaring manifest; `after` anchors Node's chain above the layer for a CommonJS subpath the\n * entry lacks. `native-after-interception` resumes Node's chain from `parent`: the interception layer for a\n * name without an entry, or the layer above it after an `interception` subpath miss.\n */\ntype ResolutionRoute =\n | { readonly kind: 'interception'; readonly entry: RuntimeResolutionEntry; readonly after: string }\n | { readonly kind: 'native-after-interception'; readonly parent: string }\n | { readonly kind: 'native'; readonly packageDir?: string }\n\ninterface ResolutionRouteState {\n readonly route: ResolutionRoute\n packageDir?: string\n esm?: ResolveFnOutput\n cjs?: string\n}\n\ninterface CommonJsLookup {\n readonly cacheable: boolean\n resolveNative(searchPaths: readonly string[]): string\n resolveEntry(entry: RuntimeResolutionEntry, after: string): string\n}\n\n/** The lookup positions that one interception layer fixes on an importer's ancestor chain. */\ninterface LayerPositions {\n /** Search paths with this prefix lie below the layer and are answered by their physical content. */\n readonly localPrefix: string\n /** Manifest anchoring Node's lookup at the layer's physical directory. */\n readonly nativeAfter: string\n /** Manifest anchoring Node's lookup above the layer after a CommonJS subpath miss. */\n readonly after: string\n}\n\n/**\n * The interception layer of one importer. A profile's layer is its parent's node_modules and answers every entry\n * for the active profile. Linked importers apply current peer declarations at each ancestor node_modules\n * position without memoizing the selected route.\n */\ntype InterceptionLayer =\n | LayerPositions & { readonly kind: 'profile'; readonly active: boolean }\n | { readonly kind: 'linked' }\n\ninterface ParentRoutes {\n readonly parent: string\n readonly layer: InterceptionLayer\n readonly requests: Map<string, ResolutionRouteState>\n selfReferenceName?: string | false | null\n}\n\ntype ResolutionRoutes = Map<string, ParentRoutes | false>\n\ninterface CompiledResolution {\n readonly entries: ReadonlyMap<string, RuntimeResolutionEntry>\n readonly profilesDir: string\n readonly profileDir: string | undefined\n readonly profilePaths: readonly string[]\n readonly profile: readonly string[]\n readonly installationPaths: readonly string[]\n readonly linkedPaths: readonly string[]\n readonly localPackageNames: ReadonlySet<string>\n readonly esmRoutes: ResolutionRoutes\n readonly cjsRoutes: ResolutionRoutes\n}\n\n/** Active interception in one Node isolate. */\nexport interface RuntimeInterception {\n /**\n * Locate a bare package without requiring one of its exports.\n * A package subpath selects its package directory without resolving or validating the requested file.\n * @param specifier - bare package or package-subpath specifier.\n * @param parentURL - file URL whose lookup order applies.\n * @returns selected package directory, or undefined when it is absent.\n */\n packageDir(specifier: string, parentURL: string): string | undefined\n /**\n * Atomically publish a complete successor and fresh caches. Linked roots may be added or removed.\n * Removed roots stop intercepting uncovered directories; existing modules and Node caches remain intact.\n * @param successor - fully constructed generation retaining existing package mappings and local names.\n * @throws when the profile scope or existing mappings change, local names are removed or override\n * existing mappings, or a previously published link name selects a different real directory.\n */\n replace(successor: RuntimeResolution): void\n /** Restore the native resolver methods. Interceptions dispose in reverse order. */\n dispose(): void\n}\n\n/**\n * Split a bare request into its package name without allocating path segments.\n * @param request - module specifier to classify.\n * @returns the bare package name, or undefined for non-package requests.\n */\nexport function barePackageName(request: string): string | undefined {\n if (!request || request[0] === '.' || request[0] === '/' || request[0] === '\\\\'\n || request[0] === '#' || request.includes(':') || isBuiltin(request)) return\n const first = request.indexOf('/')\n if (request[0] !== '@') return first < 0 ? request : request.slice(0, first)\n if (first < 0) return\n const second = request.indexOf('/', first + 1)\n return second < 0 ? request : request.slice(0, second)\n}\n\nfunction canonicalPath(path: string): string {\n try {\n return realpathSync(path)\n } catch {\n // A runtime resolution may name a profile scope before that directory is materialized.\n return resolve(path)\n }\n}\n\nfunction prefixes(path: string): readonly string[] {\n const configured = resolve(path) + sep\n const canonical = canonicalPath(path) + sep\n return canonical === configured ? [configured] : [configured, canonical]\n}\n\nfunction compileResolution(resolution: RuntimeResolution): CompiledResolution {\n return {\n entries: new Map(resolution.entries.map(entry => [entry.name, entry])),\n profilesDir: resolution.profilesDir,\n profileDir: resolution.profileDir,\n profilePaths: prefixes(resolution.profilesDir),\n profile: resolution.profileDir === undefined ? [] : prefixes(resolution.profileDir),\n installationPaths: [...new Set(resolution.entries\n .filter(entry => entry.scope === 'installation')\n .flatMap(entry => prefixes(entry.packageDir)))],\n linkedPaths: resolution.linkedRoots.flatMap(root => prefixes(root.realPath)),\n localPackageNames: new Set(resolution.localPackageNames),\n esmRoutes: new Map(),\n cjsRoutes: new Map(),\n }\n}\n\n/**\n * The interception layer of a profile is `<profileParent>/node_modules`: an entry occupies its name there, so its\n * subpath misses continue above it, and a name without an entry continues at it.\n */\nfunction computeProfileLayer(dir: string, active: boolean): InterceptionLayer {\n const profileParent = dirname(dir)\n return {\n kind: 'profile', active,\n localPrefix: dir + sep,\n nativeAfter: join(profileParent, 'package.json'),\n after: join(dirname(profileParent), 'package.json'),\n }\n}\n\n/** The interception layer of a module path: from its profile directory inside a profiles tree, or its linked root. */\nfunction findInterceptionLayer(path: string, resolution: CompiledResolution): InterceptionLayer | undefined {\n const treeRoot = resolution.profilePaths.find(prefix => path.startsWith(prefix))\n const activeProfile = resolution.profile.find(prefix => path.startsWith(prefix))\n const dir = treeRoot !== undefined ? profileChild(path, treeRoot) : activeProfile?.slice(0, -1)\n if (dir !== undefined) return computeProfileLayer(dir, activeProfile !== undefined)\n if (!startsWithin(path, resolution.linkedPaths)) return undefined\n if (startsWithin(path, resolution.installationPaths)) return undefined\n return { kind: 'linked' }\n}\n\n/** Package names a directory's current manifest lists as peers; an unreadable manifest lists none. */\nfunction readPeerNames(directory: string): ReadonlySet<string> {\n try {\n const manifest = JSON.parse(readFileSync(join(directory, 'package.json'), 'utf8')) as {\n peerDependencies?: unknown\n }\n const peers = manifest.peerDependencies\n return new Set(peers !== null && typeof peers === 'object' ? Object.keys(peers) : [])\n } catch (_error) {\n // Node reports the unreadable or invalid manifest itself when it resolves the package's own imports.\n return new Set()\n }\n}\n\nfunction startsWithin(path: string, roots: readonly string[]): boolean {\n for (const root of roots) {\n if (path.startsWith(root)) return true\n }\n return false\n}\n\n/**\n * The profile directory owning a module inside the profiles tree: the first path segment below the tree root.\n * @param path - module path below `treePrefix`.\n * @param treePrefix - profiles directory with a trailing separator.\n * @returns the profile directory without a trailing separator.\n */\nfunction profileChild(path: string, treePrefix: string): string {\n const rest = path.slice(treePrefix.length)\n const end = rest.indexOf(sep)\n return treePrefix + (end < 0 ? rest : rest.slice(0, end))\n}\n\nfunction nativePackageDir(parent: string, name: string): string | undefined {\n for (const searchPath of createRequire(parent).resolve.paths(name) as string[]) {\n const candidate = join(searchPath, name)\n if (existsSync(join(candidate, 'package.json'))) return candidate\n }\n return undefined\n}\n\nfunction localPackageCandidate(searchPath: string, name: string, flavor: 'esm' | 'cjs'): string | undefined {\n const candidate = join(searchPath, name)\n const stat = statSync(candidate, { throwIfNoEntry: false })\n const found = flavor === 'esm'\n ? stat?.isDirectory() === true\n : stat !== undefined\n || ['.js', '.json', '.node'].some(extension => existsSync(candidate + extension))\n return found ? candidate : undefined\n}\n\nfunction selfReferenceName(parent: string): string | false | null {\n let current = dirname(parent)\n while (true) {\n const manifestPath = join(current, 'package.json')\n if (existsSync(manifestPath)) {\n let manifest: Record<string, unknown>\n try {\n manifest = JSON.parse(readFileSync(manifestPath, 'utf8')) as Record<string, unknown>\n } catch (_error) {\n // Only Node decides whether this request consumes an invalid package manifest.\n return null\n }\n return typeof manifest.name === 'string' && manifest.exports != null\n ? manifest.name\n : false\n }\n /* v8 ignore next -- scoped module requests normally find an owning manifest before node_modules. */\n if (basename(current) === 'node_modules') return false\n const next = dirname(current)\n if (next === current) return false\n current = next\n }\n}\n\nfunction packageImportsTarget(\n parent: string, request: string, conditions: Iterable<string>,\n): { specifier: string; parentURL: string } | undefined {\n let current = dirname(parent)\n while (true) {\n const manifestPath = join(current, 'package.json')\n if (existsSync(manifestPath)) {\n let manifest: ResolvePackageManifest\n try {\n manifest = JSON.parse(readFileSync(manifestPath, 'utf8')) as ResolvePackageManifest\n } catch (_error) {\n // The native resolver retains invalid package-target and manifest diagnostics.\n /* v8 ignore next -- native resolution cannot report MODULE_NOT_FOUND after an invalid scope manifest */\n return undefined\n }\n try {\n const target = resolvePackageImports(manifest, request, {\n conditions: [...conditions],\n unsafe: true,\n })?.[0]\n return target !== undefined && barePackageName(target) !== undefined\n ? { specifier: target, parentURL: pathToFileURL(manifestPath).href }\n : undefined\n } catch (_error) {\n // The native resolver retains missing mappings and unmatched-condition diagnostics.\n /* v8 ignore next -- native resolution cannot report MODULE_NOT_FOUND before selecting a valid mapping */\n return undefined\n }\n }\n if (basename(current) === 'node_modules') return undefined\n const next = dirname(current)\n /* v8 ignore next -- a MODULE_NOT_FOUND package-import target always has an owning package scope */\n if (next === current) return undefined\n current = next\n }\n}\n\nfunction packageSearchPaths(\n entry: RuntimeResolutionEntry, request: string, cjs: CommonJsModule,\n): string[] {\n const name = barePackageName(request)\n /* v8 ignore next -- interception routes are created only for bare package requests */\n if (name === undefined) return cjs._nodeModulePaths(dirname(entry.declarer))\n const suffix = sep + name.split('/').join(sep)\n return entry.packageDir.endsWith(suffix)\n ? [entry.packageDir.slice(0, -suffix.length)]\n : cjs._nodeModulePaths(dirname(entry.declarer))\n}\n\nfunction localCandidateOwnsResolution(candidate: string, resolved: string, request: string, name: string): boolean {\n if (startsWithin(resolved, prefixes(candidate))) return true\n if (sameResolution(candidate, resolved)) return true\n if (['.js', '.json', '.node'].some(extension => sameResolution(candidate + extension, resolved))) return true\n /* v8 ignore next -- a bounded native lookup can escape a candidate only through its root legacy main */\n if (request !== name) return false\n try {\n const manifest = JSON.parse(readFileSync(join(candidate, 'package.json'), 'utf8')) as Record<string, unknown>\n /* v8 ignore next -- a bounded native lookup outside the package directory requires a legacy main */\n if (typeof manifest.main !== 'string') return false\n const main = createRequire(join(candidate, 'package.json')).resolve(resolve(candidate, manifest.main))\n return sameResolution(main, resolved)\n } catch (_error) {\n // Native resolution already owns malformed manifests and missing legacy entries.\n /* v8 ignore next -- this helper runs only after the same native resolution succeeded */\n return false\n }\n}\n\nfunction isUnselectedPackageMiss(error: unknown): boolean {\n const failure = error as NodeJS.ErrnoException & { path?: unknown }\n return failure.code === 'MODULE_NOT_FOUND' && failure.path === undefined\n}\n\nfunction sameResolution(left: string, right: string): boolean {\n if (left === right) return true\n return canonicalPath(left) === canonicalPath(right)\n}\n\n/** One mutable pointer to the immutable runtime resolution. */\nclass ResolutionRouter {\n private current: CompiledResolution\n private readonly linkedTargets: Map<string, string>\n\n constructor(resolution: RuntimeResolution, private readonly nodeModulePaths: (directory: string) => string[]) {\n this.current = compileResolution(resolution)\n this.linkedTargets = new Map(resolution.linkedRoots.map(root => [root.name, root.realPath]))\n }\n\n replace(successor: RuntimeResolution): void {\n const entries = new Map(successor.entries.map(entry => [entry.name, entry]))\n if (successor.profilesDir !== this.current.profilesDir\n || successor.profileDir !== this.current.profileDir) {\n throw new Error('profile resolution: a successor cannot change its profile scope')\n }\n for (const [name, current] of this.current.entries) {\n const next = entries.get(name)\n if (next === undefined\n || !sameResolution(current.packageDir, next.packageDir)\n || !sameResolution(current.declarer, next.declarer)\n || current.version !== next.version\n || current.scope !== next.scope) {\n throw new Error(`profile resolution: replacing ${JSON.stringify(name)} requires a process restart`)\n }\n }\n const localPackageNames = new Set(successor.localPackageNames)\n for (const name of this.current.localPackageNames) {\n if (!localPackageNames.has(name)) {\n throw new Error(`profile resolution: removing local package ${JSON.stringify(name)} requires a process restart`)\n }\n }\n for (const name of localPackageNames) {\n if (!this.current.localPackageNames.has(name) && this.current.entries.has(name)) {\n throw new Error(`profile resolution: overriding ${JSON.stringify(name)} locally requires a process restart`)\n }\n }\n // Node retains realpath caches after a root leaves the interception scope.\n for (const root of successor.linkedRoots) {\n const previous = this.linkedTargets.get(root.name)\n if (previous !== undefined && !sameResolution(previous, root.realPath)) {\n throw new Error(`profile resolution: relinking ${JSON.stringify(root.name)} requires a process restart`)\n }\n }\n const next = compileResolution(successor)\n for (const { name, realPath } of successor.linkedRoots) {\n if (!this.linkedTargets.has(name)) this.linkedTargets.set(name, realPath)\n }\n this.current = next\n }\n\n /** Whether a module path has an interception layer: it lies in the profiles tree, the active profile, or a linked root. */\n hasInterceptionLayerForPath(path: string): boolean {\n return findInterceptionLayer(path, this.current) !== undefined\n }\n\n /** Whether an importer URL is scoped; the answer is memoized with the importer's routes. */\n hasInterceptionLayerForUrl(parentURL: string): boolean {\n return this.getOrCreateParentRoutesForUrl(parentURL) !== false\n }\n\n private createParentRoutes(parent: string, resolution: CompiledResolution): ParentRoutes | undefined {\n const layer = findInterceptionLayer(parent, resolution)\n return layer === undefined ? undefined : { parent, layer, requests: new Map() }\n }\n\n private getOrCreateParentRoutesForUrl(parentURL: string): ParentRoutes | false {\n const resolution = this.current\n let parentRoutes = resolution.esmRoutes.get(parentURL)\n if (parentRoutes !== undefined) return parentRoutes\n let parent: string | undefined\n try {\n parent = fileURLToPath(parentURL)\n } catch {\n // Only file URLs can lie inside a profile tree or linked root.\n parent = undefined\n }\n parentRoutes = parent === undefined ? false : this.createParentRoutes(parent, resolution) ?? false\n resolution.esmRoutes.set(parentURL, parentRoutes)\n return parentRoutes\n }\n\n private routeScoped(\n request: string,\n parentRoutes: ParentRoutes,\n resolution: CompiledResolution,\n flavor: 'esm' | 'cjs',\n cjs?: CommonJsLookup,\n ): ResolutionRouteState | undefined {\n const { parent, layer, requests } = parentRoutes\n const memo = layer.kind === 'profile' && (cjs === undefined || cjs.cacheable)\n const name = barePackageName(request)\n if (name === undefined) return undefined\n\n if (parentRoutes.selfReferenceName === undefined || !memo) {\n parentRoutes.selfReferenceName = selfReferenceName(parent)\n }\n if (parentRoutes.selfReferenceName === name || parentRoutes.selfReferenceName === null) {\n const state = { route: { kind: 'native' as const } }\n if (memo) requests.set(request, state)\n return state\n }\n\n if (layer.kind === 'linked') return this.routeLinked(request, name, parent, resolution, flavor, cjs)\n\n const target = resolution.entries.get(name)\n const candidates: string[] = []\n const localSearchPaths: string[] = []\n for (const searchPath of createRequire(parent).resolve.paths(name) as string[]) {\n if (!searchPath.startsWith(layer.localPrefix)) break\n localSearchPaths.push(searchPath)\n const candidate = localPackageCandidate(searchPath, name, flavor)\n if (candidate !== undefined) candidates.push(candidate)\n }\n if (candidates.length > 0) {\n if (cjs !== undefined) {\n try {\n const resolved = cjs.resolveNative(localSearchPaths)\n const selected = candidates.find(candidate => (\n localCandidateOwnsResolution(candidate, resolved, request, name)\n ))\n if (selected !== undefined) {\n const state = {\n route: { kind: 'native' as const, packageDir: selected },\n packageDir: selected,\n cjs: resolved,\n }\n if (memo) requests.set(request, state)\n return state\n }\n } catch (error) {\n if (!isUnselectedPackageMiss(error)) throw error\n }\n } else {\n const selected = candidates[0] as string\n const state = {\n route: { kind: 'native' as const, packageDir: selected },\n packageDir: selected,\n }\n requests.set(request, state)\n return state\n }\n }\n\n const route: ResolutionRoute = target !== undefined\n && (target.scope === 'installation' || layer.active)\n ? { kind: 'interception', entry: target, after: layer.after }\n : { kind: 'native-after-interception', parent: layer.nativeAfter }\n const state: ResolutionRouteState = { route }\n if (route.kind === 'interception' && memo) requests.set(request, state)\n return state\n }\n\n private routeLinked(\n request: string, name: string, parent: string, resolution: CompiledResolution,\n flavor: 'esm' | 'cjs', cjs: CommonJsLookup | undefined,\n ): ResolutionRouteState {\n const target = resolution.entries.get(name)\n if (target === undefined) return { route: { kind: 'native' } }\n const ancestors = this.nodeModulePaths(dirname(parent))\n const ancestorSet = new Set(ancestors)\n const searchPaths = flavor === 'esm' ? ancestors : createRequire(parent).resolve.paths(name) as string[]\n for (const searchPath of searchPaths) {\n const directory = dirname(searchPath)\n if (ancestorSet.has(searchPath) && readPeerNames(directory).has(name)) {\n const route: ResolutionRoute = { kind: 'interception', entry: target, after: join(dirname(directory), 'package.json') }\n if (cjs === undefined) return { route }\n try {\n const resolved = cjs.resolveEntry(target, route.after)\n if (localCandidateOwnsResolution(target.packageDir, resolved, request, name)) {\n return { route, packageDir: target.packageDir, cjs: resolved }\n }\n } catch (error) {\n if (!isUnselectedPackageMiss(error)) throw error\n }\n // This position is occupied even when a legacy CommonJS subpath is absent from the supplied package.\n continue\n }\n const candidate = localPackageCandidate(searchPath, name, flavor)\n if (candidate === undefined) continue\n if (cjs === undefined) return { route: { kind: 'native', packageDir: candidate }, packageDir: candidate }\n try {\n const resolved = cjs.resolveNative([searchPath])\n if (localCandidateOwnsResolution(candidate, resolved, request, name)) {\n return { route: { kind: 'native', packageDir: candidate }, packageDir: candidate, cjs: resolved }\n }\n } catch (error) {\n if (!isUnselectedPackageMiss(error)) throw error\n }\n }\n // An exhausted CommonJS lookup must not retry the physical copies at occupied peer positions.\n return cjs === undefined ? { route: { kind: 'native' } } : { route: { kind: 'native' }, cjs: cjs.resolveNative([]) }\n }\n\n private routeLocalPackage(\n request: string, parentRoutes: ParentRoutes, resolution: CompiledResolution,\n ): ResolutionRouteState | undefined {\n const name = barePackageName(request)\n const { layer } = parentRoutes\n if (name === undefined || layer.kind !== 'profile' || !layer.active || !resolution.localPackageNames.has(name)) return undefined\n const state = { route: { kind: 'native' as const } }\n parentRoutes.requests.set(request, state)\n return state\n }\n\n routeUrl(request: string, parentURL: string): ResolutionRouteState | undefined {\n const resolution = this.current\n const parentRoutes = this.getOrCreateParentRoutesForUrl(parentURL)\n if (parentRoutes === false) return undefined\n const cached = parentRoutes.requests.get(request)\n if (cached !== undefined) return cached\n const local = this.routeLocalPackage(request, parentRoutes, resolution)\n if (local !== undefined) return local\n return this.routeScoped(request, parentRoutes, resolution, 'esm')\n }\n\n routePath(\n request: string, parent: string, cjs: CommonJsLookup,\n ): ResolutionRouteState | undefined {\n const resolution = this.current\n let parentRoutes = resolution.cjsRoutes.get(parent)\n if (parentRoutes === false) return undefined\n const cached = cjs.cacheable ? parentRoutes?.requests.get(request) : undefined\n if (cached !== undefined) return cached\n if (parentRoutes === undefined) {\n parentRoutes = this.createParentRoutes(parent, resolution) ?? false\n resolution.cjsRoutes.set(parent, parentRoutes)\n if (parentRoutes === false) return undefined\n }\n return this.routeScoped(request, parentRoutes, resolution, 'cjs', cjs)\n }\n\n packageDir(specifier: string, parentURL: string): string | undefined {\n const name = barePackageName(specifier)\n if (name === undefined) return undefined\n const state = this.routeUrl(name, parentURL)\n if (state?.route.kind === 'interception') return state.route.entry.packageDir\n if (state?.packageDir !== undefined) return state.packageDir\n let parent: string\n try {\n parent = state?.route.kind === 'native-after-interception' ? state.route.parent : fileURLToPath(parentURL)\n } catch {\n return undefined\n }\n const found = nativePackageDir(parent, name)\n if (state !== undefined && found !== undefined) state.packageDir = found\n return found\n }\n}\n\n/**\n * The conditions Node's CommonJS loader applies when a call names none: `require`, `node`, `node-addons` unless addons are off,\n * `module-sync` when `require(esm)` is on, and every `--conditions`/`-C` flag. A `require()` passing through the module hooks reports its\n * exact set, which {@link installRuntimeInterception} uses; this is the set for a direct `Module._resolveFilename` call.\n */\nfunction defaultCommonJsConditions(): ReadonlySet<string> {\n const flags = [...process.execArgv, ...(process.env.NODE_OPTIONS ?? '').split(/\\s+/u).filter(flag => flag !== '')]\n const user: string[] = []\n for (let at = 0; at < flags.length; at += 1) {\n const flag = flags[at] as string\n const inline = /^(?:--conditions|-C)=(.+)$/u.exec(flag)\n if (inline !== null) user.push(inline[1] as string)\n else if ((flag === '--conditions' || flag === '-C') && flags[at + 1] !== undefined) user.push(flags[(at += 1)] as string)\n }\n const addons = !flags.includes('--no-addons')\n const requireModule = (process.features as { require_module?: boolean }).require_module === true\n return new Set(['require', 'node', ...(addons ? ['node-addons'] : []), ...user, ...(requireModule ? ['module-sync'] : [])])\n}\n\n/**\n * Replace a resolver error's message and the same text in its stack.\n * Node's module-hooks thread serializes errors and returns the stack accessor as a read-only configurable\n * data property, so a rejected stack assignment redefines the property value.\n * @param error - resolver error to update in place.\n * @param message - replacement message.\n */\nfunction replaceErrorMessage(error: Error, message: string): void {\n const { message: originalMessage, stack } = error\n error.message = message\n /* v8 ignore next -- Node's resolver errors always carry a stack */\n if (stack === undefined) return\n const replaced = stack.replace(originalMessage, message)\n if (!Reflect.set(error, 'stack', replaced)) Object.defineProperty(error, 'stack', { value: replaced })\n}\n\nfunction throwWithImporter(error: unknown, routedParent: string, parent: string): never {\n const code = (error as NodeJS.ErrnoException).code\n if (error instanceof Error && (code === 'ERR_MODULE_NOT_FOUND' || code === 'ERR_PACKAGE_PATH_NOT_EXPORTED')) {\n const routedPath = fileURLToPath(routedParent)\n const parentPath = fileURLToPath(parent)\n replaceErrorMessage(error, error.message.replaceAll(routedParent, parent).replaceAll(routedPath, parentPath))\n }\n throw error\n}\n\nfunction throwWithoutCjsAnchor(error: unknown, anchor: string): never {\n const resolved = error as NodeJS.ErrnoException & { requireStack?: string[] }\n const requireStack = resolved.requireStack\n if (error instanceof Error\n && resolved.code === 'MODULE_NOT_FOUND'\n && requireStack?.[0] !== undefined\n && sameResolution(requireStack[0], anchor)) {\n const originalMessage = error.message\n const originalBlock = `\\nRequire stack:\\n${requireStack.map(path => `- ${path}`).join('\\n')}`\n const remaining = requireStack.slice(1)\n /* v8 ignore next -- routed calls always retain the original importing module */\n const replacement = remaining.length === 0\n ? ''\n : `\\nRequire stack:\\n${remaining.map(path => `- ${path}`).join('\\n')}`\n error.message = originalMessage.replace(originalBlock, replacement)\n resolved.requireStack = remaining\n const stack = error.stack\n /* v8 ignore next -- Node's resolver errors always carry a stack */\n if (stack !== undefined) error.stack = stack.replace(originalMessage, error.message)\n }\n throw error\n}\n\n/**\n * Install one runtime resolution as the interception on Node's default ESM and CommonJS resolvers.\n * @param resolution - complete package table and profile scope.\n * @returns an interception that publishes a successor or restores the native methods.\n */\nexport function installRuntimeInterception(\n resolution: RuntimeResolution,\n): RuntimeInterception {\n // Before anything is built or patched, so a runtime without module hooks fails with the message and leaves nothing behind.\n const registerHooks = requireModuleHooks()\n const cjs = Module as unknown as CommonJsModule\n const router = new ResolutionRouter(resolution, directory => cjs._nodeModulePaths(directory))\n // The conditions of the require() in flight: the module hooks see them first and Node then calls `_resolveFilename` inside `nextResolve`.\n let requireConditions: readonly string[] | undefined\n\n /** One ESM resolve, routed when its importer has an interception layer; `next` is the rest of the hook chain. */\n const resolveEsm = (request: string, context: ResolveHookContext, next: NextResolve): ResolveFnOutput => {\n const parent = context.parentURL\n const native = (parentURL: string | undefined): ResolveFnOutput => next(request, { ...context, parentURL })\n if (parent === undefined || !router.hasInterceptionLayerForUrl(parent)) return native(parent)\n const state = router.routeUrl(request, parent)\n if (state === undefined) {\n const target = request[0] === '#' ? packageImportsTarget(fileURLToPath(parent), request, context.conditions) : undefined\n if (target === undefined) return native(parent)\n try {\n return resolveEsm(target.specifier, { ...context, parentURL: target.parentURL }, next)\n } catch (error) {\n return throwWithImporter(error, target.parentURL, parent)\n }\n }\n const cacheable = Object.keys(context.importAttributes).length === 0\n // A hook that answers without calling the rest of the chain must say so.\n if (cacheable && state.esm !== undefined) return { ...state.esm, shortCircuit: true }\n const route = state.route\n if (route.kind === 'native') {\n const result = native(parent)\n if (cacheable) state.esm = result\n return result\n }\n const routedParent = pathToFileURL(route.kind === 'interception' ? route.entry.declarer : route.parent).href\n let result: ResolveFnOutput\n try {\n result = native(routedParent)\n } catch (error) {\n return throwWithImporter(error, routedParent, parent)\n }\n if (cacheable) state.esm = result\n return result\n }\n\n const hooks = registerHooks({\n resolve(specifier, context, nextResolve) {\n // A require() is routed by the `_resolveFilename` wrapper Node calls inside nextResolve; only its conditions are taken from here.\n if (context.conditions.includes('require') && !context.conditions.includes('import')) {\n const previous = requireConditions\n requireConditions = context.conditions\n try {\n return nextResolve(specifier, context)\n } finally {\n requireConditions = previous\n }\n }\n return resolveEsm(specifier, context, nextResolve)\n },\n })\n\n const originalFilename = Reflect.get(cjs, '_resolveFilename')\n let delegatedCjs = 0\n const resolveRoutedCjs = (\n request: string, routed: Exclude<ResolutionRoute, { kind: 'native' }>,\n parent: CommonJsParent, main: boolean, options?: CommonJsOptions,\n ): string => {\n const anchor = routed.kind === 'interception' ? routed.entry.declarer : routed.parent\n const synthetic = new cjs(anchor)\n // Late parent assignment preserves Node's require stack without publishing this routing anchor in parent.children.\n synthetic.parent = parent\n synthetic.filename = anchor\n synthetic.paths = routed.kind === 'interception'\n ? packageSearchPaths(routed.entry, request, cjs)\n : cjs._nodeModulePaths(dirname(anchor))\n try {\n return originalFilename.call(cjs, request, synthetic, main, options)\n } catch (error) {\n return throwWithoutCjsAnchor(error, anchor)\n }\n }\n const resolveNativeCjs = (\n request: string, searchPaths: readonly string[], parent: CommonJsParent,\n parentFilename: string, main: boolean, conditions: ReadonlySet<string> | undefined,\n ): string => {\n const synthetic = new cjs(parentFilename)\n if (parent.parent !== undefined) synthetic.parent = parent.parent\n synthetic.filename = parentFilename\n synthetic.paths = [...searchPaths]\n const options = conditions === undefined ? undefined : { conditions }\n return originalFilename.call(cjs, request, synthetic, main, options)\n }\n const resolvePackageImportCjs = (\n target: { specifier: string; parentURL: string }, conditions: Iterable<string>,\n ): string => {\n const state = router.routeUrl(target.specifier, target.parentURL)\n // Node resolves a package-imports target with its ESM package resolver; the public equivalent is the CommonJS resolver from a\n // synthetic module at the anchor with the same conditions, which selects the same `exports` target.\n const resolveFrom = (parentURL: string): string => {\n const anchor = fileURLToPath(parentURL)\n const synthetic = new cjs(anchor)\n synthetic.filename = anchor\n synthetic.paths = cjs._nodeModulePaths(dirname(anchor))\n delegatedCjs++\n try {\n return originalFilename.call(cjs, target.specifier, synthetic, false, { conditions: new Set(conditions) })\n } finally {\n delegatedCjs--\n }\n }\n /* v8 ignore next -- the target manifest was found inside the established profile scope */\n if (state === undefined) return resolveFrom(target.parentURL)\n if (state.route.kind === 'native') return resolveFrom(target.parentURL)\n const route = state.route\n if (route.kind === 'native-after-interception') return resolveFrom(pathToFileURL(route.parent).href)\n return resolveFrom(pathToFileURL(route.entry.declarer).href)\n }\n const wrappedFilename: CommonJsModule['_resolveFilename'] = (request, parent, main, options) => {\n if (delegatedCjs || !parent?.filename || options?.paths !== undefined) {\n return originalFilename.call(cjs, request, parent, main, options)\n }\n const parentFilename = parent.filename\n const cacheable = options?.conditions === undefined\n const routedOptions = options?.conditions === undefined ? undefined : { conditions: options.conditions }\n const state = router.routePath(request, parentFilename, {\n cacheable,\n resolveNative: searchPaths => resolveNativeCjs(request, searchPaths, parent, parentFilename, main, options?.conditions),\n resolveEntry: (entry, after) => {\n delegatedCjs++\n try {\n return resolveRoutedCjs(request, { kind: 'interception', entry, after }, parent, main, routedOptions)\n } finally {\n delegatedCjs--\n }\n },\n })\n if (state === undefined) {\n const scoped = router.hasInterceptionLayerForPath(parentFilename)\n const conditions = options?.conditions ?? (requireConditions === undefined ? defaultCommonJsConditions() : new Set(requireConditions))\n const target = request[0] === '#' && scoped\n ? packageImportsTarget(parentFilename, request, conditions)\n : undefined\n if (target === undefined) return originalFilename.call(cjs, request, parent, main, options)\n return resolvePackageImportCjs(target, conditions)\n }\n if (state.cjs !== undefined) return state.cjs\n const route = state.route\n if (route.kind === 'native') {\n const result = originalFilename.call(cjs, request, parent, main, options)\n if (cacheable) state.cjs = result\n return result\n }\n delegatedCjs++\n try {\n let expected: string\n try {\n expected = resolveRoutedCjs(request, route, parent, main, routedOptions)\n } catch (error) {\n if (route.kind !== 'interception' || !isUnselectedPackageMiss(error)) throw error\n expected = resolveRoutedCjs(\n request, { kind: 'native-after-interception', parent: route.after }, parent, main, routedOptions,\n )\n }\n if (cacheable) state.cjs = expected\n return expected\n } finally {\n delegatedCjs--\n }\n }\n cjs._resolveFilename = wrappedFilename\n\n return {\n packageDir(specifier, parentURL) {\n return router.packageDir(specifier, parentURL)\n },\n replace(next) { router.replace(next) },\n dispose() {\n /* v8 ignore else -- interceptions are disposed in reverse installation order */\n if (cjs._resolveFilename === wrappedFilename) cjs._resolveFilename = originalFilename\n hooks.deregister()\n },\n }\n}\n\n/**\n * Publish one runtime resolution for Harness-owned Workers.\n * @param resolution - complete package table and profile scope.\n * @returns a disposer restoring the previous thread environment data.\n */\nexport function registerWorkerResolution(\n resolution: RuntimeResolution,\n): () => void {\n const previous = getEnvironmentData(WORKER_RESOLUTION_KEY)\n setEnvironmentData(WORKER_RESOLUTION_KEY, { resolution })\n return () => { setEnvironmentData(WORKER_RESOLUTION_KEY, previous) }\n}\n","/*\n * Ported from DeepSeek Harness, packages/boot/app-boot/src/profile-resolution/service.ts at dsh-v0.2.0-rc.2 (639ed01539, MIT,\n * Copyright (c) 2026 DeepSeek; see THIRD_PARTY_NOTICES.md). Deviation: the class extends the original `PluginPackages`, so every\n * consumer of the `pluginPackages` service (the plugin inventories, the plugin manager, the typert loader) keeps its type and its\n * inherited `metaOf`, and constructs it with no resolution, so the original installs nothing; the interception is the port's in\n * ./resolver.ts, which needs no native add-on. Second deviation: a resolve hook registered after the interception names what replaces a\n * framework import from before the framework moved to acrylblends (./moved-framework.ts), and is deregistered with it.\n */\n\n/** Package metadata resolved through one runtime interception. */\n\nimport { existsSync, readFileSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport { join } from 'node:path'\nimport type { Context } from '@deepseek-ai/cordis'\nimport { PluginPackages, type PluginPackage, type PluginPackagesConfig, type RuntimeResolution } from '@deepseek-ai/dsh-app-boot'\nimport { registerMovedFrameworkImports } from './moved-framework.ts'\nimport {\n barePackageName,\n installRuntimeInterception,\n registerWorkerResolution,\n type RuntimeInterception,\n} from './resolver.ts'\n\nfunction readPackage(dir: string, fallbackName: string): PluginPackage | undefined {\n const manifestPath = join(dir, 'package.json')\n if (!existsSync(manifestPath)) return undefined\n const manifest = JSON.parse(readFileSync(manifestPath, 'utf8')) as Record<string, unknown>\n const name = manifest.name\n const version = manifest.version\n return {\n name: typeof name === 'string' ? name : fallbackName,\n version: typeof version === 'string' ? version : undefined,\n dir,\n manifestPath,\n manifest,\n }\n}\n\n/** Package lookup shared by metadata consumers in one profile process, on Node's public module hooks. */\nexport class ProfilePluginPackages extends PluginPackages {\n private table = new Map<string, PluginPackage | undefined>()\n private readonly routing: RuntimeInterception | undefined\n private disposeWorkers: (() => void) | undefined\n\n constructor(ctx: Context, config: PluginPackagesConfig = {}) {\n super(ctx, {})\n if (config.resolution === undefined) return\n const interception = installRuntimeInterception(config.resolution)\n this.disposeWorkers = registerWorkerResolution(config.resolution)\n this.routing = interception\n // Registered after the interception, so an old framework import that the profile cannot resolve fails with what replaces it.\n const movedImports = registerMovedFrameworkImports()\n ctx.effect(() => () => {\n movedImports.deregister()\n this.disposeWorkers?.()\n interception.dispose()\n }, 'profile package resolution')\n }\n\n /**\n * Publish a complete successor generation for this process and subsequently created Workers.\n * Linked roots may be removed without unloading modules or clearing Node caches.\n * @param successor - fully constructed generation accepted by {@link RuntimeInterception.replace}.\n */\n override replace(successor: RuntimeResolution): void {\n if (this.routing === undefined) throw new Error('plugin-packages: runtime resolution is not installed')\n this.routing.replace(successor)\n this.table = new Map()\n this.disposeWorkers?.()\n this.disposeWorkers = registerWorkerResolution(successor)\n }\n\n /**\n * Locate the package named by a specifier without requiring a package export.\n * @param specifier - module specifier whose package owns the requested module.\n * @param parentURL - URL whose Node lookup order applies.\n * @returns the parsed package, or undefined when no package owns the request.\n */\n override packageOf(specifier: string, parentURL: string): PluginPackage | undefined {\n const name = barePackageName(specifier)\n if (name === undefined) return undefined\n const dir = this.routing === undefined\n ? packageDirFromParent(name, parentURL)\n : this.routing.packageDir(name, parentURL)\n if (dir === undefined) return undefined\n const key = JSON.stringify({ dir, name })\n if (!this.table.has(key)) this.table.set(key, readPackage(dir, name))\n return this.table.get(key)\n }\n}\n\nfunction packageDirFromParent(name: string, parentURL: string): string | undefined {\n for (const searchPath of createRequire(parentURL).resolve.paths(name) as string[]) {\n const candidate = join(searchPath, name)\n if (existsSync(join(candidate, 'package.json'))) return candidate\n }\n return undefined\n}\n","/**\n * Web's own `desktopProfiles`/`desktopPnpm` capabilities (spec 034 T006,\n * scoped v1) - what `@acryldev/cordis-plugin-market`'s install service needs to make\n * its Installed-tab Install/Uninstall buttons do a real package operation on\n * Web, instead of the \"ACRYL is required\" gate it shows without them.\n *\n * Deliberately NOT a port of Desktop's own `pnpm.ts`/`install-recovery.ts`\n * (1,500+ lines together): that size is almost entirely a crash-recovery\n * write-ahead-log built around Electron's own generation-restart cycle - if\n * the whole app crashes mid-install, the WAL lets the next launch detect and\n * roll back a half-finished operation. Web has no equivalent \"the whole\n * process restarts and we verify it came back healthy\" cycle to protect\n * against: a `dsh plugin add` child process either finishes within this one\n * request or it doesn't, with no separate \"recovered after restart\" state to\n * track. So this file's own `recoveredInstallReceiptIds`/\n * `acknowledgeRecoveredInstall`/`rollbackPluginInstall`/\n * `acknowledgeLiveInstall` are trivial - there is no WAL for them to manage.\n *\n * Also deliberately does NOT attempt `livePluginActivation` (activating a\n * freshly-installed row without a process restart) - `specs/032-universal-\n * hot-reload` documents real, hard-to-diagnose crashes from an earlier\n * attempt at exactly that class of live-Loader-mutation-plus-client-reload\n * change on Desktop. The market's own install flow already degrades\n * gracefully without it (a restart prompt), so v1 leans on that rather than\n * re-attempting a proven-risky mechanism under time pressure.\n *\n * The install mechanics themselves reuse `dsh plugin --profile web add/\n * remove`, the exact same CLI path a human operator already uses - not a\n * reimplementation of pnpm invocation and `dsh.profile.bundles`\n * reconciliation from scratch (which Desktop's own version needs only\n * because Electron's packaged `dsh` CLI hard-rejects `--profile desktop`;\n * confirmed directly that `--profile web` has no such restriction).\n */\n\nimport { spawn } from 'node:child_process'\nimport { createRequire } from 'node:module'\nimport { dirname, join } from 'node:path'\nimport { PassThrough, Readable } from 'node:stream'\nimport { type Context, Service } from '@deepseek-ai/cordis'\nimport { pinnedPnpmEnv } from './pinned-pnpm.ts'\nimport { reconcileProfileLayout, type PnpmProfileConfig } from './profile-layout.ts'\n\n/** Matches `@acryldev/cordis-plugin-market`'s own `MarketDesktopProfile` shape (`src/install/service.ts`). */\nexport interface WebMarketProfile {\n readonly name: string\n readonly dir: string\n}\n\n/** Matches `@acryldev/cordis-plugin-market`'s own `MarketDesktopPnpmOutcome` shape. */\nexport interface WebMarketPnpmOutcome {\n readonly exitCode: number | null\n readonly signal: NodeJS.Signals | null\n}\n\n/** Matches `@acryldev/cordis-plugin-market`'s own `MarketDesktopPnpmHandle` shape. */\nexport interface WebMarketPnpmHandle {\n readonly stdout: Readable\n readonly stderr: Readable\n readonly done: Promise<WebMarketPnpmOutcome>\n cancel(): void\n}\n\n// No `declare module '@deepseek-ai/cordis'` augmentation here on purpose:\n// acryl-desktop's own pnpm.ts/desktop-plugins.ts already declare\n// `desktopProfiles`/`desktopPnpm`/`desktopPlugins` on Context with their own\n// (richer, Electron-specific) types. `Service`'s own constructor signature is\n// `(ctx: Context, name: string)` - a plain string, not `keyof Context` - so\n// providing under these exact names needs no static declaration here at all;\n// adding one anyway would be two different packages both augmenting the same\n// ambient property with structurally different types, which the TypeScript\n// compiler correctly refuses to merge (reproduced directly: acryl-desktop's\n// own typecheck failed with \"Subsequent property declarations must have the\n// same type\" the moment this block existed). This file only ever *provides*\n// these services; it never reads `ctx.get('desktopProfiles' | 'desktopPnpm')`\n// itself, so the missing consumer-side typing costs it nothing.\n\n/** Matches `@acryldev/cordis-plugin-market`'s own `MarketDesktopPnpm` shape exactly - the six methods it actually calls. */\nexport interface WebMarketPnpm {\n runPlugin(args: readonly string[], invokingDir: string, signal?: AbortSignal): WebMarketPnpmHandle\n installPlugin(request: {\n readonly pnpmOptions?: readonly string[]\n readonly invokingDir: string\n readonly recovery: { readonly packageName: string; readonly packageVersion: string; readonly receiptId: string }\n readonly signal?: AbortSignal\n }): Promise<WebMarketPnpmHandle>\n recoveredInstallReceiptIds(): Promise<readonly string[]>\n acknowledgeRecoveredInstall(receiptId: string): Promise<void>\n rollbackPluginInstall(receiptId: string): Promise<boolean>\n acknowledgeLiveInstall(packageName: string): Promise<void>\n}\n\nconst require = createRequire(import.meta.url)\n\n/** Absolute path to the pinned `@deepseek-ai/dsh` CLI's own compiled entry - resolved once, from this package's own installation, not guessed. */\nfunction resolveDshBin(): string {\n const manifestPath = require.resolve('@deepseek-ai/dsh/package.json')\n return join(dirname(manifestPath), 'lib/bin.js')\n}\n\n/** Web's single profile is always named `web` - unlike Desktop, there is no multi-profile picker to resolve against. */\nexport class WebProfilesService extends Service {\n constructor(ctx: Context, private readonly profileDir: string) {\n super(ctx, 'desktopProfiles')\n }\n\n get current(): WebMarketProfile {\n return { name: 'web', dir: this.profileDir }\n }\n}\n\n/**\n * Runs `dsh plugin --profile web <verb> <...args>` as a real child process,\n * inheriting this server's own `DSH_HOME` (already set correctly by\n * `resolveWebEngineComposition` before this service is ever constructed) -\n * the exact command a human operator already runs by hand, `-w` included for\n * pnpm's own workspace-root safety check on a profile's single-package\n * pnpm workspace.\n */\nexport class WebPnpmService extends Service implements WebMarketPnpm {\n private readonly dshBin: string\n private readonly profileName: string\n private readonly profileDir: string\n\n constructor(ctx: Context, config: PnpmProfileConfig) {\n super(ctx, 'desktopPnpm')\n this.profileName = config.name\n this.profileDir = config.dir\n this.dshBin = resolveDshBin()\n }\n\n runPlugin(args: readonly string[], _invokingDir: string, signal?: AbortSignal): WebMarketPnpmHandle {\n // Never let a pnpm relink a profile another pnpm laid out (see profile-layout.ts).\n reconcileProfileLayout(this.profileDir)\n const child = spawn(process.execPath, [this.dshBin, 'plugin', '--profile', this.profileName, ...args, '-w'], {\n // The pinned pnpm, not whatever the machine has on PATH (see pinned-pnpm.ts).\n env: pinnedPnpmEnv(process.env),\n signal,\n })\n // The market resumes/discards these itself (`handle.stdout.resume()`) -\n // pass real streams through rather than buffering, matching Desktop's\n // own handle shape.\n const stdout = new PassThrough()\n const stderr = new PassThrough()\n child.stdout?.pipe(stdout)\n child.stderr?.pipe(stderr)\n // 'close', not 'exit' - see the identical fix and its own doc comment\n // in cli-market-install.ts's runPlugin: 'exit' can race ahead of the\n // piped stdout/stderr actually draining into the streams above.\n const done = new Promise<WebMarketPnpmOutcome>((resolve, reject) => {\n child.once('error', reject)\n child.once('close', (exitCode, exitSignal) => resolve({ exitCode, signal: exitSignal }))\n })\n return {\n stdout,\n stderr,\n done,\n cancel: () => { child.kill() },\n }\n }\n\n async installPlugin(request: {\n readonly pnpmOptions?: readonly string[]\n readonly invokingDir: string\n readonly recovery: { readonly packageName: string; readonly packageVersion: string; readonly receiptId: string }\n readonly signal?: AbortSignal\n }): Promise<WebMarketPnpmHandle> {\n // No recovery WAL to open here (see this module's own doc comment) - the\n // exact npm target still comes from `recovery`, matching Desktop's own\n // `installPlugin` (never trust `pnpmOptions` alone to carry the target).\n const target = `${request.recovery.packageName}@${request.recovery.packageVersion}`\n const options = request.pnpmOptions === undefined ? [] : [...request.pnpmOptions]\n // See the identical override and its own doc comment in\n // cli-market-install.ts's installPlugin: a Market install of a plugin\n // published minutes earlier is the normal case here, not the untrusted-\n // fresh-package scenario pnpm's `minimumReleaseAge` default guards\n // against. Overridden only for this one `add` invocation.\n return this.runPlugin(['add', '--config.minimum-release-age=0', ...options, target], request.invokingDir, request.signal)\n }\n\n // No WAL (see this module's own doc comment): nothing was ever recorded as\n // \"awaiting restart\", so there is never anything to report as recovered,\n // acknowledge, or roll back.\n async recoveredInstallReceiptIds(): Promise<readonly string[]> {\n return []\n }\n\n async acknowledgeRecoveredInstall(_receiptId: string): Promise<void> {}\n\n async rollbackPluginInstall(_receiptId: string): Promise<boolean> {\n return false\n }\n\n async acknowledgeLiveInstall(_packageName: string): Promise<void> {}\n}\n\n/**\n * Provide `desktopProfiles`/`desktopPnpm` on the host root, before\n * `@acryldev/cordis-plugin-market`'s own row mounts - matching the same `prepare`-hook\n * timing `createWebEngineDefinition`'s brand/market row materialization\n * already relies on.\n * @param profileDir - the web profile's own directory (`resolveWebEngineComposition`'s `profile.dir`).\n */\nexport function provideWebMarketInstall(ctx: Context, profileDir: string): void {\n ctx.plugin(WebProfilesService, profileDir)\n ctx.plugin(WebPnpmService, { name: 'web', dir: profileDir })\n}\n","/**\n * Web's own `desktopPlugins` capability (spec 034 T006, scoped v1) - the\n * package-name/preview-token-shaped adapter `@acryldev/cordis-plugin-market`'s install\n * service needs for `disabledPackageNames()` (a hard requirement even for a\n * plain install - `previewInstall` checks a target isn't already disabled),\n * plus real enable/disable for its Installed tab.\n *\n * Not a new lifecycle implementation: wraps the SAME shared\n * `AcrPluginLifecycleController` (spec 034 T005) the CLI's own `acryl\n * plugin enable/disable` and Desktop's Lifecycle tab already drive - this\n * file is only the market-shaped view over it, matching how\n * `acryl-desktop/src/plugins/desktop-plugins.ts` is Desktop's own view over the\n * identical shared controller.\n *\n * `bundleId` here is simply the Loader `entryId` - Web owns both sides of\n * this contract, so there is no need for a second opaque identifier layer\n * the way Desktop's own richer bundle-tracking might want one.\n */\n\nimport { randomUUID } from 'node:crypto'\nimport { type Context, Service } from '@deepseek-ai/cordis'\nimport type { AcrPluginLifecycleController } from '@acryldev/control'\nimport {\n mountAcrylPluginLifecycle,\n type DshPluginLifecycleOptions,\n} from './plugin-lifecycle.ts'\n\nexport interface WebMarketPluginBundle {\n readonly bundleId: string\n readonly packageName: string\n readonly status: 'active' | 'disabled'\n readonly mutable: boolean\n}\n\ninterface PreviewEntry {\n readonly entryId: string\n readonly packageName: string\n readonly targetEnabled: boolean\n readonly expiresAt: number\n}\n\n// No `declare module '@deepseek-ai/cordis'` augmentation here - see the\n// identical note in web-market-install.ts. acryl-desktop's own\n// desktop-plugins.ts already declares `desktopPlugins` on Context with its\n// own type; a second, differently-shaped declaration for the same name is a\n// hard TypeScript merge conflict across packages, not something either side\n// can quietly win. `Service`'s constructor takes a plain `name: string`, so\n// providing under this exact name needs no static declaration at all.\n\nconst PREVIEW_TTL_MS = 5 * 60 * 1000\nconst MAX_PREVIEWS = 256\n/** Matches @acryldev/cordis-plugin-market's own PACKAGE_NAME_PATTERN - it rejects the whole list if even one entry isn't a real npm package name. */\nconst NPM_PACKAGE_NAME_PATTERN = /^(?:@[a-z0-9][a-z0-9._-]*\\/)?[a-z0-9][a-z0-9._-]*$/u\n\n/** Matches `@acryldev/cordis-plugin-market`'s own `MarketDesktopPlugins` shape exactly - the six methods it actually calls. */\nexport class WebPluginsService extends Service {\n private readonly previews = new Map<string, PreviewEntry>()\n\n private readonly controller: AcrPluginLifecycleController\n private readonly profileName: string\n\n constructor(ctx: Context, options: { readonly controller: AcrPluginLifecycleController; readonly profileName: string }) {\n super(ctx, 'desktopPlugins')\n this.controller = options.controller\n this.profileName = options.profileName\n }\n\n list(): readonly WebMarketPluginBundle[] {\n return this.controller.snapshot().entries\n // A Loader row's own `moduleName` is often not npm-package-shaped at\n // all (`cordis:group`, `cordis:include`, ...) - the market validates\n // every name it receives against exactly this npm-package pattern\n // (`@acryldev/cordis-plugin-market`'s own PACKAGE_NAME_PATTERN) and hard-rejects\n // the whole list if even one entry fails, so this filter isn't\n // optional cosmetics.\n .filter(entry => NPM_PACKAGE_NAME_PATTERN.test(entry.moduleName))\n .map(entry => ({\n bundleId: entry.entryId,\n packageName: entry.moduleName,\n status: entry.enabled ? 'active' : 'disabled',\n mutable: entry.mutable,\n }))\n }\n\n disabledPackageNames(): readonly string[] {\n return this.controller.snapshot().entries\n .filter(entry => !entry.enabled && NPM_PACKAGE_NAME_PATTERN.test(entry.moduleName))\n .map(entry => entry.moduleName)\n }\n\n isDisabled(packageName: string): boolean {\n return this.disabledPackageNames().includes(packageName)\n }\n\n private mintPreview(bundleId: string, targetEnabled: boolean): { readonly previewId: string; readonly profileName: string; readonly packageName: string; readonly expiresAt: string } {\n const entry = this.controller.snapshot().entries.find(candidate => candidate.entryId === bundleId)\n if (entry === undefined) throw new Error(`web plugins: no such bundle ${JSON.stringify(bundleId)}`)\n if (!entry.mutable) throw new Error(`web plugins: bundle ${JSON.stringify(bundleId)} is not user-mutable`)\n const expectedCurrent = !targetEnabled\n if (entry.enabled !== expectedCurrent) {\n throw new Error(`web plugins: bundle ${JSON.stringify(bundleId)} is already ${entry.enabled ? 'enabled' : 'disabled'}`)\n }\n // Bounded like Desktop's own preview cache - a preview is a short-lived\n // confirmation token, not persisted state; dropping the oldest on\n // overflow is an acceptable, simple eviction for a purely defensive cap.\n if (this.previews.size >= MAX_PREVIEWS) {\n const oldest = this.previews.keys().next().value\n if (oldest !== undefined) this.previews.delete(oldest)\n }\n const previewId = randomUUID()\n const expiresAt = Date.now() + PREVIEW_TTL_MS\n this.previews.set(previewId, { entryId: bundleId, packageName: entry.moduleName, targetEnabled, expiresAt })\n return { previewId, profileName: this.profileName, packageName: entry.moduleName, expiresAt: new Date(expiresAt).toISOString() }\n }\n\n previewDisable(bundleId: string) {\n return this.mintPreview(bundleId, false)\n }\n\n previewEnable(bundleId: string) {\n return this.mintPreview(bundleId, true)\n }\n\n // `controller.setEnabled()` applies the change through Cordis' own reactive\n // Loader (`entry.update({ disabled: ... })`, spec 032's hot-reload\n // mechanism) before resolving - a resolved call has already taken effect\n // live, so success here always means `live: true`. `MarketDesktopPlugins`\n // (@acryldev/cordis-plugin-market/src/host/routes.ts) requires this field to decide\n // `restartRequired`; omitting it left `restartRequired` permanently `true`\n // for Web regardless of whether the toggle actually applied live.\n private async execute(previewId: string, targetEnabled: boolean): Promise<{ readonly packageName: string; readonly live: boolean }> {\n const preview = this.previews.get(previewId)\n if (preview === undefined || preview.targetEnabled !== targetEnabled) {\n throw new Error('web plugins: preview not found or expired')\n }\n this.previews.delete(previewId)\n if (Date.now() > preview.expiresAt) throw new Error('web plugins: preview expired')\n await this.controller.setEnabled(preview.entryId, targetEnabled)\n return { packageName: preview.packageName, live: true }\n }\n\n executeDisable(previewId: string): Promise<{ readonly packageName: string; readonly live: boolean }> {\n return this.execute(previewId, false)\n }\n\n executeEnable(previewId: string): Promise<{ readonly packageName: string; readonly live: boolean }> {\n return this.execute(previewId, true)\n }\n}\n\n/**\n * Web's own `livePluginActivation` (spec 034 T006 follow-up, prompted by a\n * real user hitting the gap: installing through the Market left the new\n * plugin inactive until a full server-process restart). Matches Desktop's\n * own `LivePluginActivationService` (`acryl-desktop/src/plugins/lifecycle/plugin-lifecycle-\n * controller.ts`) almost line for line - both are thin wrappers over the\n * exact same shared `AcrPluginLifecycleController` (spec 034 T005), whose\n * `activate()`/`deactivate()`/`setEnabledByPackageName()`/`statusOfPackage()`\n * are already fully generic: `activate()` resolves the just-installed\n * package's own Loader row through `PluginLifecycleHost.bundleRow()` (backed\n * here by the same `resolvePackageJson` this file's own `provideWebMarketPlugins`\n * already wires up) and mounts it into the *live* Loader tree via\n * `ctx.loader.create()` - the same proven, still-shipped host-side hot-mount\n * mechanism `specs/032-universal-hot-reload`'s T1/T2/T4/T5 already landed and\n * use elsewhere. Nothing new or risky is built here; this is reuse.\n *\n * `@acryldev/cordis-plugin-market`'s own install service calls `activate()`\n * automatically right after a successful install when this service is\n * present (`liveActivate` in `@acryldev/cordis-plugin-market/src/index.ts`), then\n * `acknowledgeLiveInstall()` (already implemented as a no-op above - no WAL\n * to acknowledge). The market's own client finishes with a full page\n * `location.reload()` - the same safe mechanism Desktop's Client half uses\n * (a renderer/webContent reload, not a process restart); Web's `location` IS\n * the browser tab, so this is the exact same operation for both surfaces,\n * not something this file needs to build separately.\n */\nexport class WebLiveActivationService extends Service {\n constructor(ctx: Context, private readonly controller: AcrPluginLifecycleController) {\n super(ctx, 'livePluginActivation')\n }\n\n async activate(packageName: string): Promise<void> {\n await this.controller.activate(packageName)\n }\n\n async deactivate(packageName: string): Promise<void> {\n await this.controller.deactivate(packageName)\n }\n\n requireModules(owner: string, modules: readonly string[]): Promise<void> {\n return this.controller.requireModules(owner, modules)\n }\n\n setEnabled(packageName: string, enabled: boolean): Promise<boolean> {\n return this.controller.setEnabledByPackageName(packageName, enabled)\n }\n\n statusOf(packageName: string): 'active' | 'disabled' | undefined {\n return this.controller.statusOfPackage(packageName)\n }\n}\n\n/**\n * Mount the shared plugin lifecycle for Web (not yet done anywhere in this\n * surface before this file) and provide the market-shaped view over it,\n * plus live activation so a Market install/uninstall takes effect without a\n * server-process restart.\n * @param ctx - the host root (matching `provideWebMarketInstall`'s own timing/scope).\n * @param options - the same options shape the CLI's own `plugin-command.ts` already builds.\n */\nexport function provideWebMarketPlugins(ctx: Context, options: DshPluginLifecycleOptions): void {\n const lifecycle = mountAcrylPluginLifecycle(ctx, options)\n ctx.plugin(WebPluginsService, { controller: lifecycle.controller, profileName: options.profileName })\n ctx.plugin(WebLiveActivationService, lifecycle.controller)\n}\n","/**\n * The `dsh` engine provider (spec 028): mounts the pinned Harness profile as\n * one Loader row under `createAcrylEngineHost`'s persistent root, instead of\n * the second Cordis root `boot()`/`bootAcrylHarnessProfile` creates. Performs\n * the identical composition - the HMR guard, workspace-status/session-log-\n * exporter wiring - so selecting `dsh` behaves exactly like today's direct\n * boot (SC-004).\n *\n * Two entry points share the mounting primitive (`mountDshEngine`) but differ\n * in where the composition comes from: {@link createDshEngineDefinition} is\n * the CLI/TUI flavor, resolving a named profile through this package's own\n * profile system; {@link createDshEngineDefinitionFromComposition} takes an\n * already-resolved `{rootConfig, patches, bareModuleBaseUrl}` a surface with\n * its own profile pipeline (Desktop's `prepareDesktopProfile()`) produced\n * itself. Neither does the other's job.\n *\n * `mountRootInclude` (unlike `boot()`) composes onto an already-initialized\n * Loader rather than creating its own, but it does not scope the Include row\n * it creates to the calling plugin's own fiber - this plugin owns and\n * removes it explicitly via `ctx.effect()`. Verified with a real Loader\n * activation in `tests/engine-host-mount-root-include.spec.ts` before this\n * file trusted the pattern.\n */\n\nimport { brandWebIndex } from './web-favicon.ts'\nimport { existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, realpathSync, rmSync, symlinkSync, writeFileSync } from 'node:fs'\nimport { createRequire, findPackageJSON } from 'node:module'\nimport { basename, dirname, join } from 'node:path'\nimport { fileURLToPath, pathToFileURL } from 'node:url'\nimport type { Context } from '@deepseek-ai/cordis'\nimport type { PatchOptions } from '@deepseek-ai/cordis-plugin-include'\nimport {\n DEFAULT_PROFILE_BUNDLES,\n PROFILE_TEMPLATES,\n composeEntries,\n createRuntimeResolution,\n initProfile,\n loadOverlayPatches,\n loadProfile,\n removeLinkProjections,\n mountRootInclude,\n resolveProfileDir,\n type Profile,\n type ProfileContext,\n type RuntimeResolution,\n} from '@deepseek-ai/dsh-app-boot'\nimport { dshHomePath } from '@deepseek-ai/dsh-home-paths'\nimport { homePluginsDir } from '@acryldev/plugin-hub-core'\nimport { provideAcrylTools } from './engine-tools.ts'\nimport * as acrylWebService from '@acryldev/web'\nimport type {} from '@deepseek-ai/dsh-host-webserver'\n\nimport { provideCliMarketInstall } from './cli-market-install.ts'\nimport { provideCliMarketPlugins } from './cli-market-plugins.ts'\nimport type { AcrylCodingCapabilityId, AcrylShellMode, AcrylSurface } from './coding-capabilities.ts'\nimport type { AcrylEngineDefinition } from './engine-host.ts'\nimport { installAcrylWorkspaceStatusTool } from './plugin-acryl-workspace-status.ts'\nimport { blueprintFromEnvironment, composeBlueprintRows, currentModule, packageOfModule } from './blueprint/index.ts'\nimport { findFreeWebPort, loopbackPortIsFree, webPortPatch } from './web-port.ts'\nimport { LOOPBACK_WEB_HOST, selectInstance, type AppInstance } from './instance/index.ts'\nimport { claimProfile } from './profile-owner.ts'\nimport { pluginLifecyclePatches, readUserMutableBundleNames, resolvePluginLifecycleStatePath } from './plugin-lifecycle-state.ts'\nimport { ProfilePluginPackages } from './profile-resolution/service.ts'\nimport { installSessionLogExporter } from './session-log-exporter.ts'\nimport { provideWebMarketInstall } from './web-market-install.ts'\nimport { provideWebMarketPlugins } from './web-market-plugins.ts'\n\nconst require = createRequire(import.meta.url)\nconst dshInstallAnchor = require.resolve('@deepseek-ai/dsh/package.json')\nconst profileRoot = '[]\\n'\n\n/** The agent presets DSH 0.2 ships, in roster order. */\nconst SHIPPED_PRESET_NAMES: readonly string[] = ['standard', 'ptc', 'minimal', 'cordis']\n\n/**\n * The terminal's agent presets. DSH 0.2 declares each preset as a bundle patch of `dsh-web-app` (`presets/<name>.patch.yml`\n * inserts a `preset-<name>` row) and has no terminal app bundle, so a terminal profile on `dsh-base` alone has an empty roster.\n * ACRYL layers the same four files in, skipping any preset row the profile already composes (a Web-shaped profile booted by the CLI).\n */\nfunction terminalPresetPatches(existingRowIds: ReadonlySet<string>): PatchOptions[] {\n const presetsDir = join(dirname(require.resolve('@deepseek-ai/dsh-web-app/package.json')), 'presets')\n const presets = SHIPPED_PRESET_NAMES.flatMap(name => loadOverlayPatches('acryl', join(presetsDir, `${name}.patch.yml`)).flatMap((patch) => {\n if (!('insert' in patch) || patch.insert === undefined) return [patch]\n const insert = patch.insert.filter(row => row.id === undefined || !existingRowIds.has(row.id))\n return insert.length === 0 ? [] : [{ ...patch, insert }]\n }))\n // The presets' delegation tools run with `modelSelectionSettings: true`, which requires the settings row `dsh-web-app` itself composes\n // next to them; without it every preset's subagent tool failed to load in the terminal.\n return existingRowIds.has(SUBAGENT_MODEL_SETTINGS_ROW.id) ? presets : [{ insert: [SUBAGENT_MODEL_SETTINGS_ROW] }, ...presets]\n}\n\n/** `dsh-web-app`'s Host row that the presets' `modelSelectionSettings` delegation tools require. */\nconst SUBAGENT_MODEL_SETTINGS_ROW = { id: 'subagent-model-selection-settings', name: '@deepseek-ai/dsh-tool-subagent/model-selection-settings' } as const\n\n/** An already-resolved dsh composition: what one surface's own profile pipeline produced. */\nexport interface DshEngineComposition {\n readonly rootConfig: string\n readonly patches: readonly PatchOptions[]\n /** Resolves worker-only bare-module URLs (e.g. `/plugins/...`); omitted when the surface serves no such URLs. */\n readonly bareModuleBaseUrl?: string\n /** Which ACRYL surface this is (`tui`, `web`, `desktop`) - becomes part of the durable session-log filename. */\n readonly surface: string\n /** The product name the page title carries (the Blueprint's brand); defaults to `ACRYL`. */\n readonly productName?: string\n /** The stock ACRYL brand (not a Blueprint's own): the served page wears the ACRYL icon. */\n readonly stockBrand?: boolean\n /** The app this composition belongs to; provided to plugins as the `appInstance` service. Chosen by the surface's composition root. */\n readonly instance?: AppInstance\n /** File URL of the surface's own `package.json` (where ACRYL-owned workspace packages resolve from); provided to plugins\n * as the `acrylFrameworkPackages` service. Omitted where materializing an ACRYL framework package into a local\n * extension's profile does not apply (for example, a composition root with its own separate profile pipeline). */\n readonly installPackageUrl?: string\n /**\n * The package table `@deepseek-ai/dsh-app-boot` computes for this profile (DSH 0.2). Since 0.2 a profile no longer carries link\n * projections of the installation's packages; the `pluginPackages` service (ACRYL's `ProfilePluginPackages`) answers every bare-package import from this table, so\n * the engine mounts it before the profile include. Compute it with {@link createProfileRuntimeResolution} after every\n * ACRYL-owned package has been materialized into the profile.\n */\n readonly runtimeResolution?: RuntimeResolution\n /**\n * The profile facts DSH 0.2 reads for live configuration. `config-editor`, `settings` (the Models page, where credentials are\n * entered) and the plugin manager are only enabled while a `profileContext` exists, exactly as stock `dsh` provides one.\n * Never named `desktop`: that name would also switch on upstream's product telemetry rows.\n */\n readonly profileContext?: ProfileContext\n}\n/**\n * The surface's coding-capability composition, handed to an engine definition by the app that owns it: the plugins package for the\n * rows, the package names, the anchor they resolve from, and the rows the advanced shell replaces. `@acryldev/coding-capabilities` is\n * the one implementation; the runtime never imports it (its Blueprint vocabulary lives in `coding-capabilities.ts`).\n */\nexport interface CodingCapabilities {\n /** Installations whose `node_modules` may hold a package the composition names, in order (the surface's, then the composition package's). */\n readonly anchors: readonly string[]\n patches(surface: ReadonlySet<AcrylSurface>, existingRowIds: ReadonlySet<string>, only: ReadonlySet<AcrylCodingCapabilityId>): readonly PatchOptions[]\n shellPatches(surface: ReadonlySet<AcrylSurface>, shellMode: AcrylShellMode, existingRowIds: ReadonlySet<string>, only: ReadonlySet<AcrylCodingCapabilityId>): readonly PatchOptions[]\n /** The ACRYL-owned packages a surface must make resolvable for the capabilities it composes. */\n packages(surface: ReadonlySet<AcrylSurface>, only: ReadonlySet<AcrylCodingCapabilityId>): readonly string[]\n /** The rows the advanced shell replaces (`ADVANCED_SHELL_PATCHES`), for a Blueprint with an `app-shell` row. */\n readonly appFramePatches: readonly PatchOptions[]\n}\n\n\n/**\n * ACRYL's own patches out of a composed list laid out as `[bundle layers..., ACRYL additions..., profile's own patches..., later ACRYL\n * additions...]`. DSH 0.2's live configuration (`config-editor`, `hmr`) rebuilds the Loader from stock sources (bundle layers, the\n * profile file, the home file) plus `ProfileContext.overlays`; ACRYL's capability rows, blueprint rows, presets and plugin-lifecycle\n * toggles exist only in memory, so they must be handed over as overlays or the first edit would reload them away and be rolled back.\n */\nfunction acrylAdditions(\n patches: readonly PatchOptions[],\n layout: { readonly layerPatches: number, readonly userPatches: number, readonly composedBeforeLater: number },\n): PatchOptions[] {\n const userStart = layout.composedBeforeLater - layout.userPatches\n return [...patches.slice(layout.layerPatches, userStart), ...patches.slice(layout.composedBeforeLater)]\n}\n\n/** Module HMR is never wanted (see `mountDshEngine`); it has to be part of every reload as well as of the first mount. */\nconst HMR_OFF: PatchOptions = { id: 'hmr', disabled: true }\n\n/**\n * DeepSeek's own product analytics, which DSH's Web bundle switches on for any profile named `desktop` (Desktop's profile is) and which report\n * to DeepSeek's collector. ACRYL is not that product: they are off on every surface, at the first mount and at every reload, instead of\n * depending on a profile name. Mounted, the Host row also failed its config at every start, since only DeepSeek's shell sets its\n * `serviceVersion` (`DSH_CLIENT_VERSION`).\n */\nexport const UPSTREAM_PRODUCT_ANALYTICS_OFF: readonly PatchOptions[] = Object.freeze([\n { id: 'desktop-product-telemetry', disabled: true },\n { id: 'product-analytics', disabled: true },\n])\n\n/**\n * The patches an app instance contributes to every composition: an instance that must not use the OS user's Documents folder points the chat's first\n * workspace at its own `documents` folder. A patch for a row the surface does not compose (the terminal has no workspace controller) is ignored.\n */\nexport function instancePatches(instance: AppInstance | undefined): readonly PatchOptions[] {\n return instance?.documentsDirectory === undefined ? [] : [{ id: 'workspace-controller', config: { documentsDirectory: instance.documentsDirectory } }]\n}\n\n/** The profile facts a launcher hands to DSH's live configuration (stock `dsh`: `profile-boot`, `runProfile`). */\nexport function createProfileContext(\n profile: Profile,\n options: {\n readonly installAnchor?: string\n readonly home: string\n readonly packageManager?: ProfileContext['packageManager']\n /** ACRYL's in-memory patches that a configuration reload must keep applying (see {@link acrylAdditions}). */\n readonly overlays?: readonly PatchOptions[]\n /** The app instance, whose own patches (see {@link instancePatches}) a reload must keep applying as well. */\n readonly instance?: AppInstance\n },\n): ProfileContext {\n return {\n name: profile.name,\n ...(options.packageManager === undefined ? {} : { packageManager: options.packageManager }),\n dir: profile.dir,\n patchPath: profile.patchPath,\n installAnchor: options.installAnchor ?? dshInstallAnchor,\n cwd: process.cwd(),\n home: options.home,\n startedBundles: profile.layers.map(layer => layer.packageName),\n overlays: [...(options.overlays ?? []), HMR_OFF, ...UPSTREAM_PRODUCT_ANALYTICS_OFF, ...instancePatches(options.instance)],\n telemetryDisabledEnv: process.env.DSH_TELEMETRY_DISABLED,\n }\n}\n\n/**\n * The runtime resolution for a loaded profile, as stock `dsh` computes it (`profile-boot`: `composeProfile`).\n * @param installAnchor - the `package.json` whose dependency closure the profile may import from. Defaults to the `dsh`\n * package; a surface that ships ACRYL-owned packages (Desktop) passes its own, so those resolve like any dependency.\n */\nexport function createProfileRuntimeResolution(profile: Profile, installAnchor: string = dshInstallAnchor): Promise<RuntimeResolution> {\n return createRuntimeResolution({ installAnchor, profile })\n}\n\n/**\n * Mount an already-resolved dsh composition under the given already-\n * initialized Loader `ctx`. Does no profile resolution of its own - the\n * caller (a CLI `--profile` name resolved via `resolveProfileDir`/\n * `loadProfile`, or Desktop's own `prepareDesktopProfile()`) already\n * produced `rootConfig`/`patches`/`bareModuleBaseUrl`.\n */\nasync function mountDshEngine(ctx: Context, composition: DshEngineComposition): Promise<void> {\n // DSH 0.2 enables the `hmr` row whenever a `profileContext` exists. It only watches the profile files for edits made outside the app\n // (and needs Loader internals plus a launcher readiness signal); in-app edits (`config-editor`, Settings, Models) reconcile the Loader\n // themselves. ACRYL activates and reloads plugins through Loader entries and `livePluginActivation`, so every composition switches it off.\n // Left on, it also stalls engine disposal after a swap (its queued reload waits on a tree that is unloading).\n const patches: PatchOptions[] = [...composition.patches, HMR_OFF, ...UPSTREAM_PRODUCT_ANALYTICS_OFF, ...instancePatches(composition.instance ?? selectInstance())]\n // This assignment feeds mountRootInclude's own nested composition tree\n // (constructed below, from this ctx) - not the host root's own top-level\n // tree, whose baseUrl is a one-time snapshot taken when `createAcrylEngineHost`\n // calls `ctx.plugin(Loader)`, long before this plugin function ever runs\n // (see engine-host.ts's `HOST_ROOT_BASE_URL`). Setting `ctx.baseUrl` here\n // reaches only entries nested inside mountRootInclude's own subtree (the\n // real DSH profile plugins) - the \"acryl-engine-<id>\" and sibling\n // \"cordis:include\" rows at the host's own top level are unaffected by\n // anything this function does.\n ctx.baseUrl = pathToFileURL(dirname(composition.rootConfig)).href + '/'\n // mountRootInclude's Include entry lands as a sibling of this plugin's own\n // entry in the shared host Loader tree, not a descendant of it (the same\n // fact behind the disposal fix above) - ctx.provide() on this plugin's own\n // forked ctx would not be an ancestor of that sibling's consumers.\n // ctx.root is the one scope every entry in the tree shares. dshHomePath is\n // a static, engine-agnostic value (home-path resolution helpers, not\n // per-engine state), so it is provided once and left on the host's root\n // rather than disposed per engine swap - re-providing it on a later\n // re-mount of `dsh` would otherwise throw \"service already registered\".\n if (ctx.root.get('dshHomePath') === undefined) ctx.root.provide('dshHomePath', dshHomePath)\n // The app's resource family (instance/): plugins read where their app keeps things from here, never from the environment or the OS home.\n const provided = ctx.root.get('appInstance' as never) as AppInstance | undefined\n const instance = provided ?? composition.instance ?? selectInstance()\n if (provided === undefined) ctx.root.provide('appInstance', instance)\n if (composition.installPackageUrl !== undefined && ctx.root.get('acrylFrameworkPackages' as never) === undefined) {\n ctx.root.provide('acrylFrameworkPackages', createAcrylFrameworkPackages(ctx, composition.installPackageUrl))\n }\n // Owned by this engine's fiber (not the root), so an engine swap releases the interception with the profile it served.\n if (composition.runtimeResolution !== undefined) await ctx.plugin(ProfilePluginPackages, { resolution: composition.runtimeResolution })\n if (composition.profileContext !== undefined && ctx.root.get('profileContext' as never) === undefined) ctx.root.provide('profileContext', composition.profileContext)\n // The include is recorded under the context it is mounted on, and DSH's profile reload (`config-editor`, `hmr`) looks it up on the\n // root context, so mount it there: a reload then finds \"the root Include entry\" and an edit can be applied and kept.\n const entry = await mountRootInclude(ctx.root, composition.rootConfig, patches, composition.bareModuleBaseUrl)\n // mountRootInclude creates its Include row at the Loader's own top level -\n // it has no `parent` parameter and is not scoped to this plugin's own\n // fiber the way ctx.effect() resources are. Without this, an engine swap\n // away from `dsh` would leave the whole profile tree mounted forever.\n if (entry !== undefined) {\n // Loader 1.0.5's `remove` starts the row's disposal without waiting for it, so wait for the include's fiber here:\n // a swap away from `dsh` must not return while the profile's services are still registered.\n ctx.effect(() => async () => {\n const fiber = entry.fiber\n ctx.loader.remove(entry.options.id)\n // On a swap the root stays up and the caller must see the profile gone; when the whole root is disposing, the include goes with it\n // and waiting on it here would wait on the very disposal that is running this effect.\n if (ctx.root.fiber.state === 2) await fiber?.dispose()\n })\n }\n // Do not call ctx.loader.await() here: this function is itself running as\n // part of one Loader entry's activation, and awaiting the same loader from\n // inside it deadlocks. createAcrylEngineHost's own ctx.loader.await(),\n // called from outside any entry after ctx.loader.create()/update()\n // resolves, already settles this nested tree too - proven in\n // tests/engine-host-mount-root-include.spec.ts.\n //\n // installAcrylWorkspaceStatusTool does bare ctx.tools property access,\n // which is topology-sensitive and requires a declared injection (not\n // satisfied by this plugin's own forked ctx, for the same sibling-not-\n // descendant reason as the dshHomePath fix above). ctx.inject(['tools'])\n // resolves that safely. Neither installAcrylWorkspaceStatusTool nor its\n // own `apply()` Cordis-plugin form wraps ctx.tools.register()'s returned\n // disposer in ctx.effect() (true of its other two callers too, harmless\n // there only because they own a whole process-lifetime root) - this\n // plugin must own that disposer itself, or an engine swap away from and\n // back to `dsh` would double-register the tool.\n // Guarded exactly like bootAcrylHarnessProfile's original check - some\n // profile variants legitimately have no ctx.tools at all (SC-004: this\n // extraction must not change that behavior).\n if (ctx.get('tools') !== undefined) {\n ctx.inject(['tools'], toolsCtx => {\n const disposeTool = installAcrylWorkspaceStatusTool(toolsCtx)\n ctx.effect(() => disposeTool)\n })\n }\n // ctx.logger is an ambient Cordis primitive, not a topology-sensitive\n // injected service (unlike ctx.tools), and ctx.logger.exporter() already\n // ties its own disposal to the ctx that registers it (see\n // installSessionLogExporter's own doc comment) - this plugin's own ctx is\n // correct here, unlike the two cases above.\n installSessionLogExporter(ctx, { surface: composition.surface, dshHome: instance.dshHome })\n // Web only: the shell HTML dsh-web-app serves is a pinned\n // @deepseek-ai/dsh-web-frontend build artifact with a hardcoded\n // \"DeepSeek Harness\" <title> - not part of the pluggable Cordis Client\n // slot system the brand-swap patch (resolveWebEngineComposition) actually\n // covers, so swapping ui-brand-official for ui-acryl alone leaves the\n // visible browser-tab title wrong. Reproduced directly: a real served\n // index still read \"<title>DeepSeek Harness</title>\" after the brand-swap\n // patch landed. Desktop does not have this gap - electron-shell-\n // generation.ts already suppresses page-title-updated and keeps its\n // native window title fixed at the OS level, so this vendored HTML's\n // <title> never reaches anything the user sees there; Web has no native\n // window, so this served HTML's own <title> IS the visible artifact.\n // dsh-host-webserver's WebServer service exposes tapIndex(transform) as\n // its own designed escape hatch for exactly this class of rewrite (\"no\n // IndexInjection row exists for this\", per its own doc comment) -\n // registering a tap here, rather than editing the vendored\n // dsh-web-frontend package, which the project's own repo rules forbid.\n // The same tap swaps the favicon for the ACRYL logo, inlined as a data URL\n // (web-favicon.ts), so no route or static asset is needed.\n // The web port ACRYL's own plugins depend on (instead of DSH's `webServer`): Web and Desktop have a page, the terminal has none.\n // The same plugin every Blends app mounts (row acryl-web); it waits for webServer by its own inject.\n if (composition.surface !== 'tui') ctx.plugin(acrylWebService)\n // The tools port every surface can offer (the terminal's chat has the same registry).\n ctx.inject(['tools'], toolsCtx => { provideAcrylTools(toolsCtx) })\n if (composition.surface === 'web') {\n ctx.inject(['webServer'], webServerCtx => {\n // A custom brand ships its own favicon (@acryldev/brand); only the stock ACRYL brand gets the ACRYL logo (`productName` is always set, so it cannot tell).\n const disposeTap = webServerCtx.webServer.tapIndex(html => brandWebIndex(html, composition))\n ctx.effect(() => disposeTap)\n })\n // Web's own desktopPlugins/livePluginActivation (spec 034 T006) - mounted\n // BEFORE desktopProfiles/desktopPnpm below on purpose. dsh-community-\n // market's own ctx.inject(['desktopProfiles', 'desktopPnpm'], ...) reads\n // ctx.get('livePluginActivation') exactly once, opportunistically, the\n // moment that inject's dependencies first resolve - not reactively, so a\n // livePluginActivation provided AFTER that moment is captured as\n // `undefined` for the fiber's whole life. Reproduced directly: with the\n // reverse order, a real install through the Market succeeded but the\n // installed plugin never became active without a full process restart -\n // no error anywhere, just a silently-missed live-activation opportunity.\n // Web has no shared plugin-lifecycle mount at all before this - CLI's and\n // Desktop's own each mount it separately, so this is the first time Web\n // gets one. Guarded like dshHomePath above: an engine swap away from and\n // back to `dsh` must not re-provide an already-registered service.\n if (ctx.root.get('desktopPlugins') === undefined) {\n const profileDir = dirname(composition.rootConfig)\n provideWebMarketPlugins(ctx.root, {\n profileName: 'web',\n profileDir,\n statePath: resolvePluginLifecycleStatePath(),\n binName: 'acryl-web',\n // `createDshPluginLifecycleHost`'s own internal wrapper already\n // appends \"/package.json\" before calling this callback - despite the\n // option's own parameter being named `packageName`, what actually\n // arrives here is the full \"<packageName>/package.json\" specifier\n // already. Reproduced directly: a real live-activation attempt threw\n // ERR_PACKAGE_PATH_NOT_EXPORTED on a literal \"package.json/package.json\"\n // subpath before this fix - the same latent bug exists in acryl-cli's\n // own plugin-command.ts, just never exercised there (the CLI has no\n // install/live-activation path yet, spec 034 T006).\n resolvePackageJson: specifier => createRequire(pathToFileURL(join(profileDir, 'package.json'))).resolve(specifier),\n })\n }\n // Web's own desktopProfiles/desktopPnpm (spec 034 T006, scoped v1) - what\n // @acryldev/cordis-plugin-market's install service needs for its Install/Uninstall\n // buttons to do a real operation instead of showing \"ACRYL is required\".\n // Both are stateless besides this one profile's own fixed name/directory,\n // so - also like dshHomePath - never disposed; there is nothing to\n // invalidate by leaving them registered for the process's whole life.\n if (ctx.root.get('desktopProfiles') === undefined) {\n provideWebMarketInstall(ctx.root, dirname(composition.rootConfig))\n }\n }\n // CLI/TUI's own desktopPlugins/livePluginActivation + desktopProfiles/\n // desktopPnpm (spec 034 T006, completing the third surface) - same\n // ordering constraint as Web above (mount desktopPlugins first, since\n // @acryldev/cordis-plugin-market's own ctx.inject(['desktopProfiles', 'desktopPnpm'])\n // reads ctx.get('livePluginActivation') exactly once, opportunistically).\n // Unlike Web, the CLI has more than one named profile, so the profile name\n // comes from this composition's own directory rather than a literal - see\n // dsh-app-boot's own `$DSH_HOME/profiles/<name>` layout contract.\n if (composition.surface === 'tui') {\n const profileDir = dirname(composition.rootConfig)\n const profileName = basename(profileDir)\n if (ctx.root.get('desktopPlugins') === undefined) {\n provideCliMarketPlugins(ctx.root, {\n profileName,\n profileDir,\n statePath: resolvePluginLifecycleStatePath(),\n binName: 'acryl',\n // Same double-append trap as web-market-plugins.ts's own resolvePackageJson\n // and acryl-cli's own plugin-command.ts: createDshPluginLifecycleHost's\n // internal wrapper already appends \"/package.json\" before calling this.\n resolvePackageJson: specifier => createRequire(pathToFileURL(join(profileDir, 'package.json'))).resolve(specifier),\n })\n }\n if (ctx.root.get('desktopProfiles') === undefined) {\n provideCliMarketInstall(ctx.root, { name: profileName, dir: profileDir })\n }\n }\n}\n\n/** An app folder's own definition is its Blueprint unless one was chosen explicitly. */\nfunction instanceBlueprintEnvironment(instance: AppInstance): NodeJS.ProcessEnv {\n const explicit = process.env.ACRYL_BLUEPRINT\n return explicit === undefined || explicit.trim() === '' ? { ...process.env, ...(instance.definitionFile === undefined ? {} : { ACRYL_BLUEPRINT: instance.definitionFile }) } : process.env\n}\n\n/** Resolve the pinned Harness `acryl` profile by name into a mountable composition (the CLI/TUI flavor). */\nasync function resolveDshEngineComposition(profileName: string, capabilities: CodingCapabilities | undefined): Promise<DshEngineComposition> {\n // The composition root for the CLI surface: the app instance is chosen here, once. The pinned harness reads its home from DSH_HOME, so the instance is\n // handed across that boundary through the environment.\n const instance = selectInstance()\n process.env.DSH_HOME = instance.dshHome\n // Read by `acryl_workspace_status`: the agent must learn the real surface and profile, not a fallback label.\n process.env.ACRYL_SURFACE = 'tui'\n process.env.ACRYL_PROFILE = profileName\n const profileDirectory = resolveProfileDir(profileName)\n initProfile(profileDirectory, DEFAULT_PROFILE_BUNDLES)\n removeLinkProjections(profileDirectory)\n const profile = loadProfile('acryl', profileName, dshInstallAnchor)\n const rootConfig = join(profile.dir, 'cordis.yml')\n // Refuse to re-link a profile another live ACRYL installation is running from (profile-owner.ts).\n claimProfile(profile.dir, installationRoot(import.meta.url))\n writeFileSync(rootConfig, profileRoot)\n const profileLayerPatches = profile.layers.flatMap(layer => layer.patches)\n // A profile directory booted through this CLI/TUI flavor is not necessarily\n // tui-shaped: `--profile <name>` can point at one created by Desktop/Web's\n // own richer template, whose bundle already composes agent-presets/persona/\n // session-stats natively. Without this, ACRYL's own tui-only insert of the\n // same row ids collides at boot (spec 034 T008).\n const existingRowIds = new Set(composeEntries([profileLayerPatches]).map(entry => entry.id))\n const blueprint = blueprintFromEnvironment(instanceBlueprintEnvironment(instance))\n process.env.ACRYL_BLUEPRINT_ID = blueprint.id\n process.env.ACRYL_BLUEPRINT_NAME = blueprint.name\n const rowsComposition = composeBlueprintRows(blueprint, 'tui', existingRowIds, capabilities?.appFramePatches ?? [])\n const patches = structuredClone([\n ...profileLayerPatches,\n ...(capabilities?.patches(new Set(['tui']), existingRowIds, new Set(blueprint.capabilities)) ?? []),\n ...profile.patches,\n ])\n const composedBeforeLater = patches.length\n // The Blueprint's ACRYL-owned rows (extension pack, prompt shaping) and the terminal UI library (a plain library a\n // terminal plugin imports, so it is only made resolvable). Rows the profile's own bundle already composes are skipped\n // by `composeBlueprintRows` (a Desktop/Web-shaped profile booted through the CLI).\n // The ACRYL packages the terminal's coding capabilities name (`@acryldev/settings`), resolvable from this profile like the Web surface's.\n const tuiCapabilityPackages = capabilities?.packages(new Set(['tui'] as const), new Set(blueprint.capabilities)) ?? []\n for (const packageName of [...tuiCapabilityPackages, ...rowsComposition.packages]) materializeFrom(profile.dir, packageName, [...(capabilities?.anchors ?? []), import.meta.url])\n patches.push(...rowsComposition.patches)\n patches.push(...terminalPresetPatches(existingRowIds))\n // The profile's own user overrides come from the shared store, not from this\n // surface: `acryl plugin disable` on a TUI writes the same file the Desktop\n // panel and the Web surface read, so the next boot of any of them composes\n // the same plugin set.\n patches.push(...pluginLifecyclePatches({\n profileName,\n statePath: resolvePluginLifecycleStatePath(),\n }, rowIdsOf(patches)))\n return { rootConfig, patches, surface: 'tui', instance, installPackageUrl: import.meta.url, runtimeResolution: await createProfileRuntimeResolution(profile), profileContext: createProfileContext(profile, { home: instance.dshHome, instance, overlays: acrylAdditions(patches, { layerPatches: profileLayerPatches.length, userPatches: profile.patches.length, composedBeforeLater }) }) }\n}\n\n/**\n * Build the `dsh` engine definition for `createAcrylEngineHost`, bound to\n * one profile name resolved at host-creation time (a CLI `--profile`\n * argument, not something an engine swap changes later).\n */\nexport function createDshEngineDefinition(profileName: string, capabilities?: CodingCapabilities): AcrylEngineDefinition {\n if (profileName.trim() === '') throw new Error('ACRYL dsh engine profile must not be empty')\n return {\n id: 'dsh',\n plugin: async (ctx: Context) => mountDshEngine(ctx, await resolveDshEngineComposition(profileName, capabilities)),\n }\n}\n\n/**\n * Add one declared dependency to a Loader row's `inject` metadata. A patch\n * replaces the whole value, so the row's own declaration is preserved in either\n * the list or the map form Cordis accepts.\n */\nfunction withDeclaredDependency(inject: unknown, name: string): string[] | Record<string, unknown> {\n if (Array.isArray(inject)) return inject.includes(name) ? [...inject] : [...inject, name]\n if (inject !== null && typeof inject === 'object') {\n const declared = inject as Record<string, unknown>\n return name in declared ? { ...declared } : { ...declared, [name]: null }\n }\n return [name]\n}\n\n/**\n * Symlink one ACRYL-owned package into a profile's own `node_modules`, so\n * Node's ordinary bare-specifier resolution - the only mechanism\n * `HostResolvedRootInclude`'s composed rows use, verified directly by\n * logging every `resolve()` call: `context.parentURL` is always the\n * profile's own `package.json`, never `@deepseek-ai/cordis-plugin-loader`'s\n * own entry - can find it. A resolution-hook overlay (matching\n * `acryl-desktop`'s `installProfilePackageResolver`) cannot help here: it\n * only intercepts imports whose parent is the Loader's own entry module,\n * which this composition style never uses. Idempotent: replaces a stale\n * symlink pointing elsewhere, leaves an already-correct one untouched.\n *\n * The \"stale\" case is not hypothetical - it is the actual CI failure mode.\n * `release-cli.yml`'s `web` job runs the test suite and\n * `verify-npm-web-entrypoint.mjs` *before* building and smoke-testing the\n * release archive, in the same job, against the same shared\n * `~/.acryl/.dsh` home. Both earlier steps materialize this exact symlink\n * pointing at their own temporary staging directories, then delete those\n * directories in their own cleanup - leaving a **dangling** symlink behind\n * in the shared profile, not a missing one. The later archive-smoke step's\n * own `materializeProfilePackage` call then hits `EEXIST` (something is\n * there) and, before this fix, called `realpathSync.native` on it to\n * decide whether to replace it - which throws `ENOENT` on a dangling\n * symlink instead of returning a comparable path, crashing where the\n * function should simply have replaced the stale link. (An earlier pass\n * misdiagnosed this as an N-way in-process race and added a same-process\n * memo guard; that guard was harmless but irrelevant - every reproduction\n * that actually matched CI's real symptom involved *no* concurrency at\n * all, just one process inheriting another, earlier process's leftover\n * dangling link.)\n */\n/**\n * Materialize one package from the first anchor that has it: an ACRYL capability package comes from the surface's composition\n * (`@acryldev/coding-capabilities`), while the Blueprint's framework-kit packages (`acrylblends`, `@acryldev/ui`) come from the runtime's own\n * installation. Either anchor is a real installation; the first that resolves wins (spec 051 T021).\n */\nfunction materializeFrom(profileDir: string, packageName: string, anchors: readonly (string | undefined)[]): void {\n let failure: unknown\n for (const anchor of anchors) {\n if (anchor === undefined) continue\n try {\n materializeProfilePackage(profileDir, packageName, anchor)\n return\n } catch (error) {\n failure = error\n }\n }\n throw failure\n}\n\n/** The installation a module belongs to: the directory of its nearest package.json (the runtime or surface package of that checkout or install). */\nfunction installationRoot(moduleUrl: string): string {\n const manifest = findPackageJSON(moduleUrl)\n return manifest === undefined ? fileURLToPath(moduleUrl) : dirname(manifest)\n}\n\nexport function materializeProfilePackage(profileDir: string, packageName: string, installPackageUrl: string): void {\n const manifestPath = findPackageJSON(packageName, installPackageUrl)\n if (manifestPath === undefined) {\n throw new Error(`ACRYL web profile: cannot resolve package ${JSON.stringify(packageName)} from the acryl-web installation`)\n }\n const sourceDir = dirname(manifestPath)\n const linkPath = join(profileDir, 'node_modules', packageName)\n mkdirSync(dirname(linkPath), { recursive: true })\n // `lstatSync` (not `existsSync`/`realpathSync`, both of which follow the\n // symlink and would throw or report \"missing\" for a dangling one) is the\n // only one of the three that answers \"is there a filesystem entry at\n // this exact path at all\" without caring whether it resolves.\n const hasEntry = (() => {\n try {\n lstatSync(linkPath)\n return true\n } catch {\n return false\n }\n })()\n if (hasEntry) {\n // realpathSync throws on a dangling symlink rather than returning a\n // comparable path - that case means \"stale\", exactly like a mismatch.\n let existingTarget: string | undefined\n try {\n existingTarget = realpathSync.native(linkPath)\n } catch {\n existingTarget = undefined\n }\n if (existingTarget === realpathSync.native(sourceDir)) return\n rmSync(linkPath, { force: true, recursive: true })\n }\n symlinkSync(sourceDir, linkPath, 'dir')\n}\n\n/**\n * Resolves an ACRYL-owned workspace package by name into its live on-disk install and symlinks it into a\n * profile, the same way the Blueprint's own fixed rows do ({@link materializeProfilePackage}) - these\n * packages are not published, so a local extension's `package.json` cannot name one as an ordinary npm\n * dependency. Consumed by `@acryldev/plugin-context`'s local-plugin install path (`dsh.requiresAcrylPackages`\n * in an extension's `package.json`), which also activates the materialized package as a live Loader entry\n * through the existing `livePluginActivation` service - this object only makes the package resolvable.\n */\nexport interface AcrylFrameworkPackages {\n /** Symlink the package of module `name` (read under its current name) into `profileDir`'s `node_modules`, replacing a stale link; throws if it does not resolve from this installation. */\n materialize(profileDir: string, name: string): void\n /**\n * What a required name is today: its module, the package that module lives in, and whether a Loader row of that module is mounted\n * and enabled now. A module inside a package (`acrylblends/cordis/router`) is not a DSH bundle of its own, so it can only be used\n * live when it is already mounted; a plugin in the app's `plugins/` folder that declares it gets the row at the next start.\n */\n describe(name: string): RequiredFrameworkModule\n}\n\nexport interface RequiredFrameworkModule {\n readonly module: string\n readonly packageName: string\n readonly mounted: boolean\n}\n\nfunction createAcrylFrameworkPackages(ctx: Context, installPackageUrl: string): AcrylFrameworkPackages {\n return {\n materialize: (profileDir, name) => { materializeProfilePackage(profileDir, packageOfModule(currentModule(name)), installPackageUrl) },\n describe: (name) => {\n const module = currentModule(name)\n // Read at call time: the service outlives an engine swap, and the live tree is what a plugin will run against.\n const mounted = [...ctx.root.loader.entries()].some(entry => entry.options.name === module && entry.options.disabled !== true)\n return { module, packageName: packageOfModule(module), mounted }\n },\n }\n}\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n /** Resolves an ACRYL-owned workspace package by name for a local extension to depend on (see {@link AcrylFrameworkPackages}). */\n acrylFrameworkPackages: AcrylFrameworkPackages\n }\n}\n\n/**\n * ACRYL-owned framework packages the app's own committed plugins (`<app home>/plugins/*`, `homePluginsDir`) declare\n * through `dsh.requiresAcrylPackages` in their `package.json`. Read at compose time, not through\n * `@acryldev/plugin-context`'s dynamic agent-runtime install path: `livePluginActivation.activate()`'s group\n * resolution (`PluginLifecycleController`'s `bundleGroup()`, a fixed-point-free heuristic over the live Loader\n * tree) failed a real, reproduced activation of `@acryldev/app-shell` through that path (\"invalid plugin... received\n * object\") for reasons that trace into vendored Cordis internals this repo does not edit. A static row, inserted\n * the same way the Blueprint's own fixed rows are (`composeBlueprintRows`/`materializeProfilePackage`), sidesteps\n * dynamic activation entirely and is what every one of those fixed rows already relies on successfully.\n * Never throws: a missing or malformed `package.json` is skipped, not fatal to boot.\n */\nexport function pluginRequiredFrameworkPackages(appHome: string): readonly string[] {\n const pluginsDir = homePluginsDir(appHome)\n if (!existsSync(pluginsDir)) return []\n const names = new Set<string>()\n for (const entry of readdirSync(pluginsDir, { withFileTypes: true })) {\n if (entry.isDirectory()) for (const module of requiredModulesOf(join(pluginsDir, entry.name, 'package.json'))) names.add(module)\n }\n return [...names]\n}\n\n/**\n * The modules inside a package (`acrylblends/cordis/state`) that the plugins installed in a profile (its user bundles) declare through\n * `dsh.requiresAcrylPackages`. A running app mounts such a module's row when one of them is installed (spec 049 T001); composing the same\n * rows at start keeps the next start's tree what the running one had. A whole package a plugin requires is a profile bundle of its own and\n * composes as one, so it is not listed here. Never throws: an unreadable manifest is skipped.\n */\nexport function profileRequiredFrameworkModules(profileDir: string): readonly string[] {\n const modules = new Set<string>()\n for (const bundle of readUserMutableBundleNames(profileDir)) {\n for (const module of requiredModulesOf(join(profileDir, 'node_modules', bundle, 'package.json'))) {\n if (module !== packageOfModule(module)) modules.add(module)\n }\n }\n return [...modules]\n}\n\n/** The modules one plugin's `package.json` declares in `dsh.requiresAcrylPackages`, by today's names; none when it is missing or malformed. */\nfunction requiredModulesOf(manifestPath: string): readonly string[] {\n if (!existsSync(manifestPath)) return []\n try {\n const manifest = JSON.parse(readFileSync(manifestPath, 'utf8')) as { dsh?: { requiresAcrylPackages?: unknown } }\n const required = manifest.dsh?.requiresAcrylPackages\n // Each entry is a module, mounted as its own row; a name from before the framework moved to acrylblends is read as today's module.\n return Array.isArray(required) ? required.filter((name): name is string => typeof name === 'string').map(currentModule) : []\n } catch { return [] /* a malformed plugin package.json is the plugin's own problem, reported when it installs, not here */ }\n}\n\n/** Resolve the pinned Harness `web` profile into a mountable composition (the Web flavor). */\nasync function resolveWebEngineComposition(installPackageUrl: string, capabilities: CodingCapabilities | undefined): Promise<DshEngineComposition> {\n const profileName = 'web'\n // The composition root for the Web surface: the app instance is chosen here, once (see the CLI flavor above).\n const instance = selectInstance()\n process.env.DSH_HOME = instance.dshHome\n process.env.ACRYL_SURFACE = 'web'\n process.env.ACRYL_PROFILE = profileName\n const profileDirectory = resolveProfileDir(profileName)\n // The shipped `web` template (PROFILE_TEMPLATES.web) bundles dsh-web-app\n // (dsh-client-connection, webStartup, the auth-gated index) on top of\n // dsh-base - DEFAULT_PROFILE_BUNDLES is only ['@deepseek-ai/dsh-base'], the\n // generic fallback loadProfile() uses for a *custom-named* profile with no\n // shipped template (the CLI/TUI flavor's own 'acryl'/'--profile' names).\n // initProfile() only writes package.json when one doesn't exist yet, so\n // calling it here with the wrong (too-minimal) bundle list on a profile\n // loadProfile() would otherwise auto-initialize correctly *pre-empts* that\n // correct initialization - a fresh 'web' profile then permanently has no\n // dsh-web-app bundle, so ctx.get('connection')/ctx.get('webStartup') never\n // exist and the served index falls back to its own \"authentication\n // required\" client-side message rather than ever serving the app.\n // Reproduced directly: a fresh profile's Loader entries contained no\n // \"connection\" or \"web-startup\" row at all (not pending, not failed -\n // absent) before this fix.\n const webTemplate = PROFILE_TEMPLATES.web\n initProfile(profileDirectory, webTemplate?.bundles ?? DEFAULT_PROFILE_BUNDLES)\n removeLinkProjections(profileDirectory)\n const profile = loadProfile('web', profileName, dshInstallAnchor)\n const rootConfig = join(profile.dir, 'cordis.yml')\n claimProfile(profile.dir, installationRoot(installPackageUrl))\n writeFileSync(rootConfig, profileRoot)\n const profileLayerPatches = profile.layers.flatMap(layer => layer.patches)\n // Same reasoning as the CLI/TUI flavor above: this profile's own bundle may\n // already compose a row ACRYL's own capability table would otherwise insert\n // a second time (spec 034 T008).\n const existingRowIds = new Set(composeEntries([profileLayerPatches]).map(entry => entry.id))\n // Web runs the same ACRYL shell and workspace Desktop does (spec 040, \"Surface sharing\"): both come from the\n // shared capability declarations, and the ACRYL packages they name are made resolvable from this profile.\n const blueprint = blueprintFromEnvironment(instanceBlueprintEnvironment(instance))\n process.env.ACRYL_BLUEPRINT_ID = blueprint.id\n process.env.ACRYL_BLUEPRINT_NAME = blueprint.name\n const webSurfaces = new Set(['web'] as const)\n const enabledCapabilities = new Set(blueprint.capabilities)\n const rowsComposition = composeBlueprintRows(blueprint, 'web', existingRowIds, capabilities?.appFramePatches ?? [])\n for (const packageName of [...(capabilities?.packages(webSurfaces, enabledCapabilities) ?? []), ...rowsComposition.packages]) {\n materializeFrom(profile.dir, packageName, [...(capabilities?.anchors ?? []), installPackageUrl])\n }\n // The app's own committed plugins may each need an ACRYL-owned framework package (see\n // `pluginRequiredFrameworkPackages`'s own doc comment for why this is a static row, not the dynamic\n // agent-runtime install path `@acryldev/plugin-context` otherwise uses), and a plugin installed into the\n // profile may need a module whose row the running app mounted for it (`profileRequiredFrameworkModules`).\n const composedRowIds = new Set(rowsComposition.patches.flatMap(patch => patch.insert ?? []).map(row => row.id))\n const requiredFrameworkPackages = [...new Set([...pluginRequiredFrameworkPackages(instance.home), ...profileRequiredFrameworkModules(profile.dir)])]\n .filter(module => !existingRowIds.has(module) && !composedRowIds.has(module))\n for (const module of requiredFrameworkPackages) materializeProfilePackage(profile.dir, packageOfModule(module), installPackageUrl)\n // A Blueprint that never enables the IDE's own `workspace` capability (every Blank-grown project) keeps the\n // stock `ui-layout` row active, because the advanced-shell capability's disabling patch is gated behind\n // `ACRYL_CODING_CAPABILITIES`' own capability table, which a third-party extension cannot opt into - it is\n // the IDE's, not a general extension mechanism. An extension that requires `@acryldev/app-shell` is claiming the\n // advanced shell exactly the same way that capability does, so it needs the identical row toggle (measured\n // live: without it, `@acryldev/app-shell`'s own layout service and the still-active stock one both try to\n // register the `layout` service and the Loader throws \"service \\\"layout\\\" has been registered\").\n const claimsAdvancedShell = requiredFrameworkPackages.includes('@acryldev/app-shell')\n const patches = structuredClone([\n ...profileLayerPatches,\n ...(capabilities?.patches(webSurfaces, existingRowIds, enabledCapabilities) ?? []),\n ...(capabilities?.shellPatches(webSurfaces, 'advanced', existingRowIds, enabledCapabilities) ?? []),\n ...requiredFrameworkPackages.map(name => ({ insert: [{ id: name, name }] })),\n ...(claimsAdvancedShell ? [{ id: 'ui-layout', disabled: true }, { id: 'ui-sidebar', disabled: false }, { id: 'ui-conversation', disabled: false }] : []),\n ...profile.patches,\n ])\n const composedBeforeLater = patches.length\n // Brand swap: same technique and same row id as acryl-desktop's own\n // (independent) brand swap in profile.ts - the stock DeepSeek Harness\n // identity (`@deepseek-ai/dsh-client-ui-brand-official`, already composed\n // by the base dsh-web-app bundle at row id `ui-brand-official`) and\n // `@acryldev/brand-client` are standalone, independently swappable\n // Cordis Client plugins carrying the same slot contract\n // (`sidebar.brand.mark`/`.name`, `conversation.hero.brand.mark`) - exactly\n // one is ever enabled. Validated against the real composed row (not\n // assumed) so a future dsh-web-app bundle change that renames or removes\n // this row fails loud here instead of silently keeping the DeepSeek brand.\n const officialBrandRow = composeEntries([patches]).find(entry => entry.id === 'ui-brand-official')\n if (officialBrandRow?.name !== '@deepseek-ai/dsh-client-ui-brand-official') {\n throw new Error('ACRYL web profile must use @deepseek-ai/dsh-client-ui-brand-official in the ui-brand-official row')\n }\n // `@deepseek-ai/dsh-client-connection` resolves `webServer` from the Context\n // its own row was built with while registering a caller's\n // `connection.rpc.handle(...)` channel. Cordis resolves an undeclared name\n // only along the provider's fiber chain, and the web server row is a sibling\n // of the connection row, so any third-party profile plugin (for example\n // acryl-dsh-editor-plugin) failed the whole tree with `cannot get property\n // \"webServer\" without inject`. Same declaration acryl-desktop's\n // prepareDesktopProfile makes for the same row.\n const connectionRow = composeEntries([patches]).find(entry => entry.id === 'connection')\n if (connectionRow?.name === '@deepseek-ai/dsh-client-connection') {\n patches.push({\n id: 'connection',\n name: connectionRow.name,\n inject: withDeclaredDependency(connectionRow.inject, 'webServer'),\n // A patch replaces the row's whole config, so the trusted names (a proxy's public host, from the instance's web access) merge into what the\n // profile already set rather than dropping its recovery or cookie settings.\n ...(instance.webAccess.trustedHosts.length === 0 ? {} : { config: { ...connectionConfig(connectionRow.config), trustedHosts: [...instance.webAccess.trustedHosts] } }),\n })\n }\n // Every ACRYL-owned row (brand, Market, extension pack, prompt shaping, UI library, shortcuts, mount anchors) comes from\n // the selected Blueprint (spec 036): the row table lives in `blueprint/compose.ts`, and the packages were made resolvable\n // from this profile above (they are ACRYL-owned workspace packages outside @deepseek-ai/dsh's dependency closure, so\n // `healProfilesModuleFallback` cannot find them; see `materializeProfilePackage`).\n patches.push(...rowsComposition.patches)\n // A second instance beside one on the default port (spec 036): ACRYL_WEB_PORT moves the server.\n // The port is part of the app's family: a stable start, and the next free one when it is taken (never a fight with another app).\n // The listening address is part of it too: loopback, unless a container entry point asked for every interface (ACRYL_WEB_HOST).\n const webHost = instance.webAccess.host\n if (instance.webPort.scan) {\n const webPort = await findFreeWebPort(instance.webPort.start, port => loopbackPortIsFree(port, webHost))\n if (webPort !== instance.webPort.start) process.stdout.write(`ACRYL: port ${String(instance.webPort.start)} is in use, using ${String(webPort)}\\n`)\n patches.push(webPortPatch(webPort, webHost))\n } else if (webHost !== LOOPBACK_WEB_HOST) {\n patches.push(webPortPatch(instance.webPort.start, webHost))\n }\n // Last, so a user override beats every composition decision above it - the\n // same shared store the CLI and the Desktop panel write (spec 034).\n patches.push(...pluginLifecyclePatches({\n profileName,\n statePath: resolvePluginLifecycleStatePath(),\n }, rowIdsOf(patches)))\n return { rootConfig, patches, surface: 'web', instance, installPackageUrl, runtimeResolution: await createProfileRuntimeResolution(profile), profileContext: createProfileContext(profile, { home: instance.dshHome, instance, overlays: acrylAdditions(patches, { layerPatches: profileLayerPatches.length, userPatches: profile.patches.length, composedBeforeLater }) }), productName: blueprint.brand.kind === 'custom' ? blueprint.brand.identity.name : 'ACRYL', stockBrand: blueprint.brand.kind === 'acryl' }\n}\n\n/** The Loader row ids a list of patches composes, for overrides that apply only to rows that exist. */\nfunction rowIdsOf(patches: readonly PatchOptions[]): ReadonlySet<string> {\n return new Set(composeEntries([[...patches]]).flatMap(row => (typeof row.id === 'string' ? [row.id] : [])))\n}\n\n/** A Loader row's config as a plain object to merge into, or an empty one when the profile set none. */\nfunction connectionConfig(config: unknown): Record<string, unknown> {\n return typeof config === 'object' && config !== null && !Array.isArray(config) ? { ...(config as Record<string, unknown>) } : {}\n}\n\n/**\n * Build the `dsh` engine definition for the Web surface's `web` profile\n * (`dsh-base` + `dsh-web-app`) - the same shared `mountDshEngine` primitive\n * as {@link createDshEngineDefinition}, resolved through this package's own\n * profile system like the CLI flavor (Web has no external profile pipeline\n * of its own, unlike Desktop's `prepareDesktopProfile()`).\n * @param installPackageUrl - file URL of `acryl-web`'s own `package.json`,\n * used to materialize `@acryldev/brand-client` and `@acryldev/cordis-plugin-market`\n * into the profile (see {@link resolveWebEngineComposition}'s own comments\n * for why that is needed).\n */\nexport function createWebEngineDefinition(installPackageUrl: string, capabilities?: CodingCapabilities): AcrylEngineDefinition {\n return {\n id: 'dsh',\n plugin: async (ctx: Context) => mountDshEngine(ctx, await resolveWebEngineComposition(installPackageUrl, capabilities)),\n }\n}\n\n/**\n * Build the `dsh` engine definition from a composition a surface already\n * resolved itself (Desktop's `prepareDesktopProfile()`: its own profile\n * selection, market/editor/BLEND patch layering, and worker bare-module base\n * URL). Performs no profile resolution of its own - unlike\n * {@link createDshEngineDefinition}, which is the CLI/TUI flavor that\n * resolves a profile by name through `@acryldev/harness-runtime`'s own profile\n * system. Handing an already-resolved composition to that function would\n * silently discard it and resolve a different profile instead.\n */\nexport function createDshEngineDefinitionFromComposition(\n composition: DshEngineComposition,\n): AcrylEngineDefinition {\n if (composition.surface.trim() === '') throw new Error('ACRYL dsh engine surface must not be empty')\n return {\n id: 'dsh',\n plugin: (ctx: Context) => mountDshEngine(ctx, composition),\n }\n}\n","/**\n * Deterministic package selection between one surface's own installation and\n * one Profile - shared by every surface with a persistent, user-mutable\n * profile directory (Desktop's Market-installed plugins, or any surface's\n * own ACRYL-only packages a shipped DSH profile has no dependency path to).\n * Extracted verbatim from acryl-desktop's own package-overlay.ts (first\n * built and proven there); `binName` is the one parameter that varies per\n * caller, keeping every message and this module's own behavior otherwise\n * identical to what Desktop already shipped.\n */\n\nimport { findPackageJSON } from 'node:module'\nimport { readFileSync, statSync } from 'node:fs'\nimport { dirname } from 'node:path'\nimport { compare, valid } from 'semver'\n\nconst MAX_MANIFEST_BYTES = 1024 * 1024\nconst MAX_VERSION_LENGTH = 128\n\nexport type PackageOverlaySource = 'install' | 'profile'\n\nexport interface PackageOverlayCandidate {\n readonly packageName: string\n readonly packageDir: string\n readonly manifestPath: string\n readonly version?: string\n readonly source: PackageOverlaySource\n}\n\nexport interface PackageOverlaySelection {\n readonly packageName: string\n readonly selected: PackageOverlayCandidate\n readonly install?: PackageOverlayCandidate\n readonly profile?: PackageOverlayCandidate\n}\n\nexport interface PackageOverlayOptions {\n /** Diagnostic prefix on thrown errors - the calling surface's own bin name. */\n readonly binName: string\n /** File URL inside the exact calling surface's own installation dependency graph. */\n readonly installPackageUrl: string\n /** File URL for the active Profile package.json. */\n readonly profilePackageUrl: string\n}\n\nexport class PackageOverlayNotFoundError extends Error {\n constructor(binName: string, packageName: string) {\n super(`${binName}: cannot resolve package ${JSON.stringify(packageName)} from the ${binName} installation or active Profile`)\n this.name = 'PackageOverlayNotFoundError'\n }\n}\n\nfunction missingPackage(cause: unknown): boolean {\n return (cause as NodeJS.ErrnoException | null)?.code === 'ERR_MODULE_NOT_FOUND'\n}\n\nfunction readCandidate(\n binName: string,\n packageName: string,\n packageUrl: string,\n source: PackageOverlaySource,\n): PackageOverlayCandidate | undefined {\n let manifestPath: string | undefined\n try {\n manifestPath = findPackageJSON(packageName, packageUrl)\n } catch (cause) {\n if (missingPackage(cause)) return undefined\n throw cause\n }\n if (manifestPath === undefined) return undefined\n const size = statSync(manifestPath).size\n if (size > MAX_MANIFEST_BYTES) {\n throw new Error(`${binName}: ${source} package manifest is too large for ${packageName}`)\n }\n let manifest: unknown\n try {\n manifest = JSON.parse(readFileSync(manifestPath, 'utf8')) as unknown\n } catch (cause) {\n throw new Error(\n `${binName}: cannot read ${source} package manifest for ${packageName}: ${cause instanceof Error ? cause.message : String(cause)}`,\n )\n }\n if (manifest === null || typeof manifest !== 'object' || Array.isArray(manifest)\n || (manifest as { name?: unknown }).name !== packageName) {\n throw new Error(`${binName}: ${source} package identity is invalid for ${packageName}`)\n }\n const version = (manifest as { version?: unknown }).version\n const comparableVersion = typeof version === 'string' && version.length > 0\n && version.length <= MAX_VERSION_LENGTH && valid(version) !== null\n ? version\n : undefined\n return {\n packageName,\n packageDir: dirname(manifestPath),\n manifestPath,\n source,\n ...(comparableVersion === undefined ? {} : { version: comparableVersion }),\n }\n}\n\n/** Extract an npm package root from one Loader bare specifier. */\nexport function packageNameFromSpecifier(specifier: string): string | undefined {\n if (specifier.length === 0 || specifier.startsWith('.') || specifier.startsWith('/')\n || specifier.startsWith('#') || URL.canParse(specifier)) return undefined\n const parts = specifier.split('/')\n if (specifier.startsWith('@')) {\n if (parts.length < 2 || parts[0]?.length === 0 || parts[1]?.length === 0) return undefined\n return `${parts[0]}/${parts[1]}`\n }\n return parts[0]?.length === 0 ? undefined : parts[0]\n}\n\n/** Find one package root using the installation/Profile overlay rule. */\nexport function findOverlayPackage(\n packageName: string,\n options: PackageOverlayOptions,\n): PackageOverlaySelection | undefined {\n if (packageNameFromSpecifier(packageName) !== packageName) {\n throw new Error(`${options.binName}: package overlay requires one exact npm package name`)\n }\n const install = readCandidate(options.binName, packageName, options.installPackageUrl, 'install')\n let profile: PackageOverlayCandidate | undefined\n try {\n profile = readCandidate(options.binName, packageName, options.profilePackageUrl, 'profile')\n } catch (cause) {\n // A valid installation package is the stable fallback when a stale\n // Profile copy has unreadable identity/version metadata. Invalid\n // installation metadata still fails before this branch and is never\n // hidden by the Profile.\n if (install === undefined) throw cause\n return { packageName, selected: install, install }\n }\n if (install === undefined && profile === undefined) return\n const selected = install === undefined\n ? profile!\n : profile === undefined\n ? install\n // Equal SemVer precedence, including build-only differences, keeps the\n // installation copy as the deterministic tie-break. A missing or\n // non-SemVer version on either side is not comparable and also keeps\n // the installation copy.\n : profile.version !== undefined && install.version !== undefined\n && compare(profile.version, install.version) > 0 ? profile : install\n return {\n packageName,\n selected,\n ...(install === undefined ? {} : { install }),\n ...(profile === undefined ? {} : { profile }),\n }\n}\n\n/** Resolve one package root, failing when neither overlay side provides it. */\nexport function resolveOverlayPackage(\n packageName: string,\n options: PackageOverlayOptions,\n): PackageOverlaySelection {\n const selection = findOverlayPackage(packageName, options)\n if (selection === undefined) throw new PackageOverlayNotFoundError(options.binName, packageName)\n return selection\n}\n","/**\n * Profile-relative package resolution for a Node runtime with a persistent,\n * user-mutable profile directory.\n *\n * Extracted verbatim from acryl-desktop's own module-resolution.ts (first\n * built and proven there against Electron's restricted runtime) - the two\n * anchors that varied per surface (the calling installation's own entry\n * module and its own package.json) are now parameters\n * ({@link InstallProfilePackageResolverOptions}) instead of hardcoded\n * Desktop paths; every other line, including the two-layer CJS/ESM hook\n * strategy and its comments, is unchanged. Desktop's own module-resolution.ts\n * is now a thin wrapper supplying its Electron-specific anchors (unpacked\n * ASAR paths) to this function - its own behavior is unaffected.\n */\n\nimport Module, { isBuiltin } from 'node:module'\nimport { basename, dirname, isAbsolute, join } from 'node:path'\nimport { fileURLToPath, pathToFileURL } from 'node:url'\nimport { requireModuleHooks } from './module-hooks.ts'\nimport {\n findOverlayPackage,\n packageNameFromSpecifier,\n resolveOverlayPackage,\n} from './package-overlay.ts'\n\ninterface CommonJsModuleResolver {\n _resolveFilename(\n request: string,\n parent: { filename?: string } | null | undefined,\n isMain: boolean | undefined,\n options?: unknown,\n ): string\n}\n\n/** Node's CommonJS package lookup list for a directory: every ancestor's node_modules, nearest first. */\nfunction nodeModulePaths(directory: string): string[] {\n const paths: string[] = []\n for (let current = directory; ; current = dirname(current)) {\n if (basename(current) !== 'node_modules') paths.push(join(current, 'node_modules'))\n if (dirname(current) === current) return paths\n }\n}\n\nfunction packageNameFromManifestSpecifier(specifier: string): string | undefined {\n const suffix = '/package.json'\n if (!specifier.endsWith(suffix)) return undefined\n const packageName = specifier.slice(0, -suffix.length)\n return packageNameFromSpecifier(packageName) === packageName ? packageName : undefined\n}\n\n/** Return whether a Loader request needs Node package resolution. */\nfunction isBareSpecifier(specifier: string): boolean {\n return !specifier.startsWith('.') && !specifier.startsWith('/') && !URL.canParse(specifier)\n}\n\nexport interface InstallProfilePackageResolverOptions {\n /** Diagnostic prefix on thrown errors - the calling surface's own bin name. */\n readonly binName: string\n /** File URL of the calling installation's own package.json. */\n readonly installPackageUrl: string\n /** File URL of the calling installation's own compiled entry module. */\n readonly installEntryUrl: string\n /** File URL resolved by `import.meta.resolve('@deepseek-ai/cordis-plugin-loader')`. */\n readonly loaderEntryUrl: string\n}\n\n/**\n * Resolve Cordis Loader bare imports from the selected persistent profile.\n * @param profileBaseUrl - file URL inside the profile that owns plugin dependencies.\n * @param options - the calling installation's own resolution anchors.\n * @returns an idempotent hook disposer.\n */\nexport function installProfilePackageResolver(\n profileBaseUrl: string,\n options: InstallProfilePackageResolverOptions,\n): () => void {\n // Before `_resolveFilename` is wrapped, so a runtime without module hooks leaves nothing behind.\n const registerHooks = requireModuleHooks()\n const { binName, installPackageUrl, installEntryUrl, loaderEntryUrl } = options\n const profileManifestPath = fileURLToPath(profileBaseUrl)\n // Directory-derived `createRequire` bases (e.g. `new URL('.', profileBaseUrl)`)\n // yield a synthetic `noop.js` module as the require parent; the manifest\n // anchor yields the manifest path itself. Both live inside the profile\n // directory, so treat any parent anchored there as profile-owned.\n const profileDirPath = fileURLToPath(new URL('.', profileBaseUrl))\n\n // ClientModuleRegistry intentionally uses createRequire(ctx.baseUrl) to\n // resolve each browser bundle from the config tree. Node's ESM resolve hook\n // does not observe that CommonJS manifest lookup, so without this narrow\n // bridge the Loader can activate the installation's own copy while the\n // browser receives an older Profile copy of the same package. Intercept\n // only package manifests requested from a parent anchored in this Profile\n // (the manifest itself or a synthetic module under the profile directory);\n // every other CJS resolution remains untouched.\n // Track the module graph rooted at every overlay-selected Loader package.\n const overlayModuleUrls = new Set<string>()\n const commonJsModule = Module as unknown as CommonJsModuleResolver\n const previousResolveFilename = commonJsModule._resolveFilename\n // The parent an installation-selected package resolves from: the installation's own manifest, with Node's node_modules lookup\n // list from its directory upwards (what `Module._nodeModulePaths` computes). Made on first use, so installing the resolver converts no path.\n let installParent: { filename: string, id: string, paths: string[] } | undefined\n const installParentModule = () => {\n if (installParent !== undefined) return installParent\n const installManifestPath = fileURLToPath(installPackageUrl)\n installParent = { filename: installManifestPath, id: installManifestPath, paths: nodeModulePaths(dirname(installManifestPath)) }\n return installParent\n }\n const overlayResolveFilename: CommonJsModuleResolver['_resolveFilename'] = function (\n this: CommonJsModuleResolver,\n request,\n parent,\n isMain,\n resolveOptions,\n ) {\n const profileAnchored = parent?.filename !== undefined\n && (parent.filename === profileManifestPath || parent.filename.startsWith(profileDirPath))\n const manifestPackage = profileAnchored ? packageNameFromManifestSpecifier(request) : undefined\n // A bare plugin import from the Profile anchor (dsh-app-boot's root Include resolves every Loader row this way) takes the\n // same overlay: a package the Profile does not hold, or holds at an older version, comes from the installation. Without\n // this, a fresh Profile (no node_modules since DSH 0.2 removed the link projections) resolved no plugin at all.\n const packageName = manifestPackage\n ?? (profileAnchored && isBareSpecifier(request) && !isBuiltin(request) ? packageNameFromSpecifier(request) : undefined)\n if (packageName !== undefined) {\n const overlay = findOverlayPackage(packageName, {\n binName,\n installPackageUrl,\n profilePackageUrl: profileBaseUrl,\n })\n if (overlay !== undefined) {\n if (manifestPackage !== undefined) return overlay.selected.manifestPath\n const target = previousResolveFilename.call(\n this, request, overlay.selected.source === 'install' ? installParentModule() : parent, isMain, resolveOptions)\n // The Loader imports this file next: its graph gets the Profile fallback for dependencies, as a Loader import through the ESM hook does.\n if (isAbsolute(target)) overlayModuleUrls.add(pathToFileURL(target).href)\n return target\n }\n }\n return previousResolveFilename.call(this, request, parent, isMain, resolveOptions)\n }\n commonJsModule._resolveFilename = overlayResolveFilename\n const hooks = registerHooks({\n resolve(specifier, context, nextResolve) {\n const fromLoader = context.parentURL === loaderEntryUrl\n const packageName = fromLoader ? packageNameFromSpecifier(specifier) : undefined\n if (packageName !== undefined) {\n const overlay = resolveOverlayPackage(packageName, {\n binName,\n installPackageUrl,\n profilePackageUrl: profileBaseUrl,\n })\n const resolved = nextResolve(specifier, {\n ...context,\n parentURL: overlay.selected.source === 'profile' ? profileBaseUrl : installEntryUrl,\n })\n overlayModuleUrls.add(resolved.url)\n return resolved\n }\n if (context.parentURL === undefined || !overlayModuleUrls.has(context.parentURL)) {\n return nextResolve(specifier, context)\n }\n if (!isBareSpecifier(specifier)) {\n const resolved = nextResolve(specifier, context)\n if (specifier.startsWith('.')) overlayModuleUrls.add(resolved.url)\n return resolved\n }\n try {\n const resolved = nextResolve(specifier, context)\n overlayModuleUrls.add(resolved.url)\n return resolved\n } catch (cause) {\n if ((cause as NodeJS.ErrnoException).code !== 'ERR_MODULE_NOT_FOUND') throw cause\n const resolved = nextResolve(specifier, { ...context, parentURL: profileBaseUrl })\n overlayModuleUrls.add(resolved.url)\n return resolved\n }\n },\n })\n let active = true\n return () => {\n if (!active) return\n active = false\n hooks.deregister()\n if (commonJsModule._resolveFilename === overlayResolveFilename) {\n commonJsModule._resolveFilename = previousResolveFilename\n }\n }\n}\n","/**\n * Read-only health of one profile's plugin layer (spec 034, FR-001).\n *\n * `acryl plugin doctor` prints this and the Web panel can render the same\n * report; the diagnosis itself is neither surface's code, because \"why is my\n * plugin missing\" has the same answers everywhere: the override file does not\n * parse, an override outlived the row it names, a bundle is installed but\n * composes nothing, or a bundle the profile lists cannot be resolved at all.\n *\n * Nothing here mutates: the caller passes the live snapshot it already has and\n * gets findings back.\n *\n * @module @acryldev/harness-runtime/plugin-doctor\n */\n\nimport type { PluginLifecycleSnapshot } from '@acryldev/control'\nimport {\n entryPatchId,\n readDisabledPluginLifecycleEntries,\n readUserMutableBundleNames,\n type PluginLifecycleStatePersistence,\n} from './plugin-lifecycle-state.ts'\n\nexport type PluginHealthSeverity = 'error' | 'warning'\n\nexport type PluginHealthCode =\n | 'state-unreadable'\n | 'stale-override'\n | 'unmanaged-override'\n | 'bundle-not-composed'\n | 'bundle-missing'\n\nexport interface PluginHealthFinding {\n /** `error` means the profile is broken; `warning` means it is surprising. */\n readonly severity: PluginHealthSeverity\n readonly code: PluginHealthCode\n readonly message: string\n /** The entry or package a finding is about, when it names one. */\n readonly entryId?: string\n}\n\nexport interface PluginHealthReport {\n readonly profileName: string\n readonly profileDir: string\n readonly statePath: string\n /** Composed Loader rows in the snapshot, mutable and protected alike. */\n readonly pluginCount: number\n readonly findings: readonly PluginHealthFinding[]\n}\n\nexport interface PluginHealthInput extends PluginLifecycleStatePersistence {\n readonly profileDir: string\n readonly snapshot: PluginLifecycleSnapshot\n /**\n * Resolves an installed package's manifest path, or throws when it is not\n * resolvable from this profile. Omitted when the caller has no resolution\n * base (the bundle is then only checked for a composed row).\n */\n readonly resolvePackageJson?: (packageName: string) => string\n}\n\nfunction describe(cause: unknown): string {\n return cause instanceof Error ? cause.message : String(cause)\n}\n\n/**\n * Diagnose one profile against its own snapshot and override file. Returns\n * findings in a stable order: state, then overrides, then bundles.\n */\nexport function diagnosePluginLifecycle(input: PluginHealthInput): PluginHealthReport {\n const findings: PluginHealthFinding[] = []\n let disabled: ReadonlySet<string> = new Set()\n try {\n disabled = readDisabledPluginLifecycleEntries(input)\n } catch (cause) {\n findings.push({\n severity: 'error',\n code: 'state-unreadable',\n message: `plugin override file ${input.statePath} could not be read: ${describe(cause)}`,\n })\n }\n\n const byEntryId = new Map(input.snapshot.entries.map(entry => [entry.entryId, entry]))\n const byPatchId = new Map(input.snapshot.entries.map(entry => [entryPatchId(entry.entryId), entry]))\n for (const overrideId of [...disabled].sort()) {\n const entry = byEntryId.get(overrideId) ?? byPatchId.get(entryPatchId(overrideId))\n if (entry === undefined) {\n findings.push({\n severity: 'warning',\n code: 'stale-override',\n entryId: overrideId,\n message: `${overrideId} is recorded as disabled, but this profile composes no such entry`,\n })\n continue\n }\n if (!entry.mutable) {\n findings.push({\n severity: 'warning',\n code: 'unmanaged-override',\n entryId: overrideId,\n message: `${overrideId} is disabled by the override file but is not a user-controlled plugin`,\n })\n }\n }\n\n const bundles = readUserMutableBundleNames(input.profileDir)\n const composesPackage = (packageName: string): boolean =>\n input.snapshot.entries.some(entry =>\n entry.moduleName === packageName || entry.moduleName.startsWith(`${packageName}/`))\n for (const bundle of [...bundles].sort()) {\n if (input.resolvePackageJson !== undefined) {\n try {\n input.resolvePackageJson(bundle)\n } catch (cause) {\n findings.push({\n severity: 'error',\n code: 'bundle-missing',\n entryId: bundle,\n message: `profile bundle ${bundle} is listed in dsh.profile.bundles but does not resolve from this profile: ${describe(cause)}`,\n })\n continue\n }\n }\n if (!composesPackage(bundle)) {\n findings.push({\n severity: 'warning',\n code: 'bundle-not-composed',\n entryId: bundle,\n message: `profile bundle ${bundle} is installed but composes no entry in this process; a restart applies a freshly installed bundle`,\n })\n }\n }\n\n return Object.freeze({\n profileName: input.profileName,\n profileDir: input.profileDir,\n statePath: input.statePath,\n pluginCount: input.snapshot.entries.length,\n findings: Object.freeze(findings),\n })\n}\n","/**\n * Capture and render the system prompt and tool list the model actually receives on the first turn of a new session. Development aid\n * behind `docs/system-prompt/current/*.md`: it drives one real session on a composed runtime with a dummy provider key, so the request\n * fails after the loop has already logged the assembled system message and the request header, which is all this reads. No model is\n * called successfully.\n */\nimport { mkdtempSync, realpathSync, rmSync } from 'node:fs'\nimport { tmpdir } from 'node:os'\nimport { join } from 'node:path'\nimport type { Context } from '@deepseek-ai/cordis'\nimport { SessionId } from '@deepseek-ai/dsh-session'\nimport { createAcrylSessionBridge } from './session-bridge.ts'\n\nexport interface CapturedSystemPrompt {\n /** The assembled system prompt text. */\n system: string\n /** The tool definitions sent after it. */\n tools: Array<{ name: string; description: string; /** The whole definition as sent (schema included). */ definition: Record<string, unknown> }>\n /** `provider/model` of the request. */\n model: string\n}\n\nexport interface CaptureSystemPromptOptions {\n /** Bridge profile name for the composed runtime (`web`, `desktop`, or the CLI profile). */\n profile: string\n /** Select the `standard` agent preset first, as the browser client does for a new session. */\n selectStandardPreset: boolean\n /** Paths to replace with a placeholder, longest first. */\n scrub?: Array<[string, string]>\n}\n\n/**\n * Run one session on `ctx` and return what the model would receive.\n * @param ctx - a composed runtime root (web, desktop or CLI engine).\n * @param options - profile name, preset selection and path scrubbing.\n */\nexport async function captureSystemPrompt(ctx: Context, options: CaptureSystemPromptOptions): Promise<CapturedSystemPrompt> {\n const workspace = realpathSync(mkdtempSync(join(tmpdir(), 'acryl-prompt-ws-')))\n const bridge = createAcrylSessionBridge(ctx, { profile: options.profile, generationId: 'prompt-capture', attachment: 'owner', cwd: workspace })\n const captured: CapturedSystemPrompt = { system: '', tools: [], model: '' }\n try {\n const sessionId = await bridge.open()\n await bridge.selectModel({ sessionId, provider: 'deepseek-official', model: 'deepseek-v4-flash' })\n if (options.selectStandardPreset) {\n const presets = ctx.get('agentPresets' as never) as unknown as { select(agent: unknown, id: string): Promise<string> }\n const agent = (ctx as unknown as { agents: { get(id: unknown): unknown } }).agents.get(SessionId(sessionId))\n await presets.select(agent, 'standard')\n }\n let ended: () => void = () => {}\n const done = new Promise<void>(resolve => { ended = resolve })\n await bridge.subscribeEvents(sessionId, event => {\n const { type, data } = event as { type: string; data?: Record<string, unknown> }\n if (type === 'system/message' && captured.system === '') {\n const content = (data?.message as { content?: Array<{ text?: string }> } | undefined)?.content ?? []\n captured.system = content.map(block => block.text ?? '').join('')\n }\n if (type === 'request/header' && captured.tools.length === 0) {\n const header = data?.header as { tools?: Array<{ name: string; description: string } & Record<string, unknown>>; config?: { provider?: string; model?: string } } | undefined\n captured.tools = (header?.tools ?? []).map(tool => ({ name: tool.name, description: tool.description, definition: tool }))\n captured.model = `${header?.config?.provider ?? ''}/${header?.config?.model ?? ''}`\n }\n if (type === 'turn/end') ended()\n })\n await bridge.submitPrompt({ sessionId, text: 'hello' })\n await Promise.race([done, new Promise(resolve => setTimeout(resolve, 60_000))])\n } finally {\n await bridge.dispose()\n rmSync(workspace, { recursive: true, force: true })\n }\n const replacements: Array<[string, string]> = [[workspace, '<workspace>'], ...(options.scrub ?? [])]\n const scrub = (text: string): string => replacements.reduce((acc, [from, to]) => (from === '' ? acc : acc.replaceAll(from, to)), text)\n return { system: scrub(captured.system), tools: captured.tools.map(tool => ({ name: tool.name, description: scrub(tool.description), definition: JSON.parse(scrub(JSON.stringify(tool.definition))) as Record<string, unknown> })), model: captured.model }\n}\n\n/** Markdown for one surface's captured prompt. */\nexport function renderSystemPromptDoc(surface: string, description: string, captured: CapturedSystemPrompt): string {\n const stamp = new Date().toISOString().slice(0, 10)\n return [\n `# Current system prompt: ${surface}`,\n '',\n `<!-- Generated on ${stamp} by the system-prompt capture (see ../README.md). Do not edit; regenerate. -->`,\n '',\n `What the model receives on the first turn of a new session on the ${surface} surface (${description}), after path scrubbing.`,\n 'Temporary paths are shown as `<workspace>`, `<dsh-home>` and `<acryl-repo>`. The tool list follows the system prompt.',\n '',\n '## System prompt',\n '',\n '```text',\n captured.system.trimEnd(),\n '```',\n '',\n `## Tools (${captured.tools.length})`,\n '',\n '| Tool | Description (first line) |',\n '| --- | --- |',\n ...captured.tools.map(tool => `| \\`${tool.name}\\` | ${tool.description.split('\\n')[0]?.replaceAll('|', '\\\\|').slice(0, 160) ?? ''} |`),\n '',\n ].join('\\n')\n}\n","/**\n * Pre-image backups for repairs: every file a repair may change is copied first, so a repair can be undone\n * and an interrupted one can be rolled back.\n *\n * A backup is complete only when its manifest exists, and the manifest is written last and atomically, so a\n * repair killed halfway through making the backup leaves nothing that looks valid.\n */\n\nimport { createHash, randomBytes } from 'node:crypto'\nimport { existsSync, mkdirSync, readdirSync, readFileSync, rmSync } from 'node:fs'\nimport { basename, dirname, isAbsolute, join, relative, resolve } from 'node:path'\nimport { writeFileAtomic } from '../engine-files.ts'\n\nconst BACKUPS_DIR = 'repair-backups'\nconst MANIFEST = 'manifest.json'\n\nexport interface BackupEntry {\n readonly path: string\n /** False when the file did not exist, so undoing the repair removes it. */\n readonly existed: boolean\n /** The pre-image's name inside the backup directory. */\n readonly stored?: string\n readonly sha256?: string\n}\n\nexport interface BackupManifest {\n readonly id: string\n readonly createdAt: string\n readonly profileName: string\n readonly recipes: readonly string[]\n readonly entries: readonly BackupEntry[]\n}\n\nconst sha = (data: Buffer): string => createHash('sha256').update(data).digest('hex')\n\n/** A file a backup may touch must lie inside the engine home. */\nfunction assertInside(dshHome: string, path: string): void {\n const rel = relative(resolve(dshHome), resolve(path))\n if (rel === '' || rel.startsWith('..') || isAbsolute(rel)) throw new Error(`refusing to back up or restore a file outside the ACRYL home: ${path}`)\n}\n\nexport const backupsDir = (dshHome: string): string => join(dshHome, BACKUPS_DIR)\n\n/** Copy each file's current content aside. @returns the manifest of the new backup. */\nexport async function createBackup(input: {\n readonly dshHome: string\n readonly profileName: string\n readonly recipes: readonly string[]\n readonly files: readonly string[]\n readonly now?: () => Date\n}): Promise<BackupManifest> {\n const now = (input.now ?? (() => new Date()))()\n const id = `${now.toISOString().replace(/[-:]/g, '').replace(/\\.\\d+Z$/, 'Z')}-${randomBytes(3).toString('hex')}`\n const dir = join(backupsDir(input.dshHome), id)\n mkdirSync(dir, { recursive: true, mode: 0o700 })\n const entries: BackupEntry[] = []\n let index = 0\n for (const file of input.files) {\n assertInside(input.dshHome, file)\n if (!existsSync(file)) { entries.push({ path: file, existed: false }); continue }\n const data = readFileSync(file)\n const stored = `${String(index)}-${basename(file)}`\n index += 1\n await writeFileAtomic(join(dir, stored), data.toString('utf8'), { mode: 0o600, dirMode: 0o700 })\n entries.push({ path: file, existed: true, stored, sha256: sha(data) })\n }\n const manifest: BackupManifest = { id, createdAt: now.toISOString(), profileName: input.profileName, recipes: [...input.recipes], entries }\n // Last, so a backup that was interrupted before this point is not mistaken for a complete one.\n await writeFileAtomic(join(dir, MANIFEST), `${JSON.stringify(manifest, null, 2)}\\n`, { mode: 0o600, dirMode: 0o700 })\n return manifest\n}\n\n/** Complete backups, newest first; incomplete or damaged ones are skipped. */\nexport function listBackups(dshHome: string): BackupManifest[] {\n let ids: string[]\n try {\n ids = readdirSync(backupsDir(dshHome))\n } catch {\n return []\n }\n const found: BackupManifest[] = []\n for (const id of ids) {\n try {\n const manifest = JSON.parse(readFileSync(join(backupsDir(dshHome), id, MANIFEST), 'utf8')) as BackupManifest\n if (manifest.id === id && Array.isArray(manifest.entries)) found.push(manifest)\n } catch {\n // No manifest, or an unreadable one: not a usable backup.\n }\n }\n return found.sort((a, b) => (a.createdAt < b.createdAt ? 1 : a.createdAt > b.createdAt ? -1 : b.id.localeCompare(a.id)))\n}\n\n/** The pre-image bytes of one stored file, verified against its recorded hash. */\nexport function readPreImage(dshHome: string, manifest: BackupManifest, entry: BackupEntry): Buffer {\n if (entry.stored === undefined) throw new Error('that backup entry has no stored content')\n const data = readFileSync(join(backupsDir(dshHome), manifest.id, entry.stored))\n if (entry.sha256 !== undefined && sha(data) !== entry.sha256) throw new Error(`the backup of ${entry.path} is damaged (checksum mismatch)`)\n return data\n}\n\n/** Put every file back as it was: restore what existed, remove what the repair created. */\nexport async function restoreBackup(dshHome: string, id: string): Promise<BackupManifest> {\n const manifest = listBackups(dshHome).find(candidate => candidate.id === id)\n if (manifest === undefined) throw new Error(`no complete backup named ${id}`)\n // Verify everything first, so a damaged backup changes nothing.\n const restores = manifest.entries.map((entry) => {\n assertInside(dshHome, entry.path)\n return { entry, data: entry.existed ? readPreImage(dshHome, manifest, entry) : undefined }\n })\n for (const { entry, data } of restores) {\n if (data !== undefined) {\n mkdirSync(dirname(entry.path), { recursive: true })\n await writeFileAtomic(entry.path, data.toString('utf8'), { mode: 0o600, dirMode: 0o700 })\n } else if (existsSync(entry.path)) {\n rmSync(entry.path, { force: true })\n }\n }\n return manifest\n}\n","/** What a static diagnosis of a profile can say, and what repairs exist for it. */\n\nexport type ProfileFindingCode =\n | 'profile-missing'\n | 'state-unreadable'\n | 'profile-manifest-unreadable'\n | 'bundle-missing'\n | 'pnpm-layout-mismatch'\n | 'plugin-activation-failed'\n | 'pnpm-store-mismatch'\n\n/**\n * The repairs that may ever run without a person choosing each step. The list is short on purpose: it grows\n * only by a reviewed change (spec 041, question 6).\n */\nexport const SAFE_RECIPES = ['restore-override-file', 'disable-failing-row'] as const\nexport type RecipeId = (typeof SAFE_RECIPES)[number]\n\nexport interface ProfileFinding {\n /** `error` means the profile is broken; `warning` means it is surprising or degraded. */\n readonly severity: 'error' | 'warning'\n readonly code: ProfileFindingCode\n readonly message: string\n /** The file the finding is about. */\n readonly file?: string\n /** The Loader row or package it is about. */\n readonly entryId?: string\n /** The safe recipe that addresses it, when there is one. */\n readonly recipe?: RecipeId\n /** What a person should do when no safe recipe applies. */\n readonly guidance?: string\n}\n\nexport interface ProfileDiagnosis {\n readonly profileName: string\n readonly profileDir: string\n readonly dshHome: string\n readonly findings: readonly ProfileFinding[]\n}\n\nexport function isSafeRecipe(value: string): value is RecipeId {\n return (SAFE_RECIPES as readonly string[]).includes(value)\n}\n","/**\n * Static diagnosis of a profile: files, manifests and logs only. It never starts the app, never imports a\n * plugin, and never writes anything, so it works when the app is too broken to launch (spec 041, Scope B).\n */\n\nimport { existsSync, readdirSync, readFileSync, statSync } from 'node:fs'\nimport { join } from 'node:path'\nimport { resolveProfileDir } from '@deepseek-ai/dsh-app-boot'\nimport { parse } from 'yaml'\nimport {\n readDisabledPluginLifecycleEntries,\n readUserMutableBundleNames,\n resolvePluginLifecycleStatePath,\n} from '../plugin-lifecycle-state.ts'\nimport type { ProfileDiagnosis, ProfileFinding } from './findings.ts'\n\n/** Loader rows that are infrastructure, not plugins: a failure inside one is not fixed by disabling it. */\nconst INFRASTRUCTURE_ROWS: ReadonlySet<string> = new Set(['acryl-engine', 'include', 'webserver'])\n/** How much of each recent log to read, and how many logs. */\nconst LOG_TAIL_BYTES = 256 * 1024\nconst RECENT_LOGS = 3\n\nexport interface InspectOptions {\n readonly dshHome: string\n readonly profileName: string\n}\n\nconst describe = (cause: unknown): string => (cause instanceof Error ? cause.message : String(cause))\n\nfunction recentLogFiles(dshHome: string): string[] {\n const dir = join(dshHome, 'logs')\n let names: string[]\n try {\n names = readdirSync(dir)\n } catch {\n return []\n }\n return names\n .filter(name => /\\.(?:log|jsonl)$/.test(name))\n .flatMap((name) => {\n try {\n const path = join(dir, name)\n const stats = statSync(path)\n return stats.isFile() ? [{ path, modifiedAt: stats.mtimeMs }] : []\n } catch {\n return []\n }\n })\n .sort((a, b) => b.modifiedAt - a.modifiedAt)\n .slice(0, RECENT_LOGS)\n .map(file => file.path)\n}\n\nfunction tailOf(path: string): string {\n try {\n const text = readFileSync(path, 'utf8')\n return text.length > LOG_TAIL_BYTES ? text.slice(text.length - LOG_TAIL_BYTES) : text\n } catch {\n return ''\n }\n}\n\nconst ACTIVATION_FAILURE = /failed to apply loader entry ([A-Za-z0-9@/._:-]+)/g\n\n/** The innermost failing Loader row of each log line: the outer rows only say \"my child failed\". */\nfunction activationFailures(text: string): Array<{ entryId: string; cause: string }> {\n const found = new Map<string, string>()\n for (const line of text.split('\\n')) {\n let last: RegExpExecArray | undefined\n ACTIVATION_FAILURE.lastIndex = 0\n for (let match = ACTIVATION_FAILURE.exec(line); match !== null; match = ACTIVATION_FAILURE.exec(line)) last = match\n if (last === undefined) continue\n const entryId = last[1] ?? ''\n const rest = line.slice(last.index + last[0].length).replace(/^[^:]*\\):\\s*/, '').trim()\n if (!found.has(entryId)) found.set(entryId, rest.slice(0, 200))\n }\n return [...found].map(([entryId, cause]) => ({ entryId, cause }))\n}\n\nfunction layoutFinding(profileDir: string): ProfileFinding | undefined {\n const modules = join(profileDir, 'node_modules', '.modules.yaml')\n const workspace = join(profileDir, 'pnpm-workspace.yaml')\n if (!existsSync(modules) || !existsSync(workspace)) return undefined\n try {\n const recorded = (parse(readFileSync(modules, 'utf8')) as { nodeLinker?: unknown } | null)?.nodeLinker\n const declared = (parse(readFileSync(workspace, 'utf8')) as { nodeLinker?: unknown } | null)?.nodeLinker ?? 'isolated'\n if (typeof recorded === 'string' && recorded !== declared) {\n return {\n severity: 'warning', code: 'pnpm-layout-mismatch', file: workspace,\n message: `the profile's dependencies were installed with nodeLinker \"${recorded}\" but pnpm-workspace.yaml says \"${String(declared)}\"; a reinstall would relink the whole tree`,\n guidance: 'Do not reinstall by hand. Run the profile through ACRYL, which pins the recorded layout before any package operation.',\n }\n }\n } catch {\n // An unreadable YAML file is reported by the boot itself; it is not a layout finding.\n }\n return undefined\n}\n\n/** Diagnose a profile from its files and recent logs. Never throws for a broken profile: that is the finding. */\nexport function inspectProfile(options: InspectOptions): ProfileDiagnosis {\n const profileDir = resolveProfileDir(options.profileName, options.dshHome)\n const findings: ProfileFinding[] = []\n if (!existsSync(profileDir)) {\n findings.push({ severity: 'error', code: 'profile-missing', file: profileDir, message: `profile ${JSON.stringify(options.profileName)} has no directory at ${profileDir}`, guidance: 'Check the profile name with `acryl plugin list --profile <name>`; ACRYL creates a profile on first use.' })\n return { profileName: options.profileName, profileDir, dshHome: options.dshHome, findings }\n }\n\n const statePath = resolvePluginLifecycleStatePath(options.dshHome)\n if (existsSync(statePath)) {\n try {\n readDisabledPluginLifecycleEntries({ profileName: options.profileName, statePath })\n } catch (cause) {\n findings.push({ severity: 'error', code: 'state-unreadable', file: statePath, recipe: 'restore-override-file', message: `the plugin override file ${statePath} cannot be read: ${describe(cause)}` })\n }\n }\n\n const manifest = join(profileDir, 'package.json')\n if (existsSync(manifest)) {\n try {\n JSON.parse(readFileSync(manifest, 'utf8'))\n } catch (cause) {\n findings.push({ severity: 'error', code: 'profile-manifest-unreadable', file: manifest, message: `the profile manifest ${manifest} is not valid JSON: ${describe(cause)}`, guidance: 'Restore it from a backup or from another profile\\'s copy; it lists the profile\\'s bundles.' })\n }\n for (const bundle of [...readUserMutableBundleNames(profileDir)].sort()) {\n if (!existsSync(join(profileDir, 'node_modules', ...bundle.split('/'), 'package.json'))) {\n findings.push({ severity: 'error', code: 'bundle-missing', entryId: bundle, file: manifest, message: `the profile lists ${bundle} but it is not installed in ${join(profileDir, 'node_modules')}`, guidance: `Reinstall it with \\`acryl plugin add ${bundle}\\`, or remove it from dsh.profile.bundles.` })\n }\n }\n }\n\n const layout = layoutFinding(profileDir)\n if (layout !== undefined) findings.push(layout)\n\n const seen = new Set<string>()\n let storeMismatch = false\n for (const log of recentLogFiles(options.dshHome)) {\n const text = tailOf(log)\n for (const failure of activationFailures(text)) {\n if (seen.has(failure.entryId)) continue\n seen.add(failure.entryId)\n const infrastructure = INFRASTRUCTURE_ROWS.has(failure.entryId)\n findings.push({\n severity: 'error', code: 'plugin-activation-failed', entryId: failure.entryId, file: log,\n message: `${failure.entryId} failed to activate${failure.cause === '' ? '' : `: ${failure.cause}`}`,\n ...(infrastructure ? { guidance: `${failure.entryId} is part of the engine, not a plugin; disabling it would not fix this. Fix the cause named above.` } : { recipe: 'disable-failing-row' as const }),\n })\n }\n if (/package manager did not complete successfully/i.test(text)) storeMismatch = true\n }\n if (storeMismatch) {\n findings.push({ severity: 'warning', code: 'pnpm-store-mismatch', message: 'the package manager did not complete a recent install; this is the known symptom of a pnpm store made by a different pnpm version', guidance: 'Use the pnpm ACRYL pins (through the Lifecycle tab or `acryl plugin`), not the one on PATH, and do not delete the profile to fix it.' })\n }\n\n return { profileName: options.profileName, profileDir, dshHome: options.dshHome, findings }\n}\n","/**\n * Repair recipes and the plan that runs them.\n *\n * A recipe is a named step with a precondition, a dry-run description that names the exact files it will\n * change, and an undo through the pre-image backup. Nothing is guessed: with no matching finding a recipe does\n * not exist in the plan. There are only two recipes and they can only grow by a reviewed change.\n */\n\nimport { rmSync, writeFileSync } from 'node:fs'\nimport { join } from 'node:path'\nimport { writeFileAtomic } from '../engine-files.ts'\nimport {\n entryPatchId,\n readDisabledPluginLifecycleEntries,\n resolvePluginLifecycleStatePath,\n setPluginLifecycleEntryEnabled,\n} from '../plugin-lifecycle-state.ts'\nimport { createBackup, listBackups, readPreImage, restoreBackup, type BackupManifest } from './backup.ts'\nimport { SAFE_RECIPES, type ProfileDiagnosis, type ProfileFinding, type RecipeId } from './findings.ts'\n\nexport interface RepairStep {\n readonly recipe: RecipeId\n /** What will change, in words, naming the file or row. */\n readonly description: string\n /** Every file the step may write; each is backed up first. */\n readonly files: readonly string[]\n /** The finding that made this step applicable. */\n readonly because: ProfileFinding\n}\n\nexport interface RepairPlan {\n readonly profileName: string\n readonly dshHome: string\n readonly steps: readonly RepairStep[]\n}\n\nexport interface RepairResult {\n readonly backupId: string\n readonly applied: readonly RecipeId[]\n}\n\nconst EMPTY_STATE = `${JSON.stringify({ version: 1, profiles: [] }, null, 2)}\\n`\n\n/** Whether a stored override file still parses under the current rules. */\nfunction isValidState(dshHome: string, profileName: string, text: string): boolean {\n const probe = join(dshHome, '.repair-probe-state.json')\n try {\n // The reader takes a path, so a parseable copy is judged through the same function the app uses.\n writeFileSync(probe, text)\n readDisabledPluginLifecycleEntries({ profileName, statePath: probe })\n return true\n } catch {\n return false\n } finally {\n rmSync(probe, { force: true })\n }\n}\n\n\n/** The newest backed-up copy of the override file that is valid, if any. */\nfunction lastValidOverride(dshHome: string, profileName: string, statePath: string): string | undefined {\n for (const manifest of listBackups(dshHome)) {\n for (const entry of manifest.entries) {\n if (entry.path !== statePath || !entry.existed) continue\n try {\n const text = readPreImage(dshHome, manifest, entry).toString('utf8')\n if (isValidState(dshHome, profileName, text)) return text\n } catch {\n // A damaged backup is skipped; an older one may be fine.\n }\n }\n }\n return undefined\n}\n\n/**\n * Build the plan for the chosen recipes.\n * @param recipes - the recipes to include; only ones with a matching finding are planned.\n */\nexport function planRepairs(diagnosis: ProfileDiagnosis, recipes: readonly RecipeId[] = SAFE_RECIPES): RepairPlan {\n const statePath = resolvePluginLifecycleStatePath(diagnosis.dshHome)\n const steps: RepairStep[] = []\n for (const finding of diagnosis.findings) {\n if (finding.recipe === undefined || !recipes.includes(finding.recipe)) continue\n if (finding.recipe === 'restore-override-file') {\n const previous = lastValidOverride(diagnosis.dshHome, diagnosis.profileName, statePath)\n steps.push({\n recipe: 'restore-override-file', because: finding, files: [statePath],\n description: previous === undefined\n ? `Replace the unreadable ${statePath} with an empty override file (no plugin is recorded as disabled). The damaged file is kept in the backup.`\n : `Replace the unreadable ${statePath} with the last valid copy from a backup. The damaged file is kept in the new backup.`,\n })\n } else if (finding.entryId !== undefined) {\n steps.push({\n recipe: 'disable-failing-row', because: finding, files: [statePath],\n description: `Record ${finding.entryId} as disabled for profile ${JSON.stringify(diagnosis.profileName)} in ${statePath}, so the app starts without it. Nothing is uninstalled.`,\n })\n }\n }\n // The override file must be readable before a row can be recorded in it.\n steps.sort((a, b) => Number(b.recipe === 'restore-override-file') - Number(a.recipe === 'restore-override-file'))\n return { profileName: diagnosis.profileName, dshHome: diagnosis.dshHome, steps }\n}\n\n/** Back up, then apply every step; on any failure the backup is put back and the error is thrown. */\nexport async function applyRepairPlan(plan: RepairPlan): Promise<RepairResult> {\n if (plan.steps.length === 0) throw new Error('there is nothing to repair')\n const statePath = resolvePluginLifecycleStatePath(plan.dshHome)\n const files = [...new Set(plan.steps.flatMap(step => step.files))]\n const backup: BackupManifest = await createBackup({ dshHome: plan.dshHome, profileName: plan.profileName, recipes: plan.steps.map(step => step.recipe), files })\n try {\n for (const step of plan.steps) {\n if (step.recipe === 'restore-override-file') {\n const previous = lastValidOverride(plan.dshHome, plan.profileName, statePath)\n await writeFileAtomic(statePath, previous ?? EMPTY_STATE, { mode: 0o600, dirMode: 0o700 })\n } else if (step.because.entryId !== undefined) {\n await setPluginLifecycleEntryEnabled({ profileName: plan.profileName, statePath }, entryPatchId(step.because.entryId), false)\n }\n }\n } catch (cause) {\n await restoreBackup(plan.dshHome, backup.id)\n throw new Error(`the repair failed and was rolled back: ${cause instanceof Error ? cause.message : String(cause)}`)\n }\n return { backupId: backup.id, applied: plan.steps.map(step => step.recipe) }\n}\n\n/** Undo a repair by putting its pre-images back. */\nexport async function undoRepair(dshHome: string, backupId: string): Promise<BackupManifest> {\n return restoreBackup(dshHome, backupId)\n}\n\n/** The plan as readable text, for a dry run or a confirmation. */\nexport function describePlan(plan: RepairPlan): string {\n if (plan.steps.length === 0) return 'Nothing to repair.'\n return plan.steps.map((step, index) => `${String(index + 1)}. [${step.recipe}] ${step.description}`).join('\\n')\n}\n\n","/**\n * `acryl new <dir>`: create an ACRYL Blends app, the way `rails new` creates a Rails app. Convention over configuration: every app has the same shape, so\n * the builder inside it (the agent) and every tool know where everything is without being told.\n *\n * <app>/blend.yaml what the app is: a Blends manifest (name, brand, the Blueprint it grew from) commit\n * <app>/plugins/ the app's own plugins; the agent inside builds them here; they load at every start commit (not plugins/.store/)\n * <app>/AGENTS.md the conventions, read by the agent inside at the start of every session commit\n * <app>/bin/acryl start it: bin/acryl web | desktop | cli\n * <app>/.dsh/ what the runtime keeps (sessions, settings, profile) ignored\n * <app>/desktop-data/ the desktop window's own data (window state, storage, logs, crash evidence) ignored\n *\n * The app folder is the app's ACRYL home, so an app is self-contained like a container: it can be copied, committed, run beside any other app and deleted\n * without touching anything else. It is the user's project from the first second: nothing in it is ACRYL-branded, it gets its own git repository, and its\n * license is the user's choice (closed source and commercial included; the framework and the harness it uses are MIT). Pure file planning plus one write boundary.\n *\n * @module @acryldev/harness-runtime/app/new-app\n */\n\nimport { spawnSync } from 'node:child_process'\nimport { chmodSync, cpSync, existsSync, mkdirSync, readdirSync, writeFileSync } from 'node:fs'\nimport { basename, dirname, join, resolve } from 'node:path'\nimport { manifestDigest } from '@acryldev/blends-core'\nimport { HOME_PLUGINS_FOLDER, STORE_FOLDER } from '@acryldev/plugin-hub-core'\nimport { isMap, isSeq, parseDocument, stringify } from 'yaml'\nimport { brandIdentity, type BrandIdentity } from '../blueprint/brand-identity.ts'\nimport { builtInCatalog, type Blueprint } from '../blueprint/blueprint.ts'\nimport { appManifest } from '../blueprint/manifest.ts'\n\nexport const APP_MANIFEST_FILE = 'blend.yaml'\nexport const APP_PLUGINS_DIR = HOME_PLUGINS_FOLDER\n\nconst APP_NAME = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u\n\nexport class NewAppError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'NewAppError'\n }\n}\n\nexport interface NewAppOptions {\n /** Display name; defaults to the folder name. */\n readonly title?: string\n /** Blueprint the app grows from; `acryl.blank` by default. */\n readonly blueprint?: string\n readonly brand?: Partial<Omit<BrandIdentity, 'name'>>\n /** Absolute path of the launcher `bin/acryl` hands off to (the framework's `scripts/blank.mjs`). */\n readonly launcher: string\n /**\n * Create the app from an existing app or captured Blend (its `blend.yaml`, and its `blend.lock.json` when it has one) instead of a Blueprint: the new\n * app keeps what the source grew (rows, brand, lineage) under its own name and id. Its `plugins/` are copied by `writeNewApp`.\n */\n readonly from?: { readonly manifestText: string, readonly lockText?: string }\n}\n\nexport interface PlannedApp {\n readonly root: string\n readonly name: string\n readonly blueprint: Blueprint\n readonly files: Readonly<Record<string, string>>\n}\n\n/** Pure: everything `acryl new` would write, by relative path. */\nexport function planNewApp(dir: string, options: NewAppOptions): PlannedApp {\n const root = resolve(dir)\n const name = basename(root)\n if (!APP_NAME.test(name) || name.length > 32) throw new NewAppError(`an app folder name is lowercase letters, digits and dashes (at most 32), got ${JSON.stringify(name)}`)\n const blueprintId = options.blueprint ?? 'acryl.blank'\n const blueprint = builtInCatalog().get(blueprintId)\n if (blueprint === undefined) throw new NewAppError(`unknown blueprint ${JSON.stringify(blueprintId)}; known: ${builtInCatalog().list().map(entry => entry.id).join(', ')}`)\n const title = options.title?.trim() || name\n const brand = brandIdentity({ ...(blueprint.brand.kind === 'custom' ? blueprint.brand.identity : {}), ...options.brand, name: title })\n const derived = options.from === undefined ? undefined : fromExistingApp(options.from, `app.${name}`, title, options.brand)\n const manifestText = derived?.manifestText\n ?? `# ${title}: what this app is (name, brand, what it grew from). Edit it and restart. Format: blends.acryl.dev/v1alpha1.\\n${stringify(appManifest({ id: `app.${name}`, name: title, blueprint, brand }), { lineWidth: 0 })}`\n const files: Record<string, string> = {\n [APP_MANIFEST_FILE]: manifestText,\n ...(derived?.lockText === undefined ? {} : { 'blend.lock.json': derived.lockText }),\n ...(derived?.starter === undefined ? {} : { [`blueprints/${derived.starter.id}.yaml`]: derived.starter.text }),\n ...(derived?.notice === undefined ? {} : { 'THIRD-PARTY.md': derived.notice }),\n [`${APP_PLUGINS_DIR}/README.md`]: `# plugins\\n\\nThis app's own plugins, one folder each. The agent inside the app builds them here when you ask for something\\n(\"add a to-do list\"), and every folder here loads when the app starts. Delete a folder to remove that plugin.\\n`,\n 'AGENTS.md': agentsMd(title),\n 'bin/acryl': `#!/usr/bin/env bash\\n# Start ${title}: bin/acryl web | desktop | cli (flags: --port 3105)\\nset -euo pipefail\\napp=\"$(cd \"$(dirname \"$0\")/..\" && pwd)\"\\nexec node ${JSON.stringify(options.launcher)} \"\\${1:-web}\" --dir \"$app\" \"\\${@:2}\"\\n`,\n // The plugin store (`plugins/.store/`) is runtime data like `.dsh/`: pulled plugins are reproduced from the Blend's lock; the app's own plugins beside it are committed.\n '.gitignore': `# what the runtime keeps for this app\\n.dsh/\\ninstance.json\\ndesktop-data/\\n${APP_PLUGINS_DIR}/${STORE_FOLDER}/\\n`,\n '.github/workflows/app.yml': appWorkflow(title),\n 'README.md': `# ${title}\n\n\\`\\`\\`bash\nbin/acryl web # or desktop, cli\n\\`\\`\\`\n\nTell the assistant inside what to build; it adds plugins to \\`plugins/\\` while the app runs. \\`blend.yaml\\` is the app's definition (name, brand,\nwhat it grew from). Runtime data stays in \\`.dsh/\\` and is not committed. The app has its own port and its own window, so it runs beside any other.\n\n## License\n\nThis project is yours: license it however you want, including closed source. It runs on the ACRYL Blends framework and DeepSeek Harness, both MIT\nlicensed; if you distribute a copy of the framework (for example a carried \\`runtime/\\`), keep their license notices with it.\n`,\n }\n return { root, name, blueprint, files }\n}\n\n/**\n * A new project from an existing starter or project (the three levels: the blank canvas, a Blueprint starter kit, a project). The source's rows, brand\n * colors and plugins are kept; the identity becomes the new project's, which is the user's own work: private and Proprietary until they say otherwise.\n *\n * from a starter (kind: Blueprint, spec.extends) -> a Blend whose lineage names the starter; the starter is kept in blueprints/<id>.yaml\n * from a project (kind: Blend, spec.lineage) -> a Blend with the same lineage; the source's blueprints/ travel with it\n *\n * Comments are kept, and the lock is re-pinned to the new definition with the format's digest (local module digests stay valid: plugins/ is copied as is).\n */\nfunction fromExistingApp(source: { readonly manifestText: string, readonly lockText?: string }, id: string, title: string, brand: Partial<Omit<BrandIdentity, 'name'>> | undefined): { manifestText: string, lockText?: string, starter?: { id: string, text: string }, notice?: string } {\n const document = parseDocument(source.manifestText)\n const parsed = document.toJS() as { kind?: unknown, metadata?: { id?: unknown, version?: unknown, license?: unknown, name?: unknown }, spec?: { lineage?: { blueprint?: unknown }, extends?: unknown } } | null\n const sourceId = typeof parsed?.metadata?.id === 'string' ? parsed.metadata.id : undefined\n const sourceVersion = typeof parsed?.metadata?.version === 'string' ? parsed.metadata.version : '0.1.0'\n let starter: { id: string, text: string } | undefined\n if (parsed?.kind === 'Blueprint' && sourceId !== undefined && builtInCatalog().get(sourceId) === undefined) {\n if (typeof parsed.spec?.extends !== 'string') throw new NewAppError(`the starter ${sourceId} names no parent (spec.extends)`)\n starter = { id: sourceId, text: source.manifestText }\n document.set('kind', 'Blend')\n document.deleteIn(['spec', 'extends'])\n document.setIn(['spec', 'lineage'], document.createNode({ blueprint: sourceId, blueprintVersion: sourceVersion }))\n } else if (parsed?.kind !== 'Blend' || typeof parsed.spec?.lineage?.blueprint !== 'string') {\n throw new NewAppError('--from needs a starter (kind: Blueprint with spec.extends) or a project (kind: Blend with spec.lineage)')\n }\n document.setIn(['metadata', 'id'], id)\n document.setIn(['metadata', 'name'], title)\n document.setIn(['metadata', 'description'], `${title}, created from ${sourceId ?? 'another app'}.`)\n document.setIn(['metadata', 'license'], 'Proprietary')\n document.setIn(['metadata', 'visibility'], 'private')\n const rows = document.getIn(['spec', 'rows'])\n if (isSeq(rows)) {\n for (const row of rows.items) {\n if (isMap(row) && row.get('name') === '@acryldev/brand') {\n row.setIn(['config', 'name'], title)\n for (const [key, value] of Object.entries(brand ?? {})) if (value !== undefined) row.setIn(['config', key], value)\n }\n }\n }\n // The source's comments are kept; the header names the app it describes, so it takes the new app's name. Before the lock digests the text.\n const manifestText = String(document).replace(/^# .*?: what this app is/u, `# ${title}: what this app is`)\n const sourceLicense = typeof parsed.metadata?.license === 'string' ? parsed.metadata.license : undefined\n // The source's code (its plugins) keeps its own license: its notice travels with the copy.\n const notice = sourceLicense === undefined || sourceLicense === 'Proprietary' ? undefined\n : `# Third-party code\\n\\nThis project was created from ${sourceId ?? 'another app'}${typeof parsed.metadata?.name === 'string' ? ` (${parsed.metadata.name})` : ''}, licensed ${sourceLicense}. Code copied from it into\\nplugins/ remains under that license; keep this notice, and the source's license text where it requires one, with any copy you distribute.\\n`\n const extra = { ...(starter === undefined ? {} : { starter }), ...(notice === undefined ? {} : { notice }) }\n if (source.lockText === undefined) return { manifestText, ...extra }\n const lock = JSON.parse(source.lockText) as { origin?: Record<string, unknown> }\n lock.origin = { ...lock.origin, id, kind: 'Blend', digest: manifestDigest(manifestText) }\n return { manifestText, lockText: `${JSON.stringify(lock, null, 2)}\\n`, ...extra }\n}\n\n/**\n * CI from the first commit (spec 036, T019): on every push and pull request the app definition must validate the way the engine and the registry validate it,\n * and no tracked file may hold a secret (the same check \\`acryl save\\` runs, so a key committed outside ACRYL is caught too). Pinned to the published tools.\n */\nfunction appWorkflow(title: string): string {\n return `name: ${JSON.stringify(title)}\n\non:\n push:\n pull_request:\n\npermissions:\n contents: read\n\njobs:\n check:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: actions/setup-node@v4\n with:\n node-version: 24\n - name: The app definition is valid\n run: npx --yes --package @acryldev/blends-core@0.1 blends-validate blend.yaml\n - name: No secrets in the repository\n run: npx --yes --package @acryldev/app-persistence@0.1 acryl-secret-check .\n`\n}\n\nfunction agentsMd(title: string): string {\n return `# ${title}: conventions for the builder inside\n\nYou are the builder inside ${title}. The user asks for what they want; you build it here, as plugins, while the app runs. The project and its git repository\nbelong to the user: commit with clear messages when a change works and the user agrees, never push unless asked.\n\n- **Where things go.** Every capability you add is one plugin in \\`plugins/<name>/\\` of this app (the app's own folder, which is its ACRYL home). Install it with\n \\`acryl_install_plugin\\` using its absolute path; it goes live without a restart and loads at every start. Never put the app's plugins anywhere else.\n- **What the app is.** \\`blend.yaml\\` is the app's definition (name, brand, the Blueprint it grew from). Change the brand there when the user asks to rename or restyle the app.\n- **Data.** A plugin keeps its data in the app folder (\\`data/<plugin>.json\\`) or in the project the user opens, never inside its own code folder.\n- **Capture.** \\`/blend snapshot\\` records what the app has become so it can be re-created; publishing is the user's decision.\n- **How.** Your ACRYL plugin docs (in your system prompt) have a routed doc and a verified example for every kind of plugin; read the nearest one before writing.\n`\n}\n\n/** Write the app. The folder must not exist or must be empty: `new` never overwrites. `runtimeDir` hands the app its own Web runtime (see below). */\n/** A file of the launcher an app carries: copied from the framework, or written with the given content. */\nexport type LauncherFile = { readonly from: string } | { readonly content: string }\n\nexport function writeNewApp(planned: PlannedApp, options: { readonly runtimeDir?: string, readonly launcherFiles?: Readonly<Record<string, LauncherFile>>, readonly git?: boolean, readonly pluginsFrom?: string, readonly blueprintsFrom?: string } = {}): { readonly git: 'initialized' | 'skipped' | 'unavailable' } {\n if (existsSync(planned.root) && readdirSync(planned.root).length > 0) throw new NewAppError(`${planned.root} is not empty; acryl new only creates a new app`)\n if (options.runtimeDir !== undefined && !existsSync(join(options.runtimeDir, 'lib', 'bin.js'))) throw new NewAppError(`${options.runtimeDir} is not an ACRYL Web runtime (no lib/bin.js)`)\n for (const [relative, content] of Object.entries(planned.files)) {\n const target = join(planned.root, relative)\n mkdirSync(dirname(target), { recursive: true })\n writeFileSync(target, content)\n }\n chmodSync(join(planned.root, 'bin', 'acryl'), 0o755)\n // An app created from another brings that app's own plugins, verbatim so the lock's digests still hold (never its node_modules or git history).\n // The starters the source itself grew from travel with it, so the whole chain back to a built-in Blueprint resolves in the new app.\n if (options.blueprintsFrom !== undefined && existsSync(options.blueprintsFrom)) {\n cpSync(options.blueprintsFrom, join(planned.root, 'blueprints'), { recursive: true, force: false, errorOnExist: false })\n }\n if (options.pluginsFrom !== undefined && existsSync(options.pluginsFrom)) {\n // The source app's own plugins, not its store: pulled plugins are runtime data, reproduced from the lock.\n cpSync(options.pluginsFrom, join(planned.root, APP_PLUGINS_DIR), { recursive: true, filter: source => !['node_modules', '.git', STORE_FOLDER].includes(basename(source)) })\n }\n if (options.runtimeDir !== undefined) {\n // The app carries its own runtime: it then starts with nothing of the framework but Node. Symlinks stay relative to the copy.\n cpSync(options.runtimeDir, join(planned.root, 'runtime'), { recursive: true, verbatimSymlinks: true })\n for (const [relative, file] of Object.entries(options.launcherFiles ?? {})) {\n const target = join(planned.root, '.app', relative)\n mkdirSync(dirname(target), { recursive: true })\n if ('from' in file) cpSync(file.from, target)\n else writeFileSync(target, file.content)\n }\n writeFileSync(join(planned.root, 'bin', 'acryl'), `#!/usr/bin/env bash\\n# Start this app: bin/acryl web\\nset -euo pipefail\\napp=\"$(cd \"$(dirname \"$0\")/..\" && pwd)\"\\nexec node \"$app/.app/launch.mjs\" \"\\${1:-web}\" --dir \"$app\" \"\\${@:2}\"\\n`)\n chmodSync(join(planned.root, 'bin', 'acryl'), 0o755)\n }\n // Like `rails new`: the app starts as its own repository (no commit is made for the user). The carried runtime is large and rebuildable, so it is not tracked.\n if (options.git === false) return { git: 'skipped' }\n if (options.runtimeDir !== undefined) writeFileSync(join(planned.root, '.gitignore'), `${planned.files['.gitignore'] ?? ''}runtime/\\n`)\n const init = spawnSync('git', ['init', '--quiet', planned.root], { stdio: 'ignore' })\n return { git: init.status === 0 ? 'initialized' : 'unavailable' }\n}\n","/**\n * Where a new app starts from (`acryl new --from`, spec 036 `persistence-and-registries.md`): an app or captured Blend folder, a git repository (public or\n * private, reached with the user's own git credentials), or a starter id in a registry (a git repository or folder with `index.json`). Everything is\n * resolved to a local folder that has `blend.yaml`, which `planNewApp` / `writeNewApp` take from there.\n *\n * Git is a port (`GitClone`): the rules here are pure; `gitClone` below is the adapter that shells out to the user's git, never prompting for credentials.\n *\n * @module @acryldev/harness-runtime/app/start-source\n */\n\nimport { spawnSync } from 'node:child_process'\nimport { existsSync, mkdtempSync, readFileSync, rmSync, statSync } from 'node:fs'\nimport { tmpdir } from 'node:os'\nimport { join, resolve } from 'node:path'\nimport { parseRegistryIndex } from '@acryldev/blends-core'\n\n/** The public registry: a folder of the acrylblends.github.io repository. `#<folder>` names the folder inside a repository. */\nexport const PUBLIC_REGISTRY = 'https://github.com/acrylblends/acrylblends.github.io.git#registry'\n\nexport type StartSource =\n | { readonly kind: 'folder', readonly path: string }\n | { readonly kind: 'git', readonly url: string, readonly subdir?: string }\n | { readonly kind: 'registry', readonly id: string }\n\nexport class StartSourceError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'StartSourceError'\n }\n}\n\n/** Clone `url` (shallow) into `into`. Throws with git's own message on failure. */\nexport type GitClone = (url: string, into: string) => void\n\nconst GIT_URL = /^(?:https?:\\/\\/|ssh:\\/\\/|git@|file:\\/\\/)|\\.git(?:#.*)?$/u\nconst STARTER_ID = /^[a-z][a-z0-9-]*(?:\\.[a-z0-9][a-z0-9-]*)+$/u\n\nfunction splitSubdir(reference: string): { url: string, subdir?: string } {\n const hash = reference.lastIndexOf('#')\n if (hash <= 0) return { url: reference }\n const subdir = reference.slice(hash + 1)\n if (subdir === '' || subdir.split('/').some(part => part === '..' || part === '')) throw new StartSourceError(`\"${subdir}\" is not a folder inside the repository`)\n return { url: reference.slice(0, hash), subdir }\n}\n\n/** Pure: what `--from` names. A path that exists is a folder; a git URL is a repository; a dotted id is a registry starter. */\nexport function classifyStartSource(from: string, isDirectory: (path: string) => boolean): StartSource {\n if (isDirectory(from)) return { kind: 'folder', path: resolve(from) }\n if (GIT_URL.test(from)) return { kind: 'git', ...splitSubdir(from) }\n if (STARTER_ID.test(from)) return { kind: 'registry', id: from }\n throw new StartSourceError(`--from \"${from}\" is not a folder, a git URL or a starter id (such as acme.accounting)`)\n}\n\n/** The adapter: the user's git, shallow, and never waiting on a credentials prompt (a private repository needs the user's own git login). */\nexport const gitClone: GitClone = (url, into) => {\n const result = spawnSync('git', ['clone', '--depth', '1', '--quiet', url, into], { env: { ...process.env, GIT_TERMINAL_PROMPT: '0' }, encoding: 'utf8' })\n if (result.error !== undefined) throw new StartSourceError(`git is not available: ${result.error.message}`)\n if (result.status !== 0) throw new StartSourceError(`git could not clone ${url}: ${(result.stderr || '').trim().split('\\n').at(-1) ?? 'failed'}. A private repository needs your own git login (for GitHub: gh auth login).`)\n}\n\nconst isDirectory = (path: string): boolean => existsSync(path) && statSync(path).isDirectory()\n\nexport interface ResolvedStartSource {\n /** A local folder with `blend.yaml`. */\n readonly folder: string\n /** Where it came from, for the new app's description and the user's report. */\n readonly origin: string\n /** Remove the temporary clone, if any. */\n dispose(): void\n}\n\n/**\n * Resolve `--from` to a local folder. `registry` is a folder or git URL (`#<folder>` allowed) holding `index.json`; the public registry by default.\n * The caller disposes the result when the new app is written.\n */\nexport function resolveStartSource(from: string, options: { readonly registry?: string, readonly clone?: GitClone } = {}): ResolvedStartSource {\n const clone = options.clone ?? gitClone\n const temporary: string[] = []\n const dispose = (): void => { for (const dir of temporary.splice(0)) rmSync(dir, { recursive: true, force: true }) }\n const fetch = (reference: string): string => {\n const { url, subdir } = splitSubdir(reference)\n if (isDirectory(url)) return subdir === undefined ? resolve(url) : join(resolve(url), subdir)\n const into = mkdtempSync(join(tmpdir(), 'acryl-source-'))\n temporary.push(into)\n clone(url, join(into, 'repo'))\n return subdir === undefined ? join(into, 'repo') : join(into, 'repo', subdir)\n }\n try {\n const source = classifyStartSource(from, isDirectory)\n let folder: string\n let origin: string\n if (source.kind === 'folder') { folder = source.path; origin = source.path }\n else if (source.kind === 'git') { folder = fetch(source.subdir === undefined ? source.url : `${source.url}#${source.subdir}`); origin = source.url }\n else {\n const registry = options.registry ?? PUBLIC_REGISTRY\n const root = fetch(registry)\n const indexFile = join(root, 'index.json')\n if (!existsSync(indexFile)) throw new StartSourceError(`${registry} has no index.json; it is not a registry`)\n const entry = parseRegistryIndex(readFileSync(indexFile, 'utf8')).entries.find(candidate => candidate.id === source.id)\n if (entry === undefined) throw new StartSourceError(`${registry} has no starter \"${source.id}\"`)\n folder = join(root, entry.path)\n origin = `${source.id} (${registry})`\n }\n if (!existsSync(join(folder, 'blend.yaml'))) throw new StartSourceError(`${origin} has no blend.yaml; it is not an app or a starter`)\n return { folder, origin, dispose }\n } catch (error) {\n dispose()\n throw error\n }\n}\n","export {\n ACRYL_CODING_CAPABILITIES,\n type AcrylCodingCapabilityDeclaration,\n type AcrylCodingCapabilityId,\n type AcrylShellMode,\n type AcrylSurface,\n} from './coding-capabilities.ts'\nexport type { CodingCapabilities } from './engine-dsh.ts'\nexport type {\n DurableSessionMessage,\n DurableSessionMessagePort,\n DurableSessionMessageReceipt,\n} from './durable-message.ts'\nexport {\n createAcrylSessionBridge,\n type AcrylSessionBridge,\n type AcrylSessionBridgeOptions,\n} from './session-bridge.ts'\nexport {\n installSessionLogExporter,\n type InstallSessionLogExporterOptions,\n} from './session-log-exporter.ts'\nexport {\n ACRYL_DSH_ENGINE_DIR_NAME,\n ACRYL_HOME_DIR_NAME,\n resolveAcrylDshHome,\n resolveAcrylHome,\n} from './acryl-home.ts'\nexport {\n createAcrylEngineHost,\n type AcrylEngineDefinition,\n type AcrylEngineHost,\n} from './engine-host.ts'\nexport {\n createDshEngineDefinition,\n createDshEngineDefinitionFromComposition,\n createProfileContext,\n createProfileRuntimeResolution,\n createWebEngineDefinition,\n pluginRequiredFrameworkPackages,\n profileRequiredFrameworkModules,\n materializeProfilePackage,\n UPSTREAM_PRODUCT_ANALYTICS_OFF,\n type AcrylFrameworkPackages,\n type DshEngineComposition,\n} from './engine-dsh.ts'\nexport {\n PackageOverlayNotFoundError,\n findOverlayPackage,\n packageNameFromSpecifier,\n resolveOverlayPackage,\n type PackageOverlayCandidate,\n type PackageOverlayOptions,\n type PackageOverlaySelection,\n type PackageOverlaySource,\n} from './package-overlay.ts'\nexport {\n installProfilePackageResolver,\n type InstallProfilePackageResolverOptions,\n} from './module-resolution.ts'\nexport {\n provideWebMarketInstall,\n WebPnpmService,\n WebProfilesService,\n type WebMarketPnpm,\n type WebMarketPnpmHandle,\n type WebMarketPnpmOutcome,\n type WebMarketProfile,\n} from './web-market-install.ts'\nexport {\n provideWebMarketPlugins,\n WebLiveActivationService,\n WebPluginsService,\n type WebMarketPluginBundle,\n} from './web-market-plugins.ts'\nexport {\n provideCliMarketInstall,\n CliPnpmService,\n CliProfilesService,\n type CliMarketPnpm,\n type CliMarketPnpmHandle,\n type CliMarketPnpmOutcome,\n type CliMarketProfile,\n} from './cli-market-install.ts'\nexport {\n provideCliMarketPlugins,\n CliLiveActivationService,\n CliPluginsService,\n type CliMarketPluginBundle,\n} from './cli-market-plugins.ts'\nexport {\n createAcrylPluginLifecycle,\n createDshPluginLifecycleHost,\n mountAcrylPluginLifecycle,\n type DshPluginLifecycleOptions,\n} from './plugin-lifecycle.ts'\nexport {\n BASE_TEMPLATE_BUNDLE_NAMES,\n assertProfileName,\n entryPatchId,\n isPluginLifecycleEntryId,\n pluginLifecyclePatches,\n readDisabledPluginLifecycleEntries,\n readUserMutableBundleNames,\n resolvePluginLifecycleStatePath,\n setPluginLifecycleEntryEnabled,\n type PluginLifecycleStatePersistence,\n type ProfileNameValidator,\n} from './plugin-lifecycle-state.ts'\nexport {\n diagnosePluginLifecycle,\n type PluginHealthCode,\n type PluginHealthFinding,\n type PluginHealthInput,\n type PluginHealthReport,\n type PluginHealthSeverity,\n} from './plugin-doctor.ts'\n// The lifecycle vocabulary itself belongs to `@acryldev/control`, the domain\n// package. Surfaces depend on this runtime, not on the domain package, so the\n// shared contract is re-exported here rather than duplicated per surface; one\n// `PluginLifecycleError` class has to be the one every surface throws and\n// catches, or its `code` stops crossing a route boundary.\nexport {\n AcrPluginLifecycleService,\n PROTECTED_PLUGIN_ENTRY_REASON,\n PluginLifecycleError,\n type AcrPluginLifecycle,\n type AcrPluginLifecycleController,\n type PluginLifecycleAction,\n type PluginLifecycleEntryRef,\n type PluginLifecycleEntryView,\n type PluginLifecycleErrorCode,\n type PluginLifecycleFiberPhase,\n type PluginLifecycleHost,\n type PluginLifecycleMountedStatus,\n type PluginLifecycleReceipt,\n type PluginLifecycleSnapshot,\n} from '@acryldev/control'\n\nimport { writeFileSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport { join } from 'node:path'\nimport type { Context } from '@deepseek-ai/cordis'\nimport { provideCmdline } from '@deepseek-ai/dsh-cmdline'\nimport {\n DEFAULT_PROFILE_BUNDLES,\n PROFILE_TEMPLATES,\n boot,\n composeEntries,\n initProfile,\n loadProfile,\n removeLinkProjections,\n resolveProfileDir,\n type RuntimeResolution,\n} from '@deepseek-ai/dsh-app-boot'\n\nimport { createProfileRuntimeResolution } from './engine-dsh.ts'\nimport { selectInstance, type AppInstance } from './instance/index.ts'\nimport { materializeProfilePackage, type CodingCapabilities } from './engine-dsh.ts'\nimport { installAcrylWorkspaceStatusTool } from './plugin-acryl-workspace-status.ts'\nimport { ProfilePluginPackages } from './profile-resolution/service.ts'\nimport { installSessionLogExporter } from './session-log-exporter.ts'\n\nconst require = createRequire(import.meta.url)\nconst dshInstallAnchor = require.resolve('@deepseek-ai/dsh/package.json')\nconst profileRoot = '[]\\n'\n\nexport interface BootAcrylHarnessProfileOptions {\n readonly profile: string\n /** The surface's capability composition (`@acryldev/coding-capabilities`); without it only the profile's own rows compose. */\n readonly capabilities?: CodingCapabilities\n readonly prepare?: (ctx: Context) => Promise<void> | void\n}\n\n/**\n * Provide the chosen app instance and the profile's package table (DSH 0.2 answers every bare-package import from it, as stock\n * `dsh` mounts it in its own boot step) before any profile entry mounts, then run the caller's own host setup.\n */\nfunction withAppInstance(\n instance: AppInstance,\n resolution: RuntimeResolution,\n prepare?: (ctx: Context) => Promise<void> | void,\n): (ctx: Context) => Promise<void> {\n return async ctx => {\n ctx.provide('appInstance', instance)\n await ctx.plugin(ProfilePluginPackages, { resolution })\n await prepare?.(ctx)\n }\n}\n\nexport interface AcrylHarnessRuntime {\n readonly ctx: Context\n readonly profileDirectory: string\n dispose(): Promise<void>\n}\n\n/** Boot one normal pinned-Harness ACRYL profile in a single Cordis root. */\nexport async function bootAcrylHarnessProfile(\n options: BootAcrylHarnessProfileOptions,\n): Promise<AcrylHarnessRuntime> {\n if (options.profile.trim() === '') throw new Error('ACRYL Harness profile must not be empty')\n // This boot is its own composition root: it chooses the app instance once and provides it to plugins (runtime instance/).\n const instance = selectInstance()\n process.env.DSH_HOME = instance.dshHome\n const profileDirectory = resolveProfileDir(options.profile)\n initProfile(profileDirectory, DEFAULT_PROFILE_BUNDLES)\n removeLinkProjections(profileDirectory)\n const profile = loadProfile('acryl', options.profile, dshInstallAnchor)\n const rootConfig = join(profile.dir, 'cordis.yml')\n writeFileSync(rootConfig, profileRoot)\n // The terminal capabilities' ACRYL packages, resolvable from this profile as the CLI and Web boots make them; without it their rows\n // fail to import (`@acryldev/settings`, the account sign-in callback).\n const tuiSurfaces = new Set(['tui'] as const)\n for (const packageName of options.capabilities?.packages(tuiSurfaces, new Set()) ?? [])\n materializeProfilePackage(profile.dir, packageName, options.capabilities?.anchors[0] ?? import.meta.url)\n const patches = structuredClone([\n ...profile.layers.flatMap(layer => layer.patches),\n ...(options.capabilities?.patches(tuiSurfaces, new Set(), new Set()) ?? []),\n ...profile.patches,\n ])\n const hmr = composeEntries([patches]).find(entry => entry.id === 'hmr')\n if (hmr?.disabled !== true && !process.execArgv.includes('--expose-internals')) {\n throw new Error(\n 'ACRYL profile enables Cordis HMR and must be launched with Node --expose-internals',\n )\n }\n const ctx = await boot('acryl', rootConfig, patches, withAppInstance(instance, await createProfileRuntimeResolution(profile), options.prepare))\n if ((ctx as { tools?: unknown }).tools) installAcrylWorkspaceStatusTool(ctx)\n installSessionLogExporter(ctx, { surface: 'tui', dshHome: instance.dshHome })\n let disposed = false\n return Object.freeze({\n ctx,\n profileDirectory: profile.dir,\n async dispose() {\n if (disposed) return\n disposed = true\n await ctx.fiber.dispose()\n },\n })\n}\n\nexport interface BootAcrylWebProfileOptions {\n /** Inner arguments handed to the web-startup provider (e.g. `['--port', '4000']`). Defaults to no flags. */\n readonly cmdlineArgs?: readonly string[]\n /** The surface's capability composition (`@acryldev/coding-capabilities`); without it only the profile's own rows compose. */\n readonly capabilities?: CodingCapabilities\n /** Host setup run after Loader installation and before any config-tree entry mounts. */\n readonly prepare?: (ctx: Context) => Promise<void> | void\n}\n\nexport interface AcrylWebRuntime {\n readonly ctx: Context\n /** The canonical bind URL, e.g. `http://127.0.0.1:3080`. */\n readonly url: string\n readonly profileDirectory: string\n dispose(): Promise<void>\n}\n\n/**\n * Boot the DSH browser surface (the `web` profile: `dsh-base` + `dsh-web-app`)\n * as one normal ACRYL runtime, so `pnpm acryl-web` serves the same DSH\n * HTTP/WebSocket seam the web surface always uses. The shipped Web profile\n * already owns its system prompt, agent-preset roster, and session stats, so\n * the shared factory contributes only the missing authorization seam here.\n */\nexport async function bootAcrylWebProfile(\n options: BootAcrylWebProfileOptions = {},\n): Promise<AcrylWebRuntime> {\n const profileName = 'web'\n // This boot is its own composition root: it chooses the app instance once and provides it to plugins (runtime instance/).\n const instance = selectInstance()\n process.env.DSH_HOME = instance.dshHome\n const profileDirectory = resolveProfileDir(profileName)\n // See engine-dsh.ts's resolveWebEngineComposition for the full rationale:\n // DEFAULT_PROFILE_BUNDLES (dsh-base only) pre-empts loadProfile()'s own\n // correct PROFILE_TEMPLATES.web-based auto-init (dsh-base + dsh-web-app),\n // leaving a fresh 'web' profile with no dsh-client-connection/webStartup -\n // ctx.get('connection') and ctx.get('webStartup') are never defined, and\n // the served index falls back to its own \"authentication required\" message.\n const webTemplate = PROFILE_TEMPLATES.web\n initProfile(profileDirectory, webTemplate?.bundles ?? DEFAULT_PROFILE_BUNDLES)\n removeLinkProjections(profileDirectory)\n const profile = loadProfile('web', profileName, dshInstallAnchor)\n const rootConfig = join(profile.dir, 'cordis.yml')\n writeFileSync(rootConfig, profileRoot)\n // Same composition as the engine-host Web path: the shared workspace and shell declarations, with the ACRYL\n // packages they name made resolvable from this profile.\n const webSurfaces = new Set(['web'] as const)\n for (const packageName of options.capabilities?.packages(webSurfaces, new Set()) ?? []) {\n materializeProfilePackage(profile.dir, packageName, options.capabilities?.anchors[0] ?? import.meta.url)\n }\n const patches = structuredClone([\n ...profile.layers.flatMap(layer => layer.patches),\n ...(options.capabilities?.patches(webSurfaces, new Set(), new Set()) ?? []),\n ...(options.capabilities?.shellPatches(webSurfaces, 'advanced', new Set(), new Set()) ?? []),\n ...profile.patches,\n ])\n const cmdlineArgs = options.cmdlineArgs ?? []\n const ctx = await boot('web', rootConfig, patches, withAppInstance(instance, await createProfileRuntimeResolution(profile), hostCtx => {\n provideCmdline(hostCtx, { args: [...cmdlineArgs], exit: code => { process.exitCode = code } })\n return options.prepare?.(hostCtx)\n }))\n if ((ctx as { tools?: unknown }).tools) installAcrylWorkspaceStatusTool(ctx)\n installSessionLogExporter(ctx, { surface: 'web', dshHome: instance.dshHome })\n const startup = ctx.get('webStartup') as { host?: string; port?: number } | undefined\n const host = startup?.host ?? '127.0.0.1'\n const port = startup?.port ?? instance.webPort.start\n const url = `http://${host}:${port}`\n let disposed = false\n return Object.freeze({\n ctx,\n url,\n profileDirectory: profile.dir,\n async dispose() {\n if (disposed) return\n disposed = true\n await ctx.fiber.dispose()\n },\n })\n}\nexport {\n captureSystemPrompt,\n renderSystemPromptDoc,\n type CaptureSystemPromptOptions,\n type CapturedSystemPrompt,\n} from './system-prompt-capture.ts'\nexport { pinnedPnpmEnv, resolvePinnedPnpm, type PinnedPnpm } from './pinned-pnpm.ts'\nexport { reconcileProfileLayout, type LayoutChange } from './profile-layout.ts'\nexport {\n AGENTS_BLUEPRINT,\n BLANK_BLUEPRINT,\n DSH_CHAT_ROW_IDS,\n DSH_PLUGIN_MANAGER_ROW_ID,\n PLUGIN_MANAGER_ROW_ID,\n IDE_BLUEPRINT,\n BLUEPRINT_ROW_IDS,\n InvalidBlueprintError,\n InvalidBrandIdentityError,\n UnknownBlueprintError,\n appManifest,\n blueprintFromManifest,\n catalogWithStarters,\n isBlendsManifest,\n parseBlueprint,\n readBlueprintFile,\n readStarters,\n blueprintFromEnvironment,\n brandIdentity,\n builtInCatalog,\n composeBlueprintRows,\n currentModule,\n identityLine,\n packageOfModule,\n selectBlueprint,\n withBrand,\n type Blueprint,\n type BlueprintBrand,\n type BlueprintCatalog,\n type BlueprintComposition,\n type BlueprintRowId,\n type BrandIdentity,\n} from './blueprint/index.ts'\nexport {\n SAFE_RECIPES,\n applyRepairPlan,\n backupsDir,\n createBackup,\n describePlan,\n inspectProfile,\n isSafeRecipe,\n listBackups,\n planRepairs,\n restoreBackup,\n undoRepair,\n} from './profile-repair/index.ts'\nexport type {\n BackupEntry,\n BackupManifest,\n InspectOptions,\n ProfileDiagnosis,\n ProfileFinding,\n ProfileFindingCode,\n RecipeId,\n RepairPlan,\n RepairResult,\n RepairStep,\n} from './profile-repair/index.ts'\nexport { WEB_PORT_ATTEMPTS, findFreeWebPort, loopbackPortIsFree, webPortPatch } from './web-port.ts'\nexport { APP_MANIFEST_FILE, APP_PLUGINS_DIR, NewAppError, planNewApp, writeNewApp, type LauncherFile, type NewAppOptions, type PlannedApp } from './app/new-app.ts'\nexport { PROFILE_OWNER_FILE, ProfileInUseError, claimProfile, type ProfileOwner } from './profile-owner.ts'\nexport {\n APP_DEFINITION_FILE,\n AppInstanceError,\n LockHeldError,\n acquireLock,\n announce,\n announceSelf,\n appFolder,\n appFolderInstance,\n appName,\n defaultInstance,\n developmentInstance,\n instanceEnvironment,\n IsolationRequiredError,\n isGitWorktree,\n listRunning,\n managedApp,\n ONLINE_SECRET_FILE_NAME,\n onlineSecretPath,\n osHomeDirectory,\n pinnedInstance,\n processIsAlive,\n profileDir,\n readLock,\n readOnlineSecret,\n releaseLock,\n removeOnlineSecret,\n REQUIRE_ISOLATED_HOME_ENV,\n runLockFileForDshHome,\n selectInstance,\n stablePort,\n withdraw,\n worktreeInstance,\n writeOnlineSecret,\n InstanceAnnounceError,\n type AppInstance,\n type AppInstanceKind,\n type LockHolder,\n type RunningApp,\n type SelfAnnouncement,\n type SelectInstanceOptions,\n} from './instance/index.ts'\nexport { PUBLIC_REGISTRY, StartSourceError, classifyStartSource, gitClone, resolveStartSource, type GitClone, type ResolvedStartSource, type StartSource } from './app/start-source.ts'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CA,MAAa,4BAAyE;CACpF,EAAE,IAAI,UAAU;CAChB,EAAE,IAAI,eAAe;CACrB,EAAE,IAAI,gBAAgB;CACtB,EAAE,IAAI,gBAAgB;CACtB,EAAE,IAAI,iBAAiB;CACvB;EAAE,IAAI;EAAa,aAAa;CAAK;CACrC;EAAE,IAAI;EAAgB,aAAa;CAAK;CACxC;EAAE,IAAI;EAAW,aAAa;CAAK;CACnC;EAAE,IAAI;EAAmB,aAAa;CAAK;CAC3C,EAAE,IAAI,mBAAmB;CACzB;EAAE,IAAI;EAAW,aAAa;CAAK;CACnC;EAAE,IAAI;EAAoB,aAAa;CAAK;CAC5C,EAAE,IAAI,iBAAiB;AACzB;;;ACSA,SAAS,YAAY,SAA+E;CAClG,OAAO,QACJ,QAAQ,UAAqE;EAC5E,OAAO,MAAM,SAAS,UAAU,OAAO,MAAM,SAAS;CACxD,CAAC,CAAC,CACD,KAAI,UAAS,MAAM,IAAI,CAAC,CACxB,KAAK,EAAE;AACZ;AAEA,SAAS,WAAW,QAAiE;CACnF,MAAM,QAA+B,CAAC;CACtC,KAAK,MAAM,SAAS,QAAQ;EAC1B,IAAI,MAAM,SAAS,kBAAkB,MAAM,KAAK,OAAO,SAAS,QAAQ;GACtE,MAAM,OAAO,YAAY,MAAM,KAAK,OAAO;GAC3C,IAAI,SAAS,IAAI,MAAM,KAAK,OAAO,OAAO;IAAE,IAAI,SAAS,MAAM;IAAO,QAAQ;IAAQ;GAAK,CAAC,CAAC;EAC/F;EACA,IAAI,MAAM,SAAS,qBAAqB;GACtC,MAAM,OAAO,YAAY,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