Skip to content

Commit c7a08d3

Browse files
Copilothotlong
andcommitted
Add individual protocol documentation pages with detailed introductions
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent bf8c0d3 commit c7a08d3

13 files changed

+2801
-0
lines changed

content/docs/concepts/meta.cn.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@
55
"manifesto",
66
"core-values",
77
"architecture",
8+
{
9+
"title": "协议命名空间",
10+
"pages": [
11+
"protocol-data",
12+
"protocol-driver",
13+
"protocol-permission",
14+
"protocol-ui",
15+
"protocol-system",
16+
"protocol-auth",
17+
"protocol-kernel",
18+
"protocol-hub",
19+
"protocol-ai",
20+
"protocol-api",
21+
"protocol-automation"
22+
]
23+
},
824
"plugin-architecture",
925
"security_architecture",
1026
"enterprise-patterns",

content/docs/concepts/meta.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@
55
"manifesto",
66
"core-values",
77
"architecture",
8+
{
9+
"title": "Protocol Namespaces",
10+
"pages": [
11+
"protocol-data",
12+
"protocol-driver",
13+
"protocol-permission",
14+
"protocol-ui",
15+
"protocol-system",
16+
"protocol-auth",
17+
"protocol-kernel",
18+
"protocol-hub",
19+
"protocol-ai",
20+
"protocol-api",
21+
"protocol-automation"
22+
]
23+
},
824
"plugin-architecture",
925
"security_architecture",
1026
"enterprise-patterns",
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
---
2+
title: AI Protocol
3+
description: AI agents, RAG pipelines, natural language queries, predictive models, and cost tracking.
4+
---
5+
6+
import { Brain, Search, MessageSquare, TrendingUp } from 'lucide-react';
7+
8+
# AI Protocol
9+
10+
The **AI Protocol** integrates artificial intelligence capabilities including AI agents, RAG (Retrieval-Augmented Generation) pipelines, natural language querying, and predictive analytics.
11+
12+
## Overview
13+
14+
<Cards>
15+
<Card
16+
icon={<Brain />}
17+
title="AI Agents"
18+
description="Autonomous agents with tools, knowledge bases, and orchestration."
19+
/>
20+
<Card
21+
icon={<Search />}
22+
title="RAG Pipelines"
23+
description="Vector search, embeddings, and retrieval-augmented generation."
24+
/>
25+
<Card
26+
icon={<MessageSquare />}
27+
title="Natural Language Query"
28+
description="Convert natural language to ObjectQL queries."
29+
/>
30+
<Card
31+
icon={<TrendingUp />}
32+
title="Predictive Models"
33+
description="Train and deploy ML models on your data."
34+
/>
35+
</Cards>
36+
37+
## Key Components
38+
39+
### 1. AI Agent
40+
41+
```typescript
42+
import { AI } from '@objectstack/spec';
43+
44+
const agent: AI.Agent = {
45+
name: 'sales_assistant',
46+
model: {
47+
provider: 'openai',
48+
model: 'gpt-4',
49+
temperature: 0.7
50+
},
51+
tools: [
52+
{
53+
name: 'search_accounts',
54+
description: 'Search for accounts in CRM',
55+
schema: { /* parameters */ }
56+
},
57+
{
58+
name: 'create_opportunity',
59+
description: 'Create a new sales opportunity',
60+
schema: { /* parameters */ }
61+
}
62+
],
63+
knowledge: [
64+
{
65+
type: 'object',
66+
object: 'account',
67+
fields: ['name', 'industry', 'annual_revenue']
68+
},
69+
{
70+
type: 'document',
71+
source: 's3://docs/sales-playbook.pdf'
72+
}
73+
]
74+
};
75+
```
76+
77+
### 2. RAG Pipeline
78+
79+
```typescript
80+
const ragPipeline: AI.RAGPipelineConfig = {
81+
name: 'product_docs_qa',
82+
embeddingModel: {
83+
provider: 'openai',
84+
model: 'text-embedding-3-small'
85+
},
86+
vectorStore: {
87+
provider: 'pinecone',
88+
index: 'product-docs',
89+
dimension: 1536
90+
},
91+
chunkingStrategy: {
92+
type: 'recursive',
93+
chunkSize: 1000,
94+
overlap: 200
95+
},
96+
retrievalStrategy: {
97+
type: 'similarity',
98+
topK: 5,
99+
threshold: 0.7
100+
}
101+
};
102+
```
103+
104+
### 3. Natural Language Query
105+
106+
```typescript
107+
const nlqRequest: AI.NLQRequest = {
108+
query: "Show me all accounts in California with revenue over $1M",
109+
context: {
110+
object: 'account',
111+
userId: 'user_123'
112+
}
113+
};
114+
115+
const nlqResponse: AI.NLQResponse = {
116+
parsedQuery: {
117+
object: 'account',
118+
filters: [
119+
{ field: 'billing_state', operator: 'equals', value: 'CA' },
120+
{ field: 'annual_revenue', operator: 'greaterThan', value: 1000000 }
121+
]
122+
},
123+
confidence: 0.95,
124+
results: [/* ... */]
125+
};
126+
```
127+
128+
### 4. Predictive Model
129+
130+
```typescript
131+
const model: AI.PredictiveModel = {
132+
name: 'churn_prediction',
133+
type: 'classification',
134+
features: [
135+
{ field: 'account.last_activity_days', type: 'numeric' },
136+
{ field: 'account.support_tickets_count', type: 'numeric' },
137+
{ field: 'account.contract_renewal_date', type: 'date' }
138+
],
139+
trainingConfig: {
140+
algorithm: 'random_forest',
141+
testSize: 0.2,
142+
hyperparameters: {
143+
n_estimators: 100,
144+
max_depth: 10
145+
}
146+
}
147+
};
148+
```
149+
150+
## Learn More
151+
152+
- [Agent Reference](/docs/references/ai/agent/Agent)
153+
- [RAG Pipeline](/docs/references/ai/rag-pipeline/RAGPipelineConfig)
154+
- [NLQ Configuration](/docs/references/ai/nlq/NLQRequest)
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
---
2+
title: API Protocol
3+
description: REST contracts, API discovery, realtime subscriptions, and routing configuration.
4+
---
5+
6+
import { Wifi, Code, Zap, Map } from 'lucide-react';
7+
8+
# API Protocol
9+
10+
The **API Protocol** defines external communication interfaces including REST contracts, API discovery, realtime subscriptions via WebSocket/SSE, and routing configuration.
11+
12+
## Overview
13+
14+
<Cards>
15+
<Card
16+
icon={<Code />}
17+
title="REST Contracts"
18+
description="Standard request/response envelopes for CRUD operations."
19+
/>
20+
<Card
21+
icon={<Map />}
22+
title="API Discovery"
23+
description="Self-documenting APIs with metadata introspection."
24+
/>
25+
<Card
26+
icon={<Wifi />}
27+
title="Realtime Subscriptions"
28+
description="WebSocket and Server-Sent Events for live updates."
29+
/>
30+
<Card
31+
icon={<Zap />}
32+
title="Routing & Rate Limiting"
33+
description="Route definitions and API throttling."
34+
/>
35+
</Cards>
36+
37+
## Key Components
38+
39+
### 1. REST Contracts
40+
41+
```typescript
42+
import { API } from '@objectstack/spec';
43+
44+
const createRequest: API.CreateRequest = {
45+
object: 'account',
46+
data: {
47+
name: 'Acme Corp',
48+
industry: 'Technology',
49+
annual_revenue: 5000000
50+
}
51+
};
52+
53+
const response: API.SingleRecordResponse = {
54+
success: true,
55+
data: {
56+
id: 'acc_123',
57+
name: 'Acme Corp',
58+
industry: 'Technology',
59+
annual_revenue: 5000000,
60+
created_at: '2024-01-15T10:30:00Z'
61+
}
62+
};
63+
64+
const listResponse: API.ListRecordResponse = {
65+
success: true,
66+
data: [/* records */],
67+
pagination: {
68+
page: 1,
69+
perPage: 25,
70+
total: 150
71+
}
72+
};
73+
```
74+
75+
### 2. API Discovery
76+
77+
```typescript
78+
const discovery: API.Discovery = {
79+
objects: [
80+
{
81+
name: 'account',
82+
label: 'Account',
83+
endpoints: {
84+
list: 'GET /api/data/account',
85+
create: 'POST /api/data/account',
86+
get: 'GET /api/data/account/:id',
87+
update: 'PATCH /api/data/account/:id',
88+
delete: 'DELETE /api/data/account/:id'
89+
}
90+
}
91+
],
92+
capabilities: {
93+
bulkOperations: true,
94+
graphql: true,
95+
webhooks: true,
96+
realtime: true
97+
}
98+
};
99+
```
100+
101+
### 3. Realtime Subscriptions
102+
103+
```typescript
104+
const subscription: API.Subscription = {
105+
channel: 'account.created',
106+
filters: {
107+
field: 'industry',
108+
operator: 'equals',
109+
value: 'Technology'
110+
},
111+
protocol: 'websocket' // websocket | sse
112+
};
113+
114+
const realtimeEvent: API.RealtimeEvent = {
115+
type: 'record.created',
116+
object: 'account',
117+
recordId: 'acc_123',
118+
data: {/* record data */},
119+
timestamp: '2024-01-15T10:30:00Z'
120+
};
121+
```
122+
123+
### 4. Routing
124+
125+
```typescript
126+
const route: API.RouteDefinition = {
127+
path: '/api/custom/convert-lead',
128+
method: 'POST',
129+
category: 'custom',
130+
rateLimit: {
131+
windowMs: 60000, // 1 minute
132+
maxRequests: 10
133+
},
134+
authentication: 'required'
135+
};
136+
```
137+
138+
## Learn More
139+
140+
- [API Contract Reference](/docs/references/api/contract/BaseResponse)
141+
- [Discovery Reference](/docs/references/api/discovery/Discovery)
142+
- [Realtime Events](/docs/references/api/realtime/RealtimeEvent)

0 commit comments

Comments
 (0)