UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

14 lines (13 loc) • 633 B
import { types } from "node:util"; import { receive } from "./mods/kernel/receive.js"; import { carryNotStartedReceipt } from "./delegation-not-started.js"; const TOOL_DATA_MODE = Object.freeze({ accessors: "call-once", depth: Infinity, others: "copy", contain: true, wire: true, isProxy: (v) => types.isProxy(v) }); export function receivedToolData(v) { if (v === null || v === undefined || typeof v === "string" || typeof v === "number" || typeof v === "boolean") return v; const r = receive(v, TOOL_DATA_MODE); if (!r.ok) return undefined; carryNotStartedReceipt(v, r.value); return r.value; }