UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 1.37 kB
import{a as asOptionalRecord}from"./record-coerce-BTbqdJ3-.mjs"; //!packages/agent-core/src/harness/session/background-result-placement.ts const BACKGROUND_RESULT_PLACEMENT_CUSTOM_TYPE=`openclaw.background-result-placement`;function isPendingBackgroundResultMessage(e){const t=asOptionalRecord(e);return t?.role===`assistant`&&t.provider===`openclaw`&&t.model===`automation-result`&&t.excludeFromContext===true&&t.openclawModelPlacement===`pending`}function readBackgroundResultPlacement(e){const t=asOptionalRecord(e);if(t?.type!==`custom`||t.customType!==`openclaw.background-result-placement`)return;const n=asOptionalRecord(t.data);if(!n||n.afterEntryId!==null&&typeof n.afterEntryId!==`string`||!Array.isArray(n.resultEntryIds)||n.resultEntryIds.length===0||!n.resultEntryIds.every(e=>typeof e===`string`&&e.length>0))throw new Error(`Invalid background result placement marker`);return{afterEntryId:n.afterEntryId,resultEntryIds:n.resultEntryIds}}function projectPlacedBackgroundResultMessage(e){if(!isPendingBackgroundResultMessage(e))throw new Error(`Background result placement references an unavailable pending artifact`);const{excludeFromContext:t,openclawModelPlacement:n,...r}=e;return r}export{readBackgroundResultPlacement as i,isPendingBackgroundResultMessage as n,projectPlacedBackgroundResultMessage as r,BACKGROUND_RESULT_PLACEMENT_CUSTOM_TYPE as t};