@tangle-network/agent-app 0.48.3 → 0.49.1

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.
@@ -41,7 +41,7 @@ import {
41
41
  flattenHistory,
42
42
  readSandboxBinaryBytes,
43
43
  statSandboxFileSize
44
- } from "../chunk-3SIQ4CDA.js";
44
+ } from "../chunk-7S24DNVP.js";
45
45
  import "../chunk-MCYJON3F.js";
46
46
  import "../chunk-LWSJK546.js";
47
47
  import "../chunk-FZOGDD2E.js";
@@ -1547,8 +1547,11 @@ async function listStopped(client, name) {
1547
1547
  }
1548
1548
  async function deleteBox(box) {
1549
1549
  try {
1550
- await box.delete();
1550
+ const acknowledgement = await box.delete({ until: "removed" });
1551
1551
  livenessVerifiedAt.delete(box.id);
1552
+ if (acknowledgement.removal === "pending") {
1553
+ return fail(new Error(`sandbox ${box.id} removal is still pending; retry replacement after removal completes`));
1554
+ }
1552
1555
  return ok(void 0);
1553
1556
  } catch (err) {
1554
1557
  return fail(err);
@@ -2010,7 +2013,11 @@ async function provisionWorkspaceSandbox(shell, options) {
2010
2013
  let replacementRequested = false;
2011
2014
  const resources = shell.resources ?? DEFAULT_SANDBOX_RESOURCES;
2012
2015
  const resumeTimeout = shell.provisionTimeoutMs ?? DEFAULT_PROVISION_TIMEOUT_MS;
2013
- const existing = await listRunning(client, name);
2016
+ let existing = await listRunning(client, name);
2017
+ if (forceNew && existing.succeeded && !existing.value) {
2018
+ existing = await listStopped(client, name);
2019
+ }
2020
+ if (forceNew && !existing.succeeded) throw existing.error;
2014
2021
  if (existing.succeeded && existing.value) {
2015
2022
  const found = existing.value;
2016
2023
  if (forceNew) {
@@ -2837,4 +2844,4 @@ export {
2837
2844
  isTerminalPromptEvent,
2838
2845
  detectInteractiveQuestion
2839
2846
  };
2840
- //# sourceMappingURL=chunk-3SIQ4CDA.js.map
2847
+ //# sourceMappingURL=chunk-7S24DNVP.js.map