@essentialai/cogent-bridge
Version:
Cogent Bridge — cross-agent comms for Claude Code, OpenAI Codex and Slack. Codex users: install with `curl -fsSL https://cogent.tools/install.sh | sh`, then start with `cogent-codex` for real-time peer wake.
41 lines • 2.56 kB
TypeScript
/** Whether an ensureDaemon() error is the "managed codex build missing" case. */
export declare function isManagedCodexMissing(err: unknown): boolean;
/**
* Should this invocation get the app-server (real-time wake) rail?
*
* `cogent-codex` is a full encapsulation of `codex`: ANY codex command works through it.
* Only an interactive TUI session benefits from the daemon, so:
* - `cogent-codex` / `cogent-codex "prompt"` / `cogent-codex resume <id> …` → rail ON
* - `cogent-codex exec …` / `login` / `plugin add …` / `--help` → passed through as-is,
* and we do NOT even start the daemon.
* Everything after a `--` separator is the user's payload, never a subcommand.
*/
export declare function wantsDaemonRail(passthrough: string[]): boolean;
/**
* Build the `codex --remote` argv, pinning the working root to THIS launch directory.
*
* WHY (critical): the app-server daemon is a shared, machine-wide singleton rooted at
* whatever directory it FIRST started in. A plain `codex --remote` TUI inherits the
* DAEMON's cwd — so launching cogent-codex from project B, while the daemon started in
* project A, would run codex against project A's files (wrong, and unsafe). codex's
* global `-C, --cd <DIR>` sets the working root per-session (verified: `--remote -C /x`
* roots the conversation at /x regardless of the daemon's cwd), so we pin it to the
* caller's cwd. A user-supplied `-C`/`--cd` always wins (we don't add ours).
*/
export declare function buildRemoteArgs(sock: string, passthrough: string[], cwd: string): string[];
/** Is this a `resume`/`fork` carrying a permission override (args before any `--` only)? */
export declare function hasPermissionOverrideOnResume(passthrough: string[]): boolean;
/** `codex --version` text → does this codex refuse them? Unparseable → assume a current codex. */
export declare function remoteResumeRefusesPermissionFlags(versionText: string): boolean;
/**
* The argv handed to codex once the daemon is up. Normally `--remote` (buildRemoteArgs). For a
* resume/fork with a permission override on a codex that refuses it, `--remote` is dropped and
* the launch-dir pin is KEPT (`-C <cwd>` + the user's args): without the pin, codex launched from
* a directory other than the thread's recorded one stops at its working-directory picker.
*/
export declare function buildLaunchArgs(sock: string, passthrough: string[], cwd: string, codexVersionText: string): {
args: string[];
remote: boolean;
};
//# sourceMappingURL=cogent-codex.d.ts.map