openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 1.91 kB
JavaScript
import{t as GATEWAY_OWNER_PROFILE_ID}from"./user-profile-constants-abCq1jKI.mjs";import{o as getGatewayToolCallerIdentity}from"./gateway-caller-context-Dw9IijqV.mjs";
//!src/gateway/server-methods/gateway-personal-caller.ts
function isSyntheticGatewayCaller(e){return Boolean(e?.internal?.syntheticClient||e?.internal?.agentToolCaller||e?.internal?.agentRuntimeIdentity||getGatewayToolCallerIdentity())}function isAttendedSessionCreator(e){return Boolean(e?.authenticatedUserProfile?.profileId&&e.connect.role===`operator`&&!e.internal?.remoteIngressPrincipal&&!e.internal?.sessionCreation?.requesterSessionKey&&!isSyntheticGatewayCaller(e))}function resolveAuthenticatedPersonalGatewayProfileId(e){const t=e?.authenticatedUserProfile?.profileId;return e?.internal?.authenticatedOperator===true&&e.connect.role===`operator`&&!isSyntheticGatewayCaller(e)&&t&&t!==`gateway-owner`?t:void 0}function isIneligiblePersonalGatewayCaller(e){const t=e.internal?.operatorRoleActor;const n=e.internal?.remoteIngressPrincipal;if(n){try{n.signal.throwIfAborted();n.assertCurrent()}catch{return true}if(e.authenticatedUserProfile?.profileId!==n.authenticatedUserProfile.profileId)return true;const r=n.operatorRoleActor;return isSyntheticGatewayCaller(e)||(r.kind===`operator`?t?.kind!==`operator`||t.profileId!==r.profileId:t?.kind!==`system`)}return isSyntheticGatewayCaller(e)||Boolean(t&&(t.kind!==`system`||!e.authenticatedUserProfile))}function hasCurrentPersonalGatewaySource(e,t){if(!e||e.invalidated||e.connectionSignal?.aborted||e.connect.role!==`operator`||isIneligiblePersonalGatewayCaller(e))return false;return Boolean(e.internal?.remoteIngressPrincipal||e.connId&&t.getClientConnIds?.(t=>t===e).has(e.connId))}export{resolveAuthenticatedPersonalGatewayProfileId as a,isSyntheticGatewayCaller as i,isAttendedSessionCreator as n,isIneligiblePersonalGatewayCaller as r,hasCurrentPersonalGatewaySource as t};