UNPKG

@phren/cli

Version:

Knowledge layer for AI agents - CLI, MCP server, and data layer

29 lines (28 loc) • 2.08 kB
/** Whether a Codex hook callback comes from a thread that is not the pane's * own conversation: a `codex exec` started inside the pane (a fanout worker, * a review run) or a subagent (the guardian reviewer, a spawned thread). They * inherit the pane's variables, so their callbacks name the pane, and each * one used to rebind it: the pane's conversation then looked replaced, phone * sends were refused as "conversation changed" and queued hand-offs failed. * Read from the rollout's first row (`originator`, `source`); a rollout that * cannot be read counts as the pane's own. */ export declare function codexForeignThread(transcriptPath: unknown): Promise<boolean>; /** The session_meta fields come before its long instructions, so the head of * the line is enough; no full parse. */ export declare function foreignMeta(head: string): boolean; /** Whether a Claude hook callback comes from a headless run (`claude -p`, the * Agent SDK) started inside the pane: it inherits HERDR_* and * PHREN_DISPATCH_ID, so its callbacks name the pane and overwrite the parent's * turn record. Interactive transcripts say `"entrypoint":"cli"`, headless ones * `sdk-cli`/`sdk-ts`/`sdk-py`, on the first user row. A transcript that cannot * be read, or has a long first prompt, counts as the pane's own. */ export declare function claudeHeadlessThread(transcriptPath: unknown): Promise<boolean>; export declare function headlessEntrypoint(head: string): boolean; /** The same question asked of the callback's own environment, which answers it * before the transcript exists (SessionStart): Claude Code sets * CLAUDE_CODE_ENTRYPOINT to `sdk-cli`/`sdk-ts`/`sdk-py` for a headless run, and * a Phren fan-out launcher marks its worker. A helper or fan-out worker started * from a lead's pane rebound that pane to its own session (#909): the phone * then read the worker's empty child tree in place of the lead's workers. * Dependency-free: the fast forwarder (hook-fast.ts) embeds it. */ export declare function headlessClaudeEnv(env: Record<string, string | undefined>): boolean;