@byok-sdk/cloud-dataplane 0.14.0 → 0.16.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/index.js CHANGED
@@ -804,10 +804,11 @@ function toRecord(row) {
804
804
  proofKeyEpoch: row.proof_key_epoch,
805
805
  revoked: row.revoked,
806
806
  ...row.machine_id == null ? {} : { machineId: row.machine_id },
807
+ ...row.harnesses == null ? {} : { harnesses: row.harnesses },
807
808
  ...row.capabilities == null ? {} : { capabilities: Object.freeze([...row.capabilities]) }
808
809
  };
809
810
  }
810
- var SELECT_COLUMNS = "tenant_id, device_id, product_id, device_name, device_public_key, proof_key_id, proof_key_epoch, revoked, machine_id, capabilities";
811
+ 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";
811
812
  var DEVICE_STATE_DELETES = [
812
813
  "DELETE FROM device_presence WHERE tenant_id = $1 AND device_id = ANY($2::text[])",
813
814
  "DELETE FROM auth_nonce WHERE tenant_id = $1 AND device_id = ANY($2::text[])",
@@ -854,7 +855,7 @@ async function registerDeviceOnClient(client, tenant, input) {
854
855
  proof_key_epoch = EXCLUDED.proof_key_epoch,
855
856
  revoked = false,
856
857
  machine_id = EXCLUDED.machine_id,
857
- capabilities = NULL
858
+ capabilities = NULL, harnesses = NULL
858
859
  RETURNING ${SELECT_COLUMNS}`,
859
860
  [
860
861
  tenant,
@@ -939,10 +940,10 @@ var PostgresDeviceDirectory = class {
939
940
  async recordCapabilities(tenant, input) {
940
941
  const result = await this.#pool.query(
941
942
  `UPDATE device
942
- SET capabilities = $3::jsonb
943
+ SET capabilities = $3::jsonb, harnesses = $4::jsonb
943
944
  WHERE tenant_id = $1 AND device_id = $2 AND revoked = false
944
945
  RETURNING ${SELECT_COLUMNS}`,
945
- [tenant, input.deviceId, JSON.stringify([...input.capabilities])]
946
+ [tenant, input.deviceId, JSON.stringify([...input.capabilities]), JSON.stringify(input.harnesses ?? [])]
946
947
  );
947
948
  const row = result.rows[0];
948
949
  return row === void 0 ? void 0 : toRecord(row);
@@ -1356,7 +1357,7 @@ var PostgresProofRequestReceiptStore = class {
1356
1357
  return row === void 0 ? void 0 : toReceipt2(row);
1357
1358
  }
1358
1359
  };
1359
- 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";
1360
+ 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";
1360
1361
  var AGENT_MESSAGE_ADMISSION_SELECT_COLUMNS = "message_id, payload_body, terminal_body";
1361
1362
  function admissionRowToRecord(row) {
1362
1363
  return {
@@ -1384,6 +1385,7 @@ function taskRowToAttempt(row) {
1384
1385
  status: row.status,
1385
1386
  // `claimed_runtime` is written only by the guarded claim UPDATE below, so a
1386
1387
  // non-null value here is always the winning claim's own self-report.
1388
+ ...row.claimed_harness_id == null ? {} : { claimedHarnessId: row.claimed_harness_id },
1387
1389
  ...row.claimed_runtime === null ? {} : { claimedRuntime: row.claimed_runtime },
1388
1390
  ...row.claimed_runtime_capabilities === null ? {} : { claimedRuntimeCapabilities: row.claimed_runtime_capabilities },
1389
1391
  ...row.terminal_cause == null ? {} : { terminalCause: row.terminal_cause },
@@ -1559,6 +1561,7 @@ var PostgresTaskAttemptStore = class {
1559
1561
  SET owner_device_id = $3,
1560
1562
  status = 'claimed',
1561
1563
  claimed_runtime = $5,
1564
+ claimed_harness_id = $7,
1562
1565
  claimed_runtime_capabilities = $6::jsonb,
1563
1566
  updated_at = $4
1564
1567
  WHERE tenant_id = $1 AND task_id = $2 AND device_id = $3 AND owner_device_id IS NULL
@@ -1570,7 +1573,8 @@ var PostgresTaskAttemptStore = class {
1570
1573
  input.deviceId,
1571
1574
  this.#now(),
1572
1575
  input.runtime ?? null,
1573
- input.capabilities === void 0 ? null : JSON.stringify(input.capabilities)
1576
+ input.capabilities === void 0 ? null : JSON.stringify(input.capabilities),
1577
+ input.harnessId ?? null
1574
1578
  ]
1575
1579
  );
1576
1580
  const won = claimed.rows[0];