UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

13 lines (12 loc) 1.01 kB
import { c as WRITE_SCOPE } from "./operator-scopes-Dw7Gu2cA.js"; import { t as CLI_DEFAULT_OPERATOR_SCOPES } from "./method-scopes-K6J_UQGL.js"; import { d as getHeader, t as applyHttpOperatorRoleScopeCeiling, v as resolveTrustedHttpOperatorScopes } from "./http-auth-utils-C3lb4QXY.js"; //#region src/gateway/server/plugin-route-runtime-scopes.ts /** Resolves the scopes a plugin route receives after gateway HTTP authentication. */ function resolvePluginRouteRuntimeOperatorScopes(req, requestAuth, surface = "write-default") { if (surface === "trusted-operator" ? requestAuth.trustDeclaredOperatorScopes : requestAuth.authMethod === "trusted-proxy" && getHeader(req, "x-openclaw-scopes") !== void 0) return resolveTrustedHttpOperatorScopes(req, requestAuth); const defaultScopes = surface === "trusted-operator" ? [...CLI_DEFAULT_OPERATOR_SCOPES] : [WRITE_SCOPE]; return applyHttpOperatorRoleScopeCeiling(defaultScopes, requestAuth); } //#endregion export { resolvePluginRouteRuntimeOperatorScopes as t };