---
title: Context
description: Context protocol schemas
---

{/* ⚠️  AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs go in content/docs/guides/. */}

Runtime Mode Enum

Defines the operating mode of the kernel

<Callout type="info">
**Source:** `packages/spec/src/kernel/context.zod.ts`
</Callout>

## TypeScript Usage

```typescript
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

* `development`
* `production`
* `test`
* `provisioning`
* `preview`


---

## 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 |


---

