@edgible-team/sdk
    Preparing search index...

    Function provisionVmWithAgent

    • Boot a VM, build the Edgible source in the guest, log the in-guest CLI in, install + start the agent, and wait (via the SDK) for the device to report active. Returns the registered device info and an idempotent stop().

      The agent install/start steps run with sudo inside the guest, and a systemd drop-in is written there to set EDGIBLE_CLOUD_REGION — all host mutation is confined to the guest VM. Failures of the individual steps (Node 20 install, guest login, agent install, missing projectRoot or organizationId) throw plain Errors carrying the guest output.

      Parameters

      Returns Promise<ProvisionVmWithAgentResult>

      WAITER_TIMEOUT when the device does not report status=active within the poll timeout (default 120s).

      const { vm } = await prepareVm({ projectRoot, imagesDir });
      const provisioned = await provisionVmWithAgent({
      vm,
      client: edgibleClient,
      credentials: { email, password },
      projectRoot,
      stage: 'dev',
      startVm: false, // prepareVm already booted it
      syncAndBuild: false, // ...and built the source in the guest
      onProgress: (e) => console.log(`[${e.phase}] ${e.message}`),
      });
      console.log(`device ${provisioned.deviceId} active`);
      await provisioned.stop();