/** * The writes `/plugins` performs, each through the seam that owns it. * * Three operations, each mapping onto exactly one Harness authority: * * ``` * toggleRow ctx.configEditor.edit() — the profile configuration * editor, which is the only owner a preset declaration has * in the adopted generation * switchPreset ctx.agentPresets.select() — Harness's own whole operation: * serialize per session, re-check `turnBoundary`, refuse a * started session, recompose, then record the switch. * dshline neither checks nor appends anything of its own * setDefaultPreset ctx.settings.update('agent-preset-registry', …) — the * `selectedDefault` volatile field new sessions resolve * over the deployment default, written through the same * ns/patch contract every namespace uses * ``` * * What this module no longer offers is as much a part of the contract as what * it does. The previous generation's roster was a live directory of files, so * `/plugins` had exactly two authoring paths into it: `agentPresets.copy()` to * fork a shipped preset, and a narrow lock-coordinated edit of the copy's * `agent.cordis.yml`. The second survives, re-owned; the first is gone * upstream. A preset is now an ordinary `@deepseek-ai/dsh-agent-preset` row in * a Cordis composition, the registry "writes no declarations" and "accepts no * preset paths", and its own preset tree overrides `write()` to a no-op * because "only the profile configuration editor persists definitions". So a * new declaration is a bundle patch installed through `plugin_manager` — * Harness's operation, and authoring one is a plugin-management concern rather * than a terminal one. What is left for a terminal is EDITING a declaration * that already exists, and that is {@link toggleRow}, routed through * `ctx.configEditor` rather than through a second YAML writer and a second * file lock of dshline's own. * * Nothing here decides whether an action should be OFFERED; `model.ts`'s * `presetSwitchEligibility` does, from the same facts. These functions assume * the offer was made and report what Harness answered. * @module dshline/plugins/actions */ import type { AgentPresetsSeam, ConfigEditorSeam, PluginsAgent, PluginsSettings } from './harness.ts'; import type { RowLocator } from './composition.ts'; /** How one write ended, in words the transcript can carry. */ export interface PluginsActionOutcome { /** Whether the write went through. */ readonly kind: 'done' | 'failed'; /** What happened, already worded for a reader. */ readonly message: string; } /** * Enable or disable one row of a preset declaration, as a profile override. * * The declaration is located through the configuration editor's own entry list * rather than by a path: the registry publishes no `path`, and the editor's * `entries()` is what Harness itself addresses configuration by. Exactly one * `@deepseek-ai/dsh-agent-preset` row may declare that preset id, and anything * else — none, or more than one — is refused rather than guessed at, because * editing the wrong declaration is worse than editing nothing. * * The write goes through `edit()`, which takes the row's whole next `config`, * validates it through that row's own `Config`, persists a profile-layer * override under Harness's file lock, and reconciles the Loader. So a shipped * declaration is never modified in its package: the profile carries the * override, which is exactly what a bundle patch would do by hand, and the * declaration keeps working unchanged for any profile that does not override * it. Nothing here writes YAML, takes a lock, or reconciles anything itself. * @param configEditor - the profile configuration editor. * @param presetId - the declaration whose row is being toggled. * @param locator - the row's locator, as `CompositionRow.locator` reports it. * @param enable - `true` to enable the row, `false` to disable it. * @returns what happened. */ export declare function toggleRow(configEditor: ConfigEditorSeam, presetId: string, locator: RowLocator, enable: boolean): Promise; /** * Switch the active session's agent to a different preset. * * One call, because one authority owns the whole operation. Harness's * `AgentPresetRegistry.select` serializes concurrent selections per session, * re-reads the `turnBoundary` projection inside that queue, refuses a session * that has already started, recomposes the agent, and appends * `agent-preset/selected` only after the recomposition committed — then * returns the id it recorded. * * dshline previously did the middle three steps itself: check blank, * `recompose`, append. Every one of them was a second implementation of a rule * Harness also enforced, and the blank check in particular was a check made * OUTSIDE the switch it protected, so two selections racing through it could * both pass. That orchestration is deleted rather than translated; what is * left here is turning Harness's answer into a sentence. * @param agentPresets - the preset seam. * @param agent - the live agent whose session is switching. * @param id - the preset to switch to. * @returns what happened. */ export declare function switchPreset(agentPresets: AgentPresetsSeam, agent: PluginsAgent, id: string): Promise; /** * Set the preset a new session gets when none is named explicitly. * * Written as the volatile `selectedDefault` field rather than by overwriting * the deployment's `default`, because that is the field upstream reserves for * exactly this: a deployment's `default` is its composition, while the user's * choice is a separate preference that resolves over it and is cleared back to * it by an unset. * @param settings - the settings seam. * @param id - the preset id to make the default. * @returns what happened. */ export declare function setDefaultPreset(settings: PluginsSettings, id: string): Promise; //# sourceMappingURL=actions.d.ts.map