Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
426 changes: 426 additions & 0 deletions content/docs/guides/metadata-extensions.mdx

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions content/docs/references/ai/field-extensions/AIFieldExtension.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
title: AIFieldExtension
description: AIFieldExtension Schema Reference
---

## Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **ai_assistant.vectorIndexed** | `boolean` | optional | |
| **ai_assistant.embeddingModel** | `string` | optional | |
| **ai_assistant.chunkSize** | `number` | optional | |
| **ai_assistant.chunkOverlap** | `number` | optional | |
| **ai_assistant.autoSummarize** | `boolean` | optional | |
| **ai_assistant.summaryModel** | `string` | optional | |
| **ai_assistant.summaryMaxLength** | `number` | optional | |
| **ai_assistant.sentimentAnalysis** | `boolean` | optional | |
| **ai_assistant.sentimentField** | `string` | optional | |
3 changes: 3 additions & 0 deletions content/docs/references/ai/field-extensions/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"title": "Field Extensions"
}
2 changes: 2 additions & 0 deletions content/docs/references/ai/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
"agent",
"conversation",
"cost",
"field-extensions",
"model-registry",
"nlq",
"object-extensions",
"orchestration",
"predictive",
"rag-pipeline"
Expand Down
24 changes: 24 additions & 0 deletions content/docs/references/ai/object-extensions/AIObjectExtension.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: AIObjectExtension
description: AIObjectExtension Schema Reference
---

## Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **ai_assistant.enableRAG** | `boolean` | optional | |
| **ai_assistant.contextFields** | `string[]` | optional | |
| **ai_assistant.vectorIndex** | `string` | optional | |
| **ai_assistant.embeddingModel** | `string` | optional | |
| **ai_assistant.agentEnabled** | `boolean` | optional | |
| **ai_assistant.agentName** | `string` | optional | |
| **ai_assistant.agentTriggers** | `string[]` | optional | |
| **ai_assistant.predictiveEnabled** | `boolean` | optional | |
| **ai_assistant.predictiveModels** | `any[]` | optional | |
| **ai_assistant.autoClassification** | `boolean` | optional | |
| **ai_assistant.classificationField** | `string` | optional | |
| **ai_assistant.classificationModel** | `string` | optional | |
| **ai_assistant.classificationPrompt** | `string` | optional | |
| **ai_assistant.dataQualityEnabled** | `boolean` | optional | |
| **ai_assistant.dataQualityRules** | `any[]` | optional | |
3 changes: 3 additions & 0 deletions content/docs/references/ai/object-extensions/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"title": "Object Extensions"
}
1 change: 1 addition & 0 deletions content/docs/references/data/field/Field.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@ description: Field Schema Reference
| **encryption** | `boolean` | optional | Encrypt at rest |
| **index** | `boolean` | optional | Create standard database index |
| **externalId** | `boolean` | optional | Is external ID for upsert operations |
| **extensions** | `Record<string, string \| number \| boolean \| null \| string \| number \| boolean \| null \| any[] \| Record<string, any>[] \| Record<string, string \| number \| boolean \| null \| any[] \| Record<string, any>>>` | optional | Custom extension properties from plugins and modules |
1 change: 1 addition & 0 deletions content/docs/references/data/object/Object.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ description: Object Schema Reference
| **compactLayout** | `string[]` | optional | Primary fields for hover/cards/lookups |
| **search** | `object` | optional | Search engine configuration |
| **enable** | `object` | optional | Enabled system features modules |
| **extensions** | `Record<string, string \| number \| boolean \| null \| string \| number \| boolean \| null \| any[] \| Record<string, any>[] \| Record<string, string \| number \| boolean \| null \| any[] \| Record<string, any>>>` | optional | Custom extension properties from plugins and modules |
19 changes: 19 additions & 0 deletions content/docs/references/system/extension/ExtensionDefinition.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: ExtensionDefinition
description: ExtensionDefinition Schema Reference
---

## Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **key** | `string` | ✅ | Fully qualified extension key (e.g., "ai_assistant.vectorIndexed") |
| **pluginId** | `string` | ✅ | ID of the plugin providing this extension |
| **label** | `string` | ✅ | Display label for the extension property |
| **description** | `string` | optional | Detailed description of the extension |
| **type** | `Enum<'string' \| 'number' \| 'boolean' \| 'object' \| 'array' \| 'any'>` | ✅ | Expected data type for this extension |
| **default** | `any` | optional | Default value for this extension |
| **appliesTo** | `Enum<'object' \| 'field' \| 'view' \| 'app' \| 'dashboard' \| 'report' \| 'action' \| 'workflow'>[]` | ✅ | Metadata types this extension can be applied to |
| **fieldTypes** | `string[]` | optional | Applicable field types (for field extensions) |
| **required** | `boolean` | optional | Whether this extension is required |
| **schema** | `any` | optional | JSON Schema for advanced validation |
10 changes: 10 additions & 0 deletions content/docs/references/system/extension/ExtensionRegistry.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: ExtensionRegistry
description: ExtensionRegistry Schema Reference
---

## Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **extensions** | `Record<string, object>` | ✅ | Registry of available extension definitions |
5 changes: 5 additions & 0 deletions content/docs/references/system/extension/ExtensionValue.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: ExtensionValue
description: ExtensionValue Schema Reference
---

7 changes: 7 additions & 0 deletions content/docs/references/system/extension/ExtensionsMap.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: ExtensionsMap
description: Custom extension properties from plugins and modules
---

Custom extension properties from plugins and modules

3 changes: 3 additions & 0 deletions content/docs/references/system/extension/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"title": "Extension"
}
1 change: 1 addition & 0 deletions content/docs/references/system/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"pages": [
"audit",
"events",
"extension",
"job",
"translation"
]
Expand Down
33 changes: 33 additions & 0 deletions examples/ai-customer-service/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# AI-Powered Customer Service Example

This example demonstrates how to use ObjectStack's metadata extension mechanism to build an AI-powered customer service system.

## Features

### Field-Level AI Extensions
- **Vector Indexing**: Enable semantic search on text fields
- **Auto-Summarization**: Automatically generate summaries of long descriptions
- **Sentiment Analysis**: Analyze sentiment of customer feedback

### Object-Level AI Extensions
- **RAG (Retrieval-Augmented Generation)**: Enable context-aware AI responses
- **AI Agent Integration**: Automatic agent assistance on create/update
- **Auto-Classification**: Automatically categorize inquiries
- **Data Quality Checks**: AI-powered data validation

## Objects

1. **Customer Inquiry** - Support tickets with full AI assistance
2. **Knowledge Article** - RAG-enabled knowledge base

## Running the Example

```bash
cd examples/ai-customer-service
npm install
npm run example
Comment on lines +25 to +28

Copilot AI Jan 27, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The run instructions assume npm install / npm run example inside examples/ai-customer-service, but this folder currently has no package.json, so these steps won’t work. Either add a minimal package.json/script for the example or update the README to match the actual way examples are executed in this repo (e.g. via the monorepo root).

Suggested change
```bash
cd examples/ai-customer-service
npm install
npm run example
This example is part of the ObjectStack monorepo and is intended to be run via the repository root, not directly from this folder.
From the repository root, follow the instructions in the main README for running examples (look for the section on running the `ai-customer-service` example). A typical flow might look like:
```bash
# from the repository root
npm install
npm run example:ai-customer-service

Copilot uses AI. Check for mistakes.
```

## Usage

See `index.ts` for the complete implementation.
44 changes: 44 additions & 0 deletions examples/ai-customer-service/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* AI-Powered Customer Service Example
*
* Demonstrates ObjectStack metadata extensions for AI capabilities
*/

import { ObjectSchema, Extension } from '@objectstack/spec';

Copilot AI Jan 27, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example imports ObjectSchema and Extension from @objectstack/spec, but the package root entrypoint currently only exports namespaces (e.g. Data, System). Use namespace imports (import { Data, System } from '@objectstack/spec') or subpath imports (@objectstack/spec/data, @objectstack/spec/system) so the example can actually run.

Copilot uses AI. Check for mistakes.

