@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
28 lines • 1.45 kB
TypeScript
import type { Policy } from './base.ts';
import type { PolicyMethod } from './types.ts';
/**
* The nominal session-scoped brand (python's SessionScopedMixin
* inheritance). Detection is by this marker, never by probing for a
* `wantsFor` method. `Symbol.for` keeps the brand stable even when two
* copies of the package are loaded.
*/
export declare const SESSION_SCOPED: unique symbol;
/**
* A policy whose methods speak for some sessions and not others. A Policy
* that also implements this defines a method on behalf of the sessions
* that carry a rule for it (a profile's policy program speaks only for
* the sessions under that profile), and says so through `wantsFor`.
* `Policies.wants` is the static answer, true as soon as any policy
* defines the method, and every entry point keeps gating on it; a seam that pays
* ahead for a method (the secret fill drops its masks under a
* session-write gate) asks `Policies.wantsFor` instead, which consults
* this brand so one profile's entry point does not charge every session.
*/
export interface SessionScopedMixin {
readonly [SESSION_SCOPED]: true;
/** Whether this policy's `method` will speak for one session. */
wantsFor(method: PolicyMethod, sessionId: string): Promise<boolean>;
}
/** Whether this policy speaks per session. */
export declare function isSessionScoped(policy: Policy): policy is Policy & SessionScopedMixin;
//# sourceMappingURL=mixin.d.ts.map