@elevasis/core 0.21.0 → 0.22.0

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.
Files changed (59) hide show
  1. package/dist/index.d.ts +416 -6
  2. package/dist/index.js +240 -15
  3. package/dist/knowledge/index.d.ts +97 -1
  4. package/dist/organization-model/index.d.ts +416 -6
  5. package/dist/organization-model/index.js +240 -15
  6. package/dist/test-utils/index.d.ts +216 -1
  7. package/dist/test-utils/index.js +230 -14
  8. package/package.json +3 -3
  9. package/src/_gen/__tests__/__snapshots__/contracts.md.snap +495 -302
  10. package/src/auth/multi-tenancy/permissions.ts +20 -8
  11. package/src/business/README.md +2 -2
  12. package/src/business/acquisition/api-schemas.test.ts +173 -0
  13. package/src/business/acquisition/api-schemas.ts +125 -7
  14. package/src/business/acquisition/index.ts +12 -0
  15. package/src/business/clients/api-schemas.test.ts +115 -0
  16. package/src/business/clients/api-schemas.ts +158 -0
  17. package/src/business/clients/index.ts +1 -0
  18. package/src/business/deals/api-schemas.ts +8 -0
  19. package/src/business/index.ts +5 -2
  20. package/src/business/projects/types.ts +19 -0
  21. package/src/execution/engine/__tests__/fixtures/test-agents.ts +10 -8
  22. package/src/execution/engine/agent/core/__tests__/agent.test.ts +16 -12
  23. package/src/execution/engine/agent/core/__tests__/error-passthrough.test.ts +4 -3
  24. package/src/execution/engine/agent/core/types.ts +25 -15
  25. package/src/execution/engine/agent/index.ts +6 -4
  26. package/src/execution/engine/agent/reasoning/__tests__/request-builder.test.ts +24 -18
  27. package/src/execution/engine/index.ts +3 -0
  28. package/src/execution/engine/workflow/types.ts +7 -0
  29. package/src/organization-model/README.md +10 -3
  30. package/src/organization-model/__tests__/defaults.test.ts +6 -0
  31. package/src/organization-model/__tests__/domains/resources.test.ts +188 -0
  32. package/src/organization-model/__tests__/domains/roles.test.ts +402 -347
  33. package/src/organization-model/__tests__/domains/systems.test.ts +193 -0
  34. package/src/organization-model/__tests__/knowledge.test.ts +39 -0
  35. package/src/organization-model/__tests__/resolve.test.ts +1 -1
  36. package/src/organization-model/defaults.ts +24 -3
  37. package/src/organization-model/domains/knowledge.ts +3 -2
  38. package/src/organization-model/domains/resources.ts +88 -0
  39. package/src/organization-model/domains/roles.ts +93 -55
  40. package/src/organization-model/domains/systems.ts +46 -0
  41. package/src/organization-model/icons.ts +1 -0
  42. package/src/organization-model/index.ts +2 -0
  43. package/src/organization-model/organization-model.mdx +33 -14
  44. package/src/organization-model/published.ts +52 -1
  45. package/src/organization-model/schema.ts +121 -0
  46. package/src/organization-model/types.ts +46 -1
  47. package/src/platform/api/types.ts +38 -35
  48. package/src/platform/registry/__tests__/resource-registry.test.ts +2051 -2005
  49. package/src/platform/registry/__tests__/validation.test.ts +1343 -1086
  50. package/src/platform/registry/index.ts +14 -0
  51. package/src/platform/registry/resource-registry.ts +40 -2
  52. package/src/platform/registry/serialization.ts +241 -202
  53. package/src/platform/registry/serialized-types.ts +1 -0
  54. package/src/platform/registry/types.ts +411 -361
  55. package/src/platform/registry/validation.ts +743 -513
  56. package/src/projects/api-schemas.ts +290 -267
  57. package/src/reference/_generated/contracts.md +495 -302
  58. package/src/reference/glossary.md +8 -3
  59. package/src/supabase/database.types.ts +121 -0
@@ -11,7 +11,7 @@ description: Terminology disambiguation for Organization OS concepts used in the
11
11
 
12
12
  **Contract** -- the publishable boundary a consumer depends on: Zod schemas, TypeScript types, provider props, resource definitions, or workflow I/O schemas.
