UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

33 lines (32 loc) • 2.23 kB
/** * The bounds of what a `tool_end` frame carries. The end projection (`runner/tool-output-projection.ts`) reads them, and so * does a tool that must know, before it asks a person to look at its card, whether that card reaches the person at all * (the plan-exit tool: a plan its card cannot carry is refused before any approval is requested). One bound, one measure: * nothing else spells either. */ /** Size cap (characters) for the TEXT of a `tool_end.output` body on the live event stream, so a GB-scale result can't * bloat SSE/checkpoint replay. Media blocks are not measured against it. The full result still lives in context / * `ToolResultStore`. */ export declare const MAX_TOOL_END_OUTPUT_CHARS = 16384; /** A card rides `tool_end.structured` while its JSON is at most this many characters: 4x the text cap, because card facts * legitimately carry `originalFile` (the diff base). A larger card is left off `structured` whole; its skeleton rides instead. */ export declare const MAX_TOOL_CARD_CHARS: number; /** A card's size as the frame measures it: the length of its JSON. A card with no JSON (a cycle, a BigInt, a throwing * getter) measures `Infinity` — it never rides. */ export declare function toolCardChars(details: object): number; /** Where a card goes on its `tool_end`: whole on `structured`, or — over the bound — its skeleton on `structuredSkeleton`. */ export type CardOnFrame = { structured: object; } | { structuredSkeleton: { type: string; } & Record<string, unknown>; }; /** * The one rule for a card and the bound. A card the frame can carry rides whole. One it cannot rides as its SKELETON: `type` * plus the `members` its kind names, copied as written (a dotted name reaches into a nested object; a member the card does * not carry stays absent; nothing is computed). A skeleton the frame cannot carry either rides as nothing — never cut: a * shortened path would name another file. The rule knows no kind; the caller hands in the kind's members. A card whose * members cannot be read (a throwing getter) has no skeleton either. */ export declare function cardOnFrame(card: object, type: string, members: readonly string[]): CardOnFrame | undefined;