@elevasis/sdk 1.10.0 → 1.12.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 (40) hide show
  1. package/dist/cli.cjs +52 -149
  2. package/dist/index.d.ts +468 -198
  3. package/dist/index.js +225 -147
  4. package/dist/test-utils/index.d.ts +272 -99
  5. package/dist/test-utils/index.js +4756 -125
  6. package/dist/types/worker/adapters/llm.d.ts +1 -1
  7. package/dist/worker/index.js +14 -6
  8. package/package.json +2 -2
  9. package/reference/claude-config/rules/agent-start-here.md +14 -14
  10. package/reference/claude-config/skills/configure/SKILL.md +3 -3
  11. package/reference/claude-config/skills/setup/SKILL.md +6 -6
  12. package/reference/claude-config/sync-notes/2026-04-25-auth-role-system-and-settings-roles.md +55 -0
  13. package/reference/claude-config/sync-notes/2026-04-27-crm-hitl-action-layer-cutover.md +101 -0
  14. package/reference/cli.mdx +57 -0
  15. package/reference/deployment/provided-features.mdx +40 -267
  16. package/reference/examples/organization-model.ts +99 -564
  17. package/reference/packages/core/src/organization-model/README.md +102 -97
  18. package/reference/resources/types.mdx +72 -163
  19. package/reference/scaffold/core/organization-graph.mdx +92 -272
  20. package/reference/scaffold/core/organization-model.mdx +155 -320
  21. package/reference/scaffold/index.mdx +3 -0
  22. package/reference/scaffold/operations/propagation-pipeline.md +4 -1
  23. package/reference/scaffold/operations/scaffold-maintenance.md +3 -0
  24. package/reference/scaffold/operations/workflow-recipes.md +13 -10
  25. package/reference/scaffold/recipes/add-a-feature.md +105 -158
  26. package/reference/scaffold/recipes/add-a-resource.md +88 -158
  27. package/reference/scaffold/recipes/customize-organization-model.md +144 -400
  28. package/reference/scaffold/recipes/extend-a-base-entity.md +11 -8
  29. package/reference/scaffold/recipes/gate-by-feature-or-admin.md +117 -158
  30. package/reference/scaffold/recipes/index.md +3 -0
  31. package/reference/scaffold/reference/contracts.md +107 -435
  32. package/reference/scaffold/reference/feature-registry.md +11 -8
  33. package/reference/scaffold/reference/glossary.md +74 -105
  34. package/reference/scaffold/ui/composition-extensibility.mdx +3 -0
  35. package/reference/scaffold/ui/customization.md +3 -0
  36. package/reference/scaffold/ui/feature-flags-and-gating.md +29 -231
  37. package/reference/scaffold/ui/feature-shell.mdx +53 -219
  38. package/reference/scaffold/ui/recipes.md +65 -397
  39. package/reference/claude-config/logs/pre-edit-vibe-gate.log +0 -40
  40. package/reference/claude-config/logs/scaffold-registry-reminder.log +0 -38
