@kya-os/contracts 1.5.2-canary.3 → 1.5.2-canary.4

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 (97) hide show
  1. package/package.json +5 -5
  2. package/dist/agentshield-api/endpoints.d.ts +0 -51
  3. package/dist/agentshield-api/endpoints.js +0 -47
  4. package/dist/agentshield-api/index.d.ts +0 -13
  5. package/dist/agentshield-api/index.js +0 -37
  6. package/dist/agentshield-api/schemas.d.ts +0 -5867
  7. package/dist/agentshield-api/schemas.js +0 -207
  8. package/dist/agentshield-api/types.d.ts +0 -194
  9. package/dist/agentshield-api/types.js +0 -26
  10. package/dist/cli.d.ts +0 -388
  11. package/dist/cli.js +0 -121
  12. package/dist/config/base.d.ts +0 -96
  13. package/dist/config/base.js +0 -11
  14. package/dist/config/builder.d.ts +0 -34
  15. package/dist/config/builder.js +0 -74
  16. package/dist/config/delegation.d.ts +0 -194
  17. package/dist/config/delegation.js +0 -10
  18. package/dist/config/identity.d.ts +0 -117
  19. package/dist/config/identity.js +0 -11
  20. package/dist/config/index.d.ts +0 -35
  21. package/dist/config/index.js +0 -15
  22. package/dist/config/proofing.d.ts +0 -120
  23. package/dist/config/proofing.js +0 -10
  24. package/dist/config/tool-protection.d.ts +0 -139
  25. package/dist/config/tool-protection.js +0 -10
  26. package/dist/consent/index.d.ts +0 -6
  27. package/dist/consent/index.js +0 -22
  28. package/dist/consent/schemas.d.ts +0 -738
  29. package/dist/consent/schemas.js +0 -186
  30. package/dist/consent/types.d.ts +0 -155
  31. package/dist/consent/types.js +0 -10
  32. package/dist/dashboard-config/default-config.d.ts +0 -50
  33. package/dist/dashboard-config/default-config.js +0 -241
  34. package/dist/dashboard-config/index.d.ts +0 -11
  35. package/dist/dashboard-config/index.js +0 -36
  36. package/dist/dashboard-config/schemas.d.ts +0 -5905
  37. package/dist/dashboard-config/schemas.js +0 -255
  38. package/dist/dashboard-config/types.d.ts +0 -338
  39. package/dist/dashboard-config/types.js +0 -11
  40. package/dist/delegation/constraints.d.ts +0 -1022
  41. package/dist/delegation/constraints.js +0 -219
  42. package/dist/delegation/index.d.ts +0 -7
  43. package/dist/delegation/index.js +0 -24
  44. package/dist/delegation/schemas.d.ts +0 -8458
  45. package/dist/delegation/schemas.js +0 -476
  46. package/dist/did/index.d.ts +0 -8
  47. package/dist/did/index.js +0 -24
  48. package/dist/did/resolve-contract.d.ts +0 -219
  49. package/dist/did/resolve-contract.js +0 -31
  50. package/dist/did/schemas.d.ts +0 -112
  51. package/dist/did/schemas.js +0 -172
  52. package/dist/did/types.d.ts +0 -163
  53. package/dist/did/types.js +0 -70
  54. package/dist/env/constants.d.ts +0 -57
  55. package/dist/env/constants.js +0 -59
  56. package/dist/env/index.d.ts +0 -4
  57. package/dist/env/index.js +0 -20
  58. package/dist/handshake.d.ts +0 -167
  59. package/dist/handshake.js +0 -60
  60. package/dist/index.d.ts +0 -25
  61. package/dist/index.js +0 -55
  62. package/dist/proof/index.d.ts +0 -8
  63. package/dist/proof/index.js +0 -24
  64. package/dist/proof/proof-record.d.ts +0 -837
  65. package/dist/proof/proof-record.js +0 -133
  66. package/dist/proof/signing-spec.d.ts +0 -146
  67. package/dist/proof/signing-spec.js +0 -122
  68. package/dist/proof.d.ts +0 -415
  69. package/dist/proof.js +0 -83
  70. package/dist/registry.d.ts +0 -342
  71. package/dist/registry.js +0 -118
  72. package/dist/runtime/errors.d.ts +0 -347
  73. package/dist/runtime/errors.js +0 -119
  74. package/dist/runtime/headers.d.ts +0 -83
  75. package/dist/runtime/headers.js +0 -81
  76. package/dist/runtime/index.d.ts +0 -5
  77. package/dist/runtime/index.js +0 -21
  78. package/dist/test.d.ts +0 -251
  79. package/dist/test.js +0 -119
  80. package/dist/tlkrc/index.d.ts +0 -4
  81. package/dist/tlkrc/index.js +0 -20
  82. package/dist/tlkrc/rotation.d.ts +0 -245
  83. package/dist/tlkrc/rotation.js +0 -126
  84. package/dist/tool-protection/index.d.ts +0 -227
  85. package/dist/tool-protection/index.js +0 -113
  86. package/dist/utils/validation.d.ts +0 -30
  87. package/dist/utils/validation.js +0 -69
  88. package/dist/vc/index.d.ts +0 -7
  89. package/dist/vc/index.js +0 -23
  90. package/dist/vc/schemas.d.ts +0 -2483
  91. package/dist/vc/schemas.js +0 -224
  92. package/dist/vc/statuslist.d.ts +0 -493
  93. package/dist/vc/statuslist.js +0 -132
  94. package/dist/verifier.d.ts +0 -205
  95. package/dist/verifier.js +0 -83
  96. package/dist/well-known/index.d.ts +0 -308
  97. package/dist/well-known/index.js +0 -134
