import { type TurnOrigin } from '@xopcai/endpoint-tools-protocol'; import type { DeviceGrantAuditEvent } from '../storage/sqlite/device-grant-audit-repository.js'; import type { EndpointRegistry } from './registry.js'; export interface DeviceGrantLease { signal: AbortSignal; complete: () => void; } interface DeviceGrant { id: string; conversationId: string; requestorPrincipalId: string; targetEndpointId: string; targetPrincipalId: string; arguments: Record; toolRevision: string; connectionId: string; toolName: string; argumentsDigest: string; expiresAt: number; state: 'ready' | 'running'; actorOnly?: boolean; controller: AbortController; } export interface IssueDeviceGrantOptions { /** Allow issuing while the target device is in background (foreground is enforced at dispatch/wait time). */ allowBackground?: boolean; /** Bind the grant to an authenticated Gateway execution actor instead of an online endpoint principal. */ actorOnly?: boolean; /** Override grant lifetime in milliseconds (defaults to 60_000). */ ttlMs?: number; } /** Deliberately non-durable: restart, expiry, disconnect or revoke invalidates single-call consent. */ export declare class DeviceGrantService { private readonly registry; private readonly now; private readonly audit?; private readonly grants; constructor(registry: EndpointRegistry, now?: () => number, audit?: ((event: DeviceGrantAuditEvent) => void) | undefined); issue(input: { conversationId: string; requestorPrincipalId: string; targetEndpointId: string; toolName: string; arguments: Record; }, options?: IssueDeviceGrantOptions): { id: string; conversationId: string; requestorPrincipalId: string; targetEndpointId: string; targetPrincipalId: string; arguments: Record; toolRevision: string; connectionId: string; toolName: string; expiresAt: number; state: "ready" | "running"; actorOnly?: boolean; }; private requestor; candidates(conversationId: string, origin: TurnOrigin, actorPrincipalId?: string): DeviceGrant[]; find(conversationId: string, origin: TurnOrigin, endpointId: string, toolName: string, actorPrincipalId?: string): DeviceGrant | undefined; reserve(id: string, args: Record): DeviceGrantLease; list(): { id: string; conversationId: string; requestorPrincipalId: string; targetEndpointId: string; targetPrincipalId: string; arguments: Record; toolRevision: string; connectionId: string; toolName: string; expiresAt: number; state: "ready" | "running"; actorOnly?: boolean; }[]; revoke(id: string, reason?: 'consumed' | 'revoked' | 'expired'): boolean; revokeEndpoint(endpointId: string, principalId?: string | undefined): void; close(): void; private prune; private summary; } export {};