@@ -1,320 +1,155 @@
1
- ---
2
- title: Organization Model
3
- description: Organization OS Model layer documentation for the semantic organization contract, covering domains, features, navigation surfaces, resource mappings, and the curated @elevasis/core public API.
4
- ---
5
-
6
- ## Overview
7
-
8
- Within Organization OS, the organization model is the **Model** layer and part of the cross-cutting **Public API** layer. It is the semantic contract that maps an organization's full organizational reality to domains, features, navigation surfaces and groups, domain-specific semantics (sales pipeline, prospecting lifecycle, projects status), and resource mappings. It is schema-first, versioned, and validated.
9
-
10
- The model is authored in `@repo/core` and published as a curated external package `@elevasis/core`. It is consumed by:
11
-
12
- - `@repo/ui`'s feature-shell provider to resolve nav labels, surface paths, and feature state at runtime
13
- - command-center's root shell as its canonical organization model
14
- - `external/_template/foundations` and downstream derivatives as the adapter-backed source of organization truth
15
-
16
- The model does **not** replace the shared feature-provider system. It enriches and constrains it.
17
-
18
- ## Source of Truth
19
-
20
- - `packages/core/src/organization-model/schema.ts` -- `OrganizationModelSchema`
21
- - `packages/core/src/organization-model/types.ts` -- exported TypeScript types
22
- - `packages/core/src/organization-model/defaults.ts` -- `DEFAULT_ORGANIZATION_MODEL`
23
- - `packages/core/src/organization-model/resolve.ts` -- `defineOrganizationModel`, `resolveOrganizationModel`
24
- - `packages/core/src/organization-model/domains/*.ts` -- feature schema, navigation surfaces, sales/prospecting/projects semantics, and the 8 reality domains (identity, customers, offerings, roles, goals, statuses, operations, shared/techStack)
25
- - `packages/core/src/published.ts` -- curated root barrel for the published package
26
- - `packages/core/src/organization-model/published.ts` -- curated organization-model barrel
27
- - `packages/core/src/__tests__/template-foundations-compatibility.test.ts` -- adapter-baseline guard
28
-
29
- ## Contract Shape
30
-
31
- Top-level fields on `OrganizationModel`:
32
-
33
- - `version`
34
- - `features` -- unified feature array (`OrganizationModelFeature[]`); each entry combines access gating, semantic grouping, and display metadata
35
- - `branding` -- display identity (org name, product name, logos)
36
- - `navigation` -- surfaces, groups, `defaultSurfaceId`
37
- - `sales` -- pipeline stages and stage semantics (formerly `crm`)
38
- - `prospecting` -- company/contact lifecycle stages (formerly `leadGen`)
39
- - `projects` -- project/milestone/task statuses (formerly `delivery`)
40
- - `identity` -- legal identity, mission/vision, industry, geography, and temporal anchors
41
- - `customers` -- customer segments with jobs-to-be-done, firmographics, and value propositions
42
- - `offerings` -- products and services with pricing model and segment/feature references
43
- - `roles` -- role chart with responsibilities, reporting lines, and role holders
44
- - `goals` -- organizational goals with period and measurable outcomes
45
- - `statuses` -- flat registry of all status entries across delivery, queue, execution, schedule, and request semantic classes
46
- - `operations` -- catalog of stateful runtime entities (HITL queue, executions, sessions, notifications, schedules)
47
- - `resourceMappings` -- deployable resource links, each optionally extended with `techStack` metadata
48
-
49
- ### Domain Rename Wave
50
-
51
- Three legacy domain names were renamed in the 2026-04-20 expansion to align developer-facing code with user-visible labels:
52
-
53
- | Old name | New name | Notes |
54
- | ---------- | ------------- | ------------------------------------------------------------------------------------ |
55
- | `crm` | `sales` | Domain files, feature IDs, surface IDs, imports, and sidebar labels all updated |
56
- | `leadGen` | `prospecting` | Same scope as above |
57
- | `delivery` | `projects` | Aligns with the "Projects" sidebar label; `projects` feature ID was already in place |
58
-
59
- Any reference to `crm`, `leadGen`, or `delivery` in domain files, imports, or surface IDs should be treated as a historical artifact unless explicitly annotated otherwise.
60
-
61
- ### Branding Shape
62
-
63
- `OrganizationModelBranding` holds display identity for the organization:
64
-
65
- - `organizationName` -- the human-readable org name (required)
66
- - `productName` -- the product label shown in the shell (required)
67
- - `shortName` -- abbreviated name, max 40 chars (required)
68
- - `description` -- optional long-form description
69
- - `logos` -- optional object with `light` and `dark` URL strings (each max 2048 chars); defaults to `{}`
70
-
71
- ### ModelId Format Rules
72
-
73
- All `id` fields, `parentId`, `defaultSurfaceId`, and reference ID arrays use `ModelIdSchema`:
74
-
75
- - Regex: `/^[a-z0-9]+(?:[-._][a-z0-9]+)*$/`
76
- - Max length: 100 chars
77
- - Allowed separators: `-`, `_`, `.`
78
- - Examples: `sales.pipeline`, `prospecting.lists`, `operations.organization-graph`
79
-
80
- This applies to domain IDs, surface IDs, navigation group IDs, and resource mapping IDs.
81
-
82
- ### Default Features
83
-
84
- Eight features ship by default in `DEFAULT_ORGANIZATION_MODEL.features`:
85
-
86
- - `crm` -- enabled; sales pipeline and deal management (feature ID unchanged; domain renamed to `sales`)
87
- - `lead-gen` -- enabled; prospecting, qualification, and outreach (feature ID unchanged; domain renamed to `prospecting`)
88
- - `projects` -- enabled; projects, milestones, and client work execution
89
- - `operations` -- enabled; organizational topology and orchestration visibility
90
- - `monitoring` -- enabled; execution monitoring
91
- - `settings` -- enabled; organization settings
92
- - `submitted-requests` -- enabled; submitted-request lifecycle surface
93
- - `seo` -- disabled by default; SEO surface
94
-
95
- Note: the feature IDs (`crm`, `lead-gen`) are consumer-facing identifiers that have not changed. The underlying domain key on `OrganizationModel` was renamed (`crm` → `sales`, `leadGen` → `prospecting`). Adapters that already use the feature ID constants (`CRM_FEATURE_ID`, `LEAD_GEN_FEATURE_ID`) require no change.
96
-
97
- Each feature entry (`OrganizationModelFeature`) combines what were previously three separate concepts: an access/gating key (the former `OrganizationModelFeatureKey`), a semantic domain (the former `SemanticDomainSchema` entry), and display metadata. The `features` field is now `z.array(FeatureSchema)` -- there is no separate `domains` array and no separate `enabled`/`labels` map.
98
-
99
- `FeatureModule.featureId` on the UI side maps directly to one of these IDs. No alias layer is needed. See [Feature Shell](../ui/feature-shell.mdx) for how the provider resolves feature access from this array.
100
-
101
- ### ResourceMapping Shape
102
-
103
- `OrganizationModelResourceMapping` links a deployable resource into the semantic model:
104
-
105
- - `id` -- unique mapping ID (ModelId format)
106
- - `resourceId` -- the actual resource identifier (string, max 255 chars)
107
- - `resourceType` -- one of `'workflow' | 'agent' | 'trigger' | 'integration' | 'external' | 'human_checkpoint'`
108
- - `label`, `description`, `color`, `icon` -- display metadata (from `DisplayMetadataSchema`)
109
- - `featureIds` -- features this resource belongs to (replaces the former `domainIds`)
110
- - `entityIds` -- entities this resource operates on
111
- - `surfaceIds` -- surfaces this resource is exposed in
112
- - `capabilityIds` -- capabilities this resource fulfills
113
- - `techStack` (optional) -- external-SaaS integration metadata; see TechStack Extension below
114
-
115
- All four ID arrays are bidirectionally validated against their counterparts (see Referential Integrity).
116
-
117
- ### TechStack Extension
118
-
119
- `techStack` is an optional nested object on `ResourceMappingSchema` defined in `domains/shared.ts`. It captures external-SaaS integration metadata without introducing a tenth top-level domain. Fields:
120
-
121
- - `platform` -- name of the external platform (e.g. "HubSpot", "Stripe", "Notion")
122
- - `purpose` -- free-form description of what this integration does
123
- - `credentialStatus` -- one of `'configured' | 'pending' | 'expired' | 'missing'`
124
- - `isSystemOfRecord` -- boolean; whether this integration is the primary source of truth for its domain (defaults to `false`)
125
-
126
- Backward-compatible: existing resource mappings without `techStack` parse cleanly. The extension flows through `ResourceMappingSchema` automatically with no changes to `schema.ts` composition.
127
-
128
- ### Default Navigation
129
-
130
- Surfaces such as `sales.pipeline`, `prospecting.lists`, `projects.index`, `operations.organization-graph`, and `operations.command-view`. Groups include `primary-workspace` and `primary-operations`. The model can shape shell meaning even when route files stay app-local.
131
-
132
- ### SurfaceDefinition Shape
133
-
134
- `OrganizationModelSurface` (inferred from `SurfaceDefinitionSchema`) defines a navigable view:
135
-
136
- - `id` -- ModelId (e.g. `sales.pipeline`)
137
- - `label` -- display name
138
- - `path` -- route path, must start with `/`, max 300 chars
139
- - `surfaceType` -- `'page' | 'dashboard' | 'graph' | 'detail' | 'list' | 'settings'`
140
- - `description` -- optional
141
- - `icon` -- optional icon name token (max 80 chars)
142
- - `featureId` -- optional feature ID that gates this surface (replaces the former `featureKey` field); must match a feature `id` in the features array
143
- - `parentId` -- optional ModelId referencing a parent surface; validated to exist
144
- - `featureIds` -- features this surface belongs to (bidirectionally validated; replaces the former `domainIds`)
145
- - `entityIds` -- entity IDs relevant to this surface
146
- - `resourceIds` -- resources exposed on this surface (bidirectionally validated against resource mappings)
147
- - `capabilityIds` -- capabilities this surface fulfills
148
-
149
- ### NavigationGroup Placement
150
-
151
- `NavigationGroupSchema` has a `placement` field with three allowed values:
152
-
153
- - `'primary'` -- main workspace or operations nav rail
154
- - `'secondary'` -- secondary grouping (below primary)
155
- - `'bottom'` -- pinned to the bottom of the nav rail
156
-
157
- The default groups (`primary-workspace`, `primary-operations`) both use `placement: 'primary'`.
158
-
159
- ### Feature-Specific Semantics
160
-
161
- Three renamed top-level domain fields carry feature-specific semantic shapes (pipeline stages, lifecycle stages, project statuses). These are named fields on `OrganizationModel`, not embedded in per-feature config:
162
-
163
- - `sales` -- pipeline stages and stage semantics (formerly `crm`)
164
- - `prospecting` -- company and contact lifecycle stages (formerly `leadGen`)
165
- - `projects` -- project, milestone, and task statuses (formerly `delivery`)
166
-
167
- This is why the organization model is semantic, not just nav config -- it owns product meaning for the business objects the shell surfaces expose.
168
-
169
- ### Reality Domains (New in 2026-04-20 Expansion)
170
-
171
- Five new domains capture organizational reality that was absent from the original model. They sit alongside the existing platform-configuration domains and follow the same `domains/*.ts` pattern:
172
-
173
- **`identity`** -- legal identity distinct from `branding` (which is display identity). Fields: `mission`, `vision`, `legalName`, `entityType`, `jurisdiction`, `industryCategory`, `geographicFocus`, `timeZone`, `businessHours`. All fields default to empty strings; `timeZone` defaults to `'UTC'`; `businessHours` defaults to `{}`.
174
-
175
- **`customers`** -- customer segments. Each `CustomerSegment` entry has: `id`, `name`, `description`, `jobsToBeDone`, `pains`, `gains`, `valueProp` (all plain-language strings), and `firmographics` (optional object with `companySize`, `industry`, `revenue`, `geography`). Domain defaults to `{ segments: [] }`.
176
-
177
- **`offerings`** -- products and services. Each `Product` entry has: `id`, `name`, `description`, `pricingModel` (enum: `'one-time' | 'subscription' | 'usage-based' | 'custom'`), `price` (optional number), `currency` (optional string), `targetSegmentIds` (cross-ref validated against `customers.segments[].id`), `deliveryFeatureId` (optional cross-ref validated against `features[].id`). Domain defaults to `{ products: [] }`.
178
-
179
- **`roles`** -- role chart. Each `Role` entry has: `id`, `title`, `responsibilities` (string array, default `[]`), `reportsToId` (optional, cross-ref validated within the same collection), `heldBy` (optional name or email string). All field names are plain-language; no EOS jargon (`seats`, `accountabilities`) survives. Domain defaults to `{ roles: [] }`.
180
-
181
- **`goals`** -- organizational goals. Each `Objective` entry has: `id`, `description`, `periodStart` (ISO 8601 date), `periodEnd` (ISO 8601 date, must be strictly after `periodStart`), `keyResults` (array of `{ id, description, targetValue?, currentValue?, unit? }`). User-facing text uses "goals" and "measurable outcomes" -- never "OKR" or "key results". Domain defaults to `{ objectives: [] }`.
182
-
183
- ### Statuses and Operations Domains (Vibe Layer)
184
-
185
- Two domains support the ambient vibe layer's plain-language rendering:
186
-
187
- **`statuses`** -- flat registry of `StatusEntry` objects. Each entry: `id`, `label`, `semanticClass` (one of `'delivery.task' | 'delivery.project' | 'delivery.milestone' | 'queue' | 'execution' | 'schedule' | 'schedule.run' | 'request'`), optional `category`. Labels are vibe-readable: the ambient classifier narrates state using `label` from the model, never hardcoded strings. `QueueTaskStatus` in the queue domain routes through this registry. Defaults to a seed set covering all semantic classes.
188
-
189
- **`operations`** -- catalog of stateful runtime entities. Each `OperationEntry`: `id`, `label`, `semanticClass` (one of `'queue' | 'executions' | 'sessions' | 'notifications' | 'schedules'`), optional `featureId`, optional `supportedStatusSemanticClass` (ties an operation entry back to which status semantic classes apply). Default entries: `operations.queue` (HITL queue), `operations.executions`, `operations.sessions`, `operations.notifications`, `operations.schedules`.
190
-
191
- ## Authoring & Resolution
192
-
193
- - `defineOrganizationModel()` -- typed authoring helper; returns the input unchanged but constrains the type.
194
- - `resolveOrganizationModel(partial)` -- deep-merges a partial override into `DEFAULT_ORGANIZATION_MODEL` and validates the result against `OrganizationModelSchema`.
195
-
196
- Merge semantics:
197
-
198
- - plain objects merge recursively
199
- - arrays **replace** defaults (no element-by-element merge)
200
- - if `navigation.surfaces` is replaced without also supplying `navigation.groups`, inherited groups are normalized so they only keep still-valid surface IDs and any now-empty groups are dropped
201
- - missing fields fall back to defaults
202
-
203
- ### Referential Integrity
204
-
205
- `OrganizationModelSchema` validates more than top-level shape. The `superRefine` pass enforces:
206
-
207
- **Uniqueness checks** -- IDs must be unique within their respective collections:
208
-
209
- - `features[].id`
210
- - `navigation.surfaces[].id`
211
- - `navigation.groups[].id`
212
- - `resourceMappings[].id`
213
- - `resourceMappings[].resourceId` (separate uniqueness check -- two mappings cannot share a `resourceId`)
214
-
215
- **Dangling reference detection** -- every cross-reference must resolve:
216
-
217
- - `navigation.defaultSurfaceId` must point at a declared surface
218
- - every `surfaceId` in a navigation group must resolve to a declared surface
219
- - every `surfaceId` in a feature must resolve to a declared surface
220
- - every `resourceId` in a feature must resolve to a declared resource mapping (by `resourceId`)
221
- - surface `parentId` must reference an existing surface
222
- - every `featureId` on a surface must resolve to a declared feature
223
- - every `resourceId` on a surface must resolve to a declared resource mapping
224
- - every `featureId` on a resource mapping must resolve to a declared feature
225
- - every `surfaceId` on a resource mapping must resolve to a declared surface
226
-
227
- **Bidirectional reference enforcement** -- cross-references must be mutual, not one-sided:
228
-
229
- - a feature listing `surfaceId` S requires surface S to list that feature's ID in its `featureIds`
230
- - a surface listing `featureId` F requires feature F to list that surface's ID in its `surfaceIds`
231
- - a feature listing `resourceId` R requires resource mapping R to list that feature's ID in its `featureIds`
232
- - a resource mapping listing `featureId` F requires feature F to list that resource's `resourceId` in its `resourceIds`
233
- - a surface listing `resourceId` R requires resource mapping R to list that surface's ID in its `surfaceIds`
234
- - a resource mapping listing `surfaceId` S requires surface S to list that resource's `resourceId` in its `resourceIds`
235
-
236
- This bidirectional enforcement is what keeps the organization model semantically consistent rather than loosely structured config.
237
-
238
- **Reality domain cross-refs** (validated in the same `superRefine` pass):
239
-
240
- - each `offerings.products[].targetSegmentIds[]` must resolve to a `customers.segments[].id`
241
- - each `offerings.products[].deliveryFeatureId` (when present) must resolve to a `features[].id`
242
- - each `roles.roles[].reportsToId` (when present) must resolve to another `roles.roles[].id` in the same collection
243
- - each `goals.objectives[].periodEnd` must be strictly after `periodStart` (ISO 8601 string comparison)
244
-
245
- ## Provider Integration
246
-
247
- `ElevasisFeaturesProvider` uses the organization model in three ways:
248
-
249
- 1. **Feature resolution** -- the provider looks up each manifest's `featureId` in `organizationModel.features` to determine `access.enabled`. If no matching feature entry is found, `access.enabled` defaults to `false`.
250
- 2. **Nav label and path resolution** -- when `organizationModel` is present, feature labels resolve from the matching feature entry's `label` field, and surface labels and paths resolve from `organizationModel.navigation.surfaces`. Semantic customization without changing manifest code.
251
- 3. **Organization-graph bridge** -- the `operationsManifest` declares `organizationGraph.surfaceId = 'operations.organization-graph'`. The provider resolves that against organization-model surfaces and exposes the result as `organizationGraph` in context. See [Organization Graph](./organization-graph.mdx).
252
-
253
- ## Published Package: `@elevasis/core`
254
-
255
- `@elevasis/core` is a curated publish wrapper around `packages/core`, released through `$sdk release-core`. It exists so external foundations (`_template/foundations`, `nirvana-marketing/foundations`, `ZentaraHQ/foundations`) can depend on a stable, browser-safe organization-model contract without reaching into monorepo-only `@repo/core`.
256
-
257
- ### Published surface
258
-
259
- Intentionally narrow:
260
-
261
- - `.` -- curated root barrel (`packages/core/src/published.ts`)
262
- - `./organization-model` -- curated organization-model barrel (`packages/core/src/organization-model/published.ts`)
263
-
264
- Exports on the first published surface:
265
-
266
- - `OrganizationModelSchema`
267
- - top-level organization-model types
268
- - `DEFAULT_ORGANIZATION_MODEL`
269
- - `defineOrganizationModel`
270
- - `resolveOrganizationModel`
271
-
272
- ### Intentionally excluded
273
-
274
- - wider `@repo/core` browser barrel
275
- - organization-graph types/builder (`buildOrganizationGraph`, DTO types) -- graph work remains monorepo-first; external consumers should not assume graph contracts are published
276
-
277
- ### Build
278
-
279
- - `pnpm --filter @repo/core build:publish` emits `dist/index.{js,d.ts}` and `dist/organization-model/index.{js,d.ts}` via tsup + `rollup-plugin-dts`.
280
- - Shipped types are browser-safe and verified to contain no `@repo/*` imports.
281
-
282
- ### Release
283
-
284
- - `.claude/sub-commands/sdk/release-core.md` -- dedicated publish flow
285
- - `$sdk verify` -- covers publish metadata, bundled declarations, and the first template-foundation compatibility guard
286
-
287
- ## Downstream Adoption
288
-
289
- External foundations consume `@elevasis/core/organization-model` via an **adapter**, not a fork. The adapter pattern in `external/_template/foundations/config/organization-model.ts`:
290
-
291
- 1. Define a canonical override with `defineOrganizationModel(...)`.
292
- 2. Resolve it with `resolveOrganizationModel(...)`.
293
- 3. Adapt the result into a template-local helper shape that adds consumer-only fields (`homeLabel`, `quickAccessSurfaceIds`, icon aliases, `getOrganizationSurface()`).
294
-
295
- Exports the foundations module provides to consumers:
296
-
297
- - `canonicalOrganizationModel` -- passed to `ElevasisFeaturesProvider`
298
- - `organizationModel` -- widened adapter shape for template-local helpers
299
- - `FoundationFeatureKey`, `FoundationSurfaceIcon`, `FoundationNavigationSurface`, `FoundationOrganizationModel`
300
- - `homeLabel`, `quickAccessSurfaceIds`, `getOrganizationSurface(surfaceId)`
301
-
302
- Downstream template shells pass `canonicalOrganizationModel` into `ElevasisFeaturesProvider`, preserving host-local dashboard/nav customizations alongside the shared runtime. Feature IDs are direct matches -- `crm`, `lead-gen`, `projects` in the org model correspond directly to the same IDs on `FeatureModule.featureId`. No alias layer is needed. The domain rename wave (crm→sales, leadGen→prospecting, delivery→projects) affects the schema field names, not the feature ID constants; adapters using `CRM_FEATURE_ID`, `LEAD_GEN_FEATURE_ID`, etc. require no changes.
303
-
304
- Adapters that override the new reality domains (`identity`, `customers`, `offerings`, `roles`, `goals`) or add `techStack` metadata to resource mappings should use `/configure` as the structured entry point for those edits in external projects. `/configure` runs a layered QA flow, proposes changes, and gates the write through `resolveOrganizationModel()` + `OrganizationModelSchema.parse()` before committing.
305
-
306
- Derivative projects (`external/nirvana-marketing`, `external/ZentaraHQ`) follow the same adapter + provider-wiring baseline with their own project-local customizations.
307
-
308
- ## Verification
309
-
310
- - `pnpm --filter @repo/core build:publish` -- published bundle
311
- - `pnpm --filter @repo/core test -- publish template-foundations-compatibility` -- published surface + adapter guard
312
- - `pnpm -C external/_template/foundations test` -- foundations adapter and import-boundary guard
313
- - `pnpm -C external/_template/ui test -- src/routes/__tests__/__root.test.tsx` -- provider-level `organizationModel` wiring in the template shell
314
-
315
- ## Design Constraints
316
-
317
- - `@elevasis/core` must stay browser-safe. Build output inlines or eliminates `@repo/*` references from shipped types.
318
- - The published surface stays curated -- do not reflexively re-export new `@repo/core` internals. Widening the surface is a deliberate decision, not a default.
319
- - Organization-graph helpers remain internal until a concrete external consumer needs them.
320
- - Foundations adapters preserve the semantic contract; they do not fork it. If a template needs a concept the canonical model can't express, extend the canonical model first.
1
+ ---
2
+ title: Organization Model
3
+ description: Organization OS Model layer documentation for the flat feature hierarchy, semantic domains, resource graph links, and curated @elevasis/core public API.
4
+ ---
5
+ <!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
6
+ <!-- Regenerate: pnpm scaffold:sync -->
7
+
8
+
9
+ ## Overview
10
+
11
+ The organization model is the semantic contract that maps an organization's product shape to flat feature hierarchy, business semantics, shell navigation, and graph binding. It is schema-first, versioned, and validated.
12
+
13
+ The model is authored in `@repo/core` and published through the curated `@elevasis/core/organization-model` surface.
14
+
15
+ ## Source of Truth
16
+
17
+ - `packages/core/src/organization-model/schema.ts`
18
+ - `packages/core/src/organization-model/types.ts`
19
+ - `packages/core/src/organization-model/defaults.ts`
20
+ - `packages/core/src/organization-model/helpers.ts`
21
+ - `packages/core/src/organization-model/graph/link.ts`
22
+ - `packages/core/src/organization-model/published.ts`
23
+ - `packages/core/src/__tests__/template-core-compatibility.test.ts`
24
+
25
+ ## Contract Shape
26
+
27
+ Top-level fields on `OrganizationModel`:
28
+
29
+ - `version`
30
+ - `features`
31
+ - `branding`
32
+ - `navigation`
33
+ - `sales`
34
+ - `prospecting`
35
+ - `projects`
36
+ - `identity`
37
+ - `customers`
38
+ - `offerings`
39
+ - `roles`
40
+ - `goals`
41
+ - `statuses`
42
+ - `operations`
43
+
44
+ Resources are not authored inside `OrganizationModel`. Deployable workflows, agents, triggers, integrations, external resources, and human checkpoints declare graph links on their resource metadata.
45
+
46
+ ## Feature Shape
47
+
48
+ `OrganizationModel.features` is a flat array. Hierarchy is derived from dotted IDs:
49
+
50
+ ```ts
51
+ features: [
52
+ { id: 'dashboard', label: 'Dashboard', enabled: true, path: '/', uiPosition: 'sidebar-primary' },
53
+ { id: 'sales', label: 'Sales', enabled: true, uiPosition: 'sidebar-primary' },
54
+ { id: 'sales.crm', label: 'CRM', enabled: true, path: '/crm' },
55
+ { id: 'operations.resources', label: 'Resources', enabled: true, path: '/operations/resources' }
56
+ ]
57
+ ```
58
+
59
+ Authored fields:
60
+
61
+ - `id`
62
+ - `label`
63
+ - `description`
64
+ - `enabled`
65
+ - `path`
66
+ - `icon`
67
+ - `color`
68
+ - `uiPosition`
69
+ - `requiresAdmin`
70
+ - `devOnly`
71
+
72
+ Containers omit `path`; leaves provide `path`. `uiPosition`, `requiresAdmin`, and `devOnly` inherit from ancestors.
73
+ Development-only features remain defined and enabled with `devOnly: true`; shell consumers hide those entries and route paths outside development mode while preserving the semantic contract.
74
+
75
+ Navigation surfaces may also carry `devOnly` for compatibility with the legacy/domain navigation model. `operations.command-view` is intentionally development-only while its graph visualization modes continue to mature.
76
+
77
+ ## Graph IDs and Resource Links
78
+
79
+ Cross-collection links use kind-prefixed graph IDs:
80
+
81
+ - `feature:sales.crm`
82
+ - `integration:instantly`
83
+ - `resource:lead-import`
84
+ - `capability:operations.queue.review`
85
+
86
+ Example resource metadata:
87
+
88
+ ```ts
89
+ config: {
90
+ resourceId: 'lead-import',
91
+ name: 'Lead Import',
92
+ type: 'workflow',
93
+ version: '1.0.0',
94
+ status: 'prod',
95
+ links: [{ nodeId: 'feature:sales.lead-gen', kind: 'operates-on' }],
96
+ category: 'production'
97
+ }
98
+ ```
99
+
100
+ ## Domain Semantics
101
+
102
+ The model keeps business semantics in named domains:
103
+
104
+ - `sales` -- pipeline stages and stage semantics
105
+ - `prospecting` -- company/contact lifecycle stages
106
+ - `projects` -- project, milestone, and task statuses
107
+ - `identity`, `customers`, `offerings`, `roles`, `goals` -- organizational reality
108
+ - `statuses` and `operations` -- runtime/vibe-layer semantic registries
109
+
110
+ ## Authoring and Resolution
111
+
112
+ - `defineOrganizationModel()` is a typed authoring helper.
113
+ - `resolveOrganizationModel(partial)` deep-merges a partial override into `DEFAULT_ORGANIZATION_MODEL` and validates the result.
114
+ - `createFoundationOrganizationModel(partial)` resolves the canonical model and returns template-facing helpers.
115
+ - Plain objects merge recursively.
116
+ - Arrays replace defaults.
117
+
118
+ ## Referential Integrity
119
+
120
+ `OrganizationModelSchema` validates:
121
+
122
+ - unique feature IDs
123
+ - ancestor existence for dotted feature IDs
124
+ - container/leaf path rules
125
+ - valid sidebar positions
126
+ - reality-domain cross references such as offering target segments and role reporting lines
127
+
128
+ Resource graph links are validated during resource registry registration because resources live in deployment specs.
129
+
130
+ ## Provider Integration
131
+
132
+ `ElevasisFeaturesProvider` uses the organization model to:
133
+
134
+ 1. validate each manifest's `featureId`
135
+ 2. resolve effective feature access
136
+ 3. derive sidebar entries from `features`
137
+ 4. expose shell helpers such as `childrenOf`, `ancestorsOf`, and `findByPath`
138
+ 5. bridge the operations graph into shared UI
139
+
140
+ ## Published Package
141
+
142
+ `@elevasis/core` exposes a curated browser-safe surface:
143
+
144
+ - root barrel
145
+ - `./organization-model`
146
+
147
+ The organization graph builder remains monorepo-internal until there is a concrete external contract need.
148
+
149
+ ## Verification
150
+
151
+ ```bash
152
+ pnpm --filter @repo/core test -- organization-model
153
+ pnpm --filter @repo/core build:publish
154
+ pnpm -C external/_template/core test
155
+ ```
@@ -2,6 +2,9 @@
2
2
  title: Scaffold Reference
