@tangle-network/sandbox 0.60.78-develop.20261017134105.a6b32a2 → 0.60.78-develop.20261021201434.3bcd5ef

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 (66) hide show
  1. package/README.md +61 -0
  2. package/dist/agent/index.d.ts +4 -4
  3. package/dist/agent/index.js +5 -5
  4. package/dist/agent/preview.d.ts +1 -1
  5. package/dist/agent/preview.js +2 -2
  6. package/dist/{agent-run-outcome-CTEpjCEZ.d.ts → agent-run-outcome-brwJbH5S.d.ts} +1 -1
  7. package/dist/auth/index.d.ts +2 -2
  8. package/dist/auth/index.js +5 -5
  9. package/dist/{backend-types-D6bYbvMB.js → backend-types-CLvdSX8V.js} +41 -1
  10. package/dist/{browser-interactive-control-controller-rpTbyvAS.d.ts → browser-interactive-control-controller-CvObO_Kf.d.ts} +1 -1
  11. package/dist/{browser-interactive-control-controller-BJf0P_J4.js → browser-interactive-control-controller-DHx53yre.js} +16 -1
  12. package/dist/{chunked-upload-DtIvkKNo.js → chunked-upload-DN2twsUu.js} +2 -59
  13. package/dist/{chunked-upload-file-DnsHEjg0.js → chunked-upload-file-Dpv1YsoA.js} +2 -1
  14. package/dist/{cli-auth-bundle-cSJjPeFF.js → cli-auth-bundle-CFeHsq-5.js} +23 -11
  15. package/dist/{client-R1tw-4Px.js → client-CgtR203z.js} +3349 -3341
  16. package/dist/client-Dr8qasCR.d.ts +6076 -0
  17. package/dist/collaboration/index.d.ts +1 -1
  18. package/dist/collaboration/index.js +1 -1
  19. package/dist/{collaboration-DaJU5O0E.js → collaboration-g_HzXa6f.js} +5 -5
  20. package/dist/core.d.ts +7 -7
  21. package/dist/core.js +7 -6
  22. package/dist/direct-http2-Dar5erTH.js +99 -0
  23. package/dist/{errors-DSJBKmGZ.js → errors-BfbOP_rx.js} +171 -22
  24. package/dist/{index-DO7GVpk_.d.ts → index-C8VSFtWl.d.ts} +1 -1
  25. package/dist/{index-DZ27pdB8.d.ts → index-CVjTnRWP.d.ts} +1 -1
  26. package/dist/{sandbox-CoIGxzm_.d.ts → index-D5dVNm76.d.ts} +2117 -1519
  27. package/dist/index.d.ts +12 -4704
  28. package/dist/index.js +40 -15
  29. package/dist/intelligence/index.js +1 -1
  30. package/dist/interactive-control.d.ts +1 -1
  31. package/dist/interactive-control.js +1 -1
  32. package/dist/{interactive-controller-CJ24g8Va.js → interactive-controller-OAsASPd_.js} +662 -620
  33. package/dist/interactive-controller-nMhGqXxq.d.ts +41 -0
  34. package/dist/keep-alive-fetch-BBzJDWyt.js +247 -0
  35. package/dist/{lines-DodQslsf.d.ts → lines-C5CPSg8n.d.ts} +21 -17
  36. package/dist/lines-C5ER4aN_.js +298 -0
  37. package/dist/lines.d.ts +1 -1
  38. package/dist/lines.js +1 -295
  39. package/dist/{local-cli-auth-CBV7Vjk5.js → local-cli-auth-D-CQ0-ub.js} +1 -1
  40. package/dist/{mcp-local-DjryqUiY.js → mcp-local-BjLG7VHY.js} +1 -1
  41. package/dist/{preview-wpGGk0bu.d.ts → preview-COO7TSBk.d.ts} +3 -3
  42. package/dist/public-templates-BDrchm0J.d.ts +80 -0
  43. package/dist/public-templates.d.ts +2 -0
  44. package/dist/public-templates.js +173 -0
  45. package/dist/{raw-evidence-archive-Br5a3xZ_.js → raw-evidence-archive-CDYDqHNv.js} +161 -69
  46. package/dist/runtime.d.ts +49 -41
  47. package/dist/runtime.js +8 -8
  48. package/dist/{sandbox-C7Tk62qn.js → sandbox-BrZxAq11.js} +9048 -8939
  49. package/dist/{secp256k1-Dx2XABHz.js → secp256k1-CmLpsmWl.js} +1 -1
  50. package/dist/session-gateway/index.d.ts +23 -67
  51. package/dist/session-gateway/index.js +578 -451
  52. package/dist/tangle/index.d.ts +1 -1
  53. package/dist/tangle/index.js +1 -1
  54. package/dist/{tangle-Ba4Kz5zT.js → tangle-GiPBak5X.js} +176 -169
  55. package/dist/terminal-stream-types-ClZCArRg.d.ts +662 -0
  56. package/dist/{types-B_QF-iHm.d.ts → types-CtH0GRql.d.ts} +6161 -5812
  57. package/package.json +11 -6
  58. package/dist/client-Lhxo82x1.d.ts +0 -1261
  59. package/dist/errors-mPL-qvgF.d.ts +0 -347
  60. package/dist/index-DRto9Ijb.d.ts +0 -579
  61. package/dist/managed-process-B7WfqKmi.d.ts +0 -15
  62. package/dist/terminal-stream-jdYomM1m.d.ts +0 -389
  63. /package/dist/{cli-auth-bundle-ODe06Ts7.d.ts → cli-auth-bundle-Dyw3hCGx.d.ts} +0 -0
  64. /package/dist/{line-application-Cq6dJLBD.js → line-application-DY9ZTdgF.js} +0 -0
  65. /package/dist/{preview-operations-DqSo-IBm.js → preview-operations-Ca02vPDJ.js} +0 -0
  66. /package/dist/{utils-B7_9Hl_z.js → utils-BGvM02yJ.js} +0 -0
