openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
2 lines • 1.03 kB
JavaScript
//!src/agents/embedded-agent-runner/run/midturn-precheck.ts
const MID_TURN_PRECHECK_ERROR_MESSAGE=`Context overflow: prompt too large for the model (mid-turn precheck).`;const MID_TURN_MAINTENANCE_MESSAGE=`Context maintenance scheduled at a settled tool boundary.`;var MidTurnPrecheckSignal=class extends Error{constructor(e){super(e.pressure===`overflow`?MID_TURN_PRECHECK_ERROR_MESSAGE:MID_TURN_MAINTENANCE_MESSAGE);this.name=`MidTurnPrecheckSignal`;this.request=e}};function isMidTurnPrecheckSignal(e){return e instanceof MidTurnPrecheckSignal}function isMidTurnPrecheckAssistantError(e){return e?.role===`assistant`&&e.stopReason===`error`&&(e.errorMessage===MID_TURN_PRECHECK_ERROR_MESSAGE||e.errorMessage===MID_TURN_MAINTENANCE_MESSAGE)}function isMidTurnMaintenanceAssistantSignal(e){return e?.role===`assistant`&&e.stopReason===`error`&&e.errorMessage===MID_TURN_MAINTENANCE_MESSAGE}export{isMidTurnPrecheckSignal as i,isMidTurnMaintenanceAssistantSignal as n,isMidTurnPrecheckAssistantError as r,MidTurnPrecheckSignal as t};