/** * Flow metadata sync — reconciles local flow metadata.yaml with the platform. * * Closes the gap behind GH issue #3 (push wiping flow event subscriptions and * title): before this module existed, push only updated skill scripts. Local * edits to flow title, events, or state_fields silently never reached the * platform; new events created via `newo create-event` had no path to flow * therefore disappeared from local metadata.yaml after a subsequent pull. * * Reconciliation strategy per flow (only runs when metadata.yaml hash changed): * - Compare local FlowMetadata against fresh GET responses from the platform * - Update flow title/description/runner via PATCH /api/v1/designer/flows/{id} * - For each child collection (events, state_fields): * • idn present locally + missing remotely → create * • idn present in both, contents differ → update * • idn missing locally + present remotely → delete * * Hash-gating is critical: if the user never touched metadata.yaml, we never * compute a remote diff, which means a stale or partially-pulled tree cannot * accidentally wipe events that were created out-of-band via the Builder UI. */ import type { AxiosInstance } from 'axios'; import type { FlowMetadata, FlowEvent, FlowState } from '../types.js'; export interface FlowMetadataSyncCounts { flowsUpdated: number; eventsCreated: number; eventsUpdated: number; eventsDeleted: number; statesCreated: number; statesUpdated: number; statesDeleted: number; errors: string[]; } export declare function emptyFlowSyncCounts(): FlowMetadataSyncCounts; /** * True when remote FlowEvent fields differ from what the local metadata says. * We only compare semantic fields the platform stores - `id` is platform-owned. */ export declare function flowEventDiffers(local: FlowEvent, remote: FlowEvent): boolean; export declare function flowStateDiffers(local: FlowState, remote: FlowState): boolean; /** * Reconcile one flow's metadata with the platform. * * @param client authenticated Axios client * @param flowId platform flow ID (UUID) * @param local parsed FlowMetadata from the customer's local YAML * @param remoteFlow flow data fetched from GET /flows/{id} - if null, * flow-level updates are skipped (still syncs children). * Pass null when caller already knows the GET endpoint * will 404 (e.g. legacy data) or wants children-only. * @param verbose when true, emits per-operation log lines * @param counts shared counter mutated in place across multiple flows */ export declare function syncFlowMetadata(client: AxiosInstance, flowId: string, local: FlowMetadata, remoteFlow: { title: string; description: string | null; default_runner_type?: string; } | null, verbose: boolean, counts: FlowMetadataSyncCounts): Promise; /** * Combined count of operations across all categories. */ export declare function totalFlowSyncOps(counts: FlowMetadataSyncCounts): number; /** * Human-readable summary line for the push report. */ export declare function describeFlowSyncCounts(counts: FlowMetadataSyncCounts): string; //# sourceMappingURL=flow-metadata.d.ts.map