@elevasis/sdk 1.21.0 → 1.22.1

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 (160) hide show
  1. package/dist/cli.cjs +1239 -173
  2. package/dist/index.d.ts +1752 -464
  3. package/dist/index.js +3477 -143
  4. package/dist/node/index.d.ts +1 -0
  5. package/dist/node/index.js +19 -1
  6. package/dist/test-utils/index.d.ts +1188 -127
  7. package/dist/test-utils/index.js +3359 -152
  8. package/dist/worker/index.js +3148 -80
  9. package/package.json +2 -2
  10. package/reference/claude-config/hooks/post-edit-validate.mjs +98 -98
  11. package/reference/claude-config/hooks/scaffold-registry-reminder.mjs +188 -188
  12. package/reference/claude-config/hooks/tool-failure-recovery.mjs +73 -73
  13. package/reference/claude-config/registries/graph-skills.json +4 -4
  14. package/reference/claude-config/registries/knowledge-flags.json +0 -2
  15. package/reference/claude-config/rules/active-change-index.md +80 -80
  16. package/reference/claude-config/rules/agent-start-here.md +277 -277
  17. package/reference/claude-config/rules/deployment.md +57 -57
  18. package/reference/claude-config/rules/error-handling.md +56 -56
  19. package/reference/claude-config/rules/execution.md +40 -40
  20. package/reference/claude-config/rules/frontend.md +4 -4
  21. package/reference/claude-config/rules/observability.md +31 -31
  22. package/reference/claude-config/rules/operations.md +29 -17
  23. package/reference/claude-config/rules/organization-model.md +113 -81
  24. package/reference/claude-config/rules/organization-os.md +115 -113
  25. package/reference/claude-config/rules/package-taxonomy.md +33 -33
  26. package/reference/claude-config/rules/platform.md +42 -42
  27. package/reference/claude-config/rules/shared-types.md +49 -46
  28. package/reference/claude-config/rules/task-tracking.md +47 -47
  29. package/reference/claude-config/rules/ui.md +200 -200
  30. package/reference/claude-config/rules/vibe.md +235 -235
  31. package/reference/claude-config/scripts/statusline-command.js +18 -18
  32. package/reference/claude-config/settings.json +34 -34
  33. package/reference/claude-config/skills/deploy/{SKILL.md → skill.md} +156 -156
  34. package/reference/claude-config/skills/dsp/SKILL.md +66 -66
  35. package/reference/claude-config/skills/elevasis/SKILL.md +235 -235
  36. package/reference/claude-config/skills/explore/SKILL.md +6 -6
  37. package/reference/claude-config/skills/git-sync/SKILL.md +126 -126
  38. package/reference/claude-config/skills/knowledge/SKILL.md +314 -299
  39. package/reference/claude-config/skills/knowledge/operations/codify-level-a.md +100 -100
  40. package/reference/claude-config/skills/knowledge/operations/codify-level-b.md +159 -159
  41. package/reference/claude-config/skills/knowledge/operations/customers.md +109 -109
  42. package/reference/claude-config/skills/knowledge/operations/features.md +76 -76
  43. package/reference/claude-config/skills/knowledge/operations/goals.md +118 -118
  44. package/reference/claude-config/skills/knowledge/operations/identity.md +93 -93
  45. package/reference/claude-config/skills/knowledge/operations/labels.md +94 -94
  46. package/reference/claude-config/skills/knowledge/operations/offerings.md +109 -109
  47. package/reference/claude-config/skills/knowledge/operations/roles.md +99 -99
  48. package/reference/claude-config/skills/knowledge/operations/techStack.md +30 -30
  49. package/reference/claude-config/skills/project/SKILL.md +1088 -1088
  50. package/reference/claude-config/skills/run-ui/SKILL.md +73 -73
  51. package/reference/claude-config/skills/save/SKILL.md +3 -3
  52. package/reference/claude-config/skills/setup/SKILL.md +275 -275
  53. package/reference/claude-config/skills/status/SKILL.md +59 -59
  54. package/reference/claude-config/skills/submit-request/SKILL.md +180 -180
  55. package/reference/claude-config/skills/sync/SKILL.md +47 -47
  56. package/reference/claude-config/skills/tutorial/SKILL.md +259 -259
  57. package/reference/claude-config/skills/tutorial/progress-template.md +74 -74
  58. package/reference/claude-config/skills/tutorial/technical.md +1303 -1303
  59. package/reference/claude-config/skills/tutorial/vibe-coder.md +890 -890
  60. package/reference/claude-config/sync-notes/2026-04-22-git-sync-and-sync-notes.md +27 -27
  61. package/reference/claude-config/sync-notes/2026-04-22-lead-gen-deliverability-removal.md +30 -30
  62. package/reference/claude-config/sync-notes/2026-04-24-test-utils-and-template-tests.md +73 -73
  63. package/reference/claude-config/sync-notes/2026-04-24-ui-consolidation-and-sdk-cli-train.md +86 -86
  64. package/reference/claude-config/sync-notes/2026-04-25-auth-role-system-and-settings-roles.md +55 -55
  65. package/reference/claude-config/sync-notes/2026-04-27-crm-hitl-action-layer-cutover.md +97 -97
  66. package/reference/claude-config/sync-notes/2026-04-27-lead-gen-substrate-train.md +112 -112
  67. package/reference/claude-config/sync-notes/2026-04-29-crm-state-and-lead-gen-processing-status.md +93 -93
  68. package/reference/claude-config/sync-notes/2026-05-02-crm-ownership-next-action.md +58 -58
  69. package/reference/claude-config/sync-notes/2026-05-02-template-hardcode-workos-config.md +56 -56
  70. package/reference/claude-config/sync-notes/2026-05-04-elevasis-workspace.md +71 -71
  71. package/reference/claude-config/sync-notes/2026-05-04-knowledge-bundle.md +83 -83
  72. package/reference/claude-config/sync-notes/2026-05-04-template-skills-run-ui-and-tutorial.md +59 -59
  73. package/reference/claude-config/sync-notes/2026-05-05-list-builder.md +42 -42
  74. package/reference/claude-config/sync-notes/2026-05-06-crm-spine.md +60 -60
  75. package/reference/claude-config/sync-notes/2026-05-06-sdk-changes-release-train.md +37 -37
  76. package/reference/claude-config/sync-notes/2026-05-07-sdk-changes-release-train.md +34 -34
  77. package/reference/claude-config/sync-notes/2026-05-08-resource-governance-scaffold-guidance.md +38 -38
  78. package/reference/claude-config/sync-notes/2026-05-09-clients-domain.md +32 -32
  79. package/reference/claude-config/sync-notes/2026-05-09-command-system.md +33 -33
  80. package/reference/claude-config/sync-notes/2026-05-09-resource-governance-and-misc.md +69 -69
  81. package/reference/claude-config/sync-notes/2026-05-12-sdk-ready-release-train.md +30 -30
  82. package/reference/claude-config/sync-notes/2026-05-14-organization-model-ontology-refactor.md +45 -0
  83. package/reference/claude-config/sync-notes/README.md +43 -43
  84. package/reference/cli.mdx +808 -808
  85. package/reference/concepts.mdx +146 -146
  86. package/reference/deployment/api.mdx +297 -297
  87. package/reference/deployment/command-center.mdx +209 -209
  88. package/reference/deployment/index.mdx +195 -195
  89. package/reference/deployment/provided-features.mdx +107 -107
  90. package/reference/deployment/ui-execution.mdx +250 -250
  91. package/reference/examples/organization-model.ts +171 -84
  92. package/reference/framework/agent.mdx +156 -156
  93. package/reference/framework/index.mdx +195 -195
  94. package/reference/framework/interaction-guidance.mdx +182 -182
  95. package/reference/framework/memory.mdx +326 -326
  96. package/reference/framework/project-structure.mdx +282 -282
  97. package/reference/framework/tutorial-system.mdx +135 -135
  98. package/reference/getting-started.mdx +142 -142
  99. package/reference/index.mdx +106 -106
  100. package/reference/packages/core/src/README.md +14 -14
  101. package/reference/packages/core/src/business/README.md +2 -2
  102. package/reference/packages/core/src/knowledge/README.md +32 -32
  103. package/reference/packages/core/src/organization-model/README.md +149 -149
  104. package/reference/packages/core/src/test-utils/README.md +37 -37
  105. package/reference/packages/ui/src/api/README.md +18 -18
  106. package/reference/packages/ui/src/app/README.md +24 -24
  107. package/reference/packages/ui/src/auth/README.md +18 -18
  108. package/reference/packages/ui/src/components/README.md +24 -24
  109. package/reference/packages/ui/src/execution/README.md +16 -16
  110. package/reference/packages/ui/src/features/README.md +28 -28
  111. package/reference/packages/ui/src/graph/README.md +16 -16
  112. package/reference/packages/ui/src/hooks/README.md +23 -23
  113. package/reference/packages/ui/src/initialization/README.md +19 -19
  114. package/reference/packages/ui/src/knowledge/README.md +31 -31
  115. package/reference/packages/ui/src/organization/README.md +18 -18
  116. package/reference/packages/ui/src/profile/README.md +19 -19
  117. package/reference/packages/ui/src/provider/README.md +32 -32
  118. package/reference/packages/ui/src/router/README.md +18 -18
  119. package/reference/packages/ui/src/sse/README.md +13 -13
  120. package/reference/packages/ui/src/test-utils/README.md +7 -7
  121. package/reference/packages/ui/src/theme/README.md +23 -23
  122. package/reference/packages/ui/src/theme/presets/README.md +19 -19
  123. package/reference/packages/ui/src/types/README.md +16 -16
  124. package/reference/packages/ui/src/utils/README.md +18 -18
  125. package/reference/packages/ui/src/zustand/README.md +18 -18
  126. package/reference/platform-tools/adapters-integration.mdx +301 -301
  127. package/reference/platform-tools/adapters-platform.mdx +553 -553
  128. package/reference/platform-tools/index.mdx +217 -217
  129. package/reference/platform-tools/type-safety.mdx +82 -82
  130. package/reference/resources/index.mdx +349 -349
  131. package/reference/resources/patterns.mdx +449 -449
  132. package/reference/resources/types.mdx +116 -116
  133. package/reference/roadmap.mdx +165 -165
  134. package/reference/runtime.mdx +173 -173
  135. package/reference/scaffold/core/organization-graph.mdx +110 -90
  136. package/reference/scaffold/core/organization-model.mdx +225 -213
  137. package/reference/scaffold/index.mdx +67 -67
  138. package/reference/scaffold/operations/propagation-pipeline.md +77 -77
  139. package/reference/scaffold/operations/scaffold-maintenance.md +12 -12
  140. package/reference/scaffold/operations/workflow-recipes.md +138 -138
  141. package/reference/scaffold/recipes/add-a-feature.md +307 -85
  142. package/reference/scaffold/recipes/add-a-resource.md +137 -103
  143. package/reference/scaffold/recipes/customize-knowledge-browser.md +5 -5
  144. package/reference/scaffold/recipes/customize-organization-model.md +275 -138
  145. package/reference/scaffold/recipes/extend-a-base-entity.md +8 -8
  146. package/reference/scaffold/recipes/extend-crm.md +3 -3
  147. package/reference/scaffold/recipes/extend-lead-gen.md +394 -394
  148. package/reference/scaffold/recipes/gate-by-feature-or-admin.md +118 -118
  149. package/reference/scaffold/recipes/index.md +46 -46
  150. package/reference/scaffold/recipes/query-the-knowledge-graph.md +197 -170
  151. package/reference/scaffold/reference/contracts.md +2136 -2093
  152. package/reference/scaffold/reference/glossary.md +76 -76
  153. package/reference/scaffold/ui/composition-extensibility.mdx +233 -233
  154. package/reference/scaffold/ui/customization.md +243 -243
  155. package/reference/scaffold/ui/feature-flags-and-gating.md +46 -46
  156. package/reference/scaffold/ui/feature-shell.mdx +72 -72
  157. package/reference/scaffold/ui/recipes.md +221 -214
  158. package/reference/spine/spine-primer.md +96 -96
  159. package/reference/templates/index.mdx +47 -47
  160. package/reference/troubleshooting.mdx +223 -223
