UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

24 lines (23 loc) • 1.71 kB
/** * The answer of a `classic.Stop` / `classic.SubagentStop` handler, read ONE way wherever it is read: by the engine's stop * station when it folds the two seats' answers, and by a handler folding its own answer with what `next` answered in its * seat. The members are read as the station's answer check reads them ({@link stringMembersOf}): a string member stands * (an empty one included), a member of any other type is absent. */ import type { StopHookResult } from "../hooks.js"; /** The members a Stop answer is read for; the station's answer check refuses a non-string one. */ export declare const STOP_ANSWER_MEMBERS: readonly ["block", "additionalContext", "end"]; /** A Stop answer's members as the engine reads them. */ export declare function readStopAnswer(answer: unknown): StopHookResult; /** * Whether a Stop answer decides its stop point on its own: it asks to end (`end` present, empty or not) or it pushes back * with a non-empty `block`. Context alone is advice, never a decision. */ export declare function stopAnswerDecides(answer: StopHookResult | undefined): boolean; /** * Fold two Stop answers, `outer` the more trusted one (across seats: the deployment's; within a seat: the handler's own, * `inner` what `next` answered). An answer carrying `end` ends the stop point: the fold carries `end` alone, its reason the * first one present (`outer`'s, then `inner`'s). Otherwise the fold carries the first non-empty `block` and the non-empty * contexts in order, joined by a blank line; an empty fold lets the run end as an empty answer does. */ export declare function mergeStopAnswers(outer: StopHookResult | undefined, inner: StopHookResult | undefined): StopHookResult;