ObjectStackObjectStack

Context

Context protocol schemas

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
instanceIdstringUnique UUID for this running kernel process
modeEnum<'development' | 'production' | 'test' | 'provisioning'>optional (default: "production")Kernel operating mode
versionstringKernel version
appNamestringoptionalHost application name
cwdstringCurrent working directory
workspaceRootstringoptionalWorkspace root if different from cwd
startTimeintegerBoot timestamp (ms)
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).

RuntimeMode

Kernel operating mode

Allowed Values

  • development
  • production
  • test
  • provisioning

TenantRuntimeContext

Tenant-aware kernel runtime context

Properties

PropertyTypeRequiredDescription
instanceIdstringUnique UUID for this running kernel process
modeEnum<'development' | 'production' | 'test' | 'provisioning'>optional (default: "production")Kernel operating mode
versionstringKernel version
appNamestringoptionalHost application name
cwdstringCurrent working directory
workspaceRootstringoptionalWorkspace root if different from cwd
startTimeintegerBoot timestamp (ms)
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).
tenantIdstringResolved tenant identifier
tenantPlanEnum<'free' | 'pro' | 'enterprise'>Tenant subscription plan
tenantRegionstringoptionalTenant deployment region
tenantDbUrlstringTenant 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