import { z } from "zod"; /** * Playbook types + zod schemas. * * A playbook chains N ordered seed steps into one run. File layout at * `~/.sandbox-seed/playbooks/.yml` (user-scope only — see * `feedback_playbooks_user_scope_only.md`). * * Each step's body mirrors the existing `seed` tool's `action: "start"` * args (minus `action`/`sessionId`). The runner composes the existing * `seed()` function in a loop; it does NOT re-implement seeding. */ /** Per-step body — same fields the `seed` tool accepts at `start`. */ export declare const PlaybookStepSchema: z.ZodObject<{ name: z.ZodString; object: z.ZodString; whereClause: z.ZodString; sourceOrg: z.ZodOptional; targetOrg: z.ZodOptional; limit: z.ZodOptional; sampleSize: z.ZodOptional; includeOptionalParents: z.ZodOptional>; includeOptionalChildren: z.ZodOptional>; includeManagedPackages: z.ZodOptional; includeSystemChildren: z.ZodOptional; disableValidationRulesOnRun: z.ZodOptional; childLookups: z.ZodOptional>>; isolateIdMap: z.ZodOptional; /** * If true, a step failure is logged and the playbook continues with the * next step instead of aborting. Defaults to false — abort on first * error so the user can fix and re-run from a known state. */ continueOnError: z.ZodOptional; }, "strip", z.ZodTypeAny, { object: string; name: string; whereClause: string; sourceOrg?: string | undefined; targetOrg?: string | undefined; limit?: number | undefined; disableValidationRulesOnRun?: boolean | undefined; childLookups?: Record | undefined; isolateIdMap?: boolean | undefined; sampleSize?: number | undefined; includeOptionalParents?: string[] | undefined; includeOptionalChildren?: string[] | undefined; includeManagedPackages?: boolean | undefined; includeSystemChildren?: boolean | undefined; continueOnError?: boolean | undefined; }, { object: string; name: string; whereClause: string; sourceOrg?: string | undefined; targetOrg?: string | undefined; limit?: number | undefined; disableValidationRulesOnRun?: boolean | undefined; childLookups?: Record | undefined; isolateIdMap?: boolean | undefined; sampleSize?: number | undefined; includeOptionalParents?: string[] | undefined; includeOptionalChildren?: string[] | undefined; includeManagedPackages?: boolean | undefined; includeSystemChildren?: boolean | undefined; continueOnError?: boolean | undefined; }>; export declare const PlaybookDefaultsSchema: z.ZodObject<{ sourceOrg: z.ZodOptional; targetOrg: z.ZodOptional; disableValidationRulesOnRun: z.ZodOptional; isolateIdMap: z.ZodOptional; }, "strip", z.ZodTypeAny, { sourceOrg?: string | undefined; targetOrg?: string | undefined; disableValidationRulesOnRun?: boolean | undefined; isolateIdMap?: boolean | undefined; }, { sourceOrg?: string | undefined; targetOrg?: string | undefined; disableValidationRulesOnRun?: boolean | undefined; isolateIdMap?: boolean | undefined; }>; export declare const PlaybookSchema: z.ZodObject<{ apiVersion: z.ZodLiteral<"sandbox-seed/v1">; kind: z.ZodLiteral<"Playbook">; name: z.ZodString; description: z.ZodOptional; defaults: z.ZodOptional; targetOrg: z.ZodOptional; disableValidationRulesOnRun: z.ZodOptional; isolateIdMap: z.ZodOptional; }, "strip", z.ZodTypeAny, { sourceOrg?: string | undefined; targetOrg?: string | undefined; disableValidationRulesOnRun?: boolean | undefined; isolateIdMap?: boolean | undefined; }, { sourceOrg?: string | undefined; targetOrg?: string | undefined; disableValidationRulesOnRun?: boolean | undefined; isolateIdMap?: boolean | undefined; }>>; steps: z.ZodArray; targetOrg: z.ZodOptional; limit: z.ZodOptional; sampleSize: z.ZodOptional; includeOptionalParents: z.ZodOptional>; includeOptionalChildren: z.ZodOptional>; includeManagedPackages: z.ZodOptional; includeSystemChildren: z.ZodOptional; disableValidationRulesOnRun: z.ZodOptional; childLookups: z.ZodOptional>>; isolateIdMap: z.ZodOptional; /** * If true, a step failure is logged and the playbook continues with the * next step instead of aborting. Defaults to false — abort on first * error so the user can fix and re-run from a known state. */ continueOnError: z.ZodOptional; }, "strip", z.ZodTypeAny, { object: string; name: string; whereClause: string; sourceOrg?: string | undefined; targetOrg?: string | undefined; limit?: number | undefined; disableValidationRulesOnRun?: boolean | undefined; childLookups?: Record | undefined; isolateIdMap?: boolean | undefined; sampleSize?: number | undefined; includeOptionalParents?: string[] | undefined; includeOptionalChildren?: string[] | undefined; includeManagedPackages?: boolean | undefined; includeSystemChildren?: boolean | undefined; continueOnError?: boolean | undefined; }, { object: string; name: string; whereClause: string; sourceOrg?: string | undefined; targetOrg?: string | undefined; limit?: number | undefined; disableValidationRulesOnRun?: boolean | undefined; childLookups?: Record | undefined; isolateIdMap?: boolean | undefined; sampleSize?: number | undefined; includeOptionalParents?: string[] | undefined; includeOptionalChildren?: string[] | undefined; includeManagedPackages?: boolean | undefined; includeSystemChildren?: boolean | undefined; continueOnError?: boolean | undefined; }>, "many">; }, "strip", z.ZodTypeAny, { apiVersion: "sandbox-seed/v1"; name: string; kind: "Playbook"; steps: { object: string; name: string; whereClause: string; sourceOrg?: string | undefined; targetOrg?: string | undefined; limit?: number | undefined; disableValidationRulesOnRun?: boolean | undefined; childLookups?: Record | undefined; isolateIdMap?: boolean | undefined; sampleSize?: number | undefined; includeOptionalParents?: string[] | undefined; includeOptionalChildren?: string[] | undefined; includeManagedPackages?: boolean | undefined; includeSystemChildren?: boolean | undefined; continueOnError?: boolean | undefined; }[]; description?: string | undefined; defaults?: { sourceOrg?: string | undefined; targetOrg?: string | undefined; disableValidationRulesOnRun?: boolean | undefined; isolateIdMap?: boolean | undefined; } | undefined; }, { apiVersion: "sandbox-seed/v1"; name: string; kind: "Playbook"; steps: { object: string; name: string; whereClause: string; sourceOrg?: string | undefined; targetOrg?: string | undefined; limit?: number | undefined; disableValidationRulesOnRun?: boolean | undefined; childLookups?: Record | undefined; isolateIdMap?: boolean | undefined; sampleSize?: number | undefined; includeOptionalParents?: string[] | undefined; includeOptionalChildren?: string[] | undefined; includeManagedPackages?: boolean | undefined; includeSystemChildren?: boolean | undefined; continueOnError?: boolean | undefined; }[]; description?: string | undefined; defaults?: { sourceOrg?: string | undefined; targetOrg?: string | undefined; disableValidationRulesOnRun?: boolean | undefined; isolateIdMap?: boolean | undefined; } | undefined; }>; export type PlaybookStep = z.infer; export type PlaybookDefaults = z.infer; export type Playbook = z.infer; /** Status of a single step inside a playbook run. */ export type PlaybookStepStatus = "pending" | "dry_run_complete" | "executed" | "errored" | "skipped"; /** Per-step entry in the run manifest. */ export type PlaybookRunStep = { name: string; sessionId: string; status: PlaybookStepStatus; /** Populated after dry_run — the returned report path. */ dryRunReportPath?: string; /** Populated after dry_run — totalRecords for this step. */ dryRunTotalRecords?: number; /** Populated after run — {object: count} and log path. */ insertedCounts?: Record; alreadySeededCounts?: Record; executeLogPath?: string; errorMessage?: string; }; /** * The manifest written to * `~/.sandbox-seed/playbook-runs//manifest.json`. * Persistent across the dry_run → run gap (up to DRY_RUN_FRESHNESS_MS). */ export type PlaybookRunManifest = { playbookRunId: string; playbookName: string; playbookPath: string; createdAt: string; /** ISO timestamp of the playbook-level dry_run aggregate completion. */ dryRunAggregatedAt?: string; /** ISO timestamp of the run-all completion. */ runCompletedAt?: string; /** Per-step state. Index matches the playbook's `steps` array. */ steps: PlaybookRunStep[]; };