@kya-os/contracts 1.5.3-canary.2 → 1.5.3-canary.20

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 (90) hide show
  1. package/.turbo/turbo-build.log +17 -0
  2. package/.turbo/turbo-test$colon$coverage.log +85 -0
  3. package/.turbo/turbo-test.log +32 -0
  4. package/coverage/coverage-final.json +38 -0
  5. package/dist/agentshield-api/admin-schemas.d.ts +2 -2
  6. package/dist/agentshield-api/index.d.ts +1 -1
  7. package/dist/agentshield-api/schemas.d.ts +150 -48
  8. package/dist/agentshield-api/schemas.js +32 -4
  9. package/dist/agentshield-api/types.d.ts +31 -4
  10. package/dist/audit/index.d.ts +193 -0
  11. package/dist/audit/index.js +100 -0
  12. package/dist/config/identity.d.ts +205 -2
  13. package/dist/config/identity.js +28 -0
  14. package/dist/config/index.d.ts +2 -1
  15. package/dist/config/tool-context.d.ts +34 -0
  16. package/dist/config/tool-context.js +13 -0
  17. package/dist/consent/schemas.d.ts +119 -93
  18. package/dist/consent/schemas.js +111 -64
  19. package/dist/dashboard-config/schemas.d.ts +1949 -693
  20. package/dist/handshake.d.ts +14 -14
  21. package/dist/index.d.ts +1 -0
  22. package/dist/index.js +2 -0
  23. package/dist/tool-protection/index.d.ts +430 -2
  24. package/dist/tool-protection/index.js +62 -2
  25. package/dist/verifier/index.d.ts +1 -0
  26. package/dist/verifier/index.js +18 -0
  27. package/dist/well-known/index.d.ts +2 -2
  28. package/package.json +43 -122
  29. package/schemas/cli/register-output/v1.0.0.json +69 -0
  30. package/schemas/identity/v1.0.0.json +46 -0
  31. package/schemas/proof/v1.0.0.json +80 -0
  32. package/schemas/registry/receipt-v1.0.0.json +60 -0
  33. package/schemas/verifier/verify-page/v1.0.0.json +94 -0
  34. package/schemas/well-known/agent/v1.0.0.json +67 -0
  35. package/schemas/well-known/did/v1.0.0.json +174 -0
  36. package/scripts/emit-schemas.js +11 -0
  37. package/src/agentshield-api/admin-schemas.ts +31 -0
  38. package/src/agentshield-api/admin-types.ts +47 -0
  39. package/src/agentshield-api/endpoints.ts +60 -0
  40. package/src/agentshield-api/index.ts +70 -0
  41. package/src/agentshield-api/schemas.ts +304 -0
  42. package/src/agentshield-api/types.ts +317 -0
  43. package/src/audit/index.ts +128 -0
  44. package/src/cli.ts +156 -0
  45. package/src/config/base.ts +107 -0
  46. package/src/config/builder.ts +97 -0
  47. package/src/config/delegation.ts +232 -0
  48. package/src/config/identity.ts +252 -0
  49. package/src/config/index.ts +78 -0
  50. package/src/config/proofing.ts +138 -0
  51. package/src/config/tool-context.ts +41 -0
  52. package/src/config/tool-protection.ts +174 -0
  53. package/src/consent/index.ts +32 -0
  54. package/src/consent/schemas.ts +334 -0
  55. package/src/consent/types.ts +199 -0
  56. package/src/dashboard-config/default-config.json +86 -0
  57. package/src/dashboard-config/default-config.ts +266 -0
  58. package/src/dashboard-config/index.ts +48 -0
  59. package/src/dashboard-config/schemas.ts +286 -0
  60. package/src/dashboard-config/types.ts +404 -0
  61. package/src/delegation/constraints.ts +267 -0
  62. package/src/delegation/index.ts +8 -0
  63. package/src/delegation/schemas.ts +595 -0
  64. package/src/did/index.ts +9 -0
  65. package/src/did/resolve-contract.ts +255 -0
  66. package/src/did/schemas.ts +190 -0
  67. package/src/did/types.ts +224 -0
  68. package/src/env/constants.ts +70 -0
  69. package/src/env/index.ts +5 -0
  70. package/src/handshake.ts +125 -0
  71. package/src/index.ts +45 -0
  72. package/src/proof/index.ts +31 -0
  73. package/src/proof/proof-record.ts +163 -0
  74. package/src/proof/signing-spec.ts +146 -0
  75. package/src/proof.ts +99 -0
  76. package/src/registry.ts +146 -0
  77. package/src/runtime/errors.ts +153 -0
  78. package/src/runtime/headers.ts +136 -0
  79. package/src/runtime/index.ts +6 -0
  80. package/src/test.ts +143 -0
  81. package/src/tlkrc/index.ts +5 -0
  82. package/src/tlkrc/rotation.ts +153 -0
  83. package/src/tool-protection/index.ts +343 -0
  84. package/src/utils/validation.ts +93 -0
  85. package/src/vc/index.ts +8 -0
  86. package/src/vc/schemas.ts +277 -0
  87. package/src/vc/statuslist.ts +279 -0
  88. package/src/verifier/index.ts +2 -0
  89. package/src/verifier.ts +92 -0
  90. package/src/well-known/index.ts +237 -0
