openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 1.64 kB
JavaScript
import{Fn as object,Jn as string,Pn as number,Yt as discriminatedUnion,xn as literal}from"./schemas-DuCQi-Qb.mjs";import{n as decodeWorkerRequest}from"./protocol-record-DLQ06AtL.mjs";
//!src/worker/node-workspace-prepared-protocol.ts
const Identifier=string().min(1).max(256).refine(e=>e.trim()===e&&!e.includes(`\0`));const Identity=object({gatewayNamespace:Identifier.regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/u),environmentId:Identifier,preparationKey:string().regex(/^[a-f0-9]{64}$/u),cacheKey:string().regex(/^[a-f0-9]{64}$/u)});const WorkspacePath=string().min(1).max(4096).refine(e=>!e.includes(`\0`));const Paths=object({workspaceDir:WorkspacePath,homeDir:WorkspacePath,sourceManifestRef:string().regex(/^sha256:[a-f0-9]{64}$/u),preparedManifestRef:string().regex(/^sha256:[a-f0-9]{64}$/u)});const Registration=Identity.extend({action:literal(`register`),...Paths.shape}).strict();const Binding=Identity.extend({action:literal(`bind`),sessionId:Identifier,sessionKey:string().min(1).max(1024).refine(e=>e.trim()===e&&!e.includes(`\0`)),ownerEpoch:number().int().min(1).max(Number.MAX_SAFE_INTEGER)}).strict();const Input=discriminatedUnion(`action`,[Registration,Binding]);const Result=Identity.extend(Paths.shape).strict();function parseNodeWorkerPreparedWorkspaceInput(e){const t=decodeWorkerRequest(e,16384,`prepared workspace`);const n=Input.safeParse(t);if(!n.success)throw new Error(`INVALID_REQUEST: invalid prepared workspace request`);return n.data}function parseNodeWorkerPreparedWorkspaceResult(e){return Result.safeParse(e).data}export{parseNodeWorkerPreparedWorkspaceResult as n,parseNodeWorkerPreparedWorkspaceInput as t};