@kya-os/contracts 1.7.33 → 1.8.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.
@@ -206,18 +206,18 @@ export declare const SessionContextSchema: z.ZodObject<{
206
206
  /**
207
207
  * Delegation VC credential ID for the active delegation.
208
208
  * Set after delegation verification succeeds for a protected tool call.
209
- * Used by outbound fetch interceptors to inject X-Delegation-Id header.
209
+ * Used by outbound fetch interceptors to inject KYA-Delegation-Id header.
210
210
  */
211
211
  delegationRef: z.ZodOptional<z.ZodString>;
212
212
  /**
213
213
  * Reference chain string for the delegation hierarchy.
214
214
  * Format: "vc_id_1>del_id_1>vc_id_2>del_id_2"
215
- * Used by outbound fetch interceptors to inject X-Delegation-Chain header.
215
+ * Used by outbound fetch interceptors to inject KYA-Delegation-Chain header.
216
216
  */
217
217
  delegationChain: z.ZodOptional<z.ZodString>;
218
218
  /**
219
219
  * Scopes granted by the active delegation.
220
- * Used by outbound fetch interceptors to inject X-Scopes header.
220
+ * Used by outbound fetch interceptors to inject KYA-Granted-Scopes header.
221
221
  */
222
222
  delegationScopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
223
223
  }, "strip", z.ZodTypeAny, {
package/dist/handshake.js CHANGED
@@ -78,18 +78,18 @@ exports.SessionContextSchema = zod_1.z.object({
78
78
  /**
79
79
  * Delegation VC credential ID for the active delegation.
80
80
  * Set after delegation verification succeeds for a protected tool call.
81
- * Used by outbound fetch interceptors to inject X-Delegation-Id header.
81
+ * Used by outbound fetch interceptors to inject KYA-Delegation-Id header.
82
82
  */
83
83
  delegationRef: zod_1.z.string().optional(),
84
84
  /**
85
85
  * Reference chain string for the delegation hierarchy.
86
86
  * Format: "vc_id_1>del_id_1>vc_id_2>del_id_2"
87
- * Used by outbound fetch interceptors to inject X-Delegation-Chain header.
87
+ * Used by outbound fetch interceptors to inject KYA-Delegation-Chain header.
88
88
  */
89
89
  delegationChain: zod_1.z.string().optional(),
90
90
  /**
91
91
  * Scopes granted by the active delegation.
92
- * Used by outbound fetch interceptors to inject X-Scopes header.
92
+ * Used by outbound fetch interceptors to inject KYA-Granted-Scopes header.
93
93
  */
94
94
  delegationScopes: zod_1.z.array(zod_1.z.string()).optional(),
95
95
  });
@@ -13,36 +13,36 @@
13
13
  */
14
14
  export interface DownstreamHeaders {
15
15
  /** DID of the verified agent */
16
- 'X-Agent-DID': string;
16
+ 'KYA-Agent-DID': string;
17
17
  /** Optional delegation ID */
18
- 'X-Delegation-Id'?: string;
18
+ 'KYA-Delegation-Id'?: string;
19
19
  /** Optional delegation chain (format: vc_id>del_id>...) */
20
- 'X-Delegation-Chain'?: string;
20
+ 'KYA-Delegation-Chain'?: string;
21
21
  /** Proof ID for audit trail */
22
- 'X-MCPI-Proof-Id': string;
22
+ 'KYA-Proof-Id': string;
23
23
  /** Optional CRISP spend info (JSON string: {unit, delta, remaining}) */
24
- 'X-CRISP-Spend'?: string;
24
+ 'KYA-CRISP-Spend'?: string;
25
25
  /** Optional session ID */
26
- 'X-Session-Id'?: string;
26
+ 'KYA-Session-Id'?: string;
27
27
  /** Optional scopes */
28
- 'X-Scopes'?: string;
28
+ 'KYA-Granted-Scopes'?: string;
29
29
  }
30
30
  /**
31
31
  * Header names as constants for type safety
32
32
  */
33
33
  export declare const DOWNSTREAM_HEADER_NAMES: Readonly<{
34
- readonly AGENT_DID: "X-Agent-DID";
35
- readonly DELEGATION_ID: "X-Delegation-Id";
36
- readonly DELEGATION_CHAIN: "X-Delegation-Chain";
37
- readonly PROOF_ID: "X-MCPI-Proof-Id";
38
- readonly CRISP_SPEND: "X-CRISP-Spend";
39
- readonly SESSION_ID: "X-Session-Id";
40
- readonly SCOPES: "X-Scopes";
34
+ readonly AGENT_DID: "KYA-Agent-DID";
35
+ readonly DELEGATION_ID: "KYA-Delegation-Id";
36
+ readonly DELEGATION_CHAIN: "KYA-Delegation-Chain";
37
+ readonly PROOF_ID: "KYA-Proof-Id";
38
+ readonly CRISP_SPEND: "KYA-CRISP-Spend";
39
+ readonly SESSION_ID: "KYA-Session-Id";
40
+ readonly SCOPES: "KYA-Granted-Scopes";
41
41
  }>;
42
42
  /**
43
43
  * CRISP Spend Info
44
44
  *
45
- * Structure for X-CRISP-Spend header value
45
+ * Structure for KYA-CRISP-Spend header value
46
46
  */
47
47
  export interface CrispSpendInfo {
48
48
  /** Unit of spending */
@@ -81,4 +81,3 @@ export declare function createDownstreamHeaders(config: {
81
81
  sessionId?: string;
82
82
  scopes?: string[];
83
83
  }): DownstreamHeaders;
84
- //# sourceMappingURL=headers.d.ts.map
@@ -16,13 +16,13 @@ exports.createDownstreamHeaders = createDownstreamHeaders;
16
16
  * Header names as constants for type safety
17
17
  */
18
18
  exports.DOWNSTREAM_HEADER_NAMES = Object.freeze({
19
- AGENT_DID: 'X-Agent-DID',
20
- DELEGATION_ID: 'X-Delegation-Id',
21
- DELEGATION_CHAIN: 'X-Delegation-Chain',
22
- PROOF_ID: 'X-MCPI-Proof-Id',
23
- CRISP_SPEND: 'X-CRISP-Spend',
24
- SESSION_ID: 'X-Session-Id',
25
- SCOPES: 'X-Scopes',
19
+ AGENT_DID: 'KYA-Agent-DID',
20
+ DELEGATION_ID: 'KYA-Delegation-Id',
21
+ DELEGATION_CHAIN: 'KYA-Delegation-Chain',
22
+ PROOF_ID: 'KYA-Proof-Id',
23
+ CRISP_SPEND: 'KYA-CRISP-Spend',
24
+ SESSION_ID: 'KYA-Session-Id',
25
+ SCOPES: 'KYA-Granted-Scopes',
26
26
  });
27
27
  /**
28
28
  * Helper to serialize CRISP spend info to header value
@@ -59,24 +59,23 @@ function parseCrispSpend(headerValue) {
59
59
  */
60
60
  function createDownstreamHeaders(config) {
61
61
  const headers = {
62
- 'X-Agent-DID': config.agentDid,
63
- 'X-MCPI-Proof-Id': config.proofId,
62
+ 'KYA-Agent-DID': config.agentDid,
63
+ 'KYA-Proof-Id': config.proofId,
64
64
  };
65
65
  if (config.delegationId) {
66
- headers['X-Delegation-Id'] = config.delegationId;
66
+ headers['KYA-Delegation-Id'] = config.delegationId;
67
67
  }
68
68
  if (config.delegationChain) {
69
- headers['X-Delegation-Chain'] = config.delegationChain;
69
+ headers['KYA-Delegation-Chain'] = config.delegationChain;
70
70
  }
71
71
  if (config.crispSpend) {
72
- headers['X-CRISP-Spend'] = serializeCrispSpend(config.crispSpend);
72
+ headers['KYA-CRISP-Spend'] = serializeCrispSpend(config.crispSpend);
73
73
  }
74
74
  if (config.sessionId) {
75
- headers['X-Session-Id'] = config.sessionId;
75
+ headers['KYA-Session-Id'] = config.sessionId;
76
76
  }
77
77
  if (config.scopes && config.scopes.length > 0) {
78
- headers['X-Scopes'] = config.scopes.join(',');
78
+ headers['KYA-Granted-Scopes'] = config.scopes.join(',');
79
79
  }
80
80
  return headers;
81
81
  }
82
- //# sourceMappingURL=headers.js.map
@@ -19,4 +19,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
20
  __exportStar(require("./errors.js"), exports);
21
21
  __exportStar(require("./headers.js"), exports);
22
- //# sourceMappingURL=index.js.map
@@ -16,4 +16,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  // Re-export everything from the main verifier file
18
18
  __exportStar(require("../verifier"), exports);
19
- //# sourceMappingURL=index.js.map
@@ -13,10 +13,10 @@ export declare const AgentContextSchema: z.ZodObject<{
13
13
  registry: z.ZodString;
14
14
  verifiedAt: z.ZodNumber;
15
15
  }, "strip", z.ZodTypeAny, {
16
- scopes: string[];
17
16
  did: string;
18
17
  kid: string;
19
18
  session: string;
19
+ scopes: string[];
20
20
  confidence: "verified";
21
21
  registry: string;
22
22
  verifiedAt: number;
@@ -29,9 +29,9 @@ export declare const AgentContextSchema: z.ZodObject<{
29
29
  confidence: "verified";
30
30
  registry: string;
31
31
  verifiedAt: number;
32
- scopes?: string[] | undefined;
33
32
  subject?: string | undefined;
34
33
  delegationRef?: string | undefined;
34
+ scopes?: string[] | undefined;
35
35
  }>;
36
36
  export declare const VerifierResultSchema: z.ZodObject<{
37
37
  success: z.ZodBoolean;
@@ -47,10 +47,10 @@ export declare const VerifierResultSchema: z.ZodObject<{
47
47
  registry: z.ZodString;
48
48
  verifiedAt: z.ZodNumber;
49
49
  }, "strip", z.ZodTypeAny, {
50
- scopes: string[];
51
50
  did: string;
52
51
  kid: string;
53
52
  session: string;
53
+ scopes: string[];
54
54
  confidence: "verified";
55
55
  registry: string;
56
56
  verifiedAt: number;
@@ -63,9 +63,9 @@ export declare const VerifierResultSchema: z.ZodObject<{
63
63
  confidence: "verified";
64
64
  registry: string;
65
65
  verifiedAt: number;
66
- scopes?: string[] | undefined;
67
66
  subject?: string | undefined;
68
67
  delegationRef?: string | undefined;
68
+ scopes?: string[] | undefined;
69
69
  }>>;
70
70
  error: z.ZodOptional<z.ZodObject<{
71
71
  code: z.ZodString;
@@ -85,32 +85,26 @@ export declare const VerifierResultSchema: z.ZodObject<{
85
85
  }>>;
86
86
  }, "strip", z.ZodTypeAny, {
87
87
  success: boolean;
88
- error?: {
89
- code: string;
90
- message: string;
91
- httpStatus: number;
92
- details?: any;
93
- } | undefined;
94
88
  headers?: Record<string, string> | undefined;
95
89
  agentContext?: {
96
- scopes: string[];
97
90
  did: string;
98
91
  kid: string;
99
92
  session: string;
93
+ scopes: string[];
100
94
  confidence: "verified";
101
95
  registry: string;
102
96
  verifiedAt: number;
103
97
  subject?: string | undefined;
104
98
  delegationRef?: string | undefined;
105
99
  } | undefined;
106
- }, {
107
- success: boolean;
108
100
  error?: {
109
101
  code: string;
110
102
  message: string;
111
103
  httpStatus: number;
112
104
  details?: any;
113
105
  } | undefined;
106
+ }, {
107
+ success: boolean;
114
108
  headers?: Record<string, string> | undefined;
115
109
  agentContext?: {
116
110
  did: string;
@@ -119,9 +113,15 @@ export declare const VerifierResultSchema: z.ZodObject<{
119
113
  confidence: "verified";
120
114
  registry: string;
121
115
  verifiedAt: number;
122
- scopes?: string[] | undefined;
123
116
  subject?: string | undefined;
124
117
  delegationRef?: string | undefined;
118
+ scopes?: string[] | undefined;
119
+ } | undefined;
120
+ error?: {
121
+ code: string;
122
+ message: string;
123
+ httpStatus: number;
124
+ details?: any;
125
125
  } | undefined;
126
126
  }>;
127
127
  export declare const StructuredErrorSchema: z.ZodObject<{
@@ -169,15 +169,15 @@ export type AgentContext = z.infer<typeof AgentContextSchema>;
169
169
  export type VerifierResult = z.infer<typeof VerifierResultSchema>;
170
170
  export type StructuredError = z.infer<typeof StructuredErrorSchema>;
171
171
  export declare const AGENT_HEADERS: {
172
- readonly DID: "X-Agent-DID";
173
- readonly KEY_ID: "X-Agent-KeyId";
174
- readonly SUBJECT: "X-Agent-Subject";
175
- readonly SCOPES: "X-Agent-Scopes";
176
- readonly SESSION: "X-Agent-Session";
177
- readonly CONFIDENCE: "X-Agent-Confidence";
178
- readonly DELEGATION_REF: "X-Agent-Delegation-Ref";
179
- readonly REGISTRY: "X-Agent-Registry";
180
- readonly VERIFIED_AT: "X-Agent-Verified-At";
172
+ readonly DID: "KYA-Agent-DID";
173
+ readonly KEY_ID: "KYA-Agent-KeyId";
174
+ readonly SUBJECT: "KYA-Agent-Subject";
175
+ readonly SCOPES: "KYA-Agent-Scopes";
176
+ readonly SESSION: "KYA-Agent-Session";
177
+ readonly CONFIDENCE: "KYA-Agent-Confidence";
178
+ readonly DELEGATION_REF: "KYA-Delegation-Ref";
179
+ readonly REGISTRY: "KYA-Agent-Registry";
180
+ readonly VERIFIED_AT: "KYA-Verified-At";
181
181
  };
182
182
  export declare const VERIFIER_ERROR_CODES: {
183
183
  readonly PROOF_INVALID_TS: "XMCP_I_PROOF_INVALID_TS";
@@ -203,4 +203,3 @@ export declare const ERROR_HTTP_STATUS: {
203
203
  readonly XMCP_I_SESSION_IDLE_EXPIRED: 401;
204
204
  readonly XMCP_I_SERVER_TIME_INVALID: 500;
205
205
  };
206
- //# sourceMappingURL=verifier.d.ts.map
package/dist/verifier.js CHANGED
@@ -44,15 +44,15 @@ exports.StructuredErrorSchema = zod_1.z.object({
44
44
  });
45
45
  // Header constants (frozen names)
46
46
  exports.AGENT_HEADERS = {
47
- DID: "X-Agent-DID",
48
- KEY_ID: "X-Agent-KeyId",
49
- SUBJECT: "X-Agent-Subject",
50
- SCOPES: "X-Agent-Scopes",
51
- SESSION: "X-Agent-Session",
52
- CONFIDENCE: "X-Agent-Confidence",
53
- DELEGATION_REF: "X-Agent-Delegation-Ref",
54
- REGISTRY: "X-Agent-Registry",
55
- VERIFIED_AT: "X-Agent-Verified-At",
47
+ DID: "KYA-Agent-DID",
48
+ KEY_ID: "KYA-Agent-KeyId",
49
+ SUBJECT: "KYA-Agent-Subject",
50
+ SCOPES: "KYA-Agent-Scopes",
51
+ SESSION: "KYA-Agent-Session",
52
+ CONFIDENCE: "KYA-Agent-Confidence",
53
+ DELEGATION_REF: "KYA-Delegation-Ref",
54
+ REGISTRY: "KYA-Agent-Registry",
55
+ VERIFIED_AT: "KYA-Verified-At",
56
56
  };
57
57
  // Verifier-specific error codes
58
58
  exports.VERIFIER_ERROR_CODES = {
@@ -81,4 +81,3 @@ exports.ERROR_HTTP_STATUS = {
81
81
  [exports.VERIFIER_ERROR_CODES.SESSION_IDLE_EXPIRED]: 401,
82
82
  [exports.VERIFIER_ERROR_CODES.SERVER_TIME_INVALID]: 500,
83
83
  };
84
- //# sourceMappingURL=verifier.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kya-os/contracts",
3
- "version": "1.7.33",
3
+ "version": "1.8.0",
4
4
  "description": "Shared contracts, types, and schemas for MCP-I framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",