@sema-agent/core
Version:
Stateless, task-oriented AI agent core
37 lines (36 loc) • 2.38 kB
TypeScript
import { type LegAdoption } from "../../agents/yield-adoption.js";
import { type WorkflowContinuationGate, type WorkflowParkAdopter, type WorkflowParkDecisionNoticeCode } from "../../orchestration/workflow-park-adoption.js";
import type { ToolExecuteContext } from "../types.js";
import type { EngineText } from "../../prompt-assembly/engine-text.js";
import type { PrepareResume, RunInternals } from "./contracts.js";
export interface PrepareLegAdoptionInput {
/** borrowed-readonly — the leg's mounted tools (the yield contributor finds the delegation tools among them). */
readonly tools: ReadonlyArray<{
readonly execute: unknown;
}>;
/** borrowed-readonly — the leg's tool-context enrichment: the context a model call of this leg runs with. */
readonly enrich: (ctx: ToolExecuteContext) => ToolExecuteContext;
/** borrowed-readonly — the resume this leg is, when it is one (its card names the call it resumes). */
readonly resume: PrepareResume | undefined;
/** borrowed-readonly — the deployment's account of what the yield contributor could not do (said once per refusal). */
readonly onError: (e: Error) => void;
/** borrowed-readonly — the workflow-park decisions the deployment's trusted channel handed this leg. */
readonly decisions: RunInternals["workflowParkedResume"];
/** borrowed-readonly — the mounted Workflow tool's adopter, when the leg mounts one this engine built. */
readonly adopter: WorkflowParkAdopter | undefined;
/** borrowed-readonly — the leg's one gate pass, as a continuation asks it. */
readonly gate: WorkflowContinuationGate | undefined;
/** borrowed-readonly — the leg's user-face notice delivery (its address and admission applied by the caller). */
readonly deliver: (notice: {
code: WorkflowParkDecisionNoticeCode;
message: string;
detail: Record<string, unknown>;
}) => void;
/** borrowed-readonly — the leg's reading of the engine's messages, the `workflow_continuation` frame's wording. */
readonly say: EngineText;
}
export interface PrepareLegAdoptionResult {
/** owned — the leg's one adoption step; the run body runs it once, before its first request. */
readonly legAdoption: LegAdoption;
}
export declare function prepareLegAdoption(input: PrepareLegAdoptionInput): PrepareLegAdoptionResult;