@@ -9,7 +9,7 @@
9
9
  * @module @kya-os/contracts/tool-protection
10
10
  */
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.DelegationRequiredErrorDataSchema = exports.ToolProtectionResponseSchema = exports.ToolProtectionMapSchema = exports.ToolProtectionSchema = void 0;
12
+ exports.DelegationRequiredErrorDataSchema = exports.ToolProtectionResponseSchema = exports.ToolProtectionMapSchema = exports.ToolProtectionSchema = exports.AuthorizationRequirementSchema = void 0;
13
13
  exports.isToolProtection = isToolProtection;
14
14
  exports.isToolProtectionMap = isToolProtectionMap;
15
15
  exports.isToolProtectionResponse = isToolProtectionResponse;
@@ -22,14 +22,42 @@ exports.toolRequiresDelegation = toolRequiresDelegation;
22
22
  exports.getToolRequiredScopes = getToolRequiredScopes;
23
23
  exports.getToolRiskLevel = getToolRiskLevel;
24
24
  exports.createDelegationRequiredError = createDelegationRequiredError;
25
+ exports.normalizeToolProtection = normalizeToolProtection;
25
26
  const zod_1 = require("zod");
26
27
  /**
27
28
  * Zod Schemas for Validation
28
29
  */
30
+ exports.AuthorizationRequirementSchema = zod_1.z.discriminatedUnion('type', [
31
+ zod_1.z.object({
32
+ type: zod_1.z.literal('oauth'),
33
+ provider: zod_1.z.string(),
34
+ requiredScopes: zod_1.z.array(zod_1.z.string()).optional(),
35
+ }),
36
+ zod_1.z.object({
37
+ type: zod_1.z.literal('mdl'),
38
+ issuer: zod_1.z.string(),
39
+ credentialType: zod_1.z.string().optional(),
40
+ }),
41
+ zod_1.z.object({
42
+ type: zod_1.z.literal('idv'),
43
+ provider: zod_1.z.string(),
44
+ verificationLevel: zod_1.z.enum(['basic', 'enhanced', 'loa3']).optional(),
45
+ }),
46
+ zod_1.z.object({
47
+ type: zod_1.z.literal('credential'),
48
+ credentialType: zod_1.z.string(),
49
+ issuer: zod_1.z.string().optional(),
50
+ }),
51
+ zod_1.z.object({
52
+ type: zod_1.z.literal('none'),
53
+ }),
54
+ ]);
29
55
  exports.ToolProtectionSchema = zod_1.z.object({
30
56
  requiresDelegation: zod_1.z.boolean(),
31
57
  requiredScopes: zod_1.z.array(zod_1.z.string()),
32
- riskLevel: zod_1.z.enum(['low', 'medium', 'high', 'critical']).optional()
58
+ riskLevel: zod_1.z.enum(['low', 'medium', 'high', 'critical']).optional(),
59
+ oauthProvider: zod_1.z.string().optional(), // Phase 2: Tool-specific OAuth provider
60
+ authorization: exports.AuthorizationRequirementSchema.optional(),
33
61
  });
