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