@reason-machines/cli-linux-arm64-musl 0.2.314 → 0.2.316

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 (64) hide show
  1. package/bin/ara +2 -2
  2. package/bin/vm-hands/connect-cli-yr3p9qnz.js +2 -0
  3. package/bin/vm-hands/custom-endpoint-device-wzq9x8k5.js +2 -0
  4. package/bin/vm-hands/desktop-account-e9asw4vf.js +2 -0
  5. package/bin/vm-hands/{device-workspace-ecq3hfd6.js → device-workspace-1dm2ry6e.js} +1 -1
  6. package/bin/vm-hands/{hands-worker-source-w477y8ad.js → hands-worker-source-snbsr08g.js} +1 -1
  7. package/bin/vm-hands/{index-nxzv9qe7.js → index-p6kg955p.js} +1 -1
  8. package/bin/vm-hands/local-automation-2ympxn36.js +2 -0
  9. package/bin/vm-hands/local-capabilities-1zdjwqw6.js +2 -0
  10. package/bin/vm-hands/local-desktop-users-j09q8cnt.js +2 -0
  11. package/bin/vm-hands/local-display-mac-mjjems8c.js +2 -0
  12. package/bin/vm-hands/local-display-session-pyd8a5jn.js +2 -0
  13. package/bin/vm-hands/{network-contract-ggqak7gp.js → network-contract-kxgvk10y.js} +1 -1
  14. package/bin/vm-hands/package-28msp113.js +2 -0
  15. package/bin/vm-hands/permissions-sbhn2tza.js +2 -0
  16. package/bin/vm-hands/{reason-hands-protocol-as5477xr.js → reason-hands-protocol-7t7mewye.js} +1 -1
  17. package/bin/vm-hands/{status-gp9kxbq1.js → status-pp648fb9.js} +2 -2
  18. package/bin/vm-hands/version-vv364wfx.js +2 -0
  19. package/bin/vm-hands/{vm-hands-entry-lite-wgx7z7gt.js → vm-hands-entry-lite-14t846kp.js} +2 -2
  20. package/bin/vm-hands/{vm-hands-entry-lite-6j2yaa4n.js → vm-hands-entry-lite-22jgncrd.js} +2 -2
  21. package/bin/vm-hands/{vm-hands-entry-lite-ksd4969g.js → vm-hands-entry-lite-36ey39qm.js} +2 -2
  22. package/bin/vm-hands/vm-hands-entry-lite-3rx6cm14.js +3 -0
  23. package/bin/vm-hands/{vm-hands-entry-lite-hzkc742v.js → vm-hands-entry-lite-460d1y2d.js} +23 -23
  24. package/bin/vm-hands/{vm-hands-entry-lite-11qqexwe.js → vm-hands-entry-lite-7ve198cs.js} +1 -1
  25. package/bin/vm-hands/{vm-hands-entry-lite-3tp9yvsn.js → vm-hands-entry-lite-8759hszg.js} +2 -2
  26. package/bin/vm-hands/{vm-hands-entry-lite-ya1a2eep.js → vm-hands-entry-lite-93ejmwqn.js} +1 -1
  27. package/bin/vm-hands/{vm-hands-entry-lite-hmff1sqa.js → vm-hands-entry-lite-a8r490bb.js} +2 -2
  28. package/bin/vm-hands/{vm-hands-entry-lite-em388nee.js → vm-hands-entry-lite-cp1wqjs5.js} +2 -2
  29. package/bin/vm-hands/{vm-hands-entry-lite-njt12v46.js → vm-hands-entry-lite-gmhdbe8v.js} +77 -77
  30. package/bin/vm-hands/{vm-hands-entry-lite-q6fshf3h.js → vm-hands-entry-lite-kqn1bkrr.js} +2 -2
  31. package/bin/vm-hands/{vm-hands-entry-lite-7k65s010.js → vm-hands-entry-lite-mzxhng4z.js} +2 -2
  32. package/bin/vm-hands/vm-hands-entry-lite-n4xx6qfr.js +42 -0
  33. package/bin/vm-hands/{vm-hands-entry-lite-yp315y25.js → vm-hands-entry-lite-ne8kkvk4.js} +1 -1
  34. package/bin/vm-hands/{vm-hands-entry-lite-rrk5g62b.js → vm-hands-entry-lite-q8b738zj.js} +1 -1
  35. package/bin/vm-hands/{vm-hands-entry-lite-hf0mk7vd.js → vm-hands-entry-lite-t3gpbwqp.js} +1 -1
  36. package/bin/vm-hands/{vm-hands-entry-lite-21qkhpm0.js → vm-hands-entry-lite-t9kc2r71.js} +1 -1
  37. package/bin/vm-hands/vm-hands-entry-lite-tdpqhm9j.js +529 -0
  38. package/bin/vm-hands/{vm-hands-entry-lite-xsq25kmd.js → vm-hands-entry-lite-v6tkjqb1.js} +1 -1
  39. package/bin/vm-hands/{vm-hands-entry-lite-qssnr12b.js → vm-hands-entry-lite-vy57b2t2.js} +3 -3
  40. package/bin/vm-hands/{vm-hands-entry-lite-pf1ft65e.js → vm-hands-entry-lite-wh0qp1gf.js} +2 -2
  41. package/bin/vm-hands/{vm-hands-entry-lite-bswnp5ve.js → vm-hands-entry-lite-xf6schkk.js} +1 -1
  42. package/bin/vm-hands/{vm-hands-entry-lite-q2pb31vh.js → vm-hands-entry-lite-yhz6sv35.js} +2 -2
  43. package/bin/vm-hands/{vm-hands-entry-lite-fws38v57.js → vm-hands-entry-lite-yxbbkre7.js} +2 -2
  44. package/bin/vm-hands/vm-hands-entry-lite.js +1 -1
  45. package/bin/vm-hands/{vm-hands-executor-rzz9q5jj.js → vm-hands-executor-9kr30sec.js} +1 -1
  46. package/bin/vm-hands/{vm-hands-op-runner-mwmgvdh0.js → vm-hands-op-runner-hxh21vsh.js} +1 -1
  47. package/bin/vm-hands/{vm-hands-runtime-rkpxmsd0.js → vm-hands-runtime-42gvm2xs.js} +3 -3
  48. package/bin/vm-hands/worker-sandbox-7zfttr2t.js +2 -0
  49. package/package.json +1 -1
  50. package/bin/vm-hands/connect-cli-edkrs4p6.js +0 -2
  51. package/bin/vm-hands/custom-endpoint-device-p2bvtf6p.js +0 -2
  52. package/bin/vm-hands/desktop-account-axaenf68.js +0 -2
  53. package/bin/vm-hands/local-automation-3tg97fb8.js +0 -2
  54. package/bin/vm-hands/local-capabilities-rb17efqw.js +0 -2
  55. package/bin/vm-hands/local-desktop-users-4756c92y.js +0 -2
  56. package/bin/vm-hands/local-display-mac-3zz66vzn.js +0 -2
  57. package/bin/vm-hands/local-display-session-4jnfvpv1.js +0 -2
  58. package/bin/vm-hands/package-s6y0j1as.js +0 -2
  59. package/bin/vm-hands/permissions-5kqh2dqz.js +0 -2
  60. package/bin/vm-hands/version-jp149s8j.js +0 -2
  61. package/bin/vm-hands/vm-hands-entry-lite-0ergg2ky.js +0 -3
  62. package/bin/vm-hands/vm-hands-entry-lite-8st97h7b.js +0 -42
  63. package/bin/vm-hands/vm-hands-entry-lite-abfcsza2.js +0 -529
  64. package/bin/vm-hands/worker-sandbox-snmfpfax.js +0 -2