34
62
  exports.ToolProtectionMapSchema = zod_1.z.record(zod_1.z.string(), exports.ToolProtectionSchema);
35
63
  exports.ToolProtectionResponseSchema = zod_1.z.object({
@@ -111,3 +139,35 @@ function createDelegationRequiredError(toolName, requiredScopes, consentUrl) {
111
139
  authorizationUrl: consentUrl // Include both for compatibility
112
140
  };
113
141
  }
142
+ /**
143
+ * Normalize tool protection configuration
144
+ * Migrates legacy oauthProvider field to authorization object
145
+ *
146
+ * // TODO: Remove normalizeToolProtection() when all tools migrated (target: Phase 3)
147
+ */
148
+ function normalizeToolProtection(raw) {
149
+ // If authorization is already present, return as is
150
+ if (raw.authorization) {
151
+ return raw;
152
+ }
153
+ // Migrate oauthProvider to authorization
154
+ if (raw.oauthProvider) {
155
+ return {
156
+ ...raw,
157
+ authorization: {
158
+ type: 'oauth',
159
+ provider: raw.oauthProvider,
160
+ },
161
+ // Keep oauthProvider for backward compatibility until Phase 3
162
+ };
163
+ }
164
+ // Default for requiresDelegation=true without specific auth: type='none' (consent only)
165
+ // But ONLY if authorization is missing entirely
166
+ if (raw.requiresDelegation && !raw.authorization && !raw.oauthProvider) {
167
+ // We don't automatically set type='none' here to allow
168
+ // ProviderResolver to do its scope inference fallback logic.
169
+ // The fallback logic will eventually be moved into an AuthorizationService.
170
+ return raw;
171
+ }
172
+ return raw;
173
+ }
@@ -0,0 +1 @@
1
+ export * from "../verifier";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ // Re-export everything from the main verifier file
18
+ __exportStar(require("../verifier"), exports);
@@ -209,12 +209,12 @@ export declare const AgentDocumentSchema: z.ZodObject<{
209
209
  description?: string | undefined;
210
210
  }>>;
211
211
  }, "strip", z.ZodTypeAny, {
212
- id: string;
213
212
  capabilities: {
214
213
  'mcp-i': ("handshake" | "signing" | "verification" | "delegation" | "proof-generation")[];
215
214
  } & {
216
215
  [k: string]: string[];
217
216
  };
217
+ id: string;
218
218
  metadata?: {
219
219
  version?: string | undefined;
220
220
  name?: string | undefined;
@@ -222,12 +222,12 @@ export declare const AgentDocumentSchema: z.ZodObject<{
222
222
  description?: string | undefined;
223
223
  } | undefined;
224
224
  }, {
225
- id: string;
226
225
  capabilities: {
227
226
  'mcp-i': ("handshake" | "signing" | "verification" | "delegation" | "proof-generation")[];
228
227
  } & {
229
228
  [k: string]: string[];
230
229
  };
230
+ id: string;
231
231
  metadata?: {
232
232
  version?: string | undefined;
233
233
  name?: string | undefined;
package/package.json CHANGED
@@ -1,156 +1,77 @@
1
1
  {
2
2
  "name": "@kya-os/contracts",
3
- "version": "1.5.3-canary.2",
4
- "description": "Shared types and schemas for XMCP-I ecosystem",
5
- "type": "commonjs",
6
- "sideEffects": false,
7
- "main": "./dist/index.js",
8
- "types": "./dist/index.d.ts",
3
+ "version": "1.5.3-canary.20",
4
+ "description": "Shared contracts, types, and schemas for MCP-I framework",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
9
7
  "exports": {
10
8
  ".": {
11
9
  "types": "./dist/index.d.ts",
12
- "import": "./dist/index.js",
13
- "require": "./dist/index.js"
10
+ "default": "./dist/index.js"
14
11
  },
15
- "./handshake": {
16
- "types": "./dist/handshake.d.ts",
17
- "import": "./dist/handshake.js",
18
- "require": "./dist/handshake.js"
19
- },
20
- "./proof": {
21
- "types": "./dist/proof/index.d.ts",
22
- "import": "./dist/proof/index.js",
23
- "require": "./dist/proof/index.js"
24
- },
25
- "./verifier": {
26
- "types": "./dist/verifier.d.ts",
27
- "import": "./dist/verifier.js",
28
- "require": "./dist/verifier.js"
29
- },
30
- "./registry": {
31
- "types": "./dist/registry.d.ts",
32
- "import": "./dist/registry.js",
33
- "require": "./dist/registry.js"
34
- },
35
- "./cli": {
36
- "types": "./dist/cli.d.ts",
37
- "import": "./dist/cli.js",
38
- "require": "./dist/cli.js"
39
- },
40
- "./test": {
41
- "types": "./dist/test.d.ts",
42
- "import": "./dist/test.js",
43
- "require": "./dist/test.js"
44
- },
45
- "./did": {
46
- "types": "./dist/did/index.d.ts",
47
- "import": "./dist/did/index.js",
48
- "require": "./dist/did/index.js"
49
- },
50
- "./vc": {
51
- "types": "./dist/vc/index.d.ts",
52
- "import": "./dist/vc/index.js",
53
- "require": "./dist/vc/index.js"
12
+ "./consent": {
13
+ "types": "./dist/consent/index.d.ts",
14
+ "default": "./dist/consent/index.js"
54
15
  },
55
16
  "./delegation": {
56
17
  "types": "./dist/delegation/index.d.ts",
57
- "import": "./dist/delegation/index.js",
58
- "require": "./dist/delegation/index.js"
18
+ "default": "./dist/delegation/index.js"
19
+ },
20
+ "./agentshield-api": {
21
+ "types": "./dist/agentshield-api/index.d.ts",
22
+ "default": "./dist/agentshield-api/index.js"
59
23
  },
60
24
  "./runtime": {
61
25
  "types": "./dist/runtime/index.d.ts",
62
- "import": "./dist/runtime/index.js",
63
- "require": "./dist/runtime/index.js"
64
- },
65
- "./tlkrc": {
66
- "types": "./dist/tlkrc/index.d.ts",
67
- "import": "./dist/tlkrc/index.js",
68
- "require": "./dist/tlkrc/index.js"
26
+ "default": "./dist/runtime/index.js"
69
27
  },
70
- "./env": {
71
- "types": "./dist/env/index.d.ts",
72
- "import": "./dist/env/index.js",
73
- "require": "./dist/env/index.js"
74
- },
75
- "./agentshield-api": {
76
- "types": "./dist/agentshield-api/index.d.ts",
77
- "import": "./dist/agentshield-api/index.js",
78
- "require": "./dist/agentshield-api/index.js"
28
+ "./proof": {
29
+ "types": "./dist/proof/index.d.ts",
30
+ "default": "./dist/proof/index.js"
79
31
  },
80
32
  "./tool-protection": {
81
33
  "types": "./dist/tool-protection/index.d.ts",
82
- "import": "./dist/tool-protection/index.js",
83
- "require": "./dist/tool-protection/index.js"
84
- },
85
- "./well-known": {
86
- "types": "./dist/well-known/index.d.ts",
87
- "import": "./dist/well-known/index.js",
88
- "require": "./dist/well-known/index.js"
34
+ "default": "./dist/tool-protection/index.js"
89
35
  },
90
36
  "./config": {
91
37
  "types": "./dist/config/index.d.ts",
92
- "import": "./dist/config/index.js",
93
- "require": "./dist/config/index.js"
38
+ "default": "./dist/config/index.js"
94
39
  },
95
- "./dashboard-config": {
96
- "types": "./dist/dashboard-config/index.d.ts",
97
- "import": "./dist/dashboard-config/index.js",
98
- "require": "./dist/dashboard-config/index.js"
40
+ "./audit": {
41
+ "types": "./dist/audit/index.d.ts",
42
+ "default": "./dist/audit/index.js"
99
43
  },
100
- "./consent": {
101
- "types": "./dist/consent/index.d.ts",
102
- "import": "./dist/consent/index.js",
103
- "require": "./dist/consent/index.js"
44
+ "./verifier": {
45
+ "types": "./dist/verifier/index.d.ts",
46
+ "default": "./dist/verifier/index.js"
47
+ },
48
+ "./handshake": {
49
+ "types": "./dist/handshake.d.ts",
50
+ "default": "./dist/handshake.js"
104
51
  }
105
52
  },
106
- "files": [
107
- "dist/**/*.js",
108
- "dist/**/*.d.ts",
109
- "!dist/**/*.map",
110
- "!dist/**/__tests__/**",
111
- "!dist/**/__fixtures__/**",
112
- "!dist/**/*.spec.*",
113
- "!dist/**/*.test.*",
114
- "!README.md",
115
- "!*.md",
116
- "!CHANGELOG.md"
117
- ],
118
53
  "scripts": {
119
54
  "build": "tsc -p tsconfig.build.json && npm run emit-schemas",
120
55
  "emit-schemas": "node scripts/emit-schemas.js",
121
- "clean": "rm -rf dist && rm -f *.tsbuildinfo",
122
- "dev": "tsc -p tsconfig.build.json --watch",
123
- "type-check": "tsc --noEmit",
124
56
  "test": "vitest run",
125
- "test:watch": "vitest",
126
57
  "test:coverage": "vitest run --coverage",
127
- "prepublishOnly": "npm run build && node ../create-mcpi-app/scripts/validate-dependencies.js"
58
+ "test:watch": "vitest",
59
+ "lint": "eslint .",
60
+ "format": "prettier --write \"src/**/*.{ts,tsx}\"",
61
+ "clean": "rm -rf dist .turbo node_modules",
62
+ "prepublishOnly": "npm run build && node ../create-mcpi-app/scripts/validate-no-workspace.js"
63
+ },
64
+ "dependencies": {
65
+ "zod": "^3.23.8"
128
66
  },
129
67
  "devDependencies": {
130
- "@types/node": "^20.0.0",
68
+ "@types/node": "^20.14.9",
131
69
  "@vitest/coverage-v8": "^4.0.5",
132
- "ajv": "^8.12.0",
133
- "ajv-formats": "^2.1.1",
134
- "fast-check": "^3.15.0",
135
- "typescript": "^5.0.0",
136
- "vitest": "^4.0.5",
137
- "zod-to-json-schema": "^3.22.0"
138
- },
139
- "dependencies": {
140
- "zod": "^3.22.0"
70
+ "eslint": "^8.57.0",
71
+ "typescript": "^5.5.3",
72
+ "vitest": "^4.0.5"
141
73
  },
142
- "keywords": [
143
- "xmcp",
144
- "mcp",
145
- "identity",
146
- "types",
147
- "contracts"
148
- ],
149
- "author": "KYA OS",
150
- "license": "MIT",
151
- "repository": {
152
- "type": "git",
153
- "url": "https://github.com/kya-os/xmcp-i.git",
154
- "directory": "packages/contracts"
74
+ "publishConfig": {
75
+ "access": "public"
155
76
  }
156
77
  }
@@ -0,0 +1,69 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://schemas.kya-os.ai/xmcp-i/cli/register-output/v1.0.0",
4
+ "title": "XMCP-I CLI Register Output",
5
+ "description": "Schema for mcpi register command JSON output",
6
+ "type": "object",
7
+ "properties": {
8
+ "agentDID": {
9
+ "type": "string",
10
+ "description": "Agent DID",
11
+ "minLength": 1
12
+ },
13
+ "agentURL": {
14
+ "type": "string",
15
+ "format": "uri",
16
+ "description": "Agent URL"
17
+ },
18
+ "agentId": {
19
+ "type": "string",
20
+ "description": "Agent identifier",
21
+ "minLength": 1
22
+ },
23
+ "agentSlug": {
24
+ "type": "string",
25
+ "description": "Agent slug",
26
+ "minLength": 1
27
+ },
28
+ "claimURL": {
29
+ "type": "string",
30
+ "format": "uri",
31
+ "description": "Claim URL (when draft)"
32
+ },
33
+ "verificationEndpoint": {
34
+ "type": "string",
35
+ "format": "uri",
36
+ "description": "Verification endpoint URL"
37
+ },
38
+ "conformanceCapabilities": {
39
+ "type": "array",
40
+ "items": {
41
+ "type": "string",
42
+ "enum": ["handshake", "signing", "verification"]
43
+ },
44
+ "minItems": 3,
45
+ "maxItems": 3,
46
+ "description": "Exactly the three MCP-I capabilities"
47
+ },
48
+ "mirrorStatus": {
49
+ "type": "string",
50
+ "enum": ["pending", "success", "error"],
51
+ "description": "MCP Registry mirror status"
52
+ },
53
+ "mirrorLink": {
54
+ "type": "string",
55
+ "format": "uri",
56
+ "description": "MCP Registry mirror link"
57
+ }
58
+ },
59
+ "required": [
60
+ "agentDID",
61
+ "agentURL",
62
+ "agentId",
63
+ "agentSlug",
64
+ "verificationEndpoint",
65
+ "conformanceCapabilities",
66
+ "mirrorStatus"
67
+ ],
68
+ "additionalProperties": false
69
+ }
@@ -0,0 +1,46 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://schemas.kya-os.ai/xmcp-i/identity/v1.0.0",
4
+ "title": "MCP-I Identity File",
5
+ "description": "Schema for .mcpi/identity.json file structure used in development mode",
6
+ "type": "object",
7
+ "properties": {
8
+ "version": {
9
+ "type": "string",
10
+ "const": "1.0",
11
+ "description": "Identity file format version"
12
+ },
13
+ "did": {
14
+ "type": "string",
15
+ "pattern": "^did:",
16
+ "description": "Decentralized Identifier (DID) for the agent"
17
+ },
18
+ "kid": {
19
+ "type": "string",
20
+ "pattern": "^z[1-9A-HJ-NP-Za-km-z]+$",
21
+ "description": "Key identifier in multibase format (z-prefix base58btc)"
22
+ },
23
+ "privateKey": {
24
+ "type": "string",
25
+ "pattern": "^[A-Za-z0-9+/]{43}=$",
26
+ "description": "Base64-encoded Ed25519 private key (32 bytes)"
27
+ },
28
+ "publicKey": {
29
+ "type": "string",
30
+ "pattern": "^[A-Za-z0-9+/]{43}=$",
31
+ "description": "Base64-encoded Ed25519 public key (32 bytes)"
32
+ },
33
+ "createdAt": {
34
+ "type": "string",
35
+ "format": "date-time",
36
+ "description": "ISO 8601 timestamp of identity creation"
37
+ },
38
+ "lastRotated": {
39
+ "type": "string",
40
+ "format": "date-time",
41
+ "description": "ISO 8601 timestamp of last key rotation (optional)"
42
+ }
43
+ },
44
+ "required": ["version", "did", "kid", "privateKey", "publicKey", "createdAt"],
45
+ "additionalProperties": false
46
+ }
@@ -0,0 +1,80 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://schemas.kya-os.ai/mcpi/proof/v1.0.0",
4
+ "title": "XMCP-I Detached Proof",
5
+ "description": "Schema for detached proofs in XMCP-I protocol",
6
+ "type": "object",
7
+ "properties": {
8
+ "jws": {
9
+ "type": "string",
10
+ "description": "Compact JWS format detached signature",
11
+ "minLength": 1
12
+ },
13
+ "meta": {
14
+ "type": "object",
15
+ "properties": {
16
+ "did": {
17
+ "type": "string",
18
+ "description": "Agent DID",
19
+ "minLength": 1
20
+ },
21
+ "kid": {
22
+ "type": "string",
23
+ "description": "Key identifier",
24
+ "minLength": 1
25
+ },
26
+ "ts": {
27
+ "type": "integer",
28
+ "description": "Unix timestamp",
29
+ "minimum": 1
30
+ },
31
+ "nonce": {
32
+ "type": "string",
33
+ "description": "Session nonce",
34
+ "minLength": 1
35
+ },
36
+ "audience": {
37
+ "type": "string",
38
+ "description": "Intended audience",
39
+ "minLength": 1
40
+ },
41
+ "sessionId": {
42
+ "type": "string",
43
+ "description": "Session identifier",
44
+ "minLength": 1
45
+ },
46
+ "requestHash": {
47
+ "type": "string",
48
+ "pattern": "^sha256:[a-f0-9]{64}$",
49
+ "description": "SHA-256 hash of canonical request"
50
+ },
51
+ "responseHash": {
52
+ "type": "string",
53
+ "pattern": "^sha256:[a-f0-9]{64}$",
54
+ "description": "SHA-256 hash of canonical response"
55
+ },
56
+ "scopeId": {
57
+ "type": "string",
58
+ "description": "Optional scope identifier"
59
+ },
60
+ "delegationRef": {
61
+ "type": "string",
62
+ "description": "Optional delegation reference"
63
+ }
64
+ },
65
+ "required": [
66
+ "did",
67
+ "kid",
68
+ "ts",
69
+ "nonce",
70
+ "audience",
71
+ "sessionId",
72
+ "requestHash",
73
+ "responseHash"
74
+ ],
75
+ "additionalProperties": false
76
+ }
77
+ },
78
+ "required": ["jws", "meta"],
79
+ "additionalProperties": false
80
+ }
@@ -0,0 +1,60 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://schemas.kya-os.ai/mcpi/receipt/v1.0.0.json",
4
+ "title": "XMCP-I Receipt",
5
+ "description": "Receipt object returned by KTA for verifiable operations",
6
+ "type": "object",
7
+ "properties": {
8
+ "$schema": {
9
+ "type": "string",
10
+ "const": "https://schemas.kya-os.ai/mcpi/receipt/v1.0.0.json"
11
+ },
12
+ "ref": {
13
+ "type": "string",
14
+ "minLength": 1,
15
+ "description": "Unique reference identifier for the receipt"
16
+ },
17
+ "contentHash": {
18
+ "type": "string",
19
+ "pattern": "^sha256:[a-f0-9]{64}$",
20
+ "description": "SHA-256 hash of the content with sha256: prefix"
21
+ },
22
+ "action": {
23
+ "type": "string",
24
+ "enum": ["issue", "revoke"],
25
+ "description": "The action performed (issue or revoke)"
26
+ },
27
+ "ts": {
28
+ "type": "integer",
29
+ "minimum": 1,
30
+ "description": "Unix timestamp when the action was performed"
31
+ },
32
+ "logIndex": {
33
+ "type": "integer",
34
+ "minimum": 0,
35
+ "description": "Index in the KTA log for this receipt"
36
+ },
37
+ "logRoot": {
38
+ "type": "string",
39
+ "minLength": 1,
40
+ "description": "Merkle log root hash for verification"
41
+ },
42
+ "inclusionProof": {
43
+ "type": "array",
44
+ "items": {
45
+ "type": "string"
46
+ },
47
+ "description": "Merkle inclusion proof for verifying the receipt against the log root"
48
+ }
49
+ },
50
+ "required": [
51
+ "ref",
52
+ "contentHash",
53
+ "action",
54
+ "ts",
55
+ "logIndex",
56
+ "logRoot",
57
+ "inclusionProof"
58
+ ],
59
+ "additionalProperties": false
60
+ }