Skip to content

Commit ea7869c

Browse files
Copilothotlong
andcommitted
Initial plan for @objectstack/* upgrade to latest
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 4fb64ba commit ea7869c

1,752 files changed

Lines changed: 550208 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

objectstack-spec-3.0.11.tgz

7.23 MB
Binary file not shown.

package/README.md

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
# @objectstack/spec
2+
3+
[![Try Online](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/objectstack-ai/spec/tree/main/examples/app-todo?file=objectstack.config.ts)
4+
5+
The **Source of Truth** for the ObjectStack Protocol. Contains strictly typed Zod schemas that define every aspect of the system.
6+
7+
## Protocols
8+
9+
- **System**: Manifests, Datasources, APIs.
10+
- **Data**: Objects, Fields, Validation Rules.
11+
- **UI**: Views, Layouts, Dashboards.
12+
- **Automation**: Flows, Workflows, Triggers.
13+
- **AI**: Agents, RAG Pipelines, Models, MCP Servers.
14+
15+
## Usage
16+
17+
**Recommended: Use `ObjectSchema.create()` with `Field.*` helpers for strict TypeScript validation:**
18+
19+
```typescript
20+
import { ObjectSchema, Field } from '@objectstack/spec/data';
21+
22+
// Create a validated object definition with type checking
23+
export const Task = ObjectSchema.create({
24+
name: 'task',
25+
label: 'Task',
26+
icon: 'check-square',
27+
28+
fields: {
29+
title: Field.text({
30+
label: 'Title',
31+
required: true,
32+
maxLength: 200,
33+
}),
34+
35+
status: Field.select({
36+
label: 'Status',
37+
options: [
38+
{ label: 'To Do', value: 'todo', default: true },
39+
{ label: 'In Progress', value: 'in_progress' },
40+
{ label: 'Done', value: 'done' },
41+
],
42+
}),
43+
},
44+
45+
enable: {
46+
trackHistory: true,
47+
apiEnabled: true,
48+
},
49+
});
50+
```
51+
52+
**Alternative: Runtime validation of existing objects:**
53+
54+
```typescript
55+
import { ObjectSchema } from '@objectstack/spec/data';
56+
57+
// Validate a JSON object against the schema
58+
const result = ObjectSchema.parse(myObjectDefinition);
59+
if (result.success) {
60+
console.log('Valid object:', result.data);
61+
}
62+
```
63+
64+
## MCP (Model Context Protocol) Integration
65+
66+
Define MCP servers to connect AI agents to your ObjectStack data and tools:
67+
68+
```typescript
69+
import { MCPServerConfigSchema } from '@objectstack/spec/ai';
70+
71+
// Define an MCP server exposing ObjectStack data
72+
export const objectStackMCP = MCPServerConfigSchema.parse({
73+
name: 'objectstack_mcp',
74+
label: 'ObjectStack MCP Server',
75+
description: 'Connects AI agents to ObjectStack data and workflows',
76+
77+
serverInfo: {
78+
name: 'ObjectStack MCP',
79+
version: '1.0.0',
80+
capabilities: {
81+
resources: true,
82+
resourceTemplates: true,
83+
tools: true,
84+
prompts: true,
85+
},
86+
},
87+
88+
transport: {
89+
type: 'http',
90+
url: 'https://api.objectstack.ai/mcp',
91+
auth: {
92+
type: 'bearer',
93+
secretRef: 'system:mcp_api_key',
94+
},
95+
},
96+
97+
// Expose data as resources
98+
resourceTemplates: [
99+
{
100+
uriPattern: 'objectstack://objects/{objectName}',
101+
name: 'Object Data',
102+
description: 'Access object records',
103+
parameters: [
104+
{
105+
name: 'objectName',
106+
type: 'string',
107+
required: true,
108+
description: 'Name of the object to access',
109+
},
110+
],
111+
handler: 'resources.getObjectData',
112+
},
113+
],
114+
115+
// Expose workflows as tools
116+
tools: [
117+
{
118+
name: 'create_record',
119+
description: 'Create a new record in any object',
120+
parameters: [
121+
{
122+
name: 'object',
123+
type: 'string',
124+
description: 'Object name (e.g., "account", "contact")',
125+
required: true,
126+
},
127+
{
128+
name: 'data',
129+
type: 'object',
130+
description: 'Record data as key-value pairs',
131+
required: true,
132+
},
133+
],
134+
handler: 'flows.create_record',
135+
sideEffects: 'write',
136+
requiresConfirmation: true,
137+
},
138+
{
139+
name: 'search_records',
140+
description: 'Search for records using natural language or filters',
141+
parameters: [
142+
{
143+
name: 'object',
144+
type: 'string',
145+
description: 'Object to search in',
146+
required: true,
147+
},
148+
{
149+
name: 'query',
150+
type: 'string',
151+
description: 'Search query',
152+
required: true,
153+
},
154+
],
155+
handler: 'data.search',
156+
sideEffects: 'read',
157+
},
158+
],
159+
160+
// Provide prompt templates
161+
prompts: [
162+
{
163+
name: 'analyze_customer_data',
164+
description: 'Analyze customer data and generate insights',
165+
messages: [
166+
{
167+
role: 'system',
168+
content: 'You are a data analyst specializing in customer insights.',
169+
},
170+
{
171+
role: 'user',
172+
content: 'Analyze the following customer data and provide insights: {{customer_data}}',
173+
},
174+
],
175+
arguments: [
176+
{
177+
name: 'customer_data',
178+
type: 'string',
179+
required: true,
180+
description: 'Customer data in JSON format',
181+
},
182+
],
183+
},
184+
],
185+
186+
autoStart: true,
187+
healthCheck: {
188+
enabled: true,
189+
interval: 60000,
190+
},
191+
});
192+
```

0 commit comments

Comments
 (0)