@sema-agent/core
Version:
Stateless, task-oriented AI agent core
13 lines (12 loc) • 714 B
JavaScript
import { defaultTaskRegistry } from "../core/task-registry.js";
import { codedRefusal } from "../core/thrown-value.js";
export function delegationRegistryOf(ctx, bag) {
if (bag === undefined)
return undefined;
const seat = ctx.taskRegistry;
const option = bag.registry;
if (seat !== undefined && option !== undefined && option !== seat) {
throw codedRefusal("config.invalid_task_registry", "background.registry is not the registry this run reads (its leg end, TaskStop and teardown read the run's own task registry) — leave the option unset inside a Runner task and the run's registry rides, or wire that one registry.");
}
return seat ?? option ?? defaultTaskRegistry;
}