UNPKG

agent-device

Version:

Open source device layer for AI coding agents: a CLI, MCP server, and typed Node.js API to control mobile, web, TV, and desktop apps on devices and simulators, locally or in the cloud.

1 lines • 1.89 kB
import{E as e}from"./sdk-batch.js";import{v as t,y as n}from"./sdk-contracts.js";import{A as r}from"./sdk-batch-runner.js";import{h as i}from"./lease-scope.js";import{n as a,t as o}from"./catalog.js";import{c as s}from"./request.js";function c(r,i){let a=e(r.command)?.command;throw new t(`UNSUPPORTED_OPERATION`,`${i} cannot run within a bounded composite`,{reason:n,shape:i,...a?{standaloneCommandName:a}:{},hint:`Run the original ${a??`refused`} operation separately with its original arguments and options, the same --session value, and the same private CLI context. Inspect completed steps before retrying the batch or replay.`,dispatched:`no`})}function l(e){return s(e.meta?.requestId)===void 0?!1:e.command===o.installSource||e.command===a.installFromSource?e.internal?.executionPlan!==void 0||e.internal?.replayPlanStep===!0:!0}function u(e){return i(e)}function d(e,t){let n=u(e),i=n.leaseId??t?.leaseId,a=n.tenantId??t?.tenantId,o=n.runId??t?.runId;if(!(!a||!o||!i))return r({tenantId:a,runId:o,leaseId:i,leaseBackend:n.leaseBackend??t?.backend,leaseProvider:n.leaseProvider??t?.leaseProvider,deviceKey:n.deviceKey??t?.deviceKey,clientId:n.clientId??t?.clientId,expiresAt:t?.expiresAt})}function f(e,t){let n=u(e),i=t?.lease??t?.deviceLease??void 0;return r({tenantId:n.tenantId??i?.tenantId,runId:n.runId??i?.runId,leaseId:n.leaseId??i?.leaseId,leaseTtlMs:n.leaseTtlMs,leaseBackend:n.leaseBackend??i?.leaseBackend,leaseProvider:n.leaseProvider??i?.leaseProvider,deviceKey:n.deviceKey??i?.deviceKey,clientId:n.clientId??i?.clientId})}function p(e){let t=e.meta,n=r({leaseId:m(t?.leaseId),clientId:m(t?.clientId),tenantId:m(t?.tenantId),runId:m(t?.runId),leaseProvider:m(t?.leaseProvider),deviceKey:m(t?.deviceKey)});return Object.keys(n).length>0?n:void 0}function m(e){return typeof e==`string`&&e.trim().length>0?e.trim():void 0}export{f as a,u as i,l as n,p as o,c as r,d as t};