3
3
  description: Universal scaffold documentation for Elevasis SDK projects -- recipes, patterns, architecture, and reference materials that apply to all workspaces.
4
4
  ---
5
+ <!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
6
+ <!-- Regenerate: pnpm scaffold:sync -->
7
+
5
8
 
6
9
  ## Overview
7
10
 
@@ -2,6 +2,9 @@
2
2
  title: Propagation Pipeline
3
3
  description: Three-layer pipeline that keeps Organization OS artifacts current across the monorepo and all template-derived external projects -- source generation, registry-driven sync planning/apply, and verification.
4
4
  ---
5
+ <!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
6
+ <!-- Regenerate: pnpm scaffold:sync -->
7
+
5
8
 
6
9
  # Propagation Pipeline
7
10
 
@@ -99,7 +102,7 @@ The external skill doc (`.claude/skills/external/SKILL.md`) remains the workflow
99
102
  | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
100
103
  | `deps` | `@elevasis/ui`, `@elevasis/sdk`, `@elevasis/core` versions match template |
101
104
  | `tier1` | registry-backed replace surfaces match template where verification still models them as exact baselines |
102
- | `org-os` | Organization model exists, exports canonical symbols, imports from `@elevasis/core/organization-model`, calls `defineOrganizationModel` + `resolveOrganizationModel`, app-config references org model, `__root.tsx` uses `ElevasisFeaturesProvider` + `canonicalOrganizationModel`, `main.tsx` uses `ElevasisUIProvider`, all 3 CSS subpath imports present |
105
+ | `org-os` | Organization model exists, exports canonical symbols, imports from `@elevasis/core/organization-model`, calls `createFoundationOrganizationModel`, app-config references org model, `__root.tsx` uses `ElevasisFeaturesProvider` + `canonicalOrganizationModel`, `main.tsx` uses `createElevasisApp`, all 3 CSS subpath imports present |
103
106
  | `placeholders` | No unresolved `__PROJECT_SLUG__`, `__PROJECT_NAME__`, `__PROJECT_DESCRIPTION__` in key config files |
