UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

67 lines • 2.63 kB
import type { util } from 'zod'; import { z } from 'zod'; import { type OpenStream } from '../rs/stream.ts'; import { Limit } from '../types.ts'; import type { Ask, CommandContext, Deny, NetworkContext, Route, RouteContext, SessionContext, VfsContext } from './types.ts'; type Answer = Deny | Ask | Route; type Context = CommandContext | RouteContext | VfsContext | SessionContext | NetworkContext; export declare const PACKET_BYTES: number; declare const effectSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ op: z.ZodEnum<{ run_policy: "run_policy"; read_action: "read_action"; read_settlement_action: "read_settlement_action"; }>; slot: z.ZodNumber; evaluation: z.ZodString; effect: z.ZodNumber; }, z.core.$strip>, z.ZodObject<{ op: z.ZodLiteral<"read_ask_rules">; first: z.ZodNumber; next: z.ZodNumber; evaluation: z.ZodString; effect: z.ZodNumber; }, z.core.$strip>, z.ZodObject<{ op: z.ZodLiteral<"replace_ask_rules">; action: z.ZodNumber; rules: z.ZodArray<z.ZodNumber>; evaluation: z.ZodString; effect: z.ZodNumber; }, z.core.$strip>, z.ZodObject<{ op: z.ZodLiteral<"read_final_values">; routes: z.ZodArray<z.ZodNumber>; limits: z.ZodArray<z.ZodNumber>; evaluation: z.ZodString; effect: z.ZodNumber; }, z.core.$strip>], "op">; export interface CompositionResult { answers: Answer[]; action: Deny | Ask | null; route: Route | null; limit: Limit | null; } export declare class Composition { private readonly settlement; readonly stream: OpenStream; readonly evaluation: string; private readonly actions; private readonly originals; private readonly rules; readonly names: Map<number, string>; constructor(settlement?: readonly Answer[] | null); static packet(value: Record<string, util.JSONType>): Uint8Array; feed(value: Record<string, util.JSONType>): void; private ruleId; descriptors(answered: unknown, name: string): util.JSONType[]; request(): z.infer<typeof effectSchema> | null; respond(effect: z.infer<typeof effectSchema>, answered: unknown, name: string, more: boolean): void; respondEffect(effect: z.infer<typeof effectSchema>, ctx?: Context): boolean; private answer; settlementResult(): Answer | null; result(method?: string): CompositionResult; close(): void; } export declare function composeSettled(answers: readonly Route[], mode: 'agreed'): Deny | Route | null; export declare function composeSettled(answers: readonly Answer[], mode: 'settled'): Answer | null; export {}; //# sourceMappingURL=composition.d.ts.map