openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
32 lines (31 loc) • 1.76 kB
JavaScript
import { r as isIncognitoSessionKey } from "./session-key-DW1jcHbM.mjs";
import "./session-key-CqAyZeVk.mjs";
import { n as authorizeOperatorScopesForMethod } from "./method-scopes-Dpyb0Ck-.mjs";
import { d as createCronCreatorAuthorityCapability, p as runWithCronCreatorAuthorityCapability } from "./cron-creator-authority-context-D4fHKVAj.mjs";
import { a as isDirectGatewayChatUserTurn, c as resolveGatewayChatCronCreatorAuthorityAdmission } from "./skill-library-authoring-CwgXRvu2.mjs";
import { t as handleChatSend } from "./chat-send-handler-CzQYcege.mjs";
//#region src/gateway/server-methods/chat-send-external-entry.ts
const externalAuthorityAdmission = {
allowsDashboardReads: (e) => e.client?.internal?.authenticatedControlUi === true && authorizeOperatorScopesForMethod("chat.send", e.client.connect.scopes ?? []).allowed && isDirectGatewayChatUserTurn({
...e,
resolvedSessionKey: e.sessionKey,
isIncognito: e.isIncognitoEntry || isIncognitoSessionKey(e.sessionKey),
isDirectExternalUser: true
}),
resolve: (e) => {
const t = resolveGatewayChatCronCreatorAuthorityAdmission({
...e,
resolvedSessionKey: e.sessionKey,
isIncognito: e.isIncognitoEntry || isIncognitoSessionKey(e.sessionKey),
isDirectExternalUser: true
});
return t ? createCronCreatorAuthorityCapability(t.runId, t.callerOrigin, t.managementEntitlement, t.isCurrent, void 0, t.requesterOwner, t.callerScopedCreation) : void 0;
},
run: (e, t, n) => runWithCronCreatorAuthorityCapability(e, t, n)
};
/** Authenticated external chat entry; internal re-entry must call handleChatSend directly. */
function handleDirectExternalChatSend(e, t) {
return handleChatSend(e, t, externalAuthorityAdmission);
}
//#endregion
export { handleDirectExternalChatSend as t };