@kya-os/contracts 1.4.0 → 1.5.2-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agentshield-api/endpoints.d.ts +3 -2
- package/dist/agentshield-api/endpoints.js +3 -2
- package/dist/agentshield-api/index.js +0 -1
- package/dist/agentshield-api/schemas.d.ts +195 -124
- package/dist/agentshield-api/schemas.js +0 -1
- package/dist/agentshield-api/types.d.ts +2 -1
- package/dist/agentshield-api/types.js +0 -1
- package/dist/config/builder.d.ts +34 -0
- package/dist/config/builder.js +75 -0
- package/dist/config/index.d.ts +12 -10
- package/dist/config/index.js +4 -0
- package/dist/dashboard-config/default-config.d.ts +50 -0
- package/dist/dashboard-config/default-config.js +241 -0
- package/dist/dashboard-config/index.d.ts +1 -0
- package/dist/dashboard-config/index.js +6 -1
- package/dist/dashboard-config/schemas.d.ts +382 -324
- package/dist/dashboard-config/schemas.js +5 -1
- package/dist/dashboard-config/types.d.ts +12 -5
- package/dist/delegation/constraints.d.ts +31 -0
- package/dist/delegation/constraints.js +10 -0
- package/dist/delegation/index.js +1 -0
- package/dist/delegation/schemas.d.ts +175 -98
- package/dist/delegation/schemas.js +1 -0
- package/dist/handshake.d.ts +11 -2
- package/dist/handshake.js +4 -1
- package/dist/index.js +0 -1
- package/package.json +1 -1
|
@@ -162,4 +162,3 @@ exports.revokeDelegationResponseSchema = zod_1.z.object({
|
|
|
162
162
|
* Wrapped revocation response schema
|
|
163
163
|
*/
|
|
164
164
|
exports.revokeDelegationAPIResponseSchema = (0, exports.agentShieldAPIResponseSchema)(exports.revokeDelegationResponseSchema);
|
|
165
|
-
//# sourceMappingURL=schemas.js.map
|
|
@@ -109,7 +109,7 @@ export interface AgentShieldToolProtection {
|
|
|
109
109
|
}
|
|
110
110
|
/**
|
|
111
111
|
* Response from tool protection config endpoint
|
|
112
|
-
* GET /api/v1/bouncer/
|
|
112
|
+
* GET /api/v1/bouncer/projects/{projectId}/config
|
|
113
113
|
*/
|
|
114
114
|
export interface ToolProtectionConfigResponse {
|
|
115
115
|
agent_did: string;
|
|
@@ -166,3 +166,4 @@ export declare class AgentShieldAPIError extends Error {
|
|
|
166
166
|
readonly details?: Record<string, unknown> | undefined;
|
|
167
167
|
constructor(code: string, message: string, details?: Record<string, unknown> | undefined);
|
|
168
168
|
}
|
|
169
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration Builder Utilities
|
|
3
|
+
*
|
|
4
|
+
* Shared utilities for building MCP-I configuration objects with sensible defaults.
|
|
5
|
+
* These functions are platform-agnostic and can be used by any adapter/platform.
|
|
6
|
+
*
|
|
7
|
+
* @module @kya-os/contracts/config
|
|
8
|
+
*/
|
|
9
|
+
import type { MCPIBaseConfig } from './base.js';
|
|
10
|
+
import type { RuntimeIdentityConfig } from './identity.js';
|
|
11
|
+
import type { ProofingConfig } from './proofing.js';
|
|
12
|
+
import type { DelegationConfig } from './delegation.js';
|
|
13
|
+
import type { ToolProtectionSourceConfig } from './tool-protection.js';
|
|
14
|
+
/**
|
|
15
|
+
* Complete runtime configuration type
|
|
16
|
+
* This can be extended by platform-specific configs
|
|
17
|
+
*/
|
|
18
|
+
export interface MCPIConfig extends MCPIBaseConfig {
|
|
19
|
+
identity?: RuntimeIdentityConfig;
|
|
20
|
+
proofing?: ProofingConfig;
|
|
21
|
+
delegation?: DelegationConfig;
|
|
22
|
+
toolProtection?: ToolProtectionSourceConfig;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Build base MCPIConfig that works across all platforms
|
|
26
|
+
*
|
|
27
|
+
* Creates a platform-agnostic configuration object with sensible defaults
|
|
28
|
+
* for identity, proofing, delegation, audit, and session management.
|
|
29
|
+
*
|
|
30
|
+
* @param env - Environment variables object (works with process.env or Cloudflare env)
|
|
31
|
+
* @returns Complete MCPIConfig object
|
|
32
|
+
*/
|
|
33
|
+
export declare function buildBaseConfig(env: Record<string, any>): MCPIConfig;
|
|
34
|
+
//# sourceMappingURL=builder.d.ts.map
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Configuration Builder Utilities
|
|
4
|
+
*
|
|
5
|
+
* Shared utilities for building MCP-I configuration objects with sensible defaults.
|
|
6
|
+
* These functions are platform-agnostic and can be used by any adapter/platform.
|
|
7
|
+
*
|
|
8
|
+
* @module @kya-os/contracts/config
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.buildBaseConfig = buildBaseConfig;
|
|
12
|
+
/**
|
|
13
|
+
* Build base MCPIConfig that works across all platforms
|
|
14
|
+
*
|
|
15
|
+
* Creates a platform-agnostic configuration object with sensible defaults
|
|
16
|
+
* for identity, proofing, delegation, audit, and session management.
|
|
17
|
+
*
|
|
18
|
+
* @param env - Environment variables object (works with process.env or Cloudflare env)
|
|
19
|
+
* @returns Complete MCPIConfig object
|
|
20
|
+
*/
|
|
21
|
+
function buildBaseConfig(env) {
|
|
22
|
+
const environment = (env.MCPI_ENV || env.ENVIRONMENT || 'development');
|
|
23
|
+
const isDevelopment = environment === 'development';
|
|
24
|
+
const baseConfig = {
|
|
25
|
+
environment,
|
|
26
|
+
identity: {
|
|
27
|
+
enabled: true,
|
|
28
|
+
environment,
|
|
29
|
+
devIdentityPath: '.mcpi/identity.json'
|
|
30
|
+
},
|
|
31
|
+
proofing: {
|
|
32
|
+
enabled: true,
|
|
33
|
+
batchQueue: {
|
|
34
|
+
destinations: [
|
|
35
|
+
{
|
|
36
|
+
type: 'agentshield',
|
|
37
|
+
apiUrl: env.AGENTSHIELD_API_URL || 'https://kya.vouched.id',
|
|
38
|
+
apiKey: env.AGENTSHIELD_API_KEY || ''
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
maxBatchSize: 10,
|
|
42
|
+
flushIntervalMs: 5000,
|
|
43
|
+
maxRetries: 3,
|
|
44
|
+
debug: isDevelopment
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
delegation: {
|
|
48
|
+
enabled: true,
|
|
49
|
+
enforceDelegations: true,
|
|
50
|
+
verifier: {
|
|
51
|
+
type: 'agentshield',
|
|
52
|
+
apiUrl: env.AGENTSHIELD_API_URL || 'https://kya.vouched.id',
|
|
53
|
+
apiKey: env.AGENTSHIELD_API_KEY || '',
|
|
54
|
+
cacheTtl: 60000, // 1 minute cache
|
|
55
|
+
debug: isDevelopment
|
|
56
|
+
},
|
|
57
|
+
authorization: {
|
|
58
|
+
authorizationUrl: env.AUTHORIZATION_URL || `${env.AGENTSHIELD_API_URL || 'https://kya.vouched.id'}/authorize`,
|
|
59
|
+
resumeTokenTtl: 600000, // 10 minutes
|
|
60
|
+
minReputationScore: 76
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
audit: {
|
|
64
|
+
enabled: true,
|
|
65
|
+
includeProofHashes: false,
|
|
66
|
+
includePayloads: false
|
|
67
|
+
},
|
|
68
|
+
session: {
|
|
69
|
+
timestampSkewSeconds: 120,
|
|
70
|
+
ttlMinutes: 30
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
return baseConfig;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=builder.js.map
|
package/dist/config/index.d.ts
CHANGED
|
@@ -6,21 +6,22 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module @kya-os/contracts/config
|
|
8
8
|
*/
|
|
9
|
-
import type { MCPIBaseConfig } from
|
|
10
|
-
import type { RuntimeIdentityConfig } from
|
|
11
|
-
import type { ProofingConfig } from
|
|
12
|
-
import type { DelegationConfig } from
|
|
13
|
-
import type { ToolProtectionSourceConfig } from
|
|
14
|
-
export { MCPIBaseConfig } from
|
|
15
|
-
export { RuntimeIdentityConfig, AgentIdentity } from
|
|
9
|
+
import type { MCPIBaseConfig } from "./base.js";
|
|
10
|
+
import type { RuntimeIdentityConfig } from "./identity.js";
|
|
11
|
+
import type { ProofingConfig } from "./proofing.js";
|
|
12
|
+
import type { DelegationConfig } from "./delegation.js";
|
|
13
|
+
import type { ToolProtectionSourceConfig } from "./tool-protection.js";
|
|
14
|
+
export { MCPIBaseConfig } from "./base.js";
|
|
15
|
+
export { RuntimeIdentityConfig, AgentIdentity } from "./identity.js";
|
|
16
16
|
/**
|
|
17
17
|
* @deprecated Use RuntimeIdentityConfig instead
|
|
18
18
|
* This export is maintained for backward compatibility
|
|
19
19
|
*/
|
|
20
20
|
export type IdentityConfig = RuntimeIdentityConfig;
|
|
21
|
-
export { ProofingConfig, ProofBatchQueueConfig, ProofDestination, ProofDestinationType } from
|
|
22
|
-
export { DelegationConfig, DelegationVerifierConfig, DelegationVerifierType, AuthorizationConfig, DelegationRecord } from
|
|
23
|
-
export { ToolProtection, ToolProtectionMap, ToolProtectionSourceConfig, ToolProtectionSourceType, ToolProtectionServiceConfig, DelegationRequiredErrorData, ToolProtectionResponse } from
|
|
21
|
+
export { ProofingConfig, ProofBatchQueueConfig, ProofDestination, ProofDestinationType, } from "./proofing.js";
|
|
22
|
+
export { DelegationConfig, DelegationVerifierConfig, DelegationVerifierType, AuthorizationConfig, DelegationRecord, } from "./delegation.js";
|
|
23
|
+
export { ToolProtection, ToolProtectionMap, ToolProtectionSourceConfig, ToolProtectionSourceType, ToolProtectionServiceConfig, DelegationRequiredErrorData, ToolProtectionResponse, } from "./tool-protection.js";
|
|
24
|
+
export { buildBaseConfig } from "./builder.js";
|
|
24
25
|
/**
|
|
25
26
|
* Complete runtime configuration type
|
|
26
27
|
* This can be extended by platform-specific configs
|
|
@@ -31,3 +32,4 @@ export interface MCPIConfig extends MCPIBaseConfig {
|
|
|
31
32
|
delegation?: DelegationConfig;
|
|
32
33
|
toolProtection?: ToolProtectionSourceConfig;
|
|
33
34
|
}
|
|
35
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/config/index.js
CHANGED
|
@@ -8,4 +8,8 @@
|
|
|
8
8
|
* @module @kya-os/contracts/config
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.buildBaseConfig = void 0;
|
|
12
|
+
// Configuration builder utilities
|
|
13
|
+
var builder_js_1 = require("./builder.js");
|
|
14
|
+
Object.defineProperty(exports, "buildBaseConfig", { enumerable: true, get: function () { return builder_js_1.buildBaseConfig; } });
|
|
11
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default Configuration for MCP-I Servers
|
|
3
|
+
*
|
|
4
|
+
* Provides safe, production-ready defaults for new user configurations.
|
|
5
|
+
* Used by AgentShield Dashboard, Scaffolder, and Runtime fallbacks.
|
|
6
|
+
*
|
|
7
|
+
* @package @kya-os/contracts/dashboard-config
|
|
8
|
+
*/
|
|
9
|
+
import type { MCPIServerConfig } from "./types.js";
|
|
10
|
+
/**
|
|
11
|
+
* Default configuration object
|
|
12
|
+
*
|
|
13
|
+
* This is the base default configuration used when creating new user configs.
|
|
14
|
+
* Platform-specific defaults are available via getDefaultConfigForPlatform().
|
|
15
|
+
*/
|
|
16
|
+
export declare const defaultConfig: MCPIServerConfig;
|
|
17
|
+
/**
|
|
18
|
+
* Get default configuration for a specific platform
|
|
19
|
+
*
|
|
20
|
+
* Returns the base default config merged with platform-specific defaults.
|
|
21
|
+
*
|
|
22
|
+
* @param platform - Platform type ('node', 'cloudflare', or 'vercel')
|
|
23
|
+
* @returns Platform-specific default configuration
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* const nodeConfig = getDefaultConfigForPlatform('node');
|
|
28
|
+
* const cloudflareConfig = getDefaultConfigForPlatform('cloudflare');
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function getDefaultConfigForPlatform(platform: "node" | "cloudflare" | "vercel"): MCPIServerConfig;
|
|
32
|
+
/**
|
|
33
|
+
* Merge partial configuration with defaults
|
|
34
|
+
*
|
|
35
|
+
* Deep merges a partial configuration object with the base defaults,
|
|
36
|
+
* ensuring all required fields are present.
|
|
37
|
+
*
|
|
38
|
+
* @param partial - Partial configuration to merge with defaults
|
|
39
|
+
* @returns Complete configuration with defaults applied
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* const config = mergeWithDefaults({
|
|
44
|
+
* proofing: { enabled: false },
|
|
45
|
+
* identity: { environment: 'production' }
|
|
46
|
+
* });
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function mergeWithDefaults(partial: Partial<MCPIServerConfig>): MCPIServerConfig;
|
|
50
|
+
//# sourceMappingURL=default-config.d.ts.map
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Default Configuration for MCP-I Servers
|
|
4
|
+
*
|
|
5
|
+
* Provides safe, production-ready defaults for new user configurations.
|
|
6
|
+
* Used by AgentShield Dashboard, Scaffolder, and Runtime fallbacks.
|
|
7
|
+
*
|
|
8
|
+
* @package @kya-os/contracts/dashboard-config
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.defaultConfig = void 0;
|
|
12
|
+
exports.getDefaultConfigForPlatform = getDefaultConfigForPlatform;
|
|
13
|
+
exports.mergeWithDefaults = mergeWithDefaults;
|
|
14
|
+
const schemas_js_1 = require("./schemas.js");
|
|
15
|
+
const zod_1 = require("zod");
|
|
16
|
+
/**
|
|
17
|
+
* Default configuration JSON content
|
|
18
|
+
* Embedded here to avoid TypeScript JSON import issues in build
|
|
19
|
+
*/
|
|
20
|
+
const defaultConfigJson = {
|
|
21
|
+
identity: {
|
|
22
|
+
// agentDid removed - deprecated, use serverDid instead
|
|
23
|
+
serverDid: "", // New field - will be populated when identity is generated
|
|
24
|
+
environment: "development",
|
|
25
|
+
storageLocation: "env-vars",
|
|
26
|
+
},
|
|
27
|
+
proofing: {
|
|
28
|
+
enabled: true,
|
|
29
|
+
destinations: [
|
|
30
|
+
{
|
|
31
|
+
type: "agentshield",
|
|
32
|
+
apiUrl: "https://kya.vouched.id",
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
batchQueue: {
|
|
36
|
+
maxBatchSize: 10,
|
|
37
|
+
flushIntervalMs: 5000,
|
|
38
|
+
maxRetries: 3,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
delegation: {
|
|
42
|
+
enabled: true,
|
|
43
|
+
enforceStrictly: false,
|
|
44
|
+
verifier: {
|
|
45
|
+
type: "agentshield",
|
|
46
|
+
apiUrl: "https://kya.vouched.id/api/v1/bouncer/delegations/verify",
|
|
47
|
+
cacheTtl: 300000,
|
|
48
|
+
},
|
|
49
|
+
authorization: {
|
|
50
|
+
authorizationUrl: "https://kya.vouched.id/api/v1/bouncer/delegations/authorize",
|
|
51
|
+
minReputationScore: 80,
|
|
52
|
+
resumeTokenTtl: 3600000,
|
|
53
|
+
requireAuthForUnknown: false,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
toolProtection: {
|
|
57
|
+
source: "agentshield",
|
|
58
|
+
agentShield: {
|
|
59
|
+
apiUrl: "https://kya.vouched.id",
|
|
60
|
+
cacheTtl: 300000,
|
|
61
|
+
},
|
|
62
|
+
fallback: {},
|
|
63
|
+
},
|
|
64
|
+
audit: {
|
|
65
|
+
enabled: true,
|
|
66
|
+
includeProofHashes: false,
|
|
67
|
+
includePayloads: false,
|
|
68
|
+
},
|
|
69
|
+
session: {
|
|
70
|
+
timestampSkewSeconds: 120,
|
|
71
|
+
ttlMinutes: 30,
|
|
72
|
+
},
|
|
73
|
+
platform: {
|
|
74
|
+
type: "node",
|
|
75
|
+
node: {
|
|
76
|
+
server: {
|
|
77
|
+
port: 3000,
|
|
78
|
+
host: "0.0.0.0",
|
|
79
|
+
cors: true,
|
|
80
|
+
timeout: 30000,
|
|
81
|
+
},
|
|
82
|
+
storage: {
|
|
83
|
+
type: "memory",
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
cloudflare: {
|
|
87
|
+
workers: {
|
|
88
|
+
cpuMs: 50,
|
|
89
|
+
memoryMb: 128,
|
|
90
|
+
},
|
|
91
|
+
kvNamespaces: [],
|
|
92
|
+
environmentVariables: [],
|
|
93
|
+
},
|
|
94
|
+
vercel: {
|
|
95
|
+
environmentVariables: [],
|
|
96
|
+
edgeRuntime: {},
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
metadata: {
|
|
100
|
+
version: "1.0.0",
|
|
101
|
+
lastUpdated: "",
|
|
102
|
+
source: "dashboard",
|
|
103
|
+
deploymentStatus: "inactive",
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Relaxed schema for default config validation
|
|
108
|
+
* Allows empty strings for fields that will be populated later
|
|
109
|
+
*
|
|
110
|
+
* Note: Empty `agentDid` is valid for new/incomplete configurations.
|
|
111
|
+
* This allows users to create configs before registering their agent DID.
|
|
112
|
+
* The base schema (mcpIServerConfigSchema) requires non-empty agentDid for
|
|
113
|
+
* complete configurations, but defaults allow empty to support progressive
|
|
114
|
+
* configuration.
|
|
115
|
+
*/
|
|
116
|
+
const defaultConfigSchema = schemas_js_1.mcpIServerConfigSchema.extend({
|
|
117
|
+
identity: schemas_js_1.mcpIServerConfigSchema.shape.identity.extend({
|
|
118
|
+
agentDid: zod_1.z.string().optional(), // Allow empty string or undefined for defaults (deprecated)
|
|
119
|
+
serverDid: zod_1.z.string(), // Allow empty string for defaults (will be populated later)
|
|
120
|
+
}),
|
|
121
|
+
metadata: schemas_js_1.mcpIServerConfigSchema.shape.metadata.extend({
|
|
122
|
+
lastUpdated: zod_1.z.string(), // Allow empty string (will be set dynamically)
|
|
123
|
+
}),
|
|
124
|
+
});
|
|
125
|
+
/**
|
|
126
|
+
* Default configuration object
|
|
127
|
+
*
|
|
128
|
+
* This is the base default configuration used when creating new user configs.
|
|
129
|
+
* Platform-specific defaults are available via getDefaultConfigForPlatform().
|
|
130
|
+
*/
|
|
131
|
+
exports.defaultConfig = defaultConfigSchema.parse(defaultConfigJson);
|
|
132
|
+
/**
|
|
133
|
+
* Platform-specific default configurations
|
|
134
|
+
*/
|
|
135
|
+
const platformDefaults = {
|
|
136
|
+
node: {
|
|
137
|
+
platform: {
|
|
138
|
+
type: "node",
|
|
139
|
+
node: {
|
|
140
|
+
server: {
|
|
141
|
+
port: 3000,
|
|
142
|
+
host: "0.0.0.0",
|
|
143
|
+
cors: true,
|
|
144
|
+
timeout: 30000,
|
|
145
|
+
},
|
|
146
|
+
storage: {
|
|
147
|
+
type: "memory",
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
cloudflare: {
|
|
153
|
+
platform: {
|
|
154
|
+
type: "cloudflare",
|
|
155
|
+
cloudflare: {
|
|
156
|
+
workers: {
|
|
157
|
+
cpuMs: 50,
|
|
158
|
+
memoryMb: 128,
|
|
159
|
+
},
|
|
160
|
+
kvNamespaces: [],
|
|
161
|
+
environmentVariables: [],
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
vercel: {
|
|
166
|
+
platform: {
|
|
167
|
+
type: "vercel",
|
|
168
|
+
vercel: {
|
|
169
|
+
environmentVariables: [],
|
|
170
|
+
edgeRuntime: {},
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* Get default configuration for a specific platform
|
|
177
|
+
*
|
|
178
|
+
* Returns the base default config merged with platform-specific defaults.
|
|
179
|
+
*
|
|
180
|
+
* @param platform - Platform type ('node', 'cloudflare', or 'vercel')
|
|
181
|
+
* @returns Platform-specific default configuration
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```typescript
|
|
185
|
+
* const nodeConfig = getDefaultConfigForPlatform('node');
|
|
186
|
+
* const cloudflareConfig = getDefaultConfigForPlatform('cloudflare');
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
189
|
+
function getDefaultConfigForPlatform(platform) {
|
|
190
|
+
const platformDefault = platformDefaults[platform];
|
|
191
|
+
return {
|
|
192
|
+
...exports.defaultConfig,
|
|
193
|
+
platform: platformDefault.platform,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Deep merge utility for objects
|
|
198
|
+
*/
|
|
199
|
+
function deepMerge(target, source) {
|
|
200
|
+
const result = { ...target };
|
|
201
|
+
for (const key in source) {
|
|
202
|
+
const sourceValue = source[key];
|
|
203
|
+
if (sourceValue &&
|
|
204
|
+
typeof sourceValue === "object" &&
|
|
205
|
+
!Array.isArray(sourceValue) &&
|
|
206
|
+
sourceValue !== null) {
|
|
207
|
+
const targetValue = target[key];
|
|
208
|
+
if (targetValue &&
|
|
209
|
+
typeof targetValue === "object" &&
|
|
210
|
+
!Array.isArray(targetValue) &&
|
|
211
|
+
targetValue !== null) {
|
|
212
|
+
result[key] = deepMerge(targetValue, sourceValue);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
else if (sourceValue !== undefined) {
|
|
216
|
+
result[key] = sourceValue;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return result;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Merge partial configuration with defaults
|
|
223
|
+
*
|
|
224
|
+
* Deep merges a partial configuration object with the base defaults,
|
|
225
|
+
* ensuring all required fields are present.
|
|
226
|
+
*
|
|
227
|
+
* @param partial - Partial configuration to merge with defaults
|
|
228
|
+
* @returns Complete configuration with defaults applied
|
|
229
|
+
*
|
|
230
|
+
* @example
|
|
231
|
+
* ```typescript
|
|
232
|
+
* const config = mergeWithDefaults({
|
|
233
|
+
* proofing: { enabled: false },
|
|
234
|
+
* identity: { environment: 'production' }
|
|
235
|
+
* });
|
|
236
|
+
* ```
|
|
237
|
+
*/
|
|
238
|
+
function mergeWithDefaults(partial) {
|
|
239
|
+
return deepMerge(exports.defaultConfig, partial);
|
|
240
|
+
}
|
|
241
|
+
//# sourceMappingURL=default-config.js.map
|
|
@@ -7,4 +7,5 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export type { MCPIServerConfig, GetServerConfigRequest, GetServerConfigResponse, UpdateServerConfigRequest, UpdateServerConfigResponse, ValidateServerConfigRequest, ValidateServerConfigResponse, } from './types.js';
|
|
9
9
|
export { identityConfigSchema, proofingConfigSchema, delegationConfigSchema, toolProtectionConfigSchema, auditConfigSchema, sessionConfigSchema, platformConfigSchema, cloudflarePlatformConfigSchema, nodePlatformConfigSchema, vercelPlatformConfigSchema, configMetadataSchema, mcpIServerConfigSchema, getServerConfigRequestSchema, getServerConfigResponseSchema, updateServerConfigRequestSchema, updateServerConfigResponseSchema, validateServerConfigRequestSchema, validateServerConfigResponseSchema, } from './schemas.js';
|
|
10
|
+
export { defaultConfig, getDefaultConfigForPlatform, mergeWithDefaults, } from './default-config.js';
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @package @kya-os/contracts/dashboard-config
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.validateServerConfigResponseSchema = exports.validateServerConfigRequestSchema = exports.updateServerConfigResponseSchema = exports.updateServerConfigRequestSchema = exports.getServerConfigResponseSchema = exports.getServerConfigRequestSchema = exports.mcpIServerConfigSchema = exports.configMetadataSchema = exports.vercelPlatformConfigSchema = exports.nodePlatformConfigSchema = exports.cloudflarePlatformConfigSchema = exports.platformConfigSchema = exports.sessionConfigSchema = exports.auditConfigSchema = exports.toolProtectionConfigSchema = exports.delegationConfigSchema = exports.proofingConfigSchema = exports.identityConfigSchema = void 0;
|
|
10
|
+
exports.mergeWithDefaults = exports.getDefaultConfigForPlatform = exports.defaultConfig = exports.validateServerConfigResponseSchema = exports.validateServerConfigRequestSchema = exports.updateServerConfigResponseSchema = exports.updateServerConfigRequestSchema = exports.getServerConfigResponseSchema = exports.getServerConfigRequestSchema = exports.mcpIServerConfigSchema = exports.configMetadataSchema = exports.vercelPlatformConfigSchema = exports.nodePlatformConfigSchema = exports.cloudflarePlatformConfigSchema = exports.platformConfigSchema = exports.sessionConfigSchema = exports.auditConfigSchema = exports.toolProtectionConfigSchema = exports.delegationConfigSchema = exports.proofingConfigSchema = exports.identityConfigSchema = void 0;
|
|
11
11
|
// Schema exports
|
|
12
12
|
var schemas_js_1 = require("./schemas.js");
|
|
13
13
|
Object.defineProperty(exports, "identityConfigSchema", { enumerable: true, get: function () { return schemas_js_1.identityConfigSchema; } });
|
|
@@ -28,4 +28,9 @@ Object.defineProperty(exports, "updateServerConfigRequestSchema", { enumerable:
|
|
|
28
28
|
Object.defineProperty(exports, "updateServerConfigResponseSchema", { enumerable: true, get: function () { return schemas_js_1.updateServerConfigResponseSchema; } });
|
|
29
29
|
Object.defineProperty(exports, "validateServerConfigRequestSchema", { enumerable: true, get: function () { return schemas_js_1.validateServerConfigRequestSchema; } });
|
|
30
30
|
Object.defineProperty(exports, "validateServerConfigResponseSchema", { enumerable: true, get: function () { return schemas_js_1.validateServerConfigResponseSchema; } });
|
|
31
|
+
// Default configuration exports
|
|
32
|
+
var default_config_js_1 = require("./default-config.js");
|
|
33
|
+
Object.defineProperty(exports, "defaultConfig", { enumerable: true, get: function () { return default_config_js_1.defaultConfig; } });
|
|
34
|
+
Object.defineProperty(exports, "getDefaultConfigForPlatform", { enumerable: true, get: function () { return default_config_js_1.getDefaultConfigForPlatform; } });
|
|
35
|
+
Object.defineProperty(exports, "mergeWithDefaults", { enumerable: true, get: function () { return default_config_js_1.mergeWithDefaults; } });
|
|
31
36
|
//# sourceMappingURL=index.js.map
|