@@ -1,2 +1,2 @@
1
- import { C as JsonResponseParamTypes, E as SandboxIdParamTypes, S as ITangleJobsAbi, T as SandboxCreateResponseParamTypes, _ as JOB_SANDBOX_DELETE, a as fetchQuote, b as TangleSandboxClientConfig, c as parseQuoteResponse, d as OperatorSession, f as OperatorSessionError, g as JOB_SANDBOX_CREATE, h as TangleSandboxClient, i as SignedQuote, l as validateQuote, m as SignMessage, n as QuoteDomain, o as inputsHashOf, p as OperatorSessionToken, r as QuoteError, s as jobQuoteDigest, t as JobQuoteDetails, u as OperatorChallenge, v as TANGLE_CHAIN_ID, w as SandboxCreateParamTypes, x as AgentSandboxBlueprintAbi, y as TANGLE_JOBS_CONTRACT } from "../index-DRto9Ijb.js";
1
+ import { C as JsonResponseParamTypes, E as SandboxIdParamTypes, S as JOB_SANDBOX_DELETE, T as SandboxCreateResponseParamTypes, _ as TANGLE_JOBS_CONTRACT, a as fetchQuote, b as AgentSandboxBlueprintAbi, c as parseQuoteResponse, d as OperatorSession, f as OperatorSessionError, g as TANGLE_CHAIN_ID, h as TangleSandboxClient, i as SignedQuote, l as validateQuote, m as SignMessage, n as QuoteDomain, o as inputsHashOf, p as OperatorSessionToken, r as QuoteError, s as jobQuoteDigest, t as JobQuoteDetails, u as OperatorChallenge, v as TangleSandboxClientConfig, w as SandboxCreateParamTypes, x as JOB_SANDBOX_CREATE, y as ITangleJobsAbi } from "../index-D5dVNm76.js";
2
2
  export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JobQuoteDetails, JsonResponseParamTypes, OperatorChallenge, OperatorSession, OperatorSessionError, OperatorSessionToken, QuoteDomain, QuoteError, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, SignMessage, SignedQuote, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TangleSandboxClient, TangleSandboxClientConfig, fetchQuote, inputsHashOf, jobQuoteDigest, parseQuoteResponse, validateQuote };
