@tangle-network/agent-provider-tangle 1.1.1 → 1.1.2

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/README.md CHANGED
@@ -241,6 +241,9 @@ if (checkpoint?.status === "created" || checkpoint?.status === "replayed") {
241
241
  ### Confidential forks
242
242
 
243
243
  Sandbox returns raw TEE evidence, not a verified claim.
244
+ The deployed Tangle job does not carry snapshot restore or sealed-persistence inputs.
245
+ The provider therefore refuses new confidential workspace forks before creation.
246
+ Existing confidential fork records still require a matching TEE report and an external verifier before they become trusted.
244
247
  Pass `confidentialAttestationVerifier` to `createTangleProvider` to connect a
245
248
  trusted provider-key and measurement verifier.
246
249
  The callback receives the raw report, the expected environment binding, and
@@ -86,6 +86,8 @@ export function defaultTangleSandboxCapabilities(harness) {
86
86
  branching: {
87
87
  checkpoint: true,
88
88
  fork: true,
89
+ // The deployed Tangle job does not carry snapshot restore inputs.
90
+ confidential: false,
89
91
  retrySafe: true,
90
92
  lookup: true,
91
93
  cleanup: true,
@@ -361,11 +363,12 @@ export function narrowedTangleCapabilities(declared, support, deployment, option
361
363
  // An incomplete Sandbox surface clears every branching flag together. A
362
364
  // partial claim would let a caller start an operation it cannot recover.
363
365
  branching: support.workspaceBranching
364
- ? { ...declaredBranching }
366
+ ? { ...declaredBranching, confidential: false }
365
367
  : {
366
368
  ...declaredBranching,
367
369
  checkpoint: false,
368
370
  fork: false,
371
+ confidential: false,
369
372
  ...(declaredBranching.retrySafe !== undefined ? { retrySafe: false } : {}),
370
373
  ...(declaredBranching.lookup !== undefined ? { lookup: false } : {}),
371
374
  ...(declaredBranching.cleanup !== undefined ? { cleanup: false } : {}),
@@ -16,6 +16,18 @@ const MAX_MARKER_TAG_LENGTH = 128;
16
16
  const MARKER_CHUNK_SIZE = 80;
17
17
  const LEGACY_MARKER_CHUNK_SIZE = 240;
18
18
  const MAX_MARKER_CHUNKS = 512;
19
+ const TANGLE_ATTESTATION_NONCE_PATTERN = /^(?:0x)?[0-9a-fA-F]{64}(?:[0-9a-fA-F]{64})?$/;
20
+ function confidentialForkRefusal(request) {
21
+ const confidential = request.confidential;
22
+ if (confidential?.requested !== true)
23
+ return undefined;
24
+ if (confidential.nonce === undefined ||
25
+ !TANGLE_ATTESTATION_NONCE_PATTERN.test(confidential.nonce))
26
+ return "Tangle confidential forks require a 32-64 byte hexadecimal attestation nonce";
27
+ if (confidential.sealed === true)
28
+ return "Tangle confidential forks cannot prove sealed no-persistence because the deployed job does not carry that requirement";
29
+ return "Tangle confidential workspace forks are unavailable because the deployed job does not carry snapshot restore inputs";
30
+ }
19
31
  /**
20
32
  * Carry the verifier only when the caller supplied one. Every option type that
21
33
  * accepts it is exact-optional, so an explicit `undefined` is not an absent key.
@@ -293,6 +305,10 @@ export function createTangleWorkspaceBranching(options) {
293
305
  if (known.state === "known") {
294
306
  return forkSuccess(request, known.record.environment, "replayed");
295
307
  }
308
+ const confidentialRefusal = confidentialForkRefusal(request);
309
+ if (confidentialRefusal !== undefined) {
310
+ return forkUnknown(request, confidentialRefusal, false);
311
+ }
296
312
  const checkpoint = [...checkpoints.values()].some((record) => canonicalCandidateDigest(record.checkpoint) ===
297
313
  canonicalCandidateDigest(request.checkpoint))
298
314
  ? true
@@ -624,6 +640,7 @@ async function confidentialAttestationForChild(request, child, provider, verifie
624
640
  const material = {
625
641
  provider,
626
642
  requested: true,
643
+ tee: response.attestation.tee_type,
627
644
  nonce: confidential.nonce,
628
645
  measurement,
629
646
  environmentId: child.id,
@@ -681,7 +698,7 @@ async function confidentialAttestationForChild(request, child, provider, verifie
681
698
  }
682
699
  function validTeeReport(report) {
683
700
  return (!!report &&
684
- safeString(report.tee_type) !== undefined &&
701
+ safeIdentifier(report.tee_type) !== undefined &&
685
702
  Array.isArray(report.evidence) &&
686
703
  report.evidence.length <= MAX_TEE_EVIDENCE_BYTES &&
687
704
  report.evidence.every((value) => Number.isInteger(value) && value >= 0 && value <= 255) &&
package/package.json CHANGED
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-provider-tangle",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "AgentEnvironmentProvider adapter for Tangle sandboxes",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
- "main": "dist/index.js",
8
- "types": "src/index.ts",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
11
  "import": "./dist/index.js",
12
- "types": "./src/index.ts"
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
13
14
  }
14
15
  },
15
16
  "repository": {
@@ -19,16 +20,7 @@
19
20
  },
20
21
  "publishConfig": {
21
22
  "access": "public",
22
- "registry": "https://registry.npmjs.org",
23
- "main": "./dist/index.js",
24
- "types": "./dist/index.d.ts",
25
- "exports": {
26
- ".": {
27
- "import": "./dist/index.js",
28
- "types": "./dist/index.d.ts",
29
- "default": "./dist/index.js"
30
- }
31
- }
23
+ "registry": "https://registry.npmjs.org"
32
24
  },
33
25
  "files": [
34
26
  "dist/index.d.ts",
@@ -98,15 +90,8 @@
98
90
  "README.md",
99
91
  "LICENSE"
100
92
  ],
101
- "scripts": {
102
- "build": "tsc -p tsconfig.json",
103
- "check-types": "tsc --noEmit",
104
- "clean": "rm -rf dist",
105
- "prepublishOnly": "pnpm run build",
106
- "test": "vitest run src"
107
- },
108
93
  "dependencies": {
109
- "@tangle-network/agent-interface": "^2.2.0"
94
+ "@tangle-network/agent-interface": "^2.3.0"
110
95
  },
111
96
  "peerDependencies": {
112
97
  "@tangle-network/sandbox": ">=0.34.6 <1.0.0"
@@ -118,11 +103,17 @@
118
103
  },
119
104
  "devDependencies": {
120
105
  "@tangle-network/agent-eval": "0.170.0",
121
- "@tangle-network/agent-provider-testkit": "workspace:*",
122
106
  "@tangle-network/agent-runtime": "0.184.0",
123
107
  "@tangle-network/sandbox": "0.34.6",
124
- "@types/node": "catalog:",
108
+ "@types/node": "26.4.0",
125
109
  "typescript": "7.0.2",
126
- "vitest": "catalog:"
110
+ "vitest": "4.1.11",
111
+ "@tangle-network/agent-provider-testkit": "0.9.0"
112
+ },
113
+ "scripts": {
114
+ "build": "tsc -p tsconfig.json",
115
+ "check-types": "tsc --noEmit",
116
+ "clean": "rm -rf dist",
117
+ "test": "vitest run src"
127
118
  }
128
- }
119
+ }