/** * Zero-config seed declaration for the OPTIONAL `dsh-llm-fallbacks` plugin * : when the `llm-fallbacks` service is * applied, this module declares the 13 `mode: subagent` mstar roles into the * fallbacks seed registry — persona = mirror `description` (verbatim, the * SSOT stays `mstar-roles`) + one mandatory-load guide line. * * Batch assembly (per-apply, re-runnable): * * 1. `getEffectiveRoles()` readback → the currently-seeded NON-mstar ids are * merge-preserved (`{ id: row.id.trim(), persona: row.seedPersona }` — * seedPersona, NOT the row persona, so an operator override stays flagged * `personaOverridden` upstream). Upstream `declare` REPLACES the whole * registry, so without preservation a mstar-only batch would strip * preset/companion ids of their seeded annotations (rows remain — R2). * 2. `subagentRoleIds()` × `personaFor()` resolve the mstar personas from * the `harness-agents/` mirror (the persona channel's existing lookup surface; * `mode: primary` shells like `project-manager` are excluded). * 3. Interpolation gate (HARD): any persona carrying the dsh system-prompt * STRICT `{{...}}` hazard is skipped + warned BEFORE `declareSeeds` — * never declared, never throws (aligned with `agent-personas.ts` * extraction semantics; a mirror default is already rejected at * extraction, so the gate's live path is the UNFILTERED readback data * of a preserved row). * * The upstream `SeedDeclareOutcome` is passed through verbatim; the * structured `SeedOutcomeView` is this module's own view (the service is a * structural parameter — fake-testable, no runtime value import). The * upstream shapes are the local structural mirrors from * `fallbacks-structural.ts` (mirroring `fallbacks-probe.ts`) — this module * carries ZERO imports of `dsh-llm-fallbacks`, runtime or type. * * Failure semantics: a throwing readback is contained (skip + one warn — * probe semantics); a rejecting `declareSeeds` PROPAGATES to the caller — * the entry wiring attaches a terminal `.catch` (the upstream preset * self-declare pattern), so declare never throws out of `apply`. * * Module boundary: no barrel — the entry imports this module by explicit * relative path; the entry does not re-export it. */ import type { EffectiveRolesReadbackView, SeedDeclarationView, SeedDeclareOutcomeView } from './fallbacks-structural.ts'; /** Logger label for the mstar seeds declaration (dsh logger naming: `/`). */ export declare const SEEDS_LOGGER = "mstar/fallbacks-seeds"; /** Seed-declaration log levels the module sink understands. */ export type SeedsLogLevel = 'debug' | 'warn' | 'error'; /** Per-call log sink — the entry binds it to `ctx.logger(SEEDS_LOGGER)`; tests pass a capture sink. */ export type SeedsLogSink = (level: SeedsLogLevel, message: string) => void; /** * The consumed service surface — a structural subset of the upstream * `FallbacksService` (the two seed methods the declaration flow uses), * typed over the local mirrors in `fallbacks-structural.ts`. * Fake-testable: tests pass a spy object; the real service is assignable * (structural typing anchors the contract against the installed `.d.ts`). */ export interface SeedsServiceView { /** (a) Declare the companion's FULL current seed set (replacement semantics). */ declareSeeds(seeds: readonly SeedDeclarationView[]): Promise; /** (b) Sync readback — effective taxonomy with seed annotations. */ getEffectiveRoles(): EffectiveRolesReadbackView; } /** Options for {@link declareMstarSeeds}. */ export interface DeclareMstarSeedsOptions { /** The `harness-agents/` mirror root; absent → no mstar personas (preserved-only batch). */ agentsDir: string | undefined; /** The module log sink (entry binds `ctx.logger(SEEDS_LOGGER)`). */ log: SeedsLogSink; } /** One locally-skipped id with its gate reason (never reached `declareSeeds`). */ export interface SeedSkipView { id: string; reason: 'interpolation' | 'no-persona'; } /** One merge-preserved seeded non-mstar id (batch persona = upstream `seedPersona`). */ export interface PreservedSeedView { id: string; persona: string; } /** Structured result of one {@link declareMstarSeeds} call — this module's own view. */ export interface SeedOutcomeView { /** The full declaration batch handed to `declareSeeds` (mstar personas + preserved ids). */ declared: SeedDeclarationView[]; /** Locally skipped ids (interpolation gate / no usable default) — never declared. */ skipped: SeedSkipView[]; /** The seeded non-mstar ids preserved from the readback into the batch. */ preserved: PreservedSeedView[]; /** The upstream `SeedDeclareOutcome` — passed through verbatim. */ outcome: SeedDeclareOutcomeView; } /** * Declare the mstar subagent seeds: readback → merge-preserve seeded * non-mstar ids → resolve mirror personas → interpolation gate → declare. * Idempotent by construction (the same inputs produce the same batch; the * upstream manager's no-delta check skips the settings write). * * @param service - the structural seed surface (real service or test fake). * @param options - mirror root + log sink. * @returns the structured outcome view; rejects only when `declareSeeds` * itself rejects (the wiring attaches the terminal catch). */ export declare function declareMstarSeeds(service: SeedsServiceView, options: DeclareMstarSeedsOptions): Promise;