@byok-sdk/server 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/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +5 -0
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -280,6 +280,7 @@ var TaskEventRelay = class {
|
|
|
280
280
|
switch (envelope.type) {
|
|
281
281
|
case "task.claim":
|
|
282
282
|
if (envelope.payload.runtime !== void 0) state.claimedRuntime = envelope.payload.runtime;
|
|
283
|
+
if (envelope.payload.harnessId !== void 0) state.claimedHarnessId = envelope.payload.harnessId;
|
|
283
284
|
this.#transition(state, taskId, "Claimed", at);
|
|
284
285
|
return;
|
|
285
286
|
case "task.started":
|
|
@@ -367,6 +368,7 @@ var TaskEventRelay = class {
|
|
|
367
368
|
taskId,
|
|
368
369
|
state: next,
|
|
369
370
|
at,
|
|
371
|
+
...state.claimedHarnessId === void 0 ? {} : { claimedHarnessId: state.claimedHarnessId },
|
|
370
372
|
...state.claimedRuntime === void 0 ? {} : { claimedRuntime: state.claimedRuntime }
|
|
371
373
|
});
|
|
372
374
|
if (next !== "Complete" && next !== "Failed" && next !== "Cancelled") return;
|
|
@@ -462,6 +464,7 @@ function toTaskSnapshot(attempt, pending, terminal, dispatched) {
|
|
|
462
464
|
updatedAt: attempt.updatedAt,
|
|
463
465
|
...result === void 0 ? {} : { result },
|
|
464
466
|
...pending?.approvalId === void 0 ? {} : { pendingApprovalId: pending.approvalId },
|
|
467
|
+
...attempt.claimedHarnessId === void 0 ? {} : { claimedHarnessId: attempt.claimedHarnessId },
|
|
465
468
|
...attempt.claimedRuntime === void 0 ? {} : { claimedRuntime: attempt.claimedRuntime },
|
|
466
469
|
...attempt.claimedRuntimeCapabilities === void 0 ? {} : { claimedRuntimeCapabilities: attempt.claimedRuntimeCapabilities }
|
|
467
470
|
};
|
|
@@ -473,6 +476,7 @@ function toMachineInfo(device, connection) {
|
|
|
473
476
|
connected: connection?.connected ?? false,
|
|
474
477
|
lastSeen: connection?.lastSeen,
|
|
475
478
|
...connection?.clientVersion === void 0 ? {} : { clientVersion: connection.clientVersion },
|
|
479
|
+
harnesses: device.harnesses,
|
|
476
480
|
runtimes: connection?.runtimes === void 0 ? void 0 : [...connection.runtimes],
|
|
477
481
|
configuredToolsets: connection?.configuredToolsets === void 0 ? void 0 : [...connection.configuredToolsets]
|
|
478
482
|
};
|
|
@@ -990,7 +994,7 @@ var SqliteTaskAttemptStore = class {
|
|
|
990
994
|
db.prepare(
|
|
991
995
|
`UPDATE task_attempt SET owner_device_id = ?, claimed_runtime = ?, claimed_runtime_capabilities_json = ?,
|
|
992
996
|
status = 'claimed', updated_at = ?
|
|
993
|
-
WHERE tenant_id = ? AND task_id = ? AND owner_device_id IS NULL
|
|
997
|
+
WHERE tenant_id = ? AND task_id = ? AND device_id = ? AND owner_device_id IS NULL
|
|
994
998
|
AND cancellation_requested_at IS NULL AND status = 'offered'`
|
|
995
999
|
).run(
|
|
996
1000
|
input.deviceId,
|
|
@@ -998,7 +1002,8 @@ var SqliteTaskAttemptStore = class {
|
|
|
998
1002
|
input.capabilities === void 0 ? null : JSON.stringify(input.capabilities),
|
|
999
1003
|
this.#now(),
|
|
1000
1004
|
tenant,
|
|
1001
|
-
input.taskId
|
|
1005
|
+
input.taskId,
|
|
1006
|
+
input.deviceId
|
|
1002
1007
|
);
|
|
1003
1008
|
return readTask(db, tenant, input.taskId);
|
|
1004
1009
|
});
|
|
@@ -1891,6 +1896,7 @@ function createByokServer(opts) {
|
|
|
1891
1896
|
const policy = input.policy ?? { mode: "confirm" };
|
|
1892
1897
|
const runtime = dispatchSelection?.runtimeId ?? input.runtime;
|
|
1893
1898
|
const common = {
|
|
1899
|
+
...input.harnessId === void 0 ? {} : { harnessId: input.harnessId },
|
|
1894
1900
|
instruction: input.instruction,
|
|
1895
1901
|
policy,
|
|
1896
1902
|
...runtime === void 0 ? {} : { runtime },
|