@mastra/core
Version:
38 lines • 1.74 kB
TypeScript
/**
* In-memory registry of subagent results produced during a single supervisor
* run. Powers `delegation.enableResultReferences`: each successful, non-empty
* delegation result is stored under a deterministic `<agentName>-<n>` ID so a
* later delegation can name it via `contextFromRefs` and receive the text
* verbatim. Never persisted — the registry lives in the tool-builder closure
* for the run and is discarded when the run's tools are.
*/
export interface DelegationRefEntry {
text: string;
agentName: string;
}
export interface DelegationRefRegistry {
/** Store a result and return its minted reference ID. */
register(agentName: string, text: string): string;
get(ref: string): DelegationRefEntry | undefined;
}
export declare function createDelegationRefRegistry(): DelegationRefRegistry;
export type DelegationRefInput = string | {
ref: string;
as?: string | null;
note?: string | null;
};
export interface ResolvedDelegationRefs {
prompt: string;
/** Reference IDs that were requested but not found in the registry. */
missing: string[];
/** Reference IDs that were expanded into the prompt, in order. */
resolved: string[];
}
/**
* Expand `contextFromRefs` into the delegation prompt. Each referenced result is
* wrapped in its own frame with an unpredictable tag so text inside one block
* cannot forge or close another block, then the blocks are placed before the
* supervisor's prompt. Unknown IDs are skipped and reported in `missing`.
*/
export declare function resolveDelegationRefs(registry: DelegationRefRegistry, refs: DelegationRefInput[] | null | undefined, prompt: string): ResolvedDelegationRefs;
//# sourceMappingURL=delegation-refs.d.ts.map