@tangle-network/agent-app 4.0.6 → 4.0.7

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 (32) hide show
  1. package/dist/billing/index.js +1 -1
  2. package/dist/chat-routes/index.js +5 -5
  3. package/dist/chat-routes/route-storage.d.ts +1 -0
  4. package/dist/chat-routes/turn-ownership.d.ts +7 -3
  5. package/dist/chat-routes/turn-route-contracts.d.ts +6 -1
  6. package/dist/{chunk-ROTSZSYZ.js → chunk-4OR7NNYB.js} +49 -11
  7. package/dist/chunk-4OR7NNYB.js.map +1 -0
  8. package/dist/{chunk-JFBJ7MGK.js → chunk-ASWAPIJM.js} +40 -3
  9. package/dist/chunk-ASWAPIJM.js.map +1 -0
  10. package/dist/{chunk-IYLUPXYS.js → chunk-FTGKXM7O.js} +3 -4
  11. package/dist/chunk-FTGKXM7O.js.map +1 -0
  12. package/dist/{chunk-ZTGITMYQ.js → chunk-FZOHBYGV.js} +74 -13
  13. package/dist/chunk-FZOHBYGV.js.map +1 -0
  14. package/dist/{chunk-2PCNHHN2.js → chunk-WGT32NQ4.js} +2 -2
  15. package/dist/{chunk-3Q3UEWKK.js → chunk-YQE2CGIO.js} +1 -1
  16. package/dist/{chunk-3Q3UEWKK.js.map → chunk-YQE2CGIO.js.map} +1 -1
  17. package/dist/preset-cloudflare/index.js +4 -4
  18. package/dist/public-consultation/index.js +5 -5
  19. package/dist/sandbox/holder-box.d.ts +13 -0
  20. package/dist/sandbox/index.d.ts +1 -0
  21. package/dist/sandbox/index.js +7 -3
  22. package/dist/stream/index.js +2 -2
  23. package/dist/stream/turn-buffer.d.ts +5 -2
  24. package/dist/turn-stream/adapters.d.ts +42 -1
  25. package/dist/turn-stream/index.js +4 -2
  26. package/dist/turn-stream/index.js.map +1 -1
  27. package/package.json +1 -1
  28. package/dist/chunk-IYLUPXYS.js.map +0 -1
  29. package/dist/chunk-JFBJ7MGK.js.map +0 -1
  30. package/dist/chunk-ROTSZSYZ.js.map +0 -1
  31. package/dist/chunk-ZTGITMYQ.js.map +0 -1
  32. /package/dist/{chunk-2PCNHHN2.js.map → chunk-WGT32NQ4.js.map} +0 -0
@@ -17,10 +17,10 @@ import {
17
17
  import {
18
18
  DEFAULT_TURN_LOCK_LOCATION_HINT,
19
19
  createDurableTurnLock
20
- } from "./chunk-ZTGITMYQ.js";
20
+ } from "./chunk-FZOHBYGV.js";
21
21
  import {
22
22
  createD1TurnEventStore
23
- } from "./chunk-3Q3UEWKK.js";
23
+ } from "./chunk-YQE2CGIO.js";
24
24
  import {
25
25
  DISPATCH_REQUEST_MAX_BYTES
26
26
  } from "./chunk-K2JPSXKI.js";
@@ -3621,6 +3621,41 @@ async function peekWorkspaceSandbox(shell, options) {
3621
3621
  return { status: "running", box: match };
3622
3622
  }
3623
3623
 
3624
+ // src/sandbox/holder-box.ts
3625
+ var HOLDER_BOX_READ_TIMEOUT_MS = 5e3;
3626
+ async function readHolderBoxSessions(find) {
3627
+ let timer;
3628
+ const read = (async () => {
3629
+ const box = await find();
3630
+ if (!box || box.status !== "running") return { live: 0, sessions: 0 };
3631
+ const sessions = await box.sessions();
3632
+ let unjudged = 0;
3633
+ const live = sessions.filter(({ info }) => {
3634
+ const verdict = info.raw?.hasActiveExecution;
3635
+ if (typeof verdict === "boolean") return verdict;
3636
+ unjudged += 1;
3637
+ return !!info.activeExecutionId;
3638
+ });
3639
+ if (unjudged > 0) {
3640
+ console.warn("[turn-lock] holder box sessions carry no execution verdict; counting their active execution id", {
3641
+ class: "sidecar_verdict_absent",
3642
+ sessions: unjudged
3643
+ });
3644
+ }
3645
+ return { live: live.length, sessions: sessions.length };
3646
+ })();
3647
+ try {
3648
+ return await Promise.race([read, new Promise((resolve) => {
3649
+ timer = setTimeout(() => resolve("timeout"), HOLDER_BOX_READ_TIMEOUT_MS);
3650
+ })]);
3651
+ } catch (error) {
3652
+ console.warn("[turn-lock] holder box read failed", { class: "box_unreachable", error: error instanceof Error ? error.name : "unknown" });
3653
+ return "unreachable";
3654
+ } finally {
3655
+ clearTimeout(timer);
3656
+ }
3657
+ }
3658
+
3624
3659
  // src/sandbox/workspace-provision.ts
3625
3660
  import { parseBackendType as parseBackendType2 } from "@tangle-network/sandbox";
3626
3661
 
@@ -4356,6 +4391,8 @@ export {
4356
4391
  ensureSandboxToolBinDir,
4357
4392
  runSandboxToolPathSetup,
4358
4393
  peekWorkspaceSandbox,
4394
+ HOLDER_BOX_READ_TIMEOUT_MS,
4395
+ readHolderBoxSessions,
4359
4396
  ensureWorkspaceSandbox,
4360
4397
  reuseWorkspaceSandbox,
4361
4398
  sandboxPromptExecutionOptions,
@@ -4367,4 +4404,4 @@ export {
4367
4404
  deleteSecret,
4368
4405
  mintSandboxScopedToken
4369
4406
  };
4370
- //# sourceMappingURL=chunk-JFBJ7MGK.js.map
4407
+ //# sourceMappingURL=chunk-ASWAPIJM.js.map