import { type CommandReader, type LivenessProbe, type ProcessRecordState } from "@cotal-ai/workspace"; /** `tls` is the broker's transport decision, propagated to the daemon's argv. It is not optional * information the daemon can do without: it cannot derive the transport itself (see the note at * the argv site), and omitting it leaves a standing-credential daemon connecting * plaintext-capable to a TLS broker while looking entirely healthy. * `wsPort` is the broker's loopback websocket listener (P2 item 6), forwarded to the manager. * `noManager` (#1417) is broker-only mode: ensure the delivery daemon and NOT the manager. The * caller that sets it has already refused it against a live manager (a refresh under the flag * exits non-zero before reaching here), so this side never silently KEEPS or STOPS one either. * `onDeliveryExit` hears the exit of a daemon this process launches; only a caller that outlives * the launch (foreground `up`) can act on it. */ type Opts = { space?: string; server?: string; tls?: boolean; spawn?: string[]; runtime?: string; launch?: string; attachHost?: string; resumeAttempt?: string; resumeCommit?: { path: string; sha256: string; }; wsPort?: number; maxSessions?: number; noManager?: boolean; onDeliveryExit?: (code: number | null, signal: NodeJS.Signals | null) => void; }; /** {@link deliveryRecordState}'s verdict alone, for the callers that only branch on it. */ export declare function deliveryLiveness(probe?: LivenessProbe, space?: string, readCommand?: CommandReader): ProcessRecordState; /** True only if the daemon is PROVABLY running. Callers that ACT on the answer take * {@link deliveryLiveness} instead; this cannot express "cannot tell". */ export declare function deliveryUp(space?: string): boolean; /** Whether `cotal down` is stopping, or has stopped, the space's dead daemon: a live process holds the * `.stopping` reservation `down` takes before its first signal, or the record is gone. A missing record * proves a stop only for a daemon that cannot remove its own (one killed by a signal, or a launch that * never bound), which the caller establishes. The reservation is read first because `down` releases it * only after removing the record, so a stop that completes between the two reads is still seen. */ export declare function deliveryStoppedByDown(space?: string): boolean; /** Cutover preflight — the FIRST action, BEFORE the daemon can bind: stop any old Plane-3-hosting * manager (live `manager.pid` without the delivery-aware marker) so it never double-binds the * daemon's durables. A delivery-aware (this-build) manager is left running. No-op on a fresh install. */ export declare function stopOldHostingManagerIfPresent(probe?: LivenessProbe, space?: string): Promise; /** Start the delivery daemon detached (pid in `.cotal/delivery..pid`, output to * `.cotal/delivery..log`), stopped by `cotal down`. Re-execs this CLI's hidden * `__daemon-deliver`, the `deliver` entry without its deprecation warning; the daemon loads the * pre-minted scoped `delivery.creds` (written by {@link ensureDelivery}) — it never sees the signer. */ export declare function startDeliveryDetached(o?: Opts): number; /** Make the server-side delivery daemon available (auth mode only). FAILS CLOSED: refuses to launch * while an old Plane-3-hosting manager is live (the preflight should have stopped it) so the daemon * never double-binds. Mints a SCOPED `delivery` cred from the local signer ONCE, writes it to * `.cotal/delivery.creds` (0600), and launches the daemon WITHOUT signer access. Best-effort — callers * treat it as non-fatal (a missing daemon degrades durable delivery, never live). * * RETURNS TWO FACTS, NOT ONE (#1576). `running` is about the PROCESS; `responderBound` is about the * `ctl.delivery` responder, which is what spawn, retirement and join actually require. They are not * the same question, and collapsing them into one boolean is how a mesh came to report healthy for * 22 hours while none of those three operations could complete. `responderBound` is false when the * readiness wait elapsed without the lease flipping ready, and absent when no daemon applies. */ export declare function ensureDelivery(o?: Opts, probe?: LivenessProbe): Promise<{ running: boolean; started?: boolean; pid?: number; responderBound?: boolean; }>; export { DELIVERY_PROCESS } from "@cotal-ai/workspace"; /** Remove this space's delivery credentials after its required process stops have succeeded. */ export declare function removeDeliveryCredentials(space: string): Promise; /** Stop the space's delivery daemon, then drop its creds from the store. Whole-stack down defers * credential removal until the broker and every other required component have stopped. */ export declare function stopDelivery(space?: string, options?: { preserveCredentials?: boolean; }): Promise; /** Bring up the control plane in the correct cutover order: OLD-manager preflight → delivery daemon * (auth only, fails closed on a live old manager) → manager (lifecycle, writes the delivery-aware * marker). The manager no longer depends on the daemon (it hosts no Plane-3), so the daemon is started * first only to close the old-manager double-bind window and so freshly-spawned agents find the * `ctl.delivery` responder for their boot self-join (a miss honest-degrades to live-only). * `noManager` (#1417) stops after the daemon: a broker-only host gets delivery (auth mode) and no * manager, so there is no manager pidfile to leave stale and no slot to strand. The preflight still * runs above it — an old Plane-3-hosting manager must not double-bind the daemon's durables even on a * host that wants no manager of its own. */ export declare function ensureControlPlane(o?: Opts): Promise<{ running: boolean; started?: boolean; pid?: number; delivery?: { started: boolean; pid?: number; }; responderBound?: boolean; }>; //# sourceMappingURL=delivery-proc.d.ts.map