-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcontext.zod.ts
More file actions
50 lines (42 loc) · 1.33 KB
/
context.zod.ts
File metadata and controls
50 lines (42 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { z } from 'zod';
/**
* Runtime Mode Enum
* Defines the operating mode of the kernel
*/
export const RuntimeMode = z.enum([
'development', // Hot-reload, verbose logging
'production', // Optimized, strict security
'test', // Mocked interfaces
'provisioning' // Setup/Migration mode
]).describe('Kernel operating mode');
export type RuntimeMode = z.infer<typeof RuntimeMode>;
/**
* Kernel Context Schema
* Defines the static environment information available to the Kernel at boot.
*/
export const KernelContextSchema = z.object({
/**
* Instance Identity
*/
instanceId: z.string().uuid().describe('Unique UUID for this running kernel process'),
/**
* Environment Metadata
*/
mode: RuntimeMode.default('production'),
version: z.string().describe('Kernel version'),
appName: z.string().optional().describe('Host application name'),
/**
* Paths
*/
cwd: z.string().describe('Current working directory'),
workspaceRoot: z.string().optional().describe('Workspace root if different from cwd'),
/**
* Telemetry
*/
startTime: z.number().int().describe('Boot timestamp (ms)'),
/**
* Feature Flags (Global)
*/
features: z.record(z.string(), z.boolean()).default({}).describe('Global feature toggles')
});
export type KernelContext = z.infer<typeof KernelContextSchema>;