@@ -1,187 +1,324 @@
1
1
  <!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
2
2
  <!-- Regenerate: pnpm scaffold:sync -->
3
3
 
4
- ---
5
- title: Customize organization-model.ts
6
- description: Annotated walkthrough for customizing the System-backed Organization Model in template-derived projects.
7
- ---
8
-
9
- # Customize organization-model.ts
4
+ ---
5
+ title: Customize organization-model.ts
6
+ description: Annotated walkthrough for customizing the System-backed Organization Model in template-derived projects.
7
+ ---
8
+
9
+ # Customize organization-model.ts
10
+
11
+ `core/config/organization-model.ts` is the semantic contract between the UI shell and platform operations. The shell reads the id-keyed `systems` map for semantic ownership and access, reads `navigation.sidebar` for shell navigation, and binds resources through the id-keyed `resources` map.
12
+
13
+ ## Imports
14
+
15
+ ```ts
16
+ import {
17
+ createFoundationOrganizationModel,
18
+ defineOrganizationModel,
19
+ type OrganizationModel
20
+ } from '@elevasis/core/organization-model'
21
+ ```
22
+
23
+ - `defineOrganizationModel` gives a typed override shape.
24
+ - `createFoundationOrganizationModel` resolves defaults and returns the canonical model plus UI-facing helpers.
25
+ - `OrganizationModel` is the fully resolved model type.
26
+
27
+ ## Systems
28
+
29
+ The `systems` map is the source of truth for semantic hierarchy, lifecycle, admin visibility, and governed ownership.
30
+
31
+ ```ts
32
+ const override = defineOrganizationModel({
33
+ systems: {
34
+ dashboard: {
35
+ id: 'dashboard',
36
+ order: 10,
37
+ label: 'Dashboard',
38
+ lifecycle: 'active',
39
+ description: 'Command Center home'
40
+ },
41
+ sales: {
42
+ id: 'sales',
43
+ order: 20,
44
+ label: 'Sales',
45
+ lifecycle: 'active'
46
+ },
47
+ 'sales.crm': {
48
+ id: 'sales.crm',
49
+ order: 30,
50
+ label: 'CRM',
51
+ parentSystemId: 'sales',
52
+ lifecycle: 'active',
53
+ description: 'CRM pipeline and deal operations'
54
+ }
55
+ },
56
+ navigation: {
57
+ sidebar: {
58
+ primary: {
59
+ dashboard: {
60
+ type: 'surface',
61
+ order: 10,
62
+ label: 'Dashboard',
63
+ path: '/',
64
+ surfaceType: 'dashboard',
65
+ icon: 'feature.dashboard',
66
+ targets: { systems: ['dashboard'] }
67
+ },
68
+ business: {
69
+ type: 'group',
70
+ order: 20,
71
+ label: 'Business',
72
+ children: {
73
+ crm: {
74
+ type: 'surface',
75
+ order: 10,
76
+ label: 'CRM',
77
+ path: '/crm',
78
+ surfaceType: 'page',
79
+ targets: { systems: ['sales.crm'] }
80
+ }
81
+ }
82
+ }
83
+ },
84
+ bottom: {}
85
+ }
86
+ }
87
+ })
88
+ ```
89
+
90
+ System field reference:
91
+
92
+ - `id` -- lowercase dotted path. Parent Systems are inferred from prefix segments or declared through `parentSystemId`.
93
+ - `order` -- deterministic map iteration order. Use multiples of 10 for easy insertion.
94
+ - `label` -- sidebar and breadcrumb label.
95
+ - `description` -- optional settings/help text.
96
+ - `kind` -- product, operational, platform, or diagnostic.
97
+ - `parentSystemId` -- explicit parent System link.
98
+ - `lifecycle` -- draft, beta, active, deprecated, or archived.
99
+ - `ui` -- optional route metadata used by shell matching during migration.
100
+ - `requiresAdmin` -- hides the node for non-admin members; descendants inherit it.
101
+ - `actions` / `policies` -- references to cross-cutting domains.
102
+ - `ontology` -- System-owned object, link, action, catalog, event, surface, interface, value-type, property, or group records.
103
+ - `config` -- JSON-serializable settings local to this System.
104
+ - `systems` -- nested child Systems. Use this for new recursive authoring; `subsystems` is a compatibility alias only.
10
105
 
