@kya-os/contracts 1.3.5 → 1.5.1
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/dist/agentshield-api/endpoints.d.ts +50 -0
- package/dist/agentshield-api/endpoints.js +46 -0
- package/dist/agentshield-api/index.d.ts +13 -0
- package/dist/agentshield-api/index.js +38 -0
- package/dist/agentshield-api/schemas.d.ts +9914 -0
- package/dist/agentshield-api/schemas.js +165 -0
- package/dist/agentshield-api/types.d.ts +168 -0
- package/dist/agentshield-api/types.js +27 -0
- package/dist/cli.d.ts +13 -0
- package/dist/cli.js +13 -1
- package/dist/config/base.d.ts +96 -0
- package/dist/config/base.js +11 -0
- package/dist/config/delegation.d.ts +194 -0
- package/dist/config/delegation.js +10 -0
- package/dist/config/identity.d.ts +117 -0
- package/dist/config/identity.js +11 -0
- package/dist/config/index.d.ts +33 -0
- package/dist/config/index.js +11 -0
- package/dist/config/proofing.d.ts +120 -0
- package/dist/config/proofing.js +10 -0
- package/dist/config/tool-protection.d.ts +139 -0
- package/dist/config/tool-protection.js +10 -0
- package/dist/dashboard-config/default-config.d.ts +49 -0
- package/dist/dashboard-config/default-config.js +225 -0
- package/dist/dashboard-config/index.d.ts +10 -0
- package/dist/dashboard-config/index.js +35 -0
- package/dist/dashboard-config/schemas.d.ts +5847 -0
- package/dist/dashboard-config/schemas.js +251 -0
- package/dist/dashboard-config/types.d.ts +331 -0
- package/dist/dashboard-config/types.js +11 -0
- package/dist/delegation/constraints.d.ts +991 -0
- package/dist/delegation/constraints.js +209 -0
- package/dist/delegation/index.d.ts +7 -0
- package/dist/delegation/index.js +23 -0
- package/dist/delegation/schemas.d.ts +8381 -0
- package/dist/delegation/schemas.js +475 -0
- package/dist/did/index.d.ts +8 -0
- package/dist/did/index.js +24 -0
- package/dist/did/resolve-contract.d.ts +219 -0
- package/dist/did/resolve-contract.js +31 -0
- package/dist/did/schemas.d.ts +112 -0
- package/dist/did/schemas.js +172 -0
- package/dist/did/types.d.ts +163 -0
- package/dist/did/types.js +70 -0
- package/dist/env/constants.d.ts +57 -0
- package/dist/env/constants.js +59 -0
- package/dist/env/index.d.ts +4 -0
- package/dist/env/index.js +20 -0
- package/dist/handshake.d.ts +20 -0
- package/dist/handshake.js +10 -3
- package/dist/index.d.ts +14 -0
- package/dist/index.js +28 -0
- package/dist/proof/index.d.ts +8 -0
- package/dist/proof/index.js +24 -0
- package/dist/proof/proof-record.d.ts +837 -0
- package/dist/proof/proof-record.js +133 -0
- package/dist/proof/signing-spec.d.ts +146 -0
- package/dist/proof/signing-spec.js +122 -0
- package/dist/proof.d.ts +53 -16
- package/dist/proof.js +27 -3
- package/dist/registry.d.ts +16 -0
- package/dist/registry.js +29 -9
- package/dist/runtime/errors.d.ts +347 -0
- package/dist/runtime/errors.js +119 -0
- package/dist/runtime/headers.d.ts +83 -0
- package/dist/runtime/headers.js +81 -0
- package/dist/runtime/index.d.ts +5 -0
- package/dist/runtime/index.js +21 -0
- package/dist/test.d.ts +36 -0
- package/dist/test.js +36 -0
- package/dist/tlkrc/index.d.ts +4 -0
- package/dist/tlkrc/index.js +20 -0
- package/dist/tlkrc/rotation.d.ts +245 -0
- package/dist/tlkrc/rotation.js +126 -0
- package/dist/tool-protection/index.d.ts +227 -0
- package/dist/tool-protection/index.js +113 -0
- package/dist/utils/validation.d.ts +16 -0
- package/dist/utils/validation.js +13 -0
- package/dist/vc/index.d.ts +7 -0
- package/dist/vc/index.js +23 -0
- package/dist/vc/schemas.d.ts +2483 -0
- package/dist/vc/schemas.js +224 -0
- package/dist/vc/statuslist.d.ts +493 -0
- package/dist/vc/statuslist.js +132 -0
- package/dist/verifier.d.ts +3 -0
- package/dist/verifier.js +7 -0
- package/dist/well-known/index.d.ts +308 -0
- package/dist/well-known/index.js +134 -0
- package/package.json +6 -1
|
@@ -0,0 +1,194 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
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 });
|
|
@@ -0,0 +1,117 @@
|
|
|
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
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
/**
|
|
25
|
+
* Complete runtime configuration type
|
|
26
|
+
* This can be extended by platform-specific configs
|
|
27
|
+
*/
|
|
28
|
+
export interface MCPIConfig extends MCPIBaseConfig {
|
|
29
|
+
identity?: RuntimeIdentityConfig;
|
|
30
|
+
proofing?: ProofingConfig;
|
|
31
|
+
delegation?: DelegationConfig;
|
|
32
|
+
toolProtection?: ToolProtectionSourceConfig;
|
|
33
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,120 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
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 });
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Protection Configuration Types
|
|
3
|
+
*
|
|
4
|
+
* Configuration for tool protection including delegation requirements,
|
|
5
|
+
* scopes, and multi-source resolution strategies.
|
|
6
|
+
*
|
|
7
|
+
* @module @kya-os/contracts/config
|
|
8
|
+
*/
|
|
9
|
+
import type { ToolProtection as BaseToolProtection, ToolProtectionMap as BaseToolProtectionMap, DelegationRequiredErrorData as BaseDelegationRequiredErrorData, ToolProtectionResponse as BaseToolProtectionResponse } from '../tool-protection/index.js';
|
|
10
|
+
export type ToolProtection = BaseToolProtection;
|
|
11
|
+
export type ToolProtectionMap = BaseToolProtectionMap;
|
|
12
|
+
export type DelegationRequiredErrorData = BaseDelegationRequiredErrorData;
|
|
13
|
+
export type ToolProtectionResponse = BaseToolProtectionResponse;
|
|
14
|
+
/**
|
|
15
|
+
* Tool protection source types
|
|
16
|
+
*/
|
|
17
|
+
export type ToolProtectionSourceType = 'inline' | 'local' | 'agentshield' | 'kta' | 'multi';
|
|
18
|
+
/**
|
|
19
|
+
* Tool protection source configuration
|
|
20
|
+
* Defines where tool protection settings come from
|
|
21
|
+
*/
|
|
22
|
+
export interface ToolProtectionSourceConfig {
|
|
23
|
+
/**
|
|
24
|
+
* Type of source to use
|
|
25
|
+
*/
|
|
26
|
+
source: ToolProtectionSourceType;
|
|
27
|
+
/**
|
|
28
|
+
* Inline tool protection map
|
|
29
|
+
* Used when source is 'inline'
|
|
30
|
+
*/
|
|
31
|
+
inline?: BaseToolProtectionMap;
|
|
32
|
+
/**
|
|
33
|
+
* Path to local tool protections file
|
|
34
|
+
* Used when source is 'local'
|
|
35
|
+
* @example './tool-protections.json'
|
|
36
|
+
*/
|
|
37
|
+
localFile?: string;
|
|
38
|
+
/**
|
|
39
|
+
* AgentShield configuration
|
|
40
|
+
* Used when source is 'agentshield'
|
|
41
|
+
*/
|
|
42
|
+
agentShield?: {
|
|
43
|
+
/**
|
|
44
|
+
* AgentShield API base URL
|
|
45
|
+
* @example 'https://kya.vouched.id'
|
|
46
|
+
*/
|
|
47
|
+
apiUrl: string;
|
|
48
|
+
/**
|
|
49
|
+
* API key for authentication
|
|
50
|
+
*/
|
|
51
|
+
apiKey?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Project ID (optional, for backward compatibility)
|
|
54
|
+
* Modern approach uses agent DID
|
|
55
|
+
*/
|
|
56
|
+
projectId?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Cache TTL in milliseconds
|
|
59
|
+
* @default 300000 (5 minutes)
|
|
60
|
+
*/
|
|
61
|
+
cacheTtl?: number;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* KTA configuration
|
|
65
|
+
* Used when source is 'kta'
|
|
66
|
+
*/
|
|
67
|
+
kta?: {
|
|
68
|
+
/**
|
|
69
|
+
* KTA API base URL
|
|
70
|
+
*/
|
|
71
|
+
apiUrl: string;
|
|
72
|
+
/**
|
|
73
|
+
* API key for authentication
|
|
74
|
+
*/
|
|
75
|
+
apiKey?: string;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Multi-source configuration
|
|
79
|
+
* Used when source is 'multi'
|
|
80
|
+
* Sources are checked in priority order
|
|
81
|
+
*/
|
|
82
|
+
sources?: Array<{
|
|
83
|
+
/**
|
|
84
|
+
* Source configuration
|
|
85
|
+
*/
|
|
86
|
+
config: Omit<ToolProtectionSourceConfig, 'source' | 'sources'>;
|
|
87
|
+
/**
|
|
88
|
+
* Priority (higher number = higher priority)
|
|
89
|
+
* @default 0
|
|
90
|
+
*/
|
|
91
|
+
priority?: number;
|
|
92
|
+
/**
|
|
93
|
+
* Whether to stop after this source if found
|
|
94
|
+
* @default false
|
|
95
|
+
*/
|
|
96
|
+
exclusive?: boolean;
|
|
97
|
+
}>;
|
|
98
|
+
/**
|
|
99
|
+
* Fallback configuration if all sources fail
|
|
100
|
+
*/
|
|
101
|
+
fallback?: BaseToolProtectionMap;
|
|
102
|
+
/**
|
|
103
|
+
* Enable debug logging
|
|
104
|
+
* @default false
|
|
105
|
+
*/
|
|
106
|
+
debug?: boolean;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Tool protection service configuration
|
|
110
|
+
* Used by provider-based implementations
|
|
111
|
+
*/
|
|
112
|
+
export interface ToolProtectionServiceConfig {
|
|
113
|
+
/**
|
|
114
|
+
* API base URL for fetching tool protections
|
|
115
|
+
*/
|
|
116
|
+
apiUrl: string;
|
|
117
|
+
/**
|
|
118
|
+
* API key for authentication
|
|
119
|
+
*/
|
|
120
|
+
apiKey: string;
|
|
121
|
+
/**
|
|
122
|
+
* Project ID (optional)
|
|
123
|
+
*/
|
|
124
|
+
projectId?: string;
|
|
125
|
+
/**
|
|
126
|
+
* Cache TTL in milliseconds
|
|
127
|
+
* @default 300000 (5 minutes)
|
|
128
|
+
*/
|
|
129
|
+
cacheTtl?: number;
|
|
130
|
+
/**
|
|
131
|
+
* Fallback configuration if API is unavailable
|
|
132
|
+
*/
|
|
133
|
+
fallbackConfig?: BaseToolProtectionMap;
|
|
134
|
+
/**
|
|
135
|
+
* Enable debug logging
|
|
136
|
+
* @default false
|
|
137
|
+
*/
|
|
138
|
+
debug?: boolean;
|
|
139
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Tool Protection Configuration Types
|
|
4
|
+
*
|
|
5
|
+
* Configuration for tool protection including delegation requirements,
|
|
6
|
+
* scopes, and multi-source resolution strategies.
|
|
7
|
+
*
|
|
8
|
+
* @module @kya-os/contracts/config
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|