UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

27 lines • 891 B
import { YieldBudget } from "../io/yield_budget.js"; import { newExecutionId } from "../execution/context.js"; import { makeAbortError } from "../utils/abort.js"; /** Identity and scheduling budget shared by a call and its evaluations. */ export class ExecutionScope { onStart; id; budget = new YieldBudget(); constructor(onStart, id = newExecutionId()) { this.onStart = onStart; this.id = id; } /** Publish admission once, after acquiring the session and before effects. */ async start() { const onStart = this.onStart; this.onStart = undefined; await onStart?.(); } async checkpoint(signal) { if (signal?.aborted) throw makeAbortError(signal); await this.budget.run(); if (signal?.aborted) throw makeAbortError(signal); } } //# sourceMappingURL=execution.js.map