@kya-os/checkpoint-shared 1.4.0 → 1.5.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/CHANGELOG.md +32 -0
- package/dist/beacon-types/index.d.mts +441 -432
- package/dist/beacon-types/index.d.mts.map +1 -0
- package/dist/beacon-types/index.d.ts +441 -432
- package/dist/beacon-types/index.d.ts.map +1 -0
- package/dist/beacon-types/index.js +198 -182
- package/dist/beacon-types/index.mjs +197 -179
- package/dist/beacon-types/index.mjs.map +1 -0
- package/dist/browser-posture-cookie-Dmq9Brf_.d.mts +5 -0
- package/dist/browser-posture-cookie-Dmq9Brf_.d.mts.map +1 -0
- package/dist/browser-posture-cookie-Dmq9Brf_.d.ts +5 -0
- package/dist/browser-posture-cookie-Dmq9Brf_.d.ts.map +1 -0
- package/dist/browser-posture-cookie.d.mts +2 -0
- package/dist/browser-posture-cookie.d.ts +2 -0
- package/dist/browser-posture-cookie.js +1 -0
- package/dist/browser-posture-cookie.mjs +2 -0
- package/dist/browser-posture-cookie.mjs.map +1 -0
- package/dist/browser-posture-report.d.mts +48 -44
- package/dist/browser-posture-report.d.mts.map +1 -0
- package/dist/browser-posture-report.d.ts +48 -44
- package/dist/browser-posture-report.d.ts.map +1 -0
- package/dist/browser-posture-report.js +1 -1
- package/dist/browser-posture-report.mjs +2 -1
- package/dist/browser-posture-report.mjs.map +1 -0
- package/dist/browser-posture.d.mts +80 -75
- package/dist/browser-posture.d.mts.map +1 -0
- package/dist/browser-posture.d.ts +80 -75
- package/dist/browser-posture.d.ts.map +1 -0
- package/dist/browser-posture.js +159 -18993
- package/dist/browser-posture.mjs +158 -18990
- package/dist/browser-posture.mjs.map +1 -0
- package/dist/browser.d.mts +323 -316
- package/dist/browser.d.mts.map +1 -0
- package/dist/browser.d.ts +323 -316
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +1 -1
- package/dist/browser.mjs +2 -1
- package/dist/browser.mjs.map +1 -0
- package/dist/canonical-signer/index.d.mts +38 -33
- package/dist/canonical-signer/index.d.mts.map +1 -0
- package/dist/canonical-signer/index.d.ts +38 -33
- package/dist/canonical-signer/index.d.ts.map +1 -0
- package/dist/canonical-signer/index.js +411 -181
- package/dist/canonical-signer/index.mjs +383 -175
- package/dist/canonical-signer/index.mjs.map +1 -0
- package/dist/clearance.d.mts +30 -0
- package/dist/clearance.d.mts.map +1 -0
- package/dist/clearance.d.ts +30 -0
- package/dist/clearance.d.ts.map +1 -0
- package/dist/clearance.js +120 -0
- package/dist/clearance.mjs +112 -0
- package/dist/clearance.mjs.map +1 -0
- package/dist/client-ip-1y2iXAYW.js +237 -0
- package/dist/client-ip-HOfe6ucV.mjs +215 -0
- package/dist/client-ip-HOfe6ucV.mjs.map +1 -0
- package/dist/deploy/index.d.mts +339 -339
- package/dist/deploy/index.d.mts.map +1 -0
- package/dist/deploy/index.d.ts +339 -339
- package/dist/deploy/index.d.ts.map +1 -0
- package/dist/deploy/index.js +505 -413
- package/dist/deploy/index.mjs +504 -410
- package/dist/deploy/index.mjs.map +1 -0
- package/dist/errors/index.d.mts +101 -101
- package/dist/errors/index.d.mts.map +1 -0
- package/dist/errors/index.d.ts +101 -101
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +341 -314
- package/dist/errors/index.mjs +340 -311
- package/dist/errors/index.mjs.map +1 -0
- package/dist/external-jr_S4iSS.d.mts +4187 -0
- package/dist/external-jr_S4iSS.d.mts.map +1 -0
- package/dist/external-jr_S4iSS.d.ts +4187 -0
- package/dist/external-jr_S4iSS.d.ts.map +1 -0
- package/dist/gateway/index.d.mts +138 -132
- package/dist/gateway/index.d.mts.map +1 -0
- package/dist/gateway/index.d.ts +138 -132
- package/dist/gateway/index.d.ts.map +1 -0
- package/dist/gateway/index.js +117 -81
- package/dist/gateway/index.mjs +116 -78
- package/dist/gateway/index.mjs.map +1 -0
- package/dist/gateway-client-ip.d.mts +59 -0
- package/dist/gateway-client-ip.d.mts.map +1 -0
- package/dist/gateway-client-ip.d.ts +59 -0
- package/dist/gateway-client-ip.d.ts.map +1 -0
- package/dist/gateway-client-ip.js +149 -0
- package/dist/gateway-client-ip.mjs +139 -0
- package/dist/gateway-client-ip.mjs.map +1 -0
- package/dist/index.d.mts +14895 -14240
- package/dist/index.d.mts.map +1 -0
- package/dist/index.d.ts +14895 -14240
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15180 -31025
- package/dist/index.mjs +15065 -30942
- package/dist/index.mjs.map +1 -0
- package/dist/mcpi/agentshield-api/index.d.mts +45 -44
- package/dist/mcpi/agentshield-api/index.d.mts.map +1 -0
- package/dist/mcpi/agentshield-api/index.d.ts +45 -44
- package/dist/mcpi/agentshield-api/index.d.ts.map +1 -0
- package/dist/mcpi/agentshield-api/index.js +0 -2
- package/dist/mcpi/agentshield-api/index.mjs +1 -1
- package/dist/mcpi/approval-grant/index.d.mts +63 -61
- package/dist/mcpi/approval-grant/index.d.mts.map +1 -0
- package/dist/mcpi/approval-grant/index.d.ts +63 -61
- package/dist/mcpi/approval-grant/index.d.ts.map +1 -0
- package/dist/mcpi/approval-grant/index.js +220 -140
- package/dist/mcpi/approval-grant/index.mjs +219 -137
- package/dist/mcpi/approval-grant/index.mjs.map +1 -0
- package/dist/mcpi/dashboard-config/index.d.mts +2323 -2318
- package/dist/mcpi/dashboard-config/index.d.mts.map +1 -0
- package/dist/mcpi/dashboard-config/index.d.ts +2323 -2318
- package/dist/mcpi/dashboard-config/index.d.ts.map +1 -0
- package/dist/mcpi/dashboard-config/index.js +605 -458
- package/dist/mcpi/dashboard-config/index.mjs +604 -455
- package/dist/mcpi/dashboard-config/index.mjs.map +1 -0
- package/dist/mcpi/multibase-ed25519.d.mts +10 -8
- package/dist/mcpi/multibase-ed25519.d.mts.map +1 -0
- package/dist/mcpi/multibase-ed25519.d.ts +10 -8
- package/dist/mcpi/multibase-ed25519.d.ts.map +1 -0
- package/dist/mcpi/multibase-ed25519.js +182 -106
- package/dist/mcpi/multibase-ed25519.mjs +181 -103
- package/dist/mcpi/multibase-ed25519.mjs.map +1 -0
- package/dist/patterns-CkRVOdtV.js +243 -0
- package/dist/patterns-DzkGy_qk.mjs +173 -0
- package/dist/patterns-DzkGy_qk.mjs.map +1 -0
- package/dist/project-verification-key-C3L5rd8a.js +41 -0
- package/dist/project-verification-key-CgSVX9_m.mjs +37 -0
- package/dist/project-verification-key-CgSVX9_m.mjs.map +1 -0
- package/dist/rolldown-runtime-iY2fYEqi.mjs +19 -0
- package/dist/schemas-BmjNLAE7.js +5677 -0
- package/dist/schemas-DxY-dk9y.mjs +5511 -0
- package/dist/schemas-DxY-dk9y.mjs.map +1 -0
- package/dist/signals/index.d.mts +125 -115
- package/dist/signals/index.d.mts.map +1 -0
- package/dist/signals/index.d.ts +125 -115
- package/dist/signals/index.d.ts.map +1 -0
- package/dist/signals/index.js +1693 -1536
- package/dist/signals/index.mjs +1692 -1533
- package/dist/signals/index.mjs.map +1 -0
- package/dist/test-fixtures/index.d.mts +124 -119
- package/dist/test-fixtures/index.d.mts.map +1 -0
- package/dist/test-fixtures/index.d.ts +124 -119
- package/dist/test-fixtures/index.d.ts.map +1 -0
- package/dist/test-fixtures/index.js +460 -228
- package/dist/test-fixtures/index.mjs +459 -225
- package/dist/test-fixtures/index.mjs.map +1 -0
- package/dist/tool-protection/index.d.mts +343 -343
- package/dist/tool-protection/index.d.mts.map +1 -0
- package/dist/tool-protection/index.d.ts +343 -343
- package/dist/tool-protection/index.d.ts.map +1 -0
- package/dist/tool-protection/index.js +366 -285
- package/dist/tool-protection/index.mjs +365 -282
- package/dist/tool-protection/index.mjs.map +1 -0
- package/fixtures/bot-signal-resolution.json +142 -0
- package/fixtures/browser-posture-claims.json +421 -0
- package/fixtures/browser-posture-headers.json +46 -0
- package/fixtures/detection/reason-codes.json +10 -1
- package/fixtures/kya-http/challenge.delegation.fetcher-200.json +9 -3
- package/fixtures/kya-http/challenge.delegation.full.json +9 -3
- package/fixtures/kya-http/challenge.delegation.minimal.json +9 -3
- package/fixtures/kya-http/error-codes.json +7 -2
- package/package.json +20 -6
|
@@ -1,492 +1,641 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
//#region src/tool-protection/index.ts
|
|
4
|
+
/**
|
|
5
|
+
* KYA-OS Tool Protection Specification
|
|
6
|
+
*
|
|
7
|
+
* Core types for tool protection with delegation requirements.
|
|
8
|
+
*
|
|
9
|
+
* Consent Flow: type='none' → 2 screens, others → 3 screens (Auth→Consent→Success).
|
|
10
|
+
* DelegationCredential (VC) is created when user confirms on Consent Screen.
|
|
11
|
+
*
|
|
12
|
+
* Ported into checkpoint-shared from `@kya-os/contracts/tool-protection` as part
|
|
13
|
+
* of the E6 / C-series decommission (#2914 / #2917): checkpoint owns its product
|
|
14
|
+
* types now that the DIF `@kya-os/mcp` core is protocol-only. The single external
|
|
15
|
+
* dependency (`envVarNameSchema` from the contracts `vault` module) is inlined
|
|
16
|
+
* below so this module pulls nothing from `@kya-os/contracts`.
|
|
17
|
+
*
|
|
18
|
+
* @module @kya-os/checkpoint-shared/tool-protection
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Validates an env var name used by the `apikey` authorization requirement.
|
|
22
|
+
* Inlined from the former `@kya-os/contracts/vault` `envVarNameSchema`.
|
|
23
|
+
*/
|
|
24
|
+
const envVarNameSchema = z.string().regex(/^[A-Z][A-Z0-9_]*$/, "Must be a valid env var name (e.g., X_API_KEY)").max(255);
|
|
25
|
+
const AuthRequiredErrorDataSchema = z.object({
|
|
26
|
+
error: z.literal("auth_required"),
|
|
27
|
+
type: z.enum([
|
|
28
|
+
"apikey",
|
|
29
|
+
"oauth",
|
|
30
|
+
"credential"
|
|
31
|
+
]),
|
|
32
|
+
envVarNames: z.array(z.string()).optional(),
|
|
33
|
+
configUrl: z.string(),
|
|
34
|
+
message: z.string()
|
|
12
35
|
});
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Zod Schemas for Validation
|
|
38
|
+
*/
|
|
39
|
+
const AuthorizationRequirementSchema = z.discriminatedUnion("type", [
|
|
40
|
+
z.object({
|
|
41
|
+
type: z.literal("oauth"),
|
|
42
|
+
provider: z.string(),
|
|
43
|
+
requiredScopes: z.array(z.string()).optional()
|
|
44
|
+
}),
|
|
45
|
+
z.object({
|
|
46
|
+
type: z.literal("oauth2"),
|
|
47
|
+
provider: z.string(),
|
|
48
|
+
requiredScopes: z.array(z.string()).optional()
|
|
49
|
+
}),
|
|
50
|
+
z.object({
|
|
51
|
+
type: z.literal("password"),
|
|
52
|
+
provider: z.string()
|
|
53
|
+
}),
|
|
54
|
+
z.object({
|
|
55
|
+
type: z.literal("mdl"),
|
|
56
|
+
issuer: z.string(),
|
|
57
|
+
credentialType: z.string().optional()
|
|
58
|
+
}),
|
|
59
|
+
z.object({
|
|
60
|
+
type: z.literal("idv"),
|
|
61
|
+
provider: z.string(),
|
|
62
|
+
verificationLevel: z.enum([
|
|
63
|
+
"basic",
|
|
64
|
+
"enhanced",
|
|
65
|
+
"loa3"
|
|
66
|
+
]).optional()
|
|
67
|
+
}),
|
|
68
|
+
z.object({
|
|
69
|
+
type: z.literal("verifiable_credential"),
|
|
70
|
+
credentialType: z.string(),
|
|
71
|
+
issuer: z.string().optional()
|
|
72
|
+
}),
|
|
73
|
+
z.object({
|
|
74
|
+
type: z.literal("credential"),
|
|
75
|
+
credentialType: z.string(),
|
|
76
|
+
issuer: z.string().optional()
|
|
77
|
+
}),
|
|
78
|
+
z.object({
|
|
79
|
+
type: z.literal("webauthn"),
|
|
80
|
+
rpId: z.string().optional(),
|
|
81
|
+
userVerification: z.enum([
|
|
82
|
+
"required",
|
|
83
|
+
"preferred",
|
|
84
|
+
"discouraged"
|
|
85
|
+
]).optional()
|
|
86
|
+
}),
|
|
87
|
+
z.object({
|
|
88
|
+
type: z.literal("siwe"),
|
|
89
|
+
chainId: z.number().optional(),
|
|
90
|
+
domain: z.string().optional()
|
|
91
|
+
}),
|
|
92
|
+
z.object({
|
|
93
|
+
type: z.literal("apikey"),
|
|
94
|
+
envVarNames: z.array(envVarNameSchema).min(1),
|
|
95
|
+
headerMapping: z.record(z.string(), z.string())
|
|
96
|
+
}),
|
|
97
|
+
z.object({ type: z.literal("none") })
|
|
74
98
|
]);
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
99
|
+
const ToolProtectionSchema = z.object({
|
|
100
|
+
requiresDelegation: z.boolean(),
|
|
101
|
+
requiredScopes: z.array(z.string()),
|
|
102
|
+
riskLevel: z.enum([
|
|
103
|
+
"low",
|
|
104
|
+
"medium",
|
|
105
|
+
"high",
|
|
106
|
+
"critical"
|
|
107
|
+
]).optional(),
|
|
108
|
+
oauthProvider: z.string().optional(),
|
|
109
|
+
authorization: AuthorizationRequirementSchema.optional()
|
|
82
110
|
});
|
|
83
|
-
|
|
84
|
-
z.object({
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
111
|
+
const ToolProtectionMapSchema = z.record(z.string(), ToolProtectionSchema);
|
|
112
|
+
const ToolProtectionResponseSchema = z.object({
|
|
113
|
+
toolProtections: ToolProtectionMapSchema,
|
|
114
|
+
metadata: z.object({
|
|
115
|
+
lastUpdated: z.string().optional(),
|
|
116
|
+
version: z.string().optional(),
|
|
117
|
+
source: z.string().optional()
|
|
118
|
+
}).optional()
|
|
91
119
|
});
|
|
92
|
-
z.object({
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
120
|
+
const DelegationRequiredErrorDataSchema = z.object({
|
|
121
|
+
toolName: z.string(),
|
|
122
|
+
requiredScopes: z.array(z.string()),
|
|
123
|
+
consentUrl: z.string().optional(),
|
|
124
|
+
authorizationUrl: z.string().optional(),
|
|
125
|
+
reason: z.string().optional()
|
|
98
126
|
});
|
|
99
127
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
128
|
+
//#endregion
|
|
129
|
+
//#region src/mcpi/dashboard-config/schemas.ts
|
|
130
|
+
/**
|
|
131
|
+
* Dashboard Configuration Zod Schemas
|
|
132
|
+
*
|
|
133
|
+
* Runtime validation schemas for dashboard configuration types.
|
|
134
|
+
* Used for validating API requests and responses.
|
|
135
|
+
*
|
|
136
|
+
* Ported into checkpoint-shared from `@kya-os/contracts/dashboard-config` as part
|
|
137
|
+
* of the E6 / C-series decommission (#2914 / #2917). The only cross-module
|
|
138
|
+
* dependency (`ToolProtectionSchema`/`ToolProtectionMapSchema`) now resolves to
|
|
139
|
+
* the local `../../tool-protection` module.
|
|
140
|
+
*
|
|
141
|
+
* @module @kya-os/checkpoint-shared/dashboard-config
|
|
142
|
+
*/
|
|
143
|
+
/**
|
|
144
|
+
* Identity configuration schema
|
|
145
|
+
*/
|
|
146
|
+
const identityConfigSchema = z.object({
|
|
147
|
+
/**
|
|
148
|
+
* @deprecated Use serverDid instead. Will be removed in v2.0
|
|
149
|
+
*/
|
|
150
|
+
agentDid: z.string().min(1).optional(),
|
|
151
|
+
serverDid: z.string().min(1),
|
|
152
|
+
environment: z.enum(["development", "production"]),
|
|
153
|
+
storageLocation: z.enum([
|
|
154
|
+
"cloudflare-kv",
|
|
155
|
+
"file-system",
|
|
156
|
+
"env-vars"
|
|
157
|
+
])
|
|
109
158
|
});
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
159
|
+
/**
|
|
160
|
+
* Proofing configuration schema
|
|
161
|
+
*/
|
|
162
|
+
const proofingConfigSchema = z.object({
|
|
163
|
+
enabled: z.boolean(),
|
|
164
|
+
destinations: z.array(z.object({
|
|
165
|
+
type: z.enum([
|
|
166
|
+
"agentshield",
|
|
167
|
+
"kta",
|
|
168
|
+
"custom"
|
|
169
|
+
]),
|
|
170
|
+
apiUrl: z.string().url(),
|
|
171
|
+
apiKey: z.string().optional()
|
|
172
|
+
})),
|
|
173
|
+
batchQueue: z.object({
|
|
174
|
+
maxBatchSize: z.number().int().positive().default(10),
|
|
175
|
+
flushIntervalMs: z.number().int().positive().default(5e3),
|
|
176
|
+
maxRetries: z.number().int().nonnegative().default(3)
|
|
177
|
+
})
|
|
124
178
|
});
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
179
|
+
/**
|
|
180
|
+
* Delegation verifier type schema
|
|
181
|
+
*/
|
|
182
|
+
const delegationVerifierTypeSchema = z.enum([
|
|
183
|
+
"agentshield",
|
|
184
|
+
"kta",
|
|
185
|
+
"memory",
|
|
186
|
+
"cloudflare-kv",
|
|
187
|
+
"redis",
|
|
188
|
+
"dynamodb",
|
|
189
|
+
"custom"
|
|
133
190
|
]);
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
191
|
+
/**
|
|
192
|
+
* Delegation configuration schema
|
|
193
|
+
*/
|
|
194
|
+
const delegationConfigSchema = z.object({
|
|
195
|
+
enabled: z.boolean(),
|
|
196
|
+
enforceStrictly: z.boolean(),
|
|
197
|
+
verifier: z.object({
|
|
198
|
+
type: delegationVerifierTypeSchema,
|
|
199
|
+
apiUrl: z.string().url().optional(),
|
|
200
|
+
cacheTtl: z.number().int().positive().optional()
|
|
201
|
+
}),
|
|
202
|
+
authorization: z.object({
|
|
203
|
+
authorizationUrl: z.string().url().optional(),
|
|
204
|
+
minReputationScore: z.number().int().min(0).max(100).optional(),
|
|
205
|
+
resumeTokenTtl: z.number().int().positive().optional(),
|
|
206
|
+
requireAuthForUnknown: z.boolean().optional()
|
|
207
|
+
})
|
|
148
208
|
});
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
209
|
+
/**
|
|
210
|
+
* Tool protection configuration schema
|
|
211
|
+
*/
|
|
212
|
+
const toolProtectionConfigSchema = z.object({
|
|
213
|
+
source: z.enum([
|
|
214
|
+
"agentshield",
|
|
215
|
+
"inline",
|
|
216
|
+
"file"
|
|
217
|
+
]),
|
|
218
|
+
agentShield: z.object({
|
|
219
|
+
apiUrl: z.string().url(),
|
|
220
|
+
cacheTtl: z.number().int().positive()
|
|
221
|
+
}).optional(),
|
|
222
|
+
fallback: ToolProtectionMapSchema.optional()
|
|
156
223
|
});
|
|
157
|
-
|
|
158
|
-
|
|
224
|
+
/** Merged tool protection config with embedded tools */
|
|
225
|
+
const mergedToolProtectionConfigSchema = toolProtectionConfigSchema.extend({ tools: ToolProtectionMapSchema });
|
|
226
|
+
/**
|
|
227
|
+
* Audit configuration schema
|
|
228
|
+
*/
|
|
229
|
+
const auditConfigSchema = z.object({
|
|
230
|
+
enabled: z.boolean(),
|
|
231
|
+
includeProofHashes: z.boolean(),
|
|
232
|
+
includePayloads: z.boolean()
|
|
159
233
|
});
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
234
|
+
/**
|
|
235
|
+
* Session configuration schema
|
|
236
|
+
*/
|
|
237
|
+
const sessionConfigSchema = z.object({
|
|
238
|
+
timestampSkewSeconds: z.number().int().positive().default(120),
|
|
239
|
+
ttlMinutes: z.number().int().positive().default(30),
|
|
240
|
+
absoluteLifetime: z.number().int().positive().optional()
|
|
164
241
|
});
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
242
|
+
/**
|
|
243
|
+
* Cloudflare platform configuration schema
|
|
244
|
+
*/
|
|
245
|
+
const cloudflarePlatformConfigSchema = z.object({
|
|
246
|
+
workers: z.object({
|
|
247
|
+
cpuMs: z.number().int().positive().default(50),
|
|
248
|
+
memoryMb: z.number().int().positive().default(128)
|
|
249
|
+
}),
|
|
250
|
+
kvNamespaces: z.array(z.object({
|
|
251
|
+
name: z.string().min(1),
|
|
252
|
+
purpose: z.enum([
|
|
253
|
+
"sessions",
|
|
254
|
+
"delegations",
|
|
255
|
+
"cache",
|
|
256
|
+
"general"
|
|
257
|
+
])
|
|
258
|
+
})),
|
|
259
|
+
environmentVariables: z.array(z.object({
|
|
260
|
+
name: z.string().min(1),
|
|
261
|
+
value: z.string(),
|
|
262
|
+
source: z.enum([
|
|
263
|
+
"wrangler.toml",
|
|
264
|
+
"secrets",
|
|
265
|
+
".dev.vars"
|
|
266
|
+
])
|
|
267
|
+
}))
|
|
169
268
|
});
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
269
|
+
/**
|
|
270
|
+
* Node.js platform configuration schema
|
|
271
|
+
*/
|
|
272
|
+
const nodePlatformConfigSchema = z.object({
|
|
273
|
+
server: z.object({
|
|
274
|
+
port: z.number().int().positive().default(3e3),
|
|
275
|
+
host: z.string().default("0.0.0.0"),
|
|
276
|
+
cors: z.boolean().default(true),
|
|
277
|
+
timeout: z.number().int().positive().default(3e4)
|
|
278
|
+
}),
|
|
279
|
+
storage: z.object({
|
|
280
|
+
type: z.enum([
|
|
281
|
+
"memory",
|
|
282
|
+
"redis",
|
|
283
|
+
"postgres",
|
|
284
|
+
"mongodb"
|
|
285
|
+
]),
|
|
286
|
+
connection: z.object({
|
|
287
|
+
host: z.string().optional(),
|
|
288
|
+
port: z.number().int().positive().optional(),
|
|
289
|
+
database: z.string().optional()
|
|
290
|
+
}).optional()
|
|
291
|
+
})
|
|
188
292
|
});
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}).optional()
|
|
203
|
-
})
|
|
293
|
+
/**
|
|
294
|
+
* Vercel platform configuration schema
|
|
295
|
+
*/
|
|
296
|
+
const vercelPlatformConfigSchema = z.object({
|
|
297
|
+
environmentVariables: z.array(z.object({
|
|
298
|
+
name: z.string().min(1),
|
|
299
|
+
value: z.string(),
|
|
300
|
+
source: z.enum(["vercel-dashboard", ".env.local"])
|
|
301
|
+
})),
|
|
302
|
+
edgeRuntime: z.object({
|
|
303
|
+
maxDuration: z.number().int().positive().optional(),
|
|
304
|
+
regions: z.array(z.string()).optional()
|
|
305
|
+
}).optional()
|
|
204
306
|
});
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
307
|
+
/**
|
|
308
|
+
* Platform configuration schema
|
|
309
|
+
*/
|
|
310
|
+
const platformConfigSchema = z.object({
|
|
311
|
+
type: z.enum([
|
|
312
|
+
"cloudflare",
|
|
313
|
+
"node",
|
|
314
|
+
"vercel"
|
|
315
|
+
]),
|
|
316
|
+
cloudflare: cloudflarePlatformConfigSchema.optional(),
|
|
317
|
+
node: nodePlatformConfigSchema.optional(),
|
|
318
|
+
vercel: vercelPlatformConfigSchema.optional()
|
|
217
319
|
});
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
320
|
+
/**
|
|
321
|
+
* Metadata schema
|
|
322
|
+
*/
|
|
323
|
+
const configMetadataSchema = z.object({
|
|
324
|
+
version: z.string(),
|
|
325
|
+
lastUpdated: z.string(),
|
|
326
|
+
source: z.enum([
|
|
327
|
+
"dashboard",
|
|
328
|
+
"code",
|
|
329
|
+
"mixed"
|
|
330
|
+
]),
|
|
331
|
+
serverUrl: z.string().url().optional(),
|
|
332
|
+
deploymentStatus: z.enum([
|
|
333
|
+
"active",
|
|
334
|
+
"inactive",
|
|
335
|
+
"error"
|
|
336
|
+
]).optional()
|
|
223
337
|
});
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
338
|
+
/**
|
|
339
|
+
* Complete KYA-OS Server Configuration schema
|
|
340
|
+
*/
|
|
341
|
+
const mcpIServerConfigSchema = z.object({
|
|
342
|
+
identity: identityConfigSchema,
|
|
343
|
+
proofing: proofingConfigSchema,
|
|
344
|
+
delegation: delegationConfigSchema,
|
|
345
|
+
toolProtection: toolProtectionConfigSchema,
|
|
346
|
+
audit: auditConfigSchema,
|
|
347
|
+
session: sessionConfigSchema,
|
|
348
|
+
platform: platformConfigSchema,
|
|
349
|
+
metadata: configMetadataSchema
|
|
230
350
|
});
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
351
|
+
/** Merged KYA-OS Server Configuration schema @since 1.6.0 */
|
|
352
|
+
const mergedMcpIServerConfigSchema = mcpIServerConfigSchema.extend({ toolProtection: mergedToolProtectionConfigSchema });
|
|
353
|
+
/**
|
|
354
|
+
* Get server config request schema
|
|
355
|
+
*/
|
|
356
|
+
const getServerConfigRequestSchema = z.object({ projectId: z.string().min(1) });
|
|
357
|
+
/**
|
|
358
|
+
* Get server config response schema
|
|
359
|
+
*/
|
|
360
|
+
const getServerConfigResponseSchema = z.object({
|
|
361
|
+
success: z.boolean(),
|
|
362
|
+
data: z.object({ config: mcpIServerConfigSchema }),
|
|
363
|
+
metadata: z.object({
|
|
364
|
+
requestId: z.string().optional(),
|
|
365
|
+
timestamp: z.string().optional()
|
|
366
|
+
}).optional()
|
|
240
367
|
});
|
|
241
|
-
|
|
242
|
-
|
|
368
|
+
/** Get merged server config response schema @since 1.6.0 */
|
|
369
|
+
const getMergedServerConfigResponseSchema = z.object({
|
|
370
|
+
success: z.boolean(),
|
|
371
|
+
data: z.object({
|
|
372
|
+
config: mergedMcpIServerConfigSchema,
|
|
373
|
+
/** @deprecated Use config.toolProtection.tools instead */
|
|
374
|
+
toolProtections: ToolProtectionMapSchema.optional()
|
|
375
|
+
}),
|
|
376
|
+
metadata: z.object({
|
|
377
|
+
requestId: z.string().optional(),
|
|
378
|
+
timestamp: z.string().optional(),
|
|
379
|
+
cachedUntil: z.string().optional()
|
|
380
|
+
}).optional()
|
|
243
381
|
});
|
|
244
|
-
|
|
245
|
-
|
|
382
|
+
/**
|
|
383
|
+
* Update server config request schema
|
|
384
|
+
*/
|
|
385
|
+
const updateServerConfigRequestSchema = z.object({
|
|
386
|
+
projectId: z.string().min(1),
|
|
387
|
+
config: mcpIServerConfigSchema.partial()
|
|
246
388
|
});
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
389
|
+
/**
|
|
390
|
+
* Update server config response schema
|
|
391
|
+
*/
|
|
392
|
+
const updateServerConfigResponseSchema = z.object({
|
|
393
|
+
success: z.boolean(),
|
|
394
|
+
data: z.object({
|
|
395
|
+
config: mcpIServerConfigSchema,
|
|
396
|
+
changes: z.array(z.object({
|
|
397
|
+
path: z.string(),
|
|
398
|
+
oldValue: z.unknown(),
|
|
399
|
+
newValue: z.unknown()
|
|
400
|
+
}))
|
|
401
|
+
}),
|
|
402
|
+
metadata: z.object({
|
|
403
|
+
requestId: z.string().optional(),
|
|
404
|
+
timestamp: z.string().optional()
|
|
405
|
+
}).optional()
|
|
256
406
|
});
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
}),
|
|
264
|
-
metadata: z.object({
|
|
265
|
-
requestId: z.string().optional(),
|
|
266
|
-
timestamp: z.string().optional(),
|
|
267
|
-
cachedUntil: z.string().optional()
|
|
268
|
-
}).optional()
|
|
407
|
+
/**
|
|
408
|
+
* Validate server config request schema
|
|
409
|
+
*/
|
|
410
|
+
const validateServerConfigRequestSchema = z.object({
|
|
411
|
+
projectId: z.string().min(1),
|
|
412
|
+
config: mcpIServerConfigSchema.partial()
|
|
269
413
|
});
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
414
|
+
/**
|
|
415
|
+
* Validate server config response schema
|
|
416
|
+
*/
|
|
417
|
+
const validateServerConfigResponseSchema = z.object({
|
|
418
|
+
success: z.boolean(),
|
|
419
|
+
data: z.object({
|
|
420
|
+
valid: z.boolean(),
|
|
421
|
+
errors: z.array(z.object({
|
|
422
|
+
path: z.string(),
|
|
423
|
+
message: z.string(),
|
|
424
|
+
code: z.string()
|
|
425
|
+
})).optional(),
|
|
426
|
+
warnings: z.array(z.object({
|
|
427
|
+
path: z.string(),
|
|
428
|
+
message: z.string()
|
|
429
|
+
})).optional()
|
|
430
|
+
}),
|
|
431
|
+
metadata: z.object({
|
|
432
|
+
requestId: z.string().optional(),
|
|
433
|
+
timestamp: z.string().optional()
|
|
434
|
+
}).optional()
|
|
273
435
|
});
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
fallback: {}
|
|
362
|
-
},
|
|
363
|
-
audit: {
|
|
364
|
-
enabled: true,
|
|
365
|
-
includeProofHashes: false,
|
|
366
|
-
includePayloads: false
|
|
367
|
-
},
|
|
368
|
-
session: {
|
|
369
|
-
timestampSkewSeconds: 120,
|
|
370
|
-
ttlMinutes: 30
|
|
371
|
-
},
|
|
372
|
-
platform: {
|
|
373
|
-
type: "node",
|
|
374
|
-
node: {
|
|
375
|
-
server: {
|
|
376
|
-
port: 3e3,
|
|
377
|
-
host: "0.0.0.0",
|
|
378
|
-
cors: true,
|
|
379
|
-
timeout: 3e4
|
|
380
|
-
},
|
|
381
|
-
storage: {
|
|
382
|
-
type: "memory"
|
|
383
|
-
}
|
|
384
|
-
},
|
|
385
|
-
cloudflare: {
|
|
386
|
-
workers: {
|
|
387
|
-
cpuMs: 50,
|
|
388
|
-
memoryMb: 128
|
|
389
|
-
},
|
|
390
|
-
kvNamespaces: [],
|
|
391
|
-
environmentVariables: []
|
|
392
|
-
},
|
|
393
|
-
vercel: {
|
|
394
|
-
environmentVariables: [],
|
|
395
|
-
edgeRuntime: {}
|
|
396
|
-
}
|
|
397
|
-
},
|
|
398
|
-
metadata: {
|
|
399
|
-
version: "1.0.0",
|
|
400
|
-
lastUpdated: "",
|
|
401
|
-
source: "dashboard",
|
|
402
|
-
deploymentStatus: "inactive"
|
|
403
|
-
}
|
|
436
|
+
|
|
437
|
+
//#endregion
|
|
438
|
+
//#region src/mcpi/dashboard-config/default-config.ts
|
|
439
|
+
/**
|
|
440
|
+
* Default configuration JSON content
|
|
441
|
+
* Embedded here to avoid TypeScript JSON import issues in build
|
|
442
|
+
*/
|
|
443
|
+
const defaultConfigJson = {
|
|
444
|
+
identity: {
|
|
445
|
+
serverDid: "",
|
|
446
|
+
environment: "development",
|
|
447
|
+
storageLocation: "env-vars"
|
|
448
|
+
},
|
|
449
|
+
proofing: {
|
|
450
|
+
enabled: true,
|
|
451
|
+
destinations: [{
|
|
452
|
+
type: "agentshield",
|
|
453
|
+
apiUrl: "https://kya.vouched.id"
|
|
454
|
+
}],
|
|
455
|
+
batchQueue: {
|
|
456
|
+
maxBatchSize: 10,
|
|
457
|
+
flushIntervalMs: 5e3,
|
|
458
|
+
maxRetries: 3
|
|
459
|
+
}
|
|
460
|
+
},
|
|
461
|
+
delegation: {
|
|
462
|
+
enabled: true,
|
|
463
|
+
enforceStrictly: false,
|
|
464
|
+
verifier: {
|
|
465
|
+
type: "agentshield",
|
|
466
|
+
apiUrl: "https://kya.vouched.id/api/v1/bouncer/delegations/verify",
|
|
467
|
+
cacheTtl: 3e5
|
|
468
|
+
},
|
|
469
|
+
authorization: {
|
|
470
|
+
authorizationUrl: "https://kya.vouched.id/api/v1/bouncer/delegations/authorize",
|
|
471
|
+
minReputationScore: 80,
|
|
472
|
+
resumeTokenTtl: 36e5,
|
|
473
|
+
requireAuthForUnknown: false
|
|
474
|
+
}
|
|
475
|
+
},
|
|
476
|
+
toolProtection: {
|
|
477
|
+
source: "agentshield",
|
|
478
|
+
agentShield: {
|
|
479
|
+
apiUrl: "https://kya.vouched.id",
|
|
480
|
+
cacheTtl: 3e5
|
|
481
|
+
},
|
|
482
|
+
fallback: {}
|
|
483
|
+
},
|
|
484
|
+
audit: {
|
|
485
|
+
enabled: true,
|
|
486
|
+
includeProofHashes: false,
|
|
487
|
+
includePayloads: false
|
|
488
|
+
},
|
|
489
|
+
session: {
|
|
490
|
+
timestampSkewSeconds: 120,
|
|
491
|
+
ttlMinutes: 30
|
|
492
|
+
},
|
|
493
|
+
platform: {
|
|
494
|
+
type: "node",
|
|
495
|
+
node: {
|
|
496
|
+
server: {
|
|
497
|
+
port: 3e3,
|
|
498
|
+
host: "0.0.0.0",
|
|
499
|
+
cors: true,
|
|
500
|
+
timeout: 3e4
|
|
501
|
+
},
|
|
502
|
+
storage: { type: "memory" }
|
|
503
|
+
},
|
|
504
|
+
cloudflare: {
|
|
505
|
+
workers: {
|
|
506
|
+
cpuMs: 50,
|
|
507
|
+
memoryMb: 128
|
|
508
|
+
},
|
|
509
|
+
kvNamespaces: [],
|
|
510
|
+
environmentVariables: []
|
|
511
|
+
},
|
|
512
|
+
vercel: {
|
|
513
|
+
environmentVariables: [],
|
|
514
|
+
edgeRuntime: {}
|
|
515
|
+
}
|
|
516
|
+
},
|
|
517
|
+
metadata: {
|
|
518
|
+
version: "1.0.0",
|
|
519
|
+
lastUpdated: "",
|
|
520
|
+
source: "dashboard",
|
|
521
|
+
deploymentStatus: "inactive"
|
|
522
|
+
}
|
|
404
523
|
};
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
524
|
+
/**
|
|
525
|
+
* Relaxed schema for default config validation
|
|
526
|
+
* Allows empty strings for fields that will be populated later
|
|
527
|
+
*
|
|
528
|
+
* Note: Empty `agentDid` is valid for new/incomplete configurations.
|
|
529
|
+
* This allows users to create configs before registering their agent DID.
|
|
530
|
+
* The base schema (mcpIServerConfigSchema) requires non-empty agentDid for
|
|
531
|
+
* complete configurations, but defaults allow empty to support progressive
|
|
532
|
+
* configuration.
|
|
533
|
+
*/
|
|
534
|
+
const defaultConfigSchema = mcpIServerConfigSchema.extend({
|
|
535
|
+
identity: mcpIServerConfigSchema.shape.identity.extend({
|
|
536
|
+
agentDid: z.string().optional(),
|
|
537
|
+
serverDid: z.string()
|
|
538
|
+
}),
|
|
539
|
+
metadata: mcpIServerConfigSchema.shape.metadata.extend({ lastUpdated: z.string() })
|
|
416
540
|
});
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
}
|
|
541
|
+
/**
|
|
542
|
+
* Default configuration object
|
|
543
|
+
*
|
|
544
|
+
* This is the base default configuration used when creating new user configs.
|
|
545
|
+
* Platform-specific defaults are available via getDefaultConfigForPlatform().
|
|
546
|
+
*/
|
|
547
|
+
const defaultConfig = defaultConfigSchema.parse(defaultConfigJson);
|
|
548
|
+
/**
|
|
549
|
+
* Platform-specific default configurations
|
|
550
|
+
*/
|
|
551
|
+
const platformDefaults = {
|
|
552
|
+
node: { platform: {
|
|
553
|
+
type: "node",
|
|
554
|
+
node: {
|
|
555
|
+
server: {
|
|
556
|
+
port: 3e3,
|
|
557
|
+
host: "0.0.0.0",
|
|
558
|
+
cors: true,
|
|
559
|
+
timeout: 3e4
|
|
560
|
+
},
|
|
561
|
+
storage: { type: "memory" }
|
|
562
|
+
}
|
|
563
|
+
} },
|
|
564
|
+
cloudflare: { platform: {
|
|
565
|
+
type: "cloudflare",
|
|
566
|
+
cloudflare: {
|
|
567
|
+
workers: {
|
|
568
|
+
cpuMs: 50,
|
|
569
|
+
memoryMb: 128
|
|
570
|
+
},
|
|
571
|
+
kvNamespaces: [],
|
|
572
|
+
environmentVariables: []
|
|
573
|
+
}
|
|
574
|
+
} },
|
|
575
|
+
vercel: { platform: {
|
|
576
|
+
type: "vercel",
|
|
577
|
+
vercel: {
|
|
578
|
+
environmentVariables: [],
|
|
579
|
+
edgeRuntime: {}
|
|
580
|
+
}
|
|
581
|
+
} }
|
|
459
582
|
};
|
|
583
|
+
/**
|
|
584
|
+
* Get default configuration for a specific platform
|
|
585
|
+
*
|
|
586
|
+
* Returns the base default config merged with platform-specific defaults.
|
|
587
|
+
*
|
|
588
|
+
* @param platform - Platform type ('node', 'cloudflare', or 'vercel')
|
|
589
|
+
* @returns Platform-specific default configuration
|
|
590
|
+
*
|
|
591
|
+
* @example
|
|
592
|
+
* ```typescript
|
|
593
|
+
* const nodeConfig = getDefaultConfigForPlatform('node');
|
|
594
|
+
* const cloudflareConfig = getDefaultConfigForPlatform('cloudflare');
|
|
595
|
+
* ```
|
|
596
|
+
*/
|
|
460
597
|
function getDefaultConfigForPlatform(platform) {
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
598
|
+
const platformDefault = platformDefaults[platform];
|
|
599
|
+
return {
|
|
600
|
+
...defaultConfig,
|
|
601
|
+
platform: platformDefault.platform
|
|
602
|
+
};
|
|
466
603
|
}
|
|
604
|
+
/**
|
|
605
|
+
* Deep merge utility for objects
|
|
606
|
+
*/
|
|
467
607
|
function deepMerge(target, source) {
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
);
|
|
478
|
-
}
|
|
479
|
-
} else if (sourceValue !== void 0) {
|
|
480
|
-
result[key] = sourceValue;
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
return result;
|
|
608
|
+
const result = { ...target };
|
|
609
|
+
for (const key in source) {
|
|
610
|
+
const sourceValue = source[key];
|
|
611
|
+
if (sourceValue && typeof sourceValue === "object" && !Array.isArray(sourceValue)) {
|
|
612
|
+
const targetValue = target[key];
|
|
613
|
+
if (targetValue && typeof targetValue === "object" && !Array.isArray(targetValue)) result[key] = deepMerge(targetValue, sourceValue);
|
|
614
|
+
} else if (sourceValue !== void 0) result[key] = sourceValue;
|
|
615
|
+
}
|
|
616
|
+
return result;
|
|
484
617
|
}
|
|
618
|
+
/**
|
|
619
|
+
* Merge partial configuration with defaults
|
|
620
|
+
*
|
|
621
|
+
* Deep merges a partial configuration object with the base defaults,
|
|
622
|
+
* ensuring all required fields are present.
|
|
623
|
+
*
|
|
624
|
+
* @param partial - Partial configuration to merge with defaults
|
|
625
|
+
* @returns Complete configuration with defaults applied
|
|
626
|
+
*
|
|
627
|
+
* @example
|
|
628
|
+
* ```typescript
|
|
629
|
+
* const config = mergeWithDefaults({
|
|
630
|
+
* proofing: { enabled: false },
|
|
631
|
+
* identity: { environment: 'production' }
|
|
632
|
+
* });
|
|
633
|
+
* ```
|
|
634
|
+
*/
|
|
485
635
|
function mergeWithDefaults(partial) {
|
|
486
|
-
|
|
487
|
-
defaultConfig,
|
|
488
|
-
partial
|
|
489
|
-
);
|
|
636
|
+
return deepMerge(defaultConfig, partial);
|
|
490
637
|
}
|
|
491
638
|
|
|
639
|
+
//#endregion
|
|
492
640
|
export { auditConfigSchema, cloudflarePlatformConfigSchema, configMetadataSchema, defaultConfig, delegationConfigSchema, getDefaultConfigForPlatform, getMergedServerConfigResponseSchema, getServerConfigRequestSchema, getServerConfigResponseSchema, identityConfigSchema, mcpIServerConfigSchema, mergeWithDefaults, mergedMcpIServerConfigSchema, mergedToolProtectionConfigSchema, nodePlatformConfigSchema, platformConfigSchema, proofingConfigSchema, sessionConfigSchema, toolProtectionConfigSchema, updateServerConfigRequestSchema, updateServerConfigResponseSchema, validateServerConfigRequestSchema, validateServerConfigResponseSchema, vercelPlatformConfigSchema };
|
|
641
|
+
//# sourceMappingURL=index.mjs.map
|