UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

14 lines (13 loc) • 922 B
import { deliverEngineNotice } from "../engine-notice.js"; export function toolResultMediaRefusedSeat(onNotice, ids) { return ({ toolName, toolCallId, refused }) => { const reasons = [...new Set(refused.map((r) => r.reason))].join(", "); deliverEngineNotice(onNotice, { code: "tool_result.media_refused", message: `The ${JSON.stringify(toolName)} tool's result carried ${refused.length} media block(s) whose bytes the media admission refused (${reasons}). ` + `Each was replaced in the result by a text placeholder naming the refusal, so neither the model nor the event stream received those bytes; ` + `the tool, or the server behind it, returned bytes that are not what their block claims.`, detail: { toolName, toolCallId, refused: refused.map((r) => ({ ...r })), sessionId: ids.sessionId, runId: ids.runId }, }); }; }