11
- `core/config/organization-model.ts` is the semantic contract between the UI shell and platform operations. The shell reads the id-keyed `systems` map for semantic ownership and access, reads `navigation.sidebar` for shell navigation, and binds resources through the id-keyed `resources` map.
106
+ ## Ontology
12
107
 
13
- ## Imports
108
+ Use top-level `ontology` for global/shared primitives and `System.ontology` for owned contracts. The resolved ontology index is compiled from root and System scopes and validated for ID shape, kind mismatch, and duplicate IDs.
14
109
 
15
110
  ```ts
16
- import {
17
- createFoundationOrganizationModel,
18
- defineOrganizationModel,
19
- type OrganizationModel
20
- } from '@elevasis/core/organization-model'
111
+ const override = defineOrganizationModel({
112
+ ontology: {
113
+ valueTypes: {
114
+ 'global:value-type/text': {
115
+ id: 'global:value-type/text',
116
+ label: 'Text'
117
+ }
118
+ }
119
+ },
120
+ systems: {
121
+ sales: {
122
+ id: 'sales',
123
+ order: 20,
124
+ label: 'Sales',
125
+ lifecycle: 'active',
126
+ systems: {
127
+ crm: {
128
+ id: 'sales.crm',
129
+ order: 30,
130
+ label: 'CRM',
131
+ parentSystemId: 'sales',
132
+ lifecycle: 'active',
133
+ ontology: {
134
+ objectTypes: {
135
+ 'sales.crm:object/deal': {
136
+ id: 'sales.crm:object/deal',
137
+ label: 'Deal',
138
+ ownerSystemId: 'sales.crm'
139
+ }
140
+ },
141
+ actionTypes: {
142
+ 'sales.crm:action/deal.update-stage': {
143
+ id: 'sales.crm:action/deal.update-stage',
144
+ label: 'Update Deal Stage',
145
+ ownerSystemId: 'sales.crm',
146
+ actsOn: ['sales.crm:object/deal']
147
+ }
148
+ }
149
+ }
150
+ }
151
+ }
152
+ }
153
+ }
154
+ })
21
155
  ```
