ObjectStackObjectStack

Ai Context schema — AI Protocol reference

Ai Context schemas of the ObjectStack AI Protocol: AiContext, AiContextBody, AiContextRelated — each property with its type, default and a TypeScript example.

Source: packages/spec/src/ai/ai-context.zod.ts

TypeScript Usage

import { AiContextSchema, AiContextBodySchema, AiContextRelatedSchema } from '@objectstack/spec/ai';
import type { AiContext, AiContextBody, AiContextRelated } from '@objectstack/spec/ai';

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

AiContext

Properties

PropertyTypeRequiredDescription
namestring✅Pack machine name (snake_case) — what get_record_context's context argument and a skill's context key name
labelstring✅Pack display name — the header of the tool answer
objectstring✅The root object: a pack reads one record of it
fieldsstring[]optionalThe root object's fields handed to the model, in order (at most 30). A lookup among them is answered with the name of the record it points at
related{ object: string; field?: string; fields?: string[] }[]optionalChild lists that point at the record (at most 3), one level deep
body{ field: string }optionalThe one long-text field read as the record's body
_lockEnum<'none' | 'no-overlay' | 'no-delete' | 'full'>optionalItem-level lock — controls overlay & delete (ADR-0010).
_lockReasonstringoptionalHuman-readable reason shown when a write is refused by _lock.
_lockSourceEnum<'artifact' | 'package' | 'env-forced'>optionalLayer that set _lock (artifact | package | env-forced).
_provenanceEnum<'package' | 'org' | 'env-forced' | 'platform'>optionalOrigin of the item (package | org | env-forced | platform).
_packageIdstringoptionalOwning package machine id.
_packageVersionstringoptionalOwning package version.
_lockDocsUrlstringoptionalOptional documentation link surfaced next to _lockReason.

Nested Shape: AiContext.related[number]

PropertyTypeRequiredDescription
objectstring✅A child object with a reference field (lookup, master-detail, user or tree) that points at the pack's root object
fieldstringoptionalThe child's reference field that points at the root. Required when the child has several such fields; with one, it may be omitted. Resolved once, on the published definition
fieldsstring[]optionalThe columns read for each row, in order (at most 10). A lookup among them is answered with the name of the record it points at. Omit to read the row's name only

Nested Shape: AiContext.body

PropertyTypeRequiredDescription
fieldstring✅A long-text field of the root object (textarea, markdown, html, richtext). A body past the render service's bound is carried as an outline of its headings, each section read by its anchor

AiContextBody

Properties

PropertyTypeRequiredDescription
fieldstring✅A long-text field of the root object (textarea, markdown, html, richtext). A body past the render service's bound is carried as an outline of its headings, each section read by its anchor

AiContextRelated

Properties

PropertyTypeRequiredDescription
objectstring✅A child object with a reference field (lookup, master-detail, user or tree) that points at the pack's root object
fieldstringoptionalThe child's reference field that points at the root. Required when the child has several such fields; with one, it may be omitted. Resolved once, on the published definition
fieldsstring[]optionalThe columns read for each row, in order (at most 10). A lookup among them is answered with the name of the record it points at. Omit to read the row's name only

On this page