104
107
  | `scripts` | `ui` and `operations` `package.json` have required npm scripts |
105
108
  | `lib` | `ui/src/lib/`, `lib/`, `test-utils/` exist with minimum file counts |
@@ -2,6 +2,9 @@
2
2
  title: Scaffold Maintenance
3
3
  description: How scaffold documentation is organized, generated, and bundled into the SDK -- content placement map, auto-generation pipeline, and instructions for adding new scaffold docs.
4
4
  ---
5
+ <!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
6
+ <!-- Regenerate: pnpm scaffold:sync -->
7
+
5
8
 
6
9
  # Scaffold Maintenance
7
10
 
@@ -2,6 +2,9 @@
2
2
  title: Workflow Recipes
3
3
  description: Anatomy of a workflow, adapter usage, and trigger patterns -- runnable email-notification example replaces the trivial echo workflow. Resolves eval score 2/5 on workflow authoring.
4
4
  ---
5
+ <!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
6
+ <!-- Regenerate: pnpm scaffold:sync -->
7
+
5
8
 
6
9
  # Workflow Recipes
7
10
 
@@ -32,7 +35,7 @@ config: {
32
35
  ### Contract
33
36
 
34
37
  ```typescript
35
- // foundations/types/index.ts -- shared with frontend
38
+ // core/types/index.ts -- shared with frontend
36
39
  export const emailNotificationInputSchema = z.object({
37
40
  recipientEmail: z.string().email(),
38
41
  recipientName: z.string().min(1),
@@ -54,7 +57,7 @@ export type EmailNotificationOutput = z.infer<typeof emailNotificationOutputSche
54
57
 
55
58
  ```typescript
56
59
  // operations/src/email-notification/index.ts
57
- import { emailNotificationInputSchema, emailNotificationOutputSchema } from '@foundation/types'
60
+ import { emailNotificationInputSchema, emailNotificationOutputSchema } from '@core/types'
58
61
 
59
62
  contract: {
60
63
  inputSchema: emailNotificationInputSchema,
@@ -64,16 +67,16 @@ contract: {
64
67
 
65
68
  **Rules:**
66
69
 
67
- - Define schemas in `foundations/types/index.ts` -- never inline Zod schemas in workflow files.
68
- - Both runtimes (frontend and platform) import from `@foundation/types`, keeping validation consistent.
69
- - `@foundation/types` resolves to `foundations/types/index.ts` via the tsconfig path alias.
70
+ - Define schemas in `core/types/index.ts` -- never inline Zod schemas in workflow files.
71
+ - Both runtimes (frontend and platform) import from `@core/types`, keeping validation consistent.
72
+ - `@core/types` resolves to `core/types/index.ts` via the tsconfig path alias.
70
73
 
71
74
  **Entity-backed workflows:** for workflows that operate on a domain entity, reference the entity contract rather than redeclaring it.
72
75
 
73
76
  ```typescript
74
- // foundations/types/index.ts
77
+ // core/types/index.ts
75
78
  import { BaseDealSchema } from '@elevasis/core/entities'
76
- import { DealSchema } from '@foundation/types/entities' // project-local extended version
79
+ import { DealSchema } from '@core/types/entities' // project-local extended version
77
80
 
78
81
  export const closeDealInputSchema = z.object({
79
82
  deal: DealSchema,
@@ -83,7 +86,7 @@ export const closeDealInputSchema = z.object({
83
86
  export type CloseDealInput = z.infer<typeof closeDealInputSchema>
84
87
  ```
85
88
 
86
- `DealSchema` is defined in `foundations/types/entities.ts` by extending `BaseDealSchema` with project-specific metadata. See [../recipes/extend-a-base-entity.md](../recipes/extend-a-base-entity.md) for the pattern.
89
+ `DealSchema` is defined in `core/types/entities.ts` by extending `BaseDealSchema` with project-specific metadata. See [../recipes/extend-a-base-entity.md](../recipes/extend-a-base-entity.md) for the pattern.
87
90
 
88
91
  ### Steps
89
92
 
@@ -291,7 +294,7 @@ Use this pattern in React components and hooks. `apiRequest` automatically attac
291
294
  // ui/src/features/notifications/hooks/useSendEmailNotification.ts
292
295
  import { useMutation } from '@tanstack/react-query'
293
296
  import { useApiClient } from '@/lib/hooks/useApiClient'
294
- import type { EmailNotificationInput, EmailNotificationOutput } from '@foundation/types'
297
+ import type { EmailNotificationInput, EmailNotificationOutput } from '@core/types'
295
298
 
296
299
  export function useSendEmailNotification() {
297
300
  const { apiRequest } = useApiClient()
@@ -457,7 +460,7 @@ Use `runWorkflow` for project-owned workflows. This tests the workflow contract,
457
460
  import { describe, expect, it } from 'vitest'
458
461
  import { runWorkflow, mockNotifications } from '@elevasis/sdk/test-utils'
459
462
  import { emailNotification } from './index'
460
- import type { EmailNotificationOutput } from '@foundation/types'
463
+ import type { EmailNotificationOutput } from '@core/types'
461
464
 
462
465
  describe('emailNotification workflow', () => {
463
466
  it('runs the notify step with a mocked notification adapter', async () => {