22
156
 
23
- - `defineOrganizationModel` gives a typed override shape.
24
- - `createFoundationOrganizationModel` resolves defaults and returns the canonical model plus UI-facing helpers.
25
- - `OrganizationModel` is the fully resolved model type.
157
+ Top-level `entities`, top-level `actions`, and `System.content kind: "schema"` remain accepted for existing consumers and are projected into compiled ontology indexes. Prefer `System.ontology` for new object/action/catalog contracts.
26
158
 
27
- ## Systems
159
+ ## System Config
28
160
 
29
- The `systems` map is the source of truth for semantic hierarchy, lifecycle, admin visibility, and governed ownership.
161
+ Use `systems[*].config` for local settings and defaults that are not semantic contracts:
30
162
 
31
163
  ```ts
32
164
  const override = defineOrganizationModel({
33
165
  systems: {
34
- dashboard: {
35
- id: 'dashboard',
36
- order: 10,
37
- label: 'Dashboard',
38
- lifecycle: 'active',
39
- description: 'Command Center home'
40
- },
41
166
  sales: {
42
167
  id: 'sales',
43
168
  order: 20,
44
169
  label: 'Sales',
45
- lifecycle: 'active'
46
- },
47
- 'sales.crm': {
48
- id: 'sales.crm',
49
- order: 30,
50
- label: 'CRM',
51
- parentSystemId: 'sales',
52
170
  lifecycle: 'active',
53
- description: 'CRM pipeline and deal operations'
54
- }
55
- },
56
- navigation: {
57
- sidebar: {
58
- primary: {
59
- dashboard: {
60
- type: 'surface',
61
- order: 10,
62
- label: 'Dashboard',
63
- path: '/',
64
- surfaceType: 'dashboard',
65
- icon: 'feature.dashboard',
66
- targets: { systems: ['dashboard'] }
67
- },
68
- business: {
69
- type: 'group',
70
- order: 20,
71
- label: 'Business',
72
- children: {
73
- crm: {
74
- type: 'surface',
75
- order: 10,
76
- label: 'CRM',
77
- path: '/crm',
78
- surfaceType: 'page',
79
- targets: { systems: ['sales.crm'] }
171
+ systems: {
172
+ crm: {
173
+ id: 'sales.crm',
174
+ order: 30,
175
+ label: 'CRM',
176
+ parentSystemId: 'sales',
177
+ lifecycle: 'active',
178
+ config: {
179
+ defaultPipelineId: 'sales.crm:catalog/pipeline',
180
+ kanban: {
181
+ groupBy: 'stage',
182
+ showProbability: true
80
183
  }
81
184
  }
82
185
  }
83
- },
84
- bottom: {}
186
+ }
85
187
  }
86
188
  }
87
189
  })
88
190
  ```
