UNPKG

histoire

Version:

A fast story book powered by Vite

41 lines • 2.34 kB
import type { RequestPermissionRequest, RequestPermissionResponse } from '@agentclientprotocol/sdk'; import type { UiAgentPermission, UiAgentPlanDecision, UiAgentSettings } from '@histoire/shared'; /** Mediates agent-owned file/terminal tools without hosting either operation. */ export declare function createPermissionBroker(options: { /** Project boundary used for allow-src. */ root: string; /** Current local permission policy. */ policy: () => UiAgentSettings['permissions']; /** Emit one sanitized permission prompt. */ emit: (value: UiAgentPermission) => void; /** Notify browsers when a card is no longer pending. */ resolved?: (requestId: string) => void; /** Redact credentials before showing titles/paths. */ sanitize: (value: string) => string; /** Thread whose active prompt owns an agent session, for in-thread cards. */ threadOf?: (agentId: string, sessionId: string) => string | undefined; /** Records the user's answer to a plan approval card on its prompt. */ decided?: (agentId: string, sessionId: string, decision: UiAgentPlanDecision) => void; }): { /** * Requests permission only when current policy does not decide it safely. * @param agentId Agent preset id. * @param request Agent permission request. * @param signal Agent-side cancellation of this request. */ request(agentId: string, request: RequestPermissionRequest, signal?: AbortSignal): Promise<RequestPermissionResponse>; /** * Resolves exactly one live card; stale/duplicate browser replies and unknown choices do nothing. * @param requestId Broker-owned card identity. * @param allow Default approve/deny answer when no choice is given. * @param remember Allow the same tool category for the rest of the session. * @param choiceId Explicit card choice, for cards that list choices. */ reply(requestId: string, allow: boolean, remember: boolean, choiceId?: string): void; cancel: (agentId?: string, sessionId?: string, forget?: boolean) => void; /** Ends a prompt without discarding approvals for its persistent ACP session. */ settle(agentId: string, sessionId: string): void; /** Denies every unresolved request before the runtime retires. */ close(): void; }; //# sourceMappingURL=permissions.d.ts.map