@sema-agent/core
Version:
Stateless, task-oriented AI agent core
9 lines (8 loc) • 441 B
JavaScript
import { formatHookFeedback } from "../hooks.js";
import { inlineUntrusted } from "../untrusted-text.js";
const HOOK_REASON_MAX = 240;
export function holdPrompt(ref, mark, cause, text) {
ref.reason = formatHookFeedback(text, mark);
const hookReason = cause === "block" ? inlineUntrusted(String(text), HOOK_REASON_MAX) : "";
ref.detail = { kind: "prompt_blocked_by_hook", cause, ...(hookReason !== "" ? { hookReason } : {}) };
}