/** * Presentation adapter for Harness-owned permission presets. * * Two Harness authorities, joined here for one picker and owned by neither: * * - `permissionPresets.catalog()` — PROCESS-level and live. What may be * selected. Read at the interaction boundary, never retained. * - the `permissions` session projection — SESSION-level and durable. What is * selected. Read from the attached session's snapshot. * * Mutation leaves through Harness's `/permission ` command, never a * service call, so Harness validates every id against the live catalog. That * is why a picker held open across a catalog change needs no staleness * machinery here: it can only ask, and be told no. * * docs/architecture.md carries the full boundary and the reasoning for it. * @module dshline/permission */ import type { Context } from '@deepseek-ai/cordis'; import type { PermissionCatalog, PermissionSelection } from '@deepseek-ai/dsh-permission-presets/types'; import type { SelectChoice } from './select.ts'; /** The terminal-facing permission picker data. */ export interface PermissionPicker { /** Detail identifying the effective selection before a new one is made. */ readonly detail: string; /** The current selection to highlight, when it is one of the live catalog rows. */ readonly currentValue: string | undefined; /** Live catalog rows, in Harness's contribution order. */ readonly choices: readonly SelectChoice[]; } /** * Join Harness's live catalog with the session's current selection. * * Every row comes from the catalog verbatim — opaque id, name, description, * order — and the selection contributes exactly one thing: which row, if any, * is current. A current value no catalog row resolves is reported as-is and * highlights nothing; `custom` is how Harness derives that state, but nothing * here special-cases it, and no row is ever synthesised so the picker can find * its current value. * * Both authorities are required. Missing either one, the caller falls back to * Harness's ordinary command path rather than inferring rows or inventing a * current state. * @param catalog - the live process catalog, from `permissionPresets.catalog()`. * @param selection - the session's `permissions` projection value. * @returns picker data, or undefined when either authority is unavailable. */ export declare function permissionPicker(catalog: PermissionCatalog | undefined, selection: PermissionSelection | undefined): PermissionPicker | undefined; /** * Ask for the acknowledgement a risk-bearing picker choice needs. * * Typed command arguments retain their normal Harness semantics and do not * come through this presentation step. * @param ctx - context owning the shared bounded selector. * @param value - selected opaque catalog option id. * @returns whether this picker-originated selection may dispatch to Harness. */ export declare function confirmPermissionSelection(ctx: Context, value: string): Promise; //# sourceMappingURL=permission.d.ts.map