UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 2.1 kB
import{i as e}from"./git-operation.worker-record-coerce-BUlpHiHI.mjs";import{i as t,p as n,r,u as i}from"./git-operation.worker-schemas-6aIgnnYb.mjs";((e,n=256)=>t(e=>typeof e==`string`&&e.length>0&&e.length<=n&&e.trim()===e&&!e.includes(`\0`),{error:`INVALID_REQUEST: ${e} must be a bounded non-empty identifier`}))(`gatewayNamespace`).refine(e=>/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/u.test(e),{error:`INVALID_REQUEST: gatewayNamespace must be a safe bounded path component`});function hasExactOwnKeys(e,t,n=[]){return t.every(t=>Object.hasOwn(e,t))&&n.every(t=>Object.hasOwn(e,t)||!Reflect.has(e,t))&&Object.keys(e).every(e=>t.includes(e)||n.includes(e))}function workerProtocolObject(n){let r=[],a=[];for(let[e,t]of Object.entries(n))(t.isOptional()?a:r).push(e);return t(t=>e(t)&&hasExactOwnKeys(t,r,a)).pipe(i(n))}const a=workerProtocolObject({baseCommit:n().regex(/^[a-f0-9]{40}(?:[a-f0-9]{24})?$/u),headCommit:n().regex(/^[a-f0-9]{40}(?:[a-f0-9]{24})?$/u),descendsFromBase:r(),unavailableReason:n().max(512).optional()}),o=`OpenClaw worker workspace result`;var WorkspaceStageCurrentPathError=class extends Error{constructor(...e){super(...e),this.code=`WORKSPACE_STAGE_CURRENT_PATH_UNSAFE`}};const s=/^refs\/openclaw\/workspace-base-refresh\/[a-f0-9]{64}$/u;function isLocalWorkspaceBaseRefreshRef(e){return e!==null&&s.test(e)}function requireWorkerResultStorageRef(e){if(!(/* @__PURE__ */ RegExp(`^(?:refs/openclaw/worker-results|refs/openclaw/worker-result-candidates|refs/openclaw/worker-result-cleanup)/[A-Za-z0-9-]+$`,`u`)).test(e)&&!isLocalWorkspaceBaseRefreshRef(e))throw Error(`Cloud workspace staged result reference is invalid`);return e}const c=67108864;function stagedWorkspaceEntryBytes(e){return e.type===`file`?e.size:Buffer.byteLength(e.target)}function resolveStagedWorkspaceReadEntry(e,t){let n=e.get(t.path);if(!n)throw Error(`Cloud workspace result has no payload for ${t.path}`);return{object:n,entry:t}}export{requireWorkerResultStorageRef as a,WorkspaceStageCurrentPathError as i,c as n,resolveStagedWorkspaceReadEntry as o,a as r,stagedWorkspaceEntryBytes as s,o as t};