/** * The dsh-tui-plugin-host row: the plugin-interop anchor every later * contract surface hangs off (storage.local, messages.observe, effect * ledger — each lands as a sibling service mounted by THIS row's apply, so * the patch surface changed exactly once for the whole v0.15 alignment). * * What it provides on `ctx.tuiPluginHost`: * * - `generationId` — the runtime generation id (C-050), a fresh UUID per * row activation; ledger records and the Host Descriptor stamp it so * effects from different process generations can never be confused. * - `grants` — the unified 8-permission live GrantStore (./grants.js). * - `hostDescriptor()` — the C-010 Host Descriptor (./host-descriptor.js), * built lazily and cached; drifted contracts are dropped fail-closed. * - `selfCheck()` — vendored registry + contract-profile violations * (definition/profile drift, ten-point incompleteness, parity mismatches). * - `registerCommand(pluginCtx, definition)` — the MEDIATED command * registration surface (C-041 attribution): stamps each command with the * verified Component identity so the invoke checkpoint can enforce per-owner * denies (./command-attribution.js). Direct `ctx.get('commands')` * registrations stay unattributed — the documented C-070 boundary. * * Discipline notes: * * - #183: consumers NEVER get this service via inject — always * `ctx.get('tuiPluginHost', false)` soft probing, with the skew warning in * plugin.ts covering profile launches on a stale patch. * - The D-7 decision gate does NOT depend on this row: the extensions row * and the channel each install it with their own GrantStore read, so a * missing plugin-host row never relaxes interception gating. * - Boot-time self-check failures are logged once here (fail closed happens * per-contract at descriptor build time; boot must not die on drifted * vendored data). */ import { Context, Service } from '@deepseek-ai/cordis'; import type { CommandDefinition } from '@deepseek-ai/dsh-commands'; import type { HostDescriptor } from '../plugin-spec/types.js'; import { type GrantStore } from './grants.js'; import { type HostDescriptorBuild } from './host-descriptor.js'; import { type DecisionRegistrationOptions } from './decision-guard.js'; import { type VerifiedComponentIdentity } from './component-identity.js'; /** Public, mediated plugin-host capability. Loader-only admission remains * behind getHostAdmission(), which is deliberately omitted from the package * export surface. */ export interface TuiPluginHost { readonly generationId: string; readonly grants: GrantStore; hostDescriptor(): HostDescriptor; describe(): HostDescriptorBuild; subscribeDecision(pluginCtx: Context, event: string, listener: (payload: Record) => unknown, options?: { scope?: string; order?: string; }): () => boolean; registerCommand(pluginCtx: Context, definition: CommandDefinition): () => void; registerCommand(pluginCtx: Context, contributionId: string, definition: CommandDefinition): () => void; selfCheck(): string[]; } declare module '@deepseek-ai/cordis' { interface Context { tuiPluginHost: TuiPluginHost; } } /** `ctx.tuiPluginHost` — plugin-interop anchor (generation, grants, descriptor). */ export declare class TuiPluginHostRuntime extends Service implements TuiPluginHost { /** Runtime generation id (C-050): fresh per activation of this row. */ get generationId(): string; /** Live scoped grant store; every operation observes the current file. */ get grants(): GrantStore; constructor(ctx: Context); /** * The C-010 Host Descriptor, built lazily and cached while the * runtime-dependent commands capability remains unchanged. */ hostDescriptor(): HostDescriptor; /** The full build result (descriptor + dropped coordinates + warnings). */ describe(): HostDescriptorBuild; private build; /** * Parse, project, validate, negotiate, and bind one activation's Component * identity before any mediated runtime capability can be used. */ admit(pluginCtx: Context, source: string, options?: { source?: string; activationId?: string; }): VerifiedComponentIdentity; /** @internal Host loader entry; the unexported token prevents proxy calls. */ admitInternal(pluginCtx: Context, source: string, options?: { source?: string; activationId?: string; }, token?: symbol): VerifiedComponentIdentity; /** * Host-mediated DecisionEvents activation surface. A plugin cannot use a * raw `ctx.on` for these points: the verified Component identity, static * requirement, scope and current grant are all checked before insertion in * the registry. The returned disposer is idempotent and is also owned by * the activation so deactivation cannot leave an effect behind. */ subscribeDecision(pluginCtx: Context, event: string, listener: (payload: Record) => unknown, options?: DecisionRegistrationOptions): () => boolean; /** * Mediated command registration (C-041 attribution): registers through * the commands service and, on success, stamps the command's owner as * the verified Component identity — so the channel's invoke checkpoint * can enforce per-owner `commands.invoke` denies on the host-mediated * path. Mirrors the honest-identity pattern of storage.open / * messages.observe subscribe: there is no parameter to impersonate * another plugin. The returned disposer unregisters AND lifts the stamp * (idempotent). Duplicates throw the mapped DUPLICATE_CONTRIBUTION_ID * error; a missing commands service fails loud (the descriptor's * Command contract is excluded in that situation anyway). */ registerCommand(pluginCtx: Context, definition: CommandDefinition): () => void; registerCommand(pluginCtx: Context, contributionId: string, definition: CommandDefinition): () => void; /** * Vendored registry + contract-profile self-check (C-020 definition/profile * pins, C-040 ten-point completeness, coordinate/permission parity). Empty = * clean; violations are strings, never thrown. */ selfCheck(): string[]; } /** * Loader-only admission capability. It is intentionally omitted from the * package `plugin-host` export; tests and the in-process loader can obtain it * from this adapter module, while a plugin calling the public service proxy * receives a deterministic denial instead of being able to impersonate a * different manifest identity. */ export interface HostAdmission { admit(pluginCtx: Context, source: string, options?: { source?: string; activationId?: string; }): VerifiedComponentIdentity; } export declare function getHostAdmission(runtime: TuiPluginHost | TuiPluginHostRuntime | undefined): HostAdmission | undefined; export declare const name = "dsh-tui-plugin-host"; export declare function apply(ctx: Context): void; //# sourceMappingURL=plugin-host.d.ts.map