13
13
 
14
- **DeploymentSpec** -- resource collection for one organization: workflows, agents, triggers, integrations, relationships, external resources, and human checkpoints.
14
+ **DeploymentSpec** -- runtime/deploy assembly for one organization: workflows, agents, triggers, integrations, relationships, external resources, and human checkpoints. It assembles executable behavior around Organization Model resource descriptors; it is not the source of resource identity.
15
15
 
16
16
  **Feature** -- either a platform capability, a shell `FeatureModule`, or an Organization Model feature node. In the current shell contract, Organization Model feature nodes drive sidebar hierarchy and access state.
17
17
 
@@ -29,13 +29,17 @@ description: Terminology disambiguation for Organization OS concepts used in the
29
29
 
30
30
  **MembershipFeatureConfig** -- per-member feature override config: `{ features?: Record<string, boolean> }`.
31
31
 
32
- **OrganizationModel** -- top-level semantic contract for an organization. Current primary fields include `features`, `branding`, `navigation`, `sales`, `prospecting`, `projects`, `identity`, `customers`, `offerings`, `roles`, `goals`, `statuses`, and `operations`.
32
+ **OrganizationModel** -- top-level semantic contract for an organization. Current primary fields include `features`, `branding`, `navigation`, `sales`, `prospecting`, `projects`, `identity`, `customers`, `offerings`, `roles`, `goals`, `systems`, `resources`, `statuses`, `operations`, and `knowledge`.
33
33
 
34
34
  **OrganizationModelFeature** -- feature node in `OrganizationModel.features`. Fields include `id`, `label`, `description`, `enabled`, `path`, `icon`, `color`, `uiPosition`, `requiresAdmin`, and `devOnly`.
35
35
 
36
36
  **Provider / ElevasisFeaturesProvider** -- runtime that registers manifests, resolves feature access against the org model, and exposes shell helpers through `useElevasisFeatures()`.
37
37
 
38
- **Resource** -- deployable workflow, agent, trigger, integration, external resource, or human checkpoint in a `DeploymentSpec`. Resources bind to the Organization Model graph through metadata `links` and are grouped for operations with `category`.
38
+ **Resource** -- governance-only descriptor in `OrganizationModel.resources.entries` for a workflow, agent, or integration. Runtime code derives `resourceId` and kind from the descriptor, then attaches executable behavior in operations.
39
+
40
+ **Resource descriptor** -- OM entry with canonical `id`, required `systemId`, governance `status`, and optional role ownership. Workflow descriptors may mirror `capabilityKey`; agent descriptors carry `agentKind`, `sessionCapable`, and optional `actsAsRoleId`; integration descriptors name a provider.
41
+
42
+ **System** -- tenant-defined bounded context in `OrganizationModel.systems.systems` that groups operational resources and carries governance metadata such as responsible role, governing knowledge, driven goals, kind, and status.
39
43
 
40
44
  **ResourceCategory** -- resource metadata category: `production`, `diagnostic`, `internal`, or `testing`.
41
45
 
@@ -54,6 +58,7 @@ description: Terminology disambiguation for Organization OS concepts used in the
54
58
  **`@elevasis/core`**
55
59
 
56
60
  - `OrganizationModel`, `OrganizationModelFeature`
61
+ - `SystemEntry`, `ResourceEntry`
57
62
  - `resolveOrganizationModel`, `defineOrganizationModel`, `DEFAULT_ORGANIZATION_MODEL`
58
63
  - `MembershipFeatureConfig`
59
64
  - `DeploymentSpec`, `ResourceLink`, `ResourceCategory`