89
191
 
90
- System field reference:
91
-
92
- - `id` -- lowercase dotted path. Parent Systems are inferred from prefix segments or declared through `parentSystemId`.
93
- - `order` -- deterministic map iteration order. Use multiples of 10 for easy insertion.
94
- - `label` -- sidebar and breadcrumb label.
95
- - `description` -- optional settings/help text.
96
- - `kind` -- product, operational, platform, or diagnostic.
97
- - `parentSystemId` -- explicit parent System link.
98
- - `lifecycle` -- draft, beta, active, deprecated, or archived.
99
- - `ui` -- optional route metadata used by shell matching during migration.
100
- - `requiresAdmin` -- hides the node for non-admin members; descendants inherit it.
101
- - `actions` / `policies` -- references to cross-cutting domains.
102
-
103
- ## Sidebar Navigation
104
-
105
- Author shell navigation under `navigation.sidebar`. Groups can contain nested nodes; routeable surface leaves provide `path`, `surfaceType`, and `targets`. Dashboard should appear before Business, Business is a navigation group only, and `/clients` is the canonical clients route.
106
-
107
- ## Resource Binding
108
-
109
- Resource identity and governance metadata live in `OrganizationModel` under `resources`. Workflows, agents, integrations, and scripts import those descriptors and derive runtime `resourceId` / `type` from them. The graph derives System membership from `ResourceEntry.systemPath`.
110
-
111
- ```ts
112
- // core/config/organization-model.ts
113
- import { defineResources } from '@elevasis/core/organization-model'
114
-
192
+ Keep semantic nouns, verbs, relationships, events, catalogs, interfaces, and value types in ontology. Keep secrets, credentials, per-run execution state, logs, and external service state outside the Organization Model.
193
+
194
+ ## Sidebar Navigation
195
+
196
+ Author shell navigation under `navigation.sidebar`. Groups can contain nested nodes; routeable surface leaves provide `path`, `surfaceType`, and `targets`. Dashboard should appear before Business, Business is a navigation group only, and `/clients` is the canonical clients route.
197
+
198
+ ## Resource Binding
199
+
200
+ Resource identity and governance metadata live in `OrganizationModel` under `resources`. Workflows, agents, integrations, and scripts import those descriptors and derive runtime `resourceId` / `type` from them. The graph derives System membership from `ResourceEntry.systemPath`.
201
+
202
+ ```ts
203
+ // core/config/organization-model.ts
204
+ import { defineResources } from '@elevasis/core/organization-model'
205
+
115
206
  export const resourceDescriptors = defineResources({
116
207
  leadImport: {
117
208
  id: 'lead-import',
209
+ title: 'Lead Import',
210
+ description: 'Updates CRM deal stage data from imported lead records.',
118
211
  order: 10,
119
212
  kind: 'workflow',
120
213
  systemPath: 'sales.crm',
121
214
  ownerRoleId: 'role-ops-lead',
122
- status: 'active'
215
+ status: 'active',
216
+ ontology: {
217
+ actions: ['sales.crm:action/deal.update-stage'],
218
+ primaryAction: 'sales.crm:action/deal.update-stage',
219
+ reads: ['sales.crm:object/deal'],
220
+ writes: ['sales.crm:object/deal'],
221
+ usesCatalogs: ['sales.crm:catalog/pipeline'],
222
+ emits: ['sales.crm:event/deal-stage-updated']
223
+ }
123
224
  }
124
225
  })
