@reason-machines/cli-linux-arm64-musl 0.2.286 → 0.2.287

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/bin/ara +1 -1
  2. package/bin/vm-hands/connect-cli-t99kw2qq.js +2 -0
  3. package/bin/vm-hands/{custom-endpoint-device-7kd3qh6r.js → custom-endpoint-device-tv4wtdb2.js} +1 -1
  4. package/bin/vm-hands/desktop-account-vr5beh82.js +2 -0
  5. package/bin/vm-hands/device-workspace-s5z0zr53.js +2 -0
  6. package/bin/vm-hands/{hands-worker-source-wddm7sdp.js → hands-worker-source-xvkfkf6v.js} +1 -1
  7. package/bin/vm-hands/{index-9aw1gjs5.js → index-bwnyk312.js} +1 -1
  8. package/bin/vm-hands/local-automation-x1eq4jgd.js +2 -0
  9. package/bin/vm-hands/local-capabilities-8ng9374s.js +2 -0
  10. package/bin/vm-hands/local-desktop-users-vztj8kn8.js +2 -0
  11. package/bin/vm-hands/{local-display-mac-rp51a8w7.js → local-display-mac-4mtwfgty.js} +1 -1
  12. package/bin/vm-hands/local-display-session-yx4ss54w.js +2 -0
  13. package/bin/vm-hands/{network-contract-wkc0ycet.js → network-contract-y6kbgyhe.js} +1 -1
  14. package/bin/vm-hands/package-q8gdr1z1.js +2 -0
  15. package/bin/vm-hands/permissions-16a3qfnv.js +2 -0
  16. package/bin/vm-hands/{reason-hands-protocol-zcnd1srf.js → reason-hands-protocol-5wqth9ga.js} +1 -1
  17. package/bin/vm-hands/{status-9grfvv20.js → status-1k5hzszn.js} +2 -2
  18. package/bin/vm-hands/version-46mxn34x.js +2 -0
  19. package/bin/vm-hands/{vm-hands-entry-lite-yvmzze06.js → vm-hands-entry-lite-250sqsry.js} +1 -1
  20. package/bin/vm-hands/{vm-hands-entry-lite-5m5d6fne.js → vm-hands-entry-lite-3nfhybjy.js} +1 -1
  21. package/bin/vm-hands/{vm-hands-entry-lite-p8yz62gj.js → vm-hands-entry-lite-5bw3nakm.js} +1 -1
  22. package/bin/vm-hands/{vm-hands-entry-lite-94nvv1qx.js → vm-hands-entry-lite-5r3y8qb3.js} +2 -2
  23. package/bin/vm-hands/{vm-hands-entry-lite-yh7n4svm.js → vm-hands-entry-lite-5zzey257.js} +1 -1
  24. package/bin/vm-hands/{vm-hands-entry-lite-k901yfkm.js → vm-hands-entry-lite-7y54b8zg.js} +2 -2
  25. package/bin/vm-hands/{vm-hands-entry-lite-ss2w3h3d.js → vm-hands-entry-lite-a3n86qqm.js} +1 -1
  26. package/bin/vm-hands/{vm-hands-entry-lite-kbwr4e6f.js → vm-hands-entry-lite-b3w7btv5.js} +1 -1
  27. package/bin/vm-hands/{vm-hands-entry-lite-gfynf6jv.js → vm-hands-entry-lite-cfjx91rj.js} +1 -1
  28. package/bin/vm-hands/{vm-hands-entry-lite-y9k070mt.js → vm-hands-entry-lite-d94sv87n.js} +2 -2
  29. package/bin/vm-hands/{vm-hands-entry-lite-8byz0e1v.js → vm-hands-entry-lite-emhms7vf.js} +2 -2
  30. package/bin/vm-hands/{vm-hands-entry-lite-d2wyay7h.js → vm-hands-entry-lite-g15qv71g.js} +2 -2
  31. package/bin/vm-hands/{vm-hands-entry-lite-76hys77m.js → vm-hands-entry-lite-h7bvtc3g.js} +2 -2
  32. package/bin/vm-hands/{vm-hands-entry-lite-m5pmd2cz.js → vm-hands-entry-lite-h7ndfgwc.js} +1 -1
  33. package/bin/vm-hands/{vm-hands-entry-lite-h2xpqaxn.js → vm-hands-entry-lite-mk9p22xa.js} +1 -1
  34. package/bin/vm-hands/{vm-hands-entry-lite-85cf0jww.js → vm-hands-entry-lite-mysjgrwy.js} +1 -1
  35. package/bin/vm-hands/{vm-hands-entry-lite-mxavr4y3.js → vm-hands-entry-lite-ngvxyjhy.js} +2 -2
  36. package/bin/vm-hands/{vm-hands-entry-lite-shde1mg2.js → vm-hands-entry-lite-pr65ksfz.js} +1 -1
  37. package/bin/vm-hands/{vm-hands-entry-lite-whcnpjdx.js → vm-hands-entry-lite-qdwm3ya8.js} +1 -1
  38. package/bin/vm-hands/{vm-hands-entry-lite-wffqkcjq.js → vm-hands-entry-lite-sn3vjjgx.js} +1 -1
  39. package/bin/vm-hands/{vm-hands-entry-lite-yf8h8gmh.js → vm-hands-entry-lite-tkpfs08y.js} +1 -1
  40. package/bin/vm-hands/{vm-hands-entry-lite-5vrdj7jm.js → vm-hands-entry-lite-yadv8a82.js} +1 -1
  41. package/bin/vm-hands/{vm-hands-entry-lite-ee8txzdd.js → vm-hands-entry-lite-yeqhevk8.js} +1 -1
  42. package/bin/vm-hands/{vm-hands-entry-lite-4fnbmmp6.js → vm-hands-entry-lite-z7twr5ec.js} +1 -1
  43. package/bin/vm-hands/{vm-hands-entry-lite-hnq065fd.js → vm-hands-entry-lite-zmf3vn3w.js} +1 -1
  44. package/bin/vm-hands/vm-hands-entry-lite.js +1 -1
  45. package/bin/vm-hands/{vm-hands-executor-82wtd24g.js → vm-hands-executor-ynpf1mhj.js} +1 -1
  46. package/bin/vm-hands/{vm-hands-op-runner-1848vv0m.js → vm-hands-op-runner-z1mmfwpq.js} +1 -1
  47. package/bin/vm-hands/{vm-hands-runtime-dmk9hnwr.js → vm-hands-runtime-jnfxxb6d.js} +3 -3
  48. package/bin/vm-hands/worker-sandbox-wqxffxa1.js +2 -0
  49. package/package.json +1 -1
  50. package/bin/vm-hands/connect-cli-0g851qhv.js +0 -2
  51. package/bin/vm-hands/desktop-account-8z3zns7q.js +0 -2
  52. package/bin/vm-hands/device-workspace-pkcqavr9.js +0 -2
  53. package/bin/vm-hands/local-automation-70sarejz.js +0 -2
  54. package/bin/vm-hands/local-capabilities-0842mh3q.js +0 -2
  55. package/bin/vm-hands/local-desktop-users-nxyv3mk1.js +0 -2
  56. package/bin/vm-hands/local-display-session-1tzx2c36.js +0 -2
  57. package/bin/vm-hands/package-56yg8k4a.js +0 -2
  58. package/bin/vm-hands/permissions-1dzt3phg.js +0 -2
  59. package/bin/vm-hands/version-4m73yc89.js +0 -2
  60. package/bin/vm-hands/worker-sandbox-4c9302zr.js +0 -2
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- var r={name:"github-native-engineer-device-worker-production",version:"0.2.286",private:!0,type:"module",engines:{node:">=22",bun:">=1.3.0"},workspaces:["../../packages/runtime-distribution"],dependencies:{"@anthropic-ai/sandbox-runtime":"^0.0.73","@earendil-works/pi-tui":"1.0.0","@modelcontextprotocol/sdk":"^1.29.0","@reason/runtime-distribution":"workspace:*","playwright-core":"1.60.0",zod:"^4.4.3"},overrides:{"@hono/node-server":"1.19.15","@earendil-works/pi-agent-core":"1.0.0","@earendil-works/pi-ai":"1.0.0","@earendil-works/pi-coding-agent":"1.0.0","@earendil-works/chord":"1.0.0","@earendil-works/pi-codemode":"1.0.0","@earendil-works/pi-mcp":"1.0.0","@earendil-works/pi-telemetry":"1.0.0","@earendil-works/pi-tui":"1.0.0","brace-expansion":"2.1.7",axios:"1.20.0","basic-ftp":"6.2.1","@grpc/grpc-js":"1.14.5",browserslist:"4.28.8","engine.io":"6.6.7","fast-uri":"3.1.8",hono:"^4.13.7","ip-address":"10.7.1",nanoid:"3.3.18",dompurify:"3.4.13",postcss:"8.5.23",qs:"6.16.0","shell-quote":"1.11.0","socket.io-parser":"4.2.7",tmp:"0.2.7",toml:"4.2.0",undici:"8.10.2",ws:"^8.21.0","js-yaml":"4.3.2","@modelcontextprotocol/sdk":"1.31.0","proxy-addr":"2.0.8","source-map-js":"1.2.2"}};
3
- export{r as Ah};
2
+ var r={name:"github-native-engineer-device-worker-production",version:"0.2.287",private:!0,type:"module",engines:{node:">=22",bun:">=1.3.0"},workspaces:["../../packages/runtime-distribution"],dependencies:{"@anthropic-ai/sandbox-runtime":"^0.0.73","@earendil-works/pi-tui":"1.0.0","@modelcontextprotocol/sdk":"^1.29.0","@reason/runtime-distribution":"workspace:*","playwright-core":"1.60.0",zod:"^4.4.3"},overrides:{"@hono/node-server":"1.19.15","@earendil-works/pi-agent-core":"1.0.0","@earendil-works/pi-ai":"1.0.0","@earendil-works/pi-coding-agent":"1.0.0","@earendil-works/chord":"1.0.0","@earendil-works/pi-codemode":"1.0.0","@earendil-works/pi-mcp":"1.0.0","@earendil-works/pi-telemetry":"1.0.0","@earendil-works/pi-tui":"1.0.0","brace-expansion":"2.1.7",axios:"1.20.0","basic-ftp":"6.2.1","@grpc/grpc-js":"1.14.5",browserslist:"4.28.8","engine.io":"6.6.7","fast-uri":"3.1.8",hono:"^4.13.7","ip-address":"10.7.1",nanoid:"3.3.18",dompurify:"3.4.13",postcss:"8.5.23",qs:"6.16.0","shell-quote":"1.11.0","socket.io-parser":"4.2.7",tmp:"0.2.7",toml:"4.2.0",undici:"8.10.2",ws:"^8.21.0","js-yaml":"4.3.2","@modelcontextprotocol/sdk":"1.31.0","proxy-addr":"2.0.8","source-map-js":"1.2.2"}};
3
+ export{r as Bh};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Lh as s}from"./vm-hands-entry-lite-ss2w3h3d.js";var mc={};s(mc,{xor:()=>Zl,xid:()=>kl,void:()=>Bl,uuidv7:()=>$l,uuidv6:()=>ul,uuidv4:()=>el,uuid:()=>vl,util:()=>k,url:()=>gl,uppercase:()=>Xr,unknown:()=>mr,union:()=>gt,undefined:()=>Tl,ulid:()=>Ul,uint64:()=>Ql,uint32:()=>ql,tuple:()=>Q$,trim:()=>Tr,treeifyError:()=>Lt,transform:()=>ct,toUpperCase:()=>Br,toLowerCase:()=>Hr,toJSONSchema:()=>Yi,templateLiteral:()=>uc,symbol:()=>Fl,superRefine:()=>cg,success:()=>tc,stringbool:()=>Uc,stringFormat:()=>Ll,string:()=>On,strictObject:()=>Rl,startsWith:()=>Kr,slugify:()=>Mr,size:()=>Dr,setErrorMap:()=>i4,set:()=>pl,safeParseAsync:()=>c$,safeParse:()=>l$,safeEncodeAsync:()=>w$,safeEncode:()=>k$,safeDecodeAsync:()=>S$,safeDecode:()=>D$,registry:()=>ui,regexes:()=>d,regex:()=>Ar,refine:()=>lg,record:()=>F$,readonly:()=>og,property:()=>Vi,promise:()=>$c,prettifyError:()=>Et,preprocess:()=>Dc,prefault:()=>y$,positive:()=>Ei,pipe:()=>di,partialRecord:()=>hl,parseAsync:()=>g$,parse:()=>$$,overwrite:()=>f,optional:()=>Pn,object:()=>xl,number:()=>N$,nullish:()=>ic,nullable:()=>Jn,null:()=>J$,normalize:()=>Fr,nonpositive:()=>Wi,nonoptional:()=>a$,nonnegative:()=>Ai,never:()=>$t,negative:()=>Gi,nativeEnum:()=>sl,nanoid:()=>Il,nan:()=>oc,multipleOf:()=>ur,minSize:()=>a,minLength:()=>nr,mime:()=>Qr,meta:()=>bc,maxSize:()=>$r,maxLength:()=>wr,map:()=>al,mac:()=>Sl,lte:()=>x,lt:()=>h,lowercase:()=>Vr,looseRecord:()=>yl,looseObject:()=>fl,locales:()=>Sn,literal:()=>rc,length:()=>Sr,lazy:()=>ug,ksuid:()=>Dl,keyof:()=>dl,jwt:()=>Jl,json:()=>kc,iso:()=>Rr,ipv6:()=>ml,ipv4:()=>wl,invertCodec:()=>ec,intersection:()=>K$,int64:()=>Yl,int32:()=>Xl,int:()=>Mi,instanceof:()=>_c,includes:()=>qr,httpUrl:()=>ll,hostname:()=>El,hex:()=>Gl,hash:()=>Wl,guid:()=>ol,gte:()=>Q,gt:()=>y,globalRegistry:()=>X,getErrorMap:()=>t4,function:()=>gc,fromJSONSchema:()=>Sc,formatError:()=>$n,float64:()=>Vl,float32:()=>Al,flattenError:()=>un,file:()=>nc,exactOptional:()=>R$,enum:()=>lt,endsWith:()=>Yr,encodeAsync:()=>_$,encode:()=>I$,emoji:()=>cl,email:()=>tl,e164:()=>Pl,discriminatedUnion:()=>Cl,describe:()=>Ic,decodeAsync:()=>U$,decode:()=>b$,date:()=>Ml,custom:()=>cc,cuid2:()=>_l,cuid:()=>bl,core:()=>ir,config:()=>W,coerce:()=>bg,codec:()=>vc,clone:()=>K,cidrv6:()=>zl,cidrv4:()=>Nl,check:()=>lc,catch:()=>rg,boolean:()=>z$,bigint:()=>Kl,base64url:()=>jl,base64:()=>Ol,array:()=>Wn,any:()=>Hl,_function:()=>gc,_default:()=>C$,_ZodString:()=>xi,ZodXor:()=>V$,ZodXID:()=>ai,ZodVoid:()=>W$,ZodUnknown:()=>E$,ZodUnion:()=>Vn,ZodUndefined:()=>j$,ZodUUID:()=>p,ZodURL:()=>En,ZodULID:()=>yi,ZodType:()=>O,ZodTuple:()=>Y$,ZodTransform:()=>d$,ZodTemplateLiteral:()=>vg,ZodSymbol:()=>O$,ZodSuccess:()=>p$,ZodStringFormat:()=>L,ZodString:()=>Cr,ZodSet:()=>H$,ZodRecord:()=>fr,ZodRealError:()=>M,ZodReadonly:()=>tg,ZodPromise:()=>$g,ZodPreprocess:()=>ig,ZodPrefault:()=>h$,ZodPipe:()=>Xn,ZodOptional:()=>It,ZodObject:()=>An,ZodNumberFormat:()=>Nr,ZodNumber:()=>yr,ZodNullable:()=>f$,ZodNull:()=>P$,ZodNonOptional:()=>bt,ZodNever:()=>G$,ZodNanoID:()=>Zi,ZodNaN:()=>ng,ZodMap:()=>T$,ZodMAC:()=>m$,ZodLiteral:()=>B$,ZodLazy:()=>eg,ZodKSUID:()=>pi,ZodJWT:()=>et,ZodIssueCode:()=>n4,ZodIntersection:()=>q$,ZodISOTime:()=>Hi,ZodISODuration:()=>Bi,ZodISODateTime:()=>Fi,ZodISODate:()=>Ti,ZodIPv6:()=>rt,ZodIPv4:()=>si,ZodGUID:()=>jn,ZodFunction:()=>gg,ZodFirstPartyTypeKind:()=>Ig,ZodFile:()=>M$,ZodExactOptional:()=>x$,ZodError:()=>sb,ZodEnum:()=>Zr,ZodEmoji:()=>fi,ZodEmail:()=>Ri,ZodE164:()=>vt,ZodDiscriminatedUnion:()=>X$,ZodDefault:()=>Z$,ZodDate:()=>Gn,ZodCustomStringFormat:()=>hr,ZodCustom:()=>Kn,ZodCodec:()=>qn,ZodCatch:()=>s$,ZodCUID2:()=>hi,ZodCUID:()=>Ci,ZodCIDRv6:()=>it,ZodCIDRv4:()=>nt,ZodBoolean:()=>ar,ZodBigIntFormat:()=>ut,ZodBigInt:()=>pr,ZodBase64URL:()=>ot,ZodBase64:()=>tt,ZodArray:()=>A$,ZodAny:()=>L$,TimePrecision:()=>Qe,NEVER:()=>Ut,$output:()=>Ae,$input:()=>Ve,$brand:()=>kt});var ir={};s(ir,{version:()=>jo,util:()=>k,treeifyError:()=>Lt,toJSONSchema:()=>Yi,toDotPath:()=>zg,safeParseAsync:()=>Wt,safeParse:()=>Gt,safeEncodeAsync:()=>nI,safeEncode:()=>sc,safeDecodeAsync:()=>iI,safeDecode:()=>rI,registry:()=>ui,regexes:()=>d,process:()=>P,prettifyError:()=>Et,parseAsync:()=>Tn,parse:()=>Fn,meta:()=>Du,locales:()=>Sn,isValidJWT:()=>xg,isValidBase64URL:()=>dg,isValidBase64:()=>Zo,initializeContext:()=>gr,globalRegistry:()=>X,globalConfig:()=>Ir,formatError:()=>$n,flattenError:()=>un,finalize:()=>cr,extractDefs:()=>lr,encodeAsync:()=>ac,encode:()=>hc,describe:()=>ku,decodeAsync:()=>pc,decode:()=>yc,createToJSONSchemaMethod:()=>Su,createStandardJSONSchemaMethod:()=>xr,config:()=>W,clone:()=>K,_xor:()=>Gb,_xid:()=>wi,_void:()=>uu,_uuidv7:()=>Ii,_uuidv6:()=>ci,_uuidv4:()=>li,_uuid:()=>gi,_url:()=>Nn,_uppercase:()=>Xr,_unknown:()=>vu,_union:()=>Eb,_undefined:()=>iu,_ulid:()=>Di,_uint64:()=>ru,_uint32:()=>Ce,_tuple:()=>Vb,_trim:()=>Tr,_transform:()=>Tb,_toUpperCase:()=>Br,_toLowerCase:()=>Hr,_templateLiteral:()=>Cb,_symbol:()=>nu,_superRefine:()=>Uu,_success:()=>xb,_stringbool:()=>wu,_stringFormat:()=>dr,_string:()=>qe,_startsWith:()=>Kr,_slugify:()=>Mr,_size:()=>Dr,_set:()=>Kb,_safeParseAsync:()=>Er,_safeParse:()=>Lr,_safeEncodeAsync:()=>fn,_safeEncode:()=>xn,_safeDecodeAsync:()=>Zn,_safeDecode:()=>Rn,_regex:()=>Ar,_refine:()=>_u,_record:()=>Xb,_readonly:()=>Zb,_property:()=>Vi,_promise:()=>yb,_positive:()=>Ei,_pipe:()=>fb,_parseAsync:()=>Jr,_parse:()=>Pr,_overwrite:()=>f,_optional:()=>Hb,_number:()=>Me,_nullable:()=>Bb,_null:()=>tu,_normalize:()=>Fr,_nonpositive:()=>Wi,_nonoptional:()=>db,_nonnegative:()=>Ai,_never:()=>eu,_negative:()=>Gi,_nativeEnum:()=>Qb,_nanoid:()=>_i,_nan:()=>lu,_multipleOf:()=>ur,_minSize:()=>a,_minLength:()=>nr,_min:()=>Q,_mime:()=>Qr,_maxSize:()=>$r,_maxLength:()=>wr,_max:()=>x,_map:()=>qb,_mac:()=>Ye,_lte:()=>x,_lt:()=>h,_lowercase:()=>Vr,_literal:()=>Fb,_length:()=>Sr,_lazy:()=>hb,_ksuid:()=>Si,_jwt:()=>Li,_isoTime:()=>He,_isoDuration:()=>Be,_isoDateTime:()=>Fe,_isoDate:()=>Te,_ipv6:()=>Ni,_ipv4:()=>mi,_intersection:()=>Ab,_int64:()=>se,_int32:()=>Ze,_int:()=>xe,_includes:()=>qr,_guid:()=>mn,_gte:()=>Q,_gt:()=>y,_float64:()=>fe,_float32:()=>Re,_file:()=>Iu,_enum:()=>Yb,_endsWith:()=>Yr,_encodeAsync:()=>Mn,_encode:()=>Hn,_emoji:()=>bi,_email:()=>$i,_e164:()=>Ji,_discriminatedUnion:()=>Wb,_default:()=>Mb,_decodeAsync:()=>dn,_decode:()=>Bn,_date:()=>$u,_custom:()=>bu,_cuid2:()=>ki,_cuid:()=>Ui,_coercedString:()=>Ke,_coercedNumber:()=>de,_coercedDate:()=>gu,_coercedBoolean:()=>ye,_coercedBigint:()=>pe,_cidrv6:()=>Oi,_cidrv4:()=>zi,_check:()=>sg,_catch:()=>Rb,_boolean:()=>he,_bigint:()=>ae,_base64url:()=>Pi,_base64:()=>ji,_array:()=>cu,_any:()=>ou,TimePrecision:()=>Qe,NEVER:()=>Ut,JSONSchemaGenerator:()=>t$,JSONSchema:()=>rl,Doc:()=>an,$output:()=>Ae,$input:()=>Ve,$constructor:()=>l,$brand:()=>kt,$ZodXor:()=>cv,$ZodXID:()=>Ko,$ZodVoid:()=>uv,$ZodUnknown:()=>vv,$ZodUnion:()=>bn,$ZodUndefined:()=>iv,$ZodUUID:()=>Lo,$ZodURL:()=>Go,$ZodULID:()=>qo,$ZodType:()=>z,$ZodTuple:()=>oi,$ZodTransform:()=>mv,$ZodTemplateLiteral:()=>Av,$ZodSymbol:()=>nv,$ZodSuccess:()=>Jv,$ZodStringFormat:()=>J,$ZodString:()=>kr,$ZodSet:()=>kv,$ZodRegistry:()=>Xe,$ZodRecord:()=>_v,$ZodRealError:()=>B,$ZodReadonly:()=>Wv,$ZodPromise:()=>Xv,$ZodPreprocess:()=>Gv,$ZodPrefault:()=>jv,$ZodPipe:()=>ei,$ZodOptional:()=>vi,$ZodObjectJIT:()=>lv,$ZodObject:()=>Zg,$ZodNumberFormat:()=>so,$ZodNumber:()=>ii,$ZodNullable:()=>zv,$ZodNull:()=>tv,$ZodNonOptional:()=>Pv,$ZodNever:()=>ev,$ZodNanoID:()=>Ao,$ZodNaN:()=>Ev,$ZodMap:()=>Uv,$ZodMAC:()=>xo,$ZodLiteral:()=>wv,$ZodLazy:()=>qv,$ZodKSUID:()=>Yo,$ZodJWT:()=>ao,$ZodIntersection:()=>bv,$ZodISOTime:()=>To,$ZodISODuration:()=>Ho,$ZodISODateTime:()=>Qo,$ZodISODate:()=>Fo,$ZodIPv6:()=>Mo,$ZodIPv4:()=>Bo,$ZodGUID:()=>Jo,$ZodFunction:()=>Vv,$ZodFile:()=>Sv,$ZodExactOptional:()=>Nv,$ZodError:()=>en,$ZodEnum:()=>Dv,$ZodEncodeError:()=>br,$ZodEmoji:()=>Wo,$ZodEmail:()=>Eo,$ZodE164:()=>yo,$ZodDiscriminatedUnion:()=>Iv,$ZodDefault:()=>Ov,$ZodDate:()=>$v,$ZodCustomStringFormat:()=>po,$ZodCustom:()=>Kv,$ZodCodec:()=>_n,$ZodCheckUpperCase:()=>Do,$ZodCheckStringFormat:()=>Gr,$ZodCheckStartsWith:()=>So,$ZodCheckSizeEquals:()=>co,$ZodCheckRegex:()=>Uo,$ZodCheckProperty:()=>No,$ZodCheckOverwrite:()=>Oo,$ZodCheckNumberFormat:()=>uo,$ZodCheckMultipleOf:()=>eo,$ZodCheckMinSize:()=>lo,$ZodCheckMinLength:()=>bo,$ZodCheckMimeType:()=>zo,$ZodCheckMaxSize:()=>go,$ZodCheckMaxLength:()=>Io,$ZodCheckLowerCase:()=>ko,$ZodCheckLessThan:()=>hn,$ZodCheckLengthEquals:()=>_o,$ZodCheckIncludes:()=>wo,$ZodCheckGreaterThan:()=>yn,$ZodCheckEndsWith:()=>mo,$ZodCheckBigIntFormat:()=>$o,$ZodCheck:()=>E,$ZodCatch:()=>Lv,$ZodCUID2:()=>Xo,$ZodCUID:()=>Vo,$ZodCIDRv6:()=>fo,$ZodCIDRv4:()=>Ro,$ZodBoolean:()=>In,$ZodBigIntFormat:()=>rv,$ZodBigInt:()=>ti,$ZodBase64URL:()=>ho,$ZodBase64:()=>Co,$ZodAsyncError:()=>C,$ZodArray:()=>gv,$ZodAny:()=>ov});var kg,Ut=Object.freeze({status:"aborted"});function l(n,i,o){function v(u,g){if(!u._zod)Object.defineProperty(u,"_zod",{value:{def:g,constr:e,traits:new Set},enumerable:!1});if(u._zod.traits.has(n))return;u._zod.traits.add(n),i(u,g);let $=e.prototype,c=Object.keys($);for(let b=0;b<c.length;b++){let S=c[b];if(!(S in u))u[S]=$[S].bind(u)}}let r=o?.Parent??Object;class t extends r{}Object.defineProperty(t,"name",{value:n});function e(u){var g;let $=o?.Parent?new t:this;v($,u),(g=$._zod).deferred??(g.deferred=[]);for(let c of $._zod.deferred)c();return $}return Object.defineProperty(e,"init",{value:v}),Object.defineProperty(e,Symbol.hasInstance,{value:(u)=>{if(o?.Parent&&u instanceof o.Parent)return!0;return u?._zod?.traits?.has(n)}}),Object.defineProperty(e,"name",{value:n}),e}var kt=Symbol("zod_brand");class C extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class br extends Error{constructor(n){super(`Encountered unidirectional transform during encode: ${n}`);this.name="ZodEncodeError"}}(kg=globalThis).__zod_globalConfig??(kg.__zod_globalConfig={});var Ir=globalThis.__zod_globalConfig;function W(n){if(n)Object.assign(Ir,n);return Ir}var k={};s(k,{unwrapMessage:()=>sr,uint8ArrayToHex:()=>Zc,uint8ArrayToBase64url:()=>Rc,uint8ArrayToBase64:()=>Sg,stringifyPrimitive:()=>_,slugify:()=>St,shallowClone:()=>Nt,safeExtend:()=>Tc,required:()=>Mc,randomString:()=>Vc,propertyKeyTypes:()=>tn,promiseAllObject:()=>Ac,primitiveTypes:()=>zt,prefixIssues:()=>H,pick:()=>Yc,partial:()=>Bc,parsedType:()=>U,optionalKeys:()=>Ot,omit:()=>Qc,objectClone:()=>Ec,numKeys:()=>Xc,nullish:()=>tr,normalizeParams:()=>w,mergeDefs:()=>rr,merge:()=>Hc,jsonStringifyReplacer:()=>zr,joinValues:()=>I,issue:()=>jr,isPlainObject:()=>vr,isObject:()=>_r,hexToUint8Array:()=>fc,getSizableOrigin:()=>on,getParsedType:()=>qc,getLengthableOrigin:()=>vn,getEnumValues:()=>rn,getElementAtPath:()=>Wc,floatSafeRemainder:()=>wt,finalizeIssue:()=>Y,extend:()=>Fc,explicitlyAborted:()=>Jt,escapeRegex:()=>R,esc:()=>Yn,defineLazy:()=>j,createTransparentProxy:()=>Kc,cloneDef:()=>Gc,clone:()=>K,cleanRegex:()=>nn,cleanEnum:()=>dc,captureStackTrace:()=>Qn,cached:()=>Or,base64urlToUint8Array:()=>xc,base64ToUint8Array:()=>wg,assignProp:()=>or,assertNotEqual:()=>jc,assertNever:()=>Jc,assertIs:()=>Pc,assertEqual:()=>Oc,assert:()=>Lc,allowsEval:()=>mt,aborted:()=>er,NUMBER_FORMAT_RANGES:()=>jt,Class:()=>mg,BIGINT_FORMAT_RANGES:()=>Pt});function Oc(n){return n}function jc(n){return n}function Pc(n){}function Jc(n){throw Error("Unexpected value in exhaustive check")}function Lc(n){}function rn(n){let i=Object.values(n).filter((v)=>typeof v==="number");return Object.entries(n).filter(([v,r])=>i.indexOf(+v)===-1).map(([v,r])=>r)}function I(n,i="|"){return n.map((o)=>_(o)).join(i)}function zr(n,i){if(typeof i==="bigint")return i.toString();return i}function Or(n){return{get value(){{let o=n();return Object.defineProperty(this,"value",{value:o}),o}throw Error("cached value already set")}}}function tr(n){return n===null||n===void 0}function nn(n){let i=n.startsWith("^")?1:0,o=n.endsWith("$")?n.length-1:n.length;return n.slice(i,o)}function wt(n,i){let o=n/i,v=Math.round(o),r=Number.EPSILON*Math.max(Math.abs(o),1);if(Math.abs(o-v)<r)return 0;return o-v}var Dg=Symbol("evaluating");function j(n,i,o){let v=void 0;Object.defineProperty(n,i,{get(){if(v===Dg)return;if(v===void 0)v=Dg,v=o();return v},set(r){Object.defineProperty(n,i,{value:r})},configurable:!0})}function Ec(n){return Object.create(Object.getPrototypeOf(n),Object.getOwnPropertyDescriptors(n))}function or(n,i,o){Object.defineProperty(n,i,{value:o,writable:!0,enumerable:!0,configurable:!0})}function rr(...n){let i={};for(let o of n){let v=Object.getOwnPropertyDescriptors(o);Object.assign(i,v)}return Object.defineProperties({},i)}function Gc(n){return rr(n._zod.def)}function Wc(n,i){if(!i)return n;return i.reduce((o,v)=>o?.[v],n)}function Ac(n){let i=Object.keys(n),o=i.map((v)=>n[v]);return Promise.all(o).then((v)=>{let r={};for(let t=0;t<i.length;t++)r[i[t]]=v[t];return r})}function Vc(n=10){let o="";for(let v=0;v<n;v++)o+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return o}function Yn(n){return JSON.stringify(n)}function St(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Qn="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function _r(n){return typeof n==="object"&&n!==null&&!Array.isArray(n)}var mt=Or(()=>{if(Ir.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(n){return!1}});function vr(n){if(_r(n)===!1)return!1;let i=n.constructor;if(i===void 0)return!0;if(typeof i!=="function")return!0;let o=i.prototype;if(_r(o)===!1)return!1;if(Object.prototype.hasOwnProperty.call(o,"isPrototypeOf")===!1)return!1;return!0}function Nt(n){if(vr(n))return{...n};if(Array.isArray(n))return[...n];if(n instanceof Map)return new Map(n);if(n instanceof Set)return new Set(n);return n}function Xc(n){let i=0;for(let o in n)if(Object.prototype.hasOwnProperty.call(n,o))i++;return i}var qc=(n)=>{let i=typeof n;switch(i){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(n)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(n))return"array";if(n===null)return"null";if(n.then&&typeof n.then==="function"&&n.catch&&typeof n.catch==="function")return"promise";if(typeof Map<"u"&&n instanceof Map)return"map";if(typeof Set<"u"&&n instanceof Set)return"set";if(typeof Date<"u"&&n instanceof Date)return"date";if(typeof File<"u"&&n instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${i}`)}},tn=new Set(["string","number","symbol"]),zt=new Set(["string","number","bigint","boolean","symbol","undefined"]);function R(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function K(n,i,o){let v=new n._zod.constr(i??n._zod.def);if(!i||o?.parent)v._zod.parent=n;return v}function w(n){let i=n;if(!i)return{};if(typeof i==="string")return{error:()=>i};if(i?.message!==void 0){if(i?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");i.error=i.message}if(delete i.message,typeof i.error==="string")return{...i,error:()=>i.error};return i}function Kc(n){let i;return new Proxy({},{get(o,v,r){return i??(i=n()),Reflect.get(i,v,r)},set(o,v,r,t){return i??(i=n()),Reflect.set(i,v,r,t)},has(o,v){return i??(i=n()),Reflect.has(i,v)},deleteProperty(o,v){return i??(i=n()),Reflect.deleteProperty(i,v)},ownKeys(o){return i??(i=n()),Reflect.ownKeys(i)},getOwnPropertyDescriptor(o,v){return i??(i=n()),Reflect.getOwnPropertyDescriptor(i,v)},defineProperty(o,v,r){return i??(i=n()),Reflect.defineProperty(i,v,r)}})}function _(n){if(typeof n==="bigint")return n.toString()+"n";if(typeof n==="string")return`"${n}"`;return`${n}`}function Ot(n){return Object.keys(n).filter((i)=>{return n[i]._zod.optin==="optional"&&n[i]._zod.optout==="optional"})}var jt={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Pt={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Yc(n,i){let o=n._zod.def,v=o.checks;if(v&&v.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let t=rr(n._zod.def,{get shape(){let e={};for(let u in i){if(!(u in o.shape))throw Error(`Unrecognized key: "${u}"`);if(!i[u])continue;e[u]=o.shape[u]}return or(this,"shape",e),e},checks:[]});return K(n,t)}function Qc(n,i){let o=n._zod.def,v=o.checks;if(v&&v.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let t=rr(n._zod.def,{get shape(){let e={...n._zod.def.shape};for(let u in i){if(!(u in o.shape))throw Error(`Unrecognized key: "${u}"`);if(!i[u])continue;delete e[u]}return or(this,"shape",e),e},checks:[]});return K(n,t)}function Fc(n,i){if(!vr(i))throw Error("Invalid input to extend: expected a plain object");let o=n._zod.def.checks;if(o&&o.length>0){let t=n._zod.def.shape;for(let e in i)if(Object.getOwnPropertyDescriptor(t,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let r=rr(n._zod.def,{get shape(){let t={...n._zod.def.shape,...i};return or(this,"shape",t),t}});return K(n,r)}function Tc(n,i){if(!vr(i))throw Error("Invalid input to safeExtend: expected a plain object");let o=rr(n._zod.def,{get shape(){let v={...n._zod.def.shape,...i};return or(this,"shape",v),v}});return K(n,o)}function Hc(n,i){if(n._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let o=rr(n._zod.def,{get shape(){let v={...n._zod.def.shape,...i._zod.def.shape};return or(this,"shape",v),v},get catchall(){return i._zod.def.catchall},checks:i._zod.def.checks??[]});return K(n,o)}function Bc(n,i,o){let r=i._zod.def.checks;if(r&&r.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let e=rr(i._zod.def,{get shape(){let u=i._zod.def.shape,g={...u};if(o)for(let $ in o){if(!($ in u))throw Error(`Unrecognized key: "${$}"`);if(!o[$])continue;g[$]=n?new n({type:"optional",innerType:u[$]}):u[$]}else for(let $ in u)g[$]=n?new n({type:"optional",innerType:u[$]}):u[$];return or(this,"shape",g),g},checks:[]});return K(i,e)}function Mc(n,i,o){let v=rr(i._zod.def,{get shape(){let r=i._zod.def.shape,t={...r};if(o)for(let e in o){if(!(e in t))throw Error(`Unrecognized key: "${e}"`);if(!o[e])continue;t[e]=new n({type:"nonoptional",innerType:r[e]})}else for(let e in r)t[e]=new n({type:"nonoptional",innerType:r[e]});return or(this,"shape",t),t}});return K(i,v)}function er(n,i=0){if(n.aborted===!0)return!0;for(let o=i;o<n.issues.length;o++)if(n.issues[o]?.continue!==!0)return!0;return!1}function Jt(n,i=0){if(n.aborted===!0)return!0;for(let o=i;o<n.issues.length;o++)if(n.issues[o]?.continue===!1)return!0;return!1}function H(n,i){return i.map((o)=>{var v;return(v=o).path??(v.path=[]),o.path.unshift(n),o})}function sr(n){return typeof n==="string"?n:n?.message}function Y(n,i,o){let v=n.message?n.message:sr(n.inst?._zod.def?.error?.(n))??sr(i?.error?.(n))??sr(o.customError?.(n))??sr(o.localeError?.(n))??"Invalid input",{inst:r,continue:t,input:e,...u}=n;if(u.path??(u.path=[]),u.message=v,i?.reportInput)u.input=e;return u}function on(n){if(n instanceof Set)return"set";if(n instanceof Map)return"map";if(n instanceof File)return"file";return"unknown"}function vn(n){if(Array.isArray(n))return"array";if(typeof n==="string")return"string";return"unknown"}function U(n){let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"nan":"number";case"object":{if(n===null)return"null";if(Array.isArray(n))return"array";let o=n;if(o&&Object.getPrototypeOf(o)!==Object.prototype&&"constructor"in o&&o.constructor)return o.constructor.name}}return i}function jr(...n){let[i,o,v]=n;if(typeof i==="string")return{message:i,code:"custom",input:o,inst:v};return{...i}}function dc(n){return Object.entries(n).filter(([i,o])=>{return Number.isNaN(Number.parseInt(i,10))}).map((i)=>i[1])}function wg(n){let i=atob(n),o=new Uint8Array(i.length);for(let v=0;v<i.length;v++)o[v]=i.charCodeAt(v);return o}function Sg(n){let i="";for(let o=0;o<n.length;o++)i+=String.fromCharCode(n[o]);return btoa(i)}function xc(n){let i=n.replace(/-/g,"+").replace(/_/g,"/"),o="=".repeat((4-i.length%4)%4);return wg(i+o)}function Rc(n){return Sg(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function fc(n){let i=n.replace(/^0x/,"");if(i.length%2!==0)throw Error("Invalid hex string length");let o=new Uint8Array(i.length/2);for(let v=0;v<i.length;v+=2)o[v/2]=Number.parseInt(i.slice(v,v+2),16);return o}function Zc(n){return Array.from(n).map((i)=>i.toString(16).padStart(2,"0")).join("")}class mg{constructor(...n){}}var Ng=(n,i)=>{n.name="$ZodError",Object.defineProperty(n,"_zod",{value:n._zod,enumerable:!1}),Object.defineProperty(n,"issues",{value:i,enumerable:!1}),n.message=JSON.stringify(i,zr,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},en=l("$ZodError",Ng),B=l("$ZodError",Ng,{Parent:Error});function un(n,i=(o)=>o.message){let o={},v=[];for(let r of n.issues)if(r.path.length>0)o[r.path[0]]=o[r.path[0]]||[],o[r.path[0]].push(i(r));else v.push(i(r));return{formErrors:v,fieldErrors:o}}function $n(n,i=(o)=>o.message){let o={_errors:[]},v=(r,t=[])=>{for(let e of r.issues)if(e.code==="invalid_union"&&e.errors.length)e.errors.map((u)=>v({issues:u},[...t,...e.path]));else if(e.code==="invalid_key")v({issues:e.issues},[...t,...e.path]);else if(e.code==="invalid_element")v({issues:e.issues},[...t,...e.path]);else{let u=[...t,...e.path];if(u.length===0)o._errors.push(i(e));else{let g=o,$=0;while($<u.length){let c=u[$];if($!==u.length-1)g[c]=g[c]||{_errors:[]};else g[c]=g[c]||{_errors:[]},g[c]._errors.push(i(e));g=g[c],$++}}}};return v(n),o}function Lt(n,i=(o)=>o.message){let o={errors:[]},v=(r,t=[])=>{var e,u;for(let g of r.issues)if(g.code==="invalid_union"&&g.errors.length)g.errors.map(($)=>v({issues:$},[...t,...g.path]));else if(g.code==="invalid_key")v({issues:g.issues},[...t,...g.path]);else if(g.code==="invalid_element")v({issues:g.issues},[...t,...g.path]);else{let $=[...t,...g.path];if($.length===0){o.errors.push(i(g));continue}let c=o,b=0;while(b<$.length){let S=$[b],D=b===$.length-1;if(typeof S==="string")c.properties??(c.properties={}),(e=c.properties)[S]??(e[S]={errors:[]}),c=c.properties[S];else c.items??(c.items=[]),(u=c.items)[S]??(u[S]={errors:[]}),c=c.items[S];if(D)c.errors.push(i(g));b++}}};return v(n),o}function zg(n){let i=[],o=n.map((v)=>typeof v==="object"?v.key:v);for(let v of o)if(typeof v==="number")i.push(`[${v}]`);else if(typeof v==="symbol")i.push(`[${JSON.stringify(String(v))}]`);else if(/[^\w$]/.test(v))i.push(`[${JSON.stringify(v)}]`);else{if(i.length)i.push(".");i.push(v)}return i.join("")}function Et(n){let i=[],o=[...n.issues].sort((v,r)=>(v.path??[]).length-(r.path??[]).length);for(let v of o)if(i.push(`\u2716 ${v.message}`),v.path?.length)i.push(` \u2192 at ${zg(v.path)}`);return i.join(`
2
+ import{Mh as s}from"./vm-hands-entry-lite-a3n86qqm.js";var mc={};s(mc,{xor:()=>Zl,xid:()=>kl,void:()=>Bl,uuidv7:()=>$l,uuidv6:()=>ul,uuidv4:()=>el,uuid:()=>vl,util:()=>k,url:()=>gl,uppercase:()=>Xr,unknown:()=>mr,union:()=>gt,undefined:()=>Tl,ulid:()=>Ul,uint64:()=>Ql,uint32:()=>ql,tuple:()=>Q$,trim:()=>Tr,treeifyError:()=>Lt,transform:()=>ct,toUpperCase:()=>Br,toLowerCase:()=>Hr,toJSONSchema:()=>Yi,templateLiteral:()=>uc,symbol:()=>Fl,superRefine:()=>cg,success:()=>tc,stringbool:()=>Uc,stringFormat:()=>Ll,string:()=>On,strictObject:()=>Rl,startsWith:()=>Kr,slugify:()=>Mr,size:()=>Dr,setErrorMap:()=>i4,set:()=>pl,safeParseAsync:()=>c$,safeParse:()=>l$,safeEncodeAsync:()=>w$,safeEncode:()=>k$,safeDecodeAsync:()=>S$,safeDecode:()=>D$,registry:()=>ui,regexes:()=>d,regex:()=>Ar,refine:()=>lg,record:()=>F$,readonly:()=>og,property:()=>Vi,promise:()=>$c,prettifyError:()=>Et,preprocess:()=>Dc,prefault:()=>y$,positive:()=>Ei,pipe:()=>di,partialRecord:()=>hl,parseAsync:()=>g$,parse:()=>$$,overwrite:()=>f,optional:()=>Pn,object:()=>xl,number:()=>N$,nullish:()=>ic,nullable:()=>Jn,null:()=>J$,normalize:()=>Fr,nonpositive:()=>Wi,nonoptional:()=>a$,nonnegative:()=>Ai,never:()=>$t,negative:()=>Gi,nativeEnum:()=>sl,nanoid:()=>Il,nan:()=>oc,multipleOf:()=>ur,minSize:()=>a,minLength:()=>nr,mime:()=>Qr,meta:()=>bc,maxSize:()=>$r,maxLength:()=>wr,map:()=>al,mac:()=>Sl,lte:()=>x,lt:()=>h,lowercase:()=>Vr,looseRecord:()=>yl,looseObject:()=>fl,locales:()=>Sn,literal:()=>rc,length:()=>Sr,lazy:()=>ug,ksuid:()=>Dl,keyof:()=>dl,jwt:()=>Jl,json:()=>kc,iso:()=>Rr,ipv6:()=>ml,ipv4:()=>wl,invertCodec:()=>ec,intersection:()=>K$,int64:()=>Yl,int32:()=>Xl,int:()=>Mi,instanceof:()=>_c,includes:()=>qr,httpUrl:()=>ll,hostname:()=>El,hex:()=>Gl,hash:()=>Wl,guid:()=>ol,gte:()=>Q,gt:()=>y,globalRegistry:()=>X,getErrorMap:()=>t4,function:()=>gc,fromJSONSchema:()=>Sc,formatError:()=>$n,float64:()=>Vl,float32:()=>Al,flattenError:()=>un,file:()=>nc,exactOptional:()=>R$,enum:()=>lt,endsWith:()=>Yr,encodeAsync:()=>_$,encode:()=>I$,emoji:()=>cl,email:()=>tl,e164:()=>Pl,discriminatedUnion:()=>Cl,describe:()=>Ic,decodeAsync:()=>U$,decode:()=>b$,date:()=>Ml,custom:()=>cc,cuid2:()=>_l,cuid:()=>bl,core:()=>ir,config:()=>W,coerce:()=>bg,codec:()=>vc,clone:()=>K,cidrv6:()=>zl,cidrv4:()=>Nl,check:()=>lc,catch:()=>rg,boolean:()=>z$,bigint:()=>Kl,base64url:()=>jl,base64:()=>Ol,array:()=>Wn,any:()=>Hl,_function:()=>gc,_default:()=>C$,_ZodString:()=>xi,ZodXor:()=>V$,ZodXID:()=>ai,ZodVoid:()=>W$,ZodUnknown:()=>E$,ZodUnion:()=>Vn,ZodUndefined:()=>j$,ZodUUID:()=>p,ZodURL:()=>En,ZodULID:()=>yi,ZodType:()=>O,ZodTuple:()=>Y$,ZodTransform:()=>d$,ZodTemplateLiteral:()=>vg,ZodSymbol:()=>O$,ZodSuccess:()=>p$,ZodStringFormat:()=>L,ZodString:()=>Cr,ZodSet:()=>H$,ZodRecord:()=>fr,ZodRealError:()=>M,ZodReadonly:()=>tg,ZodPromise:()=>$g,ZodPreprocess:()=>ig,ZodPrefault:()=>h$,ZodPipe:()=>Xn,ZodOptional:()=>It,ZodObject:()=>An,ZodNumberFormat:()=>Nr,ZodNumber:()=>yr,ZodNullable:()=>f$,ZodNull:()=>P$,ZodNonOptional:()=>bt,ZodNever:()=>G$,ZodNanoID:()=>Zi,ZodNaN:()=>ng,ZodMap:()=>T$,ZodMAC:()=>m$,ZodLiteral:()=>B$,ZodLazy:()=>eg,ZodKSUID:()=>pi,ZodJWT:()=>et,ZodIssueCode:()=>n4,ZodIntersection:()=>q$,ZodISOTime:()=>Hi,ZodISODuration:()=>Bi,ZodISODateTime:()=>Fi,ZodISODate:()=>Ti,ZodIPv6:()=>rt,ZodIPv4:()=>si,ZodGUID:()=>jn,ZodFunction:()=>gg,ZodFirstPartyTypeKind:()=>Ig,ZodFile:()=>M$,ZodExactOptional:()=>x$,ZodError:()=>sb,ZodEnum:()=>Zr,ZodEmoji:()=>fi,ZodEmail:()=>Ri,ZodE164:()=>vt,ZodDiscriminatedUnion:()=>X$,ZodDefault:()=>Z$,ZodDate:()=>Gn,ZodCustomStringFormat:()=>hr,ZodCustom:()=>Kn,ZodCodec:()=>qn,ZodCatch:()=>s$,ZodCUID2:()=>hi,ZodCUID:()=>Ci,ZodCIDRv6:()=>it,ZodCIDRv4:()=>nt,ZodBoolean:()=>ar,ZodBigIntFormat:()=>ut,ZodBigInt:()=>pr,ZodBase64URL:()=>ot,ZodBase64:()=>tt,ZodArray:()=>A$,ZodAny:()=>L$,TimePrecision:()=>Qe,NEVER:()=>Ut,$output:()=>Ae,$input:()=>Ve,$brand:()=>kt});var ir={};s(ir,{version:()=>jo,util:()=>k,treeifyError:()=>Lt,toJSONSchema:()=>Yi,toDotPath:()=>zg,safeParseAsync:()=>Wt,safeParse:()=>Gt,safeEncodeAsync:()=>nI,safeEncode:()=>sc,safeDecodeAsync:()=>iI,safeDecode:()=>rI,registry:()=>ui,regexes:()=>d,process:()=>P,prettifyError:()=>Et,parseAsync:()=>Tn,parse:()=>Fn,meta:()=>Du,locales:()=>Sn,isValidJWT:()=>xg,isValidBase64URL:()=>dg,isValidBase64:()=>Zo,initializeContext:()=>gr,globalRegistry:()=>X,globalConfig:()=>Ir,formatError:()=>$n,flattenError:()=>un,finalize:()=>cr,extractDefs:()=>lr,encodeAsync:()=>ac,encode:()=>hc,describe:()=>ku,decodeAsync:()=>pc,decode:()=>yc,createToJSONSchemaMethod:()=>Su,createStandardJSONSchemaMethod:()=>xr,config:()=>W,clone:()=>K,_xor:()=>Gb,_xid:()=>wi,_void:()=>uu,_uuidv7:()=>Ii,_uuidv6:()=>ci,_uuidv4:()=>li,_uuid:()=>gi,_url:()=>Nn,_uppercase:()=>Xr,_unknown:()=>vu,_union:()=>Eb,_undefined:()=>iu,_ulid:()=>Di,_uint64:()=>ru,_uint32:()=>Ce,_tuple:()=>Vb,_trim:()=>Tr,_transform:()=>Tb,_toUpperCase:()=>Br,_toLowerCase:()=>Hr,_templateLiteral:()=>Cb,_symbol:()=>nu,_superRefine:()=>Uu,_success:()=>xb,_stringbool:()=>wu,_stringFormat:()=>dr,_string:()=>qe,_startsWith:()=>Kr,_slugify:()=>Mr,_size:()=>Dr,_set:()=>Kb,_safeParseAsync:()=>Er,_safeParse:()=>Lr,_safeEncodeAsync:()=>fn,_safeEncode:()=>xn,_safeDecodeAsync:()=>Zn,_safeDecode:()=>Rn,_regex:()=>Ar,_refine:()=>_u,_record:()=>Xb,_readonly:()=>Zb,_property:()=>Vi,_promise:()=>yb,_positive:()=>Ei,_pipe:()=>fb,_parseAsync:()=>Jr,_parse:()=>Pr,_overwrite:()=>f,_optional:()=>Hb,_number:()=>Me,_nullable:()=>Bb,_null:()=>tu,_normalize:()=>Fr,_nonpositive:()=>Wi,_nonoptional:()=>db,_nonnegative:()=>Ai,_never:()=>eu,_negative:()=>Gi,_nativeEnum:()=>Qb,_nanoid:()=>_i,_nan:()=>lu,_multipleOf:()=>ur,_minSize:()=>a,_minLength:()=>nr,_min:()=>Q,_mime:()=>Qr,_maxSize:()=>$r,_maxLength:()=>wr,_max:()=>x,_map:()=>qb,_mac:()=>Ye,_lte:()=>x,_lt:()=>h,_lowercase:()=>Vr,_literal:()=>Fb,_length:()=>Sr,_lazy:()=>hb,_ksuid:()=>Si,_jwt:()=>Li,_isoTime:()=>He,_isoDuration:()=>Be,_isoDateTime:()=>Fe,_isoDate:()=>Te,_ipv6:()=>Ni,_ipv4:()=>mi,_intersection:()=>Ab,_int64:()=>se,_int32:()=>Ze,_int:()=>xe,_includes:()=>qr,_guid:()=>mn,_gte:()=>Q,_gt:()=>y,_float64:()=>fe,_float32:()=>Re,_file:()=>Iu,_enum:()=>Yb,_endsWith:()=>Yr,_encodeAsync:()=>Mn,_encode:()=>Hn,_emoji:()=>bi,_email:()=>$i,_e164:()=>Ji,_discriminatedUnion:()=>Wb,_default:()=>Mb,_decodeAsync:()=>dn,_decode:()=>Bn,_date:()=>$u,_custom:()=>bu,_cuid2:()=>ki,_cuid:()=>Ui,_coercedString:()=>Ke,_coercedNumber:()=>de,_coercedDate:()=>gu,_coercedBoolean:()=>ye,_coercedBigint:()=>pe,_cidrv6:()=>Oi,_cidrv4:()=>zi,_check:()=>sg,_catch:()=>Rb,_boolean:()=>he,_bigint:()=>ae,_base64url:()=>Pi,_base64:()=>ji,_array:()=>cu,_any:()=>ou,TimePrecision:()=>Qe,NEVER:()=>Ut,JSONSchemaGenerator:()=>t$,JSONSchema:()=>rl,Doc:()=>an,$output:()=>Ae,$input:()=>Ve,$constructor:()=>l,$brand:()=>kt,$ZodXor:()=>cv,$ZodXID:()=>Ko,$ZodVoid:()=>uv,$ZodUnknown:()=>vv,$ZodUnion:()=>bn,$ZodUndefined:()=>iv,$ZodUUID:()=>Lo,$ZodURL:()=>Go,$ZodULID:()=>qo,$ZodType:()=>z,$ZodTuple:()=>oi,$ZodTransform:()=>mv,$ZodTemplateLiteral:()=>Av,$ZodSymbol:()=>nv,$ZodSuccess:()=>Jv,$ZodStringFormat:()=>J,$ZodString:()=>kr,$ZodSet:()=>kv,$ZodRegistry:()=>Xe,$ZodRecord:()=>_v,$ZodRealError:()=>B,$ZodReadonly:()=>Wv,$ZodPromise:()=>Xv,$ZodPreprocess:()=>Gv,$ZodPrefault:()=>jv,$ZodPipe:()=>ei,$ZodOptional:()=>vi,$ZodObjectJIT:()=>lv,$ZodObject:()=>Zg,$ZodNumberFormat:()=>so,$ZodNumber:()=>ii,$ZodNullable:()=>zv,$ZodNull:()=>tv,$ZodNonOptional:()=>Pv,$ZodNever:()=>ev,$ZodNanoID:()=>Ao,$ZodNaN:()=>Ev,$ZodMap:()=>Uv,$ZodMAC:()=>xo,$ZodLiteral:()=>wv,$ZodLazy:()=>qv,$ZodKSUID:()=>Yo,$ZodJWT:()=>ao,$ZodIntersection:()=>bv,$ZodISOTime:()=>To,$ZodISODuration:()=>Ho,$ZodISODateTime:()=>Qo,$ZodISODate:()=>Fo,$ZodIPv6:()=>Mo,$ZodIPv4:()=>Bo,$ZodGUID:()=>Jo,$ZodFunction:()=>Vv,$ZodFile:()=>Sv,$ZodExactOptional:()=>Nv,$ZodError:()=>en,$ZodEnum:()=>Dv,$ZodEncodeError:()=>br,$ZodEmoji:()=>Wo,$ZodEmail:()=>Eo,$ZodE164:()=>yo,$ZodDiscriminatedUnion:()=>Iv,$ZodDefault:()=>Ov,$ZodDate:()=>$v,$ZodCustomStringFormat:()=>po,$ZodCustom:()=>Kv,$ZodCodec:()=>_n,$ZodCheckUpperCase:()=>Do,$ZodCheckStringFormat:()=>Gr,$ZodCheckStartsWith:()=>So,$ZodCheckSizeEquals:()=>co,$ZodCheckRegex:()=>Uo,$ZodCheckProperty:()=>No,$ZodCheckOverwrite:()=>Oo,$ZodCheckNumberFormat:()=>uo,$ZodCheckMultipleOf:()=>eo,$ZodCheckMinSize:()=>lo,$ZodCheckMinLength:()=>bo,$ZodCheckMimeType:()=>zo,$ZodCheckMaxSize:()=>go,$ZodCheckMaxLength:()=>Io,$ZodCheckLowerCase:()=>ko,$ZodCheckLessThan:()=>hn,$ZodCheckLengthEquals:()=>_o,$ZodCheckIncludes:()=>wo,$ZodCheckGreaterThan:()=>yn,$ZodCheckEndsWith:()=>mo,$ZodCheckBigIntFormat:()=>$o,$ZodCheck:()=>E,$ZodCatch:()=>Lv,$ZodCUID2:()=>Xo,$ZodCUID:()=>Vo,$ZodCIDRv6:()=>fo,$ZodCIDRv4:()=>Ro,$ZodBoolean:()=>In,$ZodBigIntFormat:()=>rv,$ZodBigInt:()=>ti,$ZodBase64URL:()=>ho,$ZodBase64:()=>Co,$ZodAsyncError:()=>C,$ZodArray:()=>gv,$ZodAny:()=>ov});var kg,Ut=Object.freeze({status:"aborted"});function l(n,i,o){function v(u,g){if(!u._zod)Object.defineProperty(u,"_zod",{value:{def:g,constr:e,traits:new Set},enumerable:!1});if(u._zod.traits.has(n))return;u._zod.traits.add(n),i(u,g);let $=e.prototype,c=Object.keys($);for(let b=0;b<c.length;b++){let S=c[b];if(!(S in u))u[S]=$[S].bind(u)}}let r=o?.Parent??Object;class t extends r{}Object.defineProperty(t,"name",{value:n});function e(u){var g;let $=o?.Parent?new t:this;v($,u),(g=$._zod).deferred??(g.deferred=[]);for(let c of $._zod.deferred)c();return $}return Object.defineProperty(e,"init",{value:v}),Object.defineProperty(e,Symbol.hasInstance,{value:(u)=>{if(o?.Parent&&u instanceof o.Parent)return!0;return u?._zod?.traits?.has(n)}}),Object.defineProperty(e,"name",{value:n}),e}var kt=Symbol("zod_brand");class C extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class br extends Error{constructor(n){super(`Encountered unidirectional transform during encode: ${n}`);this.name="ZodEncodeError"}}(kg=globalThis).__zod_globalConfig??(kg.__zod_globalConfig={});var Ir=globalThis.__zod_globalConfig;function W(n){if(n)Object.assign(Ir,n);return Ir}var k={};s(k,{unwrapMessage:()=>sr,uint8ArrayToHex:()=>Zc,uint8ArrayToBase64url:()=>Rc,uint8ArrayToBase64:()=>Sg,stringifyPrimitive:()=>_,slugify:()=>St,shallowClone:()=>Nt,safeExtend:()=>Tc,required:()=>Mc,randomString:()=>Vc,propertyKeyTypes:()=>tn,promiseAllObject:()=>Ac,primitiveTypes:()=>zt,prefixIssues:()=>H,pick:()=>Yc,partial:()=>Bc,parsedType:()=>U,optionalKeys:()=>Ot,omit:()=>Qc,objectClone:()=>Ec,numKeys:()=>Xc,nullish:()=>tr,normalizeParams:()=>w,mergeDefs:()=>rr,merge:()=>Hc,jsonStringifyReplacer:()=>zr,joinValues:()=>I,issue:()=>jr,isPlainObject:()=>vr,isObject:()=>_r,hexToUint8Array:()=>fc,getSizableOrigin:()=>on,getParsedType:()=>qc,getLengthableOrigin:()=>vn,getEnumValues:()=>rn,getElementAtPath:()=>Wc,floatSafeRemainder:()=>wt,finalizeIssue:()=>Y,extend:()=>Fc,explicitlyAborted:()=>Jt,escapeRegex:()=>R,esc:()=>Yn,defineLazy:()=>j,createTransparentProxy:()=>Kc,cloneDef:()=>Gc,clone:()=>K,cleanRegex:()=>nn,cleanEnum:()=>dc,captureStackTrace:()=>Qn,cached:()=>Or,base64urlToUint8Array:()=>xc,base64ToUint8Array:()=>wg,assignProp:()=>or,assertNotEqual:()=>jc,assertNever:()=>Jc,assertIs:()=>Pc,assertEqual:()=>Oc,assert:()=>Lc,allowsEval:()=>mt,aborted:()=>er,NUMBER_FORMAT_RANGES:()=>jt,Class:()=>mg,BIGINT_FORMAT_RANGES:()=>Pt});function Oc(n){return n}function jc(n){return n}function Pc(n){}function Jc(n){throw Error("Unexpected value in exhaustive check")}function Lc(n){}function rn(n){let i=Object.values(n).filter((v)=>typeof v==="number");return Object.entries(n).filter(([v,r])=>i.indexOf(+v)===-1).map(([v,r])=>r)}function I(n,i="|"){return n.map((o)=>_(o)).join(i)}function zr(n,i){if(typeof i==="bigint")return i.toString();return i}function Or(n){return{get value(){{let o=n();return Object.defineProperty(this,"value",{value:o}),o}throw Error("cached value already set")}}}function tr(n){return n===null||n===void 0}function nn(n){let i=n.startsWith("^")?1:0,o=n.endsWith("$")?n.length-1:n.length;return n.slice(i,o)}function wt(n,i){let o=n/i,v=Math.round(o),r=Number.EPSILON*Math.max(Math.abs(o),1);if(Math.abs(o-v)<r)return 0;return o-v}var Dg=Symbol("evaluating");function j(n,i,o){let v=void 0;Object.defineProperty(n,i,{get(){if(v===Dg)return;if(v===void 0)v=Dg,v=o();return v},set(r){Object.defineProperty(n,i,{value:r})},configurable:!0})}function Ec(n){return Object.create(Object.getPrototypeOf(n),Object.getOwnPropertyDescriptors(n))}function or(n,i,o){Object.defineProperty(n,i,{value:o,writable:!0,enumerable:!0,configurable:!0})}function rr(...n){let i={};for(let o of n){let v=Object.getOwnPropertyDescriptors(o);Object.assign(i,v)}return Object.defineProperties({},i)}function Gc(n){return rr(n._zod.def)}function Wc(n,i){if(!i)return n;return i.reduce((o,v)=>o?.[v],n)}function Ac(n){let i=Object.keys(n),o=i.map((v)=>n[v]);return Promise.all(o).then((v)=>{let r={};for(let t=0;t<i.length;t++)r[i[t]]=v[t];return r})}function Vc(n=10){let o="";for(let v=0;v<n;v++)o+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return o}function Yn(n){return JSON.stringify(n)}function St(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Qn="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function _r(n){return typeof n==="object"&&n!==null&&!Array.isArray(n)}var mt=Or(()=>{if(Ir.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(n){return!1}});function vr(n){if(_r(n)===!1)return!1;let i=n.constructor;if(i===void 0)return!0;if(typeof i!=="function")return!0;let o=i.prototype;if(_r(o)===!1)return!1;if(Object.prototype.hasOwnProperty.call(o,"isPrototypeOf")===!1)return!1;return!0}function Nt(n){if(vr(n))return{...n};if(Array.isArray(n))return[...n];if(n instanceof Map)return new Map(n);if(n instanceof Set)return new Set(n);return n}function Xc(n){let i=0;for(let o in n)if(Object.prototype.hasOwnProperty.call(n,o))i++;return i}var qc=(n)=>{let i=typeof n;switch(i){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(n)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(n))return"array";if(n===null)return"null";if(n.then&&typeof n.then==="function"&&n.catch&&typeof n.catch==="function")return"promise";if(typeof Map<"u"&&n instanceof Map)return"map";if(typeof Set<"u"&&n instanceof Set)return"set";if(typeof Date<"u"&&n instanceof Date)return"date";if(typeof File<"u"&&n instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${i}`)}},tn=new Set(["string","number","symbol"]),zt=new Set(["string","number","bigint","boolean","symbol","undefined"]);function R(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function K(n,i,o){let v=new n._zod.constr(i??n._zod.def);if(!i||o?.parent)v._zod.parent=n;return v}function w(n){let i=n;if(!i)return{};if(typeof i==="string")return{error:()=>i};if(i?.message!==void 0){if(i?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");i.error=i.message}if(delete i.message,typeof i.error==="string")return{...i,error:()=>i.error};return i}function Kc(n){let i;return new Proxy({},{get(o,v,r){return i??(i=n()),Reflect.get(i,v,r)},set(o,v,r,t){return i??(i=n()),Reflect.set(i,v,r,t)},has(o,v){return i??(i=n()),Reflect.has(i,v)},deleteProperty(o,v){return i??(i=n()),Reflect.deleteProperty(i,v)},ownKeys(o){return i??(i=n()),Reflect.ownKeys(i)},getOwnPropertyDescriptor(o,v){return i??(i=n()),Reflect.getOwnPropertyDescriptor(i,v)},defineProperty(o,v,r){return i??(i=n()),Reflect.defineProperty(i,v,r)}})}function _(n){if(typeof n==="bigint")return n.toString()+"n";if(typeof n==="string")return`"${n}"`;return`${n}`}function Ot(n){return Object.keys(n).filter((i)=>{return n[i]._zod.optin==="optional"&&n[i]._zod.optout==="optional"})}var jt={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Pt={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Yc(n,i){let o=n._zod.def,v=o.checks;if(v&&v.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let t=rr(n._zod.def,{get shape(){let e={};for(let u in i){if(!(u in o.shape))throw Error(`Unrecognized key: "${u}"`);if(!i[u])continue;e[u]=o.shape[u]}return or(this,"shape",e),e},checks:[]});return K(n,t)}function Qc(n,i){let o=n._zod.def,v=o.checks;if(v&&v.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let t=rr(n._zod.def,{get shape(){let e={...n._zod.def.shape};for(let u in i){if(!(u in o.shape))throw Error(`Unrecognized key: "${u}"`);if(!i[u])continue;delete e[u]}return or(this,"shape",e),e},checks:[]});return K(n,t)}function Fc(n,i){if(!vr(i))throw Error("Invalid input to extend: expected a plain object");let o=n._zod.def.checks;if(o&&o.length>0){let t=n._zod.def.shape;for(let e in i)if(Object.getOwnPropertyDescriptor(t,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let r=rr(n._zod.def,{get shape(){let t={...n._zod.def.shape,...i};return or(this,"shape",t),t}});return K(n,r)}function Tc(n,i){if(!vr(i))throw Error("Invalid input to safeExtend: expected a plain object");let o=rr(n._zod.def,{get shape(){let v={...n._zod.def.shape,...i};return or(this,"shape",v),v}});return K(n,o)}function Hc(n,i){if(n._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let o=rr(n._zod.def,{get shape(){let v={...n._zod.def.shape,...i._zod.def.shape};return or(this,"shape",v),v},get catchall(){return i._zod.def.catchall},checks:i._zod.def.checks??[]});return K(n,o)}function Bc(n,i,o){let r=i._zod.def.checks;if(r&&r.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let e=rr(i._zod.def,{get shape(){let u=i._zod.def.shape,g={...u};if(o)for(let $ in o){if(!($ in u))throw Error(`Unrecognized key: "${$}"`);if(!o[$])continue;g[$]=n?new n({type:"optional",innerType:u[$]}):u[$]}else for(let $ in u)g[$]=n?new n({type:"optional",innerType:u[$]}):u[$];return or(this,"shape",g),g},checks:[]});return K(i,e)}function Mc(n,i,o){let v=rr(i._zod.def,{get shape(){let r=i._zod.def.shape,t={...r};if(o)for(let e in o){if(!(e in t))throw Error(`Unrecognized key: "${e}"`);if(!o[e])continue;t[e]=new n({type:"nonoptional",innerType:r[e]})}else for(let e in r)t[e]=new n({type:"nonoptional",innerType:r[e]});return or(this,"shape",t),t}});return K(i,v)}function er(n,i=0){if(n.aborted===!0)return!0;for(let o=i;o<n.issues.length;o++)if(n.issues[o]?.continue!==!0)return!0;return!1}function Jt(n,i=0){if(n.aborted===!0)return!0;for(let o=i;o<n.issues.length;o++)if(n.issues[o]?.continue===!1)return!0;return!1}function H(n,i){return i.map((o)=>{var v;return(v=o).path??(v.path=[]),o.path.unshift(n),o})}function sr(n){return typeof n==="string"?n:n?.message}function Y(n,i,o){let v=n.message?n.message:sr(n.inst?._zod.def?.error?.(n))??sr(i?.error?.(n))??sr(o.customError?.(n))??sr(o.localeError?.(n))??"Invalid input",{inst:r,continue:t,input:e,...u}=n;if(u.path??(u.path=[]),u.message=v,i?.reportInput)u.input=e;return u}function on(n){if(n instanceof Set)return"set";if(n instanceof Map)return"map";if(n instanceof File)return"file";return"unknown"}function vn(n){if(Array.isArray(n))return"array";if(typeof n==="string")return"string";return"unknown"}function U(n){let i=typeof n;switch(i){case"number":return Number.isNaN(n)?"nan":"number";case"object":{if(n===null)return"null";if(Array.isArray(n))return"array";let o=n;if(o&&Object.getPrototypeOf(o)!==Object.prototype&&"constructor"in o&&o.constructor)return o.constructor.name}}return i}function jr(...n){let[i,o,v]=n;if(typeof i==="string")return{message:i,code:"custom",input:o,inst:v};return{...i}}function dc(n){return Object.entries(n).filter(([i,o])=>{return Number.isNaN(Number.parseInt(i,10))}).map((i)=>i[1])}function wg(n){let i=atob(n),o=new Uint8Array(i.length);for(let v=0;v<i.length;v++)o[v]=i.charCodeAt(v);return o}function Sg(n){let i="";for(let o=0;o<n.length;o++)i+=String.fromCharCode(n[o]);return btoa(i)}function xc(n){let i=n.replace(/-/g,"+").replace(/_/g,"/"),o="=".repeat((4-i.length%4)%4);return wg(i+o)}function Rc(n){return Sg(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function fc(n){let i=n.replace(/^0x/,"");if(i.length%2!==0)throw Error("Invalid hex string length");let o=new Uint8Array(i.length/2);for(let v=0;v<i.length;v+=2)o[v/2]=Number.parseInt(i.slice(v,v+2),16);return o}function Zc(n){return Array.from(n).map((i)=>i.toString(16).padStart(2,"0")).join("")}class mg{constructor(...n){}}var Ng=(n,i)=>{n.name="$ZodError",Object.defineProperty(n,"_zod",{value:n._zod,enumerable:!1}),Object.defineProperty(n,"issues",{value:i,enumerable:!1}),n.message=JSON.stringify(i,zr,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},en=l("$ZodError",Ng),B=l("$ZodError",Ng,{Parent:Error});function un(n,i=(o)=>o.message){let o={},v=[];for(let r of n.issues)if(r.path.length>0)o[r.path[0]]=o[r.path[0]]||[],o[r.path[0]].push(i(r));else v.push(i(r));return{formErrors:v,fieldErrors:o}}function $n(n,i=(o)=>o.message){let o={_errors:[]},v=(r,t=[])=>{for(let e of r.issues)if(e.code==="invalid_union"&&e.errors.length)e.errors.map((u)=>v({issues:u},[...t,...e.path]));else if(e.code==="invalid_key")v({issues:e.issues},[...t,...e.path]);else if(e.code==="invalid_element")v({issues:e.issues},[...t,...e.path]);else{let u=[...t,...e.path];if(u.length===0)o._errors.push(i(e));else{let g=o,$=0;while($<u.length){let c=u[$];if($!==u.length-1)g[c]=g[c]||{_errors:[]};else g[c]=g[c]||{_errors:[]},g[c]._errors.push(i(e));g=g[c],$++}}}};return v(n),o}function Lt(n,i=(o)=>o.message){let o={errors:[]},v=(r,t=[])=>{var e,u;for(let g of r.issues)if(g.code==="invalid_union"&&g.errors.length)g.errors.map(($)=>v({issues:$},[...t,...g.path]));else if(g.code==="invalid_key")v({issues:g.issues},[...t,...g.path]);else if(g.code==="invalid_element")v({issues:g.issues},[...t,...g.path]);else{let $=[...t,...g.path];if($.length===0){o.errors.push(i(g));continue}let c=o,b=0;while(b<$.length){let S=$[b],D=b===$.length-1;if(typeof S==="string")c.properties??(c.properties={}),(e=c.properties)[S]??(e[S]={errors:[]}),c=c.properties[S];else c.items??(c.items=[]),(u=c.items)[S]??(u[S]={errors:[]}),c=c.items[S];if(D)c.errors.push(i(g));b++}}};return v(n),o}function zg(n){let i=[],o=n.map((v)=>typeof v==="object"?v.key:v);for(let v of o)if(typeof v==="number")i.push(`[${v}]`);else if(typeof v==="symbol")i.push(`[${JSON.stringify(String(v))}]`);else if(/[^\w$]/.test(v))i.push(`[${JSON.stringify(v)}]`);else{if(i.length)i.push(".");i.push(v)}return i.join("")}function Et(n){let i=[],o=[...n.issues].sort((v,r)=>(v.path??[]).length-(r.path??[]).length);for(let v of o)if(i.push(`\u2716 ${v.message}`),v.path?.length)i.push(` \u2192 at ${zg(v.path)}`);return i.join(`
3
3
  `)}var Pr=(n)=>(i,o,v,r)=>{let t=v?{...v,async:!1}:{async:!1},e=i._zod.run({value:o,issues:[]},t);if(e instanceof Promise)throw new C;if(e.issues.length){let u=new(r?.Err??n)(e.issues.map((g)=>Y(g,t,W())));throw Qn(u,r?.callee),u}return e.value},Fn=Pr(B),Jr=(n)=>async(i,o,v,r)=>{let t=v?{...v,async:!0}:{async:!0},e=i._zod.run({value:o,issues:[]},t);if(e instanceof Promise)e=await e;if(e.issues.length){let u=new(r?.Err??n)(e.issues.map((g)=>Y(g,t,W())));throw Qn(u,r?.callee),u}return e.value},Tn=Jr(B),Lr=(n)=>(i,o,v)=>{let r=v?{...v,async:!1}:{async:!1},t=i._zod.run({value:o,issues:[]},r);if(t instanceof Promise)throw new C;return t.issues.length?{success:!1,error:new(n??en)(t.issues.map((e)=>Y(e,r,W())))}:{success:!0,data:t.value}},Gt=Lr(B),Er=(n)=>async(i,o,v)=>{let r=v?{...v,async:!0}:{async:!0},t=i._zod.run({value:o,issues:[]},r);if(t instanceof Promise)t=await t;return t.issues.length?{success:!1,error:new n(t.issues.map((e)=>Y(e,r,W())))}:{success:!0,data:t.value}},Wt=Er(B),Hn=(n)=>(i,o,v)=>{let r=v?{...v,direction:"backward"}:{direction:"backward"};return Pr(n)(i,o,r)},hc=Hn(B),Bn=(n)=>(i,o,v)=>{return Pr(n)(i,o,v)},yc=Bn(B),Mn=(n)=>async(i,o,v)=>{let r=v?{...v,direction:"backward"}:{direction:"backward"};return Jr(n)(i,o,r)},ac=Mn(B),dn=(n)=>async(i,o,v)=>{return Jr(n)(i,o,v)},pc=dn(B),xn=(n)=>(i,o,v)=>{let r=v?{...v,direction:"backward"}:{direction:"backward"};return Lr(n)(i,o,r)},sc=xn(B),Rn=(n)=>(i,o,v)=>{return Lr(n)(i,o,v)},rI=Rn(B),fn=(n)=>async(i,o,v)=>{let r=v?{...v,direction:"backward"}:{direction:"backward"};return Er(n)(i,o,r)},nI=fn(B),Zn=(n)=>async(i,o,v)=>{return Er(n)(i,o,v)},iI=Zn(B);var d={};s(d,{xid:()=>qt,uuid7:()=>eI,uuid6:()=>vI,uuid4:()=>oI,uuid:()=>Ur,uppercase:()=>vo,unicodeEmail:()=>Og,undefined:()=>to,ulid:()=>Xt,time:()=>yt,string:()=>pt,sha512_hex:()=>LI,sha512_base64url:()=>GI,sha512_base64:()=>EI,sha384_hex:()=>jI,sha384_base64url:()=>JI,sha384_base64:()=>PI,sha256_hex:()=>NI,sha256_base64url:()=>OI,sha256_base64:()=>zI,sha1_hex:()=>wI,sha1_base64url:()=>mI,sha1_base64:()=>SI,rfc5322Email:()=>$I,number:()=>gn,null:()=>io,nanoid:()=>Yt,md5_hex:()=>UI,md5_base64url:()=>DI,md5_base64:()=>kI,mac:()=>dt,lowercase:()=>oo,ksuid:()=>Kt,ipv6:()=>Mt,ipv4:()=>Bt,integer:()=>ro,idnEmail:()=>gI,httpProtocol:()=>Zt,html5Email:()=>uI,hostname:()=>II,hex:()=>_I,guid:()=>Ft,extendedDuration:()=>tI,emoji:()=>Ht,email:()=>Tt,e164:()=>Ct,duration:()=>Qt,domain:()=>bI,datetime:()=>at,date:()=>ht,cuid2:()=>Vt,cuid:()=>At,cidrv6:()=>Rt,cidrv4:()=>xt,browserEmail:()=>lI,boolean:()=>no,bigint:()=>st,base64url:()=>Cn,base64:()=>ft});var At=/^[cC][0-9a-z]{6,}$/,Vt=/^[0-9a-z]+$/,Xt=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,qt=/^[0-9a-vA-V]{20}$/,Kt=/^[A-Za-z0-9]{27}$/,Yt=/^[a-zA-Z0-9_-]{21}$/,Qt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,tI=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Ft=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ur=(n)=>{if(!n)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${n}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},oI=Ur(4),vI=Ur(6),eI=Ur(7),Tt=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,uI=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,$I=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Og=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,gI=Og,lI=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,cI="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Ht(){return new RegExp(cI,"u")}var Bt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Mt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,dt=(n)=>{let i=R(n??":");return new RegExp(`^(?:[0-9A-F]{2}${i}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${i}){5}[0-9a-f]{2}$`)},xt=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Rt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ft=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Cn=/^[A-Za-z0-9_-]*$/,II=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,bI=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Zt=/^https?$/,Ct=/^\+[1-9]\d{6,14}$/,jg="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",ht=new RegExp(`^${jg}$`);function Pg(n){return typeof n.precision==="number"?n.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":n.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${n.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function yt(n){return new RegExp(`^${Pg(n)}$`)}function at(n){let i=Pg({precision:n.precision}),o=["Z"];if(n.local)o.push("");if(n.offset)o.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let v=`${i}(?:${o.join("|")})`;return new RegExp(`^${jg}T(?:${v})$`)}var pt=(n)=>{let i=n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${i}$`)},st=/^-?\d+n?$/,ro=/^-?\d+$/,gn=/^-?\d+(?:\.\d+)?$/,no=/^(?:true|false)$/i,io=/^null$/i;var to=/^undefined$/i;var oo=/^[^A-Z]*$/,vo=/^[^a-z]*$/,_I=/^[0-9a-fA-F]*$/;function ln(n,i){return new RegExp(`^[A-Za-z0-9+/]{${n}}${i}$`)}function cn(n){return new RegExp(`^[A-Za-z0-9_-]{${n}}$`)}var UI=/^[0-9a-fA-F]{32}$/,kI=ln(22,"=="),DI=cn(22),wI=/^[0-9a-fA-F]{40}$/,SI=ln(27,"="),mI=cn(27),NI=/^[0-9a-fA-F]{64}$/,zI=ln(43,"="),OI=cn(43),jI=/^[0-9a-fA-F]{96}$/,PI=ln(64,""),JI=cn(64),LI=/^[0-9a-fA-F]{128}$/,EI=ln(86,"=="),GI=cn(86);var E=l("$ZodCheck",(n,i)=>{var o;n._zod??(n._zod={}),n._zod.def=i,(o=n._zod).onattach??(o.onattach=[])}),Lg={number:"number",bigint:"bigint",object:"date"},hn=l("$ZodCheckLessThan",(n,i)=>{E.init(n,i);let o=Lg[typeof i.value];n._zod.onattach.push((v)=>{let r=v._zod.bag,t=(i.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(i.value<t)if(i.inclusive)r.maximum=i.value;else r.exclusiveMaximum=i.value}),n._zod.check=(v)=>{if(i.inclusive?v.value<=i.value:v.value<i.value)return;v.issues.push({origin:o,code:"too_big",maximum:typeof i.value==="object"?i.value.getTime():i.value,input:v.value,inclusive:i.inclusive,inst:n,continue:!i.abort})}}),yn=l("$ZodCheckGreaterThan",(n,i)=>{E.init(n,i);let o=Lg[typeof i.value];n._zod.onattach.push((v)=>{let r=v._zod.bag,t=(i.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(i.value>t)if(i.inclusive)r.minimum=i.value;else r.exclusiveMinimum=i.value}),n._zod.check=(v)=>{if(i.inclusive?v.value>=i.value:v.value>i.value)return;v.issues.push({origin:o,code:"too_small",minimum:typeof i.value==="object"?i.value.getTime():i.value,input:v.value,inclusive:i.inclusive,inst:n,continue:!i.abort})}}),eo=l("$ZodCheckMultipleOf",(n,i)=>{E.init(n,i),n._zod.onattach.push((o)=>{var v;(v=o._zod.bag).multipleOf??(v.multipleOf=i.value)}),n._zod.check=(o)=>{if(typeof o.value!==typeof i.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof o.value==="bigint"?o.value%i.value===BigInt(0):wt(o.value,i.value)===0)return;o.issues.push({origin:typeof o.value,code:"not_multiple_of",divisor:i.value,input:o.value,inst:n,continue:!i.abort})}}),uo=l("$ZodCheckNumberFormat",(n,i)=>{E.init(n,i),i.format=i.format||"float64";let o=i.format?.includes("int"),v=o?"int":"number",[r,t]=jt[i.format];n._zod.onattach.push((e)=>{let u=e._zod.bag;if(u.format=i.format,u.minimum=r,u.maximum=t,o)u.pattern=ro}),n._zod.check=(e)=>{let u=e.value;if(o){if(!Number.isInteger(u)){e.issues.push({expected:v,format:i.format,code:"invalid_type",continue:!1,input:u,inst:n});return}if(!Number.isSafeInteger(u)){if(u>0)e.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:v,inclusive:!0,continue:!i.abort});else e.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:v,inclusive:!0,continue:!i.abort});return}}if(u<r)e.issues.push({origin:"number",input:u,code:"too_small",minimum:r,inclusive:!0,inst:n,continue:!i.abort});if(u>t)e.issues.push({origin:"number",input:u,code:"too_big",maximum:t,inclusive:!0,inst:n,continue:!i.abort})}}),$o=l("$ZodCheckBigIntFormat",(n,i)=>{E.init(n,i);let[o,v]=Pt[i.format];n._zod.onattach.push((r)=>{let t=r._zod.bag;t.format=i.format,t.minimum=o,t.maximum=v}),n._zod.check=(r)=>{let t=r.value;if(t<o)r.issues.push({origin:"bigint",input:t,code:"too_small",minimum:o,inclusive:!0,inst:n,continue:!i.abort});if(t>v)r.issues.push({origin:"bigint",input:t,code:"too_big",maximum:v,inclusive:!0,inst:n,continue:!i.abort})}}),go=l("$ZodCheckMaxSize",(n,i)=>{var o;E.init(n,i),(o=n._zod.def).when??(o.when=(v)=>{let r=v.value;return!tr(r)&&r.size!==void 0}),n._zod.onattach.push((v)=>{let r=v._zod.bag.maximum??Number.POSITIVE_INFINITY;if(i.maximum<r)v._zod.bag.maximum=i.maximum}),n._zod.check=(v)=>{let r=v.value;if(r.size<=i.maximum)return;v.issues.push({origin:on(r),code:"too_big",maximum:i.maximum,inclusive:!0,input:r,inst:n,continue:!i.abort})}}),lo=l("$ZodCheckMinSize",(n,i)=>{var o;E.init(n,i),(o=n._zod.def).when??(o.when=(v)=>{let r=v.value;return!tr(r)&&r.size!==void 0}),n._zod.onattach.push((v)=>{let r=v._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(i.minimum>r)v._zod.bag.minimum=i.minimum}),n._zod.check=(v)=>{let r=v.value;if(r.size>=i.minimum)return;v.issues.push({origin:on(r),code:"too_small",minimum:i.minimum,inclusive:!0,input:r,inst:n,continue:!i.abort})}}),co=l("$ZodCheckSizeEquals",(n,i)=>{var o;E.init(n,i),(o=n._zod.def).when??(o.when=(v)=>{let r=v.value;return!tr(r)&&r.size!==void 0}),n._zod.onattach.push((v)=>{let r=v._zod.bag;r.minimum=i.size,r.maximum=i.size,r.size=i.size}),n._zod.check=(v)=>{let r=v.value,t=r.size;if(t===i.size)return;let e=t>i.size;v.issues.push({origin:on(r),...e?{code:"too_big",maximum:i.size}:{code:"too_small",minimum:i.size},inclusive:!0,exact:!0,input:v.value,inst:n,continue:!i.abort})}}),Io=l("$ZodCheckMaxLength",(n,i)=>{var o;E.init(n,i),(o=n._zod.def).when??(o.when=(v)=>{let r=v.value;return!tr(r)&&r.length!==void 0}),n._zod.onattach.push((v)=>{let r=v._zod.bag.maximum??Number.POSITIVE_INFINITY;if(i.maximum<r)v._zod.bag.maximum=i.maximum}),n._zod.check=(v)=>{let r=v.value;if(r.length<=i.maximum)return;let e=vn(r);v.issues.push({origin:e,code:"too_big",maximum:i.maximum,inclusive:!0,input:r,inst:n,continue:!i.abort})}}),bo=l("$ZodCheckMinLength",(n,i)=>{var o;E.init(n,i),(o=n._zod.def).when??(o.when=(v)=>{let r=v.value;return!tr(r)&&r.length!==void 0}),n._zod.onattach.push((v)=>{let r=v._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(i.minimum>r)v._zod.bag.minimum=i.minimum}),n._zod.check=(v)=>{let r=v.value;if(r.length>=i.minimum)return;let e=vn(r);v.issues.push({origin:e,code:"too_small",minimum:i.minimum,inclusive:!0,input:r,inst:n,continue:!i.abort})}}),_o=l("$ZodCheckLengthEquals",(n,i)=>{var o;E.init(n,i),(o=n._zod.def).when??(o.when=(v)=>{let r=v.value;return!tr(r)&&r.length!==void 0}),n._zod.onattach.push((v)=>{let r=v._zod.bag;r.minimum=i.length,r.maximum=i.length,r.length=i.length}),n._zod.check=(v)=>{let r=v.value,t=r.length;if(t===i.length)return;let e=vn(r),u=t>i.length;v.issues.push({origin:e,...u?{code:"too_big",maximum:i.length}:{code:"too_small",minimum:i.length},inclusive:!0,exact:!0,input:v.value,inst:n,continue:!i.abort})}}),Gr=l("$ZodCheckStringFormat",(n,i)=>{var o,v;if(E.init(n,i),n._zod.onattach.push((r)=>{let t=r._zod.bag;if(t.format=i.format,i.pattern)t.patterns??(t.patterns=new Set),t.patterns.add(i.pattern)}),i.pattern)(o=n._zod).check??(o.check=(r)=>{if(i.pattern.lastIndex=0,i.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:i.format,input:r.value,...i.pattern?{pattern:i.pattern.toString()}:{},inst:n,continue:!i.abort})});else(v=n._zod).check??(v.check=()=>{})}),Uo=l("$ZodCheckRegex",(n,i)=>{Gr.init(n,i),n._zod.check=(o)=>{if(i.pattern.lastIndex=0,i.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:"regex",input:o.value,pattern:i.pattern.toString(),inst:n,continue:!i.abort})}}),ko=l("$ZodCheckLowerCase",(n,i)=>{i.pattern??(i.pattern=oo),Gr.init(n,i)}),Do=l("$ZodCheckUpperCase",(n,i)=>{i.pattern??(i.pattern=vo),Gr.init(n,i)}),wo=l("$ZodCheckIncludes",(n,i)=>{E.init(n,i);let o=R(i.includes),v=new RegExp(typeof i.position==="number"?`^.{${i.position}}${o}`:o);i.pattern=v,n._zod.onattach.push((r)=>{let t=r._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(v)}),n._zod.check=(r)=>{if(r.value.includes(i.includes,i.position))return;r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:i.includes,input:r.value,inst:n,continue:!i.abort})}}),So=l("$ZodCheckStartsWith",(n,i)=>{E.init(n,i);let o=new RegExp(`^${R(i.prefix)}.*`);i.pattern??(i.pattern=o),n._zod.onattach.push((v)=>{let r=v._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(o)}),n._zod.check=(v)=>{if(v.value.startsWith(i.prefix))return;v.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:i.prefix,input:v.value,inst:n,continue:!i.abort})}}),mo=l("$ZodCheckEndsWith",(n,i)=>{E.init(n,i);let o=new RegExp(`.*${R(i.suffix)}$`);i.pattern??(i.pattern=o),n._zod.onattach.push((v)=>{let r=v._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(o)}),n._zod.check=(v)=>{if(v.value.endsWith(i.suffix))return;v.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:i.suffix,input:v.value,inst:n,continue:!i.abort})}});function Jg(n,i,o){if(n.issues.length)i.issues.push(...H(o,n.issues))}var No=l("$ZodCheckProperty",(n,i)=>{E.init(n,i),n._zod.check=(o)=>{let v=i.schema._zod.run({value:o.value[i.property],issues:[]},{});if(v instanceof Promise)return v.then((r)=>Jg(r,o,i.property));Jg(v,o,i.property);return}}),zo=l("$ZodCheckMimeType",(n,i)=>{E.init(n,i);let o=new Set(i.mime);n._zod.onattach.push((v)=>{v._zod.bag.mime=i.mime}),n._zod.check=(v)=>{if(o.has(v.value.type))return;v.issues.push({code:"invalid_value",values:i.mime,input:v.value.type,inst:n,continue:!i.abort})}}),Oo=l("$ZodCheckOverwrite",(n,i)=>{E.init(n,i),n._zod.check=(o)=>{o.value=i.tx(o.value)}});class an{constructor(n=[]){if(this.content=[],this.indent=0,this)this.args=n}indented(n){this.indent+=1,n(this),this.indent-=1}write(n){if(typeof n==="function"){n(this,{execution:"sync"}),n(this,{execution:"async"});return}let o=n.split(`
4
4
  `).filter((t)=>t),v=Math.min(...o.map((t)=>t.length-t.trimStart().length)),r=o.map((t)=>t.slice(v)).map((t)=>" ".repeat(this.indent*2)+t);for(let t of r)this.content.push(t)}compile(){let n=Function,i=this?.args,v=[...(this?.content??[""]).map((r)=>` ${r}`)];return new n(...i,v.join(`
5
5
  `))}}var jo={major:4,minor:4,patch:3};var z=l("$ZodType",(n,i)=>{var o;n??(n={}),n._zod.def=i,n._zod.bag=n._zod.bag||{},n._zod.version=jo;let v=[...n._zod.def.checks??[]];if(n._zod.traits.has("$ZodCheck"))v.unshift(n);for(let r of v)for(let t of r._zod.onattach)t(n);if(v.length===0)(o=n._zod).deferred??(o.deferred=[]),n._zod.deferred?.push(()=>{n._zod.run=n._zod.parse});else{let r=(e,u,g)=>{let $=er(e),c;for(let b of u){if(b._zod.def.when){if(Jt(e))continue;if(!b._zod.def.when(e))continue}else if($)continue;let S=e.issues.length,D=b._zod.check(e);if(D instanceof Promise&&g?.async===!1)throw new C;if(c||D instanceof Promise)c=(c??Promise.resolve()).then(async()=>{if(await D,e.issues.length===S)return;if(!$)$=er(e,S)});else{if(e.issues.length===S)continue;if(!$)$=er(e,S)}}if(c)return c.then(()=>{return e});return e},t=(e,u,g)=>{if(er(e))return e.aborted=!0,e;let $=r(u,v,g);if($ instanceof Promise){if(g.async===!1)throw new C;return $.then((c)=>n._zod.parse(c,g))}return n._zod.parse($,g)};n._zod.run=(e,u)=>{if(u.skipChecks)return n._zod.parse(e,u);if(u.direction==="backward"){let $=n._zod.parse({value:e.value,issues:[]},{...u,skipChecks:!0});if($ instanceof Promise)return $.then((c)=>{return t(c,e,u)});return t($,e,u)}let g=n._zod.parse(e,u);if(g instanceof Promise){if(u.async===!1)throw new C;return g.then(($)=>r($,v,u))}return r(g,v,u)}}j(n,"~standard",()=>({validate:(r)=>{try{let t=Gt(n,r);return t.success?{value:t.data}:{issues:t.error?.issues}}catch(t){return Wt(n,r).then((e)=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),kr=l("$ZodString",(n,i)=>{z.init(n,i),n._zod.pattern=[...n?._zod.bag?.patterns??[]].pop()??pt(n._zod.bag),n._zod.parse=(o,v)=>{if(i.coerce)try{o.value=String(o.value)}catch(r){}if(typeof o.value==="string")return o;return o.issues.push({expected:"string",code:"invalid_type",input:o.value,inst:n}),o}}),J=l("$ZodStringFormat",(n,i)=>{Gr.init(n,i),kr.init(n,i)}),Jo=l("$ZodGUID",(n,i)=>{i.pattern??(i.pattern=Ft),J.init(n,i)}),Lo=l("$ZodUUID",(n,i)=>{if(i.version){let v={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[i.version];if(v===void 0)throw Error(`Invalid UUID version: "${i.version}"`);i.pattern??(i.pattern=Ur(v))}else i.pattern??(i.pattern=Ur());J.init(n,i)}),Eo=l("$ZodEmail",(n,i)=>{i.pattern??(i.pattern=Tt),J.init(n,i)}),Go=l("$ZodURL",(n,i)=>{J.init(n,i),n._zod.check=(o)=>{try{let v=o.value.trim();if(!i.normalize&&i.protocol?.source===Zt.source){if(!/^https?:\/\//i.test(v)){o.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:o.value,inst:n,continue:!i.abort});return}}let r=new URL(v);if(i.hostname){if(i.hostname.lastIndex=0,!i.hostname.test(r.hostname))o.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:i.hostname.source,input:o.value,inst:n,continue:!i.abort})}if(i.protocol){if(i.protocol.lastIndex=0,!i.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol))o.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:i.protocol.source,input:o.value,inst:n,continue:!i.abort})}if(i.normalize)o.value=r.href;else o.value=v;return}catch(v){o.issues.push({code:"invalid_format",format:"url",input:o.value,inst:n,continue:!i.abort})}}}),Wo=l("$ZodEmoji",(n,i)=>{i.pattern??(i.pattern=Ht()),J.init(n,i)}),Ao=l("$ZodNanoID",(n,i)=>{i.pattern??(i.pattern=Yt),J.init(n,i)}),Vo=l("$ZodCUID",(n,i)=>{i.pattern??(i.pattern=At),J.init(n,i)}),Xo=l("$ZodCUID2",(n,i)=>{i.pattern??(i.pattern=Vt),J.init(n,i)}),qo=l("$ZodULID",(n,i)=>{i.pattern??(i.pattern=Xt),J.init(n,i)}),Ko=l("$ZodXID",(n,i)=>{i.pattern??(i.pattern=qt),J.init(n,i)}),Yo=l("$ZodKSUID",(n,i)=>{i.pattern??(i.pattern=Kt),J.init(n,i)}),Qo=l("$ZodISODateTime",(n,i)=>{i.pattern??(i.pattern=at(i)),J.init(n,i)}),Fo=l("$ZodISODate",(n,i)=>{i.pattern??(i.pattern=ht),J.init(n,i)}),To=l("$ZodISOTime",(n,i)=>{i.pattern??(i.pattern=yt(i)),J.init(n,i)}),Ho=l("$ZodISODuration",(n,i)=>{i.pattern??(i.pattern=Qt),J.init(n,i)}),Bo=l("$ZodIPv4",(n,i)=>{i.pattern??(i.pattern=Bt),J.init(n,i),n._zod.bag.format="ipv4"}),Mo=l("$ZodIPv6",(n,i)=>{i.pattern??(i.pattern=Mt),J.init(n,i),n._zod.bag.format="ipv6",n._zod.check=(o)=>{try{new URL(`http://[${o.value}]`)}catch{o.issues.push({code:"invalid_format",format:"ipv6",input:o.value,inst:n,continue:!i.abort})}}}),xo=l("$ZodMAC",(n,i)=>{i.pattern??(i.pattern=dt(i.delimiter)),J.init(n,i),n._zod.bag.format="mac"}),Ro=l("$ZodCIDRv4",(n,i)=>{i.pattern??(i.pattern=xt),J.init(n,i)}),fo=l("$ZodCIDRv6",(n,i)=>{i.pattern??(i.pattern=Rt),J.init(n,i),n._zod.check=(o)=>{let v=o.value.split("/");try{if(v.length!==2)throw Error();let[r,t]=v;if(!t)throw Error();let e=Number(t);if(`${e}`!==t)throw Error();if(e<0||e>128)throw Error();new URL(`http://[${r}]`)}catch{o.issues.push({code:"invalid_format",format:"cidrv6",input:o.value,inst:n,continue:!i.abort})}}});function Zo(n){if(n==="")return!0;if(/\s/.test(n))return!1;if(n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}var Co=l("$ZodBase64",(n,i)=>{i.pattern??(i.pattern=ft),J.init(n,i),n._zod.bag.contentEncoding="base64",n._zod.check=(o)=>{if(Zo(o.value))return;o.issues.push({code:"invalid_format",format:"base64",input:o.value,inst:n,continue:!i.abort})}});function dg(n){if(!Cn.test(n))return!1;let i=n.replace(/[-_]/g,(v)=>v==="-"?"+":"/"),o=i.padEnd(Math.ceil(i.length/4)*4,"=");return Zo(o)}var ho=l("$ZodBase64URL",(n,i)=>{i.pattern??(i.pattern=Cn),J.init(n,i),n._zod.bag.contentEncoding="base64url",n._zod.check=(o)=>{if(dg(o.value))return;o.issues.push({code:"invalid_format",format:"base64url",input:o.value,inst:n,continue:!i.abort})}}),yo=l("$ZodE164",(n,i)=>{i.pattern??(i.pattern=Ct),J.init(n,i)});function xg(n,i=null){try{let o=n.split(".");if(o.length!==3)return!1;let[v]=o;if(!v)return!1;let r=JSON.parse(atob(v));if("typ"in r&&r?.typ!=="JWT")return!1;if(!r.alg)return!1;if(i&&(!("alg"in r)||r.alg!==i))return!1;return!0}catch{return!1}}var ao=l("$ZodJWT",(n,i)=>{J.init(n,i),n._zod.check=(o)=>{if(xg(o.value,i.alg))return;o.issues.push({code:"invalid_format",format:"jwt",input:o.value,inst:n,continue:!i.abort})}}),po=l("$ZodCustomStringFormat",(n,i)=>{J.init(n,i),n._zod.check=(o)=>{if(i.fn(o.value))return;o.issues.push({code:"invalid_format",format:i.format,input:o.value,inst:n,continue:!i.abort})}}),ii=l("$ZodNumber",(n,i)=>{z.init(n,i),n._zod.pattern=n._zod.bag.pattern??gn,n._zod.parse=(o,v)=>{if(i.coerce)try{o.value=Number(o.value)}catch(e){}let r=o.value;if(typeof r==="number"&&!Number.isNaN(r)&&Number.isFinite(r))return o;let t=typeof r==="number"?Number.isNaN(r)?"NaN":!Number.isFinite(r)?"Infinity":void 0:void 0;return o.issues.push({expected:"number",code:"invalid_type",input:r,inst:n,...t?{received:t}:{}}),o}}),so=l("$ZodNumberFormat",(n,i)=>{uo.init(n,i),ii.init(n,i)}),In=l("$ZodBoolean",(n,i)=>{z.init(n,i),n._zod.pattern=no,n._zod.parse=(o,v)=>{if(i.coerce)try{o.value=Boolean(o.value)}catch(t){}let r=o.value;if(typeof r==="boolean")return o;return o.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:n}),o}}),ti=l("$ZodBigInt",(n,i)=>{z.init(n,i),n._zod.pattern=st,n._zod.parse=(o,v)=>{if(i.coerce)try{o.value=BigInt(o.value)}catch(r){}if(typeof o.value==="bigint")return o;return o.issues.push({expected:"bigint",code:"invalid_type",input:o.value,inst:n}),o}}),rv=l("$ZodBigIntFormat",(n,i)=>{$o.init(n,i),ti.init(n,i)}),nv=l("$ZodSymbol",(n,i)=>{z.init(n,i),n._zod.parse=(o,v)=>{let r=o.value;if(typeof r==="symbol")return o;return o.issues.push({expected:"symbol",code:"invalid_type",input:r,inst:n}),o}}),iv=l("$ZodUndefined",(n,i)=>{z.init(n,i),n._zod.pattern=to,n._zod.values=new Set([void 0]),n._zod.parse=(o,v)=>{let r=o.value;if(typeof r>"u")return o;return o.issues.push({expected:"undefined",code:"invalid_type",input:r,inst:n}),o}}),tv=l("$ZodNull",(n,i)=>{z.init(n,i),n._zod.pattern=io,n._zod.values=new Set([null]),n._zod.parse=(o,v)=>{let r=o.value;if(r===null)return o;return o.issues.push({expected:"null",code:"invalid_type",input:r,inst:n}),o}}),ov=l("$ZodAny",(n,i)=>{z.init(n,i),n._zod.parse=(o)=>o}),vv=l("$ZodUnknown",(n,i)=>{z.init(n,i),n._zod.parse=(o)=>o}),ev=l("$ZodNever",(n,i)=>{z.init(n,i),n._zod.parse=(o,v)=>{return o.issues.push({expected:"never",code:"invalid_type",input:o.value,inst:n}),o}}),uv=l("$ZodVoid",(n,i)=>{z.init(n,i),n._zod.parse=(o,v)=>{let r=o.value;if(typeof r>"u")return o;return o.issues.push({expected:"void",code:"invalid_type",input:r,inst:n}),o}}),$v=l("$ZodDate",(n,i)=>{z.init(n,i),n._zod.parse=(o,v)=>{if(i.coerce)try{o.value=new Date(o.value)}catch(u){}let r=o.value,t=r instanceof Date;if(t&&!Number.isNaN(r.getTime()))return o;return o.issues.push({expected:"date",code:"invalid_type",input:r,...t?{received:"Invalid Date"}:{},inst:n}),o}});function Gg(n,i,o){if(n.issues.length)i.issues.push(...H(o,n.issues));i.value[o]=n.value}var gv=l("$ZodArray",(n,i)=>{z.init(n,i),n._zod.parse=(o,v)=>{let r=o.value;if(!Array.isArray(r))return o.issues.push({expected:"array",code:"invalid_type",input:r,inst:n}),o;o.value=Array(r.length);let t=[];for(let e=0;e<r.length;e++){let u=r[e],g=i.element._zod.run({value:u,issues:[]},v);if(g instanceof Promise)t.push(g.then(($)=>Gg($,o,e)));else Gg(g,o,e)}if(t.length)return Promise.all(t).then(()=>o);return o}});function ni(n,i,o,v,r,t){let e=o in v;if(n.issues.length){if(r&&t&&!e)return;i.issues.push(...H(o,n.issues))}if(!e&&!r){if(!n.issues.length)i.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[o]});return}if(n.value===void 0){if(e)i.value[o]=void 0}else i.value[o]=n.value}function Rg(n){let i=Object.keys(n.shape);for(let v of i)if(!n.shape?.[v]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${v}": expected a Zod schema`);let o=Ot(n.shape);return{...n,keys:i,keySet:new Set(i),numKeys:i.length,optionalKeys:new Set(o)}}function fg(n,i,o,v,r,t){let e=[],u=r.keySet,g=r.catchall._zod,$=g.def.type,c=g.optin==="optional",b=g.optout==="optional";for(let S in i){if(S==="__proto__")continue;if(u.has(S))continue;if($==="never"){e.push(S);continue}let D=g.run({value:i[S],issues:[]},v);if(D instanceof Promise)n.push(D.then((N)=>ni(N,o,S,i,c,b)));else ni(D,o,S,i,c,b)}if(e.length)o.issues.push({code:"unrecognized_keys",keys:e,input:i,inst:t});if(!n.length)return o;return Promise.all(n).then(()=>{return o})}var Zg=l("$ZodObject",(n,i)=>{if(z.init(n,i),!Object.getOwnPropertyDescriptor(i,"shape")?.get){let u=i.shape;Object.defineProperty(i,"shape",{get:()=>{let g={...u};return Object.defineProperty(i,"shape",{value:g}),g}})}let v=Or(()=>Rg(i));j(n._zod,"propValues",()=>{let u=i.shape,g={};for(let $ in u){let c=u[$]._zod;if(c.values){g[$]??(g[$]=new Set);for(let b of c.values)g[$].add(b)}}return g});let r=_r,t=i.catchall,e;n._zod.parse=(u,g)=>{e??(e=v.value);let $=u.value;if(!r($))return u.issues.push({expected:"object",code:"invalid_type",input:$,inst:n}),u;u.value={};let c=[],b=e.shape;for(let S of e.keys){let D=b[S],N=D._zod.optin==="optional",T=D._zod.optout==="optional",A=D._zod.run({value:$[S],issues:[]},g);if(A instanceof Promise)c.push(A.then((_t)=>ni(_t,u,S,$,N,T)));else ni(A,u,S,$,N,T)}if(!t)return c.length?Promise.all(c).then(()=>u):u;return fg(c,$,u,g,v.value,n)}}),lv=l("$ZodObjectJIT",(n,i)=>{Zg.init(n,i);let o=n._zod.parse,v=Or(()=>Rg(i)),r=(S)=>{let D=new an(["shape","payload","ctx"]),N=v.value,T=(Z)=>{let G=Yn(Z);return`shape[${G}]._zod.run({ value: input[${G}], issues: [] }, ctx)`};D.write("const input = payload.value;");let A=Object.create(null),_t=0;for(let Z of N.keys)A[Z]=`key_${_t++}`;D.write("const newResult = {};");for(let Z of N.keys){let G=A[Z],V=Yn(Z),_g=S[Z],Ug=_g?._zod?.optin==="optional",zc=_g?._zod?.optout==="optional";if(D.write(`const ${G} = ${T(Z)};`),Ug&&zc)D.write(`
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Qb as D}from"./vm-hands-entry-lite-qvrnx0vk.js";import{Ih as j}from"./vm-hands-entry-lite-wffqkcjq.js";import{statSync as i}from"fs";import{delimiter as n,join as t}from"path";function _(q,z=process.env.PATH??""){if(!q||q.includes("/")||q.includes("\x00"))return!1;return z.split(n).some((G)=>{if(!G)return!1;try{let Q=i(t(G,q));return Q.isFile()&&(Q.mode&73)!==0}catch{return!1}})}import{spawn as r,spawnSync as e}from"child_process";import{existsSync as k,mkdtempSync as E,readFileSync as O,readdirSync as o,realpathSync as qq,rmSync as b,statSync as zq}from"fs";import{platform as y,tmpdir as g}from"os";import{dirname as A,join as Z}from"path";import{fileURLToPath as Gq,pathToFileURL as T}from"url";var Hq=["bwrap","socat","rg"],Jq=2000,v=20000,Qq=3,P=4000,Vq=new Set([".git",".hg",".svn","node_modules"]),Wq=["runAsHostUid","sysrq-trigger"],Yq=Z(A(A(Gq(import.meta.url))),"packages/sandbox-runtime/src/index.ts"),h=!1;function fq(){h=!0}async function u(){let z=h?Z(A(qq(process.execPath)),"runtime","srt"):void 0;if(z&&process.platform==="linux"&&!k(Z(z,"vendor","seccomp",process.arch,"apply-seccomp")))throw Error("packaged_sandbox_runtime_vendor_missing");if(z){let J=O(Z(z,"sandbox-runtime.mjs"),"utf8");for(let Y of Wq)if(!J.includes(Y))throw Error(`packaged_sandbox_runtime_fork_missing:${Y}`)}let H=(await import(z?T(Z(z,"sandbox-runtime.mjs")).href:T(Yq).href)).SandboxManager;if(!H||typeof H.initialize!=="function"||typeof H.wrapWithSandboxArgv!=="function")throw Error("sandbox-runtime does not expose the expected SandboxManager API.");return{SandboxManager:H}}function Zq(q={}){if((q.platformName??y())!=="linux")return!1;let G=q.fileExists??k,Q=q.readFile??((H)=>O(H,"utf8"));for(let H of["/.dockerenv","/run/.containerenv"])try{if(G(H))return!0}catch{}try{return/docker|containerd|kubepods|lxc|libpod/.test(Q("/proc/1/cgroup"))}catch{return!1}}function l(q){return["/bin/true","/usr/bin/true"].find((z)=>q(z))??null}function $q(q,z){return q==="strict"?["--ro-bind","/","/","--unshare-pid","--unshare-user","--cap-drop","ALL","--proc","/proc","--",z]:["--ro-bind","/","/","--unshare-pid","--unshare-user","--bind","/proc","/proc","--",z]}function jq(q,z){try{let G=e("bwrap",$q(q,z),{stdio:"ignore",timeout:Jq});return!G.error&&G.status===0}catch{return!1}}function Bq(q){let z=q.platformName??y();if(z!=="linux")return null;let G=q.hasExecutable??_;if(!Hq.every((V)=>G(V)))return null;let Q=q.fileExists??k,H=l(Q);if(!H)return null;let J=B??(q.containerized??Zq({platformName:z})?"weak":"strict");return(q.probeNamespaces??((V)=>jq(V,H)))(J)?J:null}var L=null,C=!1,K=null,S=null,f=null,B=null,F=null;function M(){throw I("sandbox_mode_conflict"),new j("sandbox_unavailable","Sandbox process policy conflicts with an existing probe or session. Restart the worker.")}function xq(q){if(B!==null&&B!==q||C&&L!==null&&L!==q||F!==null&&F!==q)M();B=q}function I(q){K=q}function c(q){if(K)return!1;if(!C){if(L=Bq(q??{}),C=!0,L&&!q)d()}return L!==null}function Lq(){return c()?L:null}var U=null,w=0;function m(q){if(K)throw new j("sandbox_unavailable","Confined execution is unavailable in this worker process.");if(B&&q.sandboxMode&&B!==q.sandboxMode)M();let z=B??q.sandboxMode??Lq();if(!z)throw new j("sandbox_unavailable","Confined command execution is unavailable on this operating system.");if(F&&F!==z)M();return F=z,U??=(async()=>{let{SandboxManager:G}=await(q.loadSandboxRuntime??u)();return await G.initialize(Iq(z)),G})().catch((G)=>{throw U=null,I(`initialize_failed: ${String(G)}`),G instanceof j?G:new j("sandbox_unavailable","The confined execution sandbox failed to start.")}),U.then((G)=>{if(K)throw new j("sandbox_unavailable","Confined execution became unavailable during sandbox initialization.");return G})}async function Kq(){let q=U;if(U=null,!q)return;try{await(await q).reset()}catch{}}async function d(q={}){if(K)return!1;if(q.loadSandboxRuntime)return x(q.loadSandboxRuntime);if(!c())return!1;return S??=x(u),S}async function x(q){try{let{SandboxManager:z}=await q(),G=z.checkDependencies().errors;if(G.length>0)return I(`dependencies_missing: ${G.join(", ")}`),!1;return!K}catch(z){return I(`load_failed: ${String(z)}`),!1}}async function Rq(q={}){if(!q.loadSandboxRuntime&&!q.sandboxMode){if(!await d())return!1;return f??=R({}),f}return R(q)}async function R(q){let z;try{z=await m(q)}catch{return!1}let G=await Xq(z);if(!G)I("confined_command_failed");if(w===0)await Kq();return G}async function Xq(q){let z=l(k);if(!z)return!1;let G=E(Z(g(),"reason-device-probe-"));try{let{argv:Q}=await q.wrapWithSandboxArgv(a([z]),p(),{filesystem:s({root:G,allowWrite:!1,temporaryDirectory:G,protectedPaths:[]})},void 0,G),[H,...J]=Q;if(!H)return!1;return await Fq(H,J,G)}catch{return!1}finally{try{q.cleanupAfterCommand()}catch{}b(G,{recursive:!0,force:!0})}}function Fq(q,z,G,Q={}){return new Promise((H)=>{let J=!1,Y,V=(X)=>{if(J)return;J=!0,clearTimeout(Y),H(X)},W;try{W=(Q.spawnChild??r)(q,z,{cwd:G,env:{PATH:D,HOME:G,TMPDIR:G},stdio:"ignore"})}catch{V(!1);return}W.once("error",()=>V(!1));let $=(X,N)=>V(X===0&&N===null);if(W.once("exit",$),W.once("close",$),W.exitCode!==null||W.signalCode!==null)$(W.exitCode,W.signalCode);if(J)return;Y=setTimeout(()=>{V(!1);try{W.kill("SIGKILL")}catch{}},Math.min(Q.timeoutMs??v,v))})}function p(q=k){return["/bin/bash","/bin/sh"].find((z)=>q(z))??"/bin/sh"}function a(q){return q.map((z)=>`'${z.replaceAll("'","'\\''")}'`).join(" ")}function Uq(q,z,G=(Q)=>o(Q,{withFileTypes:!0}).filter((H)=>H.isDirectory()||H.isFile()).map((H)=>H.name)){let Q=[],H=[{path:q,depth:0}],J=0;while(H.length>0&&J<P){let Y=H.pop(),V;try{V=G(Y.path)}catch{continue}for(let W of V){if(J+=1,J>P)break;let $=Z(Y.path,W);if(z($)){Q.push($);continue}if(Y.depth+1<Qq&&!Vq.has(W))H.push({path:$,depth:Y.depth+1})}}return Q}function s(q){let z=Z(q.root,".git"),G=[];try{if(zq(z).isDirectory())G=[Z(z,"config"),Z(z,"hooks")]}catch{}return{denyRead:["/home","/root","/tmp","/tmp/.X11-unix",...q.protectedPaths],allowRead:[q.root,q.temporaryDirectory],allowWrite:[...q.allowWrite?[q.root]:[],q.temporaryDirectory],denyWrite:[...q.protectedPaths,...G]}}function Iq(q){return{network:{allowedDomains:[],deniedDomains:[]},filesystem:{denyRead:[],allowRead:[],allowWrite:[],denyWrite:[]},...q==="weak"?{enableWeakerNestedSandbox:!0}:{}}}function Dq(q){let z=q.createTemporaryDirectory??(()=>E(Z(g(),"reason-device-"))),G=q.removeTemporaryDirectory??((Q)=>b(Q,{recursive:!0,force:!0}));return async(Q,H,J)=>{let Y=await m(q),V=z();w+=1;try{let W;try{W=await Y.wrapWithSandboxArgv(a([Q,...H]),q.shell??p(),{filesystem:s({root:J.root,allowWrite:J.allowWrite,temporaryDirectory:V,protectedPaths:Uq(J.root,q.isProtectedPath)})},J.signal,J.cwd)}catch(N){throw N instanceof j?N:new j("sandbox_unavailable","The confined execution sandbox could not wrap the command.")}let[$,...X]=W.argv;if(!$)throw new j("sandbox_unavailable","The confined execution sandbox produced no command.");return await q.spawnCaptured($,X,{cwd:J.cwd,timeoutMs:J.timeoutMs,signal:J.signal,env:q.scrubEnvironment(J.root,V)})}finally{w-=1;try{Y.cleanupAfterCommand()}catch{}G(V)}}}
2
+ import{Qb as D}from"./vm-hands-entry-lite-qvrnx0vk.js";import{Jh as j}from"./vm-hands-entry-lite-sn3vjjgx.js";import{statSync as i}from"fs";import{delimiter as n,join as t}from"path";function _(q,z=process.env.PATH??""){if(!q||q.includes("/")||q.includes("\x00"))return!1;return z.split(n).some((G)=>{if(!G)return!1;try{let Q=i(t(G,q));return Q.isFile()&&(Q.mode&73)!==0}catch{return!1}})}import{spawn as r,spawnSync as e}from"child_process";import{existsSync as k,mkdtempSync as E,readFileSync as O,readdirSync as o,realpathSync as qq,rmSync as b,statSync as zq}from"fs";import{platform as y,tmpdir as g}from"os";import{dirname as A,join as Z}from"path";import{fileURLToPath as Gq,pathToFileURL as T}from"url";var Hq=["bwrap","socat","rg"],Jq=2000,v=20000,Qq=3,P=4000,Vq=new Set([".git",".hg",".svn","node_modules"]),Wq=["runAsHostUid","sysrq-trigger"],Yq=Z(A(A(Gq(import.meta.url))),"packages/sandbox-runtime/src/index.ts"),h=!1;function fq(){h=!0}async function u(){let z=h?Z(A(qq(process.execPath)),"runtime","srt"):void 0;if(z&&process.platform==="linux"&&!k(Z(z,"vendor","seccomp",process.arch,"apply-seccomp")))throw Error("packaged_sandbox_runtime_vendor_missing");if(z){let J=O(Z(z,"sandbox-runtime.mjs"),"utf8");for(let Y of Wq)if(!J.includes(Y))throw Error(`packaged_sandbox_runtime_fork_missing:${Y}`)}let H=(await import(z?T(Z(z,"sandbox-runtime.mjs")).href:T(Yq).href)).SandboxManager;if(!H||typeof H.initialize!=="function"||typeof H.wrapWithSandboxArgv!=="function")throw Error("sandbox-runtime does not expose the expected SandboxManager API.");return{SandboxManager:H}}function Zq(q={}){if((q.platformName??y())!=="linux")return!1;let G=q.fileExists??k,Q=q.readFile??((H)=>O(H,"utf8"));for(let H of["/.dockerenv","/run/.containerenv"])try{if(G(H))return!0}catch{}try{return/docker|containerd|kubepods|lxc|libpod/.test(Q("/proc/1/cgroup"))}catch{return!1}}function l(q){return["/bin/true","/usr/bin/true"].find((z)=>q(z))??null}function $q(q,z){return q==="strict"?["--ro-bind","/","/","--unshare-pid","--unshare-user","--cap-drop","ALL","--proc","/proc","--",z]:["--ro-bind","/","/","--unshare-pid","--unshare-user","--bind","/proc","/proc","--",z]}function jq(q,z){try{let G=e("bwrap",$q(q,z),{stdio:"ignore",timeout:Jq});return!G.error&&G.status===0}catch{return!1}}function Bq(q){let z=q.platformName??y();if(z!=="linux")return null;let G=q.hasExecutable??_;if(!Hq.every((V)=>G(V)))return null;let Q=q.fileExists??k,H=l(Q);if(!H)return null;let J=B??(q.containerized??Zq({platformName:z})?"weak":"strict");return(q.probeNamespaces??((V)=>jq(V,H)))(J)?J:null}var L=null,C=!1,K=null,S=null,f=null,B=null,F=null;function M(){throw I("sandbox_mode_conflict"),new j("sandbox_unavailable","Sandbox process policy conflicts with an existing probe or session. Restart the worker.")}function xq(q){if(B!==null&&B!==q||C&&L!==null&&L!==q||F!==null&&F!==q)M();B=q}function I(q){K=q}function c(q){if(K)return!1;if(!C){if(L=Bq(q??{}),C=!0,L&&!q)d()}return L!==null}function Lq(){return c()?L:null}var U=null,w=0;function m(q){if(K)throw new j("sandbox_unavailable","Confined execution is unavailable in this worker process.");if(B&&q.sandboxMode&&B!==q.sandboxMode)M();let z=B??q.sandboxMode??Lq();if(!z)throw new j("sandbox_unavailable","Confined command execution is unavailable on this operating system.");if(F&&F!==z)M();return F=z,U??=(async()=>{let{SandboxManager:G}=await(q.loadSandboxRuntime??u)();return await G.initialize(Iq(z)),G})().catch((G)=>{throw U=null,I(`initialize_failed: ${String(G)}`),G instanceof j?G:new j("sandbox_unavailable","The confined execution sandbox failed to start.")}),U.then((G)=>{if(K)throw new j("sandbox_unavailable","Confined execution became unavailable during sandbox initialization.");return G})}async function Kq(){let q=U;if(U=null,!q)return;try{await(await q).reset()}catch{}}async function d(q={}){if(K)return!1;if(q.loadSandboxRuntime)return x(q.loadSandboxRuntime);if(!c())return!1;return S??=x(u),S}async function x(q){try{let{SandboxManager:z}=await q(),G=z.checkDependencies().errors;if(G.length>0)return I(`dependencies_missing: ${G.join(", ")}`),!1;return!K}catch(z){return I(`load_failed: ${String(z)}`),!1}}async function Rq(q={}){if(!q.loadSandboxRuntime&&!q.sandboxMode){if(!await d())return!1;return f??=R({}),f}return R(q)}async function R(q){let z;try{z=await m(q)}catch{return!1}let G=await Xq(z);if(!G)I("confined_command_failed");if(w===0)await Kq();return G}async function Xq(q){let z=l(k);if(!z)return!1;let G=E(Z(g(),"reason-device-probe-"));try{let{argv:Q}=await q.wrapWithSandboxArgv(a([z]),p(),{filesystem:s({root:G,allowWrite:!1,temporaryDirectory:G,protectedPaths:[]})},void 0,G),[H,...J]=Q;if(!H)return!1;return await Fq(H,J,G)}catch{return!1}finally{try{q.cleanupAfterCommand()}catch{}b(G,{recursive:!0,force:!0})}}function Fq(q,z,G,Q={}){return new Promise((H)=>{let J=!1,Y,V=(X)=>{if(J)return;J=!0,clearTimeout(Y),H(X)},W;try{W=(Q.spawnChild??r)(q,z,{cwd:G,env:{PATH:D,HOME:G,TMPDIR:G},stdio:"ignore"})}catch{V(!1);return}W.once("error",()=>V(!1));let $=(X,N)=>V(X===0&&N===null);if(W.once("exit",$),W.once("close",$),W.exitCode!==null||W.signalCode!==null)$(W.exitCode,W.signalCode);if(J)return;Y=setTimeout(()=>{V(!1);try{W.kill("SIGKILL")}catch{}},Math.min(Q.timeoutMs??v,v))})}function p(q=k){return["/bin/bash","/bin/sh"].find((z)=>q(z))??"/bin/sh"}function a(q){return q.map((z)=>`'${z.replaceAll("'","'\\''")}'`).join(" ")}function Uq(q,z,G=(Q)=>o(Q,{withFileTypes:!0}).filter((H)=>H.isDirectory()||H.isFile()).map((H)=>H.name)){let Q=[],H=[{path:q,depth:0}],J=0;while(H.length>0&&J<P){let Y=H.pop(),V;try{V=G(Y.path)}catch{continue}for(let W of V){if(J+=1,J>P)break;let $=Z(Y.path,W);if(z($)){Q.push($);continue}if(Y.depth+1<Qq&&!Vq.has(W))H.push({path:$,depth:Y.depth+1})}}return Q}function s(q){let z=Z(q.root,".git"),G=[];try{if(zq(z).isDirectory())G=[Z(z,"config"),Z(z,"hooks")]}catch{}return{denyRead:["/home","/root","/tmp","/tmp/.X11-unix",...q.protectedPaths],allowRead:[q.root,q.temporaryDirectory],allowWrite:[...q.allowWrite?[q.root]:[],q.temporaryDirectory],denyWrite:[...q.protectedPaths,...G]}}function Iq(q){return{network:{allowedDomains:[],deniedDomains:[]},filesystem:{denyRead:[],allowRead:[],allowWrite:[],denyWrite:[]},...q==="weak"?{enableWeakerNestedSandbox:!0}:{}}}function Dq(q){let z=q.createTemporaryDirectory??(()=>E(Z(g(),"reason-device-"))),G=q.removeTemporaryDirectory??((Q)=>b(Q,{recursive:!0,force:!0}));return async(Q,H,J)=>{let Y=await m(q),V=z();w+=1;try{let W;try{W=await Y.wrapWithSandboxArgv(a([Q,...H]),q.shell??p(),{filesystem:s({root:J.root,allowWrite:J.allowWrite,temporaryDirectory:V,protectedPaths:Uq(J.root,q.isProtectedPath)})},J.signal,J.cwd)}catch(N){throw N instanceof j?N:new j("sandbox_unavailable","The confined execution sandbox could not wrap the command.")}let[$,...X]=W.argv;if(!$)throw new j("sandbox_unavailable","The confined execution sandbox produced no command.");return await q.spawnCaptured($,X,{cwd:J.cwd,timeoutMs:J.timeoutMs,signal:J.signal,env:q.scrubEnvironment(J.root,V)})}finally{w-=1;try{Y.cleanupAfterCommand()}catch{}G(V)}}}
3
3
  export{_ as Jb,fq as Kb,xq as Lb,c as Mb,Rq as Nb,p as Ob,Dq as Pb};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{lh as m}from"./vm-hands-entry-lite-mxavr4y3.js";var E=["Click browser element","Double click browser element","Type text","Clear browser field","Press key","Scroll browser element into view","Drag on computer","Select browser option","Check browser control","Uncheck browser control","Hover browser element","Focus browser element","Open browser page","Reload browser page","Go back in browser","Go forward in browser","Take browser screenshot"],VA=32;function R(x){if(!Array.isArray(x)||x.length>32||!x.every((A)=>typeof A==="string"&&E.includes(A)))return;return x.slice()}var $A="__ARA_PI_TOOL_CONFINED_SCRIPT_5f0c9e2a__",JA=262144;function Y(x){if(!x||typeof x!=="object"||Array.isArray(x))return!1;let A=x,B=Object.keys(A);return B.length===2&&B.includes("template")&&B.includes("quoteDepth")&&typeof A.template==="string"&&A.template.length<=262144&&!A.template.includes("\x00")&&A.template.split("__ARA_PI_TOOL_CONFINED_SCRIPT_5f0c9e2a__").length===2&&(A.quoteDepth===1||A.quoteDepth===2||A.quoteDepth===3)}var X=2,P=33554432,K=200000,D=4000000,Q=240000,DA=`
2
+ import{lh as m}from"./vm-hands-entry-lite-ngvxyjhy.js";var E=["Click browser element","Double click browser element","Type text","Clear browser field","Press key","Scroll browser element into view","Drag on computer","Select browser option","Check browser control","Uncheck browser control","Hover browser element","Focus browser element","Open browser page","Reload browser page","Go back in browser","Go forward in browser","Take browser screenshot"],VA=32;function R(x){if(!Array.isArray(x)||x.length>32||!x.every((A)=>typeof A==="string"&&E.includes(A)))return;return x.slice()}var $A="__ARA_PI_TOOL_CONFINED_SCRIPT_5f0c9e2a__",JA=262144;function Y(x){if(!x||typeof x!=="object"||Array.isArray(x))return!1;let A=x,B=Object.keys(A);return B.length===2&&B.includes("template")&&B.includes("quoteDepth")&&typeof A.template==="string"&&A.template.length<=262144&&!A.template.includes("\x00")&&A.template.split("__ARA_PI_TOOL_CONFINED_SCRIPT_5f0c9e2a__").length===2&&(A.quoteDepth===1||A.quoteDepth===2||A.quoteDepth===3)}var X=2,P=33554432,K=200000,D=4000000,Q=240000,DA=`
3
3
  ...[executor output truncated]`,j=2000,f=1,b=16384,p=32768,w=128,RA=64,i=2097152,h=1,y=16384,d=32768,YA=8388608,s=1000,c=2500,n=2000,LA=c+n,t=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,199}$/,r=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,o={text_only:4430,invalid_json:4431,invalid_cancel_request:4432,invalid_sdk_response:4433,claim_required:4434,invalid_claim:4435,executor_mismatch:4436,stale_generation:4437,fence_conflict:4438,frame_too_large:4439,result_too_large:4440,progress_too_large:4441,terminal_cleanup_started:4442,job_journal_unavailable:4443},v=new Map(Object.entries(o).map(([x,A])=>[A,x]));function OA(x,A){return A||(v.get(x)??"")}var l=["cancelled","command_failed","duplicate_request_id","duplicate_result_evicted","invalid_repl_response","invalid_request","process_group_cleanup_unconfirmed","repl_failed","result_too_large","repl_response_too_large","repl_transport_failed","request_ledger_full","request_journal_unavailable","request_outcome_uncertain","maintenance_held","request_not_found","resume_digest_mismatch","spawn_failed","stale_generation","timeout"],u=new Set(l),a=200,e=2000,AA=["maintenance_held","invalid_job_request","jobs_disabled","job_not_found","job_conflict","job_capacity","job_journal_unavailable","job_not_running","job_lease_expired","job_input_sequence","job_input_backpressure","stale_generation","pty_unsupported","job_mode_mismatch"];class G extends Error{code;constructor(x){super(x);this.name="HandsProtocolError",this.code=x}}function k(x){return new TextEncoder().encode(x).byteLength}function F(x){return typeof x==="object"&&x!==null&&!Array.isArray(x)}function W(x,A){let B=new Set(A);return Object.keys(x).every((N)=>B.has(N))}function M(x){return typeof x==="string"&&t.test(x)}function V(x){return Number.isSafeInteger(x)&&Number(x)>=1}function $(x){return typeof x==="string"&&r.test(x)}function C(x){return typeof x==="string"&&x.startsWith("pty-")&&$(x.slice(4))}function z(x){return[x.cols,x.rows].every((A)=>Number.isSafeInteger(A)&&Number(A)>=1&&Number(A)<=s)}function H(x){if(typeof x!=="string"||x.length>Math.ceil(y/3)*4||x.length%4!==0||!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(x))return-1;let A=x.endsWith("==")?2:x.endsWith("=")?1:0;if(A&&"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(x[x.length-A-1])&(A===2?15:3))return-1;let N=x.length/4*3-A;return N<=y?N:-1}function S(x){return typeof x==="string"&&/^[0-9a-f]{64}$/.test(x)}function Z(x){if(k(x)>P)throw new G("frame_too_large");try{return JSON.parse(x)}catch{throw new G("invalid_json")}}function xA(x){let A=Z(x);if(!F(A)||!W(A,["version","generation","id","tool","input","semanticDigest","lifecycleLeaseId"])||A.version!==X||!V(A.generation)||!M(A.id)||!["bash","repl","resume","read","edit","write","pi_tool"].includes(String(A.tool))||!F(A.input)||A.lifecycleLeaseId!==void 0&&(A.tool!=="bash"||!$(A.lifecycleLeaseId)))throw new G("invalid_request");if(A.tool==="bash"){if(!W(A.input,["script","retainBackground","machineSdk"])||typeof A.input.script!=="string"||A.input.script.length>K||A.input.retainBackground!==void 0&&A.input.retainBackground!==!0||A.input.machineSdk!==void 0&&A.input.machineSdk!==!0||A.semanticDigest!==void 0&&!S(A.semanticDigest))throw new G("invalid_request");return{version:X,generation:A.generation,id:A.id,tool:"bash",input:{script:A.input.script,...A.input.retainBackground===!0?{retainBackground:!0}:{},...A.input.machineSdk===!0?{machineSdk:!0}:{}},...A.semanticDigest===void 0?{}:{semanticDigest:A.semanticDigest},...A.lifecycleLeaseId===void 0?{}:{lifecycleLeaseId:A.lifecycleLeaseId}}}if(A.tool==="resume"){if(A.semanticDigest!==void 0||!W(A.input,["semanticDigest"])||!S(A.input.semanticDigest))throw new G("invalid_request");return{version:X,generation:A.generation,id:A.id,tool:"resume",input:{semanticDigest:A.input.semanticDigest}}}if(A.tool==="repl"){if(!W(A.input,["code"])||typeof A.input.code!=="string"||A.input.code.length>K||A.semanticDigest!==void 0)throw new G("invalid_request");return{version:X,generation:A.generation,id:A.id,tool:"repl",input:{code:A.input.code}}}if(A.tool==="pi_tool"){let B=A.semanticDigest===void 0?BA(A.input):null;if(!B)throw new G("invalid_request");return{version:X,generation:A.generation,id:A.id,tool:"pi_tool",input:B}}if(A.tool==="read"){if(!W(A.input,["path","offset","limit"])||typeof A.input.path!=="string"||A.input.path.length<1||A.input.path.length>K||A.semanticDigest!==void 0||A.input.offset!==void 0&&(!Number.isSafeInteger(A.input.offset)||Number(A.input.offset)<1)||A.input.limit!==void 0&&(!Number.isSafeInteger(A.input.limit)||Number(A.input.limit)<1||Number(A.input.limit)>2000))throw new G("invalid_request");return{version:X,generation:A.generation,id:A.id,tool:"read",input:{path:A.input.path,...A.input.offset===void 0?{}:{offset:Number(A.input.offset)},...A.input.limit===void 0?{}:{limit:Number(A.input.limit)}}}}if(A.tool==="edit"){if(!W(A.input,["path","edits"])||typeof A.input.path!=="string"||A.input.path.length<1||!Array.isArray(A.input.edits)||A.input.edits.length<1||A.input.edits.length>128||A.semanticDigest!==void 0)throw new G("invalid_request");let B=A.input.path.length,N=[];for(let I of A.input.edits){if(!F(I)||!W(I,["oldText","newText"])||typeof I.oldText!=="string"||I.oldText.length<1||typeof I.newText!=="string")throw new G("invalid_request");if(B+=I.oldText.length+I.newText.length,B>D)throw new G("invalid_request");N.push({oldText:I.oldText,newText:I.newText})}return{version:X,generation:A.generation,id:A.id,tool:"edit",input:{path:A.input.path,edits:N}}}if(A.tool!=="write"||!W(A.input,["path","content"])||typeof A.input.path!=="string"||A.input.path.length<1||typeof A.input.content!=="string"||A.input.path.length+A.input.content.length>D||A.semanticDigest!==void 0)throw new G("invalid_request");return{version:X,generation:A.generation,id:A.id,tool:"write",input:{path:A.input.path,content:A.input.content}}}function L(x){return x===void 0||typeof x==="number"&&Number.isFinite(x)}function BA(x){let A=x.args;if(!W(x,["tool","args"])||!F(A))return null;if(x.tool==="bash")return W(A,["command","timeout"])&&typeof A.command==="string"&&A.command.length<=K&&L(A.timeout)?{tool:"bash",args:{command:A.command,...A.timeout===void 0?{}:{timeout:Number(A.timeout)}}}:null;if(typeof A.path!=="string"||A.path.length>K)return null;if(x.tool==="read")return W(A,["path","offset","limit"])&&L(A.offset)&&L(A.limit)?{tool:"read",args:{path:A.path,...A.offset===void 0?{}:{offset:Number(A.offset)},...A.limit===void 0?{}:{limit:Number(A.limit)}}}:null;if(x.tool==="write")return W(A,["path","content"])&&typeof A.content==="string"&&A.path.length+A.content.length<=D?{tool:"write",args:{path:A.path,content:A.content}}:null;if(x.tool!=="edit"||!W(A,["path","edits"])||!Array.isArray(A.edits))return null;let B=A.path.length,N=[];for(let I of A.edits){if(!F(I)||!W(I,["oldText","newText"])||typeof I.oldText!=="string"||typeof I.newText!=="string")return null;if(B+=I.oldText.length+I.newText.length,B>D)return null;N.push({oldText:I.oldText,newText:I.newText})}return{tool:"edit",args:{path:A.path,edits:N}}}function WA(x){if(!F(x))return null;if("thrown"in x)return W(x,["thrown"])&&typeof x.thrown==="string"?{thrown:x.thrown}:null;let A=x.structuredContent;if(!W(x,["content","details","structuredContent","isError"])||!Array.isArray(x.content)||x.isError!==void 0&&x.isError!==!0||A!==void 0&&(!F(A)||!W(A,["output","truncated","full_output_path","exit_code","wall_time_seconds"])||typeof A.output!=="string"||typeof A.truncated!=="boolean"||A.full_output_path!==void 0&&typeof A.full_output_path!=="string"||typeof A.exit_code!=="number"||typeof A.wall_time_seconds!=="number"))return null;let B=[];for(let N of x.content)if(F(N)&&N.type==="text"&&W(N,["type","text"])&&typeof N.text==="string")B.push({type:"text",text:N.text});else if(F(N)&&N.type==="image"&&W(N,["type","data","mimeType"])&&typeof N.data==="string"&&typeof N.mimeType==="string")B.push({type:"image",data:N.data,mimeType:N.mimeType});else return null;return{content:B,...x.details===void 0?{}:{details:x.details},...F(A)?{structuredContent:{output:String(A.output),truncated:A.truncated===!0,...typeof A.full_output_path==="string"?{full_output_path:A.full_output_path}:{},exit_code:Number(A.exit_code),wall_time_seconds:Number(A.wall_time_seconds)}}:{},...x.isError===!0?{isError:!0}:{}}}function GA(x){let A=Z(x);if(!F(A)||!W(A,["version","generation","id","ok","exitCode","stdout","stderr","cwd","error","resumed","browserActions","automaticProgressImage","piToolOutcome","workerElapsedMs","environmentWaitMs"])||A.version!==X||!V(A.generation)||!M(A.id)||typeof A.ok!=="boolean"||!Number.isSafeInteger(A.exitCode)||Number(A.exitCode)<0||Number(A.exitCode)>255||typeof A.stdout!=="string"||A.stdout.length>Q||typeof A.stderr!=="string"||A.stderr.length>Q||A.cwd!==void 0&&(typeof A.cwd!=="string"||A.cwd.length<1||A.cwd.length>4096||!A.cwd.startsWith("/")||A.cwd.includes("\x00"))||A.error!==void 0&&(typeof A.error!=="string"||A.error.length<1||A.error.length>j||!u.has(A.error))||A.browserActions!==void 0&&!R(A.browserActions)||A.automaticProgressImage!==void 0&&(A.automaticProgressImage!==!0||!A.ok)||A.resumed!==void 0&&A.resumed!==!0||A.workerElapsedMs!==void 0&&(!Number.isSafeInteger(A.workerElapsedMs)||Number(A.workerElapsedMs)<0)||A.environmentWaitMs!==void 0&&(!Number.isSafeInteger(A.environmentWaitMs)||Number(A.environmentWaitMs)<0)||A.ok&&(A.exitCode!==0||A.error!==void 0)||!A.ok&&A.exitCode===0)throw new G("invalid_result");let B=A.piToolOutcome===void 0?void 0:WA(A.piToolOutcome);if(B===null||B&&!A.ok)throw new G("invalid_result");return{version:X,generation:A.generation,id:A.id,ok:A.ok,exitCode:Number(A.exitCode),stdout:A.stdout,stderr:A.stderr,...typeof A.cwd==="string"?{cwd:A.cwd}:{},...A.browserActions!==void 0?{browserActions:R(A.browserActions)}:{},...typeof A.error==="string"?{error:A.error}:{},...A.automaticProgressImage===!0?{automaticProgressImage:!0}:{},...A.resumed===!0?{resumed:!0}:{},...B?{piToolOutcome:B}:{},...A.workerElapsedMs!==void 0?{workerElapsedMs:Number(A.workerElapsedMs)}:{},...A.environmentWaitMs!==void 0?{environmentWaitMs:Number(A.environmentWaitMs)}:{}}}function NA(x){let A=Z(x);if(!F(A)||!W(A,["type","version","generation","id","sequence","stdout","stderr"])||A.type!=="progress"||A.version!==X||!V(A.generation)||!M(A.id)||!Number.isSafeInteger(A.sequence)||Number(A.sequence)<1||typeof A.stdout!=="string"||A.stdout.length>Q||typeof A.stderr!=="string"||A.stderr.length>Q)throw new G("invalid_progress");return{type:"progress",version:X,generation:Number(A.generation),id:A.id,sequence:Number(A.sequence),stdout:A.stdout,stderr:A.stderr}}function UA(x){let A=Z(x);if(!F(A)||!W(A,["type","version","generation","fenceId","executorLaunchId","requestCancelVersion","managedJobsVersion","browserRunEnvelopeVersion","terminalCleanupVersion","guestMemoryVersion","guestMemoryDiagnosticsVersion","piToolsVersion","piToolsConfinement","backgroundBashVersion","machineSdkVersion","executionTimingVersion","environmentWaitVersion"])||A.type!=="claim"||A.version!==X||!V(A.generation)||!$(A.fenceId)||!$(A.executorLaunchId)||A.requestCancelVersion!==void 0&&A.requestCancelVersion!==1||A.managedJobsVersion!==void 0&&A.managedJobsVersion!==f||A.guestMemoryVersion!==void 0&&A.guestMemoryVersion!==1||A.guestMemoryDiagnosticsVersion!==void 0&&(A.guestMemoryDiagnosticsVersion!==1||A.guestMemoryVersion!==1)||A.terminalCleanupVersion!==void 0&&A.terminalCleanupVersion!==1||A.browserRunEnvelopeVersion!==void 0&&A.browserRunEnvelopeVersion!==1||A.piToolsVersion!==void 0&&A.piToolsVersion!==1||A.piToolsConfinement!==void 0&&(!Y(A.piToolsConfinement)||A.piToolsVersion!==1)||A.backgroundBashVersion!==void 0&&A.backgroundBashVersion!==1||A.machineSdkVersion!==void 0&&A.machineSdkVersion!==1||A.executionTimingVersion!==void 0&&A.executionTimingVersion!==1||A.environmentWaitVersion!==void 0&&(A.environmentWaitVersion!==1||A.executionTimingVersion!==1))throw new G("invalid_claim");return{type:"claim",version:X,generation:A.generation,fenceId:A.fenceId,executorLaunchId:A.executorLaunchId,...A.requestCancelVersion===1?{requestCancelVersion:1}:{},...A.managedJobsVersion===1?{managedJobsVersion:1}:{},...A.guestMemoryVersion===1?{guestMemoryVersion:1}:{},...A.guestMemoryDiagnosticsVersion===1?{guestMemoryDiagnosticsVersion:1}:{},...A.terminalCleanupVersion===1?{terminalCleanupVersion:1}:{},...A.browserRunEnvelopeVersion===1?{browserRunEnvelopeVersion:1}:{},...A.piToolsVersion===1?{piToolsVersion:1}:{},...Y(A.piToolsConfinement)?{piToolsConfinement:{template:A.piToolsConfinement.template,quoteDepth:A.piToolsConfinement.quoteDepth}}:{},...A.backgroundBashVersion===1?{backgroundBashVersion:1}:{},...A.machineSdkVersion===1?{machineSdkVersion:1}:{},...A.executionTimingVersion===1?{executionTimingVersion:1}:{},...A.environmentWaitVersion===1?{environmentWaitVersion:1}:{}}}function FA(x){let A=Z(x);if(!F(A)||!W(A,["type","version","generation","fenceId","executorLaunchId","workerVersion","workerArtifactSha256","requestCancelVersion","managedJobsVersion","lifecycleVersion","browserRunEnvelopeVersion","terminalCleanupVersion","guestMemoryVersion","guestMemoryDiagnosticsVersion","piToolsVersion","piToolsConfinementVersion","backgroundBashVersion","machineSdkVersion","executionTimingVersion","environmentWaitVersion"])||A.lifecycleVersion!==void 0&&A.lifecycleVersion!==1||A.piToolsVersion!==void 0&&A.piToolsVersion!==1||A.piToolsConfinementVersion!==void 0&&(A.piToolsConfinementVersion!==1||A.piToolsVersion!==1)||A.backgroundBashVersion!==void 0&&A.backgroundBashVersion!==1||A.machineSdkVersion!==void 0&&A.machineSdkVersion!==1||A.executionTimingVersion!==void 0&&A.executionTimingVersion!==1||A.environmentWaitVersion!==void 0&&(A.environmentWaitVersion!==1||A.executionTimingVersion!==1)||A.guestMemoryVersion!==void 0&&A.guestMemoryVersion!==1||A.guestMemoryDiagnosticsVersion!==void 0&&(A.guestMemoryDiagnosticsVersion!==1||A.guestMemoryVersion!==1)||A.terminalCleanupVersion!==void 0&&A.terminalCleanupVersion!==1||A.browserRunEnvelopeVersion!==void 0&&A.browserRunEnvelopeVersion!==1||A.type!=="claim_ack"||A.version!==X||!V(A.generation)||!$(A.fenceId)||!$(A.executorLaunchId)||!Number.isSafeInteger(A.workerVersion)||Number(A.workerVersion)<1||!S(A.workerArtifactSha256)||A.requestCancelVersion!==void 0&&A.requestCancelVersion!==1||A.managedJobsVersion!==void 0&&A.managedJobsVersion!==f)throw new G("invalid_claim_ack");return{type:"claim_ack",...A.guestMemoryVersion===1?{guestMemoryVersion:1}:{},...A.guestMemoryDiagnosticsVersion===1?{guestMemoryDiagnosticsVersion:1}:{},...A.terminalCleanupVersion===1?{terminalCleanupVersion:1}:{},...A.browserRunEnvelopeVersion===1?{browserRunEnvelopeVersion:1}:{},...A.lifecycleVersion===1?{lifecycleVersion:1}:{},...A.piToolsVersion===1?{piToolsVersion:1}:{},...A.piToolsConfinementVersion===1?{piToolsConfinementVersion:1}:{},...A.backgroundBashVersion===1?{backgroundBashVersion:1}:{},...A.machineSdkVersion===1?{machineSdkVersion:1}:{},...A.executionTimingVersion===1?{executionTimingVersion:1}:{},...A.environmentWaitVersion===1?{environmentWaitVersion:1}:{},version:X,generation:A.generation,fenceId:A.fenceId,executorLaunchId:A.executorLaunchId,workerVersion:Number(A.workerVersion),workerArtifactSha256:A.workerArtifactSha256,...A.requestCancelVersion===1?{requestCancelVersion:1}:{},...A.managedJobsVersion===1?{managedJobsVersion:1}:{}}}function zA(x){let A=Z(x);if(!F(A)||!W(A,["type","version","generation","id","jobId","action","input"])||A.type!=="job"||A.version!==X||!V(A.generation)||!M(A.id)||!M(A.jobId)||!F(A.input))throw new G("invalid_job_request");let B=A.input,N=Number.isSafeInteger(B.leaseExpiresAtMs)&&Number(B.leaseExpiresAtMs)>0,I=Number.isSafeInteger(B.sequence)&&Number(B.sequence)>=1;if(!(A.action==="start"?B.mode==="pty"?W(B,["mode","cols","rows","leaseExpiresAtMs"])&&C(A.jobId)&&z(B)&&N:W(B,["script","leaseExpiresAtMs"])&&typeof B.script==="string"&&B.script.length<=K&&N:A.action==="inspect"?W(B,["after"])&&Number.isSafeInteger(B.after)&&Number(B.after)>=0:A.action==="input"?"dataBase64"in B?W(B,["sequence","dataBase64"])&&C(A.jobId)&&I&&H(B.dataBase64)>0:W(B,["sequence","data","eof"])&&I&&typeof B.data==="string"&&B.data.length<=b&&typeof B.eof==="boolean":A.action==="resize"?W(B,["sequence","cols","rows"])&&C(A.jobId)&&I&&z(B):A.action==="renew"?W(B,["leaseExpiresAtMs"])&&N:A.action==="cancel"&&W(B,[])))throw new G("invalid_job_request");return A}function IA(x){let A=Z(x);if(!F(A)||!W(A,["type","version","generation","id","ok","job","error"])||A.type!=="job_result"||A.version!==X||!V(A.generation)||!M(A.id))throw new G("invalid_job_result");if(A.ok===!1&&A.job===void 0&&typeof A.error==="string"&&AA.some((U)=>U===A.error))return A;let B=A.job;if(A.ok!==!0||A.error!==void 0||!F(B)||!W(B,["jobId","state","startedAtMs","finishedAtMs","leaseExpiresAtMs","exitCode","inputSequence","output","firstCursor","nextCursor","truncated","process","environmentRevision","environmentSnapshotId","pty"])||!M(B.jobId)||!["starting","running","exited","cancelled","expired","uncertain"].includes(String(B.state))||!Number.isSafeInteger(B.startedAtMs)||Number(B.startedAtMs)<1||!Number.isSafeInteger(B.leaseExpiresAtMs)||Number(B.leaseExpiresAtMs)<1||B.finishedAtMs!==null&&(!Number.isSafeInteger(B.finishedAtMs)||Number(B.finishedAtMs)<Number(B.startedAtMs))||B.exitCode!==null&&(!Number.isSafeInteger(B.exitCode)||Number(B.exitCode)<0||Number(B.exitCode)>255)||!Number.isSafeInteger(B.inputSequence)||Number(B.inputSequence)<0||!Number.isSafeInteger(B.firstCursor)||Number(B.firstCursor)<1||!Number.isSafeInteger(B.nextCursor)||Number(B.nextCursor)<Number(B.firstCursor)-1||typeof B.truncated!=="boolean"||!Array.isArray(B.output)||B.output.length>w)throw new G("invalid_job_result");if(B.environmentRevision===void 0!==(B.environmentSnapshotId===void 0)||B.environmentRevision!==void 0&&(!Number.isSafeInteger(B.environmentRevision)||Number(B.environmentRevision)<1||!$(B.environmentSnapshotId)))throw new G("invalid_job_result");let N=Number(B.firstCursor)-1,I=0;for(let U of B.output){if(!F(U)||!W(U,["cursor","stream","text"])||!Number.isSafeInteger(U.cursor)||Number(U.cursor)<=N||Number(U.cursor)>Number(B.nextCursor)||!["stdout","stderr"].includes(String(U.stream))||typeof U.text!=="string")throw new G("invalid_job_result");I+=U.text.length,N=Number(U.cursor)}if(I>p)throw new G("invalid_job_result");let _=B.state==="starting"||B.state==="running";if(_&&(B.finishedAtMs!==null||B.exitCode!==null)||!_&&B.finishedAtMs===null||B.state==="uncertain"&&B.exitCode!==null||B.state==="exited"&&B.exitCode===null||B.state==="cancelled"&&B.exitCode!==130||B.state==="expired"&&B.exitCode!==124)throw new G("invalid_job_result");if(B.process!==void 0){let U=B.process;if(!F(U)||!W(U,["pid","processGroupId","executorLaunchId"])||!Number.isSafeInteger(U.pid)||Number(U.pid)<1||U.processGroupId!==U.pid||!$(U.executorLaunchId)||!["starting","running"].includes(String(B.state)))throw new G("invalid_job_result")}if(B.pty!==void 0){let U=B.pty;if(!F(U)||!W(U,["version","cols","rows","output","cleanup"])||U.version!==h||!C(B.jobId)||!z(U)||B.output.length!==0||!Array.isArray(U.output)||U.output.length>w||(_?U.cleanup!=="pending":B.state==="uncertain"?U.cleanup!=="unconfirmed":U.cleanup!=="confirmed")||B.state==="running"&&(B.process===void 0||B.environmentRevision===void 0))throw new G("invalid_job_result");let T=Number(B.firstCursor)-1,g=0;for(let J of U.output){if(!F(J)||!W(J,["cursor","dataBase64"])||!Number.isSafeInteger(J.cursor)||Number(J.cursor)<=T||Number(J.cursor)>Number(B.nextCursor))throw new G("invalid_job_result");let q=H(J.dataBase64);if(q<=0||(g+=q)>d)throw new G("invalid_job_result");T=Number(J.cursor)}}return A}function SA(x){if(k(x)>i)throw new G("frame_too_large");let A=Z(x);if(!F(A)||!W(A,["version","sessionId","operationId","runId","deviceId","rootId","workspace","binding","targetRevision","rootGrantRevision","generation","fenceId","executorLaunchId","job"])||A.version!==h||![A.sessionId,A.operationId,A.runId].every(M)||![A.deviceId,A.rootId,A.fenceId,A.executorLaunchId].every($)||!V(A.generation)||!Number.isSafeInteger(A.rootGrantRevision)||Number(A.rootGrantRevision)<1||!["workspace_source","mcp_control"].includes(String(A.binding))||!Number.isSafeInteger(A.targetRevision)||Number(A.targetRevision)<0||A.binding==="workspace_source"&&A.targetRevision!==0||!F(A.workspace))throw new G("invalid_pty_receipt");if(!m(A.workspace))throw new G("invalid_pty_receipt");let B=IA(JSON.stringify({type:"job_result",version:X,generation:A.generation,id:A.operationId,ok:!0,job:A.job}));if(!B.ok||!B.job.pty||B.job.pty.output.length!==0||B.job.process&&B.job.process.executorLaunchId!==A.executorLaunchId)throw new G("invalid_pty_receipt");return A}function TA(x){let A=Z(x);if(!F(A)||!W(A,["type","version","generation","id","targetId"])||A.type!=="cancel_request"||A.version!==X||!V(A.generation)||!M(A.id)||!M(A.targetId))throw new G("invalid_cancel_request");return A}function qA(x){let A=Z(x);if(!F(A)||!W(A,["type","version","generation","id","targetId","status"])||A.type!=="cancel_ack"||A.version!==X||!V(A.generation)||!M(A.id)||!M(A.targetId)||!["cancelled","settled","not_found","unsupported","unconfirmed"].includes(String(A.status)))throw new G("invalid_cancel_ack");return A}function wA(x){let A=JSON.stringify(x);return xA(A),A}function yA(x){let A=JSON.stringify(x);return GA(A),A}function mA(x){let A=JSON.stringify(x);return NA(A),A}function fA(x){let A=JSON.stringify(x);return UA(A),A}function hA(x){let A=JSON.stringify(x);return FA(A),A}function O(x){return typeof x==="string"&&x.length>=1&&x.length<=a&&!x.includes("\x00")}function XA(x){let A=["type","version","generation","id","jobRequestId","verb"];if(x.verb==="help")return W(x,A)?{verb:"help"}:null;if(x.verb==="describe"||x.verb==="namespace")return W(x,[...A,"name"])&&O(x.name)?{verb:x.verb,name:x.name}:null;if(x.verb==="search"){let B=x.args;if(!W(x,[...A,"query","args"])||typeof x.query!=="string"||x.query.trim().length<1||x.query.length>e)return null;if(B===void 0)return{verb:"search",query:x.query};if(!F(B)||!W(B,["namespace","limit"])||B.namespace!==void 0&&!O(B.namespace)||B.limit!==void 0&&(!Number.isSafeInteger(B.limit)||Number(B.limit)<1||Number(B.limit)>50))return null;return{verb:"search",query:x.query,args:{...typeof B.namespace==="string"?{namespace:B.namespace}:{},...B.limit===void 0?{}:{limit:Number(B.limit)}}}}if(x.verb!=="call"||!W(x,[...A,"name","args"])||!O(x.name)||!F(x.args)||JSON.stringify(x.args).length>K)return null;return{verb:"call",name:x.name,args:x.args}}function kA(x){let A=Z(x);if(!F(A)||A.type!=="sdk_request"||A.version!==X||!V(A.generation)||!M(A.id)||!M(A.jobRequestId))throw new G("invalid_sdk_request");let B=XA(A);if(!B)throw new G("invalid_sdk_request");return{type:"sdk_request",version:X,generation:Number(A.generation),id:A.id,jobRequestId:A.jobRequestId,...B}}function MA(x){let A=Z(x);if(!F(A)||A.type!=="sdk_response"||A.version!==X||!V(A.generation)||!M(A.id))throw new G("invalid_sdk_response");let B={type:"sdk_response",version:X,generation:Number(A.generation),id:A.id},N=["type","version","generation","id","ok"];if(A.ok===!0&&W(A,[...N,"result"])&&typeof A.result==="string"&&A.result.length<=Q)return{...B,ok:!0,result:A.result};if(A.ok===!1&&W(A,[...N,"error"])&&typeof A.error==="string"&&A.error.length>=1&&A.error.length<=Q)return{...B,ok:!1,error:A.error};throw new G("invalid_sdk_response")}function HA(x){let A=JSON.stringify(x);return MA(A),A}
4
4
  export{VA as gf,$A as hf,JA as if,X as jf,P as kf,K as lf,D as mf,Q as nf,DA as of,j as pf,f as qf,b as rf,p as sf,w as tf,RA as uf,i as vf,h as wf,y as xf,d as yf,YA as zf,s as Af,c as Bf,n as Cf,LA as Df,o as Ef,OA as Ff,l as Gf,a as Hf,e as If,AA as Jf,G as Kf,M as Lf,V as Mf,$ as Nf,C as Of,S as Pf,xA as Qf,GA as Rf,NA as Sf,UA as Tf,FA as Uf,zA as Vf,IA as Wf,SA as Xf,TA as Yf,qA as Zf,wA as _f,yA as $f,mA as ag,fA as bg,hA as cg,kA as dg,MA as eg,HA as fg};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- var U=".reason/workspace",T="workspace_base",y="sessions",W="workspace_layout",g=".reason/workspace/sessions",B=/^[0-9a-f]{8}$/;function C(j){if(!J(j))return!1;let q=".reason/workspace/sessions/";if(!j.startsWith(q))return!1;let z=j.slice(q.length).split("/");return z.length===2&&B.test(z[0])}var G=4096,X="workspaces/pi";function J(j){if(typeof j!=="string"||!j||j.length>G)return!1;if(j.startsWith("/")||j.includes("\x00")||j.includes("\\"))return!1;return j.split("/").every((q)=>q!==""&&q!=="."&&q!=="..")}function Z(j){if(j.kind==="root"){if(j.path===void 0)return".";if(!J(j.path))throw Error("invalid_device_workspace_identity");return j.path}if(!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$/.test(j.workspaceId)||j.workspaceId==="."||j.workspaceId==="..")throw Error("invalid_device_workspace_identity");let q=j.layout==="sessions"?"sessions":X;return`${j.base?`${j.base}/`:""}${q}/${j.workspaceId}/repo`}function L(j){if(!j||typeof j!=="object"||Array.isArray(j))return null;let q=j;if(q.kind==="root"&&Object.keys(q).length===1)return{kind:"root"};if(q.kind==="root"&&Object.keys(q).length===2&&J(q.path))return{kind:"root",path:q.path};if(q.kind!=="managed"||typeof q.workspaceId!=="string"||Object.keys(q).length!==2+(q.base===void 0?0:1)+(q.layout===void 0?0:1)||q.base!==void 0&&q.base!==".reason/workspace"||q.layout!==void 0&&q.layout!=="sessions")return null;let z={kind:"managed",workspaceId:q.workspaceId,...q.base===".reason/workspace"?{base:".reason/workspace"}:{},...q.layout==="sessions"?{layout:"sessions"}:{}};try{return Z(z),z}catch{return null}}var b="/home/runner",x="/run/reason/sessions",f=/^(?:\/[A-Za-z0-9._-]+)+$/,M=/-sidechat-([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/,H=/^(.+)-repository-[a-z0-9][a-z0-9._-]*-[0-9a-f]{12}$/;function K(j){return M.exec(j)?.[1]??H.exec(j)?.[1]??j}var $=/^((?:\/[A-Za-z0-9._-]+)+)\/\.reason\/workspace\/(workspaces\/pi|sessions)\/([^/]+)$/,P="*/.reason/workspace/workspaces/pi/*|*/.reason/workspace/sessions/*";function N(j,q=b,z="sessions"){if(!f.test(q)||q.split("/").some((V)=>V==="."||V===".."))throw Error("invalid_cloud_payload_home");let Q=`${q}/${Z({kind:"managed",workspaceId:j,base:".reason/workspace",...z?{layout:z}:{}})}`,F=`${x}/${K(j)}`;return{home:q,root:Q.slice(0,-5),checkout:Q,control:F,jobEnv:`${F}/job.env`,cloudAccess:`${F}/cloud-access`,logs:`${F}/logs`,pin:`${F}/ws`}}function Y(j){return $.exec(j.replace(/\/+$/,""))?.[2]==="sessions"?"sessions":null}function A(j){return{kind:"managed",workspaceId:j,layout:"sessions"}}function D(j){let q=$.exec(j.replace(/\/+$/,""));if(!q)return null;try{let z=N(q[3],q[1],Y(j));return z.root===j.replace(/\/+$/,"")?z:null}catch{return null}}
3
- export{U as ch,T as dh,y as eh,W as fh,g as gh,B as hh,C as ih,J as jh,Z as kh,L as lh,b as mh,x as nh,M as oh,H as ph,$ as qh,P as rh,N as sh,Y as th,A as uh,D as vh};
2
+ var U=".reason/workspace",T="workspace_base",y="sessions",W="workspace_layout",g=".reason/workspace/sessions",B=/^[0-9a-f]{8}$/;function C(j){if(!J(j))return!1;let q=".reason/workspace/sessions/";if(!j.startsWith(q))return!1;let z=j.slice(q.length).split("/");return z.length===2&&B.test(z[0])}var G=4096,X="workspaces/pi";function J(j){if(typeof j!=="string"||!j||j.length>G)return!1;if(j.startsWith("/")||j.includes("\x00")||j.includes("\\"))return!1;return j.split("/").every((q)=>q!==""&&q!=="."&&q!=="..")}function Z(j){if(j.kind==="root"){if(j.path===void 0)return".";if(!J(j.path))throw Error("invalid_device_workspace_identity");return j.path}if(!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$/.test(j.workspaceId)||j.workspaceId==="."||j.workspaceId==="..")throw Error("invalid_device_workspace_identity");let q=j.layout==="sessions"?"sessions":X;return`${j.base?`${j.base}/`:""}${q}/${j.workspaceId}/repo`}function L(j){if(!j||typeof j!=="object"||Array.isArray(j))return null;let q=j;if(q.kind==="root"&&Object.keys(q).length===1)return{kind:"root"};if(q.kind==="root"&&Object.keys(q).length===2&&J(q.path))return{kind:"root",path:q.path};if(q.kind!=="managed"||typeof q.workspaceId!=="string"||Object.keys(q).length!==2+(q.base===void 0?0:1)+(q.layout===void 0?0:1)||q.base!==void 0&&q.base!==".reason/workspace"||q.layout!==void 0&&q.layout!=="sessions")return null;let z={kind:"managed",workspaceId:q.workspaceId,...q.base===".reason/workspace"?{base:".reason/workspace"}:{},...q.layout==="sessions"?{layout:"sessions"}:{}};try{return Z(z),z}catch{return null}}var b="/home/runner",P=10001,x="/run/reason/sessions",f=/^(?:\/[A-Za-z0-9._-]+)+$/,M=/-sidechat-([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/,H=/^(.+)-repository-[a-z0-9][a-z0-9._-]*-[0-9a-f]{12}$/;function K(j){return M.exec(j)?.[1]??H.exec(j)?.[1]??j}var $=/^((?:\/[A-Za-z0-9._-]+)+)\/\.reason\/workspace\/(workspaces\/pi|sessions)\/([^/]+)$/,A="*/.reason/workspace/workspaces/pi/*|*/.reason/workspace/sessions/*";function N(j,q=b,z="sessions"){if(!f.test(q)||q.split("/").some((V)=>V==="."||V===".."))throw Error("invalid_cloud_payload_home");let Q=`${q}/${Z({kind:"managed",workspaceId:j,base:".reason/workspace",...z?{layout:z}:{}})}`,F=`${x}/${K(j)}`;return{home:q,root:Q.slice(0,-5),checkout:Q,control:F,jobEnv:`${F}/job.env`,cloudAccess:`${F}/cloud-access`,logs:`${F}/logs`,pin:`${F}/ws`}}function Y(j){return $.exec(j.replace(/\/+$/,""))?.[2]==="sessions"?"sessions":null}function D(j){return{kind:"managed",workspaceId:j,layout:"sessions"}}function R(j){let q=$.exec(j.replace(/\/+$/,""));if(!q)return null;try{let z=N(q[3],q[1],Y(j));return z.root===j.replace(/\/+$/,"")?z:null}catch{return null}}
3
+ export{U as ch,T as dh,y as eh,W as fh,g as gh,B as hh,C as ih,J as jh,Z as kh,L as lh,b as mh,P as nh,x as oh,M as ph,H as qh,$ as rh,A as sh,N as th,Y as uh,D as vh,R as wh};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{gh as X,ih as Y,kh as Z}from"./vm-hands-entry-lite-mxavr4y3.js";import{execFileSync as z}from"child_process";import{existsSync as V,realpathSync as M}from"fs";import{userInfo as D}from"os";import{isAbsolute as $,join as C,normalize as F,parse as K}from"path";function Q(){let q=F(D().homedir);if(!$(q)||q===K(q).root)throw Error("Could not resolve the canonical macOS user home.");return q}function O(q,B,J=Q()){let L=Z(B);if(B.kind==="managed"&&B.base){let G=M(J);return{anchor:G,boundary:C(G,B.base),path:C(G,L)}}if(B.kind==="root"&&Y(B.path)){let G=M(J);return{anchor:G,boundary:C(G,X),path:C(G,L)}}return{anchor:q,boundary:q,path:C(q,L)}}function _(q=Q()){return C(q,".config")}function b(){if(process.platform!=="darwin")return null;try{let q=z("/usr/bin/getconf",["DARWIN_USER_DIR"],{encoding:"utf8",timeout:5000}).trim();return $(q)?M(q):null}catch{return null}}function g(q=Q()){let B=C(q,"Library","Application Support","Ara"),J=C(q,"Library","Application Support","Reason");return V(B)&&!V(J)?B:J}
2
+ import{gh as X,ih as Y,kh as Z}from"./vm-hands-entry-lite-ngvxyjhy.js";import{execFileSync as z}from"child_process";import{existsSync as V,realpathSync as M}from"fs";import{userInfo as D}from"os";import{isAbsolute as $,join as C,normalize as F,parse as K}from"path";function Q(){let q=F(D().homedir);if(!$(q)||q===K(q).root)throw Error("Could not resolve the canonical macOS user home.");return q}function O(q,B,J=Q()){let L=Z(B);if(B.kind==="managed"&&B.base){let G=M(J);return{anchor:G,boundary:C(G,B.base),path:C(G,L)}}if(B.kind==="root"&&Y(B.path)){let G=M(J);return{anchor:G,boundary:C(G,X),path:C(G,L)}}return{anchor:q,boundary:q,path:C(q,L)}}function _(q=Q()){return C(q,".config")}function b(){if(process.platform!=="darwin")return null;try{let q=z("/usr/bin/getconf",["DARWIN_USER_DIR"],{encoding:"utf8",timeout:5000}).trim();return $(q)?M(q):null}catch{return null}}function g(q=Q()){let B=C(q,"Library","Application Support","Ara"),J=C(q,"Library","Application Support","Reason");return V(B)&&!V(J)?B:J}
3
3
  export{Q as Zg,O as _g,_ as $g,b as ah,g as bh};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{ae as j}from"./vm-hands-entry-lite-m5pmd2cz.js";var p="inference.custom.v1",R=32768,$=67108864,x=16384,A=204800,z=600000,P=["content-type","anthropic-version","user-agent"],W=j.enum(["openai-completions","openai-responses","anthropic-messages"]),U=new Set(P),V=j.record(j.string(),j.string().max(2048)).refine((w)=>Object.keys(w).every((F)=>U.has(F))&&Object.values(w).every((F)=>!/[\r\n\0]/.test(F)),"Only non-secret custom endpoint request headers are permitted");function J(w){try{let F=new URL(w);return["http:","https:"].includes(F.protocol)&&!F.username&&!F.password&&!F.search&&!F.hash?F:null}catch{return null}}function X(w,F){let G=J(w.baseUrl),K=J(F.baseUrl),H=J(w.url);if(!G||!K||!H||w.method!=="POST"||F.execution!=="device")return!1;let L=(Q)=>Q.origin+Q.pathname.replace(/\/+$/,"");if(L(G)!==L(K)||H.origin!==G.origin)return!1;let Z=F.api==="openai-completions"?"/chat/completions":F.api==="openai-responses"?"/responses":"/v1/messages";return H.pathname===G.pathname.replace(/\/+$/,"")+Z}var B=j.object({baseUrl:j.string().max(2048),url:j.string().max(4096),method:j.literal("POST"),body:j.string().refine((w)=>new TextEncoder().encode(w).byteLength<=A).optional(),headers:V,credentialOrganizationId:j.string().uuid(),accountKey:j.string().min(1).max(256).optional()}).strict().refine((w)=>W.options.some((F)=>X(w,{baseUrl:w.baseUrl,api:F,execution:"device"})),"Invalid custom endpoint inference URL"),C=j.object({status:j.number().int().min(200).max(599),statusText:j.string().max(256).refine((w)=>!/[\r\n\0]/.test(w)),headers:j.record(j.string(),j.string().max(4096)).refine((w)=>Object.keys(w).every((F)=>["content-type","retry-after","x-request-id","request-id"].includes(F))&&Object.values(w).every((F)=>!/[\r\n\0]/.test(F)))}).strict(),I=j.union([j.object({eof:j.literal(!0)}).strict(),j.object({eof:j.literal(!1),data:j.string().max(Math.ceil(R/3)*4).regex(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/).refine((w)=>w.length>0&&w.length*3/4-(w.endsWith("==")?2:w.endsWith("=")?1:0)<=R)}).strict()]),M=j.object({bytes:j.number().int().min(0).max($),chunks:j.number().int().min(0).max(x)}).strict(),N=j.object({apiKey:j.string().min(1).max(16384).refine((w)=>!/[\r\n\0]/.test(w)),api:W}).strict();
2
+ import{ae as j}from"./vm-hands-entry-lite-h7ndfgwc.js";var p="inference.custom.v1",R=32768,$=67108864,x=16384,A=204800,z=600000,P=["content-type","anthropic-version","user-agent"],W=j.enum(["openai-completions","openai-responses","anthropic-messages"]),U=new Set(P),V=j.record(j.string(),j.string().max(2048)).refine((w)=>Object.keys(w).every((F)=>U.has(F))&&Object.values(w).every((F)=>!/[\r\n\0]/.test(F)),"Only non-secret custom endpoint request headers are permitted");function J(w){try{let F=new URL(w);return["http:","https:"].includes(F.protocol)&&!F.username&&!F.password&&!F.search&&!F.hash?F:null}catch{return null}}function X(w,F){let G=J(w.baseUrl),K=J(F.baseUrl),H=J(w.url);if(!G||!K||!H||w.method!=="POST"||F.execution!=="device")return!1;let L=(Q)=>Q.origin+Q.pathname.replace(/\/+$/,"");if(L(G)!==L(K)||H.origin!==G.origin)return!1;let Z=F.api==="openai-completions"?"/chat/completions":F.api==="openai-responses"?"/responses":"/v1/messages";return H.pathname===G.pathname.replace(/\/+$/,"")+Z}var B=j.object({baseUrl:j.string().max(2048),url:j.string().max(4096),method:j.literal("POST"),body:j.string().refine((w)=>new TextEncoder().encode(w).byteLength<=A).optional(),headers:V,credentialOrganizationId:j.string().uuid(),accountKey:j.string().min(1).max(256).optional()}).strict().refine((w)=>W.options.some((F)=>X(w,{baseUrl:w.baseUrl,api:F,execution:"device"})),"Invalid custom endpoint inference URL"),C=j.object({status:j.number().int().min(200).max(599),statusText:j.string().max(256).refine((w)=>!/[\r\n\0]/.test(w)),headers:j.record(j.string(),j.string().max(4096)).refine((w)=>Object.keys(w).every((F)=>["content-type","retry-after","x-request-id","request-id"].includes(F))&&Object.values(w).every((F)=>!/[\r\n\0]/.test(F)))}).strict(),I=j.union([j.object({eof:j.literal(!0)}).strict(),j.object({eof:j.literal(!1),data:j.string().max(Math.ceil(R/3)*4).regex(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/).refine((w)=>w.length>0&&w.length*3/4-(w.endsWith("==")?2:w.endsWith("=")?1:0)<=R)}).strict()]),M=j.object({bytes:j.number().int().min(0).max($),chunks:j.number().int().min(0).max(x)}).strict(),N=j.object({apiKey:j.string().min(1).max(16384).refine((w)=>!/[\r\n\0]/.test(w)),api:W}).strict();
3
3
  export{p as _b,R as $b,$ as ac,x as bc,A as cc,z as dc,P as ec,X as fc,B as gc,C as hc,I as ic,M as jc,N as kc};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  class o extends Error{code;constructor(a,r){super(r);this.code=a;this.name="LocalCapabilityError"}}
3
- export{o as Ih};
3
+ export{o as Jh};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Kh as e}from"./vm-hands-entry-lite-ss2w3h3d.js";var i=e((o,t)=>{t.exports={name:"playwright-core",version:"1.60.0",description:"A high-level API to automate web browsers",repository:{type:"git",url:"git+https://github.com/microsoft/playwright.git"},homepage:"https://playwright.dev",engines:{node:">=18"},author:{name:"Microsoft Corporation"},license:"Apache-2.0",exports:{".":{types:"./index.d.ts",import:"./index.mjs",require:"./index.js",default:"./index.js"},"./package.json":"./package.json","./lib/bootstrap":"./lib/bootstrap.js","./lib/coreBundle":"./lib/coreBundle.js","./lib/utilsBundle":"./lib/utilsBundle.js","./lib/tools/cli-client/program":"./lib/tools/cli-client/program.js"},bin:{"playwright-core":"cli.js"},types:"types/types.d.ts"}});
2
+ import{Lh as e}from"./vm-hands-entry-lite-a3n86qqm.js";var i=e((o,t)=>{t.exports={name:"playwright-core",version:"1.60.0",description:"A high-level API to automate web browsers",repository:{type:"git",url:"git+https://github.com/microsoft/playwright.git"},homepage:"https://playwright.dev",engines:{node:">=18"},author:{name:"Microsoft Corporation"},license:"Apache-2.0",exports:{".":{types:"./index.d.ts",import:"./index.mjs",require:"./index.js",default:"./index.js"},"./package.json":"./package.json","./lib/bootstrap":"./lib/bootstrap.js","./lib/coreBundle":"./lib/coreBundle.js","./lib/utilsBundle":"./lib/utilsBundle.js","./lib/tools/cli-client/program":"./lib/tools/cli-client/program.js"},bin:{"playwright-core":"cli.js"},types:"types/types.d.ts"}});
3
3
  export{i as x};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Ih as l}from"./vm-hands-entry-lite-wffqkcjq.js";import{execFile as zj,spawn as I}from"child_process";var Cj="h264_ws_v1",kj="video",h=["smooth","sharp","data_saver","balanced"];var Yj="video_presets";var V=8388608,Y=65536,Lj="control",Aj="v1",d=200;function s(q){if(!q||typeof q!=="object"||Array.isArray(q))return null;let j=q,J=(Q)=>typeof Q==="string"&&Q.length>0&&Q.length<=d;if(Object.keys(j).length!==2||!J(j.user_id)||!J(j.name))return null;return{user_id:j.user_id,name:j.name}}var xj="windows",Mj="v1",A=200,o=(q)=>typeof q==="string"&&h.includes(q);function fj(q){if(!q||typeof q!=="object"||Array.isArray(q))return null;let j=q;if(Object.keys(j).length!==2||j.format!=="h264_ws_v1"||!o(j.preset))return null;return{format:"h264_ws_v1",preset:j.preset}}var $={hello:1,frame:2,stats:3,pong:4,serverClipboard:5,error:6,audioHello:7,audio:8,control:9,windows:10,pointer:16,key:17,config:18,ping:19,clientClipboard:20,keyframeRequest:21,ack:22,audioEnable:23};class U extends Error{constructor(q){super(q);this.name="DisplayVideoProtocolError"}}var e=new TextEncoder,jj=new TextDecoder("utf-8",{fatal:!0});function H(q,j){if(j.byteLength+1>V)throw new U("message_too_large");let J=new Uint8Array(5+j.byteLength),Q=new DataView(J.buffer);return Q.setUint32(0,j.byteLength+1),Q.setUint8(4,q),J.set(j,5),J}function R(q){let j=e.encode(q);if(j.byteLength>Y)throw new U("text_too_large");return j}function f(q,j){if(!Number.isInteger(q)||q<0||q>65535)throw new U(`invalid_${j}`);return q}function qj(q){if(!Number.isFinite(q))throw new U("invalid_window");return Math.max(-2147483648,Math.min(2147483647,Math.round(q)))}function hj(q){switch(q.type){case"hello":{let j=R(q.codec),J=new Uint8Array(6+j.byteLength),Q=new DataView(J.buffer);return Q.setUint16(0,f(q.width,"width")),Q.setUint16(2,f(q.height,"height")),Q.setUint8(4,Math.max(1,Math.min(240,Math.round(q.fps)))),Q.setUint8(5,h.indexOf(q.preset)),J.set(j,6),H($.hello,J)}case"frame":{let j=new Uint8Array(13+q.data.byteLength),J=new DataView(j.buffer);return J.setUint8(0,q.key?1:0),J.setUint32(1,q.seq>>>0),J.setBigUint64(5,BigInt(Math.max(0,Math.floor(q.captureMicros)))),j.set(q.data,13),H($.frame,j)}case"stats":return H($.stats,R(JSON.stringify(q.stats)));case"pong":case"ping":{let j=new Uint8Array(8);return new DataView(j.buffer).setFloat64(0,q.token),H(q.type==="ping"?$.ping:$.pong,j)}case"serverClipboard":return H($.serverClipboard,R(q.text));case"clientClipboard":return H($.clientClipboard,R(q.text));case"error":return H($.error,R(q.code));case"pointer":{let j=new Uint8Array(5),J=new DataView(j.buffer);return J.setUint16(0,f(q.x,"x")),J.setUint16(2,f(q.y,"y")),J.setUint8(4,q.buttons&255),H($.pointer,j)}case"key":{let j=new Uint8Array(5),J=new DataView(j.buffer);return J.setUint8(0,q.down?1:0),J.setUint32(1,q.keysym>>>0),H($.key,j)}case"config":return H($.config,Uint8Array.of(h.indexOf(q.preset)));case"keyframeRequest":return H($.keyframeRequest,new Uint8Array(0));case"audioHello":{let j=R(q.codec),J=new Uint8Array(5+j.byteLength),Q=new DataView(J.buffer);return Q.setUint32(0,q.sampleRate>>>0),Q.setUint8(4,q.channels&255),J.set(j,5),H($.audioHello,J)}case"audio":{let j=new Uint8Array(8+q.data.byteLength);return new DataView(j.buffer).setBigUint64(0,BigInt(Math.max(0,Math.floor(q.captureMicros)))),j.set(q.data,8),H($.audio,j)}case"control":return H($.control,R(JSON.stringify(q.control)));case"windows":{let j=q.bounds.slice(0,A),J=new Uint8Array(j.length*16),Q=new DataView(J.buffer);return j.forEach((Z,z)=>{[Z.x,Z.y,Z.width,Z.height].forEach((G,F)=>Q.setInt32(z*16+F*4,qj(G)))}),H($.windows,J)}case"audioEnable":return H($.audioEnable,Uint8Array.of(q.on?1:0));case"ack":{let j=new Uint8Array(4);return new DataView(j.buffer).setUint32(0,q.seq>>>0),H($.ack,j)}}}function T(q){let j=h[q];if(!j)throw new U("invalid_preset");return j}function C(q,j){if(q.byteLength!==j)throw new U("invalid_length")}function k(q){if(q.byteLength>Y)throw new U("text_too_large");try{return jj.decode(q)}catch{throw new U("invalid_text")}}function Jj(q){let j;try{j=JSON.parse(k(q))}catch{throw new U("invalid_stats")}let J=j;if(!J||typeof J!=="object"||["fps","kbps","dropped","restarts","queued_bytes"].some((Z)=>typeof J[Z]!=="number"||!Number.isFinite(J[Z])))throw new U("invalid_stats");return{fps:J.fps,kbps:J.kbps,dropped:J.dropped,restarts:J.restarts,queued_bytes:J.queued_bytes}}function Qj(q){let j;try{j=JSON.parse(k(q))}catch{throw new U("invalid_control")}let J=j;if(!J||typeof J!=="object"||typeof J.you!=="boolean"||typeof J.same_user!=="boolean")throw new U("invalid_control");let Q=J.holder===null?null:s(J.holder);if(Q===null&&J.holder!==null)throw new U("invalid_control");return{holder:Q,you:J.you,same_user:J.same_user}}function Zj(q,j){let J=new DataView(j.buffer,j.byteOffset,j.byteLength);switch(q){case $.hello:if(j.byteLength<6)throw new U("invalid_length");return{type:"hello",width:J.getUint16(0),height:J.getUint16(2),fps:J.getUint8(4),preset:T(J.getUint8(5)),codec:k(j.subarray(6))};case $.frame:if(j.byteLength<14)throw new U("invalid_length");if(J.getUint8(0)>1)throw new U("invalid_frame_flags");return{type:"frame",key:J.getUint8(0)===1,seq:J.getUint32(1),captureMicros:Number(J.getBigUint64(5)),data:j.subarray(13)};case $.stats:return{type:"stats",stats:Jj(j)};case $.ping:case $.pong:return C(j,8),{type:q===$.ping?"ping":"pong",token:J.getFloat64(0)};case $.serverClipboard:return{type:"serverClipboard",text:k(j)};case $.clientClipboard:return{type:"clientClipboard",text:k(j)};case $.error:return{type:"error",code:k(j)};case $.pointer:return C(j,5),{type:"pointer",x:J.getUint16(0),y:J.getUint16(2),buttons:J.getUint8(4)};case $.key:if(C(j,5),J.getUint8(0)>1)throw new U("invalid_key_flags");return{type:"key",down:J.getUint8(0)===1,keysym:J.getUint32(1)};case $.config:return C(j,1),{type:"config",preset:T(J.getUint8(0))};case $.keyframeRequest:return C(j,0),{type:"keyframeRequest"};case $.audioHello:if(j.byteLength<5)throw new U("invalid_length");return{type:"audioHello",sampleRate:J.getUint32(0),channels:J.getUint8(4),codec:k(j.subarray(5))};case $.audio:if(j.byteLength<9)throw new U("invalid_length");return{type:"audio",captureMicros:Number(J.getBigUint64(0)),data:j.subarray(8)};case $.audioEnable:if(C(j,1),J.getUint8(0)>1)throw new U("invalid_audio_flags");return{type:"audioEnable",on:J.getUint8(0)===1};case $.control:return{type:"control",control:Qj(j)};case $.windows:{if(j.byteLength%16!==0||j.byteLength>A*16)throw new U("invalid_length");let Q=[];for(let Z=0;Z<j.byteLength;Z+=16)Q.push({x:J.getInt32(Z),y:J.getInt32(Z+4),width:J.getInt32(Z+8),height:J.getInt32(Z+12)});return{type:"windows",bounds:Q}}case $.ack:return C(j,4),{type:"ack",seq:J.getUint32(0)};default:return null}}class $j{buffer=new Uint8Array(0);push(q){let j=new Uint8Array(this.buffer.byteLength+q.byteLength);j.set(this.buffer),j.set(q,this.buffer.byteLength);let J=[],Q=0;while(j.byteLength-Q>=4){let Z=new DataView(j.buffer,j.byteOffset+Q,4).getUint32(0);if(Z<1||Z>V)throw new U("invalid_message_length");if(j.byteLength-Q-4<Z)break;let z=j[Q+4],G=j.slice(Q+5,Q+4+Z),F=Zj(z,G);if(F)J.push(F);Q+=4+Z}return this.buffer=j.slice(Q),J}}var t="/usr/bin/osascript",Gj=5000,Kj=1048576,Uj=String.raw`
2
+ import{Jh as l}from"./vm-hands-entry-lite-sn3vjjgx.js";import{execFile as zj,spawn as I}from"child_process";var Cj="h264_ws_v1",kj="video",h=["smooth","sharp","data_saver","balanced"];var Yj="video_presets";var V=8388608,Y=65536,Lj="control",Aj="v1",d=200;function s(q){if(!q||typeof q!=="object"||Array.isArray(q))return null;let j=q,J=(Q)=>typeof Q==="string"&&Q.length>0&&Q.length<=d;if(Object.keys(j).length!==2||!J(j.user_id)||!J(j.name))return null;return{user_id:j.user_id,name:j.name}}var xj="windows",Mj="v1",A=200,o=(q)=>typeof q==="string"&&h.includes(q);function fj(q){if(!q||typeof q!=="object"||Array.isArray(q))return null;let j=q;if(Object.keys(j).length!==2||j.format!=="h264_ws_v1"||!o(j.preset))return null;return{format:"h264_ws_v1",preset:j.preset}}var $={hello:1,frame:2,stats:3,pong:4,serverClipboard:5,error:6,audioHello:7,audio:8,control:9,windows:10,pointer:16,key:17,config:18,ping:19,clientClipboard:20,keyframeRequest:21,ack:22,audioEnable:23};class U extends Error{constructor(q){super(q);this.name="DisplayVideoProtocolError"}}var e=new TextEncoder,jj=new TextDecoder("utf-8",{fatal:!0});function H(q,j){if(j.byteLength+1>V)throw new U("message_too_large");let J=new Uint8Array(5+j.byteLength),Q=new DataView(J.buffer);return Q.setUint32(0,j.byteLength+1),Q.setUint8(4,q),J.set(j,5),J}function R(q){let j=e.encode(q);if(j.byteLength>Y)throw new U("text_too_large");return j}function f(q,j){if(!Number.isInteger(q)||q<0||q>65535)throw new U(`invalid_${j}`);return q}function qj(q){if(!Number.isFinite(q))throw new U("invalid_window");return Math.max(-2147483648,Math.min(2147483647,Math.round(q)))}function hj(q){switch(q.type){case"hello":{let j=R(q.codec),J=new Uint8Array(6+j.byteLength),Q=new DataView(J.buffer);return Q.setUint16(0,f(q.width,"width")),Q.setUint16(2,f(q.height,"height")),Q.setUint8(4,Math.max(1,Math.min(240,Math.round(q.fps)))),Q.setUint8(5,h.indexOf(q.preset)),J.set(j,6),H($.hello,J)}case"frame":{let j=new Uint8Array(13+q.data.byteLength),J=new DataView(j.buffer);return J.setUint8(0,q.key?1:0),J.setUint32(1,q.seq>>>0),J.setBigUint64(5,BigInt(Math.max(0,Math.floor(q.captureMicros)))),j.set(q.data,13),H($.frame,j)}case"stats":return H($.stats,R(JSON.stringify(q.stats)));case"pong":case"ping":{let j=new Uint8Array(8);return new DataView(j.buffer).setFloat64(0,q.token),H(q.type==="ping"?$.ping:$.pong,j)}case"serverClipboard":return H($.serverClipboard,R(q.text));case"clientClipboard":return H($.clientClipboard,R(q.text));case"error":return H($.error,R(q.code));case"pointer":{let j=new Uint8Array(5),J=new DataView(j.buffer);return J.setUint16(0,f(q.x,"x")),J.setUint16(2,f(q.y,"y")),J.setUint8(4,q.buttons&255),H($.pointer,j)}case"key":{let j=new Uint8Array(5),J=new DataView(j.buffer);return J.setUint8(0,q.down?1:0),J.setUint32(1,q.keysym>>>0),H($.key,j)}case"config":return H($.config,Uint8Array.of(h.indexOf(q.preset)));case"keyframeRequest":return H($.keyframeRequest,new Uint8Array(0));case"audioHello":{let j=R(q.codec),J=new Uint8Array(5+j.byteLength),Q=new DataView(J.buffer);return Q.setUint32(0,q.sampleRate>>>0),Q.setUint8(4,q.channels&255),J.set(j,5),H($.audioHello,J)}case"audio":{let j=new Uint8Array(8+q.data.byteLength);return new DataView(j.buffer).setBigUint64(0,BigInt(Math.max(0,Math.floor(q.captureMicros)))),j.set(q.data,8),H($.audio,j)}case"control":return H($.control,R(JSON.stringify(q.control)));case"windows":{let j=q.bounds.slice(0,A),J=new Uint8Array(j.length*16),Q=new DataView(J.buffer);return j.forEach((Z,z)=>{[Z.x,Z.y,Z.width,Z.height].forEach((G,F)=>Q.setInt32(z*16+F*4,qj(G)))}),H($.windows,J)}case"audioEnable":return H($.audioEnable,Uint8Array.of(q.on?1:0));case"ack":{let j=new Uint8Array(4);return new DataView(j.buffer).setUint32(0,q.seq>>>0),H($.ack,j)}}}function T(q){let j=h[q];if(!j)throw new U("invalid_preset");return j}function C(q,j){if(q.byteLength!==j)throw new U("invalid_length")}function k(q){if(q.byteLength>Y)throw new U("text_too_large");try{return jj.decode(q)}catch{throw new U("invalid_text")}}function Jj(q){let j;try{j=JSON.parse(k(q))}catch{throw new U("invalid_stats")}let J=j;if(!J||typeof J!=="object"||["fps","kbps","dropped","restarts","queued_bytes"].some((Z)=>typeof J[Z]!=="number"||!Number.isFinite(J[Z])))throw new U("invalid_stats");return{fps:J.fps,kbps:J.kbps,dropped:J.dropped,restarts:J.restarts,queued_bytes:J.queued_bytes}}function Qj(q){let j;try{j=JSON.parse(k(q))}catch{throw new U("invalid_control")}let J=j;if(!J||typeof J!=="object"||typeof J.you!=="boolean"||typeof J.same_user!=="boolean")throw new U("invalid_control");let Q=J.holder===null?null:s(J.holder);if(Q===null&&J.holder!==null)throw new U("invalid_control");return{holder:Q,you:J.you,same_user:J.same_user}}function Zj(q,j){let J=new DataView(j.buffer,j.byteOffset,j.byteLength);switch(q){case $.hello:if(j.byteLength<6)throw new U("invalid_length");return{type:"hello",width:J.getUint16(0),height:J.getUint16(2),fps:J.getUint8(4),preset:T(J.getUint8(5)),codec:k(j.subarray(6))};case $.frame:if(j.byteLength<14)throw new U("invalid_length");if(J.getUint8(0)>1)throw new U("invalid_frame_flags");return{type:"frame",key:J.getUint8(0)===1,seq:J.getUint32(1),captureMicros:Number(J.getBigUint64(5)),data:j.subarray(13)};case $.stats:return{type:"stats",stats:Jj(j)};case $.ping:case $.pong:return C(j,8),{type:q===$.ping?"ping":"pong",token:J.getFloat64(0)};case $.serverClipboard:return{type:"serverClipboard",text:k(j)};case $.clientClipboard:return{type:"clientClipboard",text:k(j)};case $.error:return{type:"error",code:k(j)};case $.pointer:return C(j,5),{type:"pointer",x:J.getUint16(0),y:J.getUint16(2),buttons:J.getUint8(4)};case $.key:if(C(j,5),J.getUint8(0)>1)throw new U("invalid_key_flags");return{type:"key",down:J.getUint8(0)===1,keysym:J.getUint32(1)};case $.config:return C(j,1),{type:"config",preset:T(J.getUint8(0))};case $.keyframeRequest:return C(j,0),{type:"keyframeRequest"};case $.audioHello:if(j.byteLength<5)throw new U("invalid_length");return{type:"audioHello",sampleRate:J.getUint32(0),channels:J.getUint8(4),codec:k(j.subarray(5))};case $.audio:if(j.byteLength<9)throw new U("invalid_length");return{type:"audio",captureMicros:Number(J.getBigUint64(0)),data:j.subarray(8)};case $.audioEnable:if(C(j,1),J.getUint8(0)>1)throw new U("invalid_audio_flags");return{type:"audioEnable",on:J.getUint8(0)===1};case $.control:return{type:"control",control:Qj(j)};case $.windows:{if(j.byteLength%16!==0||j.byteLength>A*16)throw new U("invalid_length");let Q=[];for(let Z=0;Z<j.byteLength;Z+=16)Q.push({x:J.getInt32(Z),y:J.getInt32(Z+4),width:J.getInt32(Z+8),height:J.getInt32(Z+12)});return{type:"windows",bounds:Q}}case $.ack:return C(j,4),{type:"ack",seq:J.getUint32(0)};default:return null}}class $j{buffer=new Uint8Array(0);push(q){let j=new Uint8Array(this.buffer.byteLength+q.byteLength);j.set(this.buffer),j.set(q,this.buffer.byteLength);let J=[],Q=0;while(j.byteLength-Q>=4){let Z=new DataView(j.buffer,j.byteOffset+Q,4).getUint32(0);if(Z<1||Z>V)throw new U("invalid_message_length");if(j.byteLength-Q-4<Z)break;let z=j[Q+4],G=j.slice(Q+5,Q+4+Z),F=Zj(z,G);if(F)J.push(F);Q+=4+Z}return this.buffer=j.slice(Q),J}}var t="/usr/bin/osascript",Gj=5000,Kj=1048576,Uj=String.raw`
3
3
  ObjC.import("CoreGraphics");
4
4
  ObjC.import("ApplicationServices");
5
5
  ObjC.import("AppKit");
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Fd as xe}from"./vm-hands-entry-lite-yh7n4svm.js";import{ge as W,he as se,je as ut,ke as Ne,ne as pt,oe as xt,pe as $,ye as z,ze as Je}from"./vm-hands-entry-lite-p8yz62gj.js";import{Be as v,De as tt,Ee as D,Me as gt}from"./vm-hands-entry-lite-hnq065fd.js";import{gg as zt,jg as St,mg as Z,og as jt,pg as ie}from"./vm-hands-entry-lite-94nvv1qx.js";import{Og as Ae,Pg as ae}from"./vm-hands-entry-lite-5vrdj7jm.js";import{Xg as Se}from"./vm-hands-entry-lite-gfynf6jv.js";import{Zg as q}from"./vm-hands-entry-lite-shde1mg2.js";import{Bh as pe,Hh as ye}from"./vm-hands-entry-lite-y9k070mt.js";import{Ih as _}from"./vm-hands-entry-lite-wffqkcjq.js";import{spawn as I}from"child_process";import{randomUUID as Oe}from"crypto";import{closeSync as Vr,copyFileSync as de,existsSync as mt,fstatSync as Er,mkdirSync as fe,openSync as vr,readdirSync as V,readFileSync as ge,readlinkSync as to,renameSync as eo,rmSync as ro,statSync as oo}from"fs";import{connect as so}from"net";import{userInfo as Te}from"os";import{basename as le,dirname as bt,join as b}from"path";var Nt=`import { spawn, execFileSync } from "node:child_process";
2
+ import{Fd as xe}from"./vm-hands-entry-lite-5zzey257.js";import{ge as W,he as se,je as ut,ke as Ne,ne as pt,oe as xt,pe as $,ye as z,ze as Je}from"./vm-hands-entry-lite-5bw3nakm.js";import{Be as v,De as tt,Ee as D,Me as gt}from"./vm-hands-entry-lite-zmf3vn3w.js";import{gg as zt,jg as St,mg as Z,og as jt,pg as ie}from"./vm-hands-entry-lite-5r3y8qb3.js";import{Og as Ae,Pg as ae}from"./vm-hands-entry-lite-yadv8a82.js";import{Xg as Se}from"./vm-hands-entry-lite-cfjx91rj.js";import{Zg as q}from"./vm-hands-entry-lite-pr65ksfz.js";import{Ch as pe,Ih as ye}from"./vm-hands-entry-lite-d94sv87n.js";import{Jh as _}from"./vm-hands-entry-lite-sn3vjjgx.js";import{spawn as I}from"child_process";import{randomUUID as Oe}from"crypto";import{closeSync as Vr,copyFileSync as de,existsSync as mt,fstatSync as Er,mkdirSync as fe,openSync as vr,readdirSync as V,readFileSync as ge,readlinkSync as to,renameSync as eo,rmSync as ro,statSync as oo}from"fs";import{connect as so}from"net";import{userInfo as Te}from"os";import{basename as le,dirname as bt,join as b}from"path";var Nt=`import { spawn, execFileSync } from "node:child_process";
3
3
  import { createHash, randomUUID } from "node:crypto";
4
4
  import { readFileSync, readlinkSync, lstatSync, realpathSync, statSync, mkdtempSync, mkdirSync, chmodSync, writeFileSync, readdirSync, rmSync, openSync, readSync, closeSync, renameSync } from "node:fs";
5
5
  import { tmpdir } from "node:os";
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Ld as UJ,ad as CJ,id as qJ}from"./vm-hands-entry-lite-yh7n4svm.js";import{createHash as v,randomBytes as t}from"crypto";import{closeSync as QJ,fsyncSync as FJ,mkdirSync as kJ,openSync as WJ,renameSync as SJ,rmSync as gJ,statSync as BJ,writeSync as PJ,constants as S}from"fs";import{join as V}from"path";var HJ=1;var d=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function e(J){if(J.environment!==void 0||J.payload.environment!==void 0)throw new W("vm_hands_bind_invalid","bind carries a plaintext environment");if(J.payload.vm_hands_env_deferred===!0&&J.environment_sealed!==void 0)throw new W("vm_hands_bind_invalid","split bind carries an environment");return J.environment_sealed!==void 0}function jJ(J,Z){let{payload:z,authority:G}=J;if(!z||typeof z!=="object"||Array.isArray(z)||!G||typeof G!=="object"||Array.isArray(G)||!Z.deviceId||!Z.rootId||z.run_id!==Z.runId||z.device_id!==Z.deviceId||G.device_id!==Z.deviceId||z.root_id!==Z.rootId||Z.snapshotId!==void 0&&z.snapshot_id!==Z.snapshotId)throw new W("vm_hands_env_invalid","environment does not match this Hands");return z}function NJ(J){if(J.capability!=="hands.connect")throw new W("vm_hands_bind_invalid","not a hands.connect claim");let Z=J.payload;return{kind:"vm_hands.bind",v:1,bind_id:J.attempt_id,attempt_id:J.attempt_id,attempt_token:J.attempt_token,run_id:J.run_id,session_id:typeof Z.workspace_id==="string"&&d.test(Z.workspace_id)?Z.workspace_id:J.run_id,brain_generation:Z.target_generation,fence_id:Z.target_fence_id,lease_until:J.lease_until,policy:{agent_profile:"",confinement_key:String(Z.hands_confinement??""),browser_egress:Z.browser_egress??null,policy_digest:Z.vm_hands_policy_digest},cwd:typeof Z.cwd==="string"?Z.cwd:"",claim:J,env:e(J)?J.environment_sealed:null}}class W extends Error{code;constructor(J,Z){super(Z);this.code=J}}var g=(J)=>Buffer.from(J instanceof Uint8Array?J:new Uint8Array(J)).toString("base64url"),y=(J)=>new Uint8Array(Buffer.from(J,"base64url"));function R(J){if(J===null||typeof J!=="object")return JSON.stringify(J);if(Array.isArray(J))return`[${J.map(R).join(",")}]`;return`{${Object.keys(J).sort().map((Z)=>`${JSON.stringify(Z)}:${R(J[Z])}`).join(",")}}`}async function aJ(J){let Z=await crypto.subtle.importKey("pkcs8",y(J.device_key.pkcs8),{name:"ECDSA",namedCurve:"P-256"},!1,["sign"]),z=y(J.device_key.spki),G=await crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!1,["deriveKey"]),N=new Uint8Array(await crypto.subtle.exportKey("spki",G.publicKey)),D=v("sha256").update(z).digest("base64url");return{signing:{privateKey:Z},agreement:G,signingSpki:z,agreementSpki:N,fingerprint:D}}class VJ{init;keys;hooks;options;state="identity_free";lastBrainGeneration=0;bound=null;servedRun=!1;verifiedSinceRun=!1;envDirectory=null;constructor(J,Z,z,G){this.init=J;this.keys=Z;this.hooks=z;this.options=G;if(!d.test(J.workspace_id)&&!/^ws-[a-z0-9]{8,64}$/.test(J.workspace_id))throw new W("vm_hands_layout_invalid","bad workspace id");if(!Number.isSafeInteger(J.instance_generation)||J.instance_generation<1)throw new W("vm_hands_layout_invalid","bad generation")}get phase(){return this.state}get boundRunId(){return this.state==="bound"?this.bound?.runId??null:null}canSpawn(J){return this.state==="bound"&&this.bound?.runId===J&&this.bound.envInstalled}async registerFrame(J){if(this.state!=="identity_free")throw new W("vm_hands_register_twice","already registered");if(typeof J!=="string"||J.length<16||J.length>256)throw new W("vm_hands_challenge_invalid","bad register challenge");let Z={challenge:J,t:"register",v:HJ,workspace_id:this.init.workspace_id,instance_generation:this.init.instance_generation,credential:this.init.credential,device_public_key:g(this.keys.signingSpki),env_public_key:g(this.keys.agreementSpki),key_fingerprint:this.keys.fingerprint,manifest_digest:this.init.manifest_digest,nonce:g(t(32)),timestamp_ms:(this.options.now??Date.now)(),vm_hands_attest_hold:!0},z=await crypto.subtle.sign({name:"ECDSA",hash:"SHA-256"},this.keys.signing.privateKey,new TextEncoder().encode(R(Z)));return{...Z,device_signature:g(z)}}async helloFrame(J,Z){if(this.state==="identity_free")throw new W("vm_hands_not_registered","hello before register");let z=String((this.options.now??Date.now)()),G=g(t(32)),N=UJ({method:"GET",pathAndQuery:CJ,timestamp:z,nonce:G,challenge:J,bodySha256:v("sha256").update("").digest("hex")}),D=new Uint8Array(await crypto.subtle.sign({name:"ECDSA",hash:"SHA-256"},this.keys.signing.privateKey,new Uint8Array(N)));return{t:"hello",timestamp:z,nonce:G,signature:g(vJ(D)),...Z?{vm_hands_previous_connection:Z}:{}}}registered(){if(this.state!=="identity_free")throw new W("vm_hands_register_unexpected","registered twice");this.state="registered"}async bind(J){if(this.state!=="registered")throw new W("vm_hands_not_registered","bind before register or while bound");if(J.kind!=="vm_hands.bind"||J.v!==1)throw new W("vm_hands_bind_invalid","bad bind");for(let G of[J.bind_id,J.attempt_id,J.run_id,J.session_id,J.fence_id])if(!d.test(G))throw new W("vm_hands_bind_invalid","bad id");if(!Number.isSafeInteger(J.brain_generation)||J.brain_generation<=this.lastBrainGeneration)throw new W("vm_hands_generation_stale","brain generation not strictly higher");if(J.env&&(J.env.aad!==J.bind_id||J.env.alg!=="ECDH-P256+A256GCM"))throw new W("vm_hands_bind_invalid","bad env envelope");if(!/^[0-9a-f]{64}$/.test(J.policy.policy_digest))throw new W("vm_hands_bind_invalid","bad policy or nonce");if(v("sha256").update(R({hands_confinement:J.policy.confinement_key||null,browser_egress:J.policy.browser_egress??null})).digest("hex")!==J.policy.policy_digest)throw new W("vm_hands_policy_mismatch","policy digest does not match the claim");this.lastBrainGeneration=J.brain_generation;let z=null;try{if(this.servedRun&&!this.verifiedSinceRun)await this.hooks.killAndVerifyPayload();this.verifiedSinceRun=!1;let{launchId:G,applied:N,readyData:D}=await this.hooks.startExecutor({sessionId:J.session_id,policyDigest:J.policy.policy_digest,confinementKey:J.policy.confinement_key,browserEgress:J.policy.browser_egress,cwd:J.cwd,claim:J.claim}),B=this.hooks.restatLayout(),M=null;if(J.env){let A=J.claim?.owner??{},x=jJ(await this.openSealed(J.env,J.bind_id),{runId:J.run_id,deviceId:typeof A.device_id==="string"?A.device_id:"",rootId:J.claim?.root_id??""});M=this.hooks.installEnvironment(x),z=this.writeJobEnvRootOnly(J.bind_id,x)}return this.servedRun=!0,this.bound={bindId:J.bind_id,runId:J.run_id,sessionId:J.session_id,brainGeneration:J.brain_generation,policyDigest:J.policy.policy_digest,launchId:G,envInstalled:M!==null,rootId:J.claim?.root_id??""},this.state="bound",{bind_id:J.bind_id,attempt_id:J.attempt_id,attempt_token:J.attempt_token,launch_id:G,snapshot_revision:M,layout:B,...D?{ready_data:D}:{},policy_digest:v("sha256").update(R({hands_confinement:N.hands_confinement??null,browser_egress:N.browser_egress??null})).digest("hex")}}catch(G){if(this.servedRun=!0,z)this.shred();let N=G&&typeof G==="object"&&"code"in G&&typeof G.code==="string"&&/^[a-z][a-z0-9_]{2,63}$/.test(G.code)?G.code:"vm_hands_bind_failed";throw G instanceof W?G:new W(N,"executor refused the bind")}}async deliverEnvironment(J){let Z=this.bound;if(this.state!=="bound"||!Z)throw new W("vm_hands_not_bound","environment delivered while not bound");if(J.attemptId!==Z.bindId)throw new W("vm_hands_env_invalid","environment for another attempt");if(!d.test(J.attemptId)||typeof J.snapshotId!=="string"||!J.snapshotId||J.snapshotId.length>128||J.snapshotId.includes("/"))throw new W("vm_hands_env_invalid","bad snapshot id");let z=`${J.attemptId}/${J.snapshotId}`;if(J.sealed?.alg!=="ECDH-P256+A256GCM"||J.sealed.aad!==z)throw new W("vm_hands_env_invalid","bad env envelope");let G=jJ(await this.openSealed(J.sealed,z),{runId:Z.runId,deviceId:J.deviceId,rootId:Z.rootId,snapshotId:J.snapshotId}),N=this.hooks.installEnvironment(G);return Z.envInstalled=!0,this.shred(),this.writeJobEnvRootOnly(`${Z.bindId}-r${N}`,G),{snapshot_id:J.snapshotId,installed_revision:N,installed:!0}}async attestFrame(J,Z){if(this.state==="identity_free")throw new W("vm_hands_not_registered","attest before register");if(!J||J.length>65536)throw new W("vm_hands_attest_invalid","no probe script");let z=await this.hooks.runProbe({nonce:Z,script:J});try{await this.hooks.killAndVerifyPayload(),this.verifiedSinceRun=!0}catch{this.servedRun=!0,this.verifiedSinceRun=!1}return{t:"attest",nonce:Z,exit_code:z.exitCode,markers:z.markers,proof_dir_inode:z.proofDirInode,script_sha256:v("sha256").update(J).digest("hex")}}executorExited(){return this.hooks.executorExited?.()??new Promise(()=>{})}async boundRefused(){await this.unbind()}async unbind(){let J=this.bound?.bindId??null;return this.state="unbinding",this.bound=null,await this.hooks.killAndVerifyPayload(),this.verifiedSinceRun=!0,this.shred(),this.state="registered",{bind_id:J,killed_verified:!0,shredded:!0,srt_fallbacks:this.hooks.takeSrtFallbacks?.()??null}}async openSealed(J,Z){let z=()=>{throw new W("vm_hands_env_invalid","env did not decrypt")},G=await crypto.subtle.importKey("spki",y(J.epk),{name:"ECDH",namedCurve:"P-256"},!1,[]).catch(z),N=await crypto.subtle.deriveKey({name:"ECDH",public:G},this.keys.agreement.privateKey,{name:"AES-GCM",length:256},!1,["decrypt"]),D=await crypto.subtle.decrypt({name:"AES-GCM",iv:y(J.iv),additionalData:new TextEncoder().encode(Z)},N,y(J.ct)).catch(z),B=JSON.parse(new TextDecoder().decode(D));if(!B||typeof B!=="object"||Array.isArray(B))throw new W("vm_hands_env_invalid","env not an object");return B}writeJobEnvRootOnly(J,Z){let z=V(this.options.envRoot,`bind-${J}`);kJ(z,{mode:448});let G=BJ(z);if(!G.isDirectory()||(G.mode&63)!==0||G.uid!==(process.getuid?.()??-1))throw new W("vm_hands_env_dir_unsafe","env directory is not root's 0700");let N=Z.variables&&typeof Z.variables==="object"?Z.variables:{},D=Object.entries(N).filter(([A,x])=>/^[A-Za-z_][A-Za-z0-9_]*$/.test(A)&&typeof x==="string").map(([A,x])=>`export ${A}='${String(x).replaceAll("'","'\\''")}'`).join(`
2
+ import{Ld as UJ,ad as CJ,id as qJ}from"./vm-hands-entry-lite-5zzey257.js";import{createHash as v,randomBytes as t}from"crypto";import{closeSync as QJ,fsyncSync as FJ,mkdirSync as kJ,openSync as WJ,renameSync as SJ,rmSync as gJ,statSync as BJ,writeSync as PJ,constants as S}from"fs";import{join as V}from"path";var HJ=1;var d=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function e(J){if(J.environment!==void 0||J.payload.environment!==void 0)throw new W("vm_hands_bind_invalid","bind carries a plaintext environment");if(J.payload.vm_hands_env_deferred===!0&&J.environment_sealed!==void 0)throw new W("vm_hands_bind_invalid","split bind carries an environment");return J.environment_sealed!==void 0}function jJ(J,Z){let{payload:z,authority:G}=J;if(!z||typeof z!=="object"||Array.isArray(z)||!G||typeof G!=="object"||Array.isArray(G)||!Z.deviceId||!Z.rootId||z.run_id!==Z.runId||z.device_id!==Z.deviceId||G.device_id!==Z.deviceId||z.root_id!==Z.rootId||Z.snapshotId!==void 0&&z.snapshot_id!==Z.snapshotId)throw new W("vm_hands_env_invalid","environment does not match this Hands");return z}function NJ(J){if(J.capability!=="hands.connect")throw new W("vm_hands_bind_invalid","not a hands.connect claim");let Z=J.payload;return{kind:"vm_hands.bind",v:1,bind_id:J.attempt_id,attempt_id:J.attempt_id,attempt_token:J.attempt_token,run_id:J.run_id,session_id:typeof Z.workspace_id==="string"&&d.test(Z.workspace_id)?Z.workspace_id:J.run_id,brain_generation:Z.target_generation,fence_id:Z.target_fence_id,lease_until:J.lease_until,policy:{agent_profile:"",confinement_key:String(Z.hands_confinement??""),browser_egress:Z.browser_egress??null,policy_digest:Z.vm_hands_policy_digest},cwd:typeof Z.cwd==="string"?Z.cwd:"",claim:J,env:e(J)?J.environment_sealed:null}}class W extends Error{code;constructor(J,Z){super(Z);this.code=J}}var g=(J)=>Buffer.from(J instanceof Uint8Array?J:new Uint8Array(J)).toString("base64url"),y=(J)=>new Uint8Array(Buffer.from(J,"base64url"));function R(J){if(J===null||typeof J!=="object")return JSON.stringify(J);if(Array.isArray(J))return`[${J.map(R).join(",")}]`;return`{${Object.keys(J).sort().map((Z)=>`${JSON.stringify(Z)}:${R(J[Z])}`).join(",")}}`}async function aJ(J){let Z=await crypto.subtle.importKey("pkcs8",y(J.device_key.pkcs8),{name:"ECDSA",namedCurve:"P-256"},!1,["sign"]),z=y(J.device_key.spki),G=await crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!1,["deriveKey"]),N=new Uint8Array(await crypto.subtle.exportKey("spki",G.publicKey)),D=v("sha256").update(z).digest("base64url");return{signing:{privateKey:Z},agreement:G,signingSpki:z,agreementSpki:N,fingerprint:D}}class VJ{init;keys;hooks;options;state="identity_free";lastBrainGeneration=0;bound=null;servedRun=!1;verifiedSinceRun=!1;envDirectory=null;constructor(J,Z,z,G){this.init=J;this.keys=Z;this.hooks=z;this.options=G;if(!d.test(J.workspace_id)&&!/^ws-[a-z0-9]{8,64}$/.test(J.workspace_id))throw new W("vm_hands_layout_invalid","bad workspace id");if(!Number.isSafeInteger(J.instance_generation)||J.instance_generation<1)throw new W("vm_hands_layout_invalid","bad generation")}get phase(){return this.state}get boundRunId(){return this.state==="bound"?this.bound?.runId??null:null}canSpawn(J){return this.state==="bound"&&this.bound?.runId===J&&this.bound.envInstalled}async registerFrame(J){if(this.state!=="identity_free")throw new W("vm_hands_register_twice","already registered");if(typeof J!=="string"||J.length<16||J.length>256)throw new W("vm_hands_challenge_invalid","bad register challenge");let Z={challenge:J,t:"register",v:HJ,workspace_id:this.init.workspace_id,instance_generation:this.init.instance_generation,credential:this.init.credential,device_public_key:g(this.keys.signingSpki),env_public_key:g(this.keys.agreementSpki),key_fingerprint:this.keys.fingerprint,manifest_digest:this.init.manifest_digest,nonce:g(t(32)),timestamp_ms:(this.options.now??Date.now)(),vm_hands_attest_hold:!0},z=await crypto.subtle.sign({name:"ECDSA",hash:"SHA-256"},this.keys.signing.privateKey,new TextEncoder().encode(R(Z)));return{...Z,device_signature:g(z)}}async helloFrame(J,Z){if(this.state==="identity_free")throw new W("vm_hands_not_registered","hello before register");let z=String((this.options.now??Date.now)()),G=g(t(32)),N=UJ({method:"GET",pathAndQuery:CJ,timestamp:z,nonce:G,challenge:J,bodySha256:v("sha256").update("").digest("hex")}),D=new Uint8Array(await crypto.subtle.sign({name:"ECDSA",hash:"SHA-256"},this.keys.signing.privateKey,new Uint8Array(N)));return{t:"hello",timestamp:z,nonce:G,signature:g(vJ(D)),...Z?{vm_hands_previous_connection:Z}:{}}}registered(){if(this.state!=="identity_free")throw new W("vm_hands_register_unexpected","registered twice");this.state="registered"}async bind(J){if(this.state!=="registered")throw new W("vm_hands_not_registered","bind before register or while bound");if(J.kind!=="vm_hands.bind"||J.v!==1)throw new W("vm_hands_bind_invalid","bad bind");for(let G of[J.bind_id,J.attempt_id,J.run_id,J.session_id,J.fence_id])if(!d.test(G))throw new W("vm_hands_bind_invalid","bad id");if(!Number.isSafeInteger(J.brain_generation)||J.brain_generation<=this.lastBrainGeneration)throw new W("vm_hands_generation_stale","brain generation not strictly higher");if(J.env&&(J.env.aad!==J.bind_id||J.env.alg!=="ECDH-P256+A256GCM"))throw new W("vm_hands_bind_invalid","bad env envelope");if(!/^[0-9a-f]{64}$/.test(J.policy.policy_digest))throw new W("vm_hands_bind_invalid","bad policy or nonce");if(v("sha256").update(R({hands_confinement:J.policy.confinement_key||null,browser_egress:J.policy.browser_egress??null})).digest("hex")!==J.policy.policy_digest)throw new W("vm_hands_policy_mismatch","policy digest does not match the claim");this.lastBrainGeneration=J.brain_generation;let z=null;try{if(this.servedRun&&!this.verifiedSinceRun)await this.hooks.killAndVerifyPayload();this.verifiedSinceRun=!1;let{launchId:G,applied:N,readyData:D}=await this.hooks.startExecutor({sessionId:J.session_id,policyDigest:J.policy.policy_digest,confinementKey:J.policy.confinement_key,browserEgress:J.policy.browser_egress,cwd:J.cwd,claim:J.claim}),B=this.hooks.restatLayout(),M=null;if(J.env){let A=J.claim?.owner??{},x=jJ(await this.openSealed(J.env,J.bind_id),{runId:J.run_id,deviceId:typeof A.device_id==="string"?A.device_id:"",rootId:J.claim?.root_id??""});M=this.hooks.installEnvironment(x),z=this.writeJobEnvRootOnly(J.bind_id,x)}return this.servedRun=!0,this.bound={bindId:J.bind_id,runId:J.run_id,sessionId:J.session_id,brainGeneration:J.brain_generation,policyDigest:J.policy.policy_digest,launchId:G,envInstalled:M!==null,rootId:J.claim?.root_id??""},this.state="bound",{bind_id:J.bind_id,attempt_id:J.attempt_id,attempt_token:J.attempt_token,launch_id:G,snapshot_revision:M,layout:B,...D?{ready_data:D}:{},policy_digest:v("sha256").update(R({hands_confinement:N.hands_confinement??null,browser_egress:N.browser_egress??null})).digest("hex")}}catch(G){if(this.servedRun=!0,z)this.shred();let N=G&&typeof G==="object"&&"code"in G&&typeof G.code==="string"&&/^[a-z][a-z0-9_]{2,63}$/.test(G.code)?G.code:"vm_hands_bind_failed";throw G instanceof W?G:new W(N,"executor refused the bind")}}async deliverEnvironment(J){let Z=this.bound;if(this.state!=="bound"||!Z)throw new W("vm_hands_not_bound","environment delivered while not bound");if(J.attemptId!==Z.bindId)throw new W("vm_hands_env_invalid","environment for another attempt");if(!d.test(J.attemptId)||typeof J.snapshotId!=="string"||!J.snapshotId||J.snapshotId.length>128||J.snapshotId.includes("/"))throw new W("vm_hands_env_invalid","bad snapshot id");let z=`${J.attemptId}/${J.snapshotId}`;if(J.sealed?.alg!=="ECDH-P256+A256GCM"||J.sealed.aad!==z)throw new W("vm_hands_env_invalid","bad env envelope");let G=jJ(await this.openSealed(J.sealed,z),{runId:Z.runId,deviceId:J.deviceId,rootId:Z.rootId,snapshotId:J.snapshotId}),N=this.hooks.installEnvironment(G);return Z.envInstalled=!0,this.shred(),this.writeJobEnvRootOnly(`${Z.bindId}-r${N}`,G),{snapshot_id:J.snapshotId,installed_revision:N,installed:!0}}async attestFrame(J,Z){if(this.state==="identity_free")throw new W("vm_hands_not_registered","attest before register");if(!J||J.length>65536)throw new W("vm_hands_attest_invalid","no probe script");let z=await this.hooks.runProbe({nonce:Z,script:J});try{await this.hooks.killAndVerifyPayload(),this.verifiedSinceRun=!0}catch{this.servedRun=!0,this.verifiedSinceRun=!1}return{t:"attest",nonce:Z,exit_code:z.exitCode,markers:z.markers,proof_dir_inode:z.proofDirInode,script_sha256:v("sha256").update(J).digest("hex")}}executorExited(){return this.hooks.executorExited?.()??new Promise(()=>{})}async boundRefused(){await this.unbind()}async unbind(){let J=this.bound?.bindId??null;return this.state="unbinding",this.bound=null,await this.hooks.killAndVerifyPayload(),this.verifiedSinceRun=!0,this.shred(),this.state="registered",{bind_id:J,killed_verified:!0,shredded:!0,srt_fallbacks:this.hooks.takeSrtFallbacks?.()??null}}async openSealed(J,Z){let z=()=>{throw new W("vm_hands_env_invalid","env did not decrypt")},G=await crypto.subtle.importKey("spki",y(J.epk),{name:"ECDH",namedCurve:"P-256"},!1,[]).catch(z),N=await crypto.subtle.deriveKey({name:"ECDH",public:G},this.keys.agreement.privateKey,{name:"AES-GCM",length:256},!1,["decrypt"]),D=await crypto.subtle.decrypt({name:"AES-GCM",iv:y(J.iv),additionalData:new TextEncoder().encode(Z)},N,y(J.ct)).catch(z),B=JSON.parse(new TextDecoder().decode(D));if(!B||typeof B!=="object"||Array.isArray(B))throw new W("vm_hands_env_invalid","env not an object");return B}writeJobEnvRootOnly(J,Z){let z=V(this.options.envRoot,`bind-${J}`);kJ(z,{mode:448});let G=BJ(z);if(!G.isDirectory()||(G.mode&63)!==0||G.uid!==(process.getuid?.()??-1))throw new W("vm_hands_env_dir_unsafe","env directory is not root's 0700");let N=Z.variables&&typeof Z.variables==="object"?Z.variables:{},D=Object.entries(N).filter(([A,x])=>/^[A-Za-z_][A-Za-z0-9_]*$/.test(A)&&typeof x==="string").map(([A,x])=>`export ${A}='${String(x).replaceAll("'","'\\''")}'`).join(`
3
3
  `)+`
4
4
  `,B=V(z,`.job.env.${t(8).toString("hex")}`),M=WJ(B,S.O_WRONLY|S.O_CREAT|S.O_EXCL|S.O_NOFOLLOW,384);try{PJ(M,D),FJ(M)}finally{QJ(M)}return SJ(B,V(z,"job.env")),this.envDirectory=z,V(z,"job.env")}shred(){let J=this.envDirectory;if(this.envDirectory=null,!J)return;try{let Z=V(J,"job.env"),z=BJ(Z).size,G=WJ(Z,S.O_WRONLY|S.O_NOFOLLOW);try{PJ(G,Buffer.alloc(z)),FJ(G)}finally{QJ(G)}}catch{}gJ(J,{recursive:!0,force:!0})}}function vJ(J){if(J.length!==64)throw new W("vm_hands_signature_invalid","unexpected ECDSA signature length");let Z=(N)=>{let D=0;while(D<N.length-1&&N[D]===0)D++;let B=N.subarray(D),M=B[0]&128?Uint8Array.of(0,...B):B;return Uint8Array.of(2,M.length,...M)},z=Z(J.subarray(0,32)),G=Z(J.subarray(32));return Uint8Array.of(48,z.length+G.length,...z,...G)}import{randomUUID as yJ}from"crypto";var RJ="/app/local-runtime/session?register=vm_hands_v1",fJ="/app/local-runtime",DJ=25000,bJ=20000,mJ=1e4,cJ=5000,pJ=new Set(["pty.start","jobs.control","preview.serve.v1","display.stream.v1"]),JJ=75000,lJ=1e4,u=20000;class h extends Error{}var dJ=64;async function AJ(J){let Z=[...J.modelOps];for(let z of Z)z.abort.abort();await Promise.race([Promise.all(Z.map((z)=>z.settled)),new Promise((z)=>setTimeout(z,cJ))])}async function f(J,Z){return await AJ(J),Z.unbind()}function o(J){for(let Z of J.outbox?.splice(0)??[])Z.reject(Error("vm_hands_attempt_ended"))}var LJ=15000,uJ=1e4;async function zZ(J){let Z=Date.now(),z={deviceId:null,connection:null,turn:null,lostAt:0,receipts:[],attest:"pending",attestWaiters:[],flush:null,modelOps:new Set},G=J.log??(()=>{}),N=async(D)=>{let B=z.turn;if(!B)return;z.turn=null,o(B);let M=await f(z,J.agent).catch(()=>null);if(M)z.receipts.push({turn:B,failure:"vm_hands_bind_lost",unbound:M});G("vm_hands.bound_dropped",{reason:D})};try{for(let D=0;!J.signal.aborted;D++){let B=await oJ(J,z).catch((A)=>{if(A instanceof W&&z.deviceId===null&&A.code==="vm_hands_no_session"&&Date.now()-Z<lJ)return{closeCode:0,closeReason:"vm_hands_no_session"};if(A instanceof W&&z.deviceId===null)throw A;return{closeCode:0,closeReason:A instanceof Error?A.message:String(A)}});if(G("vm_hands.session_closed",{close_code:B.closeCode,reason:B.closeReason.slice(0,120),registered:z.deviceId!==null}),B.closeCode===4401||z.attest==="refused")return;if(J.signal.aborted)return;if(z.turn&&Date.now()-z.lostAt>=JJ)await N("reconnect_deadline");let M=B.closeReason==="vm_hands_no_session"?Math.min(250*2**Math.min(D,5),2000):z.turn?Math.min(250*2**Math.min(D,5),5000,Math.max(0,z.lostAt+JJ-Date.now())):Math.min(500*2**D,30000);if(await new Promise((A)=>setTimeout(A,M)),z.turn&&Date.now()-z.lostAt>=JJ)await N("reconnect_deadline")}}finally{await N("session_ended")}}async function oJ(J,Z){let z=Z.deviceId,G=J.log??(()=>{}),N=z?`/app/local-runtime/session?device_id=${encodeURIComponent(z)}`:RJ,D=`${J.apiOrigin.replace(/^http/,"ws")}${N}`,B=new WebSocket(D),M=0,A="",x=new Map,i=[],b=null,MJ=new Promise(($)=>{B.onclose=(K)=>{M=K.code,A=K.reason;for(let Y of x.values())Y.reject(new h(`session closed ${K.code}`));for(let Y of Z.attestWaiters.splice(0))Y(!1);x.clear(),$()}});B.onmessage=($)=>{let K;try{K=JSON.parse(String($.data))}catch{B.close(4400);return}if(K.t==="res"){let Y=K;x.get(Y.id)?.resolve({status:Y.status,body:Y.body}),x.delete(Y.id);return}if(!b?.(K))i.push(K)};let m=($,K)=>new Promise((Y,F)=>{let P=i.findIndex((C)=>$.includes(C.t));if(P>=0){Y(i.splice(P,1)[0]);return}let U=setTimeout(()=>{b=null,F(new W("vm_hands_no_register",`no ${$.join("/")} in ${K} ms`))},K);b=(C)=>{if(!$.includes(C.t))return!1;return clearTimeout(U),b=null,Y(C),!0}}),c=($)=>B.send(JSON.stringify($)),w=($,K)=>new Promise((Y,F)=>{if(B.readyState!==WebSocket.OPEN){F(new h("session closed"));return}let P=yJ(),U=typeof K.wait_ms==="number"?K.wait_ms:0,C=setTimeout(()=>{if(!x.delete(P))return;F(new h(`no answer to ${$.split("/").pop()} in ${U+LJ} ms`)),B.close(4000,"request_timeout")},U+LJ);x.set(P,{reject:(X)=>{clearTimeout(C),F(X)},resolve:({status:X,body:Q})=>{clearTimeout(C);let j=null;try{j=Q?JSON.parse(Q):null}catch{}Y({status:X,json:j})}}),c({t:"req",id:P,path:`${fJ}${$}`,body:JSON.stringify(K)})}),ZJ=()=>B.close(1001,"stopping");J.signal.addEventListener("abort",ZJ,{once:!0});let r,p={turn:null},T=null,$J=!1,s=new Set,n=!1,l=!1;try{await new Promise((X,Q)=>{let j=setTimeout(()=>Q(Error("session open timeout")),uJ);B.onopen=()=>{clearTimeout(j),G("vm_hands.ws_open",{}),X()},B.onerror=()=>{clearTimeout(j),Q(Error("session socket error"))}});let $=await m(["challenge"],5000);G("vm_hands.challenge",{});let K=null,Y=null,F=null,P;if(z){c(await J.agent.helloFrame($.challenge,Z.connection));let X=await m(["ready"],1e4);if(typeof X.vm_hands_connection==="string")Z.connection=X.vm_hands_connection;if(P={device_id:z,...X.cadence?{cadence:X.cadence}:{}},typeof X.vm_hands_probe_script==="string"){if(F=X.vm_hands_probe_script,l=!0,J.agent.phase==="registered"&&!Z.turn)Z.attest="pending"}if(G("vm_hands.reconnected",{device_id:z}),Z.turn){let Q=X.vm_hands_bind;if(Q&&Q.operation_id===Z.turn.claim.operation_id&&Q.attempt_id===Z.turn.claim.attempt_id)K=Z.turn,G("vm_hands.bound_resumed",{operation_id:Q.operation_id});else{Y=Z.turn,Z.turn=null,o(Y);let j=await f(Z,J.agent).catch(()=>null);if(j)Z.receipts.push({turn:Y,failure:"vm_hands_bind_lost",unbound:j});G("vm_hands.bound_dropped",{reason:"not_named_on_reconnect"})}}}else{c(await J.agent.registerFrame($.challenge)),G("vm_hands.register_sent",{});let X=await m(["registered","register_refused"],1e4);if(X.t==="register_refused")throw new W(X.code,"register refused");J.agent.registered();let Q=X;if(P=Q,Z.deviceId=Q.device_id,typeof Q.vm_hands_connection==="string")Z.connection=Q.vm_hands_connection;if(typeof Q.vm_hands_probe_script==="string"){if(F=Q.vm_hands_probe_script,l=!0,J.agent.phase==="registered"&&!Z.turn)Z.attest="pending"}G("vm_hands.registered",{device_id:P.device_id})}let U=async()=>{let X=await w("/heartbeat",await J.heartbeat());if(X.status>=300)throw Error(`heartbeat ${X.status}`)};await U();let C=P.cadence?.presence_interval_ms??30000;if(r=setInterval(()=>{U().catch(()=>B.close())},C),F&&Z.attest!=="accepted"&&J.agent.phase==="registered"&&!Z.turn)IJ(F,$.challenge);try{if(await KJ(),K){let X=K;Z.flush=()=>zJ(X),Z.flush(),T=GJ(X).catch(async(Q)=>{await a(Q),B.close()}).finally(()=>{T=null})}while(!J.signal.aborted&&B.readyState===WebSocket.OPEN){let X=await w("/operations/claim",{wait_ms:Math.min(P.cadence?.claim_wait_ms??DJ,DJ)});if(X.status===204||!X.json)continue;if(X.status>=300)throw Error(`claim ${X.status}`);let Q=X.json;if(Q.capability==="hands.connect"){if(T){_({claim:Q,eventSeq:0}).complete("failed",{error_code:"vm_hands_busy"}).catch(()=>{return});continue}T=EJ(Q).catch(async(j)=>{await a(j),B.close()}).finally(()=>{T=null})}else _J(Q).catch(()=>{return})}}catch(X){await a(X)}}finally{if(r)clearInterval(r);if(J.signal.removeEventListener("abort",ZJ),Z.flush=null,B.close(),await MJ,await T,(J.agent.phase==="bound"||J.agent.phase==="unbinding")&&!Z.turn){let $=await f(Z,J.agent).catch(()=>null),K=p.turn;if($&&K)Z.receipts.push({turn:{...K,eventSeq:K.eventSeq+1},failure:"vm_hands_bind_lost",unbound:$});G("vm_hands.bound_dropped",{reason:"bound_after_loss"})}for(let $ of s)$.abort()}return{closeCode:M,closeReason:A};async function a($){if($J)return;if($J=!0,Z.turn&&$ instanceof h)Z.lostAt=Date.now();else{let K=Z.turn;if(Z.turn=null,K)o(K),J.onTurn?.(null);if(J.agent.phase==="bound"||J.agent.phase==="unbinding"){let Y=await f(Z,J.agent).catch(()=>null),F=p.turn;if(Y&&F)Z.receipts.push({turn:{...F,eventSeq:F.eventSeq+1},failure:"vm_hands_bind_lost",unbound:Y})}}G("vm_hands.session_lost",{error:$ instanceof Error?$.message:String($),bound_kept:Z.turn!==null})}function _($){let K=$.claim,Y={attempt_id:K.attempt_id,attempt_token:K.attempt_token},F=encodeURIComponent(K.operation_id);return{fence:Y,op:F,complete:(U,C={})=>w(`/operations/${F}/complete`,{...Y,status:U,...C}),emit:(U,C)=>{let X=($.chain??Promise.resolve()).catch(()=>{return}).then(()=>P(U,C));return $.chain=X,X}};async function P(U,C){let X=$.eventSeq,Q=(L)=>w(`/operations/${F}/events`,{...Y,event_seq_start:L,events:[{kind:U,payload:{sequence:L,capability:String(K.capability??"hands.connect"),data:C}}]}),j=X,E=await Q(j),I=E.status===409?E.json?.expected_event_seq:void 0;if(typeof I==="number"&&I===X+1)E={status:200,json:{duplicate:!0}};else if(typeof I==="number"&&I>=0&&I!==X)j=I,E=await Q(j);if(E.status<300)$.eventSeq=j+1;return E}}function xJ($){return(K,Y)=>new Promise((F,P)=>{if(Z.turn!==$){P(Error("vm_hands_attempt_ended"));return}if($.outbox??=[],$.outbox.length>=dJ){P(Error("vm_hands_outbox_full"));return}$.outbox.push({kind:K,data:Y,resolve:F,reject:P}),Z.flush?.()})}function zJ($){if(n)return;n=!0,(async()=>{try{while($.outbox?.length&&Z.turn===$&&B.readyState===WebSocket.OPEN){let K=$.outbox[0],Y;try{Y=await _($).emit(K.kind,K.data)}catch(F){if(F instanceof h)return;Y={status:500}}if($.outbox.shift(),Y.status<300)K.resolve();else K.reject(Error(`${K.kind} refused ${Y.status}`))}}finally{n=!1}})()}async function IJ($,K){try{let Y=await J.agent.attestFrame($,K);if(B.readyState!==WebSocket.OPEN)return;c(Y);let F=await m(["attested","attest_refused"],15000);Z.attest=F.t==="attested"?"accepted":"refused";for(let P of Z.attestWaiters.splice(0))P(Z.attest==="accepted");if(G("vm_hands.attest",{result:Z.attest,exit_code:Y.exit_code,...F.t==="attest_refused"?{code:String(F.code??"")}:{}}),Z.attest==="refused")B.close(4401,"attest_refused")}catch(Y){G("vm_hands.attest_failed",{code:Y instanceof W?Y.code:"probe_error"});for(let F of Z.attestWaiters.splice(0))F(!1);if(Z.attest!=="accepted")B.close(4000,"attest_unanswered")}}async function EJ($){let K=l&&Z.attest==="pending",Y=$.vm_hands_attest,F=Y;if(Z.attest==="refused"){G("vm_hands.claim_attest_refused",{said:typeof Y==="string"?Y.slice(0,16):typeof Y,local:Z.attest}),await _({claim:$,eventSeq:0}).complete("failed",{error_code:"vm_hands_unattested"}).catch(()=>{return});return}if(F==="accepted"){if(!K&&Z.attest!=="accepted"){Z.attest="accepted";for(let L of Z.attestWaiters.splice(0))L(!0)}}else if(F!=="pending"||!K){G("vm_hands.claim_attest_refused",{said:typeof Y==="string"?Y.slice(0,16):typeof Y,local:Z.attest}),await _({claim:$,eventSeq:0}).complete("failed",{error_code:"vm_hands_unattested"}).catch(()=>{return});return}if(Z.attest!=="accepted"){let L=Date.parse($.lease_until)-Date.now()-5000,H=Math.max(0,Math.min(u,Number.isFinite(L)?L:u));if(!await new Promise((q)=>{let O=setTimeout(()=>q(!1),H);Z.attestWaiters.push((k)=>{clearTimeout(O),q(k)})})){await _({claim:$,eventSeq:0}).complete("failed",{error_code:"vm_hands_unattested"}).catch(()=>{return});return}}let P={claim:$,eventSeq:0},{complete:U,emit:C}=_(P),X;try{if($.capability!=="hands.connect")throw new W("vm_hands_bind_invalid","not hands.connect");X=!e($)}catch(L){G("vm_hands.bind_refused",{code:L instanceof W?L.code:"unexpected"}),await U("failed",{error_code:L instanceof W?L.code:"vm_hands_bind_invalid"});return}let Q;try{Q=await J.agent.bind(NJ($))}catch(L){G("vm_hands.bind_refused",{code:L instanceof W?L.code:"unexpected"}),await U("failed",{error_code:L instanceof W?L.code:"vm_hands_bind_failed"});return}let j={...Q.ready_data??J.readyData({launchId:Q.launch_id,claim:$})};if(X)delete j.environment_installed;p.turn={claim:$,launchId:Q.launch_id,readyData:j,eventSeq:P.eventSeq,ackSeq:-1};let E=await C("hands.ready",{...j,vm_hands:{layout:Q.layout,policy_digest:Q.policy_digest,launch_id:Q.launch_id}});if(p.turn=null,E.status>=300){await AJ(Z),await J.agent.boundRefused(),await U("failed",{error_code:String(E.json?.error??"vm_hands_probe_failed")});return}let I={claim:$,launchId:Q.launch_id,readyData:j,eventSeq:P.eventSeq,ackSeq:-1};Z.turn=I,Z.flush=()=>zJ(I),J.onTurn?.(xJ(I)),await GJ(I)}async function GJ($){let{fence:K,op:Y}=_($),F=null,P=null,U=J.agent.executorExited().then((C)=>{return P=C,null});J:for(;;){let C=await Promise.race([U,w(`/operations/${Y}/heartbeat`,{...K,control_ack_seq:$.ackSeq,wait_ms:bJ})]);if(!C){F="vm_hands_executor_exited",G("vm_hands.executor_exited",{reason:P});break}if(C.status>=300)break;let X=(C.json?.controls??[]).slice().sort((Q,j)=>Q.seq-j.seq);for(let Q of X){if(Q.seq<=$.ackSeq)continue;if(Q.kind==="operation.cancel"||Q.kind==="cancel"){$.ackSeq=Q.seq;break J}if(Q.kind===qJ)try{await wJ($,Q.payload??{})}catch(j){if(j instanceof h)throw j;F=j instanceof W?j.code:"environment_unavailable",G("vm_hands.environment_refused",{code:F});break J}$.ackSeq=Q.seq}}await OJ($,F)}async function _J($){let K=$,Y={claim:K,eventSeq:0},{complete:F,emit:P,fence:U,op:C}={..._(Y)},X=$.vm_hands_origin==="person"?"person":"model",Q=String($.capability??"");if(!J.executeOp){await F("failed",{error_code:"vm_hands_op_unsupported"});return}if($.vm_hands_attest==="accepted"&&Z.attest==="pending"&&!(l&&Z.attest==="pending")){Z.attest="accepted";for(let q of Z.attestWaiters.splice(0))q(!0)}if(Z.attest!=="accepted"){let q=Date.parse(String($.lease_until??""))-Date.now()-5000,O=Z.attest==="refused"?0:Math.max(0,Math.min(u,Number.isFinite(q)?q:u));if(!(O>0&&await new Promise((XJ)=>{let hJ=setTimeout(()=>XJ(!1),O);Z.attestWaiters.push((TJ)=>{clearTimeout(hJ),XJ(TJ)})}))){await F("failed",{error_code:"vm_hands_unattested"});return}}if(X==="model"&&(J.agent.phase!=="bound"||J.agent.boundRunId!==K.run_id)){await F("failed",{error_code:"vm_hands_not_bound"});return}if(pJ.has(Q)&&J.agent.phase!=="bound"){await F("failed",{error_code:"vm_hands_not_bound"});return}let j=new AbortController;s.add(j);let E,I=new Promise((q)=>{E=q}),L={abort:j,settled:I};if(X==="model")Z.modelOps.add(L);let H=-1,YJ=setInterval(()=>{w(`/operations/${C}/heartbeat`,{...U,control_ack_seq:H,wait_ms:0}).then((q)=>{if(q.status>=300){j.abort();return}let O=q.json?.controls??[];for(let k of O)if(H=Math.max(H,k.seq),k.kind==="operation.cancel"||k.kind==="cancel")j.abort()},()=>j.abort())},mJ);try{let q=await J.executeOp({kind:X,claim:$,signal:j.signal,emit:async(O)=>{await P(O.kind,O.data??{})}});await F(q.status,{...q.result?{result:q.result}:{},...q.error_code!==void 0?{error_code:q.error_code}:{}}),G("vm_hands.op",{capability:Q,kind:X,status:q.status,code:q.error_code??null})}finally{clearInterval(YJ),s.delete(j),Z.modelOps.delete(L),E()}}async function OJ($,K){if(Z.turn===$)Z.turn=null;J.onTurn?.(null),o($);let Y=await f(Z,J.agent);Z.receipts.push({turn:$,failure:K,unbound:Y}),await KJ()}async function KJ(){while(Z.receipts.length){let{turn:$,failure:K,unbound:Y}=Z.receipts[0],{complete:F,emit:P}=_($);try{if(await P("hands.stopped",{...$.readyData,reason_code:K?"failed":"cancelled",killed_verified:Y.killed_verified,shredded:Y.shredded,...Y.srt_fallbacks?{vm_hands_srt_fallbacks:Y.srt_fallbacks}:{}}),K)await F("failed",{error_code:K});else await F("cancelled",{error_code:"driver_stopped"})}catch(U){if(U instanceof h)return}Z.receipts.shift()}}async function wJ($,K){let{fence:Y,op:F}=_($),P=K.snapshot_id;if(K.version!==1||typeof P!=="string"||Object.keys(K).length!==2)throw new W("vm_hands_env_invalid","invalid environment delivery");let U=await w(`/operations/${F}/environment`,{...Y,snapshot_id:P}),C=U.json?.environment_sealed;if(U.status!==200||!C||U.json?.payload!==void 0)throw new W("vm_hands_env_invalid","environment not delivered sealed");let X=await J.agent.deliverEnvironment({attemptId:$.claim.attempt_id,snapshotId:P,deviceId:Z.deviceId??"",sealed:C});if((await w(`/operations/${F}/environment-ack`,{...Y,...X})).status>=300)throw new W("vm_hands_env_ack_refused","environment ack refused")}}
5
5
  export{aJ as u,VJ as v,zZ as w};