| title | Execution Context |
|---|---|
| description | Execution Context protocol schemas |
{/*
Execution Context Schema
Defines the runtime context that flows from HTTP request → data operations.
This is the "identity + environment" envelope that every data operation can carry.
Design:
-
All fields are optional for backward compatibility
-
isSystembypasses permission checks (for internal/migration operations) -
transactioncarries the database transaction handle for atomicity -
traceIdenables distributed tracing across microservices
Usage:
engine.find('account', { context: { userId: '...', tenantId: '...' } })
**Source:** `packages/spec/src/kernel/execution-context.zod.ts`import { ExecutionContext } from '@objectstack/spec/kernel';
import type { ExecutionContext } from '@objectstack/spec/kernel';
// Validate data
const result = ExecutionContext.parse(data);| Property | Type | Required | Description |
|---|---|---|---|
| userId | string |
optional | |
| actor | string |
optional | |
string |
optional | ||
| tenantId | string |
optional | |
| timezone | string |
optional | |
| locale | string |
optional | |
| currency | string |
optional | |
| positions | string[] |
✅ | |
| principalKind | Enum<'human' | 'agent' | 'service' | 'guest' | 'system'> |
optional | |
| audience | Enum<'internal' | 'external'> |
optional | |
| posture | Enum<'PLATFORM_ADMIN' | 'TENANT_ADMIN' | 'MEMBER' | 'EXTERNAL'> |
optional | ADR-0095 D2 posture rung — PLATFORM_ADMIN crosses the tenant wall where object posture permits; TENANT_ADMIN sees all rows in the org; MEMBER gets business RLS; EXTERNAL sees only explicitly shared rows. |
| onBehalfOf | { userId: string; principalKind?: Enum<'human' | 'agent' | 'service' | 'guest' | 'system'> } |
optional | |
| permissions | string[] |
✅ | |
| systemPermissions | string[] |
optional | |
| tabPermissions | Record<string, Enum<'visible' | 'hidden' | 'default_on' | 'default_off'>> |
optional | |
| org_user_ids | string[] |
optional | |
| rlsMembership | Record<string, string[]> |
optional | |
| isSystem | boolean |
✅ | |
| skipTriggers | boolean |
optional | |
| skipAutomations | boolean |
optional | |
| seedReplay | boolean |
optional | |
| oauthScopes | string[] |
optional | |
| accessToken | string |
optional | |
| transaction | any |
optional | |
| traceId | string |
optional |