ObjectStackObjectStack

Context schema — Kernel Protocol reference

Context schemas of the ObjectStack Kernel Protocol: KernelContext, RuntimeMode and 1 more — each property with its type, default and a TypeScript example.

Source: packages/spec/src/kernel/context.zod.ts

TypeScript Usage

import { KernelContextSchema, RuntimeMode, TenantRuntimeContextSchema } from '@objectstack/spec/kernel';
import type { KernelContext, RuntimeMode, TenantRuntimeContext } from '@objectstack/spec/kernel';

// Validate data
const result = KernelContextSchema.parse(data);

KernelContext

Properties

PropertyTypeRequiredDescription
instanceIdstring✅Unique UUID for this running kernel process
modeEnum<'development' | 'production' | 'test' | 'provisioning'>optional (default: "production")Kernel operating mode
versionstring✅Kernel version
appNamestringoptionalHost application name
cwdstring✅Current working directory
workspaceRootstringoptionalWorkspace root if different from cwd
startedAtinteger✅Boot timestamp — Unix milliseconds
featuresRecord<string, boolean>optional (default: {})Global feature toggles
previewModeneveroptional[REMOVED] context.previewMode was removed in @objectstack/spec 17 (ADR-0049 enforce-or-remove) — nothing ever read the block: none of its six keys (autoLogin, simulatedRole, simulatedUserName, readOnly, expiresInSeconds, bannerMessage) had a consumer in any repo, so an authored block parsed cleanly and configured NOTHING, while its own docstring promised an auth bypass ("skips authentication screens", "simulates an admin identity") and named a production guard no runtime ever received. Delete the key. Preview/demo deployments belong to the deployment layer, which owns auth per-project (ArtifactKernelFactory in the cloud distribution); OS_PREVIEW_MODE stays there as a routing-only switch. If a preview experience becomes a product capability it re-declares fresh, with the production-posture hard-refusal as the first-landed half (ruling record).
startTimeneveroptional[REMOVED] context.startTime was renamed to context.startedAt in @objectstack/spec 17 — the boot INSTANT now carries the shared EpochMs schema, which declares the epoch-millisecond unit the key name used to leave to the describe prose. Rename the key to startedAt; the value is unchanged (Date.now()). *At rather than startTimeMs deliberately: every *Ms key in this package is a DURATION, so spelling an instant that way would move it into the family the rule exists to separate it from.

RuntimeMode

Kernel operating mode

Allowed Values

  • development
  • production
  • test
  • provisioning

TenantRuntimeContext

Tenant-aware kernel runtime context

Properties

PropertyTypeRequiredDescription
instanceIdstring✅Unique UUID for this running kernel process
modeEnum<'development' | 'production' | 'test' | 'provisioning'>optional (default: "production")Kernel operating mode
versionstring✅Kernel version
appNamestringoptionalHost application name
cwdstring✅Current working directory
workspaceRootstringoptionalWorkspace root if different from cwd
startedAtinteger✅Boot timestamp — Unix milliseconds
featuresRecord<string, boolean>optional (default: {})Global feature toggles
previewModeneveroptional[REMOVED] context.previewMode was removed in @objectstack/spec 17 (ADR-0049 enforce-or-remove) — nothing ever read the block: none of its six keys (autoLogin, simulatedRole, simulatedUserName, readOnly, expiresInSeconds, bannerMessage) had a consumer in any repo, so an authored block parsed cleanly and configured NOTHING, while its own docstring promised an auth bypass ("skips authentication screens", "simulates an admin identity") and named a production guard no runtime ever received. Delete the key. Preview/demo deployments belong to the deployment layer, which owns auth per-project (ArtifactKernelFactory in the cloud distribution); OS_PREVIEW_MODE stays there as a routing-only switch. If a preview experience becomes a product capability it re-declares fresh, with the production-posture hard-refusal as the first-landed half (ruling record).
startTimeneveroptional[REMOVED] context.startTime was renamed to context.startedAt in @objectstack/spec 17 — the boot INSTANT now carries the shared EpochMs schema, which declares the epoch-millisecond unit the key name used to leave to the describe prose. Rename the key to startedAt; the value is unchanged (Date.now()). *At rather than startTimeMs deliberately: every *Ms key in this package is a DURATION, so spelling an instant that way would move it into the family the rule exists to separate it from.
tenantIdstring✅Resolved tenant identifier
tenantPlanEnum<'free' | 'pro' | 'enterprise'>✅Tenant subscription plan
tenantRegionstringoptionalTenant deployment region
tenantDbUrlstring✅Tenant database connection URL
tenantQuotas{ maxUsers?: integer; maxStorage?: integer; apiRateLimit?: integer; maxObjects?: integer; … }optionalTenant resource quotas

Nested Shape: TenantRuntimeContext.tenantQuotas

PropertyTypeRequiredDescription
maxUsersintegeroptionalMaximum number of users
maxStorageintegeroptionalMaximum storage in bytes
apiRateLimitintegeroptionalAPI requests per minute
maxObjectsintegeroptionalMaximum number of custom objects
maxRecordsPerObjectintegeroptionalMaximum records per object
maxDeploymentsPerDayintegeroptionalMaximum deployments per day
maxStorageBytesintegeroptionalMaximum storage in bytes

On this page