@kya-os/contracts 1.5.3-canary.21 → 1.5.3-canary.23
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/consent/schemas.d.ts +149 -77
- package/dist/consent/schemas.js +29 -2
- package/package.json +23 -1
- package/.turbo/turbo-build.log +0 -17
- package/.turbo/turbo-test$colon$coverage.log +0 -85
- package/.turbo/turbo-test.log +0 -32
- package/coverage/coverage-final.json +0 -38
- package/schemas/cli/register-output/v1.0.0.json +0 -69
- package/schemas/identity/v1.0.0.json +0 -46
- package/schemas/proof/v1.0.0.json +0 -80
- package/schemas/registry/receipt-v1.0.0.json +0 -60
- package/schemas/verifier/verify-page/v1.0.0.json +0 -94
- package/schemas/well-known/agent/v1.0.0.json +0 -67
- package/schemas/well-known/did/v1.0.0.json +0 -174
- package/scripts/emit-schemas.js +0 -11
- package/src/agentshield-api/admin-schemas.ts +0 -31
- package/src/agentshield-api/admin-types.ts +0 -47
- package/src/agentshield-api/endpoints.ts +0 -60
- package/src/agentshield-api/index.ts +0 -70
- package/src/agentshield-api/schemas.ts +0 -304
- package/src/agentshield-api/types.ts +0 -317
- package/src/audit/index.ts +0 -128
- package/src/cli.ts +0 -156
- package/src/config/base.ts +0 -107
- package/src/config/builder.ts +0 -97
- package/src/config/delegation.ts +0 -232
- package/src/config/identity.ts +0 -252
- package/src/config/index.ts +0 -78
- package/src/config/proofing.ts +0 -138
- package/src/config/tool-context.ts +0 -41
- package/src/config/tool-protection.ts +0 -174
- package/src/consent/index.ts +0 -32
- package/src/consent/schemas.ts +0 -334
- package/src/consent/types.ts +0 -199
- package/src/dashboard-config/default-config.json +0 -86
- package/src/dashboard-config/default-config.ts +0 -266
- package/src/dashboard-config/index.ts +0 -48
- package/src/dashboard-config/schemas.ts +0 -286
- package/src/dashboard-config/types.ts +0 -404
- package/src/delegation/constraints.ts +0 -267
- package/src/delegation/index.ts +0 -8
- package/src/delegation/schemas.ts +0 -595
- package/src/did/index.ts +0 -9
- package/src/did/resolve-contract.ts +0 -255
- package/src/did/schemas.ts +0 -190
- package/src/did/types.ts +0 -224
- package/src/env/constants.ts +0 -70
- package/src/env/index.ts +0 -5
- package/src/handshake.ts +0 -125
- package/src/index.ts +0 -45
- package/src/proof/index.ts +0 -31
- package/src/proof/proof-record.ts +0 -163
- package/src/proof/signing-spec.ts +0 -146
- package/src/proof.ts +0 -99
- package/src/registry.ts +0 -146
- package/src/runtime/errors.ts +0 -153
- package/src/runtime/headers.ts +0 -136
- package/src/runtime/index.ts +0 -6
- package/src/test.ts +0 -143
- package/src/tlkrc/index.ts +0 -5
- package/src/tlkrc/rotation.ts +0 -153
- package/src/tool-protection/index.ts +0 -406
- package/src/utils/validation.ts +0 -93
- package/src/vc/index.ts +0 -8
- package/src/vc/schemas.ts +0 -277
- package/src/vc/statuslist.ts +0 -279
- package/src/verifier/index.ts +0 -2
- package/src/verifier.ts +0 -92
- package/src/well-known/index.ts +0 -237
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Default Configuration for MCP-I Servers
|
|
3
|
-
*
|
|
4
|
-
* Provides safe, production-ready defaults for new user configurations.
|
|
5
|
-
* Used by AgentShield Dashboard, Scaffolder, and Runtime fallbacks.
|
|
6
|
-
*
|
|
7
|
-
* @package @kya-os/contracts/dashboard-config
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import type { MCPIServerConfig } from "./types.js";
|
|
11
|
-
import { mcpIServerConfigSchema } from "./schemas.js";
|
|
12
|
-
import { z } from "zod";
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Default configuration JSON content
|
|
16
|
-
* Embedded here to avoid TypeScript JSON import issues in build
|
|
17
|
-
*/
|
|
18
|
-
const defaultConfigJson = {
|
|
19
|
-
identity: {
|
|
20
|
-
// agentDid removed - deprecated, use serverDid instead
|
|
21
|
-
serverDid: "", // New field - will be populated when identity is generated
|
|
22
|
-
environment: "development" as const,
|
|
23
|
-
storageLocation: "env-vars" as const,
|
|
24
|
-
},
|
|
25
|
-
proofing: {
|
|
26
|
-
enabled: true,
|
|
27
|
-
destinations: [
|
|
28
|
-
{
|
|
29
|
-
type: "agentshield" as const,
|
|
30
|
-
apiUrl: "https://kya.vouched.id",
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
batchQueue: {
|
|
34
|
-
maxBatchSize: 10,
|
|
35
|
-
flushIntervalMs: 5000,
|
|
36
|
-
maxRetries: 3,
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
delegation: {
|
|
40
|
-
enabled: true,
|
|
41
|
-
enforceStrictly: false,
|
|
42
|
-
verifier: {
|
|
43
|
-
type: "agentshield" as const,
|
|
44
|
-
apiUrl: "https://kya.vouched.id/api/v1/bouncer/delegations/verify",
|
|
45
|
-
cacheTtl: 300000,
|
|
46
|
-
},
|
|
47
|
-
authorization: {
|
|
48
|
-
authorizationUrl:
|
|
49
|
-
"https://kya.vouched.id/api/v1/bouncer/delegations/authorize",
|
|
50
|
-
minReputationScore: 80,
|
|
51
|
-
resumeTokenTtl: 3600000,
|
|
52
|
-
requireAuthForUnknown: false,
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
toolProtection: {
|
|
56
|
-
source: "agentshield" as const,
|
|
57
|
-
agentShield: {
|
|
58
|
-
apiUrl: "https://kya.vouched.id",
|
|
59
|
-
cacheTtl: 300000,
|
|
60
|
-
},
|
|
61
|
-
fallback: {},
|
|
62
|
-
},
|
|
63
|
-
audit: {
|
|
64
|
-
enabled: true,
|
|
65
|
-
includeProofHashes: false,
|
|
66
|
-
includePayloads: false,
|
|
67
|
-
},
|
|
68
|
-
session: {
|
|
69
|
-
timestampSkewSeconds: 120,
|
|
70
|
-
ttlMinutes: 30,
|
|
71
|
-
},
|
|
72
|
-
platform: {
|
|
73
|
-
type: "node" as const,
|
|
74
|
-
node: {
|
|
75
|
-
server: {
|
|
76
|
-
port: 3000,
|
|
77
|
-
host: "0.0.0.0",
|
|
78
|
-
cors: true,
|
|
79
|
-
timeout: 30000,
|
|
80
|
-
},
|
|
81
|
-
storage: {
|
|
82
|
-
type: "memory" as const,
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
cloudflare: {
|
|
86
|
-
workers: {
|
|
87
|
-
cpuMs: 50,
|
|
88
|
-
memoryMb: 128,
|
|
89
|
-
},
|
|
90
|
-
kvNamespaces: [],
|
|
91
|
-
environmentVariables: [],
|
|
92
|
-
},
|
|
93
|
-
vercel: {
|
|
94
|
-
environmentVariables: [],
|
|
95
|
-
edgeRuntime: {},
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
metadata: {
|
|
99
|
-
version: "1.0.0",
|
|
100
|
-
lastUpdated: "",
|
|
101
|
-
source: "dashboard" as const,
|
|
102
|
-
deploymentStatus: "inactive" as const,
|
|
103
|
-
},
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Relaxed schema for default config validation
|
|
108
|
-
* Allows empty strings for fields that will be populated later
|
|
109
|
-
*
|
|
110
|
-
* Note: Empty `agentDid` is valid for new/incomplete configurations.
|
|
111
|
-
* This allows users to create configs before registering their agent DID.
|
|
112
|
-
* The base schema (mcpIServerConfigSchema) requires non-empty agentDid for
|
|
113
|
-
* complete configurations, but defaults allow empty to support progressive
|
|
114
|
-
* configuration.
|
|
115
|
-
*/
|
|
116
|
-
const defaultConfigSchema = mcpIServerConfigSchema.extend({
|
|
117
|
-
identity: mcpIServerConfigSchema.shape.identity.extend({
|
|
118
|
-
agentDid: z.string().optional(), // Allow empty string or undefined for defaults (deprecated)
|
|
119
|
-
serverDid: z.string(), // Allow empty string for defaults (will be populated later)
|
|
120
|
-
}),
|
|
121
|
-
metadata: mcpIServerConfigSchema.shape.metadata.extend({
|
|
122
|
-
lastUpdated: z.string(), // Allow empty string (will be set dynamically)
|
|
123
|
-
}),
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Default configuration object
|
|
128
|
-
*
|
|
129
|
-
* This is the base default configuration used when creating new user configs.
|
|
130
|
-
* Platform-specific defaults are available via getDefaultConfigForPlatform().
|
|
131
|
-
*/
|
|
132
|
-
export const defaultConfig: MCPIServerConfig = defaultConfigSchema.parse(
|
|
133
|
-
defaultConfigJson
|
|
134
|
-
) as MCPIServerConfig;
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Platform-specific default configurations
|
|
138
|
-
*/
|
|
139
|
-
const platformDefaults = {
|
|
140
|
-
node: {
|
|
141
|
-
platform: {
|
|
142
|
-
type: "node" as const,
|
|
143
|
-
node: {
|
|
144
|
-
server: {
|
|
145
|
-
port: 3000,
|
|
146
|
-
host: "0.0.0.0",
|
|
147
|
-
cors: true,
|
|
148
|
-
timeout: 30000,
|
|
149
|
-
},
|
|
150
|
-
storage: {
|
|
151
|
-
type: "memory" as const,
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
cloudflare: {
|
|
157
|
-
platform: {
|
|
158
|
-
type: "cloudflare" as const,
|
|
159
|
-
cloudflare: {
|
|
160
|
-
workers: {
|
|
161
|
-
cpuMs: 50,
|
|
162
|
-
memoryMb: 128,
|
|
163
|
-
},
|
|
164
|
-
kvNamespaces: [],
|
|
165
|
-
environmentVariables: [],
|
|
166
|
-
},
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
vercel: {
|
|
170
|
-
platform: {
|
|
171
|
-
type: "vercel" as const,
|
|
172
|
-
vercel: {
|
|
173
|
-
environmentVariables: [],
|
|
174
|
-
edgeRuntime: {},
|
|
175
|
-
},
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Get default configuration for a specific platform
|
|
182
|
-
*
|
|
183
|
-
* Returns the base default config merged with platform-specific defaults.
|
|
184
|
-
*
|
|
185
|
-
* @param platform - Platform type ('node', 'cloudflare', or 'vercel')
|
|
186
|
-
* @returns Platform-specific default configuration
|
|
187
|
-
*
|
|
188
|
-
* @example
|
|
189
|
-
* ```typescript
|
|
190
|
-
* const nodeConfig = getDefaultConfigForPlatform('node');
|
|
191
|
-
* const cloudflareConfig = getDefaultConfigForPlatform('cloudflare');
|
|
192
|
-
* ```
|
|
193
|
-
*/
|
|
194
|
-
export function getDefaultConfigForPlatform(
|
|
195
|
-
platform: "node" | "cloudflare" | "vercel"
|
|
196
|
-
): MCPIServerConfig {
|
|
197
|
-
const platformDefault = platformDefaults[platform];
|
|
198
|
-
|
|
199
|
-
return {
|
|
200
|
-
...defaultConfig,
|
|
201
|
-
platform: platformDefault.platform,
|
|
202
|
-
} as MCPIServerConfig;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Deep merge utility for objects
|
|
207
|
-
*/
|
|
208
|
-
function deepMerge<T extends Record<string, unknown>>(
|
|
209
|
-
target: T,
|
|
210
|
-
source: Partial<T>
|
|
211
|
-
): T {
|
|
212
|
-
const result = { ...target } as T;
|
|
213
|
-
|
|
214
|
-
for (const key in source) {
|
|
215
|
-
const sourceValue = source[key];
|
|
216
|
-
if (
|
|
217
|
-
sourceValue &&
|
|
218
|
-
typeof sourceValue === "object" &&
|
|
219
|
-
!Array.isArray(sourceValue) &&
|
|
220
|
-
sourceValue !== null
|
|
221
|
-
) {
|
|
222
|
-
const targetValue = target[key];
|
|
223
|
-
if (
|
|
224
|
-
targetValue &&
|
|
225
|
-
typeof targetValue === "object" &&
|
|
226
|
-
!Array.isArray(targetValue) &&
|
|
227
|
-
targetValue !== null
|
|
228
|
-
) {
|
|
229
|
-
result[key] = deepMerge(
|
|
230
|
-
targetValue as Record<string, unknown>,
|
|
231
|
-
sourceValue as Record<string, unknown>
|
|
232
|
-
) as T[Extract<keyof T, string>];
|
|
233
|
-
}
|
|
234
|
-
} else if (sourceValue !== undefined) {
|
|
235
|
-
result[key] = sourceValue as T[Extract<keyof T, string>];
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
return result;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* Merge partial configuration with defaults
|
|
244
|
-
*
|
|
245
|
-
* Deep merges a partial configuration object with the base defaults,
|
|
246
|
-
* ensuring all required fields are present.
|
|
247
|
-
*
|
|
248
|
-
* @param partial - Partial configuration to merge with defaults
|
|
249
|
-
* @returns Complete configuration with defaults applied
|
|
250
|
-
*
|
|
251
|
-
* @example
|
|
252
|
-
* ```typescript
|
|
253
|
-
* const config = mergeWithDefaults({
|
|
254
|
-
* proofing: { enabled: false },
|
|
255
|
-
* identity: { environment: 'production' }
|
|
256
|
-
* });
|
|
257
|
-
* ```
|
|
258
|
-
*/
|
|
259
|
-
export function mergeWithDefaults(
|
|
260
|
-
partial: Partial<MCPIServerConfig>
|
|
261
|
-
): MCPIServerConfig {
|
|
262
|
-
return deepMerge(
|
|
263
|
-
defaultConfig as unknown as Record<string, unknown>,
|
|
264
|
-
partial as unknown as Record<string, unknown>
|
|
265
|
-
) as unknown as MCPIServerConfig;
|
|
266
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dashboard Configuration Module
|
|
3
|
-
*
|
|
4
|
-
* Central export point for dashboard configuration types and schemas.
|
|
5
|
-
*
|
|
6
|
-
* @package @kya-os/contracts/dashboard-config
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
// Type exports
|
|
10
|
-
export type {
|
|
11
|
-
MCPIServerConfig,
|
|
12
|
-
GetServerConfigRequest,
|
|
13
|
-
GetServerConfigResponse,
|
|
14
|
-
UpdateServerConfigRequest,
|
|
15
|
-
UpdateServerConfigResponse,
|
|
16
|
-
ValidateServerConfigRequest,
|
|
17
|
-
ValidateServerConfigResponse,
|
|
18
|
-
} from './types.js';
|
|
19
|
-
|
|
20
|
-
// Schema exports
|
|
21
|
-
export {
|
|
22
|
-
identityConfigSchema,
|
|
23
|
-
proofingConfigSchema,
|
|
24
|
-
delegationConfigSchema,
|
|
25
|
-
toolProtectionConfigSchema,
|
|
26
|
-
auditConfigSchema,
|
|
27
|
-
sessionConfigSchema,
|
|
28
|
-
platformConfigSchema,
|
|
29
|
-
cloudflarePlatformConfigSchema,
|
|
30
|
-
nodePlatformConfigSchema,
|
|
31
|
-
vercelPlatformConfigSchema,
|
|
32
|
-
configMetadataSchema,
|
|
33
|
-
mcpIServerConfigSchema,
|
|
34
|
-
getServerConfigRequestSchema,
|
|
35
|
-
getServerConfigResponseSchema,
|
|
36
|
-
updateServerConfigRequestSchema,
|
|
37
|
-
updateServerConfigResponseSchema,
|
|
38
|
-
validateServerConfigRequestSchema,
|
|
39
|
-
validateServerConfigResponseSchema,
|
|
40
|
-
} from './schemas.js';
|
|
41
|
-
|
|
42
|
-
// Default configuration exports
|
|
43
|
-
export {
|
|
44
|
-
defaultConfig,
|
|
45
|
-
getDefaultConfigForPlatform,
|
|
46
|
-
mergeWithDefaults,
|
|
47
|
-
} from './default-config.js';
|
|
48
|
-
|
|
@@ -1,286 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dashboard Configuration Zod Schemas
|
|
3
|
-
*
|
|
4
|
-
* Runtime validation schemas for dashboard configuration types.
|
|
5
|
-
* Used for validating API requests and responses.
|
|
6
|
-
*
|
|
7
|
-
* @package @kya-os/contracts/dashboard-config
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { z } from 'zod';
|
|
11
|
-
import { ToolProtectionSchema, ToolProtectionMapSchema } from '../tool-protection/index.js';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Identity configuration schema
|
|
15
|
-
*/
|
|
16
|
-
export const identityConfigSchema = z.object({
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated Use serverDid instead. Will be removed in v2.0
|
|
19
|
-
*/
|
|
20
|
-
agentDid: z.string().min(1).optional(),
|
|
21
|
-
serverDid: z.string().min(1),
|
|
22
|
-
environment: z.enum(['development', 'production']),
|
|
23
|
-
storageLocation: z.enum(['cloudflare-kv', 'file-system', 'env-vars']),
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Proofing configuration schema
|
|
28
|
-
*/
|
|
29
|
-
export const proofingConfigSchema = z.object({
|
|
30
|
-
enabled: z.boolean(),
|
|
31
|
-
destinations: z.array(
|
|
32
|
-
z.object({
|
|
33
|
-
type: z.enum(['agentshield', 'kta', 'custom']),
|
|
34
|
-
apiUrl: z.string().url(),
|
|
35
|
-
apiKey: z.string().optional(),
|
|
36
|
-
})
|
|
37
|
-
),
|
|
38
|
-
batchQueue: z.object({
|
|
39
|
-
maxBatchSize: z.number().int().positive().default(10),
|
|
40
|
-
flushIntervalMs: z.number().int().positive().default(5000),
|
|
41
|
-
maxRetries: z.number().int().nonnegative().default(3),
|
|
42
|
-
}),
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Delegation verifier type schema
|
|
47
|
-
*/
|
|
48
|
-
const delegationVerifierTypeSchema = z.enum([
|
|
49
|
-
'agentshield',
|
|
50
|
-
'kta',
|
|
51
|
-
'memory',
|
|
52
|
-
'cloudflare-kv',
|
|
53
|
-
'redis',
|
|
54
|
-
'dynamodb',
|
|
55
|
-
'custom',
|
|
56
|
-
]);
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Delegation configuration schema
|
|
60
|
-
*/
|
|
61
|
-
export const delegationConfigSchema = z.object({
|
|
62
|
-
enabled: z.boolean(),
|
|
63
|
-
enforceStrictly: z.boolean(),
|
|
64
|
-
verifier: z.object({
|
|
65
|
-
type: delegationVerifierTypeSchema,
|
|
66
|
-
apiUrl: z.string().url().optional(),
|
|
67
|
-
cacheTtl: z.number().int().positive().optional(),
|
|
68
|
-
}),
|
|
69
|
-
authorization: z.object({
|
|
70
|
-
authorizationUrl: z.string().url().optional(),
|
|
71
|
-
minReputationScore: z.number().int().min(0).max(100).optional(),
|
|
72
|
-
resumeTokenTtl: z.number().int().positive().optional(),
|
|
73
|
-
requireAuthForUnknown: z.boolean().optional(),
|
|
74
|
-
}),
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Tool protection configuration schema
|
|
79
|
-
*/
|
|
80
|
-
export const toolProtectionConfigSchema = z.object({
|
|
81
|
-
source: z.enum(['agentshield', 'inline', 'file']),
|
|
82
|
-
agentShield: z.object({
|
|
83
|
-
apiUrl: z.string().url(),
|
|
84
|
-
cacheTtl: z.number().int().positive(),
|
|
85
|
-
}).optional(),
|
|
86
|
-
fallback: ToolProtectionMapSchema.optional(),
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Audit configuration schema
|
|
91
|
-
*/
|
|
92
|
-
export const auditConfigSchema = z.object({
|
|
93
|
-
enabled: z.boolean(),
|
|
94
|
-
includeProofHashes: z.boolean(),
|
|
95
|
-
includePayloads: z.boolean(),
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Session configuration schema
|
|
100
|
-
*/
|
|
101
|
-
export const sessionConfigSchema = z.object({
|
|
102
|
-
timestampSkewSeconds: z.number().int().positive().default(120),
|
|
103
|
-
ttlMinutes: z.number().int().positive().default(30),
|
|
104
|
-
absoluteLifetime: z.number().int().positive().optional(),
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Cloudflare platform configuration schema
|
|
109
|
-
*/
|
|
110
|
-
export const cloudflarePlatformConfigSchema = z.object({
|
|
111
|
-
workers: z.object({
|
|
112
|
-
cpuMs: z.number().int().positive().default(50),
|
|
113
|
-
memoryMb: z.number().int().positive().default(128),
|
|
114
|
-
}),
|
|
115
|
-
kvNamespaces: z.array(
|
|
116
|
-
z.object({
|
|
117
|
-
name: z.string().min(1),
|
|
118
|
-
purpose: z.enum(['sessions', 'delegations', 'cache', 'general']),
|
|
119
|
-
})
|
|
120
|
-
),
|
|
121
|
-
environmentVariables: z.array(
|
|
122
|
-
z.object({
|
|
123
|
-
name: z.string().min(1),
|
|
124
|
-
value: z.string(),
|
|
125
|
-
source: z.enum(['wrangler.toml', 'secrets', '.dev.vars']),
|
|
126
|
-
})
|
|
127
|
-
),
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Node.js platform configuration schema
|
|
132
|
-
*/
|
|
133
|
-
export const nodePlatformConfigSchema = z.object({
|
|
134
|
-
server: z.object({
|
|
135
|
-
port: z.number().int().positive().default(3000),
|
|
136
|
-
host: z.string().default('0.0.0.0'),
|
|
137
|
-
cors: z.boolean().default(true),
|
|
138
|
-
timeout: z.number().int().positive().default(30000),
|
|
139
|
-
}),
|
|
140
|
-
storage: z.object({
|
|
141
|
-
type: z.enum(['memory', 'redis', 'postgres', 'mongodb']),
|
|
142
|
-
connection: z.object({
|
|
143
|
-
host: z.string().optional(),
|
|
144
|
-
port: z.number().int().positive().optional(),
|
|
145
|
-
database: z.string().optional(),
|
|
146
|
-
}).optional(),
|
|
147
|
-
}),
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Vercel platform configuration schema
|
|
152
|
-
*/
|
|
153
|
-
export const vercelPlatformConfigSchema = z.object({
|
|
154
|
-
environmentVariables: z.array(
|
|
155
|
-
z.object({
|
|
156
|
-
name: z.string().min(1),
|
|
157
|
-
value: z.string(),
|
|
158
|
-
source: z.enum(['vercel-dashboard', '.env.local']),
|
|
159
|
-
})
|
|
160
|
-
),
|
|
161
|
-
edgeRuntime: z.object({
|
|
162
|
-
maxDuration: z.number().int().positive().optional(),
|
|
163
|
-
regions: z.array(z.string()).optional(),
|
|
164
|
-
}).optional(),
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Platform configuration schema
|
|
169
|
-
*/
|
|
170
|
-
export const platformConfigSchema = z.object({
|
|
171
|
-
type: z.enum(['cloudflare', 'node', 'vercel']),
|
|
172
|
-
cloudflare: cloudflarePlatformConfigSchema.optional(),
|
|
173
|
-
node: nodePlatformConfigSchema.optional(),
|
|
174
|
-
vercel: vercelPlatformConfigSchema.optional(),
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Metadata schema
|
|
179
|
-
*/
|
|
180
|
-
export const configMetadataSchema = z.object({
|
|
181
|
-
version: z.string(),
|
|
182
|
-
lastUpdated: z.string(),
|
|
183
|
-
source: z.enum(['dashboard', 'code', 'mixed']),
|
|
184
|
-
serverUrl: z.string().url().optional(),
|
|
185
|
-
deploymentStatus: z.enum(['active', 'inactive', 'error']).optional(),
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Complete MCP-I Server Configuration schema
|
|
190
|
-
*/
|
|
191
|
-
export const mcpIServerConfigSchema = z.object({
|
|
192
|
-
identity: identityConfigSchema,
|
|
193
|
-
proofing: proofingConfigSchema,
|
|
194
|
-
delegation: delegationConfigSchema,
|
|
195
|
-
toolProtection: toolProtectionConfigSchema,
|
|
196
|
-
audit: auditConfigSchema,
|
|
197
|
-
session: sessionConfigSchema,
|
|
198
|
-
platform: platformConfigSchema,
|
|
199
|
-
metadata: configMetadataSchema,
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Get server config request schema
|
|
204
|
-
*/
|
|
205
|
-
export const getServerConfigRequestSchema = z.object({
|
|
206
|
-
projectId: z.string().min(1),
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* Get server config response schema
|
|
211
|
-
*/
|
|
212
|
-
export const getServerConfigResponseSchema = z.object({
|
|
213
|
-
success: z.boolean(),
|
|
214
|
-
data: z.object({
|
|
215
|
-
config: mcpIServerConfigSchema,
|
|
216
|
-
}),
|
|
217
|
-
metadata: z.object({
|
|
218
|
-
requestId: z.string().optional(),
|
|
219
|
-
timestamp: z.string().optional(),
|
|
220
|
-
}).optional(),
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* Update server config request schema
|
|
225
|
-
*/
|
|
226
|
-
export const updateServerConfigRequestSchema = z.object({
|
|
227
|
-
projectId: z.string().min(1),
|
|
228
|
-
config: mcpIServerConfigSchema.partial(),
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Update server config response schema
|
|
233
|
-
*/
|
|
234
|
-
export const updateServerConfigResponseSchema = z.object({
|
|
235
|
-
success: z.boolean(),
|
|
236
|
-
data: z.object({
|
|
237
|
-
config: mcpIServerConfigSchema,
|
|
238
|
-
changes: z.array(
|
|
239
|
-
z.object({
|
|
240
|
-
path: z.string(),
|
|
241
|
-
oldValue: z.unknown(),
|
|
242
|
-
newValue: z.unknown(),
|
|
243
|
-
})
|
|
244
|
-
),
|
|
245
|
-
}),
|
|
246
|
-
metadata: z.object({
|
|
247
|
-
requestId: z.string().optional(),
|
|
248
|
-
timestamp: z.string().optional(),
|
|
249
|
-
}).optional(),
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Validate server config request schema
|
|
254
|
-
*/
|
|
255
|
-
export const validateServerConfigRequestSchema = z.object({
|
|
256
|
-
projectId: z.string().min(1),
|
|
257
|
-
config: mcpIServerConfigSchema.partial(),
|
|
258
|
-
});
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* Validate server config response schema
|
|
262
|
-
*/
|
|
263
|
-
export const validateServerConfigResponseSchema = z.object({
|
|
264
|
-
success: z.boolean(),
|
|
265
|
-
data: z.object({
|
|
266
|
-
valid: z.boolean(),
|
|
267
|
-
errors: z.array(
|
|
268
|
-
z.object({
|
|
269
|
-
path: z.string(),
|
|
270
|
-
message: z.string(),
|
|
271
|
-
code: z.string(),
|
|
272
|
-
})
|
|
273
|
-
).optional(),
|
|
274
|
-
warnings: z.array(
|
|
275
|
-
z.object({
|
|
276
|
-
path: z.string(),
|
|
277
|
-
message: z.string(),
|
|
278
|
-
})
|
|
279
|
-
).optional(),
|
|
280
|
-
}),
|
|
281
|
-
metadata: z.object({
|
|
282
|
-
requestId: z.string().optional(),
|
|
283
|
-
timestamp: z.string().optional(),
|
|
284
|
-
}).optional(),
|
|
285
|
-
});
|
|
286
|
-
|