@@ -1,2 +1,2 @@
1
- import { _ as SandboxCreateParamTypes, a as parseQuoteResponse, c as OperatorSession, d as JOB_SANDBOX_DELETE, f as TANGLE_CHAIN_ID, g as JsonResponseParamTypes, h as ITangleJobsAbi, i as jobQuoteDigest, l as OperatorSessionError, m as AgentSandboxBlueprintAbi, n as fetchQuote, o as validateQuote, p as TANGLE_JOBS_CONTRACT, r as inputsHashOf, s as TangleSandboxClient, t as QuoteError, u as JOB_SANDBOX_CREATE, v as SandboxCreateResponseParamTypes, y as SandboxIdParamTypes } from "../tangle-Ba4Kz5zT.js";
1
+ import { _ as SandboxCreateParamTypes, a as parseQuoteResponse, c as OperatorSession, d as TANGLE_JOBS_CONTRACT, f as ITangleJobsAbi, g as JsonResponseParamTypes, h as JOB_SANDBOX_DELETE, i as jobQuoteDigest, l as OperatorSessionError, m as JOB_SANDBOX_CREATE, n as fetchQuote, o as validateQuote, p as AgentSandboxBlueprintAbi, r as inputsHashOf, s as TangleSandboxClient, t as QuoteError, u as TANGLE_CHAIN_ID, v as SandboxCreateResponseParamTypes, y as SandboxIdParamTypes } from "../tangle-GiPBak5X.js";
2
2
  export { AgentSandboxBlueprintAbi, ITangleJobsAbi, JOB_SANDBOX_CREATE, JOB_SANDBOX_DELETE, JsonResponseParamTypes, OperatorSession, OperatorSessionError, QuoteError, SandboxCreateParamTypes, SandboxCreateResponseParamTypes, SandboxIdParamTypes, TANGLE_CHAIN_ID, TANGLE_JOBS_CONTRACT, TangleSandboxClient, fetchQuote, inputsHashOf, jobQuoteDigest, parseQuoteResponse, validateQuote };
@@ -1,138 +1,16 @@
1
- import { C as readResponseJson } from "./errors-DSJBKmGZ.js";
2
- import { n as createSandboxInstanceFromResponse } from "./sandbox-C7Tk62qn.js";
3
- import { _ as rotlBH, a as anumber, b as rotlSL, d as createXOFer, g as u32, h as toBytes$1, l as createHasher, m as swap32IfBE, n as abytes, o as aoutput, r as aexists, s as clean, t as Hash, v as rotlBL, x as split, y as rotlSH } from "./utils-B7_9Hl_z.js";
4
- //#region src/tangle/abi.ts
1
+ import { i as readResponseJson } from "./errors-BfbOP_rx.js";
2
+ import { n as createSandboxInstanceFromResponse } from "./sandbox-BrZxAq11.js";
3
+ import { _ as rotlBH, a as anumber, b as rotlSL, d as createXOFer, g as u32, h as toBytes$1, l as createHasher, m as swap32IfBE, n as abytes, o as aoutput, r as aexists, s as clean, t as Hash, v as rotlBL, x as split, y as rotlSH } from "./utils-BGvM02yJ.js";
4
+ //#region ../../../packages/runtime-contracts/dist/tangle-blueprint-abi.js
5
5
  /**
6
- * Tangle Contract ABI Definitions
7
- *
8
- * Viem-compatible ABI for the ITangleJobs precompile, the AgentSandbox
9
- * blueprint contract views/events, and ABI parameter definitions for
10
- * encoding/decoding blueprint job inputs and outputs.
6
+ * Tangle blueprint wire contract shared by the orchestrator's Tangle driver and
7
+ * the published sandbox SDK's Tangle client: job indices and the ABI
8
+ * definitions for encoding/decoding the AgentSandbox blueprint's job inputs
9
+ * and outputs, plus its contract views/events.
11
10
  */