226
+
227
+ // operations/src/lead-import/index.ts
228
+ config: {
229
+ resource: resourceDescriptors.leadImport,
230
+ resourceId: resourceDescriptors.leadImport.id,
231
+ name: 'Lead Import',
232
+ type: resourceDescriptors.leadImport.kind,
233
+ version: '1.0.0',
234
+ status: 'prod',
235
+ category: 'production'
236
+ }
237
+ ```
238
+
239
+ Use kind-prefixed graph IDs for cross-collection links:
240
+
241
+ - `system:sales.crm`
242
+ - `integration:instantly`
243
+ - `resource:lead-import`
244
+ - `action:operations.queue.review`
245
+
246
+ `category` is one of `production`, `diagnostic`, `internal`, or `testing`.
125
247
 
126
- // operations/src/lead-import/index.ts
127
- config: {
128
- resource: resourceDescriptors.leadImport,
129
- resourceId: resourceDescriptors.leadImport.id,
130
- name: 'Lead Import',
131
- type: resourceDescriptors.leadImport.kind,
132
- version: '1.0.0',
133
- status: 'prod',
134
- category: 'production'
135
- }
136
- ```
137
-
138
- Use kind-prefixed graph IDs for cross-collection links:
139
-
140
- - `system:sales.crm`
141
- - `integration:instantly`
142
- - `resource:lead-import`
143
- - `action:operations.queue.review`
248
+ Descriptor `title` and `description` own executable display metadata. Use nested `resource.ontology` bindings to declare which ontology actions, objects, catalogs, and events the resource performs, reads, writes, uses, or emits. `resource.ontology.primaryAction` names the default/selectable action and must be included in `resource.ontology.actions`. Resource event emissions can still be declared through top-level `emits` for older descriptors, but new descriptors should use `resource.ontology.emits`.
144
249
 
145
- `category` is one of `production`, `diagnostic`, `internal`, or `testing`.
250
+ ## Compatibility Domain Mirrors
146
251
 
147
- ## Domain Config
252
+ The old `sales`, `prospecting`, and `projects` top-level keys are not part of the current primary Organization Model schema. If an older local project still has bridge-era examples for those concepts, migrate the data toward owning Systems:
148
253
 
149
- The `sales`, `prospecting`, and `projects` top-level keys configure business semantics such as pipeline stages, entity IDs, and status vocabularies. They are not shell navigation.
254
+ - durable objects -> `System.ontology.objectTypes`
255
+ - stable verbs -> `System.ontology.actionTypes`
256
+ - pipelines, stages, templates, and status vocabularies -> `System.ontology.catalogTypes`
257
+ - local settings and defaults -> `System.config`
258
+ - existing `System.content kind: "schema"` nodes -> compatibility catalog projections
150
259
 
151
260
  ```ts
152
- sales: {
153
- entityId: 'crm.deal',
154
- defaultPipelineId: 'default',
155
- pipelines: [
156
- {
157
- id: 'default',
158
- label: 'Default Pipeline',
159
- entityId: 'crm.deal',
160
- stages: [
161
- { id: 'interested', label: 'Interested', color: 'blue', order: 1, semanticClass: 'open' },
162
- { id: 'closed_won', label: 'Closed Won', color: 'green', order: 4, semanticClass: 'closed_won' }
163
- ]
261
+ systems: {
262
+ sales: {
263
+ id: 'sales',
264
+ order: 20,
265
+ label: 'Sales',
266
+ lifecycle: 'active',
267
+ systems: {
268
+ crm: {
269
+ id: 'sales.crm',
270
+ order: 30,
271
+ label: 'CRM',
272
+ lifecycle: 'active',
273
+ parentSystemId: 'sales',
274
+ ontology: {
275
+ catalogTypes: {
276
+ 'sales.crm:catalog/pipeline': {
277
+ id: 'sales.crm:catalog/pipeline',
278
+ label: 'Default Pipeline',
279
+ kind: 'pipeline',
280
+ ownerSystemId: 'sales.crm',
281
+ entries: {
282
+ interested: { label: 'Interested', color: 'blue', order: 10, semanticClass: 'open' },
283
+ closed_won: { label: 'Closed Won', color: 'green', order: 20, semanticClass: 'closed_won' }
284
+ }
285
+ }
286
+ }
287
+ }
288
+ }
164
289
  }
165
- ]
290
+ }
166
291
  }
167
292
  ```
