/** * Saved Workflow compiler + run materializer. * * Save is intentionally exact by default: it freezes the approved DAG/spec * and canonical bot identities, but does not guess which literals should turn * into parameters. A future distiller may submit an explicit parameterized * draft through the same schema/host validation seam. */ import type { BotConfig } from '../../bot-registry.js'; import { type RawParamInput } from '../shared/params.js'; import { type V3Dag } from './dag.js'; import { type RunChatBinding } from './grill-state.js'; import { type LoadedSavedWorkflowRevision, type SavedWorkflowBuiltinContextRef, type SavedWorkflowMetadata, type SavedWorkflowParamDef, type SavedWorkflowRevisionDraft } from './library-schema.js'; import { type LoadedAuthorizedV3Run, type V3SavedDefinitionRunEnvelope } from './run-envelope.js'; import type { BotSnapshot, Spec } from './contract.js'; export interface CompiledSavedWorkflowFromRun { displayName: string; revision: SavedWorkflowRevisionDraft; sourceStatus: 'succeeded' | 'failed' | 'blocked'; publish: boolean; lintWarnings: string[]; } /** * Exact-save found literals that are risky to freeze into a reusable * definition. Warning strings contain only a field path and a risk class (not * the matched value), so an IM adapter may safely render them for confirmation. */ export declare class SavedWorkflowUnsafeLiteralError extends Error { readonly warnings: readonly string[]; readonly warningDigest: string; constructor(warnings: readonly string[]); } export interface CompileSavedWorkflowFromRunOptions { /** Non-successful runs can only become a draft and require explicit opt-in. */ allowDraft?: boolean; /** Explicit distiller/editor output. Default exact save has no params. */ inputs?: Record; contextRefs?: SavedWorkflowBuiltinContextRef[]; specStatus?: 'current' | 'stale'; /** Explicit user confirmation after reviewing free-text secret/path lint. */ acknowledgeUnsafeLiterals?: boolean; } export type BuildSavedWorkflowRevisionBaselineOptions = Pick; export interface BuiltSavedWorkflowRevisionBaseline { displayName: string; revision: SavedWorkflowRevisionDraft; lintWarnings: string[]; } export declare function collectSavedWorkflowReusableTextWarnings(value: unknown, path: string, warnings: string[]): void; /** * Pure exact-revision compiler over one already authenticated/digest-checked * run read. It performs no path or journal IO, so callers cannot accidentally * rebuild a baseline from a different set of source bytes. */ export declare function buildSavedWorkflowRevisionBaseline(loaded: LoadedAuthorizedV3Run, opts?: BuildSavedWorkflowRevisionBaselineOptions): BuiltSavedWorkflowRevisionBaseline; /** Exact run → revision draft. No heuristic literal replacement. */ export declare function compileSavedWorkflowFromRun(runDir: string, opts?: CompileSavedWorkflowFromRunOptions): CompiledSavedWorkflowFromRun; export interface SavedWorkflowMaterializeContext { chatBinding?: RunChatBinding; initiatorOpenId?: string; } export interface MaterializeSavedWorkflowRunInput { metadata: SavedWorkflowMetadata; revision: LoadedSavedWorkflowRevision; rawParams?: Record; context?: SavedWorkflowMaterializeContext; bots: BotConfig[]; baseDir: string; runId?: string; now?: Date; } export interface MaterializedSavedWorkflowRun { runId: string; runDir: string; dag: V3Dag; spec: Spec; resolvedParams: Record; resolvedContext: Partial>; botSnapshots: Map; envelope: V3SavedDefinitionRunEnvelope; } /** Published revision → fresh immutable v3 run directory. */ export declare function materializeSavedWorkflowRun(input: MaterializeSavedWorkflowRunInput): MaterializedSavedWorkflowRun; /** Convenience for tests/command responses. */ export declare function savedWorkflowRunIdFromDir(runDir: string): string; /** Convenience for callers that need to derive the runs root from a runDir. */ export declare function savedWorkflowRunsRoot(runDir: string): string; //# sourceMappingURL=library-materialize.d.ts.map