@kya-os/contracts 1.3.5 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/index.d.ts +10 -0
- package/dist/dashboard-config/index.js +31 -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,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* AgentShield/Bouncer API Zod Validation Schemas
|
|
4
|
+
*
|
|
5
|
+
* Runtime validation schemas matching the API contract types.
|
|
6
|
+
* These schemas ensure request/response validation before sending/receiving.
|
|
7
|
+
*
|
|
8
|
+
* @package @kya-os/contracts/agentshield-api
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
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;
|
|
12
|
+
const zod_1 = require("zod");
|
|
13
|
+
const proof_js_1 = require("../proof.js");
|
|
14
|
+
const index_js_1 = require("../delegation/index.js");
|
|
15
|
+
/**
|
|
16
|
+
* Standard error schema
|
|
17
|
+
*/
|
|
18
|
+
exports.agentShieldAPIErrorSchema = zod_1.z.object({
|
|
19
|
+
code: zod_1.z.string(),
|
|
20
|
+
message: zod_1.z.string(),
|
|
21
|
+
details: zod_1.z.record(zod_1.z.unknown()).optional(),
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* Standard API response wrapper schema
|
|
25
|
+
*/
|
|
26
|
+
const agentShieldAPIResponseSchema = (dataSchema) => zod_1.z.object({
|
|
27
|
+
success: zod_1.z.boolean(),
|
|
28
|
+
data: dataSchema,
|
|
29
|
+
metadata: zod_1.z.object({
|
|
30
|
+
requestId: zod_1.z.string(),
|
|
31
|
+
timestamp: zod_1.z.string(),
|
|
32
|
+
}).optional(),
|
|
33
|
+
});
|
|
34
|
+
exports.agentShieldAPIResponseSchema = agentShieldAPIResponseSchema;
|
|
35
|
+
// ============================================================================
|
|
36
|
+
// Proof Submission Schemas
|
|
37
|
+
// ============================================================================
|
|
38
|
+
/**
|
|
39
|
+
* Proof submission request schema
|
|
40
|
+
*/
|
|
41
|
+
exports.proofSubmissionRequestSchema = zod_1.z.object({
|
|
42
|
+
delegation_id: zod_1.z.string().uuid().nullable(),
|
|
43
|
+
session_id: zod_1.z.string().uuid(),
|
|
44
|
+
proofs: zod_1.z.array(proof_js_1.DetachedProofSchema).min(1),
|
|
45
|
+
});
|
|
46
|
+
/**
|
|
47
|
+
* Proof submission response schema
|
|
48
|
+
*/
|
|
49
|
+
exports.proofSubmissionResponseSchema = zod_1.z.object({
|
|
50
|
+
success: zod_1.z.boolean(),
|
|
51
|
+
received: zod_1.z.number().int().min(0),
|
|
52
|
+
processed: zod_1.z.number().int().min(0),
|
|
53
|
+
errors: zod_1.z.array(zod_1.z.object({
|
|
54
|
+
proofId: zod_1.z.string(),
|
|
55
|
+
error: zod_1.z.string(),
|
|
56
|
+
})).optional(),
|
|
57
|
+
});
|
|
58
|
+
// ============================================================================
|
|
59
|
+
// Delegation Verification Schemas
|
|
60
|
+
// ============================================================================
|
|
61
|
+
/**
|
|
62
|
+
* Delegation credential schema
|
|
63
|
+
*/
|
|
64
|
+
exports.delegationCredentialSchema = zod_1.z.object({
|
|
65
|
+
agent_did: zod_1.z.string(),
|
|
66
|
+
user_id: zod_1.z.string().optional(),
|
|
67
|
+
user_identifier: zod_1.z.string().optional(),
|
|
68
|
+
scopes: zod_1.z.array(zod_1.z.string()),
|
|
69
|
+
constraints: zod_1.z.record(zod_1.z.unknown()).optional(),
|
|
70
|
+
issued_at: zod_1.z.number().int().positive(),
|
|
71
|
+
created_at: zod_1.z.number().int().positive(),
|
|
72
|
+
});
|
|
73
|
+
/**
|
|
74
|
+
* Delegation verification request schema
|
|
75
|
+
*/
|
|
76
|
+
exports.verifyDelegationRequestSchema = zod_1.z.object({
|
|
77
|
+
agent_did: zod_1.z.string(),
|
|
78
|
+
scopes: zod_1.z.array(zod_1.z.string()).min(1),
|
|
79
|
+
timestamp: zod_1.z.number().int().positive().optional(),
|
|
80
|
+
client_info: zod_1.z.object({
|
|
81
|
+
ip_address: zod_1.z.string().ip().optional(),
|
|
82
|
+
origin: zod_1.z.string().url().optional(),
|
|
83
|
+
user_agent: zod_1.z.string().optional(),
|
|
84
|
+
}).optional(),
|
|
85
|
+
});
|
|
86
|
+
/**
|
|
87
|
+
* Delegation verification response schema
|
|
88
|
+
*/
|
|
89
|
+
exports.verifyDelegationResponseSchema = zod_1.z.object({
|
|
90
|
+
valid: zod_1.z.boolean(),
|
|
91
|
+
delegation: index_js_1.DelegationRecordSchema.optional(),
|
|
92
|
+
delegation_id: zod_1.z.string().uuid().optional(),
|
|
93
|
+
credential: exports.delegationCredentialSchema.optional(),
|
|
94
|
+
error: exports.agentShieldAPIErrorSchema.optional(),
|
|
95
|
+
reason: zod_1.z.string().optional(),
|
|
96
|
+
});
|
|
97
|
+
/**
|
|
98
|
+
* Wrapped verification response schema
|
|
99
|
+
*/
|
|
100
|
+
exports.verifyDelegationAPIResponseSchema = (0, exports.agentShieldAPIResponseSchema)(exports.verifyDelegationResponseSchema);
|
|
101
|
+
// ============================================================================
|
|
102
|
+
// Tool Protection Configuration Schemas
|
|
103
|
+
// ============================================================================
|
|
104
|
+
/**
|
|
105
|
+
* AgentShield tool protection schema (supports both snake_case and camelCase)
|
|
106
|
+
* This is the API-specific format, not the MCP-I spec schema
|
|
107
|
+
*/
|
|
108
|
+
exports.agentShieldToolProtectionSchema = zod_1.z.object({
|
|
109
|
+
scopes: zod_1.z.array(zod_1.z.string()),
|
|
110
|
+
requires_delegation: zod_1.z.boolean().optional(),
|
|
111
|
+
requiresDelegation: zod_1.z.boolean().optional(),
|
|
112
|
+
required_scopes: zod_1.z.array(zod_1.z.string()).optional(),
|
|
113
|
+
}).passthrough(); // Allow additional properties
|
|
114
|
+
/**
|
|
115
|
+
* Tool protection config response schema
|
|
116
|
+
*/
|
|
117
|
+
exports.toolProtectionConfigResponseSchema = zod_1.z.object({
|
|
118
|
+
agent_did: zod_1.z.string(),
|
|
119
|
+
tools: zod_1.z.record(zod_1.z.string(), exports.agentShieldToolProtectionSchema),
|
|
120
|
+
reputation_threshold: zod_1.z.number().min(0).max(1).optional(),
|
|
121
|
+
denied_agents: zod_1.z.array(zod_1.z.string()).optional(),
|
|
122
|
+
});
|
|
123
|
+
/**
|
|
124
|
+
* Wrapped config response schema
|
|
125
|
+
*/
|
|
126
|
+
exports.toolProtectionConfigAPIResponseSchema = (0, exports.agentShieldAPIResponseSchema)(exports.toolProtectionConfigResponseSchema);
|
|
127
|
+
// ============================================================================
|
|
128
|
+
// Delegation Management Schemas
|
|
129
|
+
// ============================================================================
|
|
130
|
+
/**
|
|
131
|
+
* Create delegation request schema
|
|
132
|
+
*/
|
|
133
|
+
exports.createDelegationRequestSchema = zod_1.z.object({
|
|
134
|
+
delegation: index_js_1.DelegationRecordSchema,
|
|
135
|
+
});
|
|
136
|
+
/**
|
|
137
|
+
* Create delegation response schema
|
|
138
|
+
*/
|
|
139
|
+
exports.createDelegationResponseSchema = zod_1.z.object({
|
|
140
|
+
delegation_id: zod_1.z.string().uuid(),
|
|
141
|
+
delegation: index_js_1.DelegationRecordSchema,
|
|
142
|
+
});
|
|
143
|
+
/**
|
|
144
|
+
* Wrapped creation response schema
|
|
145
|
+
*/
|
|
146
|
+
exports.createDelegationAPIResponseSchema = (0, exports.agentShieldAPIResponseSchema)(exports.createDelegationResponseSchema);
|
|
147
|
+
/**
|
|
148
|
+
* Revoke delegation request schema
|
|
149
|
+
*/
|
|
150
|
+
exports.revokeDelegationRequestSchema = zod_1.z.object({
|
|
151
|
+
reason: zod_1.z.string().optional(),
|
|
152
|
+
});
|
|
153
|
+
/**
|
|
154
|
+
* Revoke delegation response schema
|
|
155
|
+
*/
|
|
156
|
+
exports.revokeDelegationResponseSchema = zod_1.z.object({
|
|
157
|
+
delegation_id: zod_1.z.string().uuid(),
|
|
158
|
+
revoked: zod_1.z.boolean(),
|
|
159
|
+
revoked_at: zod_1.z.number().int().positive(),
|
|
160
|
+
});
|
|
161
|
+
/**
|
|
162
|
+
* Wrapped revocation response schema
|
|
163
|
+
*/
|
|
164
|
+
exports.revokeDelegationAPIResponseSchema = (0, exports.agentShieldAPIResponseSchema)(exports.revokeDelegationResponseSchema);
|
|
165
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentShield/Bouncer API Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* TypeScript interfaces matching the AgentShield dashboard API contract.
|
|
5
|
+
* These types ensure parity between xmcp-i clients and the AgentShield service.
|
|
6
|
+
*
|
|
7
|
+
* @package @kya-os/contracts/agentshield-api
|
|
8
|
+
*/
|
|
9
|
+
import type { DetachedProof } from '../proof.js';
|
|
10
|
+
import type { DelegationRecord } from '../delegation/index.js';
|
|
11
|
+
/**
|
|
12
|
+
* Standard AgentShield API response wrapper
|
|
13
|
+
*/
|
|
14
|
+
export interface AgentShieldAPIResponse<T> {
|
|
15
|
+
success: boolean;
|
|
16
|
+
data: T;
|
|
17
|
+
metadata?: {
|
|
18
|
+
requestId: string;
|
|
19
|
+
timestamp: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Standard AgentShield API error response structure
|
|
24
|
+
* (Use AgentShieldAPIError class for runtime errors)
|
|
25
|
+
*/
|
|
26
|
+
export interface AgentShieldAPIErrorResponse {
|
|
27
|
+
code: string;
|
|
28
|
+
message: string;
|
|
29
|
+
details?: Record<string, unknown>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Request body for proof submission endpoint
|
|
33
|
+
* POST /api/v1/bouncer/proofs
|
|
34
|
+
*/
|
|
35
|
+
export interface ProofSubmissionRequest {
|
|
36
|
+
/** Delegation ID (null if no delegation context) */
|
|
37
|
+
delegation_id: string | null;
|
|
38
|
+
/** Session ID for grouping proofs */
|
|
39
|
+
session_id: string;
|
|
40
|
+
/** Array of proofs to submit */
|
|
41
|
+
proofs: DetachedProof[];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Response from proof submission endpoint
|
|
45
|
+
*/
|
|
46
|
+
export interface ProofSubmissionResponse {
|
|
47
|
+
success: boolean;
|
|
48
|
+
received: number;
|
|
49
|
+
processed: number;
|
|
50
|
+
errors?: Array<{
|
|
51
|
+
proofId: string;
|
|
52
|
+
error: string;
|
|
53
|
+
}>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Request body for delegation verification endpoint
|
|
57
|
+
* POST /api/v1/bouncer/delegations/verify
|
|
58
|
+
*/
|
|
59
|
+
export interface VerifyDelegationRequest {
|
|
60
|
+
/** Agent DID to verify */
|
|
61
|
+
agent_did: string;
|
|
62
|
+
/** Required scopes */
|
|
63
|
+
scopes: string[];
|
|
64
|
+
/** Optional timestamp for verification */
|
|
65
|
+
timestamp?: number;
|
|
66
|
+
/** Optional client info for IP/origin checking */
|
|
67
|
+
client_info?: {
|
|
68
|
+
ip_address?: string;
|
|
69
|
+
origin?: string;
|
|
70
|
+
user_agent?: string;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Credential information returned in verification response
|
|
75
|
+
*/
|
|
76
|
+
export interface DelegationCredential {
|
|
77
|
+
agent_did: string;
|
|
78
|
+
user_id?: string;
|
|
79
|
+
user_identifier?: string;
|
|
80
|
+
scopes: string[];
|
|
81
|
+
constraints?: Record<string, unknown>;
|
|
82
|
+
issued_at: number;
|
|
83
|
+
created_at: number;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Response from delegation verification endpoint
|
|
87
|
+
*/
|
|
88
|
+
export interface VerifyDelegationResponse {
|
|
89
|
+
valid: boolean;
|
|
90
|
+
delegation?: DelegationRecord;
|
|
91
|
+
delegation_id?: string;
|
|
92
|
+
credential?: DelegationCredential;
|
|
93
|
+
error?: AgentShieldAPIErrorResponse;
|
|
94
|
+
reason?: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Wrapped verification response (AgentShield wraps in success/data)
|
|
98
|
+
*/
|
|
99
|
+
export type VerifyDelegationAPIResponse = AgentShieldAPIResponse<VerifyDelegationResponse>;
|
|
100
|
+
/**
|
|
101
|
+
* AgentShield API tool protection format for a single tool
|
|
102
|
+
* This is the API-specific format, not the MCP-I spec type
|
|
103
|
+
*/
|
|
104
|
+
export interface AgentShieldToolProtection {
|
|
105
|
+
scopes: string[];
|
|
106
|
+
requires_delegation?: boolean;
|
|
107
|
+
requiresDelegation?: boolean;
|
|
108
|
+
required_scopes?: string[];
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Response from tool protection config endpoint
|
|
112
|
+
* GET /api/v1/bouncer/config/{projectId}
|
|
113
|
+
*/
|
|
114
|
+
export interface ToolProtectionConfigResponse {
|
|
115
|
+
agent_did: string;
|
|
116
|
+
tools: Record<string, AgentShieldToolProtection>;
|
|
117
|
+
reputation_threshold?: number;
|
|
118
|
+
denied_agents?: string[];
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Wrapped config response
|
|
122
|
+
*/
|
|
123
|
+
export type ToolProtectionConfigAPIResponse = AgentShieldAPIResponse<ToolProtectionConfigResponse>;
|
|
124
|
+
/**
|
|
125
|
+
* Request body for creating a delegation
|
|
126
|
+
* POST /api/v1/bouncer/delegations
|
|
127
|
+
*/
|
|
128
|
+
export interface CreateDelegationRequest {
|
|
129
|
+
delegation: DelegationRecord;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Response from delegation creation endpoint
|
|
133
|
+
*/
|
|
134
|
+
export interface CreateDelegationResponse {
|
|
135
|
+
delegation_id: string;
|
|
136
|
+
delegation: DelegationRecord;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Wrapped creation response
|
|
140
|
+
*/
|
|
141
|
+
export type CreateDelegationAPIResponse = AgentShieldAPIResponse<CreateDelegationResponse>;
|
|
142
|
+
/**
|
|
143
|
+
* Request body for revoking a delegation
|
|
144
|
+
* POST /api/v1/bouncer/delegations/{id}/revoke
|
|
145
|
+
*/
|
|
146
|
+
export interface RevokeDelegationRequest {
|
|
147
|
+
reason?: string;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Response from delegation revocation endpoint
|
|
151
|
+
*/
|
|
152
|
+
export interface RevokeDelegationResponse {
|
|
153
|
+
delegation_id: string;
|
|
154
|
+
revoked: boolean;
|
|
155
|
+
revoked_at: number;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Wrapped revocation response
|
|
159
|
+
*/
|
|
160
|
+
export type RevokeDelegationAPIResponse = AgentShieldAPIResponse<RevokeDelegationResponse>;
|
|
161
|
+
/**
|
|
162
|
+
* AgentShield API error class
|
|
163
|
+
*/
|
|
164
|
+
export declare class AgentShieldAPIError extends Error {
|
|
165
|
+
readonly code: string;
|
|
166
|
+
readonly details?: Record<string, unknown> | undefined;
|
|
167
|
+
constructor(code: string, message: string, details?: Record<string, unknown> | undefined);
|
|
168
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* AgentShield/Bouncer API Type Definitions
|
|
4
|
+
*
|
|
5
|
+
* TypeScript interfaces matching the AgentShield dashboard API contract.
|
|
6
|
+
* These types ensure parity between xmcp-i clients and the AgentShield service.
|
|
7
|
+
*
|
|
8
|
+
* @package @kya-os/contracts/agentshield-api
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.AgentShieldAPIError = void 0;
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// Error Types
|
|
14
|
+
// ============================================================================
|
|
15
|
+
/**
|
|
16
|
+
* AgentShield API error class
|
|
17
|
+
*/
|
|
18
|
+
class AgentShieldAPIError extends Error {
|
|
19
|
+
constructor(code, message, details) {
|
|
20
|
+
super(message);
|
|
21
|
+
this.code = code;
|
|
22
|
+
this.details = details;
|
|
23
|
+
this.name = 'AgentShieldAPIError';
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.AgentShieldAPIError = AgentShieldAPIError;
|
|
27
|
+
//# sourceMappingURL=types.js.map
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* CLI command schemas and results
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* CLI Identity File Format Schema
|
|
7
|
+
*
|
|
8
|
+
* Format for identity.json files stored on disk.
|
|
9
|
+
* Used by CLI tools for identity management.
|
|
10
|
+
*/
|
|
2
11
|
export declare const CLIIdentityFileSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
3
12
|
version: z.ZodLiteral<"1.0">;
|
|
4
13
|
did: z.ZodString;
|
|
@@ -350,6 +359,10 @@ export type CacheInfo = z.infer<typeof CacheInfoSchema>;
|
|
|
350
359
|
export type DoctorResult = z.infer<typeof DoctorResultSchema>;
|
|
351
360
|
export type ScaffolderOptions = z.infer<typeof ScaffolderOptionsSchema>;
|
|
352
361
|
export type ScaffolderResult = z.infer<typeof ScaffolderResultSchema>;
|
|
362
|
+
/**
|
|
363
|
+
* @deprecated Use CLIIdentityFile instead
|
|
364
|
+
* This export is maintained for backward compatibility
|
|
365
|
+
*/
|
|
353
366
|
export type IdentityConfig = CLIIdentityFile;
|
|
354
367
|
export declare const ERROR_CODES: {
|
|
355
368
|
readonly XMCP_I_EBADPROOF: "XMCP_I_EBADPROOF";
|
package/dist/cli.js
CHANGED
|
@@ -2,9 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
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
|
+
/**
|
|
9
|
+
* CLI Identity File Format Schema
|
|
10
|
+
*
|
|
11
|
+
* Format for identity.json files stored on disk.
|
|
12
|
+
* Used by CLI tools for identity management.
|
|
13
|
+
*/
|
|
5
14
|
exports.CLIIdentityFileSchema = zod_1.z.object({
|
|
6
15
|
version: zod_1.z.literal("1.0"),
|
|
7
16
|
did: zod_1.z.string().min(1),
|
|
17
|
+
// Accept both kid and keyId for backward compatibility with pre-1.3 identity files
|
|
8
18
|
kid: zod_1.z.string().min(1).optional(),
|
|
9
19
|
keyId: zod_1.z.string().min(1).optional(),
|
|
10
20
|
privateKey: zod_1.z.string().regex(/^[A-Za-z0-9+/]{43}=$/, "Must be a valid base64-encoded Ed25519 private key (44 characters)"),
|
|
@@ -34,7 +44,7 @@ exports.KeyRotationResultSchema = zod_1.z.object({
|
|
|
34
44
|
});
|
|
35
45
|
exports.StatusReportSchema = zod_1.z.object({
|
|
36
46
|
did: zod_1.z.string().min(1),
|
|
37
|
-
kid: zod_1.z.string().min(1),
|
|
47
|
+
kid: zod_1.z.string().min(1), // Changed from keyId to kid for spec compliance
|
|
38
48
|
ktaURL: zod_1.z.string().url(),
|
|
39
49
|
mirrorStatus: zod_1.z.enum(["pending", "success", "error"]),
|
|
40
50
|
lastHandshake: zod_1.z.number().int().positive().optional(),
|
|
@@ -86,6 +96,7 @@ exports.ScaffolderResultSchema = zod_1.z.object({
|
|
|
86
96
|
identityEnabled: zod_1.z.boolean(),
|
|
87
97
|
warnings: zod_1.z.array(zod_1.z.string()).optional(),
|
|
88
98
|
});
|
|
99
|
+
// Error codes as string literal union
|
|
89
100
|
exports.ERROR_CODES = {
|
|
90
101
|
XMCP_I_EBADPROOF: "XMCP_I_EBADPROOF",
|
|
91
102
|
XMCP_I_ENOIDENTITY: "XMCP_I_ENOIDENTITY",
|
|
@@ -96,6 +107,7 @@ exports.ERROR_CODES = {
|
|
|
96
107
|
XMCP_I_ECONFIG: "XMCP_I_ECONFIG",
|
|
97
108
|
XMCP_I_ERUNTIME: "XMCP_I_ERUNTIME",
|
|
98
109
|
};
|
|
110
|
+
// CLI exit codes
|
|
99
111
|
exports.CLI_EXIT_CODES = {
|
|
100
112
|
SUCCESS: 0,
|
|
101
113
|
GENERAL_ERROR: 1,
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Configuration Types
|
|
3
|
+
*
|
|
4
|
+
* Shared configuration interfaces that are platform-agnostic and used
|
|
5
|
+
* across all XMCP-I implementations. These form the foundation of the
|
|
6
|
+
* configuration hierarchy.
|
|
7
|
+
*
|
|
8
|
+
* @module @kya-os/contracts/config
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Base configuration shared across ALL platforms
|
|
12
|
+
*
|
|
13
|
+
* This interface defines the core configuration options that are
|
|
14
|
+
* universally applicable regardless of the runtime platform (Node.js,
|
|
15
|
+
* Cloudflare Workers, etc.).
|
|
16
|
+
*/
|
|
17
|
+
export interface MCPIBaseConfig {
|
|
18
|
+
/**
|
|
19
|
+
* Runtime environment setting
|
|
20
|
+
* - 'development': Enables debug logging, dev identity, relaxed security
|
|
21
|
+
* - 'production': Production security, identity from env vars, minimal logging
|
|
22
|
+
*/
|
|
23
|
+
environment: 'development' | 'production';
|
|
24
|
+
/**
|
|
25
|
+
* Session configuration
|
|
26
|
+
* Controls how sessions are managed and validated
|
|
27
|
+
*/
|
|
28
|
+
session?: {
|
|
29
|
+
/**
|
|
30
|
+
* Maximum time skew allowed for timestamp validation (in seconds)
|
|
31
|
+
* Helps handle clock drift between client and server
|
|
32
|
+
* @default 120
|
|
33
|
+
*/
|
|
34
|
+
timestampSkewSeconds?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Session time-to-live in minutes
|
|
37
|
+
* How long a session remains valid after creation
|
|
38
|
+
* @default 30
|
|
39
|
+
*/
|
|
40
|
+
ttlMinutes?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Absolute session lifetime in minutes (optional)
|
|
43
|
+
* Maximum lifetime regardless of activity
|
|
44
|
+
*/
|
|
45
|
+
absoluteLifetime?: number;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Audit logging configuration
|
|
49
|
+
* Controls what gets logged for security and compliance
|
|
50
|
+
*/
|
|
51
|
+
audit?: {
|
|
52
|
+
/**
|
|
53
|
+
* Enable audit logging
|
|
54
|
+
* @default true in production, false in development
|
|
55
|
+
*/
|
|
56
|
+
enabled: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Include proof hashes in audit logs
|
|
59
|
+
* Useful for cryptographic verification but increases log size
|
|
60
|
+
* @default false
|
|
61
|
+
*/
|
|
62
|
+
includeProofHashes?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Include full payloads in audit logs
|
|
65
|
+
* WARNING: May include sensitive data
|
|
66
|
+
* @default false
|
|
67
|
+
*/
|
|
68
|
+
includePayloads?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Custom log function for audit records
|
|
71
|
+
* If not provided, uses console.log
|
|
72
|
+
*/
|
|
73
|
+
logFunction?: (record: string) => void;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Well-known endpoints configuration
|
|
77
|
+
* Controls the /.well-known/* endpoints for identity discovery
|
|
78
|
+
*/
|
|
79
|
+
wellKnown?: {
|
|
80
|
+
/**
|
|
81
|
+
* Enable well-known endpoints
|
|
82
|
+
* @default true
|
|
83
|
+
*/
|
|
84
|
+
enabled: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Service name advertised in well-known endpoints
|
|
87
|
+
* @default 'MCP-I Service'
|
|
88
|
+
*/
|
|
89
|
+
serviceName?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Service endpoint URL
|
|
92
|
+
* @default 'https://example.com'
|
|
93
|
+
*/
|
|
94
|
+
serviceEndpoint?: string;
|
|
95
|
+
};
|
|
96
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Base Configuration Types
|
|
4
|
+
*
|
|
5
|
+
* Shared configuration interfaces that are platform-agnostic and used
|
|
6
|
+
* across all XMCP-I implementations. These form the foundation of the
|
|
7
|
+
* configuration hierarchy.
|
|
8
|
+
*
|
|
9
|
+
* @module @kya-os/contracts/config
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|