@sema-agent/core
Version:
Stateless, task-oriented AI agent core
18 lines (17 loc) • 752 B
JavaScript
const NOT_STARTED_RECEIPTS = new WeakSet();
export function notStartedResult(result) {
const details = result.details;
if (typeof details === "object" && details !== null)
NOT_STARTED_RECEIPTS.add(details);
return result;
}
export function carryNotStartedReceipt(original, copy) {
if (typeof original === "object" && original !== null && typeof copy === "object" && copy !== null && NOT_STARTED_RECEIPTS.has(original))
NOT_STARTED_RECEIPTS.add(copy);
}
export function isNotStartedDelegationResult(result) {
if (typeof result !== "object" || result === null)
return false;
const details = result.details;
return typeof details === "object" && details !== null && NOT_STARTED_RECEIPTS.has(details);
}