import { type CurrentTurnProvenance } from '../../core/current-turn-provenance.js'; export type V3DaemonCommandBindingSource = 'run-envelope' | 'legacy-grill' | 'legacy-unbound'; export interface V3DaemonCommandAuthority { runDir: string; /** Exact daemon owner selected from the authenticated target/current turn. */ larkAppId: string; mode: 'chat' | 'standalone'; bindingSource: V3DaemonCommandBindingSource; } export interface AuthorizeV3DaemonCommandOptions { runId: string; dataDir: string; baseDir?: string; envSessionId?: string; startPid?: number; /** Explicit `--bot`; inherited BOTMUX_LARK_APP_ID is intentionally ignored. */ requestedLarkAppId?: string; /** Cancel-only escape hatch: an unbound manual run is mutated on local disk * and therefore does not need a daemon selector. Other daemon commands keep * requiring --bot for standalone routing. */ allowStandaloneLocal?: boolean; /** Test seam. Production always uses the fresh marker/session resolver. */ resolveProvenance?: (options: { dataDir: string; envSessionId?: string; startPid?: number; }) => CurrentTurnProvenance | null; } export declare class V3DaemonCommandAuthorityError extends Error { constructor(message: string); } /** The exact identity tuple a chat mutation must prove against the binding. */ export interface V3RunMutationCurrentTuple { callerOpenId: string; chatId: string; larkAppId: string; } /** * Chat-tuple authorization core shared by the CLI host path (marker-derived * provenance) and the daemon session relay (capability-derived live session). * The tuple must have been AUTHENTICATED by the caller: process-tree marker + * durable session join on the host, or rotating per-turn capability + the * daemon's own live session record on the relay path — never env/argv claims. */ export declare function authorizeV3RunMutationForCurrentTuple(options: { runId: string; baseDir?: string; current: V3RunMutationCurrentTuple; }): V3DaemonCommandAuthority; /** * Authorize a CLI daemon mutation and return the only app id it may contact. * * Chat callers may mutate only a run bound to the exact current * (caller, chat, app) tuple. Genuine standalone callers may mutate only an * unbound run and must name the daemon explicitly with --bot. This preserves * the dev path without letting a detached/stale agent fall back to it. */ export declare function authorizeV3DaemonCommand(options: AuthorizeV3DaemonCommandOptions): V3DaemonCommandAuthority; //# sourceMappingURL=cli-daemon-command-authority.d.ts.map