@@ -1,74 +0,0 @@
1
- "use strict";
2
- /**
3
- * Configuration Builder Utilities
4
- *
5
- * Shared utilities for building MCP-I configuration objects with sensible defaults.
6
- * These functions are platform-agnostic and can be used by any adapter/platform.
7
- *
8
- * @module @kya-os/contracts/config
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.buildBaseConfig = buildBaseConfig;
12
- /**
13
- * Build base MCPIConfig that works across all platforms
14
- *
15
- * Creates a platform-agnostic configuration object with sensible defaults
16
- * for identity, proofing, delegation, audit, and session management.
17
- *
18
- * @param env - Environment variables object (works with process.env or Cloudflare env)
19
- * @returns Complete MCPIConfig object
20
- */
21
- function buildBaseConfig(env) {
22
- const environment = (env.MCPI_ENV || env.ENVIRONMENT || 'development');
23
- const isDevelopment = environment === 'development';
24
- const baseConfig = {
25
- environment,
26
- identity: {
27
- enabled: true,
28
- environment,
29
- devIdentityPath: '.mcpi/identity.json'
30
- },
31
- proofing: {
32
- enabled: true,
33
- batchQueue: {
34
- destinations: [
35
- {
36
- type: 'agentshield',
37
- apiUrl: env.AGENTSHIELD_API_URL || 'https://kya.vouched.id',
38
- apiKey: env.AGENTSHIELD_API_KEY
39
- }
40
- ],
41
- maxBatchSize: 10,
42
- flushIntervalMs: 5000,
43
- maxRetries: 3,
44
- debug: isDevelopment
45
- }
46
- },
47
- delegation: {
48
- enabled: true,
49
- enforceDelegations: true,
50
- verifier: {
51
- type: 'agentshield',
52
- apiUrl: env.AGENTSHIELD_API_URL || 'https://kya.vouched.id',
53
- apiKey: env.AGENTSHIELD_API_KEY || '',
54
- cacheTtl: 60000, // 1 minute cache
55
- debug: isDevelopment
56
- },
57
- authorization: {
58
- authorizationUrl: env.AUTHORIZATION_URL || `${env.AGENTSHIELD_API_URL || 'https://kya.vouched.id'}/authorize`,
59
- resumeTokenTtl: 600000, // 10 minutes
60
- minReputationScore: 76
61
- }
62
- },
63
- audit: {
64
- enabled: true,
65
- includeProofHashes: false,
66
- includePayloads: false
67
- },
68
- session: {
69
- timestampSkewSeconds: 120,
70
- ttlMinutes: 30
71
- }
72
- };
73
- return baseConfig;
74
- }
@@ -1,194 +0,0 @@
1
- /**
2
- * Delegation Configuration Types
3
- *
4
- * Configuration for delegation verification, authorization flows,
5
- * and consent management in MCP-I.
6
- *
7
- * @module @kya-os/contracts/config
8
- */
9
- /**
10
- * Delegation verifier types
11
- */
12
- export type DelegationVerifierType = 'agentshield' | 'kta' | 'memory' | 'cloudflare-kv' | 'redis' | 'dynamodb' | 'custom';
13
- /**
14
- * Delegation verifier configuration
15
- * Controls how delegations are verified and cached
16
- */
17
- export interface DelegationVerifierConfig {
18
- /**
19
- * Type of verifier to use
20
- */
21
- type: DelegationVerifierType;
22
- /**
23
- * API URL for remote verifiers (agentshield, kta)
24
- * @example 'https://kya.vouched.id'
25
- */
26
- apiUrl?: string;
27
- /**
28
- * API key for authentication with remote verifiers
29
- */
30
- apiKey?: string;
31
- /**
32
- * Cache time-to-live in milliseconds
33
- * How long to cache delegation verification results
34
- * @default 300000 (5 minutes)
35
- */
36
- cacheTtl?: number;
37
- /**
38
- * Custom verifier implementation
39
- * Required when type is 'custom'
40
- */
41
- customVerifier?: {
42
- verify: (agentDid: string, scopes: string[]) => Promise<boolean>;
43
- invalidate?: (agentDid: string) => Promise<void>;
44
- };
45
- /**
46
- * Additional verifier-specific options
47
- */
48
- options?: Record<string, unknown>;
49
- }
50
- /**
51
- * Authorization configuration
52
- * Controls consent flows and authorization requirements
53
- */
54
- export interface AuthorizationConfig {
55
- /**
56
- * Base URL for authorization/consent flow
57
- * Users are redirected here when delegation is required
58
- * @example 'https://kya.vouched.id/bouncer/consent'
59
- */
60
- authorizationUrl?: string;
61
- /**
62
- * KTA (Know That AI) configuration for reputation checks
63
- */
64
- kta?: {
65
- /**
66
- * KTA API base URL
67
- */
68
- apiUrl: string;
69
- /**
70
- * API key for KTA
71
- */
72
- apiKey?: string;
73
- };
74
- /**
75
- * Minimum reputation score to bypass authorization
76
- * Agents with reputation above this threshold don't need explicit consent
77
- * Range: 0-100
78
- * @default 80
79
- */
80
- minReputationScore?: number;
81
- /**
82
- * Resume token TTL in milliseconds
83
- * How long a resume token remains valid
84
- * @default 3600000 (1 hour)
85
- */
86
- resumeTokenTtl?: number;
87
- /**
88
- * Require authorization for unknown agents
89
- * If false, unknown agents are allowed by default
90
- * @default true
91
- */
92
- requireAuthForUnknown?: boolean;
93
- /**
94
- * Custom authorization URL builder
95
- * Allows customization of consent URL generation
96
- */
97
- buildAuthUrl?: (toolName: string, scopes: string[], context: any) => string;
98
- }
99
- /**
100
- * Delegation configuration (platform-agnostic)
101
- *
102
- * Controls delegation verification, authorization flows, and
103
- * tool protection enforcement.
104
- */
105
- export interface DelegationConfig {
106
- /**
107
- * Enable delegation features
108
- * When false, all tools are accessible without delegation
109
- * @default false (for backward compatibility)
110
- */
111
- enabled: boolean;
112
- /**
113
- * Enforce delegation requirements strictly
114
- * When true, tools requiring delegation will fail without valid delegation
115
- * When false, logs warnings but allows execution
116
- * @default true in production, false in development
117
- */
118
- enforceDelegations?: boolean;
119
- /**
120
- * Delegation verifier configuration
121
- * Controls how delegations are verified
122
- */
123
- verifier: DelegationVerifierConfig;
124
- /**
125
- * Authorization configuration
126
- * Controls consent flows and reputation checks
127
- */
128
- authorization?: AuthorizationConfig;
129
- /**
130
- * Enable debug logging for delegation operations
131
- * @default false
132
- */
133
- debug?: boolean;
134
- }
135
- /**
136
- * Delegation record structure
137
- * Represents a delegation from a user to an agent
138
- */
139
- export interface DelegationRecord {
140
- /**
141
- * Unique identifier for this delegation
142
- */
143
- id: string;
144
- /**
145
- * User who granted the delegation
146
- */
147
- userId: string;
148
- /**
149
- * Agent DID receiving the delegation
150
- */
151
- agentDid: string;
152
- /**
153
- * Scopes granted in this delegation
154
- * @example ['files:read', 'files:write']
155
- */
156
- scopes: string[];
157
- /**
158
- * ISO 8601 timestamp when delegation was created
159
- */
160
- createdAt: string;
161
- /**
162
- * ISO 8601 timestamp when delegation expires
163
- */
164
- expiresAt?: string;
165
- /**
166
- * Whether this delegation has been revoked
167
- */
168
- revoked?: boolean;
169
- /**
170
- * Additional constraints on the delegation
171
- */
172
- constraints?: {
173
- /**
174
- * IP addresses allowed to use this delegation
175
- */
176
- allowedIps?: string[];
177
- /**
178
- * Origins allowed to use this delegation
179
- */
180
- allowedOrigins?: string[];
181
- /**
182
- * Maximum number of uses
183
- */
184
- maxUses?: number;
185
- /**
186
- * Current number of uses
187
- */
188
- currentUses?: number;
189
- /**
190
- * Additional custom constraints
191
- */
192
- [key: string]: unknown;
193
- };
194
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- /**
3
- * Delegation Configuration Types
4
- *
5
- * Configuration for delegation verification, authorization flows,
6
- * and consent management in MCP-I.
7
- *
8
- * @module @kya-os/contracts/config
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,117 +0,0 @@
1
- /**
2
- * Identity Configuration Types
3
- *
4
- * Configuration for MCP-I identity management including DID generation,
5
- * key management, and environment-specific settings.
6
- *
7
- * @module @kya-os/contracts/config
8
- */
9
- /**
10
- * Runtime Identity Configuration
11
- *
12
- * Configuration for MCP-I identity management at runtime.
13
- * Used in application configs (mcpi-runtime-config.ts)
14
- *
15
- * Controls how agent identity is managed, including key generation,
16
- * storage, and DID creation.
17
- */
18
- export interface RuntimeIdentityConfig {
19
- /**
20
- * Enable identity features
21
- * When false, the agent operates anonymously without DID/keys
22
- */
23
- enabled: boolean;
24
- /**
25
- * Runtime environment for identity
26
- * Determines where keys come from and how they're managed
27
- */
28
- environment: 'development' | 'production';
29
- /**
30
- * Production identity configuration
31
- * Used when environment is 'production'
32
- */
33
- production?: {
34
- /**
35
- * Environment variable name containing the private key
36
- * @example 'MCPI_PRIVATE_KEY'
37
- */
38
- privateKeyEnv?: string;
39
- /**
40
- * Environment variable name containing the public key
41
- * @example 'MCPI_PUBLIC_KEY'
42
- */
43
- publicKeyEnv?: string;
44
- /**
45
- * Environment variable name containing the DID
46
- * @example 'MCPI_AGENT_DID'
47
- */
48
- didEnv?: string;
49
- };
50
- /**
51
- * Privacy mode - minimizes identity disclosure
52
- * When true, identity is only revealed when absolutely necessary
53
- * @default false
54
- */
55
- privacyMode?: boolean;
56
- /**
57
- * Enable debug logging for identity operations
58
- * WARNING: May log sensitive information
59
- * @default false
60
- */
61
- debug?: boolean;
62
- /**
63
- * Enable automatic user DID generation on chat join
64
- * When true, generates ephemeral did:key DIDs for users when they join a session
65
- * @default false
66
- */
67
- generateUserDids?: boolean;
68
- /**
69
- * User DID storage strategy
70
- * - 'ephemeral': User DIDs are not persisted (default, did:key)
71
- * - 'persistent': User DIDs are persisted in storage (requires did:web setup)
72
- * @default 'ephemeral'
73
- */
74
- userDidStorage?: 'ephemeral' | 'persistent';
75
- }
76
- /**
77
- * Agent identity representation
78
- * The actual identity data structure used at runtime
79
- */
80
- export interface AgentIdentity {
81
- /**
82
- * Decentralized Identifier
83
- * @example 'did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK'
84
- */
85
- did: string;
86
- /**
87
- * Base64-encoded public key
88
- */
89
- publicKey: string;
90
- /**
91
- * Base64-encoded private key
92
- * NOTE: Should be kept secure and never logged
93
- */
94
- privateKey: string;
95
- /**
96
- * ISO 8601 timestamp of when the identity was created
97
- */
98
- createdAt: string;
99
- /**
100
- * Optional metadata about the identity
101
- */
102
- metadata?: {
103
- /**
104
- * Human-readable name for this identity
105
- */
106
- name?: string;
107
- /**
108
- * Version of the identity format
109
- */
110
- version?: string;
111
- /**
112
- * Additional custom properties
113
- */
114
- [key: string]: unknown;
115
- };
116
- }
117
- //# sourceMappingURL=identity.d.ts.map
@@ -1,11 +0,0 @@
1
- "use strict";
2
- /**
3
- * Identity Configuration Types
4
- *
5
- * Configuration for MCP-I identity management including DID generation,
6
- * key management, and environment-specific settings.
7
- *
8
- * @module @kya-os/contracts/config
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- //# sourceMappingURL=identity.js.map
@@ -1,35 +0,0 @@
1
- /**
2
- * Configuration Type Exports
3
- *
4
- * Central export point for all configuration types in the contracts package.
5
- * These types form the foundation of XMCP-I's configuration architecture.
6
- *
7
- * @module @kya-os/contracts/config
8
- */
9
- import type { MCPIBaseConfig } from "./base.js";
10
- import type { RuntimeIdentityConfig } from "./identity.js";
11
- import type { ProofingConfig } from "./proofing.js";
12
- import type { DelegationConfig } from "./delegation.js";
13
- import type { ToolProtectionSourceConfig } from "./tool-protection.js";
14
- export { MCPIBaseConfig } from "./base.js";
15
- export { RuntimeIdentityConfig, AgentIdentity } from "./identity.js";
16
- /**
17
- * @deprecated Use RuntimeIdentityConfig instead
18
- * This export is maintained for backward compatibility
19
- */
20
- export type IdentityConfig = RuntimeIdentityConfig;
21
- export { ProofingConfig, ProofBatchQueueConfig, ProofDestination, ProofDestinationType, } from "./proofing.js";
22
- export { DelegationConfig, DelegationVerifierConfig, DelegationVerifierType, AuthorizationConfig, DelegationRecord, } from "./delegation.js";
23
- export { ToolProtection, ToolProtectionMap, ToolProtectionSourceConfig, ToolProtectionSourceType, ToolProtectionServiceConfig, DelegationRequiredErrorData, ToolProtectionResponse, } from "./tool-protection.js";
24
- export { buildBaseConfig } from "./builder.js";
25
- /**
26
- * Complete runtime configuration type
27
- * This can be extended by platform-specific configs
28
- */
29
- export interface MCPIConfig extends MCPIBaseConfig {
30
- identity?: RuntimeIdentityConfig;
31
- proofing?: ProofingConfig;
32
- delegation?: DelegationConfig;
33
- toolProtection?: ToolProtectionSourceConfig;
34
- }
35
- //# sourceMappingURL=index.d.ts.map
@@ -1,15 +0,0 @@
1
- "use strict";
2
- /**
3
- * Configuration Type Exports
4
- *
5
- * Central export point for all configuration types in the contracts package.
6
- * These types form the foundation of XMCP-I's configuration architecture.
7
- *
8
- * @module @kya-os/contracts/config
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.buildBaseConfig = void 0;
12
- // Configuration builder utilities
13
- var builder_js_1 = require("./builder.js");
14
- Object.defineProperty(exports, "buildBaseConfig", { enumerable: true, get: function () { return builder_js_1.buildBaseConfig; } });
15
- //# sourceMappingURL=index.js.map
@@ -1,120 +0,0 @@
1
- /**
2
- * Proofing Configuration Types
3
- *
4
- * Configuration for proof generation and submission including batch
5
- * processing, destinations, and retry logic.
6
- *
7
- * @module @kya-os/contracts/config
8
- */
9
- /**
10
- * Proof destination types
11
- */
12
- export type ProofDestinationType = 'agentshield' | 'kta' | 'custom';
13
- /**
14
- * Proof destination configuration
15
- * Defines where proofs should be submitted
16
- */
17
- export interface ProofDestination {
18
- /**
19
- * Type of destination
20
- */
21
- type: ProofDestinationType;
22
- /**
23
- * API base URL for the destination
24
- * Required for 'agentshield' and 'kta' types
25
- * @example 'https://kya.vouched.id'
26
- */
27
- apiUrl?: string;
28
- /**
29
- * API key for authentication
30
- * Required for most destinations
31
- */
32
- apiKey?: string;
33
- /**
34
- * Custom submission function
35
- * Required for 'custom' type destinations
36
- */
37
- submit?: (proofs: any[]) => Promise<void>;
38
- /**
39
- * Additional destination-specific configuration
40
- */
41
- options?: Record<string, unknown>;
42
- }
43
- /**
44
- * Proof batch queue configuration
45
- * Controls how proofs are batched and submitted
46
- */
47
- export interface ProofBatchQueueConfig {
48
- /**
49
- * Destinations where proofs should be sent
50
- * Multiple destinations are processed in parallel
51
- */
52
- destinations: ProofDestination[];
53
- /**
54
- * Maximum number of proofs to batch before auto-submission
55
- * @default 10
56
- */
57
- maxBatchSize?: number;
58
- /**
59
- * Time interval (ms) between automatic flush attempts
60
- * @default 5000
61
- */
62
- flushIntervalMs?: number;
63
- /**
64
- * Maximum number of retry attempts for failed submissions
65
- * @default 3
66
- */
67
- maxRetries?: number;
68
- /**
69
- * Backoff multiplier for retry delays
70
- * @default 2
71
- */
72
- retryBackoff?: number;
73
- /**
74
- * Enable debug logging for proof submission
75
- * @default false
76
- */
77
- debug?: boolean;
78
- }
79
- /**
80
- * Proofing configuration (platform-agnostic)
81
- *
82
- * Controls proof generation, batching, and submission to external services
83
- * like AgentShield or Know That AI (KTA).
84
- */
85
- export interface ProofingConfig {
86
- /**
87
- * Enable proof generation and submission
88
- * @default true
89
- */
90
- enabled: boolean;
91
- /**
92
- * Proof batch queue configuration
93
- * Controls batching and submission behavior
94
- */
95
- batchQueue?: ProofBatchQueueConfig;
96
- /**
97
- * Include additional metadata in proofs
98
- * @default true
99
- */
100
- includeMetadata?: boolean;
101
- /**
102
- * Custom proof generation options
103
- */
104
- options?: {
105
- /**
106
- * Include timestamp in all proofs
107
- * @default true
108
- */
109
- includeTimestamp?: boolean;
110
- /**
111
- * Include session context in proofs
112
- * @default true
113
- */
114
- includeSession?: boolean;
115
- /**
116
- * Custom fields to include in every proof
117
- */
118
- customFields?: Record<string, unknown>;
119
- };
120
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- /**
3
- * Proofing Configuration Types
4
- *
5
- * Configuration for proof generation and submission including batch
6
- * processing, destinations, and retry logic.
7
- *
8
- * @module @kya-os/contracts/config
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });