UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

23 lines (22 loc) • 1.21 kB
import { legNoticeTaskId } from "../mods/stations.js"; import { deliverEngineNotice } from "../types.js"; export function approverDefectAnnouncer(args) { return (defect) => { const how = defect.cause === "threw" ? "threw" : 'answered outside its contract (an answer that is not true, false, "unavailable", "window_expired" or the {allow} object, or an object the seam refuses)'; const which = defect.seat === "policy" ? "approval policy (asPolicyApprover)" : "approver"; deliverEngineNotice(args.onNotice, { code: "approval.approver_defect", message: `the deployment's ${which} ${how} on the ask for "${args.toolName}" — the call was denied fail-closed and the tool did not run. ` + "Every ask this seat fails to answer in contract is refused the same way; the model reads the denial as an ordinary one.", detail: { toolName: args.toolName, toolCallId: args.toolCallId, cause: defect.cause, seat: defect.seat, sessionId: args.sessionId, runId: args.runId, ...legNoticeTaskId(args), }, }); }; }