UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

17 lines (16 loc) • 856 B
import { deliverEngineNotice } from "../types.js"; export function haltConsumed(c) { return c?.turnCut === "halt" || c?.boundaryStop?.sources.includes("halt") === true; } export function discloseUnconsumedHalt(input) { if (!input.accepted || haltConsumed(input.consumption)) return false; deliverEngineNotice(input.onNotice, { code: "task.halt_unconsumed", message: "a user halt was accepted, but the run ended for its own reason before the halt stopped or cut anything: " + "no turn was settled as its cut and no boundary stopped for it — the run's own ending stands, and the result " + "will not carry haltedByUser for this halt.", detail: { sessionId: input.sessionId, runId: input.runId, ...(input.taskId !== undefined ? { taskId: input.taskId } : {}) }, }); return true; }