@kya-os/contracts 1.3.2 → 1.3.3
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/README.md +1 -1
- package/dist/agentshield-api/endpoints.d.ts +21 -0
- package/dist/agentshield-api/endpoints.js +20 -0
- package/dist/agentshield-api/index.d.ts +5 -0
- package/dist/agentshield-api/index.js +27 -0
- package/dist/agentshield-api/schemas.d.ts +9846 -0
- package/dist/agentshield-api/schemas.js +92 -0
- package/dist/agentshield-api/types.d.ts +92 -0
- package/dist/agentshield-api/types.js +12 -0
- package/dist/cli.d.ts +3 -6
- package/dist/cli.js +3 -10
- package/dist/config/base.d.ts +19 -0
- package/dist/config/base.js +2 -0
- package/dist/config/delegation.d.ts +46 -0
- package/dist/config/delegation.js +2 -0
- package/dist/config/identity.d.ts +22 -0
- package/dist/config/identity.js +2 -0
- package/dist/config/index.d.ts +17 -0
- package/dist/config/index.js +2 -0
- package/dist/config/proofing.d.ts +26 -0
- package/dist/config/proofing.js +2 -0
- package/dist/config/tool-protection.d.ts +36 -0
- package/dist/config/tool-protection.js +2 -0
- package/dist/delegation/constraints.d.ts +0 -266
- package/dist/delegation/constraints.js +3 -110
- package/dist/delegation/index.d.ts +0 -6
- package/dist/delegation/index.js +0 -6
- package/dist/delegation/schemas.d.ts +174 -514
- package/dist/delegation/schemas.js +3 -247
- package/dist/did/index.d.ts +0 -6
- package/dist/did/index.js +0 -6
- package/dist/did/resolve-contract.d.ts +0 -167
- package/dist/did/resolve-contract.js +0 -20
- package/dist/did/schemas.d.ts +0 -80
- package/dist/did/schemas.js +4 -97
- package/dist/did/types.d.ts +0 -126
- package/dist/did/types.js +0 -34
- package/dist/env/constants.d.ts +0 -45
- package/dist/env/constants.js +0 -45
- package/dist/env/index.d.ts +0 -4
- package/dist/env/index.js +0 -4
- package/dist/handshake.d.ts +0 -21
- package/dist/handshake.js +3 -11
- package/dist/index.d.ts +0 -15
- package/dist/index.js +0 -25
- package/dist/proof/index.d.ts +0 -7
- package/dist/proof/index.js +0 -7
- package/dist/proof/proof-record.d.ts +62 -172
- package/dist/proof/proof-record.js +0 -74
- package/dist/proof/signing-spec.d.ts +12 -86
- package/dist/proof/signing-spec.js +0 -71
- package/dist/proof.d.ts +16 -38
- package/dist/proof.js +3 -26
- package/dist/registry.d.ts +10 -27
- package/dist/registry.js +9 -30
- package/dist/runtime/errors.d.ts +0 -169
- package/dist/runtime/errors.js +0 -69
- package/dist/runtime/headers.d.ts +0 -50
- package/dist/runtime/headers.js +0 -30
- package/dist/runtime/index.d.ts +0 -4
- package/dist/runtime/index.js +0 -4
- package/dist/test.d.ts +0 -37
- package/dist/test.js +0 -37
- package/dist/tlkrc/index.d.ts +0 -4
- package/dist/tlkrc/index.js +0 -4
- package/dist/tlkrc/rotation.d.ts +12 -90
- package/dist/tlkrc/rotation.js +0 -72
- package/dist/tool-protection/index.d.ts +129 -0
- package/dist/tool-protection/index.js +80 -0
- package/dist/utils/validation.d.ts +0 -17
- package/dist/utils/validation.js +0 -14
- package/dist/vc/index.d.ts +0 -6
- package/dist/vc/index.js +0 -6
- package/dist/vc/schemas.d.ts +0 -596
- package/dist/vc/schemas.js +2 -111
- package/dist/vc/statuslist.d.ts +0 -202
- package/dist/vc/statuslist.js +1 -73
- package/dist/verifier.d.ts +9 -13
- package/dist/verifier.js +0 -8
- package/dist/well-known/index.d.ts +248 -0
- package/dist/well-known/index.js +104 -0
- package/package.json +27 -5
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.revokeDelegationAPIResponseSchema = exports.revokeDelegationResponseSchema = exports.revokeDelegationRequestSchema = exports.createDelegationAPIResponseSchema = exports.createDelegationResponseSchema = exports.createDelegationRequestSchema = exports.toolProtectionConfigAPIResponseSchema = exports.toolProtectionConfigResponseSchema = exports.agentShieldToolProtectionSchema = exports.verifyDelegationAPIResponseSchema = exports.verifyDelegationResponseSchema = exports.verifyDelegationRequestSchema = exports.delegationCredentialSchema = exports.proofSubmissionResponseSchema = exports.proofSubmissionRequestSchema = exports.agentShieldAPIResponseSchema = exports.agentShieldAPIErrorSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const proof_js_1 = require("../proof.js");
|
|
6
|
+
const index_js_1 = require("../delegation/index.js");
|
|
7
|
+
exports.agentShieldAPIErrorSchema = zod_1.z.object({
|
|
8
|
+
code: zod_1.z.string(),
|
|
9
|
+
message: zod_1.z.string(),
|
|
10
|
+
details: zod_1.z.record(zod_1.z.unknown()).optional(),
|
|
11
|
+
});
|
|
12
|
+
const agentShieldAPIResponseSchema = (dataSchema) => zod_1.z.object({
|
|
13
|
+
success: zod_1.z.boolean(),
|
|
14
|
+
data: dataSchema,
|
|
15
|
+
metadata: zod_1.z.object({
|
|
16
|
+
requestId: zod_1.z.string(),
|
|
17
|
+
timestamp: zod_1.z.string(),
|
|
18
|
+
}).optional(),
|
|
19
|
+
});
|
|
20
|
+
exports.agentShieldAPIResponseSchema = agentShieldAPIResponseSchema;
|
|
21
|
+
exports.proofSubmissionRequestSchema = zod_1.z.object({
|
|
22
|
+
delegation_id: zod_1.z.string().uuid().nullable(),
|
|
23
|
+
session_id: zod_1.z.string().uuid(),
|
|
24
|
+
proofs: zod_1.z.array(proof_js_1.DetachedProofSchema).min(1),
|
|
25
|
+
});
|
|
26
|
+
exports.proofSubmissionResponseSchema = zod_1.z.object({
|
|
27
|
+
success: zod_1.z.boolean(),
|
|
28
|
+
received: zod_1.z.number().int().min(0),
|
|
29
|
+
processed: zod_1.z.number().int().min(0),
|
|
30
|
+
errors: zod_1.z.array(zod_1.z.object({
|
|
31
|
+
proofId: zod_1.z.string(),
|
|
32
|
+
error: zod_1.z.string(),
|
|
33
|
+
})).optional(),
|
|
34
|
+
});
|
|
35
|
+
exports.delegationCredentialSchema = zod_1.z.object({
|
|
36
|
+
agent_did: zod_1.z.string(),
|
|
37
|
+
user_id: zod_1.z.string().optional(),
|
|
38
|
+
user_identifier: zod_1.z.string().optional(),
|
|
39
|
+
scopes: zod_1.z.array(zod_1.z.string()),
|
|
40
|
+
constraints: zod_1.z.record(zod_1.z.unknown()).optional(),
|
|
41
|
+
issued_at: zod_1.z.number().int().positive(),
|
|
42
|
+
created_at: zod_1.z.number().int().positive(),
|
|
43
|
+
});
|
|
44
|
+
exports.verifyDelegationRequestSchema = zod_1.z.object({
|
|
45
|
+
agent_did: zod_1.z.string(),
|
|
46
|
+
scopes: zod_1.z.array(zod_1.z.string()).min(1),
|
|
47
|
+
timestamp: zod_1.z.number().int().positive().optional(),
|
|
48
|
+
client_info: zod_1.z.object({
|
|
49
|
+
ip_address: zod_1.z.string().ip().optional(),
|
|
50
|
+
origin: zod_1.z.string().url().optional(),
|
|
51
|
+
user_agent: zod_1.z.string().optional(),
|
|
52
|
+
}).optional(),
|
|
53
|
+
});
|
|
54
|
+
exports.verifyDelegationResponseSchema = zod_1.z.object({
|
|
55
|
+
valid: zod_1.z.boolean(),
|
|
56
|
+
delegation: index_js_1.DelegationRecordSchema.optional(),
|
|
57
|
+
delegation_id: zod_1.z.string().uuid().optional(),
|
|
58
|
+
credential: exports.delegationCredentialSchema.optional(),
|
|
59
|
+
error: exports.agentShieldAPIErrorSchema.optional(),
|
|
60
|
+
reason: zod_1.z.string().optional(),
|
|
61
|
+
});
|
|
62
|
+
exports.verifyDelegationAPIResponseSchema = (0, exports.agentShieldAPIResponseSchema)(exports.verifyDelegationResponseSchema);
|
|
63
|
+
exports.agentShieldToolProtectionSchema = zod_1.z.object({
|
|
64
|
+
scopes: zod_1.z.array(zod_1.z.string()),
|
|
65
|
+
requires_delegation: zod_1.z.boolean().optional(),
|
|
66
|
+
requiresDelegation: zod_1.z.boolean().optional(),
|
|
67
|
+
required_scopes: zod_1.z.array(zod_1.z.string()).optional(),
|
|
68
|
+
}).passthrough();
|
|
69
|
+
exports.toolProtectionConfigResponseSchema = zod_1.z.object({
|
|
70
|
+
agent_did: zod_1.z.string(),
|
|
71
|
+
tools: zod_1.z.record(zod_1.z.string(), exports.agentShieldToolProtectionSchema),
|
|
72
|
+
reputation_threshold: zod_1.z.number().min(0).max(1).optional(),
|
|
73
|
+
denied_agents: zod_1.z.array(zod_1.z.string()).optional(),
|
|
74
|
+
});
|
|
75
|
+
exports.toolProtectionConfigAPIResponseSchema = (0, exports.agentShieldAPIResponseSchema)(exports.toolProtectionConfigResponseSchema);
|
|
76
|
+
exports.createDelegationRequestSchema = zod_1.z.object({
|
|
77
|
+
delegation: index_js_1.DelegationRecordSchema,
|
|
78
|
+
});
|
|
79
|
+
exports.createDelegationResponseSchema = zod_1.z.object({
|
|
80
|
+
delegation_id: zod_1.z.string().uuid(),
|
|
81
|
+
delegation: index_js_1.DelegationRecordSchema,
|
|
82
|
+
});
|
|
83
|
+
exports.createDelegationAPIResponseSchema = (0, exports.agentShieldAPIResponseSchema)(exports.createDelegationResponseSchema);
|
|
84
|
+
exports.revokeDelegationRequestSchema = zod_1.z.object({
|
|
85
|
+
reason: zod_1.z.string().optional(),
|
|
86
|
+
});
|
|
87
|
+
exports.revokeDelegationResponseSchema = zod_1.z.object({
|
|
88
|
+
delegation_id: zod_1.z.string().uuid(),
|
|
89
|
+
revoked: zod_1.z.boolean(),
|
|
90
|
+
revoked_at: zod_1.z.number().int().positive(),
|
|
91
|
+
});
|
|
92
|
+
exports.revokeDelegationAPIResponseSchema = (0, exports.agentShieldAPIResponseSchema)(exports.revokeDelegationResponseSchema);
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { DetachedProof } from '../proof.js';
|
|
2
|
+
import type { DelegationRecord } from '../delegation/index.js';
|
|
3
|
+
export interface AgentShieldAPIResponse<T> {
|
|
4
|
+
success: boolean;
|
|
5
|
+
data: T;
|
|
6
|
+
metadata?: {
|
|
7
|
+
requestId: string;
|
|
8
|
+
timestamp: string;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export interface AgentShieldAPIErrorResponse {
|
|
12
|
+
code: string;
|
|
13
|
+
message: string;
|
|
14
|
+
details?: Record<string, unknown>;
|
|
15
|
+
}
|
|
16
|
+
export interface ProofSubmissionRequest {
|
|
17
|
+
delegation_id: string | null;
|
|
18
|
+
session_id: string;
|
|
19
|
+
proofs: DetachedProof[];
|
|
20
|
+
}
|
|
21
|
+
export interface ProofSubmissionResponse {
|
|
22
|
+
success: boolean;
|
|
23
|
+
received: number;
|
|
24
|
+
processed: number;
|
|
25
|
+
errors?: Array<{
|
|
26
|
+
proofId: string;
|
|
27
|
+
error: string;
|
|
28
|
+
}>;
|
|
29
|
+
}
|
|
30
|
+
export interface VerifyDelegationRequest {
|
|
31
|
+
agent_did: string;
|
|
32
|
+
scopes: string[];
|
|
33
|
+
timestamp?: number;
|
|
34
|
+
client_info?: {
|
|
35
|
+
ip_address?: string;
|
|
36
|
+
origin?: string;
|
|
37
|
+
user_agent?: string;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export interface DelegationCredential {
|
|
41
|
+
agent_did: string;
|
|
42
|
+
user_id?: string;
|
|
43
|
+
user_identifier?: string;
|
|
44
|
+
scopes: string[];
|
|
45
|
+
constraints?: Record<string, unknown>;
|
|
46
|
+
issued_at: number;
|
|
47
|
+
created_at: number;
|
|
48
|
+
}
|
|
49
|
+
export interface VerifyDelegationResponse {
|
|
50
|
+
valid: boolean;
|
|
51
|
+
delegation?: DelegationRecord;
|
|
52
|
+
delegation_id?: string;
|
|
53
|
+
credential?: DelegationCredential;
|
|
54
|
+
error?: AgentShieldAPIErrorResponse;
|
|
55
|
+
reason?: string;
|
|
56
|
+
}
|
|
57
|
+
export type VerifyDelegationAPIResponse = AgentShieldAPIResponse<VerifyDelegationResponse>;
|
|
58
|
+
export interface AgentShieldToolProtection {
|
|
59
|
+
scopes: string[];
|
|
60
|
+
requires_delegation?: boolean;
|
|
61
|
+
requiresDelegation?: boolean;
|
|
62
|
+
required_scopes?: string[];
|
|
63
|
+
}
|
|
64
|
+
export interface ToolProtectionConfigResponse {
|
|
65
|
+
agent_did: string;
|
|
66
|
+
tools: Record<string, AgentShieldToolProtection>;
|
|
67
|
+
reputation_threshold?: number;
|
|
68
|
+
denied_agents?: string[];
|
|
69
|
+
}
|
|
70
|
+
export type ToolProtectionConfigAPIResponse = AgentShieldAPIResponse<ToolProtectionConfigResponse>;
|
|
71
|
+
export interface CreateDelegationRequest {
|
|
72
|
+
delegation: DelegationRecord;
|
|
73
|
+
}
|
|
74
|
+
export interface CreateDelegationResponse {
|
|
75
|
+
delegation_id: string;
|
|
76
|
+
delegation: DelegationRecord;
|
|
77
|
+
}
|
|
78
|
+
export type CreateDelegationAPIResponse = AgentShieldAPIResponse<CreateDelegationResponse>;
|
|
79
|
+
export interface RevokeDelegationRequest {
|
|
80
|
+
reason?: string;
|
|
81
|
+
}
|
|
82
|
+
export interface RevokeDelegationResponse {
|
|
83
|
+
delegation_id: string;
|
|
84
|
+
revoked: boolean;
|
|
85
|
+
revoked_at: number;
|
|
86
|
+
}
|
|
87
|
+
export type RevokeDelegationAPIResponse = AgentShieldAPIResponse<RevokeDelegationResponse>;
|
|
88
|
+
export declare class AgentShieldAPIError extends Error {
|
|
89
|
+
readonly code: string;
|
|
90
|
+
readonly details?: Record<string, unknown> | undefined;
|
|
91
|
+
constructor(code: string, message: string, details?: Record<string, unknown> | undefined);
|
|
92
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AgentShieldAPIError = void 0;
|
|
4
|
+
class AgentShieldAPIError extends Error {
|
|
5
|
+
constructor(code, message, details) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.code = code;
|
|
8
|
+
this.details = details;
|
|
9
|
+
this.name = 'AgentShieldAPIError';
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.AgentShieldAPIError = AgentShieldAPIError;
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
* CLI command schemas and results
|
|
4
|
-
*/
|
|
5
|
-
export declare const IdentityConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
2
|
+
export declare const CLIIdentityFileSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
6
3
|
version: z.ZodLiteral<"1.0">;
|
|
7
4
|
did: z.ZodString;
|
|
8
5
|
kid: z.ZodOptional<z.ZodString>;
|
|
@@ -342,7 +339,7 @@ export declare const ScaffolderResultSchema: z.ZodObject<{
|
|
|
342
339
|
identityEnabled: boolean;
|
|
343
340
|
warnings?: string[] | undefined;
|
|
344
341
|
}>;
|
|
345
|
-
export type
|
|
342
|
+
export type CLIIdentityFile = z.infer<typeof CLIIdentityFileSchema>;
|
|
346
343
|
export type KeyRotationResult = z.infer<typeof KeyRotationResultSchema>;
|
|
347
344
|
export type StatusReport = z.infer<typeof StatusReportSchema>;
|
|
348
345
|
export type PackageInfo = z.infer<typeof PackageInfoSchema>;
|
|
@@ -353,6 +350,7 @@ export type CacheInfo = z.infer<typeof CacheInfoSchema>;
|
|
|
353
350
|
export type DoctorResult = z.infer<typeof DoctorResultSchema>;
|
|
354
351
|
export type ScaffolderOptions = z.infer<typeof ScaffolderOptionsSchema>;
|
|
355
352
|
export type ScaffolderResult = z.infer<typeof ScaffolderResultSchema>;
|
|
353
|
+
export type IdentityConfig = CLIIdentityFile;
|
|
356
354
|
export declare const ERROR_CODES: {
|
|
357
355
|
readonly XMCP_I_EBADPROOF: "XMCP_I_EBADPROOF";
|
|
358
356
|
readonly XMCP_I_ENOIDENTITY: "XMCP_I_ENOIDENTITY";
|
|
@@ -375,4 +373,3 @@ export declare const CLI_EXIT_CODES: {
|
|
|
375
373
|
readonly CONFIG: 25;
|
|
376
374
|
readonly RUNTIME: 26;
|
|
377
375
|
};
|
|
378
|
-
//# sourceMappingURL=cli.d.ts.map
|
package/dist/cli.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CLI_EXIT_CODES = exports.ERROR_CODES = exports.ScaffolderResultSchema = exports.ScaffolderOptionsSchema = exports.DoctorResultSchema = exports.CacheInfoSchema = exports.KTAInfoSchema = exports.EnvironmentInfoSchema = exports.XMCPUpstreamInfoSchema = exports.PackageInfoSchema = exports.StatusReportSchema = exports.KeyRotationResultSchema = exports.
|
|
3
|
+
exports.CLI_EXIT_CODES = exports.ERROR_CODES = exports.ScaffolderResultSchema = exports.ScaffolderOptionsSchema = exports.DoctorResultSchema = exports.CacheInfoSchema = exports.KTAInfoSchema = exports.EnvironmentInfoSchema = exports.XMCPUpstreamInfoSchema = exports.PackageInfoSchema = exports.StatusReportSchema = exports.KeyRotationResultSchema = exports.CLIIdentityFileSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
|
|
6
|
-
* CLI command schemas and results
|
|
7
|
-
*/
|
|
8
|
-
exports.IdentityConfigSchema = zod_1.z.object({
|
|
5
|
+
exports.CLIIdentityFileSchema = zod_1.z.object({
|
|
9
6
|
version: zod_1.z.literal("1.0"),
|
|
10
7
|
did: zod_1.z.string().min(1),
|
|
11
|
-
// Accept both kid and keyId for backward compatibility with pre-1.3 identity files
|
|
12
8
|
kid: zod_1.z.string().min(1).optional(),
|
|
13
9
|
keyId: zod_1.z.string().min(1).optional(),
|
|
14
10
|
privateKey: zod_1.z.string().regex(/^[A-Za-z0-9+/]{43}=$/, "Must be a valid base64-encoded Ed25519 private key (44 characters)"),
|
|
@@ -38,7 +34,7 @@ exports.KeyRotationResultSchema = zod_1.z.object({
|
|
|
38
34
|
});
|
|
39
35
|
exports.StatusReportSchema = zod_1.z.object({
|
|
40
36
|
did: zod_1.z.string().min(1),
|
|
41
|
-
kid: zod_1.z.string().min(1),
|
|
37
|
+
kid: zod_1.z.string().min(1),
|
|
42
38
|
ktaURL: zod_1.z.string().url(),
|
|
43
39
|
mirrorStatus: zod_1.z.enum(["pending", "success", "error"]),
|
|
44
40
|
lastHandshake: zod_1.z.number().int().positive().optional(),
|
|
@@ -90,7 +86,6 @@ exports.ScaffolderResultSchema = zod_1.z.object({
|
|
|
90
86
|
identityEnabled: zod_1.z.boolean(),
|
|
91
87
|
warnings: zod_1.z.array(zod_1.z.string()).optional(),
|
|
92
88
|
});
|
|
93
|
-
// Error codes as string literal union
|
|
94
89
|
exports.ERROR_CODES = {
|
|
95
90
|
XMCP_I_EBADPROOF: "XMCP_I_EBADPROOF",
|
|
96
91
|
XMCP_I_ENOIDENTITY: "XMCP_I_ENOIDENTITY",
|
|
@@ -101,7 +96,6 @@ exports.ERROR_CODES = {
|
|
|
101
96
|
XMCP_I_ECONFIG: "XMCP_I_ECONFIG",
|
|
102
97
|
XMCP_I_ERUNTIME: "XMCP_I_ERUNTIME",
|
|
103
98
|
};
|
|
104
|
-
// CLI exit codes
|
|
105
99
|
exports.CLI_EXIT_CODES = {
|
|
106
100
|
SUCCESS: 0,
|
|
107
101
|
GENERAL_ERROR: 1,
|
|
@@ -113,4 +107,3 @@ exports.CLI_EXIT_CODES = {
|
|
|
113
107
|
CONFIG: 25,
|
|
114
108
|
RUNTIME: 26,
|
|
115
109
|
};
|
|
116
|
-
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface MCPIBaseConfig {
|
|
2
|
+
environment: 'development' | 'production';
|
|
3
|
+
session?: {
|
|
4
|
+
timestampSkewSeconds?: number;
|
|
5
|
+
ttlMinutes?: number;
|
|
6
|
+
absoluteLifetime?: number;
|
|
7
|
+
};
|
|
8
|
+
audit?: {
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
includeProofHashes?: boolean;
|
|
11
|
+
includePayloads?: boolean;
|
|
12
|
+
logFunction?: (record: string) => void;
|
|
13
|
+
};
|
|
14
|
+
wellKnown?: {
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
serviceName?: string;
|
|
17
|
+
serviceEndpoint?: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export type DelegationVerifierType = 'agentshield' | 'kta' | 'memory' | 'cloudflare-kv' | 'redis' | 'dynamodb' | 'custom';
|
|
2
|
+
export interface DelegationVerifierConfig {
|
|
3
|
+
type: DelegationVerifierType;
|
|
4
|
+
apiUrl?: string;
|
|
5
|
+
apiKey?: string;
|
|
6
|
+
cacheTtl?: number;
|
|
7
|
+
customVerifier?: {
|
|
8
|
+
verify: (agentDid: string, scopes: string[]) => Promise<boolean>;
|
|
9
|
+
invalidate?: (agentDid: string) => Promise<void>;
|
|
10
|
+
};
|
|
11
|
+
options?: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
export interface AuthorizationConfig {
|
|
14
|
+
authorizationUrl?: string;
|
|
15
|
+
kta?: {
|
|
16
|
+
apiUrl: string;
|
|
17
|
+
apiKey?: string;
|
|
18
|
+
};
|
|
19
|
+
minReputationScore?: number;
|
|
20
|
+
resumeTokenTtl?: number;
|
|
21
|
+
requireAuthForUnknown?: boolean;
|
|
22
|
+
buildAuthUrl?: (toolName: string, scopes: string[], context: any) => string;
|
|
23
|
+
}
|
|
24
|
+
export interface DelegationConfig {
|
|
25
|
+
enabled: boolean;
|
|
26
|
+
enforceDelegations?: boolean;
|
|
27
|
+
verifier: DelegationVerifierConfig;
|
|
28
|
+
authorization?: AuthorizationConfig;
|
|
29
|
+
debug?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface DelegationRecord {
|
|
32
|
+
id: string;
|
|
33
|
+
userId: string;
|
|
34
|
+
agentDid: string;
|
|
35
|
+
scopes: string[];
|
|
36
|
+
createdAt: string;
|
|
37
|
+
expiresAt?: string;
|
|
38
|
+
revoked?: boolean;
|
|
39
|
+
constraints?: {
|
|
40
|
+
allowedIps?: string[];
|
|
41
|
+
allowedOrigins?: string[];
|
|
42
|
+
maxUses?: number;
|
|
43
|
+
currentUses?: number;
|
|
44
|
+
[key: string]: unknown;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface RuntimeIdentityConfig {
|
|
2
|
+
enabled: boolean;
|
|
3
|
+
environment: 'development' | 'production';
|
|
4
|
+
production?: {
|
|
5
|
+
privateKeyEnv?: string;
|
|
6
|
+
publicKeyEnv?: string;
|
|
7
|
+
didEnv?: string;
|
|
8
|
+
};
|
|
9
|
+
privacyMode?: boolean;
|
|
10
|
+
debug?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface AgentIdentity {
|
|
13
|
+
did: string;
|
|
14
|
+
publicKey: string;
|
|
15
|
+
privateKey: string;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
metadata?: {
|
|
18
|
+
name?: string;
|
|
19
|
+
version?: string;
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { MCPIBaseConfig } from './base.js';
|
|
2
|
+
import type { RuntimeIdentityConfig } from './identity.js';
|
|
3
|
+
import type { ProofingConfig } from './proofing.js';
|
|
4
|
+
import type { DelegationConfig } from './delegation.js';
|
|
5
|
+
import type { ToolProtectionSourceConfig } from './tool-protection.js';
|
|
6
|
+
export { MCPIBaseConfig } from './base.js';
|
|
7
|
+
export { RuntimeIdentityConfig, AgentIdentity } from './identity.js';
|
|
8
|
+
export type IdentityConfig = RuntimeIdentityConfig;
|
|
9
|
+
export { ProofingConfig, ProofBatchQueueConfig, ProofDestination, ProofDestinationType } from './proofing.js';
|
|
10
|
+
export { DelegationConfig, DelegationVerifierConfig, DelegationVerifierType, AuthorizationConfig, DelegationRecord } from './delegation.js';
|
|
11
|
+
export { ToolProtection, ToolProtectionMap, ToolProtectionSourceConfig, ToolProtectionSourceType, ToolProtectionServiceConfig, DelegationRequiredErrorData, ToolProtectionResponse } from './tool-protection.js';
|
|
12
|
+
export interface MCPIConfig extends MCPIBaseConfig {
|
|
13
|
+
identity?: RuntimeIdentityConfig;
|
|
14
|
+
proofing?: ProofingConfig;
|
|
15
|
+
delegation?: DelegationConfig;
|
|
16
|
+
toolProtection?: ToolProtectionSourceConfig;
|
|
17
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type ProofDestinationType = 'agentshield' | 'kta' | 'custom';
|
|
2
|
+
export interface ProofDestination {
|
|
3
|
+
type: ProofDestinationType;
|
|
4
|
+
apiUrl?: string;
|
|
5
|
+
apiKey?: string;
|
|
6
|
+
submit?: (proofs: any[]) => Promise<void>;
|
|
7
|
+
options?: Record<string, unknown>;
|
|
8
|
+
}
|
|
9
|
+
export interface ProofBatchQueueConfig {
|
|
10
|
+
destinations: ProofDestination[];
|
|
11
|
+
maxBatchSize?: number;
|
|
12
|
+
flushIntervalMs?: number;
|
|
13
|
+
maxRetries?: number;
|
|
14
|
+
retryBackoff?: number;
|
|
15
|
+
debug?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface ProofingConfig {
|
|
18
|
+
enabled: boolean;
|
|
19
|
+
batchQueue?: ProofBatchQueueConfig;
|
|
20
|
+
includeMetadata?: boolean;
|
|
21
|
+
options?: {
|
|
22
|
+
includeTimestamp?: boolean;
|
|
23
|
+
includeSession?: boolean;
|
|
24
|
+
customFields?: Record<string, unknown>;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ToolProtection as BaseToolProtection, ToolProtectionMap as BaseToolProtectionMap, DelegationRequiredErrorData as BaseDelegationRequiredErrorData, ToolProtectionResponse as BaseToolProtectionResponse } from '../tool-protection/index.js';
|
|
2
|
+
export type ToolProtection = BaseToolProtection;
|
|
3
|
+
export type ToolProtectionMap = BaseToolProtectionMap;
|
|
4
|
+
export type DelegationRequiredErrorData = BaseDelegationRequiredErrorData;
|
|
5
|
+
export type ToolProtectionResponse = BaseToolProtectionResponse;
|
|
6
|
+
export type ToolProtectionSourceType = 'inline' | 'local' | 'agentshield' | 'kta' | 'multi';
|
|
7
|
+
export interface ToolProtectionSourceConfig {
|
|
8
|
+
source: ToolProtectionSourceType;
|
|
9
|
+
inline?: BaseToolProtectionMap;
|
|
10
|
+
localFile?: string;
|
|
11
|
+
agentShield?: {
|
|
12
|
+
apiUrl: string;
|
|
13
|
+
apiKey?: string;
|
|
14
|
+
projectId?: string;
|
|
15
|
+
cacheTtl?: number;
|
|
16
|
+
};
|
|
17
|
+
kta?: {
|
|
18
|
+
apiUrl: string;
|
|
19
|
+
apiKey?: string;
|
|
20
|
+
};
|
|
21
|
+
sources?: Array<{
|
|
22
|
+
config: Omit<ToolProtectionSourceConfig, 'source' | 'sources'>;
|
|
23
|
+
priority?: number;
|
|
24
|
+
exclusive?: boolean;
|
|
25
|
+
}>;
|
|
26
|
+
fallback?: BaseToolProtectionMap;
|
|
27
|
+
debug?: boolean;
|
|
28
|
+
}
|
|
29
|
+
export interface ToolProtectionServiceConfig {
|
|
30
|
+
apiUrl: string;
|
|
31
|
+
apiKey: string;
|
|
32
|
+
projectId?: string;
|
|
33
|
+
cacheTtl?: number;
|
|
34
|
+
fallbackConfig?: BaseToolProtectionMap;
|
|
35
|
+
debug?: boolean;
|
|
36
|
+
}
|