168
-
293
+
169
294
  Keep `semanticClass` values stable; platform analytics and triggers depend on them.
170
295
 
171
- ## Export Pattern
172
-
173
- ```ts
174
- const foundation = createFoundationOrganizationModel(override)
175
-
176
- export const canonicalOrganizationModel: OrganizationModel = foundation.canonical
177
- export const organizationModel = foundation.model
178
- export const { getOrganizationSurface } = foundation
296
+ Policy and role integration remains outside ontology in this pass. Use `roles`, `policies`, `responsibleRoleId`, and `ownerRoleId` for accountability and access semantics until a dedicated policy/role ontology design is published.
297
+
298
+ ## Export Pattern
299
+
300
+ ```ts
301
+ const foundation = createFoundationOrganizationModel(override)
302
+
303
+ export const canonicalOrganizationModel: OrganizationModel = foundation.canonical
304
+ export const organizationModel = foundation.model
305
+ export const { getOrganizationSurface } = foundation
306
+ ```
307
+
308
+ Pass `canonicalOrganizationModel` to `ElevasisSystemsProvider` in `ui/src/routes/__root.tsx`.
309
+
310
+ ## Resolve Behavior
311
+
312
+ `createFoundationOrganizationModel(override)` resolves defaults, validates System hierarchy, and exposes helper functions used by the shell. Id-keyed domain maps merge additively by key, so tenant overrides can add one System or resource without re-authoring every default entry.
313
+
314
+ Validation catches duplicate System IDs, missing parent Systems, invalid graph IDs, invalid UI paths, invalid ontology IDs, ontology kind mismatches, and duplicate ontology IDs.
315
+
316
+ ## Refresh Generated Scaffold Copies
317
+
318
+ This file is source guidance for generated SDK reference copies. After changing Organization Model scaffold docs, refresh and verify generated outputs from the monorepo root:
319
+
320
+ ```bash
321
+ pnpm scaffold:sync
322
+ pnpm scaffold:verify
323
+ pnpm verify:scaffold-reference
179
324
  ```
180
-
181
- Pass `canonicalOrganizationModel` to `ElevasisSystemsProvider` in `ui/src/routes/__root.tsx`.
182
-
183
- ## Resolve Behavior
184
-
185
- `createFoundationOrganizationModel(override)` resolves defaults, validates System hierarchy, and exposes helper functions used by the shell. Id-keyed domain maps merge additively by key, so tenant overrides can add one System or resource without re-authoring every default entry.
186
-
187
- Validation catches duplicate System IDs, missing parent Systems, invalid graph IDs, and invalid UI paths.
@@ -10,7 +10,7 @@ description: Add project-specific metadata to the canonical entity shapes (Proje
10
10
 
11
11
  Workflows and UI features often operate on domain entities such as projects, deals, companies, or contacts. Rather than each project declaring its own shape from scratch, `@elevasis/core/entities` provides typed base interfaces generic over a `<TMeta>` slot. External projects extend these to add project-specific fields while keeping the canonical shape stable and interoperable with platform tooling.
12
12
 
13
- The canonical demo lives in `core/types/entities.ts` of any scaffold project.
13
+ The canonical demo lives in `core/types/entities.ts` of any scaffold project.
14
14
 
15
15
  ---
16
16
 
@@ -33,7 +33,7 @@ All imports come from `@elevasis/core/entities`.
33
33
 
34
34
  ## Recipe 1 -- Extend a base entity with custom metadata
35
35
 
36
- Place this in `core/types/entities.ts`. This is the primary pattern -- the scaffold template ships this exact example.
36
+ Place this in `core/types/entities.ts`. This is the primary pattern -- the scaffold template ships this exact example.
37
37
 
38
38
  ```ts
39
39
  import { z } from 'zod'
@@ -59,7 +59,7 @@ Key points:
59
59
  - `BaseProjectSchema.extend({ metadata: ... })` merges your metadata Zod schema into the validated shape. Zod handles the rest.
60
60
  - `BaseProject<ProjectMeta>` infers the TypeScript type with your metadata typed correctly.
61
61
  - Only the `metadata` field is extended -- all other base fields (`id`, `organizationId`, `name`, `status`, `createdAt`, `updatedAt`, etc.) are inherited unchanged.
62
- - This file is the single source of truth for entity shapes across `core/`, `operations/`, and `ui/`.
62
+ - This file is the single source of truth for entity shapes across `core/`, `operations/`, and `ui/`.
63
63
 
64
64
  ---
65
65
 
