oneie 2.0.3 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +220 -29
- package/LICENSE.md +84 -0
- package/README.md +489 -931
- package/folders.yaml +78 -17
- package/one/.obsidian/workspace.json +6 -6
- package/one/events/CASCADE-2-BACKEND-AGNOSTIC.md +412 -0
- package/one/events/FEATURE-2-4-COMPLETE.md +302 -0
- package/one/events/FEATURE_2_3_COMPLETE.md +575 -0
- package/one/events/GROUPS-MIGRATION.md +625 -0
- package/one/events/INSTALL-TESTS.md +293 -0
- package/one/events/INTEGRATION-ARCHITECTURE.md +561 -0
- package/one/events/INTEGRATION-CHECKLIST.md +1234 -0
- package/one/events/INTEGRATION-ORCHESTRATION.md +2623 -0
- package/one/events/INTEGRATION-SUMMARY.md +653 -0
- package/one/events/MIGRATION-REPORT.md +435 -0
- package/one/events/MIGRATION.md +69 -0
- package/one/events/README-archived.md +519 -0
- package/one/events/TEST-SUMMARY.md +393 -0
- package/one/events/TESTS-QUICK-REF.md +262 -0
- package/one/groups/groups.md +543 -0
- package/one/knowledge/CLOUDFLARE_ENV_SETUP.md +49 -0
- package/one/knowledge/architecture-any-backend.md +1366 -0
- package/one/knowledge/docs/flow.md +0 -0
- package/one/knowledge/ontology-documentation.md +18 -18
- package/one/knowledge/ontology.md +154 -143
- package/one/knowledge/ontology.md.backup +2822 -0
- package/one/knowledge/ontology.yaml +87 -87
- package/one/knowledge/provider-creation-guide.md +1064 -0
- package/one/knowledge/todo.md +251 -0
- package/one/license.md +84 -0
- package/one/things/CHECKLIST.md +356 -0
- package/one/things/ONE.md +510 -0
- package/one/things/{cli.md → cli/cli.md} +27 -4
- package/one/things/features/2-1-dataprovider-interface.md +2358 -0
- package/one/things/features/2-2-config-system.md +3075 -0
- package/one/things/features/2-3-effectts-services.md +1498 -0
- package/one/things/features/2-4-react-hooks.md +2120 -0
- package/one/things/features/2-5-auth-migration.md +2046 -0
- package/one/things/features/2-6-dashboard-migration.md +1985 -0
- package/one/things/features/2-7-alternative-providers.md +2505 -0
- package/one/things/features/2-7-implementation-report.md +680 -0
- package/one/things/features/2-cli.md +39 -39
- package/one/things/features/2-design.md +1738 -0
- package/one/things/features/2-tests.md +520 -0
- package/one/things/features/AUTH_HOOKS_IMPLEMENTATION.md +521 -0
- package/one/things/features/DECOUPLING.md +272 -0
- package/one/things/features/DEPLOYMENT.md +452 -0
- package/one/things/features/IMPLEMENTATION_SUMMARY.md +316 -0
- package/one/things/features/dataprovider-interface/1-tests.md +1522 -0
- package/one/things/features/improve.md +843 -0
- package/one/things/features/remove-convex-deps.md +45 -0
- package/one/things/features/top-features.md +79 -0
- package/one/things/ideas/2-backend-agnostic-frontend.md +384 -0
- package/one/things/plans/2-backend-agnostic-frontend.md +543 -0
- package/one/things/plans/3-groups.md +502 -0
- package/one/things/plans/backend-agnostic-frontend.md +323 -0
- package/one/things/plans/deploy-to-cloudflare.md +581 -0
- package/one/things/plans/organizations-to-groups.md +705 -0
- package/one/things/plans/release.md +432 -0
- package/one/things/products/ontology.md +1 -1
- package/one/things/system.md +600 -0
- package/one/things/tests/2-1-dataprovider-interface.md +1144 -0
- package/one/things/tests/2-1-test-analysis.md +496 -0
- package/one/things/vision/elegant-interface.md +214 -0
- package/package.json +1 -1
- package/one/organisation/organisation.md +0 -438
- package/one/repomix-output.md +0 -92634
- /package/one/{things → connections}/agentkit.md +0 -0
- /package/one/{things → connections}/copilotkit.md +0 -0
- /package/one/{organisation → groups}/one.md +0 -0
- /package/one/{organisation → groups}/revenue.md +0 -0
- /package/one/{organisation → groups}/strategy.md +0 -0
- /package/one/{organisation → groups}/vision.md +0 -0
- /package/one/things/{cli-code.md → cli/cli-code.md} +0 -0
- /package/one/things/{cli-compiler-code.md → cli/cli-compiler-code.md} +0 -0
|
@@ -14,21 +14,28 @@ This ontology is organized into 6 dimension files:
|
|
|
14
14
|
5. **[events.md](./events.md)** - 67 event types (what happened)
|
|
15
15
|
6. **[knowledge.md](./knowledge.md)** - Vectors, embeddings, RAG (what it means)
|
|
16
16
|
|
|
17
|
+
**Execution Guide:**
|
|
18
|
+
|
|
19
|
+
7. **[todo.md](./todo.md)** - 100-inference execution sequence (plan in inferences, not days)
|
|
20
|
+
|
|
17
21
|
**This document (Ontology.md)** contains the complete technical specification. The consolidated files above provide focused summaries and patterns.
|
|
18
22
|
|
|
23
|
+
**Planning Paradigm:** We don't plan in days. We plan in **inference passes** (Infer 1-100). See [todo.md](./todo.md) for the complete 100-inference template that guides feature implementation from idea to production.
|
|
24
|
+
|
|
19
25
|
## The 6-Dimension Reality Model
|
|
20
26
|
|
|
21
27
|
Every single thing in ONE platform exists within one of these 6 dimensions:
|
|
22
28
|
|
|
23
29
|
```
|
|
24
30
|
┌──────────────────────────────────────────────────────────────┐
|
|
25
|
-
│
|
|
26
|
-
│ Multi-tenant isolation
|
|
31
|
+
│ 1. GROUPS │
|
|
32
|
+
│ Multi-tenant isolation with hierarchical nesting - who owns │
|
|
33
|
+
│ what at group level (friend circles → DAOs → governments) │
|
|
27
34
|
└──────────────────────────────────────────────────────────────┘
|
|
28
35
|
↓
|
|
29
36
|
┌──────────────────────────────────────────────────────────────┐
|
|
30
37
|
│ 2. PEOPLE │
|
|
31
|
-
│ Authorization & governance - platform owner,
|
|
38
|
+
│ Authorization & governance - platform owner, group owners │
|
|
32
39
|
└──────────────────────────────────────────────────────────────┘
|
|
33
40
|
↓
|
|
34
41
|
┌──────────────────────────────────────────────────────────────┐
|
|
@@ -54,68 +61,64 @@ Every single thing in ONE platform exists within one of these 6 dimensions:
|
|
|
54
61
|
|
|
55
62
|
**Golden Rule:** If you can't map your feature to these 6 dimensions, you're thinking about it wrong.
|
|
56
63
|
|
|
57
|
-
**Simplicity:** ONE is six dimensions —
|
|
64
|
+
**Simplicity:** ONE is six dimensions — groups partition, people authorize, things exist, connections relate, events record, and knowledge understands. Everything composes from these building blocks.
|
|
58
65
|
|
|
59
66
|
---
|
|
60
67
|
|
|
61
|
-
##
|
|
68
|
+
## GROUPS: The Isolation Boundary with Hierarchical Nesting
|
|
62
69
|
|
|
63
|
-
Purpose: Partition the system
|
|
70
|
+
Purpose: Partition the system with perfect isolation and support nested groups (groups within groups) - from friend circles to DAOs to governments. Every group owns its own graph of things, connections, events, and knowledge.
|
|
64
71
|
|
|
65
|
-
###
|
|
72
|
+
### Group Structure
|
|
66
73
|
|
|
67
74
|
```typescript
|
|
68
75
|
{
|
|
69
|
-
_id: Id<'
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
limits: {
|
|
77
|
-
users: number,
|
|
78
|
-
storage: number, // GB
|
|
79
|
-
apiCalls: number,
|
|
80
|
-
inference: number, // Monthly LLM calls
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
usage: {
|
|
84
|
-
users: number,
|
|
85
|
-
storage: number,
|
|
86
|
-
apiCalls: number,
|
|
87
|
-
inference: number,
|
|
88
|
-
},
|
|
76
|
+
_id: Id<'groups'>,
|
|
77
|
+
slug: string, // REQUIRED: URL identifier (/group/slug)
|
|
78
|
+
name: string, // REQUIRED: Display name
|
|
79
|
+
type: 'friend_circle' | 'business' | 'community' | 'dao' | 'government' | 'organization',
|
|
80
|
+
parentGroupId?: Id<'groups'>, // OPTIONAL: Parent group for hierarchical nesting
|
|
81
|
+
description?: string, // OPTIONAL: About text
|
|
89
82
|
|
|
90
|
-
|
|
91
|
-
customerId?: string, // Stripe customer
|
|
92
|
-
subscriptionId?: string,
|
|
93
|
-
},
|
|
83
|
+
metadata: Record<string, any>,
|
|
94
84
|
|
|
95
85
|
settings: {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
86
|
+
visibility: 'public' | 'private',
|
|
87
|
+
joinPolicy: 'open' | 'invite_only' | 'approval_required',
|
|
88
|
+
plan: 'starter' | 'pro' | 'enterprise',
|
|
89
|
+
limits: {
|
|
90
|
+
users: number,
|
|
91
|
+
storage: number, // GB
|
|
92
|
+
apiCalls: number,
|
|
93
|
+
}
|
|
99
94
|
},
|
|
100
95
|
|
|
96
|
+
status: 'active' | 'archived',
|
|
101
97
|
createdAt: number,
|
|
102
98
|
updatedAt: number,
|
|
103
|
-
trialEndsAt?: number,
|
|
104
99
|
}
|
|
105
100
|
```
|
|
106
101
|
|
|
107
|
-
###
|
|
102
|
+
### Common Fields by Use Case
|
|
103
|
+
|
|
104
|
+
**Identity:** `[slug, name]` - Who they are + URL
|
|
105
|
+
**Web:** `[slug, name, description]` - Website generation
|
|
106
|
+
**Operations:** `[status, type, settings, parentGroupId]` - System management
|
|
108
107
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
108
|
+
### Why Groups Matter
|
|
109
|
+
|
|
110
|
+
1. **Multi-Tenant Isolation:** Each group's data is completely separate
|
|
111
|
+
2. **Hierarchical Nesting:** Groups can contain sub-groups for complex organizations (parent → child → grandchild...)
|
|
112
|
+
3. **Flexible Types:** From friend circles (2 people) to businesses to DAOs to governments (billions)
|
|
113
|
+
4. **Resource Quotas:** Control costs and usage per group
|
|
114
|
+
5. **Privacy Control:** Groups can be public or private with controlled access
|
|
115
|
+
6. **Flexible Scale:** Scales from friend circles to global governments without schema changes
|
|
113
116
|
|
|
114
117
|
---
|
|
115
118
|
|
|
116
119
|
## PEOPLE: Authorization & Governance
|
|
117
120
|
|
|
118
|
-
Purpose: Define who can do what. People direct
|
|
121
|
+
Purpose: Define who can do what. People direct groups, customize AI agents, and govern access.
|
|
119
122
|
|
|
120
123
|
### Person Structure
|
|
121
124
|
|
|
@@ -127,10 +130,10 @@ Purpose: Define who can do what. People direct organizations, customize AI agent
|
|
|
127
130
|
displayName: string,
|
|
128
131
|
|
|
129
132
|
// CRITICAL: Role determines access level
|
|
130
|
-
role: 'platform_owner' | '
|
|
133
|
+
role: 'platform_owner' | 'group_owner' | 'group_user' | 'customer',
|
|
131
134
|
|
|
132
|
-
//
|
|
133
|
-
|
|
135
|
+
// Group context
|
|
136
|
+
groupId?: Id<'groups'>, // Current/default group
|
|
134
137
|
permissions?: string[],
|
|
135
138
|
|
|
136
139
|
// Profile
|
|
@@ -138,7 +141,7 @@ Purpose: Define who can do what. People direct organizations, customize AI agent
|
|
|
138
141
|
avatar?: string,
|
|
139
142
|
|
|
140
143
|
// Multi-tenant tracking
|
|
141
|
-
|
|
144
|
+
groups: Id<'groups'>[], // All groups this person belongs to
|
|
142
145
|
|
|
143
146
|
createdAt: number,
|
|
144
147
|
updatedAt: number,
|
|
@@ -150,18 +153,18 @@ Purpose: Define who can do what. People direct organizations, customize AI agent
|
|
|
150
153
|
1. **Platform Owner** (Anthony)
|
|
151
154
|
- Owns the ONE Platform
|
|
152
155
|
- 100% revenue from platform-level services
|
|
153
|
-
- Can access all
|
|
154
|
-
- Creates new
|
|
156
|
+
- Can access all groups (support/debugging)
|
|
157
|
+
- Creates new groups
|
|
155
158
|
|
|
156
|
-
2. **
|
|
157
|
-
- Owns/manages one or more
|
|
158
|
-
- Controls users, permissions, billing within
|
|
159
|
+
2. **Group Owner**
|
|
160
|
+
- Owns/manages one or more groups
|
|
161
|
+
- Controls users, permissions, billing within group
|
|
159
162
|
- Customizes AI agents and frontend
|
|
160
163
|
- Revenue sharing with platform
|
|
161
164
|
|
|
162
|
-
3. **
|
|
163
|
-
- Works within
|
|
164
|
-
- Limited permissions (defined by
|
|
165
|
+
3. **Group User**
|
|
166
|
+
- Works within a group
|
|
167
|
+
- Limited permissions (defined by group owner)
|
|
165
168
|
- Can create content, run agents (within quotas)
|
|
166
169
|
|
|
167
170
|
4. **Customer**
|
|
@@ -172,7 +175,7 @@ Purpose: Define who can do what. People direct organizations, customize AI agent
|
|
|
172
175
|
### Why People Matter
|
|
173
176
|
|
|
174
177
|
1. **Authorization:** Every action must have an actor (person)
|
|
175
|
-
2. **Governance:**
|
|
178
|
+
2. **Governance:** Group owners control who can do what
|
|
176
179
|
3. **Audit Trail:** Events log who did what when
|
|
177
180
|
4. **Customization:** People teach AI agents their preferences
|
|
178
181
|
|
|
@@ -407,8 +410,8 @@ type ThingType =
|
|
|
407
410
|
totalContent: number,
|
|
408
411
|
totalRevenue: number,
|
|
409
412
|
// MULTI-TENANT ROLES
|
|
410
|
-
role: "platform_owner" | "
|
|
411
|
-
|
|
413
|
+
role: "platform_owner" | "group_owner" | "group_user" | "customer",
|
|
414
|
+
groupId?: Id<"groups">, // Current/default group (if group_owner or group_user)
|
|
412
415
|
permissions?: string[], // Additional permissions
|
|
413
416
|
}
|
|
414
417
|
```
|
|
@@ -986,16 +989,16 @@ type ConnectionType =
|
|
|
986
989
|
}
|
|
987
990
|
```
|
|
988
991
|
|
|
989
|
-
**Pattern:
|
|
992
|
+
**Pattern: Group Membership**
|
|
990
993
|
|
|
991
994
|
```typescript
|
|
992
|
-
// User is member of
|
|
995
|
+
// User is member of group with role
|
|
993
996
|
{
|
|
994
997
|
fromThingId: userId,
|
|
995
|
-
toThingId:
|
|
998
|
+
toThingId: groupId,
|
|
996
999
|
relationshipType: "member_of",
|
|
997
1000
|
metadata: {
|
|
998
|
-
role: "
|
|
1001
|
+
role: "group_owner" | "group_user", // Group-specific role
|
|
999
1002
|
permissions: ["read", "write", "admin"],
|
|
1000
1003
|
invitedBy?: Id<"things">, // Who invited this user
|
|
1001
1004
|
invitedAt?: number,
|
|
@@ -1004,9 +1007,9 @@ type ConnectionType =
|
|
|
1004
1007
|
createdAt: Date.now()
|
|
1005
1008
|
}
|
|
1006
1009
|
|
|
1007
|
-
//
|
|
1010
|
+
// Group owns content/resources
|
|
1008
1011
|
{
|
|
1009
|
-
fromThingId:
|
|
1012
|
+
fromThingId: groupId,
|
|
1010
1013
|
toThingId: contentId,
|
|
1011
1014
|
relationshipType: "owns",
|
|
1012
1015
|
metadata: {
|
|
@@ -1131,12 +1134,12 @@ type EventType =
|
|
|
1131
1134
|
| 'two_factor_enabled'
|
|
1132
1135
|
| 'two_factor_disabled'
|
|
1133
1136
|
|
|
1134
|
-
//
|
|
1135
|
-
| '
|
|
1136
|
-
| '
|
|
1137
|
-
| '
|
|
1138
|
-
| '
|
|
1139
|
-
| '
|
|
1137
|
+
// GROUP EVENTS (5)
|
|
1138
|
+
| 'group_created'
|
|
1139
|
+
| 'group_updated'
|
|
1140
|
+
| 'user_invited_to_group'
|
|
1141
|
+
| 'user_joined_group'
|
|
1142
|
+
| 'user_removed_from_group'
|
|
1140
1143
|
|
|
1141
1144
|
// DASHBOARD & UI EVENTS (4)
|
|
1142
1145
|
| 'dashboard_viewed'
|
|
@@ -1185,7 +1188,7 @@ type EventType =
|
|
|
1185
1188
|
| 'inference_failed' // Inference failed
|
|
1186
1189
|
| 'inference_quota_exceeded' // Monthly limit hit
|
|
1187
1190
|
| 'inference_revenue_collected' // Daily revenue sweep
|
|
1188
|
-
| 'org_revenue_generated' //
|
|
1191
|
+
| 'org_revenue_generated' // Group generates platform revenue
|
|
1189
1192
|
| 'revenue_share_distributed' // Revenue share paid out
|
|
1190
1193
|
|
|
1191
1194
|
// BLOCKCHAIN EVENTS (5) - NEW
|
|
@@ -1462,14 +1465,14 @@ The `metadata` field is flexible JSON that ALWAYS includes `protocol` for protoc
|
|
|
1462
1465
|
}
|
|
1463
1466
|
```
|
|
1464
1467
|
|
|
1465
|
-
**Pattern:
|
|
1468
|
+
**Pattern: Group Events**
|
|
1466
1469
|
|
|
1467
1470
|
```typescript
|
|
1468
|
-
//
|
|
1471
|
+
// Group created
|
|
1469
1472
|
{
|
|
1470
|
-
type: "
|
|
1473
|
+
type: "group_created",
|
|
1471
1474
|
actorId: creatorId,
|
|
1472
|
-
targetId:
|
|
1475
|
+
targetId: groupId,
|
|
1473
1476
|
timestamp: Date.now(),
|
|
1474
1477
|
metadata: {
|
|
1475
1478
|
name: "Acme Corp",
|
|
@@ -1479,28 +1482,28 @@ The `metadata` field is flexible JSON that ALWAYS includes `protocol` for protoc
|
|
|
1479
1482
|
}
|
|
1480
1483
|
}
|
|
1481
1484
|
|
|
1482
|
-
// User invited to
|
|
1485
|
+
// User invited to group
|
|
1483
1486
|
{
|
|
1484
|
-
type: "
|
|
1487
|
+
type: "user_invited_to_group",
|
|
1485
1488
|
actorId: inviterId,
|
|
1486
|
-
targetId:
|
|
1489
|
+
targetId: groupId,
|
|
1487
1490
|
timestamp: Date.now(),
|
|
1488
1491
|
metadata: {
|
|
1489
1492
|
invitedEmail: "newuser@example.com",
|
|
1490
|
-
role: "
|
|
1493
|
+
role: "group_user",
|
|
1491
1494
|
inviteToken: "inv_123456",
|
|
1492
1495
|
expiresAt: Date.now() + 7 * 24 * 60 * 60 * 1000 // 7 days
|
|
1493
1496
|
}
|
|
1494
1497
|
}
|
|
1495
1498
|
|
|
1496
|
-
// User joined
|
|
1499
|
+
// User joined group
|
|
1497
1500
|
{
|
|
1498
|
-
type: "
|
|
1501
|
+
type: "user_joined_group",
|
|
1499
1502
|
actorId: userId,
|
|
1500
|
-
targetId:
|
|
1503
|
+
targetId: groupId,
|
|
1501
1504
|
timestamp: Date.now(),
|
|
1502
1505
|
metadata: {
|
|
1503
|
-
role: "
|
|
1506
|
+
role: "group_user",
|
|
1504
1507
|
invitedBy: inviterId
|
|
1505
1508
|
}
|
|
1506
1509
|
}
|
|
@@ -1515,8 +1518,8 @@ The `metadata` field is flexible JSON that ALWAYS includes `protocol` for protoc
|
|
|
1515
1518
|
actorId: userId,
|
|
1516
1519
|
timestamp: Date.now(),
|
|
1517
1520
|
metadata: {
|
|
1518
|
-
dashboardType: "platform_owner" | "
|
|
1519
|
-
|
|
1521
|
+
dashboardType: "platform_owner" | "group_owner" | "group_user" | "customer",
|
|
1522
|
+
groupId?: groupId,
|
|
1520
1523
|
route: "/admin/dashboard",
|
|
1521
1524
|
sessionDuration: 0 // Updated on session end
|
|
1522
1525
|
}
|
|
@@ -1575,11 +1578,11 @@ for (const label of labels) {
|
|
|
1575
1578
|
Pattern: semantic search across chunks
|
|
1576
1579
|
|
|
1577
1580
|
```typescript
|
|
1578
|
-
// Given a query embedding, find top-k similar chunks for
|
|
1581
|
+
// Given a query embedding, find top-k similar chunks for a group
|
|
1579
1582
|
const topK = await vectorSearch('knowledge', {
|
|
1580
1583
|
vectorField: 'embedding',
|
|
1581
1584
|
query: queryEmbedding,
|
|
1582
|
-
filter: { 'sourceThingId.
|
|
1585
|
+
filter: { 'sourceThingId.groupId': groupId, knowledgeType: 'chunk' },
|
|
1583
1586
|
k: 10,
|
|
1584
1587
|
});
|
|
1585
1588
|
```
|
|
@@ -2189,14 +2192,14 @@ Principle: Users can add to any type without breaking the ontology.
|
|
|
2189
2192
|
- `connection` (state): Relationship between two entities (owns, member_of, transacted, fulfilled, delegated, communicated).
|
|
2190
2193
|
- `event` (action): Time-stamped occurrence (content_changed, payment_event, communication_event, task_event, mandate_event).
|
|
2191
2194
|
- `knowledge` (label/chunk): Classification and RAG units applied via `thingKnowledge` (labels like skill/industry/topic and chunks with embeddings).
|
|
2192
|
-
- `owner`: A `creator` with ownership responsibilities. Platform owner (platform_owner) or
|
|
2193
|
-
- `
|
|
2195
|
+
- `owner`: A `creator` with ownership responsibilities. Platform owner (platform_owner) or group owner (group_owner). See `one/people/owner.md`.
|
|
2196
|
+
- `group`: Multi-tenant container for users and resources with hierarchical nesting. See `one/people/organisation.md`.
|
|
2194
2197
|
|
|
2195
2198
|
---
|
|
2196
2199
|
|
|
2197
2200
|
## Summary Statistics
|
|
2198
2201
|
|
|
2199
|
-
**Dimensions:** 6 total (
|
|
2202
|
+
**Dimensions:** 6 total (groups, people, things, connections, events, knowledge)
|
|
2200
2203
|
|
|
2201
2204
|
**Thing Types:** 66 total
|
|
2202
2205
|
- Core: 4 (creator, ai_clone, audience_member, organization)
|
|
@@ -2217,13 +2220,13 @@ Principle: Users can add to any type without breaking the ontology.
|
|
|
2217
2220
|
- 18 specific semantic types
|
|
2218
2221
|
- 7 consolidated types with metadata variants
|
|
2219
2222
|
- Protocol-agnostic via metadata.protocol
|
|
2220
|
-
- Includes
|
|
2223
|
+
- Includes group membership with role-based metadata
|
|
2221
2224
|
|
|
2222
2225
|
**Event Types:** 67 total (Hybrid approach)
|
|
2223
2226
|
- 4 Thing lifecycle
|
|
2224
2227
|
- 5 User events
|
|
2225
2228
|
- 6 Authentication events
|
|
2226
|
-
- 5 Organization events
|
|
2229
|
+
- 5 Group events (formerly "Organization events")
|
|
2227
2230
|
- 4 Dashboard & UI events
|
|
2228
2231
|
- 4 AI/Clone events
|
|
2229
2232
|
- 4 Agent events
|
|
@@ -2253,15 +2256,23 @@ Policy: Default is free-form, user-extensible knowledge labels for maximum flexi
|
|
|
2253
2256
|
|
|
2254
2257
|
- Curated label prefixes (recommended): `skill:*`, `industry:*`, `topic:*`, `format:*`, `goal:*`, `audience:*`, `technology:*`, `status:*`, `capability:*`, `protocol:*`, `payment_method:*`, `network:*`.
|
|
2255
2258
|
- Validation: Enforce label hygiene (no duplicates within scope); allow synonyms via an alias list if needed.
|
|
2256
|
-
- Ownership: Platform/
|
|
2259
|
+
- Ownership: Platform/group owners may curate official labels; users can still apply ad‑hoc labels.
|
|
2257
2260
|
- Hygiene: Periodically consolidate low-usage duplicates; do not delete knowledge items with active references—mark deprecated instead.
|
|
2258
2261
|
|
|
2259
2262
|
---
|
|
2260
2263
|
|
|
2261
2264
|
## Changelog
|
|
2262
2265
|
|
|
2266
|
+
- 2025-10-14
|
|
2267
|
+
- Updated terminology from "organizations" to "groups" throughout Frontend Integration Examples, Summary Statistics, Philosophy, Knowledge Governance, and Glossary sections.
|
|
2268
|
+
- Updated all code examples to use `groups` table and `groupId` references instead of organizations/orgId.
|
|
2269
|
+
- Changed event category from "Organization events" to "Group events" in Summary Statistics.
|
|
2270
|
+
- Updated role references from `org_owner` to `group_owner` throughout examples.
|
|
2271
|
+
- Clarified that groups scale hierarchically from friend circles to governments.
|
|
2272
|
+
- Updated RAG ingestion strategy to use "group" filtering instead of "org".
|
|
2273
|
+
|
|
2263
2274
|
- 2025-10-07
|
|
2264
|
-
- Canonicalized terminology:
|
|
2275
|
+
- Canonicalized terminology: "things" as the conceptual term; kept implementation table/fields as `entities` for compatibility.
|
|
2265
2276
|
- Merged protocol integration requirements; clarified consolidated events/connections with `metadata.protocol`.
|
|
2266
2277
|
- Added Event Retention & Archival guidance for scale.
|
|
2267
2278
|
- Added Extensibility rules and a compact Glossary.
|
|
@@ -2288,14 +2299,14 @@ Policy: Default is free-form, user-extensible knowledge labels for maximum flexi
|
|
|
2288
2299
|
- 18 specific semantic types
|
|
2289
2300
|
- 7 consolidated types with metadata variants
|
|
2290
2301
|
- Protocol-agnostic via metadata.protocol
|
|
2291
|
-
- Includes
|
|
2302
|
+
- Includes group membership with role-based metadata
|
|
2292
2303
|
|
|
2293
2304
|
**Event Types:** 63 total (Hybrid approach)
|
|
2294
2305
|
|
|
2295
2306
|
- 4 Thing lifecycle
|
|
2296
2307
|
- 5 User events
|
|
2297
2308
|
- 6 Authentication events (password_reset, email_verification, 2FA)
|
|
2298
|
-
- 5
|
|
2309
|
+
- 5 Group events (group_created, user_invited_to_group, user_joined_group)
|
|
2299
2310
|
- 4 Dashboard & UI events (dashboard_viewed, theme_changed, settings_updated)
|
|
2300
2311
|
- 4 AI/Clone events
|
|
2301
2312
|
- 4 Agent events
|
|
@@ -2332,7 +2343,7 @@ Policy: Default is free-form, user-extensible knowledge labels for maximum flexi
|
|
|
2332
2343
|
|
|
2333
2344
|
This ontology proves that you don't need hundreds of tables or complex schemas to build a complete AI-native platform. You need:
|
|
2334
2345
|
|
|
2335
|
-
1. **6 dimensions** (
|
|
2346
|
+
1. **6 dimensions** (groups, people, things, connections, events, knowledge)
|
|
2336
2347
|
2. **66 thing types** (every "thing")
|
|
2337
2348
|
3. **25 connection types** (every relationship)
|
|
2338
2349
|
4. **67 event types** (every action)
|
|
@@ -2353,7 +2364,7 @@ That's it. Everything else is just data.
|
|
|
2353
2364
|
**ONE's approach:**
|
|
2354
2365
|
|
|
2355
2366
|
- Map every feature to 6 dimensions
|
|
2356
|
-
-
|
|
2367
|
+
- Groups partition the space (from friend circles to governments)
|
|
2357
2368
|
- People authorize and govern
|
|
2358
2369
|
- Things, connections, events flow from there
|
|
2359
2370
|
- Knowledge understands it all
|
|
@@ -2365,7 +2376,7 @@ That's it. Everything else is just data.
|
|
|
2365
2376
|
A database schema that:
|
|
2366
2377
|
|
|
2367
2378
|
- Scales from lemonade stands to global enterprises
|
|
2368
|
-
- Children can understand: "I own (
|
|
2379
|
+
- Children can understand: "I own (group), I'm the boss (person), I sell lemonade (things)"
|
|
2369
2380
|
- Enterprises can rely on: Multi-tenant isolation, clear governance, infinite scale
|
|
2370
2381
|
- AI agents can reason about completely
|
|
2371
2382
|
- Never needs breaking changes
|
|
@@ -2388,25 +2399,25 @@ The Astro frontend (documented in `Frontend.md`) uses this ontology through:
|
|
|
2388
2399
|
**Example: Multi-Tenant Dashboard**
|
|
2389
2400
|
|
|
2390
2401
|
```typescript
|
|
2391
|
-
// Frontend Component (src/components/admin/
|
|
2402
|
+
// Frontend Component (src/components/admin/GroupList.tsx)
|
|
2392
2403
|
import { useQuery } from 'convex/react';
|
|
2393
2404
|
import { api } from '@/convex/_generated/api';
|
|
2394
2405
|
|
|
2395
|
-
export function
|
|
2396
|
-
// Query
|
|
2397
|
-
const
|
|
2406
|
+
export function GroupList() {
|
|
2407
|
+
// Query groups (table: "groups")
|
|
2408
|
+
const groups = useQuery(api.queries.admin.listGroups);
|
|
2398
2409
|
|
|
2399
2410
|
return (
|
|
2400
2411
|
<div>
|
|
2401
|
-
{
|
|
2402
|
-
<Card key={
|
|
2412
|
+
{groups?.map(group => (
|
|
2413
|
+
<Card key={group._id}>
|
|
2403
2414
|
<CardHeader>
|
|
2404
|
-
<CardTitle>{
|
|
2405
|
-
<Badge>{
|
|
2415
|
+
<CardTitle>{group.name}</CardTitle>
|
|
2416
|
+
<Badge>{group.settings.plan}</Badge>
|
|
2406
2417
|
</CardHeader>
|
|
2407
2418
|
<CardContent>
|
|
2408
|
-
<p>{
|
|
2409
|
-
<p>Status: {
|
|
2419
|
+
<p>{group.metadata.userCount || 0} / {group.settings.limits.users} users</p>
|
|
2420
|
+
<p>Status: {group.status}</p>
|
|
2410
2421
|
</CardContent>
|
|
2411
2422
|
</Card>
|
|
2412
2423
|
))}
|
|
@@ -2477,37 +2488,37 @@ export function PasswordResetForm() {
|
|
|
2477
2488
|
}
|
|
2478
2489
|
```
|
|
2479
2490
|
|
|
2480
|
-
**Example:
|
|
2491
|
+
**Example: Group Membership Check**
|
|
2481
2492
|
|
|
2482
2493
|
```typescript
|
|
2483
|
-
// Check if user is
|
|
2484
|
-
export const
|
|
2485
|
-
args: { userId: v.id('
|
|
2486
|
-
handler: async (ctx, { userId,
|
|
2494
|
+
// Check if user is group_owner (Middleware.md pattern)
|
|
2495
|
+
export const checkGroupOwner = query({
|
|
2496
|
+
args: { userId: v.id('things'), groupId: v.id('groups') },
|
|
2497
|
+
handler: async (ctx, { userId, groupId }) => {
|
|
2487
2498
|
// Query connection with role metadata
|
|
2488
2499
|
const membership = await ctx.db
|
|
2489
2500
|
.query('connections')
|
|
2490
2501
|
.withIndex('from_type', (q) =>
|
|
2491
2502
|
q
|
|
2492
2503
|
.eq('fromThingId', userId)
|
|
2493
|
-
.eq('toThingId',
|
|
2504
|
+
.eq('toThingId', groupId)
|
|
2494
2505
|
.eq('relationshipType', 'member_of')
|
|
2495
2506
|
)
|
|
2496
2507
|
.first();
|
|
2497
2508
|
|
|
2498
|
-
return membership?.metadata?.role === '
|
|
2509
|
+
return membership?.metadata?.role === 'group_owner';
|
|
2499
2510
|
},
|
|
2500
2511
|
});
|
|
2501
2512
|
|
|
2502
2513
|
// Frontend usage in middleware
|
|
2503
2514
|
import { ConvexHttpClient } from 'convex/browser';
|
|
2504
2515
|
|
|
2505
|
-
export async function checkAccess(userId: string,
|
|
2516
|
+
export async function checkAccess(userId: string, groupId: string) {
|
|
2506
2517
|
const convex = new ConvexHttpClient(env.CONVEX_URL);
|
|
2507
|
-
const isOwner = await convex.query(api.auth.
|
|
2518
|
+
const isOwner = await convex.query(api.auth.checkGroupOwner, { userId, groupId });
|
|
2508
2519
|
|
|
2509
2520
|
if (!isOwner) {
|
|
2510
|
-
throw new Error('Forbidden:
|
|
2521
|
+
throw new Error('Forbidden: Group owner access required');
|
|
2511
2522
|
}
|
|
2512
2523
|
}
|
|
2513
2524
|
```
|
|
@@ -2516,20 +2527,20 @@ export async function checkAccess(userId: string, orgId: string) {
|
|
|
2516
2527
|
|
|
2517
2528
|
```typescript
|
|
2518
2529
|
// Query events for analytics (Dashboard.md pattern)
|
|
2519
|
-
export const
|
|
2520
|
-
args: {
|
|
2521
|
-
handler: async (ctx, {
|
|
2530
|
+
export const getGroupAnalytics = query({
|
|
2531
|
+
args: { groupId: v.id('groups'), days: v.number() },
|
|
2532
|
+
handler: async (ctx, { groupId, days }) => {
|
|
2522
2533
|
const since = Date.now() - days * 24 * 60 * 60 * 1000;
|
|
2523
2534
|
|
|
2524
|
-
// Get all dashboard_viewed events for
|
|
2525
|
-
const
|
|
2535
|
+
// Get all dashboard_viewed events for group users
|
|
2536
|
+
const groupMembers = await ctx.db
|
|
2526
2537
|
.query('connections')
|
|
2527
2538
|
.withIndex('to_type', (q) =>
|
|
2528
|
-
q.eq('toThingId',
|
|
2539
|
+
q.eq('toThingId', groupId).eq('relationshipType', 'member_of')
|
|
2529
2540
|
)
|
|
2530
2541
|
.collect();
|
|
2531
2542
|
|
|
2532
|
-
const memberIds =
|
|
2543
|
+
const memberIds = groupMembers.map((m) => m.fromThingId);
|
|
2533
2544
|
|
|
2534
2545
|
const dashboardViews = await ctx.db
|
|
2535
2546
|
.query('events')
|
|
@@ -2662,9 +2673,9 @@ const agentsCollection = defineCollection({
|
|
|
2662
2673
|
**2. Real-time Dashboard Stats**
|
|
2663
2674
|
|
|
2664
2675
|
```tsx
|
|
2665
|
-
export function DashboardStats({
|
|
2676
|
+
export function DashboardStats({ groupId }) {
|
|
2666
2677
|
// Subscribes to changes - auto-updates when events are logged!
|
|
2667
|
-
const stats = useQuery(api.queries.dashboard.getStats, {
|
|
2678
|
+
const stats = useQuery(api.queries.dashboard.getStats, { groupId });
|
|
2668
2679
|
|
|
2669
2680
|
return <StatsCards data={stats} />;
|
|
2670
2681
|
}
|
|
@@ -2673,13 +2684,13 @@ export function DashboardStats({ orgId }) {
|
|
|
2673
2684
|
**3. Permission-Based Rendering**
|
|
2674
2685
|
|
|
2675
2686
|
```tsx
|
|
2676
|
-
export function AdminPanel({ userId,
|
|
2677
|
-
const membership = useQuery(api.queries.
|
|
2687
|
+
export function AdminPanel({ userId, groupId }) {
|
|
2688
|
+
const membership = useQuery(api.queries.groups.getMembership, {
|
|
2678
2689
|
userId,
|
|
2679
|
-
|
|
2690
|
+
groupId,
|
|
2680
2691
|
});
|
|
2681
2692
|
|
|
2682
|
-
if (membership?.metadata?.role !== '
|
|
2693
|
+
if (membership?.metadata?.role !== 'group_owner') {
|
|
2683
2694
|
return <div>Access denied</div>;
|
|
2684
2695
|
}
|
|
2685
2696
|
|
|
@@ -2691,30 +2702,30 @@ export function AdminPanel({ userId, orgId }) {
|
|
|
2691
2702
|
|
|
2692
2703
|
```astro
|
|
2693
2704
|
---
|
|
2694
|
-
// src/pages/
|
|
2705
|
+
// src/pages/group/[groupId]/dashboard.astro
|
|
2695
2706
|
import { ConvexHttpClient } from 'convex/browser';
|
|
2696
2707
|
import { api } from '@/convex/_generated/api';
|
|
2697
2708
|
|
|
2698
2709
|
const convex = new ConvexHttpClient(import.meta.env.PUBLIC_CONVEX_URL);
|
|
2699
2710
|
|
|
2700
|
-
// Fetch
|
|
2701
|
-
const
|
|
2702
|
-
id: Astro.params.
|
|
2711
|
+
// Fetch group
|
|
2712
|
+
const group = await convex.query(api.queries.groups.get, {
|
|
2713
|
+
id: Astro.params.groupId,
|
|
2703
2714
|
});
|
|
2704
2715
|
|
|
2705
|
-
// Fetch
|
|
2706
|
-
const members = await convex.query(api.queries.
|
|
2707
|
-
|
|
2716
|
+
// Fetch group members (connections where relationshipType = "member_of")
|
|
2717
|
+
const members = await convex.query(api.queries.groups.getMembers, {
|
|
2718
|
+
groupId: Astro.params.groupId,
|
|
2708
2719
|
});
|
|
2709
2720
|
---
|
|
2710
2721
|
|
|
2711
|
-
<Layout title={
|
|
2712
|
-
<h1>{
|
|
2713
|
-
<p>Plan: {
|
|
2714
|
-
<p>Members: {members.length} / {
|
|
2722
|
+
<Layout title={group.name}>
|
|
2723
|
+
<h1>{group.name} Dashboard</h1>
|
|
2724
|
+
<p>Plan: {group.settings.plan}</p>
|
|
2725
|
+
<p>Members: {members.length} / {group.settings.limits.users}</p>
|
|
2715
2726
|
|
|
2716
2727
|
<!-- Real-time stats component -->
|
|
2717
|
-
<
|
|
2728
|
+
<GroupStats client:load groupId={group._id} />
|
|
2718
2729
|
</Layout>
|
|
2719
2730
|
```
|
|
2720
2731
|
|
|
@@ -2765,7 +2776,7 @@ Objective: attach vectors to every relevant piece of content to enable high‑qu
|
|
|
2765
2776
|
- Event log: `content_changed` on source updates triggers re‑embedding (debounced) via scheduler.
|
|
2766
2777
|
|
|
2767
2778
|
5) Query + retrieval
|
|
2768
|
-
- Vector search over `knowledge` filtered by
|
|
2779
|
+
- Vector search over `knowledge` filtered by group, creator, and content type; k‑NN approximate index when available, else provider‑side search.
|
|
2769
2780
|
- Hybrid scoring: combine semantic similarity with lexical signals from `labels` and metadata.
|
|
2770
2781
|
|
|
2771
2782
|
6) Governance + lifecycle
|