@kya-os/contracts 1.5.2-canary.3 → 1.5.2-canary.4

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 (97) hide show
  1. package/package.json +5 -5
  2. package/dist/agentshield-api/endpoints.d.ts +0 -51
  3. package/dist/agentshield-api/endpoints.js +0 -47
  4. package/dist/agentshield-api/index.d.ts +0 -13
  5. package/dist/agentshield-api/index.js +0 -37
  6. package/dist/agentshield-api/schemas.d.ts +0 -5867
  7. package/dist/agentshield-api/schemas.js +0 -207
  8. package/dist/agentshield-api/types.d.ts +0 -194
  9. package/dist/agentshield-api/types.js +0 -26
  10. package/dist/cli.d.ts +0 -388
  11. package/dist/cli.js +0 -121
  12. package/dist/config/base.d.ts +0 -96
  13. package/dist/config/base.js +0 -11
  14. package/dist/config/builder.d.ts +0 -34
  15. package/dist/config/builder.js +0 -74
  16. package/dist/config/delegation.d.ts +0 -194
  17. package/dist/config/delegation.js +0 -10
  18. package/dist/config/identity.d.ts +0 -117
  19. package/dist/config/identity.js +0 -11
  20. package/dist/config/index.d.ts +0 -35
  21. package/dist/config/index.js +0 -15
  22. package/dist/config/proofing.d.ts +0 -120
  23. package/dist/config/proofing.js +0 -10
  24. package/dist/config/tool-protection.d.ts +0 -139
  25. package/dist/config/tool-protection.js +0 -10
  26. package/dist/consent/index.d.ts +0 -6
  27. package/dist/consent/index.js +0 -22
  28. package/dist/consent/schemas.d.ts +0 -738
  29. package/dist/consent/schemas.js +0 -186
  30. package/dist/consent/types.d.ts +0 -155
  31. package/dist/consent/types.js +0 -10
  32. package/dist/dashboard-config/default-config.d.ts +0 -50
  33. package/dist/dashboard-config/default-config.js +0 -241
  34. package/dist/dashboard-config/index.d.ts +0 -11
  35. package/dist/dashboard-config/index.js +0 -36
  36. package/dist/dashboard-config/schemas.d.ts +0 -5905
  37. package/dist/dashboard-config/schemas.js +0 -255
  38. package/dist/dashboard-config/types.d.ts +0 -338
  39. package/dist/dashboard-config/types.js +0 -11
  40. package/dist/delegation/constraints.d.ts +0 -1022
  41. package/dist/delegation/constraints.js +0 -219
  42. package/dist/delegation/index.d.ts +0 -7
  43. package/dist/delegation/index.js +0 -24
  44. package/dist/delegation/schemas.d.ts +0 -8458
  45. package/dist/delegation/schemas.js +0 -476
  46. package/dist/did/index.d.ts +0 -8
  47. package/dist/did/index.js +0 -24
  48. package/dist/did/resolve-contract.d.ts +0 -219
  49. package/dist/did/resolve-contract.js +0 -31
  50. package/dist/did/schemas.d.ts +0 -112
  51. package/dist/did/schemas.js +0 -172
  52. package/dist/did/types.d.ts +0 -163
  53. package/dist/did/types.js +0 -70
  54. package/dist/env/constants.d.ts +0 -57
  55. package/dist/env/constants.js +0 -59
  56. package/dist/env/index.d.ts +0 -4
  57. package/dist/env/index.js +0 -20
  58. package/dist/handshake.d.ts +0 -167
  59. package/dist/handshake.js +0 -60
  60. package/dist/index.d.ts +0 -25
  61. package/dist/index.js +0 -55
  62. package/dist/proof/index.d.ts +0 -8
  63. package/dist/proof/index.js +0 -24
  64. package/dist/proof/proof-record.d.ts +0 -837
  65. package/dist/proof/proof-record.js +0 -133
  66. package/dist/proof/signing-spec.d.ts +0 -146
  67. package/dist/proof/signing-spec.js +0 -122
  68. package/dist/proof.d.ts +0 -415
  69. package/dist/proof.js +0 -83
  70. package/dist/registry.d.ts +0 -342
  71. package/dist/registry.js +0 -118
  72. package/dist/runtime/errors.d.ts +0 -347
  73. package/dist/runtime/errors.js +0 -119
  74. package/dist/runtime/headers.d.ts +0 -83
  75. package/dist/runtime/headers.js +0 -81
  76. package/dist/runtime/index.d.ts +0 -5
  77. package/dist/runtime/index.js +0 -21
  78. package/dist/test.d.ts +0 -251
  79. package/dist/test.js +0 -119
  80. package/dist/tlkrc/index.d.ts +0 -4
  81. package/dist/tlkrc/index.js +0 -20
  82. package/dist/tlkrc/rotation.d.ts +0 -245
  83. package/dist/tlkrc/rotation.js +0 -126
  84. package/dist/tool-protection/index.d.ts +0 -227
  85. package/dist/tool-protection/index.js +0 -113
  86. package/dist/utils/validation.d.ts +0 -30
  87. package/dist/utils/validation.js +0 -69
  88. package/dist/vc/index.d.ts +0 -7
  89. package/dist/vc/index.js +0 -23
  90. package/dist/vc/schemas.d.ts +0 -2483
  91. package/dist/vc/schemas.js +0 -224
  92. package/dist/vc/statuslist.d.ts +0 -493
  93. package/dist/vc/statuslist.js +0 -132
  94. package/dist/verifier.d.ts +0 -205
  95. package/dist/verifier.js +0 -83
  96. package/dist/well-known/index.d.ts +0 -308
  97. package/dist/well-known/index.js +0 -134
