Context
Context protocol schemas
Runtime Mode Enum
Defines the operating mode of the kernel
Source: packages/spec/src/kernel/context.zod.ts
TypeScript Usage
import { KernelContext, PreviewModeConfig, RuntimeMode, TenantRuntimeContext } from '@objectstack/spec/kernel';
import type { KernelContext, PreviewModeConfig, RuntimeMode, TenantRuntimeContext } from '@objectstack/spec/kernel';
// Validate data
const result = KernelContext.parse(data);KernelContext
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| instanceId | string | ✅ | Unique UUID for this running kernel process |
| mode | Enum<'development' | 'production' | 'test' | 'provisioning' | 'preview'> | ✅ | Kernel operating mode |
| version | string | ✅ | Kernel version |
| appName | string | optional | Host application name |
| cwd | string | ✅ | Current working directory |
| workspaceRoot | string | optional | Workspace root if different from cwd |
| startTime | integer | ✅ | Boot timestamp (ms) |
| features | Record<string, boolean> | ✅ | Global feature toggles |
| previewMode | Object | optional | Preview/demo mode configuration (used when mode is "preview") |
PreviewModeConfig
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| autoLogin | boolean | ✅ | Auto-login as simulated user, skipping login/registration pages |
| simulatedRole | Enum<'admin' | 'user' | 'viewer'> | ✅ | Permission role for the simulated preview user |
| simulatedUserName | string | ✅ | Display name for the simulated preview user |
| readOnly | boolean | ✅ | Restrict the preview session to read-only operations |
| expiresInSeconds | integer | ✅ | Preview session duration in seconds (0 = no expiration) |
| bannerMessage | string | optional | Banner message displayed in the UI during preview mode |
RuntimeMode
Kernel operating mode
Allowed Values
developmentproductiontestprovisioningpreview
TenantRuntimeContext
Tenant-aware kernel runtime context
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| instanceId | string | ✅ | Unique UUID for this running kernel process |
| mode | Enum<'development' | 'production' | 'test' | 'provisioning' | 'preview'> | ✅ | Kernel operating mode |
| version | string | ✅ | Kernel version |
| appName | string | optional | Host application name |
| cwd | string | ✅ | Current working directory |
| workspaceRoot | string | optional | Workspace root if different from cwd |
| startTime | integer | ✅ | Boot timestamp (ms) |
| features | Record<string, boolean> | ✅ | Global feature toggles |
| previewMode | Object | optional | Preview/demo mode configuration (used when mode is "preview") |
| tenantId | string | ✅ | Resolved tenant identifier |
| tenantPlan | Enum<'free' | 'pro' | 'enterprise'> | ✅ | Tenant subscription plan |
| tenantRegion | string | optional | Tenant deployment region |
| tenantDbUrl | string | ✅ | Tenant database connection URL |
| tenantQuotas | Object | optional | Tenant resource quotas |