@@ -1,42 +0,0 @@
1
- // @bun
2
- import{ae as W}from"./vm-hands-entry-lite-q6fshf3h.js";var T=W.string().max(201).regex(/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/).refine((Q)=>Q.split("/").every((Z)=>Z!=="."&&Z!=="..")),G=W.string().min(1).max(255).regex(/^[A-Za-z0-9_][A-Za-z0-9_./-]*$/).refine((Q)=>!Q.includes("..")&&!Q.includes("//")&&!Q.endsWith("/")&&!Q.endsWith(".lock")),g=W.string().regex(/^[a-f0-9]{40}$/),N=W.number().int().positive(),C=W.string().min(1).max(256),A=W.string().max(60000),q={version:W.literal(1),repoFullName:T},c=W.discriminatedUnion("action",[W.strictObject({action:W.literal("edit"),title:C.optional(),body:A.optional(),base:G.optional()}),W.strictObject({action:W.enum(["ready","draft","close"])}),W.strictObject({action:W.literal("metadata"),field:W.enum(["reviewer","assignee","label"]),change:W.enum(["add","remove"]),value:W.string().min(1).max(100).refine((Q)=>!/[\r\n\0]/.test(Q))})]),l=W.discriminatedUnion("kind",[W.strictObject({...q,kind:W.literal("read"),path:W.string().min(1).max(2048),accept:W.enum(["application/vnd.github+json","application/vnd.github.full+json","application/vnd.github.v3.diff"]).optional()}),W.strictObject({...q,kind:W.literal("pr_review_context"),number:N,after:W.string().min(1).max(1024).optional()}),W.strictObject({...q,kind:W.literal("prepare"),branch:G,baseSha:g,defaultBranch:G}),W.strictObject({...q,kind:W.literal("publish"),branch:G,defaultBranch:G,baseSha:g,remoteHeadSha:g.nullable()}),W.strictObject({...q,kind:W.literal("pr_create"),head:G,base:G,title:C,body:A,draft:W.boolean()}),W.strictObject({...q,kind:W.literal("pr_mutation"),number:N,mutation:c}),W.strictObject({...q,kind:W.literal("pr_merge"),number:N,expectedHeadSha:g,expectedBaseRef:G,method:W.enum(["merge","squash","rebase"])})]),I=245760,u=W.discriminatedUnion("kind",[W.strictObject({kind:W.literal("pr_review_context"),body:W.string().max(I)}),W.strictObject({kind:W.literal("prepare"),headSha:g}),W.strictObject({kind:W.literal("read"),status:W.number().int().min(200).max(599),headers:W.record(W.string(),W.string().max(8192)).refine((Q)=>Object.keys(Q).every((Z)=>Z==="link"||Z==="content-type")),body:W.string().max(I)}),W.strictObject({kind:W.literal("publish"),headSha:g,scannedObjectCount:W.number().int().min(0).max(5000)}),W.strictObject({kind:W.literal("pr_create"),url:W.string().max(1024).regex(/^https:\/\/github\.com\/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+\/pull\/[1-9][0-9]*$/)}),W.strictObject({kind:W.literal("pr_mutation"),number:N,applied:W.literal(!0)}),W.strictObject({kind:W.literal("pr_merge"),number:N,merged:W.literal(!0)})]).refine((Q)=>new TextEncoder().encode(JSON.stringify(Q)).byteLength<=I,"local_device_gh_result_too_large"),y=W.strictObject({source:W.enum(["agent","human"]),operationId:W.uuid()}),j=W.strictObject({version:W.literal(1),userId:W.guid(),deviceId:W.guid(),rootId:W.guid(),runId:W.guid(),merge:y.optional(),repoFullName:T.nullable(),rootRevision:W.string().regex(/^[1-9][0-9]*$/),readOnly:W.boolean(),generation:W.number().int().positive().nullable(),fenceId:W.guid().nullable()}).refine((Q)=>Q.generation===null===(Q.fenceId===null));function P(Q){return/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(Q)&&Q.split("/").every((Z)=>Z!=="."&&Z!=="..")}function a(Q,Z,$={},H="read"){if(P(Q)&&(Z==="/search/issues"||Z.startsWith("/search/issues?")))return d(Q,Z,$);if(!P(Q)||!Z.startsWith(`/repos/${Q}/`)&&Z!==`/repos/${Q}`)throw Error("local_device_gh_repository_mismatch");if(/[\\#\u0000-\u001f]/.test(Z)||/%(?:2e|5c|00)/i.test(Z))throw Error("local_device_gh_path_denied");let V=new URL(Z,"https://api.github.com");if(V.pathname!==Z.split("?")[0]||V.username||V.password)throw Error("local_device_gh_path_denied");let Y;try{Y=decodeURIComponent(V.pathname.slice(`/repos/${Q}`.length))}catch{throw Error("local_device_gh_path_denied")}if(Y.includes("%")||Y.split("/").some((K)=>K==="."||K===".."))throw Error("local_device_gh_path_denied");if(($.method??"GET").toUpperCase()!=="GET"||$.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((K)=>K.test(Y)))throw Error("local_device_gh_path_denied");if(V.searchParams.forEach((K,B)=>{if(B==="per_page"&&/^[1-9][0-9]*$/.test(K)&&Number(K)<=100)return;if(B==="page"&&/^[1-9][0-9]*$/.test(K)&&Number(K)<=100)return;if(Y==="/pulls"&&B==="state"&&["open","closed","all"].includes(K))return;if(Y==="/pulls"&&B==="sort"&&K==="updated")return;if(Y==="/pulls"&&B==="direction"&&K==="desc")return;if(Y==="/pulls"&&["head","base"].includes(B)&&/^[A-Za-z0-9_./:-]{1,255}$/.test(K))return;throw Error("local_device_gh_query_denied")}),$.headers)new Headers($.headers).forEach((B,b)=>{if(b!=="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 d(Q,Z,$){if(/[\\#\u0000-\u001f]/.test(Z))throw Error("local_device_gh_path_denied");let H=new URL(Z,"https://api.github.com");if(H.pathname!=="/search/issues"||H.username||H.password)throw Error("local_device_gh_path_denied");if(($.method??"GET").toUpperCase()!=="GET"||$.body!=null)throw Error("local_device_gh_mutation_not_admitted");let V=null;H.searchParams.forEach((X,K)=>{if(K==="q"&&V===null){V=X;return}if(K==="per_page"&&/^[1-9][0-9]*$/.test(X)&&Number(X)<=100)return;if(K==="page"&&/^[1-9][0-9]*$/.test(X)&&Number(X)<=100)return;throw Error("local_device_gh_query_denied")});let Y=`repo:${Q.toLowerCase()} `,U=V?.toLowerCase()??"";if(U.length>512||!(U+" ").startsWith(Y)||/(?:^|\s)(?:repo|org|user):/.test(U.slice(Y.length)))throw Error("local_device_gh_query_denied");if($.headers)new Headers($.headers).forEach((X,K)=>{if(K!=="accept"||X!=="application/vnd.github+json")throw Error("local_device_gh_header_denied")})}var e=`query PullRequestReviewContext($owner: String!, $repo: String!, $number: Int!, $after: String) {
3
- repository(owner: $owner, name: $repo) {
4
- nameWithOwner
5
- pullRequest(number: $number) {
6
- number
7
- reviewDecision
8
- headRefOid
9
- baseRefOid
10
- baseRef {
11
- branchProtectionRule {
12
- requiresApprovingReviews
13
- requiredApprovingReviewCount
14
- requiresStatusChecks
15
- requiredStatusCheckContexts
16
- requiresConversationResolution
17
- dismissesStaleReviews
18
- }
19
- }
20
- reviewThreads(first: 100, after: $after) {
21
- nodes {
22
- id isResolved isOutdated viewerCanResolve viewerCanUnresolve
23
- path line originalLine startLine originalStartLine diffSide startDiffSide
24
- comments(first: 100) {
25
- nodes {
26
- id databaseId body createdAt updatedAt url
27
- author { __typename login }
28
- replyTo { databaseId }
29
- }
30
- pageInfo { hasNextPage }
31
- }
32
- }
33
- pageInfo { hasNextPage endCursor }
34
- }
35
- }
36
- }
37
- }`;function QQ(Q){return Q.kind==="read"||Q.kind==="pr_review_context"}var E=["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 x=2,m="/app/local-runtime",O=262144,KQ="x-reason-relay-host-alias",FQ="v1";function F(Q,Z){return{path:`${m}${Q}`,routerPath:Q,auth:Z}}function M(Q,Z){return{...F(Q,"device_proof"),forOperation($){return F(`/operations/${encodeURIComponent($)}${Z}`,"device_proof")}}}var wQ={register:F("/register","registration_bearer"),enroll:F("/enroll","none"),authChallenge:F("/auth/challenge","none"),identity:F("/identity","device_proof"),heartbeat:F("/heartbeat","device_proof"),rootsSync:F("/roots/sync","device_proof"),disconnect:F("/disconnect","device_proof"),lifecycle:F("/lifecycle","device_proof"),localSubscription:F("/local-subscription","device_proof"),ownerWorkspaces:F("/owner-workspaces","device_proof"),ownerWorkspaceEnrollment:F("/owner-workspaces/enrollment","device_proof"),sessionWorktrees:F("/session-worktrees","device_proof"),operationClaim:F("/operations/claim","device_proof"),operationHeartbeat:M("/operations/:operationId/heartbeat","/heartbeat"),operationEvents:M("/operations/:operationId/events","/events"),operationComplete:M("/operations/:operationId/complete","/complete"),operationEnvironment:M("/operations/:operationId/environment","/environment"),operationEnvironmentAck:M("/operations/:operationId/environment-ack","/environment-ack"),operationCustomEndpointCredential:M("/operations/:operationId/custom-endpoint-credential","/custom-endpoint-credential")},HQ=`${m}/session`,VQ=4096,YQ=5000,z=[/^\/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 XQ(Q){return z.some((Z)=>Z.test(Q))}var BQ="vm_hands_v1",GQ=60000,qQ={unauthenticated:4401,unavailable:4404,overloaded:4429,serviceRestart:1012},gQ="hands_control_v1",MQ="environment.deliver",NQ="claim_v1",UQ="environment_at_claim",jQ="rebind_v1",JQ="resident_rebind",xQ="hands.rebind",IQ="snapshot_v1",SQ="cloud_access",mQ="playwright_v1",PQ="headless_browser",TQ="v1",CQ="job_env_large_values",AQ="srt_root_v1",EQ="hands_confinement",kQ="gid_v1",LQ="model_jobs_egress",_Q="setpriv_v1",fQ="jobs_user",bQ="spawning_attempt_v1",cQ="hands_session_group",yQ="same_launch_v1",dQ="exit_v1",OQ="start_wait",zQ="user_chrome",RQ="cloud_sessions";function S(Q){if(!D(Q)||Object.keys(Q).length!==5||Q.version!==1)return!1;let Z=/^[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(($)=>typeof Q[$]==="string"&&Z.test(Q[$]))&&typeof Q.root_version==="string"&&/^[0-9]{1,20}(?:\.[0-9]{1,6})?$/.test(Q.root_version)}function J(Q){if(!D(Q)||Object.keys(Q).length!==6)return!1;let Z=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;return typeof Q.device_id==="string"&&Z.test(Q.device_id)&&(Q.binding==="workspace_source"||Q.binding==="mcp_control")&&Number.isSafeInteger(Q.target_revision)&&Number(Q.target_revision)>=0&&Number.isSafeInteger(Q.root_grant_revision)&&Number(Q.root_grant_revision)>0&&Number.isSafeInteger(Q.target_generation)&&Number(Q.target_generation)>0&&typeof Q.target_fence_id==="string"&&Z.test(Q.target_fence_id)}var hQ=86400000,pQ=["service.install_started","service.install_completed","service.install_failed","service.launcher_adopted","service.launcher_conflict","service.started","service.reconnecting","service.reconnected","service.idle_sleep_held","service.idle_sleep_released","service.idle_sleep_failed","service.start_failed","service.stopped","service.exit_failed","service.singleton_rejected","credential.migration_started","credential.migration_completed","credential.migration_failed","credential.store_started","credential.store_completed","credential.store_failed","credential.delete_started","credential.delete_completed","credential.delete_failed","update.check_started","update.not_available","update.download_started","update.downloaded","update.verified","update.activated","update.rollback","update.failed","executor.update.check_started","executor.update.not_available","executor.update.download_started","executor.update.downloaded","executor.update.verified","executor.update.activated","executor.update.rollback","executor.update.failed","identity.refresh_completed","identity.refresh_failed","update.device_moved","update.components_installed","update.deferred","update.deferral_expired","worker.previous_exit","worker.capabilities_withheld","identity.computer_use_unavailable"],R=["production","staging"];function k(Q){if(!D(Q)||Object.keys(Q).length!==3)return!1;let Z=/^[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(($)=>Object.hasOwn(Q,$)&&typeof Q[$]==="string"&&Z.test(Q[$])&&Q[$]!=="00000000-0000-0000-0000-000000000000")}var h="DEVICE-PROOF-V2",rQ="ARA-DEVICE-V1";function nQ(Q,Z=h){let $=Q.method.toUpperCase();if(!/^[A-Z]+$/.test($)||!Q.pathAndQuery.startsWith(`${m}/`)||Q.pathAndQuery.includes(`
38
- `)||!/^[0-9]{1,20}$/.test(Q.timestamp)||!/^[A-Za-z0-9_-]{22,43}$/.test(Q.nonce)||Q.challenge.length<16||Q.challenge.length>1024||Q.challenge.includes(`
39
- `)||!/^[a-f0-9]{64}$/.test(Q.bodySha256))throw Error("Invalid Reason Device proof input.");return Buffer.from([Z,$,Q.pathAndQuery,Q.timestamp,Q.nonce,Q.challenge,Q.bodySha256].join(`
40
- `),"utf8")}function D(Q){return Boolean(Q)&&typeof Q==="object"&&!Array.isArray(Q)}function p(Q,Z){return typeof Q==="string"&&Z.some(($)=>$===Q)}function L(Q){return D(Q)&&typeof Q.id==="string"&&typeof Q.label==="string"&&typeof Q.path_fingerprint==="string"}function r(Q){return D(Q)&&Number.isInteger(Q.seq)&&Number(Q.seq)>=0&&typeof Q.kind==="string"&&/^[A-Za-z0-9._:-]{1,64}$/.test(Q.kind)&&D(Q.payload)}function w(Q){throw Error(Q)}function sQ(Q,Z){let $=D(Q)?Q:{},H=typeof $.error==="string"?$.error:`http_${Z}`,V=typeof $.detail==="string"?$.detail:typeof $.message==="string"?$.message:`Reason Device request failed (${Z})`;return{code:H,message:V}}function n(Q){if(!D(Q)||typeof Q.challenge!=="string"||Q.challenge.length<16||Q.challenge.length>1024||Q.challenge.includes(`
41
- `)||typeof Q.expires_at!=="string"||!Number.isFinite(Date.parse(Q.expires_at)))w("Reason returned an invalid Device proof challenge.");return{challenge:Q.challenge,expires_at:Q.expires_at}}function _(Q,Z){if(!D(Q)||typeof Q.device_id!=="string"||Q.auth_scheme!=="p256"||Q.organization_id!==void 0&&typeof Q.organization_id!=="string"||Q.protocol_version!==x||!Array.isArray(Q.roots)||!Q.roots.every(L)||Z&&typeof Q.organization_id!=="string"||Q.device_credential!==void 0)w(Z?"Reason returned an invalid Device enrollment.":"Reason returned an invalid Device registration.");return{...{device_id:Q.device_id,...typeof Q.organization_id==="string"?{organization_id:Q.organization_id}:{},protocol_version:x,roots:Q.roots},auth_scheme:"p256"}}function oQ(Q){return _(Q,!1)}function iQ(Q){let Z=_(Q,!0);if(typeof Z.organization_id!=="string")return w("Reason returned an invalid Device enrollment.");return{...Z,organization_id:Z.organization_id}}function tQ(Q){if(!D(Q)||typeof Q.server_time!=="string"||typeof Q.drain!=="boolean")return w("Reason returned an invalid Device heartbeat.");return{server_time:Q.server_time,drain:Q.drain,...f(Q),...typeof Q.update_policy==="string"||Q.update_policy===null?{update_policy:Q.update_policy}:{},...typeof Q.supported_protocol_version==="number"?{supported_protocol_version:Q.supported_protocol_version}:{},...o(Q.latest_cli_versions),...Q.hands_prespawn===!0?{hands_prespawn:!0}:{}}}var s=["account_root_metadata_supported","workspace_root_metadata_supported","account_root_path_supported","home_contained_roots_supported","root_paths_supported","startup_supported"];function f(Q){return Object.fromEntries(s.filter((Z)=>Q[Z]===!0).map((Z)=>[Z,!0]))}function vQ(Q){if(!D(Q))return;try{return{...n(Q),...f(Q)}}catch{return}}function o(Q){if(!D(Q))return{};let Z={};for(let $ of R){let H=Q[$];if(typeof H==="string"&&/^(0|[1-9][0-9]{0,5})\.(0|[1-9][0-9]{0,5})\.(0|[1-9][0-9]{0,5})$/.test(H))Z[$]=H}return Object.keys(Z).length>0?{latest_cli_versions:Z}:{}}function lQ(Q){if(!D(Q)||!Array.isArray(Q.roots)||!Q.roots.every(L))return w("Reason returned an invalid Device root sync.");return{roots:Q.roots}}function uQ(Q){if(!D(Q)||Q.user_id!==void 0&&typeof Q.user_id!=="string"||typeof Q.organization_id!=="string"||typeof Q.organization_name!=="string"||typeof Q.organization_slug!=="string")return w("Reason returned an invalid Device identity.");return{...typeof Q.user_id==="string"?{user_id:Q.user_id}:{},organization_id:Q.organization_id,organization_name:Q.organization_name,organization_slug:Q.organization_slug}}function aQ(Q){if(!D(Q)||Q.disconnected!==!0)return w("Reason did not disconnect this Device.");let Z=Q.sessions_moved;return typeof Z==="number"&&Number.isSafeInteger(Z)&&Z>=0?{disconnected:!0,sessions_moved:Z}:{disconnected:!0}}function eQ(Q){if(D(Q)&&Q.ok===!0&&typeof Q.expires==="number")return{ok:!0,expires:Q.expires};if(D(Q)&&Q.ok===!1&&typeof Q.error==="string")return{ok:!1,error:Q.error};return w("Reason did not answer the local login hand-over.")}function QW(Q){if(!D(Q)||Q.accepted!==!0)return w("Reason did not accept the Device lifecycle event.");return{accepted:!0}}function i(Q){return Buffer.byteLength(JSON.stringify(Q),"utf8")}function WW(Q,Z=E){if(!D(Q)||typeof Q.operation_id!=="string"||typeof Q.attempt_id!=="string"||typeof Q.attempt_token!=="string"||!/^(?:reason|ara)_attempt_/.test(Q.attempt_token)||typeof Q.lease_until!=="string"||typeof Q.run_id!=="string"||typeof Q.root_id!=="string"||Q.owner!==void 0&&!k(Q.owner)||!p(Q.capability,Z)||!D(Q.payload)||Q.protocol_version!==x||i(Q.payload)>O||Q.authority!==void 0&&!J(Q.authority)||Q.local_github_authority!==void 0&&!j.safeParse(Q.local_github_authority).success||Q.capability==="github.local.v1"&&!j.safeParse(Q.local_github_authority).success||Q.recording_authority!==void 0&&!S(Q.recording_authority)||Q.capability==="browser.recording.v1"&&(!S(Q.recording_authority)||!k(Q.owner))||Q.capability!=="browser.recording.v1"&&Q.recording_authority!==void 0)return w("Reason returned an invalid Device operation claim.");let $={operation_id:Q.operation_id,attempt_id:Q.attempt_id,attempt_token:Q.attempt_token,lease_until:Q.lease_until,run_id:Q.run_id,root_id:Q.root_id,capability:Q.capability,payload:Q.payload,...J(Q.authority)?{authority:Q.authority}:{},...S(Q.recording_authority)?{recording_authority:Object.freeze({...Q.recording_authority})}:{},...Q.local_github_authority!==void 0?{local_github_authority:j.parse(Q.local_github_authority)}:{},...Q.capability==="hands.connect"&&D(Q.environment)&&D(Q.environment.payload)&&J(Q.environment.authority)?{environment:{payload:Q.environment.payload,authority:Q.environment.authority}}:{},protocol_version:x};if(Q.owner!==void 0)$.owner=Object.freeze({...Q.owner});return $}function ZW(Q){if(!D(Q)||typeof Q.lease_until!=="string"||!Array.isArray(Q.controls)||!Q.controls.every(r)||!Number.isInteger(Q.next_control_seq)||Number(Q.next_control_seq)<0)return w("Reason returned an invalid Device operation heartbeat.");return{lease_until:Q.lease_until,controls:Q.controls,next_control_seq:Number(Q.next_control_seq)}}function $W(Q){if(!D(Q)||!Number.isInteger(Q.next_event_seq)||Number(Q.next_event_seq)<0||typeof Q.duplicate!=="boolean"||!Number.isInteger(Q.accepted_count)||Number(Q.accepted_count)<0)return w("Reason returned an invalid Device operation event result.");return{next_event_seq:Number(Q.next_event_seq),duplicate:Q.duplicate,accepted_count:Number(Q.accepted_count)}}function DW(Q){if(!D(Q)||!D(Q.payload)||!J(Q.authority))return w("Reason returned an invalid Device environment delivery.");return{payload:Q.payload,authority:Q.authority}}function t(Q){return Q==="succeeded"||Q==="failed"||Q==="cancelled"||Q==="expired"}function KW(Q){if(!D(Q)||!t(Q.status)||typeof Q.idempotent!=="boolean")return w("Reason returned an invalid Device operation completion.");return{status:Q.status,idempotent:Q.idempotent}}
42
- export{l as Oc,I as Pc,u as Qc,j as Rc,a as Sc,e as Tc,QQ as Uc,E as Vc,x as Wc,m as Xc,O as Yc,KQ as Zc,FQ as _c,wQ as $c,HQ as ad,VQ as bd,YQ as cd,XQ as dd,BQ as ed,GQ as fd,qQ as gd,gQ as hd,MQ as id,NQ as jd,UQ as kd,jQ as ld,JQ as md,xQ as nd,IQ as od,SQ as pd,mQ as qd,PQ as rd,TQ as sd,CQ as td,AQ as ud,EQ as vd,kQ as wd,LQ as xd,_Q as yd,fQ as zd,bQ as Ad,cQ as Bd,yQ as Cd,dQ as Dd,OQ as Ed,zQ as Fd,RQ as Gd,hQ as Hd,pQ as Id,h as Jd,rQ as Kd,nQ as Ld,sQ as Md,n as Nd,oQ as Od,iQ as Pd,tQ as Qd,vQ as Rd,lQ as Sd,uQ as Td,aQ as Ud,eQ as Vd,QW as Wd,WW as Xd,ZW as Yd,$W as Zd,DW as _d,KW as $d};