import { type ChannelConfig, type ChannelDefaults } from "@cotal-ai/core"; import { z } from "zod"; import type { AdditiveAgentReceipt, AdditiveChannelReceipt, AdditiveTeamAttempt, AdditiveTeamReceipt } from "./team-additive-attempt.js"; /** A channel-only receipt, or a mixed team receipt whose original agents are fully retired. */ export type CardReceipt = AdditiveChannelReceipt | (AdditiveAgentReceipt & { kind: "additive-team-receipt"; }); declare const Intent: z.ZodObject<{ kind: z.ZodLiteral<"additive-channel-removal-attempt">; channels: z.ZodArray>; registry: z.ZodOptional>; createdAt: z.ZodISODateTime; schemaVersion: z.ZodLiteral<1>; deploymentId: z.ZodString; root: z.ZodString; space: z.ZodString; server: z.ZodString; authMode: z.ZodEnum<{ open: "open"; auth: "auth"; user: "user"; }>; tlsRequired: z.ZodBoolean; originalReceiptDigest: z.ZodString; }, z.core.$strict>; declare const Step: z.ZodDiscriminatedUnion<[z.ZodObject<{ phase: z.ZodLiteral<"submitted">; schemaVersion: z.ZodLiteral<1>; deploymentId: z.ZodString; ordinal: z.ZodNumber; name: z.ZodString; createdRevision: z.ZodNumber; recordedAt: z.ZodISODateTime; }, z.core.$strict>, z.ZodObject<{ phase: z.ZodLiteral<"deleted">; markerRevision: z.ZodNumber; schemaVersion: z.ZodLiteral<1>; deploymentId: z.ZodString; ordinal: z.ZodNumber; name: z.ZodString; createdRevision: z.ZodNumber; recordedAt: z.ZodISODateTime; }, z.core.$strict>, z.ZodObject<{ phase: z.ZodLiteral<"absent">; markerRevision: z.ZodNullable; schemaVersion: z.ZodLiteral<1>; deploymentId: z.ZodString; ordinal: z.ZodNumber; name: z.ZodString; createdRevision: z.ZodNumber; recordedAt: z.ZodISODateTime; }, z.core.$strict>, z.ZodObject<{ phase: z.ZodLiteral<"conflict">; schemaVersion: z.ZodLiteral<1>; deploymentId: z.ZodString; ordinal: z.ZodNumber; name: z.ZodString; createdRevision: z.ZodNumber; recordedAt: z.ZodISODateTime; }, z.core.$strict>, z.ZodObject<{ phase: z.ZodLiteral<"observed-removed">; markerRevision: z.ZodNullable; markerOperation: z.ZodNullable>; registryCreated: z.ZodString; schemaVersion: z.ZodLiteral<1>; deploymentId: z.ZodString; ordinal: z.ZodNumber; name: z.ZodString; createdRevision: z.ZodNumber; recordedAt: z.ZodISODateTime; }, z.core.$strict>, z.ZodObject<{ phase: z.ZodLiteral<"observed-superseded">; currentRevision: z.ZodNumber; registryCreated: z.ZodString; schemaVersion: z.ZodLiteral<1>; deploymentId: z.ZodString; ordinal: z.ZodNumber; name: z.ZodString; createdRevision: z.ZodNumber; recordedAt: z.ZodISODateTime; }, z.core.$strict>], "phase">; declare const Removed: z.ZodObject<{ name: z.ZodString; createdRevision: z.ZodNumber; outcome: z.ZodEnum<{ absent: "absent"; deleted: "deleted"; "observed-removed": "observed-removed"; }>; markerRevision: z.ZodNullable; }, z.core.$strict>; declare const Receipt: z.ZodObject<{ kind: z.ZodLiteral<"additive-channel-removal-receipt">; removedChannels: z.ZodArray; markerRevision: z.ZodNullable; }, z.core.$strict>>; recordedAt: z.ZodISODateTime; schemaVersion: z.ZodLiteral<1>; deploymentId: z.ZodString; root: z.ZodString; space: z.ZodString; server: z.ZodString; authMode: z.ZodEnum<{ open: "open"; auth: "auth"; user: "user"; }>; tlsRequired: z.ZodBoolean; originalReceiptDigest: z.ZodString; }, z.core.$strict>; export type ChannelRemovalAttempt = z.infer; export type ChannelRemovalStep = z.infer; export type ChannelRemovalReceipt = z.infer; export type RemovedChannel = z.infer; export interface ChannelRemovalInventory { attempts: ChannelRemovalAttempt[]; steps: ChannelRemovalStep[]; returned: ChannelRemovalReceipt[]; refused: { path: string; why: string; }[]; } /** Every phase that ends one card's removal. At most one may exist per card. */ export declare const CARD_TERMINAL_PHASES: readonly ["deleted", "absent", "conflict", "observed-removed", "observed-superseded"]; /** A removal record is history, never authority to delete a name. Only a complete sequence bound to * the original channel receipt releases the root's known additive blocker; anything else blocks. */ export declare function readChannelTeamRemovals(root: string, attempts: readonly AdditiveTeamAttempt[], receipts: readonly AdditiveTeamReceipt[], retired?: ReadonlySet): ChannelRemovalInventory; export declare function writeChannelRemovalAttempt(root: string, attempt: AdditiveTeamAttempt, receipt: CardReceipt, retired: ReadonlySet, registry: RegistryIdentity): ChannelRemovalAttempt; export type ObservedCardStep = { phase: "observed-removed"; markerRevision: number | null; markerOperation: "DEL" | "PURGE" | null; } | { phase: "observed-superseded"; currentRevision: number; }; export declare function writeChannelRemovalStep(root: string, intent: ChannelRemovalAttempt, ordinal: number, value: { phase: "submitted" | "conflict"; } | { phase: "deleted"; markerRevision: number; } | { phase: "absent"; markerRevision: number | null; } | ObservedCardStep): void; export declare function writeChannelRemovalReceipt(root: string, intent: ChannelRemovalAttempt, removedChannels: readonly RemovedChannel[]): void; type Auth = { creds?: string; bearer?: string; sentinelCreds?: string; }; export type CardObservation = { name: string; state: "same-revision" | "changed" | "absent"; revision: number | null; config: ChannelConfig | null; }; /** One registry stream incarnation, read from the broker's stream info. */ export interface RegistryIdentity { stream: string; created: string; lastSeq: number; } /** The last message on one card key. `none` is only the broker's explicit "message not found". */ export type CardMessage = { kind: "put"; revision: number; } | { kind: "marker"; operation: "DEL" | "PURGE"; revision: number; } | { kind: "none"; }; /** One non-reconnecting registry connection. `deleteAt` is the native revision-conditioned delete * (`Nats-Expected-Last-Subject-Sequence`): it removes only the card still at the created revision. */ export declare function openChannelCardRegistry(input: { server: string; space: string; tls: boolean; auth: Auth; }): Promise<{ observe(name: string, createdRevision: number): Promise; /** The registry stream's name, creation time and last sequence. A failed read throws. */ identity(): Promise; /** The card key's last message. The client returns null only for the broker's "message not * found" answer; permission, stream and transport failures reject and are never absence. */ lastMessage(name: string): Promise; defaults(): Promise; /** `not-executed` only for the broker's wrong-last-sequence refusal; every other failure throws. */ deleteAt(name: string, createdRevision: number): Promise<"acknowledged" | "not-executed">; close: () => Promise; }>; /** Display-only impact: the derived membership feed is never an authorization input. */ export declare function readChannelMemberImpact(server: string, space: string, tls: boolean, auth: Auth, names: readonly string[]): Promise<{ asOf: number | null; channels: Array<{ name: string; observedMembers: string[]; }>; } | null>; export {}; //# sourceMappingURL=team-channel-removal.d.ts.map