@@ -1,186 +0,0 @@
1
- "use strict";
2
- /**
3
- * Consent Schemas
4
- *
5
- * Zod schemas for runtime validation of consent-related data structures.
6
- * All types are derived from these schemas using z.infer.
7
- *
8
- * Related Spec: MCP-I Phase 0 Implementation Plan
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.consentConfigSchema = exports.consentApprovalResponseSchema = exports.consentApprovalRequestSchema = exports.consentPageConfigSchema = exports.consentCustomFieldSchema = exports.consentCustomFieldOptionSchema = exports.consentTermsSchema = exports.consentBrandingSchema = void 0;
12
- exports.validateConsentPageConfig = validateConsentPageConfig;
13
- exports.validateConsentApprovalRequest = validateConsentApprovalRequest;
14
- exports.validateConsentApprovalResponse = validateConsentApprovalResponse;
15
- exports.validateConsentConfig = validateConsentConfig;
16
- const zod_1 = require("zod");
17
- /**
18
- * Consent Branding Schema
19
- */
20
- exports.consentBrandingSchema = zod_1.z.object({
21
- primaryColor: zod_1.z
22
- .string()
23
- .regex(/^#[0-9A-Fa-f]{6}$/, 'Must be a valid hex color (e.g., #0066CC)')
24
- .optional(),
25
- logoUrl: zod_1.z.string().url('Must be a valid URL').optional(),
26
- companyName: zod_1.z.string().max(100, 'Company name must be 100 characters or less').optional(),
27
- theme: zod_1.z.enum(['light', 'dark', 'auto']).optional(),
28
- });
29
- /**
30
- * Consent Terms Schema
31
- */
32
- exports.consentTermsSchema = zod_1.z.object({
33
- text: zod_1.z.string().max(10000, 'Terms text must be 10000 characters or less').optional(),
34
- url: zod_1.z.string().url('Must be a valid URL').optional(),
35
- version: zod_1.z.string().max(50, 'Version must be 50 characters or less').optional(),
36
- required: zod_1.z.boolean().default(true),
37
- });
38
- /**
39
- * Consent Custom Field Option Schema
40
- */
41
- exports.consentCustomFieldOptionSchema = zod_1.z.object({
42
- value: zod_1.z.string().max(100, 'Option value must be 100 characters or less'),
43
- label: zod_1.z.string().max(100, 'Option label must be 100 characters or less'),
44
- });
45
- /**
46
- * Consent Custom Field Schema
47
- */
48
- exports.consentCustomFieldSchema = zod_1.z.object({
49
- name: zod_1.z
50
- .string()
51
- .min(1, 'Field name is required')
52
- .max(50, 'Field name must be 50 characters or less')
53
- .regex(/^[a-zA-Z0-9_]+$/, 'Field name must contain only letters, numbers, and underscores'),
54
- label: zod_1.z.string().min(1, 'Field label is required').max(100, 'Field label must be 100 characters or less'),
55
- type: zod_1.z.enum(['text', 'textarea', 'checkbox', 'select']),
56
- required: zod_1.z.boolean(),
57
- placeholder: zod_1.z.string().max(200, 'Placeholder must be 200 characters or less').optional(),
58
- options: zod_1.z
59
- .array(exports.consentCustomFieldOptionSchema)
60
- .min(1, 'Select fields must have at least one option')
61
- .optional(),
62
- pattern: zod_1.z.string().max(500, 'Pattern must be 500 characters or less').optional(),
63
- }).refine((data) => {
64
- // Select fields must have options
65
- if (data.type === 'select' && (!data.options || data.options.length === 0)) {
66
- return false;
67
- }
68
- // Non-select fields should not have options
69
- if (data.type !== 'select' && data.options) {
70
- return false;
71
- }
72
- return true;
73
- }, {
74
- message: 'Select fields must have options, and non-select fields must not have options',
75
- });
76
- /**
77
- * Consent Page Config Schema
78
- */
79
- exports.consentPageConfigSchema = zod_1.z.object({
80
- tool: zod_1.z.string().min(1, 'Tool name is required'),
81
- toolDescription: zod_1.z.string().max(500, 'Tool description must be 500 characters or less'),
82
- scopes: zod_1.z.array(zod_1.z.string()).min(0, 'Scopes array cannot be negative'),
83
- agentDid: zod_1.z.string().min(1, 'Agent DID is required'),
84
- sessionId: zod_1.z.string().min(1, 'Session ID is required'),
85
- projectId: zod_1.z.string().min(1, 'Project ID is required'),
86
- branding: exports.consentBrandingSchema.optional(),
87
- terms: exports.consentTermsSchema.optional(),
88
- customFields: zod_1.z
89
- .array(exports.consentCustomFieldSchema)
90
- .max(10, 'Maximum 10 custom fields allowed')
91
- .optional(),
92
- serverUrl: zod_1.z.string().url('Server URL must be a valid URL'),
93
- autoClose: zod_1.z.boolean().optional(),
94
- });
95
- /**
96
- * Consent Approval Request Schema
97
- *
98
- * Note: Uses snake_case for API compatibility (agent_did, session_id, project_id)
99
- */
100
- exports.consentApprovalRequestSchema = zod_1.z.object({
101
- tool: zod_1.z.string().min(1, 'Tool name is required'),
102
- scopes: zod_1.z.array(zod_1.z.string()).min(0, 'Scopes array cannot be negative'),
103
- agent_did: zod_1.z.string().min(1, 'Agent DID is required'),
104
- session_id: zod_1.z.string().min(1, 'Session ID is required'),
105
- project_id: zod_1.z.string().min(1, 'Project ID is required'),
106
- termsAccepted: zod_1.z.boolean(),
107
- termsVersion: zod_1.z.string().max(50, 'Terms version must be 50 characters or less').optional(),
108
- customFields: zod_1.z
109
- .record(zod_1.z.union([zod_1.z.string(), zod_1.z.boolean()]))
110
- .optional(),
111
- });
112
- /**
113
- * Consent Approval Response Schema
114
- */
115
- exports.consentApprovalResponseSchema = zod_1.z.object({
116
- success: zod_1.z.boolean(),
117
- delegation_id: zod_1.z.string().min(1).optional(),
118
- delegation_token: zod_1.z.string().min(1).optional(),
119
- error: zod_1.z.string().optional(),
120
- error_code: zod_1.z.string().optional(),
121
- }).refine((data) => {
122
- // If success is true, must have delegation_id and delegation_token
123
- if (data.success) {
124
- return !!data.delegation_id && !!data.delegation_token;
125
- }
126
- // If success is false, must have error or error_code
127
- return !!data.error || !!data.error_code;
128
- }, {
129
- message: 'Successful responses must include delegation_id and delegation_token. Failed responses must include error or error_code',
130
- });
131
- /**
132
- * Consent Config Schema
133
- */
134
- exports.consentConfigSchema = zod_1.z.object({
135
- branding: exports.consentBrandingSchema.optional(),
136
- terms: exports.consentTermsSchema.optional(),
137
- customFields: zod_1.z
138
- .array(exports.consentCustomFieldSchema)
139
- .max(10, 'Maximum 10 custom fields allowed')
140
- .optional(),
141
- ui: zod_1.z.object({
142
- theme: zod_1.z.enum(['light', 'dark', 'auto']).optional(),
143
- popupEnabled: zod_1.z.boolean().optional(),
144
- autoClose: zod_1.z.boolean().optional(),
145
- autoCloseDelay: zod_1.z.number().int().positive().max(60000, 'Auto-close delay must be 60000ms or less').optional(),
146
- }).optional(),
147
- });
148
- /**
149
- * Validation Helpers
150
- */
151
- /**
152
- * Validate a consent page config
153
- *
154
- * @param config - The config to validate
155
- * @returns Validation result
156
- */
157
- function validateConsentPageConfig(config) {
158
- return exports.consentPageConfigSchema.safeParse(config);
159
- }
160
- /**
161
- * Validate a consent approval request
162
- *
163
- * @param request - The request to validate
164
- * @returns Validation result
165
- */
166
- function validateConsentApprovalRequest(request) {
167
- return exports.consentApprovalRequestSchema.safeParse(request);
168
- }
169
- /**
170
- * Validate a consent approval response
171
- *
172
- * @param response - The response to validate
173
- * @returns Validation result
174
- */
175
- function validateConsentApprovalResponse(response) {
176
- return exports.consentApprovalResponseSchema.safeParse(response);
177
- }
178
- /**
179
- * Validate a consent config
180
- *
181
- * @param config - The config to validate
182
- * @returns Validation result
183
- */
184
- function validateConsentConfig(config) {
185
- return exports.consentConfigSchema.safeParse(config);
186
- }
@@ -1,155 +0,0 @@
1
- /**
2
- * Consent Types
3
- *
4
- * TypeScript type definitions for consent page configuration and approval handling.
5
- * These types are used for server-hosted consent pages in HTTP/SSE transports.
6
- *
7
- * Related Spec: MCP-I Phase 0 Implementation Plan
8
- */
9
- /**
10
- * Consent Branding Configuration
11
- *
12
- * Customization options for consent page appearance
13
- */
14
- export interface ConsentBranding {
15
- /** Primary brand color (hex format, e.g., '#0066CC') */
16
- primaryColor?: string;
17
- /** Logo URL for display on consent page */
18
- logoUrl?: string;
19
- /** Company/application name */
20
- companyName?: string;
21
- /** Theme preference ('light', 'dark', or 'auto' for system preference) */
22
- theme?: 'light' | 'dark' | 'auto';
23
- }
24
- /**
25
- * Consent Terms Configuration
26
- *
27
- * Terms of service or privacy policy information
28
- */
29
- export interface ConsentTerms {
30
- /** Full terms text (displayed on page) */
31
- text?: string;
32
- /** URL to terms document */
33
- url?: string;
34
- /** Version identifier for terms */
35
- version?: string;
36
- /** Whether terms acceptance is required */
37
- required?: boolean;
38
- }
39
- /**
40
- * Consent Custom Field
41
- *
42
- * Additional fields to collect during consent (e.g., email, preferences)
43
- */
44
- export interface ConsentCustomField {
45
- /** Field name (used as form field name, must be valid identifier) */
46
- name: string;
47
- /** Display label for the field */
48
- label: string;
49
- /** Field type */
50
- type: 'text' | 'textarea' | 'checkbox' | 'select';
51
- /** Whether field is required */
52
- required: boolean;
53
- /** Placeholder text */
54
- placeholder?: string;
55
- /** Options for select fields */
56
- options?: Array<{
57
- value: string;
58
- label: string;
59
- }>;
60
- /** Validation pattern (regex) */
61
- pattern?: string;
62
- }
63
- /**
64
- * Consent Page Configuration
65
- *
66
- * Complete configuration for rendering a consent page
67
- */
68
- export interface ConsentPageConfig {
69
- /** Tool name requiring authorization */
70
- tool: string;
71
- /** Description of what the tool does */
72
- toolDescription: string;
73
- /** Scopes being requested */
74
- scopes: string[];
75
- /** Agent DID requesting authorization */
76
- agentDid: string;
77
- /** Session ID for tracking */
78
- sessionId: string;
79
- /** Project ID from AgentShield */
80
- projectId: string;
81
- /** Branding configuration */
82
- branding?: ConsentBranding;
83
- /** Terms configuration */
84
- terms?: ConsentTerms;
85
- /** Custom fields to collect */
86
- customFields?: ConsentCustomField[];
87
- /** Server URL for form submission */
88
- serverUrl: string;
89
- /** Whether to auto-close window after success */
90
- autoClose?: boolean;
91
- }
92
- /**
93
- * Consent Approval Request
94
- *
95
- * Request payload when user approves consent
96
- */
97
- export interface ConsentApprovalRequest {
98
- /** Tool name */
99
- tool: string;
100
- /** Approved scopes */
101
- scopes: string[];
102
- /** Agent DID (snake_case for API compatibility) */
103
- agent_did: string;
104
- /** Session ID (snake_case for API compatibility) */
105
- session_id: string;
106
- /** Project ID (snake_case for API compatibility) */
107
- project_id: string;
108
- /** Whether terms were accepted */
109
- termsAccepted: boolean;
110
- /** Terms version (if applicable) */
111
- termsVersion?: string;
112
- /** Custom field values */
113
- customFields?: Record<string, string | boolean>;
114
- }
115
- /**
116
- * Consent Approval Response
117
- *
118
- * Response after processing consent approval
119
- */
120
- export interface ConsentApprovalResponse {
121
- /** Whether approval was successful */
122
- success: boolean;
123
- /** Delegation ID (if successful) */
124
- delegation_id?: string;
125
- /** Delegation token (if successful) */
126
- delegation_token?: string;
127
- /** Error message (if failed) */
128
- error?: string;
129
- /** Error code (if failed) */
130
- error_code?: string;
131
- }
132
- /**
133
- * Consent Configuration
134
- *
135
- * Complete consent configuration fetched from AgentShield or defaults
136
- */
137
- export interface ConsentConfig {
138
- /** Branding configuration */
139
- branding?: ConsentBranding;
140
- /** Terms configuration */
141
- terms?: ConsentTerms;
142
- /** Custom fields configuration */
143
- customFields?: ConsentCustomField[];
144
- /** UI preferences */
145
- ui?: {
146
- /** Theme preference */
147
- theme?: 'light' | 'dark' | 'auto';
148
- /** Whether popup mode is enabled */
149
- popupEnabled?: boolean;
150
- /** Whether to auto-close after success */
151
- autoClose?: boolean;
152
- /** Delay before auto-close (milliseconds) */
153
- autoCloseDelay?: number;
154
- };
155
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- /**
3
- * Consent Types
4
- *
5
- * TypeScript type definitions for consent page configuration and approval handling.
6
- * These types are used for server-hosted consent pages in HTTP/SSE transports.
7
- *
8
- * Related Spec: MCP-I Phase 0 Implementation Plan
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,50 +0,0 @@
1
- /**
2
- * Default Configuration for MCP-I Servers
3
- *
4
- * Provides safe, production-ready defaults for new user configurations.
5
- * Used by AgentShield Dashboard, Scaffolder, and Runtime fallbacks.
6
- *
7
- * @package @kya-os/contracts/dashboard-config
8
- */
9
- 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
@@ -1,241 +0,0 @@
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
@@ -1,11 +0,0 @@
1
- /**
2
- * Dashboard Configuration Module
3
- *
4
- * Central export point for dashboard configuration types and schemas.
5
- *
6
- * @package @kya-os/contracts/dashboard-config
7
- */
8
- export type { MCPIServerConfig, GetServerConfigRequest, GetServerConfigResponse, UpdateServerConfigRequest, UpdateServerConfigResponse, ValidateServerConfigRequest, ValidateServerConfigResponse, } from './types.js';
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';
11
- //# sourceMappingURL=index.d.ts.map
@@ -1,36 +0,0 @@
1
- "use strict";
2
- /**
3
- * Dashboard Configuration Module
4
- *
5
- * Central export point for dashboard configuration types and schemas.
6
- *
7
- * @package @kya-os/contracts/dashboard-config
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
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
- // Schema exports
12
- var schemas_js_1 = require("./schemas.js");
13
- Object.defineProperty(exports, "identityConfigSchema", { enumerable: true, get: function () { return schemas_js_1.identityConfigSchema; } });
14
- Object.defineProperty(exports, "proofingConfigSchema", { enumerable: true, get: function () { return schemas_js_1.proofingConfigSchema; } });
15
- Object.defineProperty(exports, "delegationConfigSchema", { enumerable: true, get: function () { return schemas_js_1.delegationConfigSchema; } });
16
- Object.defineProperty(exports, "toolProtectionConfigSchema", { enumerable: true, get: function () { return schemas_js_1.toolProtectionConfigSchema; } });
17
- Object.defineProperty(exports, "auditConfigSchema", { enumerable: true, get: function () { return schemas_js_1.auditConfigSchema; } });
18
- Object.defineProperty(exports, "sessionConfigSchema", { enumerable: true, get: function () { return schemas_js_1.sessionConfigSchema; } });
19
- Object.defineProperty(exports, "platformConfigSchema", { enumerable: true, get: function () { return schemas_js_1.platformConfigSchema; } });
20
- Object.defineProperty(exports, "cloudflarePlatformConfigSchema", { enumerable: true, get: function () { return schemas_js_1.cloudflarePlatformConfigSchema; } });
21
- Object.defineProperty(exports, "nodePlatformConfigSchema", { enumerable: true, get: function () { return schemas_js_1.nodePlatformConfigSchema; } });
22
- Object.defineProperty(exports, "vercelPlatformConfigSchema", { enumerable: true, get: function () { return schemas_js_1.vercelPlatformConfigSchema; } });
23
- Object.defineProperty(exports, "configMetadataSchema", { enumerable: true, get: function () { return schemas_js_1.configMetadataSchema; } });
24
- Object.defineProperty(exports, "mcpIServerConfigSchema", { enumerable: true, get: function () { return schemas_js_1.mcpIServerConfigSchema; } });
25
- Object.defineProperty(exports, "getServerConfigRequestSchema", { enumerable: true, get: function () { return schemas_js_1.getServerConfigRequestSchema; } });
26
- Object.defineProperty(exports, "getServerConfigResponseSchema", { enumerable: true, get: function () { return schemas_js_1.getServerConfigResponseSchema; } });
27
- Object.defineProperty(exports, "updateServerConfigRequestSchema", { enumerable: true, get: function () { return schemas_js_1.updateServerConfigRequestSchema; } });
28
- Object.defineProperty(exports, "updateServerConfigResponseSchema", { enumerable: true, get: function () { return schemas_js_1.updateServerConfigResponseSchema; } });
29
- Object.defineProperty(exports, "validateServerConfigRequestSchema", { enumerable: true, get: function () { return schemas_js_1.validateServerConfigRequestSchema; } });
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; } });
36
- //# sourceMappingURL=index.js.map