import type { OrgDaemon } from '../orgrt/daemon.js'; import type { CommandResult } from '../types.js'; /** The foreground `org run` wait loop. Every `intervalMs` it ends the wait * when `org stop` wrote the stopfile (stoppedManually) or the daemon no * longer hosts the org (org_complete, idle watchdog, crash), and otherwise * applies a pending `org reload`. Before the reload poll was added here only * `org serve` read the reload file, so `org reload` against an `org run` * process printed "picks it up within ~2s", exited 0, and changed nothing — * a rotated endpoint URL kept receiving deliveries until it went dead. * SIGINT/SIGTERM also end the wait (reported as `signal: true`). */ export declare function waitForRunEnd(cwd: string, name: string, daemon: Pick, intervalMs?: number): Promise<{ stoppedManually: boolean; signal?: true; }>; /** Just the fields determineRunOutcome needs from runtime.json. */ export type RunTerminalState = { status?: string; closedBy?: string; error?: string; }; /** runtime.json's final record; {} when unreadable (the non-clean-stop case). */ export declare const runtimeState: (cwd: string, name: string) => RunTerminalState; /** Decides `org run`'s exit-code-bearing CommandResult from the run's final * recorded state. Extracted (matching resolvedIdleNudgeCount's precedent for * the idle watchdog) so this decision is unit-testable without spinning up a * real daemon/org. Exit 0 ONLY for a clean, goal-driven end (closedBy: * 'org-complete', set by daemon.ts's org-complete auto-stop path) — every * other outcome (idle-watchdog stop, boss-restart-exhausted, a process-level * crash) exits 1 so scripts/supervisors can tell success from failure. */ export declare function runOutcomeResult(name: string, final: RunTerminalState): CommandResult; /** One pass of the `org serve` stopfile poll. * * `monomind org stop ` writes `.monomind/orgs//stop`. `org run` has always * polled that file; `org serve` did not — so against a serve daemon `org stop` was a * silent no-op that still printed "daemon exits within 2s" and exited 0 while the org * kept running. Stops every running org whose stopfile is present, then clears the * stopfile so the next scheduled iteration isn't killed on sight. * * Returns the names it stopped (awaited), so callers/tests don't have to guess. */ export declare const pollStopfiles: (cwd: string, daemon: OrgDaemon) => Promise; export declare const pollReloadfiles: (cwd: string, daemon: OrgDaemon) => Promise; export declare const pollRunfiles: (cwd: string, daemon: OrgDaemon) => Promise; //# sourceMappingURL=org-poll.d.ts.map