UNPKG

eve

Version:

Filesystem-first framework for durable backend AI agents that run anywhere.

26 lines (25 loc) • 1.52 kB
import { type DynamicResolveContext, type DynamicSentinel } from "#dynamic/definition.js"; import type { ExactDefinition } from "#public/definitions/exact.js"; import { type PublicInstructionsDefinition } from "#shared/instructions-definition.js"; export type InstructionsDefinition = Readonly<PublicInstructionsDefinition>; /** * Defines instructions in TypeScript from a `{ content, role? }` * definition. Omitted `role` defaults to `"system"`. * * Use it to return instructions from a `defineDynamic` resolver in * `agent/instructions/`. For a fixed prompt with no resolver, * author `instructions.md` instead. The result is branded so the dynamic * instruction lifecycle can validate that a resolver return came through * this helper. */ export declare function defineInstructions<TInstructions extends InstructionsDefinition>(definition: ExactDefinition<TInstructions, InstructionsDefinition>): TInstructions; export type DynamicInstructionsResult = InstructionsDefinition | null; export type DynamicInstructionsEvents = { readonly [K in "session.started" | "turn.started"]?: (event: unknown, ctx: DynamicResolveContext) => DynamicInstructionsResult | Promise<DynamicInstructionsResult>; }; /** * Defines a runtime instructions resolver for session and turn boundaries. */ export declare function defineDynamic<const TEvents extends DynamicInstructionsEvents>(definition: { readonly events: ExactDefinition<TEvents, DynamicInstructionsEvents>; }): DynamicSentinel<DynamicInstructionsResult>;