/** This CLI's own invocation as argv: `[node, ...loaderFlags, entryScript]`. The loader flags carry * tsx in dev (so a re-exec can run the `.ts` entry) and are empty in prod (entry = compiled JS). * Re-execed children (web, manager) and cmux pane commands use this so they never depend on * `cotal` being on PATH — works the same via `npx`, `npm i -g`, and a dev clone. * * A RE-EXEC IS ONLY VALID FROM THE CLI'S OWN ENTRY, and that is checked here rather than at each * spawn site. Every caller appends a cotal subcommand (`supervise`, `deliver`, `ext add`) to this * argv and detaches the child, so the entry has to be the file that READS a subcommand. Started * from anything else the child re-runs THAT file with an argument it ignores, and a file that * reaches this on load spawns its own successor. * * #1629 measured that: a smoke fixture calling `ensureControlPlane` under tsx had `process.argv[1]` * pointing at the suite, so the detached "manager" was the suite, which ran to the same call and * spawned the next generation. 970 generations in 4.7 hours on a persistent host, each holding a * nats-server and a delivery holder, until the chain was killed by pid. The guard cannot live in * the smoke harness: `startManagerDetached` unrefs its child on purpose, so nothing that owns the * suite's children can own it. It is a THROW rather than a skipped spawn, because a re-exec that * silently does not happen reports a healthy control plane over nothing. */ export declare function selfArgv(): string[]; /** True when launched via `npx` — the package is unpacked under `~/.npm/_npx//…`. */ export declare function isNpx(): boolean; /** Is a *durable* `cotal` executable resolvable on PATH? A pure PATH scan (no exec): * {@link displayCmd} calls it for every user-facing hint, so it only resolves files, and the * `--version` exec probe stays in {@link verifiedCotalExecutables} for the recovery path. * Skips npx's transient shim: `npm exec` (npx) prepends the package's own * `/_npx//node_modules/.bin` to PATH, and since `cotal-ai` declares a `cotal` bin, * that dir holds a throwaway `cotal`. Counting it would make a bare `npx cotal-ai setup` conclude * `cotal` is already installed — skipping the global-install offer and printing `cotal …` hints * the user can't run once npx exits. That shim is exactly what we're offering to make permanent. */ export declare function cotalOnPath(): boolean; export interface CotalExecutable { readonly path: string; readonly version: string; } /** * Concrete durable `cotal` executables this host can prove exist and identify. This is deliberately * NOT part of ordinary startup: it executes each candidate's side-effect-free `--version` surface, * with a short timeout, only when a recovery path needs an executable rather than another bare * `cotal` command that may resolve straight back to the failing binary. * * PATH entries are checked in order after transient npx bins are skipped, then the POSIX installer's * default `~/.local/bin/cotal` is checked even when a service supplied a reduced PATH. Candidates * are deduped by real path. A file counts only when it exits cleanly and its first line is exactly * `cotal-ai `. */ export declare function verifiedCotalExecutables(env?: NodeJS.ProcessEnv): CotalExecutable[]; /** The copy-paste command prefix for user-facing hints: `cotal` when it's on PATH, `npx cotal-ai` * for an npx run, `pnpm cotal` in a dev clone. (Display only — re-execs use {@link selfArgv}.) */ export declare function displayCmd(): string; /** The self-invocation as a shell-ready, double-quoted command prefix (for cmux pane commands). * Tokens are absolute paths with no single quotes, so the surrounding `bash -lc '…'` single-quote * wrapping stays intact through a login shell (e.g. nushell) before bash. */ export declare function selfCotal(): string; //# sourceMappingURL=self-exec.d.ts.map