@byok-sdk/cloud-dataplane 0.13.0 → 0.15.0

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/dist/runtime.js CHANGED
@@ -800,10 +800,11 @@ function toRecord(row) {
800
800
  proofKeyEpoch: row.proof_key_epoch,
801
801
  revoked: row.revoked,
802
802
  ...row.machine_id == null ? {} : { machineId: row.machine_id },
803
+ ...row.harnesses == null ? {} : { harnesses: row.harnesses },
803
804
  ...row.capabilities == null ? {} : { capabilities: Object.freeze([...row.capabilities]) }
804
805
  };
805
806
  }
806
- var SELECT_COLUMNS = "tenant_id, device_id, product_id, device_name, device_public_key, proof_key_id, proof_key_epoch, revoked, machine_id, capabilities";
807
+ var SELECT_COLUMNS = "tenant_id, device_id, product_id, device_name, device_public_key, proof_key_id, proof_key_epoch, revoked, machine_id, capabilities, harnesses";
807
808
  var DEVICE_STATE_DELETES = [
808
809
  "DELETE FROM device_presence WHERE tenant_id = $1 AND device_id = ANY($2::text[])",
809
810
  "DELETE FROM auth_nonce WHERE tenant_id = $1 AND device_id = ANY($2::text[])",
@@ -850,7 +851,7 @@ async function registerDeviceOnClient(client, tenant, input) {
850
851
  proof_key_epoch = EXCLUDED.proof_key_epoch,
851
852
  revoked = false,
852
853
  machine_id = EXCLUDED.machine_id,
853
- capabilities = NULL
854
+ capabilities = NULL, harnesses = NULL
854
855
  RETURNING ${SELECT_COLUMNS}`,
855
856
  [
856
857
  tenant,
@@ -935,10 +936,10 @@ var PostgresDeviceDirectory = class {
935
936
  async recordCapabilities(tenant, input) {
936
937
  const result = await this.#pool.query(
937
938
  `UPDATE device
938
- SET capabilities = $3::jsonb
939
+ SET capabilities = $3::jsonb, harnesses = $4::jsonb
939
940
  WHERE tenant_id = $1 AND device_id = $2 AND revoked = false
940
941
  RETURNING ${SELECT_COLUMNS}`,
941
- [tenant, input.deviceId, JSON.stringify([...input.capabilities])]
942
+ [tenant, input.deviceId, JSON.stringify([...input.capabilities]), JSON.stringify(input.harnesses ?? [])]
942
943
  );
943
944
  const row = result.rows[0];
944
945
  return row === void 0 ? void 0 : toRecord(row);
@@ -1352,7 +1353,7 @@ var PostgresProofRequestReceiptStore = class {
1352
1353
  return row === void 0 ? void 0 : toReceipt2(row);
1353
1354
  }
1354
1355
  };
1355
- var TASK_SELECT_COLUMNS = "tenant_id, task_id, device_id, agent_id, agent_profile_revision, owner_device_id, status, terminal_cause, cancel_requested_at, cancel_reason, cancel_message_id, claimed_runtime, claimed_runtime_capabilities, updated_at";
1356
+ var TASK_SELECT_COLUMNS = "tenant_id, task_id, device_id, agent_id, agent_profile_revision, owner_device_id, status, terminal_cause, cancel_requested_at, cancel_reason, cancel_message_id, claimed_runtime, claimed_harness_id, claimed_runtime_capabilities, updated_at";
1356
1357
  var AGENT_MESSAGE_ADMISSION_SELECT_COLUMNS = "message_id, payload_body, terminal_body";
1357
1358
  function admissionRowToRecord(row) {
1358
1359
  return {
@@ -1380,6 +1381,7 @@ function taskRowToAttempt(row) {
1380
1381
  status: row.status,
1381
1382
  // `claimed_runtime` is written only by the guarded claim UPDATE below, so a
1382
1383
  // non-null value here is always the winning claim's own self-report.
1384
+ ...row.claimed_harness_id == null ? {} : { claimedHarnessId: row.claimed_harness_id },
1383
1385
  ...row.claimed_runtime === null ? {} : { claimedRuntime: row.claimed_runtime },
1384
1386
  ...row.claimed_runtime_capabilities === null ? {} : { claimedRuntimeCapabilities: row.claimed_runtime_capabilities },
1385
1387
  ...row.terminal_cause == null ? {} : { terminalCause: row.terminal_cause },
@@ -1555,9 +1557,10 @@ var PostgresTaskAttemptStore = class {
1555
1557
  SET owner_device_id = $3,
1556
1558
  status = 'claimed',
1557
1559
  claimed_runtime = $5,
1560
+ claimed_harness_id = $7,
1558
1561
  claimed_runtime_capabilities = $6::jsonb,
1559
1562
  updated_at = $4
1560
- WHERE tenant_id = $1 AND task_id = $2 AND owner_device_id IS NULL
1563
+ WHERE tenant_id = $1 AND task_id = $2 AND device_id = $3 AND owner_device_id IS NULL
1561
1564
  AND cancel_requested_at IS NULL AND status = 'offered'
1562
1565
  RETURNING ${TASK_SELECT_COLUMNS}`,
1563
1566
  [
@@ -1566,7 +1569,8 @@ var PostgresTaskAttemptStore = class {
1566
1569
  input.deviceId,
1567
1570
  this.#now(),
1568
1571
  input.runtime ?? null,
1569
- input.capabilities === void 0 ? null : JSON.stringify(input.capabilities)
1572
+ input.capabilities === void 0 ? null : JSON.stringify(input.capabilities),
1573
+ input.harnessId ?? null
1570
1574
  ]
1571
1575
  );
1572
1576
  const won = claimed.rows[0];