/** * Stable identity of a RUN for the MCP relay (2026-10-25, agent-scoped 2026-11). * * WHY THIS EXISTS * --------------- * A relay token used to be minted per CLI process, so every resume, retry or * continuation got a NEW token. OpenCode V2 keeps ONE MCP connection for the * run's project directory, opened with whatever token `opencode.json` held at * spawn, and it never re-initializes that client when the file changes. Handing * a resumed run a new token therefore left the live connection authenticating * with the OLD one - and a revoked/expired old token is a permanent 401 that * takes every TeamShare tool away mid-run (the QA run that lost its report). * * THE AGENT IS PART OF THE KEY (2026-11) * -------------------------------------- * A chat run's store key is the CONVERSATION (`chat--`), * which two agents answering in the same channel share. Without the agent in * the run key both spawned with the SAME key, and `registerSessionToken` * correctly refuses to hand one identity another's token: it DROPPED the first * agent's token and minted the second's. The first agent's live MCP connection * then 401'd on every call, and its retry dropped the second's - a ping-pong * that only showed up "when multiple agents were working". Two agents are two * runs and must never share a token. * * Both sides MUST derive this the same way: `spawnHarness` (mint) and the * daemon's stop path / `cmdResearch` (revoke). It is pure and unit-tested for * that reason. */ export declare function relayKeyFor(taskId?: string | null, mode?: string | null, fallbackSessionId?: string | null, agentId?: string | null): string | undefined;