@reason-machines/cli-linux-x64 0.2.471 → 0.2.473
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.
- package/bin/reason +2 -2
- package/bin/vm-hands/api-credentials-s9h7p7mh.js +2 -0
- package/bin/vm-hands/{api-7xy672j8.js → api-y0tty1bt.js} +1 -1
- package/bin/vm-hands/connect-cli-hzad1rps.js +2 -0
- package/bin/vm-hands/{custom-endpoint-device-r2nn1xj9.js → custom-endpoint-device-6c5s0j3t.js} +1 -1
- package/bin/vm-hands/desktop-account-wgkkapa4.js +2 -0
- package/bin/vm-hands/{fsevents-sxsgn7s9.js → fsevents-xj75dzay.js} +1 -1
- package/bin/vm-hands/{hands-worker-source-k8v5kmmw.js → hands-worker-source-rjsr93rq.js} +1 -1
- package/bin/vm-hands/{index-d5n50g8b.js → index-kn7eerh9.js} +2 -2
- package/bin/vm-hands/local-automation-pq08yjbc.js +2 -0
- package/bin/vm-hands/local-capabilities-35z8nr0y.js +2 -0
- package/bin/vm-hands/local-desktop-users-3641y146.js +2 -0
- package/bin/vm-hands/local-display-session-ecntdwxe.js +2 -0
- package/bin/vm-hands/local-display-video-v7g7n7tf.js +2 -0
- package/bin/vm-hands/local-managed-process-0q0khgdg.js +2 -0
- package/bin/vm-hands/{local-pty-session-k6kab3tc.js → local-pty-session-k3c8bwtj.js} +1 -1
- package/bin/vm-hands/managed-runtime-0f805trk.js +2 -0
- package/bin/vm-hands/network-contract-z0sk9jzq.js +2 -0
- package/bin/vm-hands/package-t67yw2kp.js +2 -0
- package/bin/vm-hands/permissions-7ay3j94c.js +2 -0
- package/bin/vm-hands/serve-service-vgt7qedg.js +2 -0
- package/bin/vm-hands/{status-3mgfgra8.js → status-69b64z1g.js} +1 -1
- package/bin/vm-hands/version-t0xnbt7t.js +2 -0
- package/bin/vm-hands/{vm-hands-entry-lite-mmrdd8gk.js → vm-hands-entry-lite-4t4sh0q6.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-nxyk22qr.js → vm-hands-entry-lite-6431pknh.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-5zvph0py.js → vm-hands-entry-lite-7e2x9bfe.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-spajqeyc.js → vm-hands-entry-lite-7fyrsw85.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-eqbbemee.js → vm-hands-entry-lite-7mf3t1v6.js} +1 -1
- package/bin/vm-hands/vm-hands-entry-lite-9ar02hg7.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-ahtvnd86.js +2 -0
- package/bin/vm-hands/{vm-hands-entry-lite-egax7vw4.js → vm-hands-entry-lite-amwx1104.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-gez48xt4.js → vm-hands-entry-lite-cvgeeyjj.js} +4 -4
- package/bin/vm-hands/{vm-hands-entry-lite-98rmcvag.js → vm-hands-entry-lite-dg9eh49f.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-vfxx44f3.js → vm-hands-entry-lite-dykbkjpt.js} +3 -3
- package/bin/vm-hands/vm-hands-entry-lite-e508r607.js +2 -0
- package/bin/vm-hands/{vm-hands-entry-lite-tn8v3yfj.js → vm-hands-entry-lite-ey2hbfs8.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-r3yp6cr9.js → vm-hands-entry-lite-fykfnzjg.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-03d1fhxv.js → vm-hands-entry-lite-hk6grdfm.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-awp08wyd.js → vm-hands-entry-lite-hyk852md.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-7ja63pfz.js → vm-hands-entry-lite-jwgheerx.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-d2fveq6h.js → vm-hands-entry-lite-k3ksgb4t.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-7c7swrjq.js → vm-hands-entry-lite-kqdysn28.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-b8yapqfn.js → vm-hands-entry-lite-mb6atrr0.js} +5 -5
- package/bin/vm-hands/{vm-hands-entry-lite-vm6et8tm.js → vm-hands-entry-lite-pz1gnec4.js} +10 -10
- package/bin/vm-hands/{vm-hands-entry-lite-hdc0sb80.js → vm-hands-entry-lite-r43h85w5.js} +4 -4
- package/bin/vm-hands/{vm-hands-entry-lite-8eksd9j1.js → vm-hands-entry-lite-s8san9e5.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-8qvsnkvv.js → vm-hands-entry-lite-tmart4k9.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-5agyspqp.js → vm-hands-entry-lite-vmnxnr7y.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-kz48x6p0.js → vm-hands-entry-lite-wwp36b4m.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-44qha2rt.js → vm-hands-entry-lite-wxz5n6tc.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-gdzw92jk.js → vm-hands-entry-lite-ye0pkbqd.js} +1 -1
- package/bin/vm-hands/vm-hands-entry-lite.js +2 -2
- package/bin/vm-hands/{vm-hands-executor-zn1wyrng.js → vm-hands-executor-3cxjy1sr.js} +1 -1
- package/bin/vm-hands/{vm-hands-op-runner-h6s4p65y.js → vm-hands-op-runner-pmpa2r8z.js} +1 -1
- package/bin/vm-hands/{vm-hands-runtime-ecfwv3a4.js → vm-hands-runtime-2emg32yv.js} +3 -3
- package/bin/vm-hands/worker-preview-readiness-jrmtzbwm.js +2 -0
- package/bin/vm-hands/{worker-sandbox-1g7jheqm.js → worker-sandbox-26a3hggc.js} +1 -1
- package/package.json +1 -1
- package/bin/vm-hands/api-credentials-bbmmmkwx.js +0 -2
- package/bin/vm-hands/connect-cli-c5bmsf0p.js +0 -2
- package/bin/vm-hands/desktop-account-3cc0bhw8.js +0 -2
- package/bin/vm-hands/local-automation-xqbgsg13.js +0 -2
- package/bin/vm-hands/local-capabilities-rnsn2yye.js +0 -2
- package/bin/vm-hands/local-desktop-users-qskbh51j.js +0 -2
- package/bin/vm-hands/local-display-session-avdg9bkp.js +0 -2
- package/bin/vm-hands/local-display-video-7t4c9cwg.js +0 -2
- package/bin/vm-hands/local-managed-process-zvm6srg5.js +0 -2
- package/bin/vm-hands/managed-runtime-10rq8hz6.js +0 -2
- package/bin/vm-hands/network-contract-y2eybfhn.js +0 -2
- package/bin/vm-hands/package-8v6gpwas.js +0 -2
- package/bin/vm-hands/permissions-0yb0vzqr.js +0 -2
- package/bin/vm-hands/serve-service-q02jz4d9.js +0 -2
- package/bin/vm-hands/version-5ffeerbd.js +0 -2
- package/bin/vm-hands/vm-hands-entry-lite-3pxmmb7z.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-n1k1njzh.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-zz8yhajj.js +0 -2
- package/bin/vm-hands/worker-preview-readiness-6hzzjnk7.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t,St,k,o,d,u,c,g,ee,s,n}from"./vm-hands-entry-lite-
|
|
2
|
+
import{t,St,k,o,d,u,c,g,ee,s,n}from"./vm-hands-entry-lite-vmnxnr7y.js";var I=t().max(201).regex(/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/).refine((e)=>e.split("/").every((r)=>r!=="."&&r!=="..")),y=t().min(1).max(255).regex(/^[A-Za-z0-9_][A-Za-z0-9_./-]*$/).refine((e)=>!e.includes("..")&&!e.includes("//")&&!e.endsWith("/")&&!e.endsWith(".lock")),x=t().regex(/^[a-f0-9]{40}$/),E=o().int().positive(),T=t().min(1).max(256),D=t().max(60000),L={version:n(1),repoFullName:I},C=u(t().max(1024).regex(/^(?:Co-authored-by: [^<>\r\n\x00]+ <[^<>\s]+@[^<>\s]+>|Reason-Contributor-ID: rc_[a-f0-9]{32})$/)).max(1000),G=c({expectedTrailers:C,missingFromHead:C}),z=g("action",[c({action:n("edit"),title:T.optional(),body:D.optional(),base:y.optional()}),c({action:s(["ready","draft","close"])}),c({action:n("metadata"),field:s(["reviewer","assignee","label"]),change:s(["add","remove"]),value:t().min(1).max(100).refine((e)=>!/[\r\n\0]/.test(e))})]),Pe=g("kind",[c({...L,kind:n("read"),path:t().min(1).max(2048),accept:s(["application/vnd.github+json","application/vnd.github.full+json","application/vnd.github.v3.diff"]).optional()}),c({...L,kind:n("pr_review_context"),number:E,after:t().min(1).max(1024).optional()}),c({...L,kind:n("prepare"),branch:y,baseSha:x,defaultBranch:y,diagnosticsVersion:n(1).optional()}),c({...L,kind:n("publish"),branch:y,defaultBranch:y,baseSha:x,remoteHeadSha:x.nullable(),contributorTrailers:C.optional()}),c({...L,kind:n("pr_create"),head:y,base:y,title:T,body:D,draft:d()}),c({...L,kind:n("pr_mutation"),number:E,mutation:z}),c({...L,kind:n("pr_merge"),number:E,expectedHeadSha:x,expectedBaseRef:y,method:s(["merge","squash","rebase"]),commitBody:t().max(65536).optional()})]),V=["local_device_gh_prepare_setup","local_device_gh_prepare_metadata","local_device_gh_prepare_private_init","local_device_gh_prepare_fetch","local_device_gh_prepare_base_mismatch","local_device_gh_prepare_checkout_validation","local_device_gh_prepare_checkout_init","local_device_gh_prepare_materialization"];function F(e){return V.some((r)=>r===e)}class ir extends Error{code;constructor(e){super(e);this.code=e}}function ti(e,r,i){let _=Pe.safeParse(e);return r==="failed"&&_.success&&_.data.kind==="prepare"&&_.data.diagnosticsVersion===1&&F(i)}var yt=245760,Mo=g("kind",[c({kind:n("pr_review_context"),body:t().max(yt)}),c({kind:n("prepare"),headSha:x}),c({kind:n("read"),status:o().int().min(200).max(599),headers:ee(t(),t().max(8192)).refine((e)=>Object.keys(e).every((r)=>r==="link"||r==="content-type")),body:t().max(yt)}),c({kind:n("publish"),headSha:x,scannedObjectCount:o().int().min(0).max(5000),attribution:G.optional()}),c({kind:n("pr_create"),url:t().max(1024).regex(/^https:\/\/github\.com\/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+\/pull\/[1-9][0-9]*$/)}),c({kind:n("pr_mutation"),number:E,applied:n(!0)}),c({kind:n("pr_merge"),number:E,merged:n(!0)})]).refine((e)=>new TextEncoder().encode(JSON.stringify(e)).byteLength<=yt,"local_device_gh_result_too_large"),B=c({source:s(["agent","human"]),operationId:k()}),oe=c({version:n(1),userId:St(),deviceId:St(),rootId:St(),runId:St(),merge:B.optional(),contributorRefresh:St().optional(),repoFullName:I.nullable(),rootRevision:t().regex(/^[1-9][0-9]*$/),readOnly:d(),generation:o().int().positive().nullable(),fenceId:St().nullable()}).refine((e)=>e.generation===null===(e.fenceId===null));function w(e){return/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(e)&&e.split("/").every((r)=>r!=="."&&r!=="..")}function $o(e,r,i={},_="read"){if(w(e)&&(r==="/search/issues"||r.startsWith("/search/issues?")))return J(e,r,i);if(!w(e)||!r.startsWith(`/repos/${e}/`)&&r!==`/repos/${e}`)throw Error("local_device_gh_repository_mismatch");if(/[\\#\u0000-\u001f]/.test(r)||/%(?:2e|5c|00)/i.test(r))throw Error("local_device_gh_path_denied");let R=new URL(r,"https://api.github.com");if(R.pathname!==r.split("?")[0]||R.username||R.password)throw Error("local_device_gh_path_denied");let h;try{h=decodeURIComponent(R.pathname.slice(`/repos/${e}`.length))}catch{throw Error("local_device_gh_path_denied")}if(h.includes("%")||h.split("/").some((p)=>p==="."||p===".."))throw Error("local_device_gh_path_denied");if((i.method??"GET").toUpperCase()!=="GET"||i.body!=null)throw Error("local_device_gh_mutation_not_admitted");if(![/^$/,/^\/commits$/,/^\/pulls$/,/^\/pulls\/[1-9][0-9]*(?:\/(?:commits|files|reviews|comments))?$/,/^\/issues\/[1-9][0-9]*(?:\/comments)?$/,/^\/issues\/comments\/[1-9][0-9]*\/reactions$/,/^\/commits\/[A-Za-z0-9_./-]+(?:\/(?:check-runs|status))?$/,/^\/check-runs\/[1-9][0-9]*(?:\/annotations)?$/,/^\/branches\/[A-Za-z0-9_./-]+$/,/^\/git\/ref\/heads\/[A-Za-z0-9_./-]+$/,/^\/compare\/[A-Za-z0-9_./-]+\.\.\.[A-Za-z0-9_./-]+$/].some((p)=>p.test(h)))throw Error("local_device_gh_path_denied");if(R.searchParams.forEach((p,b)=>{if(b==="per_page"&&/^[1-9][0-9]*$/.test(p)&&Number(p)<=100)return;if(b==="page"&&/^[1-9][0-9]*$/.test(p)&&Number(p)<=100)return;if(h==="/pulls"&&b==="state"&&["open","closed","all"].includes(p))return;if(h==="/pulls"&&b==="sort"&&p==="updated")return;if(h==="/pulls"&&b==="direction"&&p==="desc")return;if(h==="/pulls"&&["head","base"].includes(b)&&/^[A-Za-z0-9_./:-]{1,255}$/.test(p))return;throw Error("local_device_gh_query_denied")}),i.headers)new Headers(i.headers).forEach((b,j)=>{if(j!=="accept"||!["application/vnd.github+json","application/vnd.github.full+json","application/vnd.github.v3.diff"].includes(b))throw Error("local_device_gh_header_denied")})}function J(e,r,i){if(/[\\#\u0000-\u001f]/.test(r))throw Error("local_device_gh_path_denied");let _=new URL(r,"https://api.github.com");if(_.pathname!=="/search/issues"||_.username||_.password)throw Error("local_device_gh_path_denied");if((i.method??"GET").toUpperCase()!=="GET"||i.body!=null)throw Error("local_device_gh_mutation_not_admitted");let R=null;_.searchParams.forEach((f,p)=>{if(p==="q"&&R===null){R=f;return}if(p==="per_page"&&/^[1-9][0-9]*$/.test(f)&&Number(f)<=100)return;if(p==="page"&&/^[1-9][0-9]*$/.test(f)&&Number(f)<=100)return;throw Error("local_device_gh_query_denied")});let h=`repo:${e.toLowerCase()} `,S=R?.toLowerCase()??"";if(S.length>512||!(S+" ").startsWith(h)||/(?:^|\s)(?:repo|org|user):/.test(S.slice(h.length)))throw Error("local_device_gh_query_denied");if(i.headers)new Headers(i.headers).forEach((f,p)=>{if(p!=="accept"||f!=="application/vnd.github+json")throw Error("local_device_gh_header_denied")})}var Bo=`query PullRequestReviewContext($owner: String!, $repo: String!, $number: Int!, $after: String) {
|
|
3
3
|
repository(owner: $owner, name: $repo) {
|
|
4
4
|
nameWithOwner
|
|
5
5
|
pullRequest(number: $number) {
|
|
@@ -34,9 +34,9 @@ import{t,St,k,o,d,u,c,g,ee,s,n}from"./vm-hands-entry-lite-5agyspqp.js";var I=t()
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
}`;function et(e){return e.kind==="read"||e.kind==="pr_review_context"}var wt=["inspect_project","fs.read","fs.write","fs.search","fs.watch","fs.upload","fs.export","fs.import","fs.download","exec.run","exec.full","process.run.v1","process.full.v1","pty.start","pty.input","pty.resize","pty.close","git.run","process.list","process.signal","ports.list","tunnel.open","tunnel.close","env.discover","setup.run","mcp.discover","mcp.start","mcp.proxy","browser.snapshot","browser.navigate","browser.act","computer.snapshot","computer.act","computer.use","browser.use","browser.recording.v1","browser.pr-proof.v1","hands.connect","jobs.control","environment.install","github.local.v1","inference.ollama.v1","inference.custom.v1","delegate.devin.copy.v1","delegate.cursor.copy.v1","display.stream.v1","automation.call.v1","preview.serve.v1","workspace.setup.v1","simulator.call.v1","simulator.stream.v1"];var tt=2,N="/app/local-runtime",Te=262144,
|
|
37
|
+
}`;function et(e){return e.kind==="read"||e.kind==="pr_review_context"}var wt=["inspect_project","fs.read","fs.write","fs.search","fs.watch","fs.upload","fs.export","fs.import","fs.download","exec.run","exec.full","process.run.v1","process.full.v1","pty.start","pty.input","pty.resize","pty.close","git.run","process.list","process.signal","ports.list","tunnel.open","tunnel.close","env.discover","setup.run","mcp.discover","mcp.start","mcp.proxy","browser.snapshot","browser.navigate","browser.act","computer.snapshot","computer.act","computer.use","browser.use","browser.recording.v1","browser.pr-proof.v1","hands.connect","jobs.control","environment.install","github.local.v1","inference.ollama.v1","inference.custom.v1","delegate.devin.copy.v1","delegate.cursor.copy.v1","display.stream.v1","automation.call.v1","preview.serve.v1","workspace.setup.v1","simulator.call.v1","simulator.stream.v1"];var tt=2,N="/app/local-runtime",Te=262144,qs="x-reason-relay-host-alias",Ws="v1";function l(e,r){return{path:`${N}${e}`,routerPath:e,auth:r}}function O(e,r){return{...l(e,"device_proof"),forOperation(i){return l(`/operations/${encodeURIComponent(i)}${r}`,"device_proof")}}}var Vs={register:l("/register","registration_bearer"),enroll:l("/enroll","none"),authChallenge:l("/auth/challenge","none"),identity:l("/identity","device_proof"),heartbeat:l("/heartbeat","device_proof"),rootsSync:l("/roots/sync","device_proof"),disconnect:l("/disconnect","device_proof"),lifecycle:l("/lifecycle","device_proof"),localSubscription:l("/local-subscription","device_proof"),ownerWorkspaces:l("/owner-workspaces","device_proof"),ownerWorkspaceEnrollment:l("/owner-workspaces/enrollment","device_proof"),sessionWorktrees:l("/session-worktrees","device_proof"),operationClaim:l("/operations/claim","device_proof"),operationHeartbeat:O("/operations/:operationId/heartbeat","/heartbeat"),operationEvents:O("/operations/:operationId/events","/events"),operationComplete:O("/operations/:operationId/complete","/complete"),operationEnvironment:O("/operations/:operationId/environment","/environment"),operationEnvironmentAck:O("/operations/:operationId/environment-ack","/environment-ack"),operationCustomEndpointCredential:O("/operations/:operationId/custom-endpoint-credential","/custom-endpoint-credential")},ri=`${N}/session`;var W=[/^\/app\/local-runtime\/heartbeat$/,/^\/app\/local-runtime\/operations\/claim$/,/^\/app\/local-runtime\/operations\/[0-9a-fA-F-]{36}\/(?:heartbeat|events|complete|environment|environment-ack)$/];function Gs(e){return W.some((r)=>r.test(e))}var rn=60000;var ni="hands_control_v1",bt="environment.deliver",ii="vm_hands_workspace_deferred",oi="vm_hands.workspace_grant",si="hands.unbind_unverified",ai="claim_v1",ci="environment_at_claim",li="ready_v1",ui="workspace_check",di="rebind_v1",pi="resident_rebind",hi="hands.rebind",fi="snapshot_v1",mi="cloud_access",gi="playwright_v1",_i="headless_browser",yi="v1",wi="job_env_large_values",pe="srt_root_v1",Y="hands_confinement",Re="gid_v1",q="model_jobs_egress",bi="setpriv_v1",vi="jobs_user",Si="spawning_attempt_v1",Q="hands_session_group";var Ei="session_cap",xi="none",ki="same_launch_v1",Ci="exit_v1",Ai="start_wait",vt="user_chrome",Pi="cloud_sessions";function v(e){if(!a(e)||Object.keys(e).length!==5||e.version!==1)return!1;let r=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;return["boot_generation","recording_operation_id","recording_attempt_id"].every((i)=>typeof e[i]==="string"&&r.test(e[i]))&&typeof e.root_version==="string"&&/^[0-9]{1,20}(?:\.[0-9]{1,6})?$/.test(e.root_version)}function A(e){if(!a(e)||Object.keys(e).length!==6)return!1;let r=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;return typeof e.device_id==="string"&&r.test(e.device_id)&&(e.binding==="workspace_source"||e.binding==="mcp_control")&&Number.isSafeInteger(e.target_revision)&&Number(e.target_revision)>=0&&Number.isSafeInteger(e.root_grant_revision)&&Number(e.root_grant_revision)>0&&Number.isSafeInteger(e.target_generation)&&Number(e.target_generation)>0&&typeof e.target_fence_id==="string"&&r.test(e.target_fence_id)}var Ks=["lock_acquired","enrollment_started","enrollment_completed","readiness_started","readiness_completed","inventory_completed","control_ready"],or=86400000;var K=["production","staging"];function P(e){if(!a(e)||Object.keys(e).length!==3)return!1;let r=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;return["organization_id","user_id","device_id"].every((i)=>Object.hasOwn(e,i)&&typeof e[i]==="string"&&r.test(e[i])&&e[i]!=="00000000-0000-0000-0000-000000000000")}var Z="DEVICE-PROOF-V2";function Ti(e,r=Z){let i=e.method.toUpperCase();if(!/^[A-Z]+$/.test(i)||!e.pathAndQuery.startsWith(`${N}/`)||e.pathAndQuery.includes(`
|
|
38
38
|
`)||!/^[0-9]{1,20}$/.test(e.timestamp)||!/^[A-Za-z0-9_-]{22,43}$/.test(e.nonce)||e.challenge.length<16||e.challenge.length>1024||e.challenge.includes(`
|
|
39
39
|
`)||!/^[a-f0-9]{64}$/.test(e.bodySha256))throw Error("Invalid Reason Device proof input.");return Buffer.from([r,i,e.pathAndQuery,e.timestamp,e.nonce,e.challenge,e.bodySha256].join(`
|
|
40
|
-
`),"utf8")}function a(e){return Boolean(e)&&typeof e==="object"&&!Array.isArray(e)}function X(e,r){return typeof e==="string"&&r.some((i)=>i===e)}function H(e){return a(e)&&typeof e.id==="string"&&typeof e.label==="string"&&typeof e.path_fingerprint==="string"}function te(e){return a(e)&&Number.isInteger(e.seq)&&Number(e.seq)>=0&&typeof e.kind==="string"&&/^[A-Za-z0-9._:-]{1,64}$/.test(e.kind)&&a(e.payload)}function m(e){throw Error(e)}function
|
|
41
|
-
`)||typeof e.expires_at!=="string"||!Number.isFinite(Date.parse(e.expires_at)))m("Reason returned an invalid Device proof challenge.");return{challenge:e.challenge,expires_at:e.expires_at}}function M(e,r){if(!a(e)||typeof e.device_id!=="string"||e.auth_scheme!=="p256"||e.organization_id!==void 0&&typeof e.organization_id!=="string"||e.protocol_version!==tt||!Array.isArray(e.roots)||!e.roots.every(H)||r&&typeof e.organization_id!=="string"||e.device_credential!==void 0)m(r?"Reason returned an invalid Device enrollment.":"Reason returned an invalid Device registration.");return{...{device_id:e.device_id,...typeof e.organization_id==="string"?{organization_id:e.organization_id}:{},protocol_version:tt,roots:e.roots},auth_scheme:"p256"}}function
|
|
42
|
-
export{Pe,ir,ti,yt,Mo,oe,$o,Bo,et,wt,tt,Te,Ws,Vs,
|
|
40
|
+
`),"utf8")}function a(e){return Boolean(e)&&typeof e==="object"&&!Array.isArray(e)}function X(e,r){return typeof e==="string"&&r.some((i)=>i===e)}function H(e){return a(e)&&typeof e.id==="string"&&typeof e.label==="string"&&typeof e.path_fingerprint==="string"}function te(e){return a(e)&&Number.isInteger(e.seq)&&Number(e.seq)>=0&&typeof e.kind==="string"&&/^[A-Za-z0-9._:-]{1,64}$/.test(e.kind)&&a(e.payload)}function m(e){throw Error(e)}function Js(e,r){let i=a(e)?e:{},_=typeof i.error==="string"?i.error:`http_${r}`,R=typeof i.detail==="string"?i.detail:typeof i.message==="string"?i.message:`Reason Device request failed (${r})`;return{code:_,message:R}}function rs(e){if(!a(e)||typeof e.challenge!=="string"||e.challenge.length<16||e.challenge.length>1024||e.challenge.includes(`
|
|
41
|
+
`)||typeof e.expires_at!=="string"||!Number.isFinite(Date.parse(e.expires_at)))m("Reason returned an invalid Device proof challenge.");return{challenge:e.challenge,expires_at:e.expires_at}}function M(e,r){if(!a(e)||typeof e.device_id!=="string"||e.auth_scheme!=="p256"||e.organization_id!==void 0&&typeof e.organization_id!=="string"||e.protocol_version!==tt||!Array.isArray(e.roots)||!e.roots.every(H)||r&&typeof e.organization_id!=="string"||e.device_credential!==void 0)m(r?"Reason returned an invalid Device enrollment.":"Reason returned an invalid Device registration.");return{...{device_id:e.device_id,...typeof e.organization_id==="string"?{organization_id:e.organization_id}:{},protocol_version:tt,roots:e.roots},auth_scheme:"p256"}}function Zs(e){return M(e,!1)}function Xs(e){let r=M(e,!0);if(typeof r.organization_id!=="string")return m("Reason returned an invalid Device enrollment.");return{...r,organization_id:r.organization_id}}function Ys(e){if(!a(e)||typeof e.server_time!=="string"||typeof e.drain!=="boolean")return m("Reason returned an invalid Device heartbeat.");return{server_time:e.server_time,drain:e.drain,...U(e),...typeof e.update_policy==="string"||e.update_policy===null?{update_policy:e.update_policy}:{},...typeof e.supported_protocol_version==="number"?{supported_protocol_version:e.supported_protocol_version}:{},...re(e.latest_cli_versions),...e.hands_prespawn===!0?{hands_prespawn:!0}:{}}}var ne=["account_root_metadata_supported","workspace_root_metadata_supported","account_root_path_supported","home_contained_roots_supported","root_paths_supported","startup_supported"];function U(e){return Object.fromEntries(ne.filter((r)=>e[r]===!0).map((r)=>[r,!0]))}function Qs(e){if(!a(e))return;try{return{...rs(e),...U(e)}}catch{return}}function re(e){if(!a(e))return{};let r={};for(let i of K){let _=e[i];if(typeof _==="string"&&/^(0|[1-9][0-9]{0,5})\.(0|[1-9][0-9]{0,5})\.(0|[1-9][0-9]{0,5})$/.test(_))r[i]=_}return Object.keys(r).length>0?{latest_cli_versions:r}:{}}function ea(e){if(!a(e)||!Array.isArray(e.roots)||!e.roots.every(H))return m("Reason returned an invalid Device root sync.");return{roots:e.roots}}function ta(e){if(!a(e)||e.user_id!==void 0&&typeof e.user_id!=="string"||typeof e.organization_id!=="string"||typeof e.organization_name!=="string"||typeof e.organization_slug!=="string")return m("Reason returned an invalid Device identity.");return{...typeof e.user_id==="string"?{user_id:e.user_id}:{},organization_id:e.organization_id,organization_name:e.organization_name,organization_slug:e.organization_slug}}function ra(e){if(!a(e)||e.disconnected!==!0)return m("Reason did not disconnect this Device.");let r=e.sessions_moved;return typeof r==="number"&&Number.isSafeInteger(r)&&r>=0?{disconnected:!0,sessions_moved:r}:{disconnected:!0}}function na(e){if(a(e)&&e.ok===!0&&typeof e.expires==="number")return{ok:!0,expires:e.expires};if(a(e)&&e.ok===!1&&typeof e.error==="string")return{ok:!1,error:e.error};return m("Reason did not answer the local login hand-over.")}function ia(e){if(!a(e)||e.accepted!==!0)return m("Reason did not accept the Device lifecycle event.");return{accepted:!0}}function ie(e){return Buffer.byteLength(JSON.stringify(e),"utf8")}function oa(e,r=wt){if(!a(e)||typeof e.operation_id!=="string"||typeof e.attempt_id!=="string"||typeof e.attempt_token!=="string"||!/^(?:reason|ara)_attempt_/.test(e.attempt_token)||typeof e.lease_until!=="string"||typeof e.run_id!=="string"||typeof e.root_id!=="string"||e.owner!==void 0&&!P(e.owner)||!X(e.capability,r)||!a(e.payload)||e.protocol_version!==tt||ie(e.payload)>Te||e.authority!==void 0&&!A(e.authority)||e.local_github_authority!==void 0&&!oe.safeParse(e.local_github_authority).success||e.capability==="github.local.v1"&&!oe.safeParse(e.local_github_authority).success||e.recording_authority!==void 0&&!v(e.recording_authority)||e.capability==="browser.recording.v1"&&(!v(e.recording_authority)||!P(e.owner))||e.capability!=="browser.recording.v1"&&e.recording_authority!==void 0)return m("Reason returned an invalid Device operation claim.");let i={operation_id:e.operation_id,attempt_id:e.attempt_id,attempt_token:e.attempt_token,lease_until:e.lease_until,run_id:e.run_id,root_id:e.root_id,capability:e.capability,payload:e.payload,...A(e.authority)?{authority:e.authority}:{},...v(e.recording_authority)?{recording_authority:Object.freeze({...e.recording_authority})}:{},...e.local_github_authority!==void 0?{local_github_authority:oe.parse(e.local_github_authority)}:{},...e.capability==="hands.connect"&&a(e.environment)&&a(e.environment.payload)&&A(e.environment.authority)?{environment:{payload:e.environment.payload,authority:e.environment.authority}}:{},protocol_version:tt};if(e.owner!==void 0)i.owner=Object.freeze({...e.owner});return i}function sa(e){if(!a(e)||typeof e.lease_until!=="string"||!Array.isArray(e.controls)||!e.controls.every(te)||!Number.isInteger(e.next_control_seq)||Number(e.next_control_seq)<0)return m("Reason returned an invalid Device operation heartbeat.");return{lease_until:e.lease_until,controls:e.controls,next_control_seq:Number(e.next_control_seq)}}function aa(e){if(!a(e)||!Number.isInteger(e.next_event_seq)||Number(e.next_event_seq)<0||typeof e.duplicate!=="boolean"||!Number.isInteger(e.accepted_count)||Number(e.accepted_count)<0)return m("Reason returned an invalid Device operation event result.");return{next_event_seq:Number(e.next_event_seq),duplicate:e.duplicate,accepted_count:Number(e.accepted_count)}}function ca(e){if(!a(e)||!a(e.payload)||!A(e.authority))return m("Reason returned an invalid Device environment delivery.");return{payload:e.payload,authority:e.authority}}function ae(e){return e==="succeeded"||e==="failed"||e==="cancelled"||e==="expired"}function la(e){if(!a(e)||!ae(e.status)||typeof e.idempotent!=="boolean")return m("Reason returned an invalid Device operation completion.");return{status:e.status,idempotent:e.idempotent}}
|
|
42
|
+
export{Pe,ir,ti,yt,Mo,oe,$o,Bo,et,wt,tt,Te,qs,Ws,Vs,ri,Gs,rn,ni,bt,ii,oi,si,ai,ci,li,ui,di,pi,hi,fi,mi,gi,_i,yi,wi,pe,Y,Re,q,bi,vi,Si,Q,Ei,xi,ki,Ci,Ai,vt,Pi,Ks,or,Ti,Js,rs,Zs,Xs,Ys,Qs,ea,ta,ra,na,ia,oa,sa,aa,ca,la};
|