@@ -87,7 +87,7 @@ Workflows that operate on projects or deals should reference the project-local e
87
87
  ```ts
88
88
  import { z } from 'zod'
89
89
  import type { WorkflowDefinition } from '@elevasis/sdk'
90
- import { ProjectSchema } from '@core/types/entities'
90
+ import { ProjectSchema } from '@core/types/entities'
91
91
 
92
92
  export const myWorkflow: WorkflowDefinition = {
93
93
  id: 'my-workflow',
@@ -99,16 +99,16 @@ export const myWorkflow: WorkflowDefinition = {
99
99
  }
100
100
  ```
101
101
 
102
- The `@core/*` alias maps to the `core/` workspace package. This keeps entity contracts in one place and ensures the workflow input type matches whatever the UI passes as the execution payload.
102
+ The `@core/*` alias maps to the `core/` workspace package. This keeps entity contracts in one place and ensures the workflow input type matches whatever the UI passes as the execution payload.
103
103
 
104
104
  ---
105
105
 
106
106
  ## Recipe 4 -- Reference entity types from the UI
107
107
 
108
- UI components accept entity types directly in props. The entity type flows from the `core` package through the component into the workflow execution payload:
108
+ UI components accept entity types directly in props. The entity type flows from the `core` package through the component into the workflow execution payload:
109
109
 
110
110
  ```tsx
111
- import type { Project } from '@core/types/entities'
111
+ import type { Project } from '@core/types/entities'
112
112
 
113
113
  interface ProjectCardProps {
114
114
  project: Project
@@ -130,7 +130,7 @@ When wiring this to a `RunResourceButton`, the entity instance becomes the workf
130
130
 
131
131
  ## Verification
132
132
 
133
- - **Test core contracts:** `pnpm -C core test` runs the Vitest suite. The template ships `core/types/entities.test.ts` as a working smoke-check -- it `safeParse`s a valid project (expects success) and an invalid one (expects failure). Run this after any schema change.
133
+ - **Test core contracts:** `pnpm -C core test` runs the Vitest suite. The template ships `core/types/entities.test.ts` as a working smoke-check -- it `safeParse`s a valid project (expects success) and an invalid one (expects failure). Run this after any schema change.
134
134
  - **Round-trip safeParse:** Call `ProjectSchema.safeParse(candidateObject)` in a test or REPL to confirm the Zod shape accepts the data your workflows and UI will produce.
135
135
  - **Cross-package type check:** `pnpm -C ui build` will surface any TypeScript errors if a UI component or hook passes a mismatched entity type to a workflow input.
136
136
 
@@ -20,7 +20,7 @@ Good trigger phrases:
20
20
 
21
21
  CRM is a layered platform surface, not one component:
22
22
 
23
- - **Organization OS:** System access, sales pipeline semantics, quick access, and labels live in the organization model.
23
+ - **Organization OS:** System access, sales pipeline semantics, quick access, and labels live in the organization model.
24
24
  - **Shared UI:** CRM pages, sidebars, workbench panels, overview widgets, and Kanban/detail components live in `@elevasis/ui`.
25
25
  - **Headless hooks:** deal, company, contact, note, task, list, transition, and action hooks live under `@elevasis/ui/hooks`.
26
26
  - **Action system:** `ActionDef`, `DEFAULT_CRM_ACTIONS`, `deriveActions`, and provider-level `crmActions` configure deal actions.
@@ -31,7 +31,7 @@ CRM is a layered platform surface, not one component:
31
31
 
32
32
  | User wants | Start here | Notes |
33
33
  | --- | --- | --- |
34
- | Change CRM System availability, labels, pipeline stages, or resource descriptors | `core/config/organization-model.ts` | Treat this as Organization OS work. Use the project's configure ceremony if available. |
34
+ | Change CRM System availability, labels, pipeline stages, or resource descriptors | `core/config/organization-model.ts` | Treat this as Organization OS work. Use the project's configure ceremony if available. |
35
35
  | Add CRM sidebar nav or a CRM route | `@elevasis/ui/features/crm` and `node_modules/@elevasis/sdk/reference/scaffold/ui/customization.md` | Prefer manifest/sidebar composition. Do not fork shared source first. |
36
36
  | Wrap a shared CRM page with project chrome | `DealsListPage`, `DealDetailPage`, `CrmOverview` from `@elevasis/ui/features/crm` | Keep route files thin and put project-specific logic in local feature modules. |
37
37
  | Build a custom deal page | `useDealDetail`, `useDealNotes`, `useDealTasks`, `useExecuteAction` from `@elevasis/ui/hooks` | Use hooks for platform data and compose your own UI. |
@@ -225,7 +225,7 @@ Use `crm` for focused CRM deal reads, notes, tasks, activity, and cleanup. Use `
225
225
 
226
226
  ## 5. Customize Pipeline Semantics
227
227
 
228
- CRM System identity is `sales.crm`, but the organization-model domain is `sales`.
228
+ CRM System identity is `sales.crm`, but the organization-model domain is `sales`.
229
229
 
230
230
  For stage labels or stage sets, update the project model:
231
231