/** * Deployment identity for `lobu apply`. * * Each apply run mints an `apply_id`, sends it as `x-lobu-apply-id` on every * mutation (the server stamps its config-audit events with it), and posts a * summary to `POST /api//deployments` at the end — including the * redacted desired-state snapshot (`manifest`) that makes the deployment * self-contained: `lobu rollback ` re-applies it through the same * diff/execute engine, repointing connectors to their retained versions. The * summary still records the config repo's HEAD SHA so git-first rollback * (revert commit → re-apply) stays first-class for config-as-code orgs. */ import type { DesiredState } from "./desired-state.js"; import type { Baseline, DiffPlan, DiffRow, RemoteSnapshot } from "./diff.js"; export declare function mintApplyId(): string; export interface GitInfo { sha: string | null; dirty: boolean | null; } /** HEAD SHA + dirty flag of the config repo; nulls outside a git work tree. */ export declare function collectGitInfo(cwd: string): GitInfo; /** * Structurally redact the fields that hold RESOLVED secret values in process * memory — agent `providerKeys[].value`, org provider `apiKey`, and auth-profile * `credentials` (resolved from `$VAR`/`secret()` at map time) — then deep-redact * by key-name denylist. Shared by the manifest hash and the stored deployment * snapshot: a snapshot NEVER carries a secret value, so `lobu rollback` * structurally cannot re-apply one. */ export declare function redactDesiredState(state: DesiredState): Record; /** * sha256 of the redacted, canonicalized desired state. The hash identifies a * config revision; two applies of the same config (same secrets or not) hash * identically because secret VALUES never participate. */ export declare function computeManifestHash(state: DesiredState): string; export declare const SNAPSHOT_VERSION = 1; export interface DeploymentManifest { version: typeof SNAPSHOT_VERSION; /** * The redacted desired state, minus connector source bytes: connector * definitions are stripped to declaration metadata, and the artifacts they * resolved to ride `connector_versions` below as retained * (org, key, version) pins — a deployment is self-contained without ever * embedding code or secrets. */ state: Record; /** Active connector version per declared key, recorded post-install. */ connector_versions: Record; /** * The attribution baseline for the three-way drift compare: the effective * entity/rel-type and Automation state AFTER this apply (declared config * values + preserved unmanaged facets). When absent, declared definitions * use the ordinary two-way diff while provenance-dependent deletes fail * closed. */ attribution?: { entityTypes: unknown[]; relationshipTypes: unknown[]; automations: unknown[]; }; /** * Kind-qualified definition incarnation identities (`entity-type:12`, * `automation:b7-…`) this config actually applied — the delete-eligible set. */ owned?: string[]; } export interface BaselineRecord { attribution: { entityTypes: unknown[]; relationshipTypes: unknown[]; automations: unknown[]; }; owned: string[]; /** Connector key → version from the deployment's post-apply pins. */ connectorVersions?: Record; } /** * Parse the stored baseline; null when attribution was never recorded. A * partially-shaped attribution (a manifest written before the Automation * cutover carries no `automations` array) is treated the same way: it cannot * prove ownership, so it must fail closed rather than read as "empty". */ export declare function loadBaselineFromManifest(manifest: { attribution?: DeploymentManifest["attribution"]; owned?: DeploymentManifest["owned"]; connector_versions?: Record; } | null): BaselineRecord | null; /** * Preserve whether attribution was absent or recorded as empty. The former * cannot prove ownership and must not enable three-way comparisons. */ export declare function toBaseline(record: BaselineRecord | null): Baseline; /** * The post-apply attribution snapshot + owned identities. Attribution records * the effective entity/rel/Automation state AFTER a successful apply — config's * declared values merged with preserved unmanaged facets (eventKinds / * viewTemplate / schemaExtras the config never declared) from the pre-apply * remote — so `remote == attribution` means "unchanged since last apply". * * Under `prune`, omitted clearable facets are cleared by executePlan, so the * baseline must record the cleared value (not the pre-apply remote). Recording * the pre-apply remote left the next config-expressed delete blocked as * "post-baseline edit" forever. * * `owned` records the incarnation ids of definitions this config applied * (delete-eligible); creates with no known id are conservatively omitted * (they block as drift instead of auto-deleting — fail-closed). */ export declare function buildAttributionAndOwned(state: DesiredState, remote: RemoteSnapshot, orgId?: string, prune?: boolean): BaselineRecord; /** * Build the stored deployment snapshot. `connectorVersions` maps each * config-declared connector key to the version active AFTER this apply * (`install_connector` responses / the refreshed catalog) — the pins * `lobu rollback` repoints to via `rollback_connector_version`. */ export declare function buildDeploymentManifest(state: DesiredState, connectorVersions: Record, baseline?: BaselineRecord): DeploymentManifest; export type CountsByKind = Record; /** Per-resource-kind create/update/delete tallies for the summary payload. */ export declare function buildCountsByKind(rows: DiffRow[]): CountsByKind; export interface DeploymentSummary { apply_id: string; status: "succeeded" | "partial_failure" | "blocked"; counts: DiffPlan["counts"]; counts_by_kind: CountsByKind; manifest_hash: string; git_sha: string | null; git_dirty: boolean | null; cli_version: string | null; error?: string; /** Self-contained snapshot for `lobu rollback` (absent on legacy CLIs). */ manifest?: DeploymentManifest; /** Blocking-drift candidates — present on `blocked` runs. */ candidates?: { items: Array<{ kind: string; slug: string; field?: string; action: "delete" | "revert"; }>; }; /** Set on rollback deployments: the deployment this one restored. */ rollback_of?: string; } //# sourceMappingURL=deployment.d.ts.map