@@ -66,6 +66,7 @@ export type Database = {
66
66
  batch_id: string | null
67
67
  category: string | null
68
68
  category_pain: string | null
69
+ client_id: string | null
69
70
  created_at: string
70
71
  domain: string | null
71
72
  enrichment_data: Json | null
@@ -92,6 +93,7 @@ export type Database = {
92
93
  batch_id?: string | null
93
94
  category?: string | null
94
95
  category_pain?: string | null
96
+ client_id?: string | null
95
97
  created_at?: string
96
98
  domain?: string | null
97
99
  enrichment_data?: Json | null
@@ -118,6 +120,7 @@ export type Database = {
118
120
  batch_id?: string | null
119
121
  category?: string | null
120
122
  category_pain?: string | null
123
+ client_id?: string | null
121
124
  created_at?: string
122
125
  domain?: string | null
123
126
  enrichment_data?: Json | null
@@ -141,6 +144,13 @@ export type Database = {
141
144
  website?: string | null
142
145
  }
143
146
  Relationships: [
147
+ {
148
+ foreignKeyName: "acq_companies_client_id_fkey"
149
+ columns: ["client_id"]
150
+ isOneToOne: false
151
+ referencedRelation: "clients"
152
+ referencedColumns: ["id"]
153
+ },
144
154
  {
145
155
  foreignKeyName: "acq_companies_organization_id_fkey"
146
156
  columns: ["organization_id"]
@@ -155,6 +165,7 @@ export type Database = {
155
165
  batch_id: string | null
156
166
  brochure_first_viewed_at: string | null
157
167
  brochure_view_count: number
168
+ client_id: string | null
158
169
  company_id: string | null
159
170
  created_at: string
160
171
  email: string
@@ -183,6 +194,7 @@ export type Database = {
183
194
  batch_id?: string | null
184
195
  brochure_first_viewed_at?: string | null
185
196
  brochure_view_count?: number
197
+ client_id?: string | null
186
198
  company_id?: string | null
187
199
  created_at?: string
188
200
  email: string
@@ -211,6 +223,7 @@ export type Database = {
211
223
  batch_id?: string | null
212
224
  brochure_first_viewed_at?: string | null
213
225
  brochure_view_count?: number
226
+ client_id?: string | null
214
227
  company_id?: string | null
215
228
  created_at?: string
216
229
  email?: string
@@ -236,6 +249,13 @@ export type Database = {
236
249
  updated_at?: string
237
250
  }
238
251
  Relationships: [
252
+ {
253
+ foreignKeyName: "acq_contacts_client_id_fkey"
254
+ columns: ["client_id"]
255
+ isOneToOne: false
256
+ referencedRelation: "clients"
257
+ referencedColumns: ["id"]
258
+ },
239
259
  {
240
260
  foreignKeyName: "acq_contacts_company_id_fkey"
241
261
  columns: ["company_id"]
@@ -479,8 +499,10 @@ export type Database = {
479
499
  acq_deals: {
480
500
  Row: {
481
501
  activity_log: Json
502
+ client_id: string | null
482
503
  closed_lost_at: string | null
483
504
  closed_lost_reason: string | null
505
+ company_id: string | null
484
506
  contact_email: string
485
507
  contact_id: string | null
486
508
  created_at: string
@@ -516,8 +538,10 @@ export type Database = {
516
538
  }
517
539
  Insert: {
518
540
  activity_log?: Json
541
+ client_id?: string | null
519
542
  closed_lost_at?: string | null
520
543
  closed_lost_reason?: string | null
544
+ company_id?: string | null
521
545
  contact_email: string
522
546
  contact_id?: string | null
523
547
  created_at?: string
@@ -553,8 +577,10 @@ export type Database = {
553
577
  }
554
578
  Update: {
555
579
  activity_log?: Json
580
+ client_id?: string | null
556
581
  closed_lost_at?: string | null
557
582
  closed_lost_reason?: string | null
583
+ company_id?: string | null
558
584
  contact_email?: string
559
585
  contact_id?: string | null
560
586
  created_at?: string
@@ -589,6 +615,20 @@ export type Database = {
589
615
  updated_at?: string
590
616
  }
591
617
  Relationships: [
618
+ {
619
+ foreignKeyName: "acq_deals_client_id_fkey"
620
+ columns: ["client_id"]
621
+ isOneToOne: false
622
+ referencedRelation: "clients"
623
+ referencedColumns: ["id"]
624
+ },
625
+ {
626
+ foreignKeyName: "acq_deals_company_id_fkey"
627
+ columns: ["company_id"]
628
+ isOneToOne: false
629
+ referencedRelation: "acq_companies"
630
+ referencedColumns: ["id"]
631
+ },
592
632
  {
593
633
  foreignKeyName: "acq_deals_contact_id_fkey"
594
634
  columns: ["contact_id"]
@@ -1206,6 +1246,77 @@ export type Database = {
1206
1246
  },
1207
1247
  ]
1208
1248
  }
1249
+ clients: {
1250
+ Row: {
1251
+ converted_at: string | null
1252
+ created_at: string
1253
+ id: string
1254
+ metadata: Json
1255
+ name: string
1256
+ organization_id: string
1257
+ primary_company_id: string | null
1258
+ primary_contact_id: string | null
1259
+ source_deal_id: string | null
1260
+ status: string
1261
+ updated_at: string
1262
+ }
1263
+ Insert: {
1264
+ converted_at?: string | null
1265
+ created_at?: string
1266
+ id?: string
1267
+ metadata?: Json
1268
+ name: string
1269
+ organization_id: string
1270
+ primary_company_id?: string | null
1271
+ primary_contact_id?: string | null
1272
+ source_deal_id?: string | null
1273
+ status?: string
1274
+ updated_at?: string
1275
+ }
1276
+ Update: {
1277
+ converted_at?: string | null
1278
+ created_at?: string
1279
+ id?: string
1280
+ metadata?: Json
1281
+ name?: string
1282
+ organization_id?: string
1283
+ primary_company_id?: string | null
1284
+ primary_contact_id?: string | null
1285
+ source_deal_id?: string | null
1286
+ status?: string
1287
+ updated_at?: string
1288
+ }
1289
+ Relationships: [
1290
+ {
1291
+ foreignKeyName: "clients_organization_id_fkey"
1292
+ columns: ["organization_id"]
1293
+ isOneToOne: false
1294
+ referencedRelation: "organizations"
1295
+ referencedColumns: ["id"]
1296
+ },
1297
+ {
1298
+ foreignKeyName: "clients_primary_company_id_fkey"
1299
+ columns: ["primary_company_id"]
1300
+ isOneToOne: false
1301
+ referencedRelation: "acq_companies"
1302
+ referencedColumns: ["id"]
1303
+ },
1304
+ {
1305
+ foreignKeyName: "clients_primary_contact_id_fkey"
1306
+ columns: ["primary_contact_id"]
1307
+ isOneToOne: false
1308
+ referencedRelation: "acq_contacts"
1309
+ referencedColumns: ["id"]
1310
+ },
1311
+ {
1312
+ foreignKeyName: "clients_source_deal_id_fkey"
1313
+ columns: ["source_deal_id"]
1314
+ isOneToOne: false
1315
+ referencedRelation: "acq_deals"
1316
+ referencedColumns: ["id"]
1317
+ },
1318
+ ]
1319
+ }
1209
1320
  command_queue: {
1210
1321
  Row: {
1211
1322
  action_payload: Json | null
@@ -2175,6 +2286,7 @@ export type Database = {
2175
2286
  Row: {
2176
2287
  actual_end_date: string | null
2177
2288
  client_company_id: string | null
2289
+ client_id: string | null
2178
2290
  contract_value: number | null
2179
2291
  created_at: string
2180
2292
  deal_id: string | null
@@ -2192,6 +2304,7 @@ export type Database = {
2192
2304
  Insert: {
2193
2305
  actual_end_date?: string | null
2194
2306
  client_company_id?: string | null
2307
+ client_id?: string | null
2195
2308
  contract_value?: number | null
2196
2309
  created_at?: string
2197
2310
  deal_id?: string | null
@@ -2209,6 +2322,7 @@ export type Database = {
2209
2322
  Update: {
2210
2323
  actual_end_date?: string | null
2211
2324
  client_company_id?: string | null
2325
+ client_id?: string | null
2212
2326
  contract_value?: number | null
2213
2327
  created_at?: string
2214
2328
  deal_id?: string | null
@@ -2245,6 +2359,13 @@ export type Database = {
2245
2359
  referencedRelation: "acq_companies"
2246
2360
  referencedColumns: ["id"]
2247
2361
  },
2362
+ {
2363
+ foreignKeyName: "prj_projects_client_id_fkey"
2364
+ columns: ["client_id"]
2365
+ isOneToOne: false
2366
+ referencedRelation: "clients"
2367
+ referencedColumns: ["id"]
2368
+ },
2248
2369
  {
2249
2370
  foreignKeyName: "prj_projects_deal_id_fkey"
2250
2371
  columns: ["deal_id"]