UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

25 lines (24 loc) • 1.26 kB
import type { LegYield } from "../runner-drain.js"; import type { RunnerDeps, TaskSpec } from "../types.js"; import type { Stats } from "./assemble-result.js"; import type { Prepared, RunState } from "./contracts.js"; /** What an attempt came to: `"ended"` — the leg ends at this boundary (parked, or the mint stopped the run); `"continues"` — * nothing was parked and the leg goes on. */ export type YieldAnswer = "ended" | "continues"; /** Each ask answers `undefined` when it makes no attempt here, and a leg with no mint is answered on the same tick: only a * mint is awaited. */ export interface BoundaryYield { /** The first ask. */ readonly first: () => Promise<YieldAnswer> | YieldAnswer | undefined; /** Asked again (only a leg with a mint is). `goesOn`: this boundary's tool results go back to the model as the next request, * and nothing on it so far ends the leg (no crossed task axis, no requested stop, no halted batch). */ readonly again: (goesOn: boolean) => Promise<YieldAnswer> | undefined; } export declare function boundaryYield(input: { spec: TaskSpec; legYield: LegYield | undefined; prepared: Prepared; rs: RunState; stats: Stats; onError: () => RunnerDeps["onError"]; }): BoundaryYield;