@kya-os/contracts 1.5.3-canary.16 → 1.5.3-canary.17
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/.turbo/turbo-build.log +17 -0
- package/.turbo/turbo-test$colon$coverage.log +85 -0
- package/.turbo/turbo-test.log +32 -0
- package/coverage/coverage-final.json +38 -0
- package/dist/consent/schemas.d.ts +18 -0
- package/dist/consent/schemas.js +10 -0
- package/dist/dashboard-config/schemas.d.ts +1424 -220
- package/dist/tool-protection/index.d.ts +418 -8
- package/dist/tool-protection/index.js +61 -2
- package/package.json +35 -129
- package/schemas/cli/register-output/v1.0.0.json +69 -0
- package/schemas/identity/v1.0.0.json +46 -0
- package/schemas/proof/v1.0.0.json +80 -0
- package/schemas/registry/receipt-v1.0.0.json +60 -0
- package/schemas/verifier/verify-page/v1.0.0.json +94 -0
- package/schemas/well-known/agent/v1.0.0.json +67 -0
- package/schemas/well-known/did/v1.0.0.json +174 -0
- package/scripts/emit-schemas.js +11 -0
- package/src/agentshield-api/admin-schemas.ts +31 -0
- package/src/agentshield-api/admin-types.ts +47 -0
- package/src/agentshield-api/endpoints.ts +60 -0
- package/src/agentshield-api/index.ts +70 -0
- package/src/agentshield-api/schemas.ts +304 -0
- package/src/agentshield-api/types.ts +317 -0
- package/src/audit/index.ts +128 -0
- package/src/cli.ts +156 -0
- package/src/config/base.ts +107 -0
- package/src/config/builder.ts +97 -0
- package/src/config/delegation.ts +232 -0
- package/src/config/identity.ts +252 -0
- package/src/config/index.ts +78 -0
- package/src/config/proofing.ts +138 -0
- package/src/config/tool-context.ts +41 -0
- package/src/config/tool-protection.ts +174 -0
- package/src/consent/index.ts +32 -0
- package/src/consent/schemas.ts +334 -0
- package/src/consent/types.ts +199 -0
- package/src/dashboard-config/default-config.json +86 -0
- package/src/dashboard-config/default-config.ts +266 -0
- package/src/dashboard-config/index.ts +48 -0
- package/src/dashboard-config/schemas.ts +286 -0
- package/src/dashboard-config/types.ts +404 -0
- package/src/delegation/constraints.ts +267 -0
- package/src/delegation/index.ts +8 -0
- package/src/delegation/schemas.ts +595 -0
- package/src/did/index.ts +9 -0
- package/src/did/resolve-contract.ts +255 -0
- package/src/did/schemas.ts +190 -0
- package/src/did/types.ts +224 -0
- package/src/env/constants.ts +70 -0
- package/src/env/index.ts +5 -0
- package/src/handshake.ts +125 -0
- package/src/index.ts +45 -0
- package/src/proof/index.ts +31 -0
- package/src/proof/proof-record.ts +163 -0
- package/src/proof/signing-spec.ts +146 -0
- package/src/proof.ts +99 -0
- package/src/registry.ts +146 -0
- package/src/runtime/errors.ts +153 -0
- package/src/runtime/headers.ts +136 -0
- package/src/runtime/index.ts +6 -0
- package/src/test.ts +143 -0
- package/src/tlkrc/index.ts +5 -0
- package/src/tlkrc/rotation.ts +153 -0
- package/src/tool-protection/index.ts +343 -0
- package/src/utils/validation.ts +93 -0
- package/src/vc/index.ts +8 -0
- package/src/vc/schemas.ts +277 -0
- package/src/vc/statuslist.ts +279 -0
- package/src/verifier.ts +92 -0
- package/src/well-known/index.ts +237 -0
|
@@ -0,0 +1,286 @@
|
|
|
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
|
+
|
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dashboard Configuration Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for AgentShield dashboard server configuration management API.
|
|
5
|
+
* These types ensure parity between xmcp-i and AgentShield dashboard implementations.
|
|
6
|
+
*
|
|
7
|
+
* @package @kya-os/contracts/dashboard-config
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { ToolProtectionMap } from '../tool-protection/index.js';
|
|
11
|
+
import type { ProofDestination } from '../config/proofing.js';
|
|
12
|
+
import type { DelegationVerifierType } from '../config/delegation.js';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* MCP-I Server Configuration (Dashboard View Model)
|
|
16
|
+
*
|
|
17
|
+
* This is a flattened, UI-friendly representation of server configuration
|
|
18
|
+
* used by the AgentShield dashboard for configuration management.
|
|
19
|
+
*
|
|
20
|
+
* This type differs from MCPIConfig in that it:
|
|
21
|
+
* - Includes platform-specific details
|
|
22
|
+
* - Includes read-only metadata
|
|
23
|
+
* - Flattens nested structures for easier UI rendering
|
|
24
|
+
* - Includes deployment status information
|
|
25
|
+
*/
|
|
26
|
+
export interface MCPIServerConfig {
|
|
27
|
+
// ============================================
|
|
28
|
+
// 1. IDENTITY CONFIGURATION
|
|
29
|
+
// ============================================
|
|
30
|
+
identity: {
|
|
31
|
+
/**
|
|
32
|
+
* MCP-I Server DID (public identifier)
|
|
33
|
+
* Identifies this server instance
|
|
34
|
+
* @deprecated Use serverDid instead. Will be removed in v2.0
|
|
35
|
+
*/
|
|
36
|
+
agentDid?: string;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* MCP-I Server DID (public identifier)
|
|
40
|
+
* Identifies this server instance
|
|
41
|
+
* Read-only, displayed for reference
|
|
42
|
+
*/
|
|
43
|
+
serverDid: string;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Environment mode
|
|
47
|
+
* Controls identity source: 'development' | 'production'
|
|
48
|
+
*/
|
|
49
|
+
environment: 'development' | 'production';
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Identity storage location (read-only)
|
|
53
|
+
* Shows where identity is stored based on platform
|
|
54
|
+
*/
|
|
55
|
+
storageLocation: 'cloudflare-kv' | 'file-system' | 'env-vars';
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// ============================================
|
|
59
|
+
// 2. PROOFING CONFIGURATION
|
|
60
|
+
// ============================================
|
|
61
|
+
proofing: {
|
|
62
|
+
/**
|
|
63
|
+
* Enable proof submission
|
|
64
|
+
*/
|
|
65
|
+
enabled: boolean;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Proof destinations
|
|
69
|
+
* Where proofs are sent (AgentShield, KTA, etc.)
|
|
70
|
+
*/
|
|
71
|
+
destinations: Array<{
|
|
72
|
+
type: 'agentshield' | 'kta' | 'custom';
|
|
73
|
+
apiUrl: string;
|
|
74
|
+
apiKey?: string; // Masked, only show if user has permission
|
|
75
|
+
}>;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Batch queue settings
|
|
79
|
+
*/
|
|
80
|
+
batchQueue: {
|
|
81
|
+
maxBatchSize: number; // Default: 10
|
|
82
|
+
flushIntervalMs: number; // Default: 5000
|
|
83
|
+
maxRetries: number; // Default: 3
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// ============================================
|
|
88
|
+
// 3. DELEGATION CONFIGURATION
|
|
89
|
+
// ============================================
|
|
90
|
+
delegation: {
|
|
91
|
+
/**
|
|
92
|
+
* Enable delegation enforcement
|
|
93
|
+
*/
|
|
94
|
+
enabled: boolean;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Strict enforcement mode
|
|
98
|
+
* When true, blocks tools without delegation
|
|
99
|
+
* When false, logs warnings but allows execution
|
|
100
|
+
*/
|
|
101
|
+
enforceStrictly: boolean;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Delegation verifier settings
|
|
105
|
+
*/
|
|
106
|
+
verifier: {
|
|
107
|
+
type: DelegationVerifierType;
|
|
108
|
+
apiUrl?: string;
|
|
109
|
+
cacheTtl?: number; // Default: 300000 (5 minutes)
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Authorization flow settings
|
|
114
|
+
*/
|
|
115
|
+
authorization: {
|
|
116
|
+
authorizationUrl?: string;
|
|
117
|
+
minReputationScore?: number; // 0-100, default: 80
|
|
118
|
+
resumeTokenTtl?: number; // milliseconds, default: 3600000
|
|
119
|
+
requireAuthForUnknown?: boolean;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
// ============================================
|
|
124
|
+
// 4. TOOL PROTECTION CONFIGURATION
|
|
125
|
+
// ============================================
|
|
126
|
+
toolProtection: {
|
|
127
|
+
/**
|
|
128
|
+
* Source of tool protection config
|
|
129
|
+
* 'agentshield' = Fetched from AgentShield API (dashboard-controlled)
|
|
130
|
+
* 'inline' = Defined in code/config file
|
|
131
|
+
* 'file' = Loaded from external file
|
|
132
|
+
*/
|
|
133
|
+
source: 'agentshield' | 'inline' | 'file';
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* AgentShield API settings (if source is 'agentshield')
|
|
137
|
+
*/
|
|
138
|
+
agentShield?: {
|
|
139
|
+
apiUrl: string; // Default: 'https://kya.vouched.id'
|
|
140
|
+
cacheTtl: number; // Default: 300000 (5 minutes)
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Fallback configuration
|
|
145
|
+
* Used when API is unavailable
|
|
146
|
+
* Displayed as read-only (managed via /tools page)
|
|
147
|
+
*/
|
|
148
|
+
fallback?: ToolProtectionMap;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
// ============================================
|
|
152
|
+
// 5. AUDIT & LOGGING
|
|
153
|
+
// ============================================
|
|
154
|
+
audit: {
|
|
155
|
+
/**
|
|
156
|
+
* Enable audit logging
|
|
157
|
+
*/
|
|
158
|
+
enabled: boolean;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Include proof hashes in logs
|
|
162
|
+
*/
|
|
163
|
+
includeProofHashes: boolean;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Include full payloads in logs
|
|
167
|
+
* WARNING: May include sensitive data
|
|
168
|
+
*/
|
|
169
|
+
includePayloads: boolean;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
// ============================================
|
|
173
|
+
// 6. SESSION CONFIGURATION
|
|
174
|
+
// ============================================
|
|
175
|
+
session: {
|
|
176
|
+
/**
|
|
177
|
+
* Maximum time skew allowed (seconds)
|
|
178
|
+
* Default: 120
|
|
179
|
+
*/
|
|
180
|
+
timestampSkewSeconds: number;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Session TTL (minutes)
|
|
184
|
+
* Default: 30
|
|
185
|
+
*/
|
|
186
|
+
ttlMinutes: number;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Absolute session lifetime (minutes)
|
|
190
|
+
* Optional, max lifetime regardless of activity
|
|
191
|
+
*/
|
|
192
|
+
absoluteLifetime?: number;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
// ============================================
|
|
196
|
+
// 7. PLATFORM-SPECIFIC CONFIGURATION
|
|
197
|
+
// ============================================
|
|
198
|
+
platform: {
|
|
199
|
+
/**
|
|
200
|
+
* Platform type
|
|
201
|
+
*/
|
|
202
|
+
type: 'cloudflare' | 'node' | 'vercel';
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Cloudflare-specific settings
|
|
206
|
+
*/
|
|
207
|
+
cloudflare?: {
|
|
208
|
+
/**
|
|
209
|
+
* Workers runtime settings
|
|
210
|
+
*/
|
|
211
|
+
workers: {
|
|
212
|
+
cpuMs: number; // Default: 50
|
|
213
|
+
memoryMb: number; // Default: 128
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* KV namespace bindings (read-only)
|
|
218
|
+
* Shows which KV namespaces are configured
|
|
219
|
+
*/
|
|
220
|
+
kvNamespaces: Array<{
|
|
221
|
+
name: string;
|
|
222
|
+
purpose: 'sessions' | 'delegations' | 'cache' | 'general';
|
|
223
|
+
}>;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Environment variables (masked)
|
|
227
|
+
*/
|
|
228
|
+
environmentVariables: Array<{
|
|
229
|
+
name: string;
|
|
230
|
+
value: string; // Masked (e.g., "sk_***")
|
|
231
|
+
source: 'wrangler.toml' | 'secrets' | '.dev.vars';
|
|
232
|
+
}>;
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Node.js-specific settings
|
|
237
|
+
*/
|
|
238
|
+
node?: {
|
|
239
|
+
/**
|
|
240
|
+
* Server configuration
|
|
241
|
+
*/
|
|
242
|
+
server: {
|
|
243
|
+
port: number; // Default: 3000
|
|
244
|
+
host: string; // Default: '0.0.0.0'
|
|
245
|
+
cors: boolean; // Default: true
|
|
246
|
+
timeout: number; // Default: 30000
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Storage configuration
|
|
251
|
+
*/
|
|
252
|
+
storage: {
|
|
253
|
+
type: 'memory' | 'redis' | 'postgres' | 'mongodb';
|
|
254
|
+
connection?: {
|
|
255
|
+
host?: string;
|
|
256
|
+
port?: number;
|
|
257
|
+
database?: string;
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Vercel-specific settings
|
|
264
|
+
*/
|
|
265
|
+
vercel?: {
|
|
266
|
+
/**
|
|
267
|
+
* Environment variables (masked)
|
|
268
|
+
*/
|
|
269
|
+
environmentVariables: Array<{
|
|
270
|
+
name: string;
|
|
271
|
+
value: string; // Masked
|
|
272
|
+
source: 'vercel-dashboard' | '.env.local';
|
|
273
|
+
}>;
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Edge runtime configuration
|
|
277
|
+
*/
|
|
278
|
+
edgeRuntime?: {
|
|
279
|
+
maxDuration?: number;
|
|
280
|
+
regions?: string[];
|
|
281
|
+
};
|
|
282
|
+
};
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
// ============================================
|
|
286
|
+
// 8. METADATA
|
|
287
|
+
// ============================================
|
|
288
|
+
metadata: {
|
|
289
|
+
/**
|
|
290
|
+
* Configuration version
|
|
291
|
+
*/
|
|
292
|
+
version: string;
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Last updated timestamp
|
|
296
|
+
*/
|
|
297
|
+
lastUpdated: string;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Configuration source
|
|
301
|
+
* 'dashboard' = Managed via AgentShield dashboard
|
|
302
|
+
* 'code' = Defined in code (mcpi-runtime-config.ts)
|
|
303
|
+
* 'mixed' = Partially managed via dashboard
|
|
304
|
+
*/
|
|
305
|
+
source: 'dashboard' | 'code' | 'mixed';
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Server deployment URL
|
|
309
|
+
*/
|
|
310
|
+
serverUrl?: string;
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Server deployment status
|
|
314
|
+
*/
|
|
315
|
+
deploymentStatus?: 'active' | 'inactive' | 'error';
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* API Request/Response types for dashboard config endpoints
|
|
321
|
+
*/
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Request to get server configuration
|
|
325
|
+
* GET /api/v1/bouncer/projects/{projectId}/config
|
|
326
|
+
*/
|
|
327
|
+
export interface GetServerConfigRequest {
|
|
328
|
+
projectId: string;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Response from get server configuration endpoint
|
|
333
|
+
*/
|
|
334
|
+
export interface GetServerConfigResponse {
|
|
335
|
+
success: boolean;
|
|
336
|
+
data: {
|
|
337
|
+
config: MCPIServerConfig;
|
|
338
|
+
};
|
|
339
|
+
metadata?: {
|
|
340
|
+
requestId?: string;
|
|
341
|
+
timestamp?: string;
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Request to update server configuration
|
|
347
|
+
* PUT /api/v1/bouncer/projects/{projectId}/config
|
|
348
|
+
*/
|
|
349
|
+
export interface UpdateServerConfigRequest {
|
|
350
|
+
projectId: string;
|
|
351
|
+
config: Partial<MCPIServerConfig>;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Response from update server configuration endpoint
|
|
356
|
+
*/
|
|
357
|
+
export interface UpdateServerConfigResponse {
|
|
358
|
+
success: boolean;
|
|
359
|
+
data: {
|
|
360
|
+
config: MCPIServerConfig;
|
|
361
|
+
changes: Array<{
|
|
362
|
+
path: string;
|
|
363
|
+
oldValue: unknown;
|
|
364
|
+
newValue: unknown;
|
|
365
|
+
}>;
|
|
366
|
+
};
|
|
367
|
+
metadata?: {
|
|
368
|
+
requestId?: string;
|
|
369
|
+
timestamp?: string;
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Request to validate server configuration without saving
|
|
375
|
+
* POST /api/v1/bouncer/projects/{projectId}/config/validate
|
|
376
|
+
*/
|
|
377
|
+
export interface ValidateServerConfigRequest {
|
|
378
|
+
projectId: string;
|
|
379
|
+
config: Partial<MCPIServerConfig>;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Response from validate server configuration endpoint
|
|
384
|
+
*/
|
|
385
|
+
export interface ValidateServerConfigResponse {
|
|
386
|
+
success: boolean;
|
|
387
|
+
data: {
|
|
388
|
+
valid: boolean;
|
|
389
|
+
errors?: Array<{
|
|
390
|
+
path: string;
|
|
391
|
+
message: string;
|
|
392
|
+
code: string;
|
|
393
|
+
}>;
|
|
394
|
+
warnings?: Array<{
|
|
395
|
+
path: string;
|
|
396
|
+
message: string;
|
|
397
|
+
}>;
|
|
398
|
+
};
|
|
399
|
+
metadata?: {
|
|
400
|
+
requestId?: string;
|
|
401
|
+
timestamp?: string;
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
|