import { OrgDaemon } from '../orgrt/daemon.js'; import type { Command, CommandResult } from '../types.js'; export declare function validateOrgName(name: string | undefined): { ok: true; name: string; } | { ok: false; result: CommandResult; }; export declare function listOrgConfigFiles(orgsDir: string): string[]; /** Remove a lingering stopfile so a fresh `org run` doesn't self-terminate. */ export declare const clearStopfile: (cwd: string, name: string) => void; /** True when a pause sentinel exists for an org. */ export declare const isOrgPaused: (cwd: string, name: string) => boolean; /** Just the fields determineRunOutcome needs from runtime.json. */ type RunTerminalState = { status?: string; closedBy?: string; error?: string; }; /** 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; /** One pass of the `org serve` runfile poll — the mirror of pollStopfiles. * * A serve daemon owns its orgs, and nothing could ask it to start one off-cycle: * a scheduled org simply waited for its next tick, and `org run` against a * served org would spawn a second daemon competing for the same runtime.json * and broker lease. "Run it now" therefore meant killing and restarting the * daemon, which resets the schedule and drops any in-flight work. * * `.monomind/orgs//run` is the request. Consumed (deleted) before the * start, so a crash mid-run cannot wedge the org into a restart loop, and an * already-running org just clears it — "start now" on something already started * is satisfied, not an error. * * Returns the names it started, so callers/tests don't have to guess. */ export declare const pollRunfiles: (cwd: string, daemon: OrgDaemon) => Promise; export declare const orgCommand: Command; export default orgCommand; //# sourceMappingURL=org.d.ts.map