/**
 * PARITY-SPOT-WORKFLOW B5/F2 (CC pretty.js:449105-449141 + `Pqi` :149631) — the script-persistence seam behind
 * the Workflow tool's `scriptPath` calling surface. CC persists EVERY invocation's script under the session
 * directory and returns the path in the tool result, so the model iterates by EDITING THE FILE and re-invoking
 * with `{scriptPath}` instead of resending the whole script.
 *
 * This store holds per-run scripts ONLY. Saved workflows — what `{name}` runs — are the workflow catalog's
 * ({@link import("./workflow-catalog.js").WorkflowCatalog}), a separate seat with its own layers: a run's script
 * is never a saved name and a saved name is never a run's.
 *
 * Core is deployment-neutral: the tool takes this seam via `RunWorkflowToolDeps.scriptStore` (optional — when
 * absent, `scriptPath` calls get an honest structured error and inline `script` works as before). The
 * file-backed implementation below is the TOC default (mirrors CC's session-dir posture: dir 0o700 / file
 * 0o600, best-effort persist that never blocks a launch).
 */
export interface WorkflowScriptStore {
    /** B-4 — the CONFORMANCE MARKER for the scope-partitioned contract. Structural
     *  typing would otherwise let a pre-partition adapter (`load(path)`, `persist(runId, script)`)
     *  remain assignable — fewer-parameter functions are compatible in TypeScript — and silently
     *  ignore the scope argument, serving cross-tenant reads while the tool presents the operation as
     *  scope-bounded. A REQUIRED literal field breaks that assignability at compile time; the
     *  run-workflow tool also refuses at runtime when it is absent (plain-JS adapters). */
    readonly scopePartitioned: true;
    /** Persist THIS invocation's resolved script, keyed by its runId. Returns the persisted path (what the tool
     *  reports back to the model). Failures should throw — the tool treats persistence as best-effort.
     *  B-4 (BREAKING): `scope` PARTITIONS per-run scripts — the CC anchor is a per-session directory,
     *  and the port had dropped the axis (one flat directory let a model-supplied scriptPath read another
     *  scope's script). Implementations key storage by scope (the file store uses per-scope subdirs). */
    persist(runId: string, script: string, scope: string): Promise<string> | string;
    /** Read a previously persisted script back. MUST refuse paths outside the store (the argument is
     *  model-supplied — containment is the store's contract, not the tool's).
     *  B-4 (BREAKING): `scope` bounds the read to the CALLER's partition — a path pointing into
     *  another scope's partition must be refused exactly like a path outside the store. */
    load(scriptPath: string, scope: string): Promise<string> | string;
    /**
     * Erase the script {@link persist} stored for `runId` in `scope`'s partition — the session-tree cascade's leg for a terminal run its
     * session started ({@link import("../core/retention.js").RETENTION_CASCADE}), found through the run store's rows while they exist.
     * `true` = this call removed it; `false` = there was none under that scope (another scope's script is not this call's, and an id
     * {@link persist} would refuse names none). Idempotent; a store fault throws (a deletion face that cannot delete is loud). A later
     * {@link load} of the path it answered fails as a missing file. Saved workflows are the catalog's and are never touched. OPTIONAL:
     * absent ⇒ this store's per-run scripts outlive their runs, and the deployment owns that gap.
     */
    deleteRun?(runId: string, scope: string): Promise<boolean> | boolean;
    /** RETIRED: saved names are the workflow catalog's (`RunnerDeps.workflowCatalog`, {@link import("./workflow-catalog.js").createWorkflowCatalog}).
     *  Typed `never` so a store still carrying the member does not compile; at run time the mount refuses it by name. */
    resolveName?: never;
    /** RETIRED with {@link resolveName}: the catalog's `list()` is the one listing. */
    list?: never;
}
/**
 * design/140 §6 1a — the default-args merge: **call-time args > a preset's args** (the script's own
 * internal fallbacks remain the third tier, applied by the script itself). Semantics (locked by test):
 * - both sides plain objects → SHALLOW top-level merge (`{...defaults, ...call}`): a top-level key present in
 *   the call args wins WHOLESALE — nested objects/arrays/scalars are replaced, never deep-merged;
 * - call args absent (`undefined`) → the registered defaults verbatim;
 * - call args a non-object (array / scalar / null) → the call args win wholesale (no structural mixing).
 * Pure value-in/value-out: the caller snapshots the RESULT into the run (parse-time discipline, design/140 §2 —
 * a resume replay never re-queries the registry; a post-launch registry change cannot reach an in-flight run).
 */
export declare function mergeWorkflowArgs(callArgs: unknown, defaultArgs: unknown): unknown;
/**
 * CORE-1 — NORMALIZE a bare-string call-time arg into `{ [key]: <string> }` so the published
 * "裸 string = <key>" ergonomic entry (built-in `discussion`: bare string args IS the topic) COMPOSES
 * with a registered object `defaultArgs` instead of colliding with it.
 *
 * The bug it fixes: {@link mergeWorkflowArgs}'s non-object branch lets a bare string win WHOLESALE — so a
 * named workflow whose registration carries object `defaultArgs` (center 配的 members/rounds/finalizer) had
 * its whole defaults block silently wiped the moment a caller used the ergonomic `{name, args: "<topic>"}`
 * form, and the collab template quietly ran as a generic advocate/skeptic. Wrapping the string here lets the
 * subsequent object merge preserve the defaults AND honor the topic.
 *
 * Applied ONLY when BOTH hold (otherwise return `callArgs` untouched — pre- behavior byte-preserved):
 *  - `callArgs` is a string (the ergonomic form), AND
 *  - `defaultArgs` is a PLAIN OBJECT (there ARE object defaults to merge under; with no/scalar defaults a bare
 *    string must still reach the script verbatim — the built-in's own `raw === "string"` fallback handles it).
 * `key` is the resolution's `stringArgKey` (a registry may declare which key its bare string maps to); the
 * caller passes the built-in default `"topic"` when the resolution omits it.
 */
export declare function normalizeStringArg(callArgs: unknown, defaultArgs: unknown, key?: string): unknown;
/**
 * File-backed {@link WorkflowScriptStore}: per-run scripts land as `<dir>/<scopeDir>/<runId>.js`
 * (B-4: per-scope partition — the CC per-session-dir posture restored on the tenant axis). It never reads the
 * files directly under `<dir>`: a deployment that keeps its saved workflows there mounts that same directory as
 * the catalog's deployment layer ({@link import("./workflow-catalog.js").createDirectoryWorkflowLayer}), which reads
 * only that level — the two never meet, by depth.
 */
export declare function createFileWorkflowScriptStore(dir: string): WorkflowScriptStore;
