@tangle-network/agent-app 0.45.28 → 0.45.29

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.
Files changed (38) hide show
  1. package/dist/{DesignCanvas-3RRPVPCP.js → DesignCanvas-RSWQCXM3.js} +2 -2
  2. package/dist/{DesignCanvasEditor-KAMMEX7E.js → DesignCanvasEditor-XZMGIST7.js} +4 -4
  3. package/dist/assistant/index.d.ts +62 -39
  4. package/dist/assistant/index.js +23 -5
  5. package/dist/assistant/index.js.map +1 -1
  6. package/dist/chat-react/index.d.ts +25 -2
  7. package/dist/chat-react/index.js.map +1 -1
  8. package/dist/chat-routes/index.js +1 -1
  9. package/dist/{chunk-WC43OQMR.js → chunk-3I27SDU3.js} +103 -30
  10. package/dist/chunk-3I27SDU3.js.map +1 -0
  11. package/dist/{chunk-NC2V63EL.js → chunk-FNM7JYME.js} +88 -21
  12. package/dist/chunk-FNM7JYME.js.map +1 -0
  13. package/dist/{chunk-4QVG4WJQ.js → chunk-OYTMILRK.js} +10 -3
  14. package/dist/chunk-OYTMILRK.js.map +1 -0
  15. package/dist/{chunk-OYGM5WLD.js → chunk-PURHUAOR.js} +52 -15
  16. package/dist/chunk-PURHUAOR.js.map +1 -0
  17. package/dist/{chunk-AWPK7ZDS.js → chunk-QGOU3VXH.js} +3 -3
  18. package/dist/{chunk-OTLEYHOG.js → chunk-RRH23CGS.js} +24 -4
  19. package/dist/chunk-RRH23CGS.js.map +1 -0
  20. package/dist/design-canvas-react/engine.d.ts +15 -1
  21. package/dist/design-canvas-react/engine.js +6 -2
  22. package/dist/design-canvas-react/index.d.ts +13 -1
  23. package/dist/design-canvas-react/index.js +13 -8
  24. package/dist/design-canvas-react/index.js.map +1 -1
  25. package/dist/design-canvas-react/lazy.js +1 -1
  26. package/dist/sandbox/index.d.ts +11 -1
  27. package/dist/sandbox/index.js +1 -1
  28. package/dist/web-react/index.d.ts +23 -4
  29. package/dist/web-react/index.js +1 -1
  30. package/package.json +14 -3
  31. package/dist/chunk-4QVG4WJQ.js.map +0 -1
  32. package/dist/chunk-NC2V63EL.js.map +0 -1
  33. package/dist/chunk-OTLEYHOG.js.map +0 -1
  34. package/dist/chunk-OYGM5WLD.js.map +0 -1
  35. package/dist/chunk-WC43OQMR.js.map +0 -1
  36. /package/dist/{DesignCanvas-3RRPVPCP.js.map → DesignCanvas-RSWQCXM3.js.map} +0 -0
  37. /package/dist/{DesignCanvasEditor-KAMMEX7E.js.map → DesignCanvasEditor-XZMGIST7.js.map} +0 -0
  38. /package/dist/{chunk-AWPK7ZDS.js.map → chunk-QGOU3VXH.js.map} +0 -0
@@ -939,6 +939,7 @@ var DEFAULT_SANDBOX_RESOURCES = {
939
939
  idleTimeoutSeconds: 3600
940
940
  };
941
941
  var _cached = null;
942
+ var livenessVerifiedAt = /* @__PURE__ */ new Map();
942
943
  function getClientFromCreds(creds) {
943
944
  const fingerprint = `${creds.apiKey} ${creds.baseUrl}`;
944
945
  if (_cached && _cached.fingerprint === fingerprint) return _cached.client;
@@ -956,6 +957,7 @@ function getClient(shell) {
956
957
  }
957
958
  function resetClientCache() {
958
959
  _cached = null;
960
+ livenessVerifiedAt.clear();
959
961
  }
960
962
  function buildAppToolMcpServers(options) {
961
963
  const entries = {};
@@ -1368,6 +1370,7 @@ async function listStopped(client, name) {
1368
1370
  async function deleteBox(box) {
1369
1371
  try {
1370
1372
  await box.delete();
1373
+ livenessVerifiedAt.delete(box.id);
1371
1374
  return ok(void 0);
1372
1375
  } catch (err) {
1373
1376
  return fail(err);
@@ -1446,6 +1449,15 @@ async function isBoxAlive(box, harness, probe) {
1446
1449
  return false;
1447
1450
  }
1448
1451
  }
1452
+ var DEFAULT_LIVENESS_CACHE_TTL_MS = 5e3;
1453
+ function hasRecentLivenessVerification(box, probe, now = Date.now()) {
1454
+ const ttlMs = probe.cacheTtlMs ?? DEFAULT_LIVENESS_CACHE_TTL_MS;
1455
+ if (!Number.isFinite(ttlMs) || ttlMs <= 0) return false;
1456
+ const verifiedAt = livenessVerifiedAt.get(box.id);
1457
+ if (verifiedAt !== void 0 && now - verifiedAt < ttlMs) return true;
1458
+ livenessVerifiedAt.delete(box.id);
1459
+ return false;
1460
+ }
1449
1461
  var RUNTIME_CONNECTION_WAIT_MS = 3e4;
1450
1462
  var RUNTIME_CONNECTION_POLL_MS = 1e3;
1451
1463
  function sandboxRuntimeUrl(box) {
@@ -1568,12 +1580,20 @@ async function writeDeferredFilesWithRuntimeAuthRefresh(client, box, files, stag
1568
1580
  );
1569
1581
  }
1570
1582
  async function isReusableBox(box, harness, probe) {
1571
- if (sandboxEdgeFailed(box)) return false;
1572
- if (!sandboxRuntimeUrl(box)) return false;
1573
- return isBoxAlive(box, harness, probe);
1583
+ if (sandboxEdgeFailed(box) || !sandboxRuntimeUrl(box)) {
1584
+ livenessVerifiedAt.delete(box.id);
1585
+ return false;
1586
+ }
1587
+ if (!probe) return true;
1588
+ if (hasRecentLivenessVerification(box, probe)) return true;
1589
+ const alive = await isBoxAlive(box, harness, probe);
1590
+ if (alive) livenessVerifiedAt.set(box.id, Date.now());
1591
+ else livenessVerifiedAt.delete(box.id);
1592
+ return alive;
1574
1593
  }
1575
1594
  async function resumeStoppedBox(box, timeoutMs, onProgress) {
1576
1595
  try {
1596
+ livenessVerifiedAt.delete(box.id);
1577
1597
  await box.resume();
1578
1598
  await box.waitFor("running", { timeoutMs, ...onProgress ? { onProgress } : {} });
1579
1599
  return ok(box);
@@ -2354,4 +2374,4 @@ export {
2354
2374
  isTerminalPromptEvent,
2355
2375
  detectInteractiveQuestion
2356
2376
  };
2357
- //# sourceMappingURL=chunk-OTLEYHOG.js.map
2377
+ //# sourceMappingURL=chunk-RRH23CGS.js.map