@tangle-network/agent-interface 2.2.0 → 2.3.0

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.
@@ -827,6 +827,8 @@ export interface AgentEnvironmentCapabilities {
827
827
  branching: {
828
828
  checkpoint: boolean;
829
829
  fork: boolean;
830
+ /** True only when a fork can preserve and prove confidential requirements. */
831
+ confidential?: boolean;
830
832
  /** True only when key + canonical request digest semantics are implemented. */
831
833
  retrySafe?: boolean;
832
834
  /** True only when operations can be recovered by idempotency key. */
@@ -984,6 +986,7 @@ export declare const AgentEnvironmentCapabilitiesSchema: z.ZodObject<{
984
986
  branching: z.ZodObject<{
985
987
  checkpoint: z.ZodBoolean;
986
988
  fork: z.ZodBoolean;
989
+ confidential: z.ZodOptional<z.ZodBoolean>;
987
990
  retrySafe: z.ZodOptional<z.ZodBoolean>;
988
991
  lookup: z.ZodOptional<z.ZodBoolean>;
989
992
  cleanup: z.ZodOptional<z.ZodBoolean>;
@@ -215,6 +215,7 @@ export const AgentEnvironmentCapabilitiesSchema = z
215
215
  branching: z.strictObject({
216
216
  checkpoint: z.boolean(),
217
217
  fork: z.boolean(),
218
+ confidential: z.boolean().optional(),
218
219
  retrySafe: z.boolean().optional(),
219
220
  lookup: z.boolean().optional(),
220
221
  cleanup: z.boolean().optional(),
@@ -9,6 +9,8 @@ import { type AgentExactRunControlRef } from "./runtime-control.js";
9
9
  export declare const ConfidentialAttestationSchema: z.ZodObject<{
10
10
  provider: z.ZodString;
11
11
  requested: z.ZodLiteral<true>;
12
+ tee: z.ZodOptional<z.ZodString>;
13
+ sealed: z.ZodOptional<z.ZodBoolean>;
12
14
  nonce: z.ZodString;
13
15
  measurement: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
14
16
  environmentId: z.ZodString;
@@ -32,11 +34,15 @@ export type ConfidentialAttestation = z.infer<typeof ConfidentialAttestationSche
32
34
  /** What the caller asked for, separate from what the provider proved. */
33
35
  export declare const ConfidentialExecutionRequestSchema: z.ZodObject<{
34
36
  requested: z.ZodBoolean;
37
+ tee: z.ZodOptional<z.ZodString>;
38
+ sealed: z.ZodOptional<z.ZodBoolean>;
35
39
  nonce: z.ZodOptional<z.ZodString>;
36
40
  policy: z.ZodOptional<z.ZodString>;
37
41
  profileDigest: z.ZodOptional<z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>>;
38
42
  }, z.core.$strict>;
39
43
  export type ConfidentialExecutionRequest = z.infer<typeof ConfidentialExecutionRequestSchema>;
44
+ /** Match one requested TEE against a provider-reported TEE identifier. */
45
+ export declare function confidentialTeeMatchesRequest(requested: string | undefined, attested: string | undefined): boolean;
40
46
  export interface ConfidentialExecutionEnvironment {
41
47
  provider: string;
42
48
  environmentId: string;
@@ -11,6 +11,10 @@ export const ConfidentialAttestationSchema = z
11
11
  .strictObject({
12
12
  provider: idSchema,
13
13
  requested: z.literal(true),
14
+ /** Provider-reported TEE type after external evidence verification. */
15
+ tee: idSchema.optional(),
16
+ /** Verified no-persistence posture, when the provider can prove it. */
17
+ sealed: z.boolean().optional(),
14
18
  nonce: idSchema,
15
19
  measurement: sha256DigestSchema,
16
20
  environmentId: idSchema,
@@ -43,11 +47,18 @@ export const ConfidentialAttestationSchema = z
43
47
  export const ConfidentialExecutionRequestSchema = z
44
48
  .strictObject({
45
49
  requested: z.boolean(),
50
+ /** Requested TEE. Omit it to accept any provider-supported TEE. */
51
+ tee: idSchema.optional(),
52
+ /** Require the provider to avoid persistence after the environment ends. */
53
+ sealed: z.boolean().optional(),
46
54
  nonce: idSchema.optional(),
47
55
  policy: idSchema.optional(),
48
56
  profileDigest: sha256DigestSchema.optional(),
49
57
  })
50
58
  .superRefine((request, refinement) => {
59
+ const carriesAdmissionField = request.nonce !== undefined ||
60
+ request.policy !== undefined ||
61
+ request.profileDigest !== undefined;
51
62
  const complete = request.nonce !== undefined &&
52
63
  request.policy !== undefined &&
53
64
  request.profileDigest !== undefined;
@@ -58,14 +69,48 @@ export const ConfidentialExecutionRequestSchema = z
58
69
  message: "a confidential execution request must bind nonce, policy, and profile digest",
59
70
  });
60
71
  }
61
- if (!request.requested && complete) {
72
+ if (!request.requested &&
73
+ (carriesAdmissionField ||
74
+ request.tee !== undefined ||
75
+ request.sealed !== undefined)) {
62
76
  refinement.addIssue({
63
77
  code: "custom",
64
78
  path: ["requested"],
65
- message: "a non-confidential execution request cannot carry confidential admission fields",
79
+ message: "a non-confidential execution request cannot carry confidential requirements or admission fields",
66
80
  });
67
81
  }
68
82
  });
83
+ function normalizedTeeId(value) {
84
+ const normalized = value.trim().toLowerCase().replaceAll("_", "-");
85
+ switch (normalized) {
86
+ case "aws-nitro":
87
+ case "aws-nitro-enclave":
88
+ case "aws-nitro-enclaves":
89
+ return "nitro";
90
+ case "intel-tdx":
91
+ return "tdx";
92
+ case "amd-sev":
93
+ case "amd-sev-snp":
94
+ case "sev":
95
+ return "sev-snp";
96
+ case "dstack":
97
+ case "phala":
98
+ return "phala-dstack";
99
+ default:
100
+ return normalized;
101
+ }
102
+ }
103
+ /** Match one requested TEE against a provider-reported TEE identifier. */
104
+ export function confidentialTeeMatchesRequest(requested, attested) {
105
+ if (attested === undefined)
106
+ return requested === undefined;
107
+ const normalizedAttested = normalizedTeeId(attested);
108
+ if (normalizedAttested === "none")
109
+ return false;
110
+ if (requested === undefined || normalizedTeeId(requested) === "any")
111
+ return true;
112
+ return (normalizedAttested === normalizedTeeId(requested));
113
+ }
69
114
  /**
70
115
  * Verify every request/result binding and require an external provider-key
71
116
  * check before exposing a positive confidentiality result.
@@ -104,6 +149,8 @@ export function confidentialExecutionVerified(input) {
104
149
  attestation.nonce !== request.nonce ||
105
150
  attestation.policy !== request.policy ||
106
151
  attestation.profileDigest !== request.profileDigest ||
152
+ !confidentialTeeMatchesRequest(request.tee, attestation.tee) ||
153
+ (request.sealed === true && attestation.sealed !== true) ||
107
154
  environment.confidentialRequested !== request.requested) {
108
155
  return false;
109
156
  }
@@ -114,6 +161,8 @@ export function confidentialExecutionRequestDigest(request) {
114
161
  const parsed = ConfidentialExecutionRequestSchema.parse(request);
115
162
  return wireDigest({
116
163
  requested: parsed.requested,
164
+ ...(parsed.tee === undefined ? {} : { tee: parsed.tee }),
165
+ ...(parsed.sealed === undefined ? {} : { sealed: parsed.sealed }),
117
166
  ...(parsed.nonce === undefined ? {} : { nonce: parsed.nonce }),
118
167
  ...(parsed.policy === undefined ? {} : { policy: parsed.policy }),
119
168
  ...(parsed.profileDigest === undefined
@@ -52,6 +52,8 @@ export declare const WorkspaceForkRequestSchema: z.ZodObject<{
52
52
  }, z.core.$strict>;
53
53
  confidential: z.ZodOptional<z.ZodObject<{
54
54
  requested: z.ZodBoolean;
55
+ tee: z.ZodOptional<z.ZodString>;
56
+ sealed: z.ZodOptional<z.ZodBoolean>;
55
57
  nonce: z.ZodOptional<z.ZodString>;
56
58
  policy: z.ZodOptional<z.ZodString>;
57
59
  profileDigest: z.ZodOptional<z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>>;
@@ -115,6 +117,8 @@ export declare const ForkedEnvironmentRefSchema: z.ZodObject<{
115
117
  confidentialAttestation: z.ZodOptional<z.ZodObject<{
116
118
  provider: z.ZodString;
117
119
  requested: z.ZodLiteral<true>;
120
+ tee: z.ZodOptional<z.ZodString>;
121
+ sealed: z.ZodOptional<z.ZodBoolean>;
118
122
  nonce: z.ZodString;
119
123
  measurement: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
120
124
  environmentId: z.ZodString;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-interface",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",