UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 1.41 kB
import{n as containsAsciiControlCharacter}from"./string-normalization-D_oBUpO3.mjs";import{t as parseControlUiSessionPath}from"./parse-1lY3Sn7m.mjs"; //!src/gateway/control-ui-session-entry-path.ts const RETURN_PATH_QUERY_VALIDATORS=/* @__PURE__ */ new Map([[`dashboard`,e=>e===`expanded`],[`draft`,()=>true],[`openclaw_mount_recovery`,e=>/^[0-9]+$/u.test(e)],[`__openclawSessionFacePreference`,e=>e===`1`],[`__openclawComposerFocus`,e=>e===`1`],[`__openclawSessionKey`,e=>Boolean(e.trim())&&!containsAsciiControlCharacter(e)]]);function isControlUiSessionReturnPathQueryKey(e){return RETURN_PATH_QUERY_VALIDATORS.has(e)}function controlUiSessionEntryPath(e){return`${e}/__openclaw__/session-entry`}function parseControlUiSessionReturnPath(e,t){if(!e.startsWith(`/`)||e.startsWith(`//`)||containsAsciiControlCharacter(e)||/[\\ #]/u.test(e))return null;const n=URL.parse(e,`http://localhost`);if(!n||`${n.pathname}${n.search}`!==e||[...n.searchParams].some(([e,t])=>n.searchParams.getAll(e).length>1||!RETURN_PATH_QUERY_VALIDATORS.get(e)?.(t)))return null;const r=parseControlUiSessionPath(n.pathname,t);return r?.namespace===`chat`?r:null}function buildControlUiSessionEntryUrl(e,t){return`${controlUiSessionEntryPath(t)}?${new URLSearchParams({path:e})}`}export{parseControlUiSessionReturnPath as i,controlUiSessionEntryPath as n,isControlUiSessionReturnPathQueryKey as r,buildControlUiSessionEntryUrl as t};