12
- const ITangleJobsAbi = [
13
- {
14
- type: "function",
15
- name: "submitJob",
16
- inputs: [
17
- {
18
- name: "serviceId",
19
- type: "uint64"
20
- },
21
- {
22
- name: "jobIndex",
23
- type: "uint8"
24
- },
25
- {
26
- name: "inputs",
27
- type: "bytes"
28
- }
29
- ],
30
- outputs: [{
31
- name: "callId",
32
- type: "uint64"
33
- }],
34
- stateMutability: "payable"
35
- },
36
- {
37
- type: "function",
38
- name: "getJobCall",
39
- inputs: [{
40
- name: "serviceId",
41
- type: "uint64"
42
- }, {
43
- name: "callId",
44
- type: "uint64"
45
- }],
46
- outputs: [{
47
- name: "",
48
- type: "tuple",
49
- components: [
50
- {
51
- name: "jobIndex",
52
- type: "uint8"
53
- },
54
- {
55
- name: "caller",
56
- type: "address"
57
- },
58
- {
59
- name: "createdAt",
60
- type: "uint64"
61
- },
62
- {
63
- name: "resultCount",
64
- type: "uint32"
65
- },
66
- {
67
- name: "payment",
68
- type: "uint256"
69
- },
70
- {
71
- name: "completed",
72
- type: "bool"
73
- }
74
- ]
75
- }],
76
- stateMutability: "view"
77
- },
78
- {
79
- type: "event",
80
- name: "JobSubmitted",
81
- inputs: [
82
- {
83
- name: "serviceId",
84
- type: "uint64",
85
- indexed: true
86
- },
87
- {
88
- name: "callId",
89
- type: "uint64",
90
- indexed: true
91
- },
92
- {
93
- name: "jobIndex",
94
- type: "uint8",
95
- indexed: false
96
- },
97
- {
98
- name: "caller",
99
- type: "address",
100
- indexed: false
101
- },
102
- {
103
- name: "inputs",
104
- type: "bytes",
105
- indexed: false
106
- }
107
- ]
108
- },
109
- {
110
- type: "event",
111
- name: "JobResultSubmitted",
112
- inputs: [
113
- {
114
- name: "serviceId",
115
- type: "uint64",
116
- indexed: true
117
- },
118
- {
119
- name: "callId",
120
- type: "uint64",
121
- indexed: true
122
- },
123
- {
124
- name: "operator",
125
- type: "address",
126
- indexed: true
127
- },
128
- {
129
- name: "result",
130
- type: "bytes",
131
- indexed: false
132
- }
133
- ]
134
- }
135
- ];
11
+ /** Job indices matching the blueprint's job IDs. */
12
+ const JOB_SANDBOX_CREATE = 0;
13
+ const JOB_SANDBOX_DELETE = 1;
136
14
  const SandboxCreateParamTypes = [{
137
15
  name: "request",
138
16
  type: "tuple",
@@ -374,6 +252,137 @@ const AgentSandboxBlueprintAbi = [
374
252
  }
375
253
  ];
376
254
  //#endregion
255
+ //#region src/tangle/abi.ts
256
+ /**
257
+ * Tangle Contract ABI Definitions
258
+ *
259
+ * Viem-compatible ABI for the ITangleJobs precompile.
260
+ */
261
+ const ITangleJobsAbi = [
262
+ {
263
+ type: "function",
264
+ name: "submitJob",
265
+ inputs: [
266
+ {
267
+ name: "serviceId",
268
+ type: "uint64"
269
+ },
270
+ {
271
+ name: "jobIndex",
272
+ type: "uint8"
273
+ },
274
+ {
275
+ name: "inputs",
276
+ type: "bytes"
277
+ }
278
+ ],
279
+ outputs: [{
280
+ name: "callId",
281
+ type: "uint64"
282
+ }],
283
+ stateMutability: "payable"
284
+ },
285
+ {
286
+ type: "function",
287
+ name: "getJobCall",
288
+ inputs: [{
289
+ name: "serviceId",
290
+ type: "uint64"
291
+ }, {
292
+ name: "callId",
293
+ type: "uint64"
294
+ }],
295
+ outputs: [{
296
+ name: "",
297
+ type: "tuple",
298
+ components: [
299
+ {
300
+ name: "jobIndex",
301
+ type: "uint8"
302
+ },
303
+ {
304
+ name: "caller",
305
+ type: "address"
306
+ },
307
+ {
308
+ name: "createdAt",
309
+ type: "uint64"
310
+ },
311
+ {
312
+ name: "resultCount",
313
+ type: "uint32"
314
+ },
315
+ {
316
+ name: "payment",
317
+ type: "uint256"
318
+ },
319
+ {
320
+ name: "completed",
321
+ type: "bool"
322
+ }
323
+ ]
324
+ }],
325
+ stateMutability: "view"
326
+ },
327
+ {
328
+ type: "event",
329
+ name: "JobSubmitted",
330
+ inputs: [
331
+ {
332
+ name: "serviceId",
333
+ type: "uint64",
334
+ indexed: true
335
+ },
336
+ {
337
+ name: "callId",
338
+ type: "uint64",
339
+ indexed: true
340
+ },
341
+ {
342
+ name: "jobIndex",
343
+ type: "uint8",
344
+ indexed: false
345
+ },
346
+ {
347
+ name: "caller",
348
+ type: "address",
349
+ indexed: false
350
+ },
351
+ {
352
+ name: "inputs",
353
+ type: "bytes",
354
+ indexed: false
355
+ }
356
+ ]
357
+ },
358
+ {
359
+ type: "event",
360
+ name: "JobResultSubmitted",
361
+ inputs: [
362
+ {
363
+ name: "serviceId",
364
+ type: "uint64",
365
+ indexed: true
366
+ },
367
+ {
368
+ name: "callId",
369
+ type: "uint64",
370
+ indexed: true
371
+ },
372
+ {
373
+ name: "operator",
374
+ type: "address",
375
+ indexed: true
376
+ },
377
+ {
378
+ name: "result",
379
+ type: "bytes",
380
+ indexed: false
381
+ }
382
+ ]
383
+ }
384
+ ];
385
+ //#endregion
377
386
  //#region src/tangle/types.ts
378
387
  /**
379
388
  * Tangle Sandbox Client types and constants.
@@ -382,9 +391,6 @@ const AgentSandboxBlueprintAbi = [
382
391
  const TANGLE_CHAIN_ID = 5845;
383
392
  /** ITangleJobs precompile contract address. */
384
393
  const TANGLE_JOBS_CONTRACT = "0x0000000000000000000000000000000000000808";
385
- /** Job indices matching the blueprint's job IDs. */
386
- const JOB_SANDBOX_CREATE = 0;
387
- const JOB_SANDBOX_DELETE = 1;
388
394
  //#endregion
389
395
  //#region src/tangle/chain-client.ts
390
396
  function confidentialFromOptions(options) {
@@ -413,19 +419,19 @@ function teeCreateValues(options) {
413
419
  ];
414
420
  }
415
421
  var TangleChainClient = class {
416
- config;
422
+ #config;
417
423
  publicClient = null;
418
424
  walletClient = null;
419
425
  account = null;
420
426
  constructor(config) {
421
- this.config = config;
427
+ this.#config = config;
422
428
  }
423
429
  async ensureInitialized() {
424
430
  if (this.publicClient && this.walletClient) return {
425
431
  publicClient: this.publicClient,
426
432
  walletClient: this.walletClient
427
433
  };
428
- const rpcUrl = this.config.rpcUrl;
434
+ const rpcUrl = this.#config.rpcUrl;
429
435
  if (typeof rpcUrl !== "string" || rpcUrl.trim().length === 0) throw new Error("TangleSandboxClient requires rpcUrl: the SDK has no default Tangle RPC endpoint");
430
436
  let viem;
431
437
  try {
@@ -448,16 +454,16 @@ var TangleChainClient = class {
448
454
  chain,
449
455
  transport
450
456
  });
451
- if (this.config.privateKey) {
457
+ if (this.#config.privateKey) {
452
458
  const { privateKeyToAccount } = await import("viem/accounts");
453
- this.account = privateKeyToAccount(this.config.privateKey);
459
+ this.account = privateKeyToAccount(this.#config.privateKey);
454
460
  this.walletClient = viem.createWalletClient({
455
461
  account: this.account,
456
462
  chain,
457
463
  transport
458
464
  });
459
- } else if (this.config.wallet) {
460
- const wallet = this.config.wallet;
465
+ } else if (this.#config.wallet) {
466
+ const wallet = this.#config.wallet;
461
467
  this.walletClient = wallet;
462
468
  this.account = wallet.account ?? null;
463
469
  } else throw new Error("TangleSandboxClient requires either privateKey or wallet");
@@ -502,8 +508,8 @@ var TangleChainClient = class {
502
508
  async submitJobAndWait(jobIndex, encoded) {
503
509
  const { publicClient, walletClient } = await this.ensureInitialized();
504
510
  const viem = await import("viem");
505
- const contractAddress = this.config.contractAddress ?? "0x0000000000000000000000000000000000000808";
506
- const serviceId = this.config.serviceId;
511
+ const contractAddress = this.#config.contractAddress ?? "0x0000000000000000000000000000000000000808";
512
+ const serviceId = this.#config.serviceId;
507
513
  const inputs = viem.encodeAbiParameters(encoded.types, encoded.values);
508
514
  const hash = await walletClient.writeContract({
509
515
  address: contractAddress,
@@ -533,8 +539,8 @@ var TangleChainClient = class {
533
539
  data: jobSubmittedEvent.data,
534
540
  topics: jobSubmittedEvent.topics
535
541
  }).args.callId;
536
- const timeoutMs = this.config.jobTimeoutMs ?? 144e5;
537
- const pollIntervalMs = this.config.pollIntervalMs ?? 5e3;
542
+ const timeoutMs = this.#config.jobTimeoutMs ?? 144e5;
543
+ const pollIntervalMs = this.#config.pollIntervalMs ?? 5e3;
538
544
  const deadline = Date.now() + timeoutMs;
539
545
  while (Date.now() < deadline) {
540
546
  await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
@@ -555,12 +561,12 @@ var TangleChainClient = class {
555
561
  async getJobResult(callId, fromBlock) {
556
562
  const { publicClient } = await this.ensureInitialized();
557
563
  const viem = await import("viem");
558
- const contractAddress = this.config.contractAddress ?? "0x0000000000000000000000000000000000000808";
564
+ const contractAddress = this.#config.contractAddress ?? "0x0000000000000000000000000000000000000808";
559
565
  const logs = await publicClient.getLogs({
560
566
  address: contractAddress,
561
567
  event: viem.parseAbiItem("event JobResultSubmitted(uint64 indexed serviceId, uint64 indexed callId, address indexed operator, bytes result)"),
562
568
  args: {
563
- serviceId: this.config.serviceId,
569
+ serviceId: this.#config.serviceId,
564
570
  callId
565
571
  },
566
572
  fromBlock: fromBlock ?? "earliest"
@@ -570,9 +576,9 @@ var TangleChainClient = class {
570
576
  }
571
577
  async getAvailableCapacity() {
572
578
  const { publicClient } = await this.ensureInitialized();
573
- if (!this.config.blueprintContractAddress) throw new Error("blueprintContractAddress is required for getAvailableCapacity");
579
+ if (!this.#config.blueprintContractAddress) throw new Error("blueprintContractAddress is required for getAvailableCapacity");
574
580
  const result = await publicClient.readContract({
575
- address: this.config.blueprintContractAddress,
581
+ address: this.#config.blueprintContractAddress,
576
582
  abi: AgentSandboxBlueprintAbi,
577
583
  functionName: "getAvailableCapacity"
578
584
  });
@@ -580,9 +586,9 @@ var TangleChainClient = class {
580
586
  }
581
587
  async getServiceStats() {
582
588
  const { publicClient } = await this.ensureInitialized();
583
- if (!this.config.blueprintContractAddress) throw new Error("blueprintContractAddress is required for getServiceStats");
589
+ if (!this.#config.blueprintContractAddress) throw new Error("blueprintContractAddress is required for getServiceStats");
584
590
  const [totalSandboxes, totalCapacity] = await publicClient.readContract({
585
- address: this.config.blueprintContractAddress,
591
+ address: this.#config.blueprintContractAddress,
586
592
  abi: AgentSandboxBlueprintAbi,
587
593
  functionName: "getServiceStats"
588
594
  });
@@ -607,7 +613,7 @@ var TangleChainClient = class {
607
613
  await this.ensureInitialized();
608
614
  const account = this.account;
609
615
  if (!account) throw new Error("TangleChainClient has no account to sign with; privateKey or wallet is required");
610
- if (this.config.privateKey) {
616
+ if (this.#config.privateKey) {
611
617
  if (typeof account.signMessage !== "function") throw new Error("Configured account cannot sign messages; an EIP-191 signer is required for operator sessions");
612
618
  return account.signMessage({ message });
613
619
  }
@@ -635,10 +641,11 @@ var OperatorSessionError = class extends Error {
635
641
  * the caller retries with a fresh session on 401.
636
642
  */
637
643
  var OperatorSession = class OperatorSession {
644
+ #token;
638
645
  constructor(token, address, expiresAtMs) {
639
- this.token = token;
640
646
  this.address = address;
641
647
  this.expiresAtMs = expiresAtMs;
648
+ this.#token = token;
642
649
  }
643
650
  get signerAddress() {
644
651
  return this.address;
@@ -648,7 +655,7 @@ var OperatorSession = class OperatorSession {
648
655
  return nowMs >= this.expiresAtMs - SESSION_REFRESH_MARGIN_MS;
649
656
  }
650
657
  authorizationHeader() {
651
- return `Bearer ${this.token}`;
658
+ return `Bearer ${this.#token}`;
652
659
  }
653
660
  /**
654
661
  * Run the challenge-response flow against an operator API base URL.
@@ -846,15 +853,15 @@ function sandboxEntryFromWire(fallbackId, raw) {
846
853
  }
847
854
  var TangleSandboxClient = class {
848
855
  chain;
849
- sandboxes = /* @__PURE__ */ new Map();
856
+ #sandboxes = /* @__PURE__ */ new Map();
850
857
  operatorApiUrl;
851
- operatorApiToken;
858
+ #operatorApiToken;
852
859
  operatorSession = null;
853
860
  constructor(config) {
854
861
  if (!config.privateKey && !config.wallet) throw new Error("TangleSandboxClient requires either privateKey or wallet");
855
862
  this.chain = new TangleChainClient(config);
856
863
  this.operatorApiUrl = config.operatorApiUrl?.replace(/\/+$/, "");
857
- this.operatorApiToken = config.operatorApiToken;
864
+ this.#operatorApiToken = config.operatorApiToken;
858
865
  }
859
866
  /**
860
867
  * Create a sandbox via on-chain job submission.
@@ -905,7 +912,7 @@ var TangleSandboxClient = class {
905
912
  teePublicKeyJson: wireEntry.teePublicKeyJson ?? responseJson.teePublicKeyJson,
906
913
  attestationNonce: attestationNonceFromOptions(createOptions) ?? wireEntry.attestationNonce
907
914
  };
908
- this.sandboxes.set(sandboxId, entry);
915
+ this.#sandboxes.set(sandboxId, entry);
909
916
  if (tangleSecrets && Object.keys(tangleSecrets).length > 0) await this.injectSecrets(sandboxId, tangleSecrets);
910
917
  return createSandboxInstanceFromResponse(this, sandboxInfoFromEntry(entry));
911
918
  }
@@ -939,12 +946,12 @@ var TangleSandboxClient = class {
939
946
  const getMatch = path.match(/^\/v1\/sandboxes\/([^/]+)$/);
940
947
  if (getMatch && method === "GET") {
941
948
  const id = decodeURIComponent(requirePathGroup(getMatch, 1));
942
- let entry = this.sandboxes.get(id);
949
+ let entry = this.#sandboxes.get(id);
943
950
  if (this.operatorApiUrl) {
944
951
  const operatorResponse = await this.fetchOperatorApi(`/api/sandboxes/${encodeURIComponent(id)}`, { method: "GET" });
945
952
  if (!operatorResponse.ok) return operatorResponse;
946
953
  entry = sandboxEntryFromWire(id, await operatorResponse.json());
947
- this.sandboxes.set(entry.id, entry);
954
+ this.#sandboxes.set(entry.id, entry);
948
955
  }
949
956
  if (!entry) return new Response(JSON.stringify({ error: "Not found" }), { status: 404 });
950
957
  const info = sandboxInfoFromEntry(entry);
@@ -1012,20 +1019,20 @@ var TangleSandboxClient = class {
1012
1019
  const id = decodeURIComponent(requirePathGroup(deleteMatch, 1));
1013
1020
  const encoded = this.chain.encodeSandboxIdInputs(id);
1014
1021
  await this.chain.submitJobAndWait(1, encoded);
1015
- const entry = this.sandboxes.get(id);
1022
+ const entry = this.#sandboxes.get(id);
1016
1023
  if (entry) entry.status = "deleted";
1017
- this.sandboxes.delete(id);
1024
+ this.#sandboxes.delete(id);
1018
1025
  return new Response(null, { status: 204 });
1019
1026
  }
1020
1027
  throw new Error(`Operation not supported via on-chain client: ${method} ${path}`);
1021
1028
  }
1022
1029
  async fetchRuntime(sandboxId, runtimePath, options) {
1023
- let entry = this.sandboxes.get(sandboxId);
1030
+ let entry = this.#sandboxes.get(sandboxId);
1024
1031
  if (this.operatorApiUrl) {
1025
1032
  const operatorResponse = await this.fetchOperatorApi(`/api/sandboxes/${encodeURIComponent(sandboxId)}`, { method: "GET" });
1026
1033
  if (!operatorResponse.ok) return operatorResponse;
1027
1034
  entry = sandboxEntryFromWire(sandboxId, await operatorResponse.json());
1028
- this.sandboxes.set(entry.id, entry);
1035
+ this.#sandboxes.set(entry.id, entry);
1029
1036
  }
1030
1037
  const incarnation = entry ? classifyFilesystemIncarnation(entry) : void 0;
1031
1038
  if (!entry || !incarnation || !runtimeCredentialsAllowed(incarnation) || !entry.runtimeUrl || !entry.runtimeToken) return new Response(JSON.stringify({ error: "Sandbox runtime unavailable" }), {
@@ -1131,7 +1138,7 @@ var TangleSandboxClient = class {
1131
1138
  headers: { "Content-Type": "application/json" }
1132
1139
  });
1133
1140
  const headers = new Headers(options?.headers);
1134
- if (this.operatorApiToken && !headers.has("Authorization")) headers.set("Authorization", `Bearer ${this.operatorApiToken}`);
1141
+ if (this.#operatorApiToken && !headers.has("Authorization")) headers.set("Authorization", `Bearer ${this.#operatorApiToken}`);
1135
1142
  if (options?.body && !headers.has("Content-Type")) headers.set("Content-Type", "application/json");
1136
1143
  return fetch(`${this.operatorApiUrl}${path}`, {
1137
1144
  ...options,
@@ -2369,7 +2376,7 @@ function isAddressEqual(a, b) {
2369
2376
  //#region ../../../node_modules/.pnpm/viem@2.55.4_bufferutil@4.1.0_typescript@6.0.3_utf-8-validate@5.0.10_zod@4.6.5/node_modules/viem/_esm/utils/signature/recoverPublicKey.js
2370
2377
  async function recoverPublicKey({ hash, signature }) {
2371
2378
  const hashHex = isHex(hash) ? hash : toHex(hash);
2372
- const { secp256k1 } = await import("./secp256k1-Dx2XABHz.js");
2379
+ const { secp256k1 } = await import("./secp256k1-CmLpsmWl.js");
2373
2380
  return `0x${(() => {
2374
2381
  if (typeof signature === "object" && "r" in signature && "s" in signature) {
2375
2382
  const { r, s, v, yParity } = signature;
@@ -2845,4 +2852,4 @@ async function fetchQuote(operatorApiUrl, params) {
2845
2852
  return parseQuoteResponse(raw);
2846
2853
  }
2847
2854
  //#endregion
2848
- export { SandboxCreateParamTypes as _, parseQuoteResponse as a, OperatorSession as c, JOB_SANDBOX_DELETE as d, TANGLE_CHAIN_ID as f, JsonResponseParamTypes as g, ITangleJobsAbi as h, jobQuoteDigest as i, OperatorSessionError as l, AgentSandboxBlueprintAbi as m, fetchQuote as n, validateQuote as o, TANGLE_JOBS_CONTRACT as p, inputsHashOf as r, TangleSandboxClient as s, QuoteError as t, JOB_SANDBOX_CREATE as u, SandboxCreateResponseParamTypes as v, SandboxIdParamTypes as y };
2855
+ export { SandboxCreateParamTypes as _, parseQuoteResponse as a, OperatorSession as c, TANGLE_JOBS_CONTRACT as d, ITangleJobsAbi as f, JsonResponseParamTypes as g, JOB_SANDBOX_DELETE as h, jobQuoteDigest as i, OperatorSessionError as l, JOB_SANDBOX_CREATE as m, fetchQuote as n, validateQuote as o, AgentSandboxBlueprintAbi as p, inputsHashOf as r, TangleSandboxClient as s, QuoteError as t, TANGLE_CHAIN_ID as u, SandboxCreateResponseParamTypes as v, SandboxIdParamTypes as y };