UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

55 lines • 2.21 kB
import type { ReadSpec } from '../types.ts'; import type { Clock } from '../utils/clock.ts'; import type { TokenManager } from '../core/api/oauth.ts'; import type { ResponseCache } from './responses.ts'; export declare class Accessor { [key: string]: unknown; /** Release what this accessor holds, when it holds anything. */ close?(): Promise<void>; /** Share what a peer on the same account holds (the workspace's other accessors). */ join?(peers: readonly Accessor[]): void; /** * Whether a write through this accessor may change what `peer` reads. One * that does not say may reach anything. */ reaches?(peer: Accessor): boolean; /** The answers this accessor keeps of its own service. */ caches?(): readonly ResponseCache<unknown, unknown>[]; /** Keep this accessor's own answers under a mount's read policy. */ govern?(read: ReadSpec): void; /** Drop this accessor's own answers, as its mount drops its caches. */ forget?(): void; /** * Read time and wait on the clock of a workspace that mounts it; one that * does not say reads none. */ bindClock?(clock: Clock, owner: unknown): void; /** * Let `owner` go, as it unmounts the accessor or closes; one that does not * say holds none. */ releaseClock?(owner: unknown): void; } /** * An accessor whose calls a `TokenManager` signs. The manager reads token * expiry and times retry waits on the clock of the workspace that mounts the * accessor. Mirrors Python's `TokenAccessor`. */ export declare abstract class TokenAccessor extends Accessor { abstract readonly tokenManager: TokenManager; /** * Read token expiry and retry waits on `clock`. * * @param owner who holds it, released by the same key. * @throws Error when a workspace on another clock mounts it. */ bindClock(clock: Clock, owner: unknown): void; /** Let `owner` go. */ releaseClock(owner: unknown): void; } /** The accessor of a mount or CLI with no client of its own. */ export declare class NOOPAccessor extends Accessor { readonly config: unknown; constructor(config?: unknown); } //# sourceMappingURL=base.d.ts.map