// Customer Inquiry Object with AI extensions
export const customerInquiryObject = {
name: 'customer_inquiry',
label: 'Customer Inquiry',
fields: {
title: {
name: 'title',
label: 'Title',
type: 'text' as const,
required: true,
extensions: {
'ai_assistant.vectorIndexed': true,
'ai_assistant.embeddingModel': 'text-embedding-3-small',
},
},
description: {
name: 'description',
label: 'Description',
type: 'textarea' as const,
extensions: {
'ai_assistant.vectorIndexed': true,
'ai_assistant.autoSummarize': true,
},
},
},
extensions: {
'ai_assistant.enableRAG': true,
'ai_assistant.contextFields': ['title', 'description'],
'ai_assistant.agentEnabled': true,
},
};

// Validate
const validated = ObjectSchema.parse(customerInquiryObject);
console.log('✓ Schema validated with AI extensions');
console.log('RAG Enabled:', Extension.get(validated.extensions, 'ai_assistant.enableRAG'));
39 changes: 39 additions & 0 deletions packages/spec/json-schema/ai/AIFieldExtension.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"$ref": "#/definitions/AIFieldExtension",
"definitions": {
"AIFieldExtension": {
"type": "object",
"properties": {
"ai_assistant.vectorIndexed": {
"type": "boolean"
},
"ai_assistant.embeddingModel": {
"type": "string"
},
"ai_assistant.chunkSize": {
"type": "number"
},
"ai_assistant.chunkOverlap": {
"type": "number"
},
"ai_assistant.autoSummarize": {
"type": "boolean"
},
"ai_assistant.summaryModel": {
"type": "string"
},
"ai_assistant.summaryMaxLength": {
"type": "number"
},
"ai_assistant.sentimentAnalysis": {
"type": "boolean"
},
"ai_assistant.sentimentField": {
"type": "string"
}
},
"additionalProperties": false
}
},
"$schema": "http://json-schema.org/draft-07/schema#"
}
63 changes: 63 additions & 0 deletions packages/spec/json-schema/ai/AIObjectExtension.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"$ref": "#/definitions/AIObjectExtension",
"definitions": {
"AIObjectExtension": {
"type": "object",
"properties": {
"ai_assistant.enableRAG": {
"type": "boolean"
},
"ai_assistant.contextFields": {
"type": "array",
"items": {
"type": "string"
}
},
"ai_assistant.vectorIndex": {
"type": "string"
},
"ai_assistant.embeddingModel": {
"type": "string"
},
"ai_assistant.agentEnabled": {
"type": "boolean"
},
"ai_assistant.agentName": {
"type": "string"
},
"ai_assistant.agentTriggers": {
"type": "array",
"items": {
"type": "string"
}
},
"ai_assistant.predictiveEnabled": {
"type": "boolean"
},
"ai_assistant.predictiveModels": {
"type": "array"
},
"ai_assistant.autoClassification": {
"type": "boolean"
},
"ai_assistant.classificationField": {
"type": "string"
},
"ai_assistant.classificationModel": {
"type": "string"
},
"ai_assistant.classificationPrompt": {
"type": "string"
},
"ai_assistant.dataQualityEnabled": {
"type": "boolean"
},
"ai_assistant.dataQualityRules": {
"type": "array"
}
},
"additionalProperties": false
}
},
"$schema": "http://json-schema.org/draft-07/schema#"
}
75 changes: 75 additions & 0 deletions packages/spec/json-schema/data/Field.json
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,81 @@
"type": "boolean",
"default": false,
"description": "Is external ID for upsert operations"
},
"extensions": {
"type": "object",
"additionalProperties": {
"anyOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"type": "null"
},
{
"type": "array",
"items": {
"anyOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"type": "null"
},
{
"type": "array",
"items": {}
},
{
"type": "object",
"additionalProperties": {}
}
]
}
},
{
"type": "object",
"additionalProperties": {
"anyOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"type": "null"
},
{
"type": "array",
"items": {}
},
{
"type": "object",
"additionalProperties": {}
}
]
}
}
],
"description": "Extension value (string, number, boolean, object, or array)"
},
"description": "Custom extension properties from plugins and modules"
}
},
"required": [
Expand Down
Loading
Loading