@elevasis/sdk 1.4.0 → 1.5.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.
- package/dist/cli.cjs +75 -8
- package/dist/index.d.ts +1464 -749
- package/dist/index.js +74 -7
- package/dist/types/worker/adapters/crm.d.ts +20 -0
- package/dist/types/worker/adapters/index.d.ts +2 -0
- package/dist/types/worker/adapters/projects.d.ts +20 -0
- package/dist/worker/index.js +41 -1
- package/package.json +2 -2
- package/reference/_navigation.md +24 -0
- package/reference/deployment/provided-features.mdx +64 -25
- package/reference/framework/index.mdx +2 -2
- package/reference/framework/project-structure.mdx +10 -8
- package/reference/index.mdx +3 -3
- package/reference/packages/core/src/organization-model/README.md +19 -4
- package/reference/resources/patterns.mdx +54 -8
- package/reference/scaffold/core/organization-graph.mdx +262 -0
- package/reference/scaffold/core/organization-model.mdx +257 -0
- package/reference/scaffold/index.mdx +59 -0
- package/reference/scaffold/operations/workflow-recipes.md +419 -0
- package/reference/scaffold/recipes/add-a-feature.md +142 -0
- package/reference/scaffold/recipes/add-a-resource.md +163 -0
- package/reference/scaffold/recipes/gate-by-feature-or-admin.md +152 -0
- package/reference/scaffold/recipes/index.md +32 -0
- package/reference/scaffold/reference/contracts.md +1044 -0
- package/reference/scaffold/reference/feature-registry.md +30 -0
- package/reference/scaffold/reference/glossary.md +88 -0
- package/reference/scaffold/ui/composition-extensibility.mdx +216 -0
- package/reference/scaffold/ui/customization.md +239 -0
- package/reference/scaffold/ui/feature-flags-and-gating.md +265 -0
- package/reference/scaffold/ui/feature-shell.mdx +241 -0
- package/reference/scaffold/ui/recipes.md +418 -0
|
@@ -101,7 +101,7 @@ const scoreStep: WorkflowStep = {
|
|
|
101
101
|
|
|
102
102
|
## Using Platform Tools in Steps
|
|
103
103
|
|
|
104
|
-
Platform tools let your steps call integrations managed by Elevasis (email, CRM, databases, etc.). Import `platform` from `@elevasis/sdk/worker` and call it with the tool name, method, parameters, and
|
|
104
|
+
Platform tools let your steps call integrations managed by Elevasis (email, CRM, databases, etc.). Import `platform` from `@elevasis/sdk/worker` and call it with the tool name, method, parameters, and an optional credential reference when the tool requires one.
|
|
105
105
|
|
|
106
106
|
```typescript
|
|
107
107
|
import { platform, PlatformToolError } from '@elevasis/sdk/worker';
|
|
@@ -132,7 +132,7 @@ const sendEmailStep: WorkflowStep = {
|
|
|
132
132
|
**Key points:**
|
|
133
133
|
|
|
134
134
|
- `platform.call()` is async and times out after 60 seconds
|
|
135
|
-
- `credential` is the name of a platform environment variable set via `elevasis-sdk env set`
|
|
135
|
+
- `credential` is the name of a platform environment variable set via `elevasis-sdk env set` when the tool needs one
|
|
136
136
|
- On failure, `platform.call()` throws `PlatformToolError` (not `ToolingError`)
|
|
137
137
|
- Always log success so executions are easy to debug in the dashboard
|
|
138
138
|
|
|
@@ -149,18 +149,64 @@ import { platform, PlatformToolError } from '@elevasis/sdk/worker';
|
|
|
149
149
|
|
|
150
150
|
const step = async (input) => {
|
|
151
151
|
try {
|
|
152
|
-
const
|
|
152
|
+
const deals = await platform.call({
|
|
153
153
|
tool: 'crm',
|
|
154
|
-
method: '
|
|
155
|
-
params: {
|
|
156
|
-
credential: 'CRM_API_KEY',
|
|
154
|
+
method: 'listDeals',
|
|
155
|
+
params: { stage: 'proposal', limit: 10 },
|
|
157
156
|
});
|
|
158
|
-
|
|
157
|
+
|
|
158
|
+
const deal = deals[0]
|
|
159
|
+
? await platform.call({
|
|
160
|
+
tool: 'crm',
|
|
161
|
+
method: 'getDeal',
|
|
162
|
+
params: { dealId: deals[0].id },
|
|
163
|
+
})
|
|
164
|
+
: null;
|
|
165
|
+
|
|
166
|
+
if (deal) {
|
|
167
|
+
await platform.call({
|
|
168
|
+
tool: 'crm',
|
|
169
|
+
method: 'updateDealStage',
|
|
170
|
+
params: { dealId: deal.id, stage: 'closing' },
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
await platform.call({
|
|
174
|
+
tool: 'crm',
|
|
175
|
+
method: 'createDealNote',
|
|
176
|
+
params: {
|
|
177
|
+
dealId: deal.id,
|
|
178
|
+
body: 'Reviewed proposal and moved the deal forward.',
|
|
179
|
+
},
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
await platform.call({
|
|
183
|
+
tool: 'crm',
|
|
184
|
+
method: 'createDealTask',
|
|
185
|
+
params: {
|
|
186
|
+
dealId: deal.id,
|
|
187
|
+
title: 'Send updated proposal',
|
|
188
|
+
dueAt: input.followUpAt ?? null,
|
|
189
|
+
},
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
await platform.call({
|
|
193
|
+
tool: 'crm',
|
|
194
|
+
method: 'recordActivity',
|
|
195
|
+
params: {
|
|
196
|
+
dealId: deal.id,
|
|
197
|
+
type: 'stage_changed',
|
|
198
|
+
title: 'Deal moved to closing',
|
|
199
|
+
description: 'Reviewed the proposal and moved the deal forward.',
|
|
200
|
+
},
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return { dealId: deal?.id ?? null, dealCount: deals.length };
|
|
159
205
|
} catch (err) {
|
|
160
206
|
if (err instanceof PlatformToolError) {
|
|
161
207
|
// Tool failed -- log it and return a degraded result
|
|
162
208
|
console.error('CRM tool failed:', err.message);
|
|
163
|
-
return {
|
|
209
|
+
return { dealId: null, error: err.message };
|
|
164
210
|
}
|
|
165
211
|
throw err; // re-throw unexpected errors
|
|
166
212
|
}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Organization Graph
|
|
3
|
+
description: Organization OS Graph layer documentation for the Cytoscape-based organization graph, derived from the organization model and bridged with Command View runtime topology through the shared feature provider.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Overview
|
|
7
|
+
|
|
8
|
+
Within Organization OS, the organization graph is the dedicated **Graph** layer. It treats the organization model as the top-level ontology and bridges in Command View runtime topology so one graph can support semantic exploration and operations-oriented tracing. It is not a replacement renderer for Command View; it is a shared graph product that subsumes Command View as one operational lens.
|
|
9
|
+
|
|
10
|
+
Graph contracts live in `@repo/core` alongside the organization model. Rendering lives in `@repo/ui` with Cytoscape.js. The command-center route is a thin wrapper over the shared page.
|
|
11
|
+
|
|
12
|
+
## Status
|
|
13
|
+
|
|
14
|
+
First implementation slices are live end-to-end. Command View now delegates to the graph through a command-view lens preset. Layout iteration on the one-panel graph + command surface is ongoing; graph contracts and provider bridge are stable.
|
|
15
|
+
|
|
16
|
+
Graph types are intentionally **not** part of the published `@elevasis/core` surface yet. Graph adoption remains monorepo-first.
|
|
17
|
+
|
|
18
|
+
## Source of Truth
|
|
19
|
+
|
|
20
|
+
- `packages/core/src/organization-model/graph/types.ts` -- node/edge DTO shapes
|
|
21
|
+
- `packages/core/src/organization-model/graph/schema.ts` -- runtime validation
|
|
22
|
+
- `packages/core/src/organization-model/graph/build.ts` -- `buildOrganizationGraph(...)` derivation
|
|
23
|
+
- `packages/core/src/organization-model/__tests__/graph.test.ts` -- derivation and bridge tests
|
|
24
|
+
- `packages/ui/src/features/operations/OrganizationGraphPage.tsx` -- shared Cytoscape page
|
|
25
|
+
- `packages/ui/src/features/operations/CommandViewPage.tsx` -- command-view lens delegating to the graph
|
|
26
|
+
- `packages/ui/src/features/operations/organization-graph/` -- filter helpers, detail-state helpers, path tracing, operational summary
|
|
27
|
+
- `packages/ui/src/features/operations/manifest.ts` -- `organizationGraph.surfaceId = 'operations.organization-graph'`
|
|
28
|
+
- `apps/command-center/src/routes/operations/organization-graph.index.tsx` -- route wrapper
|
|
29
|
+
|
|
30
|
+
## Product Jobs
|
|
31
|
+
|
|
32
|
+
The graph helps users:
|
|
33
|
+
|
|
34
|
+
- orient themselves in the organization model
|
|
35
|
+
- discover how domains, capabilities, surfaces, entities, resources, and workflows connect
|
|
36
|
+
- trace upstream/downstream dependencies
|
|
37
|
+
- understand ownership and implementation boundaries
|
|
38
|
+
- assess blast radius before changing a workflow, agent, feature, or integration
|
|
39
|
+
- operate across strategy, operations, and debugging through different lenses on the same graph
|
|
40
|
+
|
|
41
|
+
The graph does not replace workflow editors, execution-run visualizers, or builder-style authoring canvases. React Flow remains the better fit for editor/execution visuals; Cytoscape fits the exploration-oriented ontology graph.
|
|
42
|
+
|
|
43
|
+
## Architecture
|
|
44
|
+
|
|
45
|
+
### Unified graph model
|
|
46
|
+
|
|
47
|
+
The implementation uses one typed graph, not separate semantic and implementation taxonomies.
|
|
48
|
+
|
|
49
|
+
- Node kinds: `organization`, `feature`, `domain`, `surface`, `entity`, `capability`, `resource`
|
|
50
|
+
- Edge kinds: `contains`, `references`, `exposes`, `maps_to`
|
|
51
|
+
- `resource` nodes carry `resourceType` metadata: `workflow`, `agent`, `trigger`, `integration`, `external`, or `human_checkpoint`
|
|
52
|
+
- `references` edges may also carry `relationshipType`: `triggers`, `uses`, or `approval`
|
|
53
|
+
|
|
54
|
+
This means runtime topology is represented as bridged `resource` nodes plus relationship metadata on shared edge types, rather than as a second disconnected edge/node vocabulary.
|
|
55
|
+
|
|
56
|
+
### Compatibility rules with the organization model
|
|
57
|
+
|
|
58
|
+
- `OrganizationModelSchema` is the source of truth for semantic structure. The graph does not introduce a second ontology.
|
|
59
|
+
- Graph node IDs and references reuse organization-model IDs wherever those IDs already exist.
|
|
60
|
+
- `domain` nodes derive from `organizationModel.domains`.
|
|
61
|
+
- `surface` nodes derive from `organizationModel.navigation.surfaces`; graph routing respects surface `path` and `defaultSurfaceId`.
|
|
62
|
+
- Feature gating and labels respect `organizationModel.features.enabled` and `.labels`.
|
|
63
|
+
- Implementation-resource bridging prefers `organizationModel.resourceMappings`.
|
|
64
|
+
- Graph defaults remain valid when produced by `resolveOrganizationModel()`.
|
|
65
|
+
- If the graph needs a concept the model cannot express, extend the model first.
|
|
66
|
+
|
|
67
|
+
### Shared DTO
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
type OrganizationGraphNodeKind =
|
|
71
|
+
| 'organization'
|
|
72
|
+
| 'feature'
|
|
73
|
+
| 'domain'
|
|
74
|
+
| 'surface'
|
|
75
|
+
| 'entity'
|
|
76
|
+
| 'capability'
|
|
77
|
+
| 'resource'
|
|
78
|
+
|
|
79
|
+
type OrganizationGraphEdgeKind = 'contains' | 'references' | 'exposes' | 'maps_to'
|
|
80
|
+
|
|
81
|
+
interface OrganizationGraph {
|
|
82
|
+
version: 1
|
|
83
|
+
organizationModelVersion: OrganizationModel['version']
|
|
84
|
+
nodes: OrganizationGraphNode[]
|
|
85
|
+
edges: OrganizationGraphEdge[]
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
`OrganizationGraphNode` also includes optional `sourceId`, `description`, `enabled`, `featureKey`, `surfaceType`, and `resourceType`. `OrganizationGraphEdge` includes optional `label` and `relationshipType`.
|
|
90
|
+
|
|
91
|
+
### Build pipeline
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
interface BuildOrganizationGraphInput {
|
|
95
|
+
organizationModel: OrganizationModel
|
|
96
|
+
commandViewData?: CommandViewData
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
`buildOrganizationGraph` accepts optional topology input so the semantic graph still renders when operational bridging is sparse. The derivation flow is additive and upsert-oriented:
|
|
101
|
+
|
|
102
|
+
1. Resolve the active organization model.
|
|
103
|
+
2. Derive semantic nodes and edges from domains, features, surfaces, entities, capabilities, and resource mappings.
|
|
104
|
+
3. Upsert bridged runtime resources from Command View data into shared `resource` nodes.
|
|
105
|
+
4. Merge topology relationships onto the same DTO using `references` or `maps_to` edges plus optional `relationshipType`.
|
|
106
|
+
5. Hand the resulting graph to UI-level lensing, filtering, and Cytoscape projection.
|
|
107
|
+
|
|
108
|
+
Keeping assembly outside the renderer keeps graph semantics testable without UI and prevents Cytoscape concepts from leaking into business logic.
|
|
109
|
+
|
|
110
|
+
### Ownership split
|
|
111
|
+
|
|
112
|
+
- `@repo/core` owns normalized node/edge types, schemas, and build/derivation helpers.
|
|
113
|
+
- `@repo/ui` owns Cytoscape element conversion, layout presets, selection/hover/expansion/viewport state, detail panels, and presentation helpers.
|
|
114
|
+
- `apps/command-center` owns route wiring and page-level integration.
|
|
115
|
+
|
|
116
|
+
## Interaction Model
|
|
117
|
+
|
|
118
|
+
### Lenses
|
|
119
|
+
|
|
120
|
+
The graph ships with two lens presets in UI code:
|
|
121
|
+
|
|
122
|
+
- `default` -- title "Organization Graph", initial mode `map`, no preset filters
|
|
123
|
+
- `command-view` -- title "Command View", initial mode `trace`, filters preset to `nodeKinds: ['resource']` and `topologyPresence: 'topology-only'`
|
|
124
|
+
|
|
125
|
+
Lenses do not change the core DTO. They configure how the shared graph is initially presented.
|
|
126
|
+
|
|
127
|
+
### Modes
|
|
128
|
+
|
|
129
|
+
- **Map mode** -- clustered for broad graph orientation
|
|
130
|
+
- **Trace mode** -- directed layout that privileges path readability
|
|
131
|
+
- **Impact mode** -- centered radial/concentric layout around the current focus
|
|
132
|
+
|
|
133
|
+
Layouts are deterministic presets, not unconstrained force simulation:
|
|
134
|
+
|
|
135
|
+
- `map` uses Cytoscape `cose`
|
|
136
|
+
- `trace` uses directed `breadthfirst`
|
|
137
|
+
- `impact` uses degree-based `concentric`
|
|
138
|
+
|
|
139
|
+
### Interactions
|
|
140
|
+
|
|
141
|
+
Primary set, kept small and high-value:
|
|
142
|
+
|
|
143
|
+
- click node for detail panel
|
|
144
|
+
- click edge for relationship meaning
|
|
145
|
+
- hover for adjacency preview
|
|
146
|
+
- search and jump to node
|
|
147
|
+
- expand immediate neighbors
|
|
148
|
+
- isolate selected node + N-hop neighborhood
|
|
149
|
+
- switch mode
|
|
150
|
+
- pin selected nodes
|
|
151
|
+
- highlight shortest or most relevant path between two nodes
|
|
152
|
+
- filter by node kind, domain, capability, feature, status, environment
|
|
153
|
+
|
|
154
|
+
Deferred: freeform node placement, collaborative annotations, graph editing/authoring, arbitrary canvas drawing.
|
|
155
|
+
|
|
156
|
+
### Filtering
|
|
157
|
+
|
|
158
|
+
The filter state lives in `useOrganizationGraphFilters()` and the toolbar UI in `OrganizationGraphFilterToolbar`.
|
|
159
|
+
|
|
160
|
+
Filter inputs:
|
|
161
|
+
|
|
162
|
+
- `search`
|
|
163
|
+
- `nodeKinds`
|
|
164
|
+
- `topologyPresence: 'all' | 'semantic-only' | 'topology-only'`
|
|
165
|
+
|
|
166
|
+
Presence is derived per node:
|
|
167
|
+
|
|
168
|
+
- `resource` nodes are `topology-only`
|
|
169
|
+
- nodes with only semantic edges are `semantic-only`
|
|
170
|
+
- nodes with both semantic and topology edges are treated as bridge nodes internally
|
|
171
|
+
|
|
172
|
+
Search matches node IDs, labels, descriptions, source IDs, feature keys, surface/resource types, edge labels, edge kinds, and `relationshipType`.
|
|
173
|
+
|
|
174
|
+
The page applies `useDeferredValue()` to the active filters so graph search stays responsive while typing.
|
|
175
|
+
|
|
176
|
+
### Path tracing
|
|
177
|
+
|
|
178
|
+
The visible Cytoscape surface projects a **filtered** shared graph DTO rather than rendering the full graph unconditionally. Path tracing resolves and highlights directed paths inside the current visible projection, so filtering and tracing stay coherent.
|
|
179
|
+
|
|
180
|
+
Renderer-agnostic helpers under `packages/ui/src/features/operations/organization-graph/path-tracing/` implement shortest-path logic independent of Cytoscape.
|
|
181
|
+
|
|
182
|
+
## Provider Integration
|
|
183
|
+
|
|
184
|
+
The graph is exposed through `ElevasisFeaturesProvider` rather than as app-local glue:
|
|
185
|
+
|
|
186
|
+
- `FeatureModule.organizationGraph.surfaceId` declares a manifest's bridge point.
|
|
187
|
+
- `operationsManifest` declares `organizationGraph.surfaceId = 'operations.organization-graph'`.
|
|
188
|
+
- The provider resolves that against `organizationModel.navigation.surfaces` and exposes the result as `organizationGraph` in context.
|
|
189
|
+
- Shared UI/operations code stays manifest-driven while remaining aware of semantic organization topology.
|
|
190
|
+
|
|
191
|
+
## Command View Integration
|
|
192
|
+
|
|
193
|
+
`CommandViewPage` now delegates to `OrganizationGraphPage` through a command-view lens preset. The lens restores high-value operational context through:
|
|
194
|
+
|
|
195
|
+
- route-level execution-health cards
|
|
196
|
+
- selection-aware resource and human-checkpoint summaries inside the shared graph detail panel
|
|
197
|
+
- follow-up actions for recent executions and pending tasks inside the detail panel
|
|
198
|
+
- dedicated command-view sidebar content (`Command View` labeling and node filters live in the subshell sidebar, not on the graph canvas)
|
|
199
|
+
|
|
200
|
+
Operational summary and drill-down derivation is covered by tests under `packages/ui/src/features/operations/organization-graph/__tests__/`.
|
|
201
|
+
|
|
202
|
+
The detail experience is shared through `OrganizationGraphDetailPanel`, which can render both semantic context and command-view-specific follow-up sections.
|
|
203
|
+
|
|
204
|
+
## Cytoscape Responsibility Split
|
|
205
|
+
|
|
206
|
+
Cytoscape owns:
|
|
207
|
+
|
|
208
|
+
- element rendering
|
|
209
|
+
- compound/group visualization
|
|
210
|
+
- neighborhood traversal and selection state
|
|
211
|
+
- path highlighting
|
|
212
|
+
- collapsed/expanded cluster behavior
|
|
213
|
+
- layout execution
|
|
214
|
+
- viewport mechanics (pan, zoom, fit, focus)
|
|
215
|
+
|
|
216
|
+
React owns:
|
|
217
|
+
|
|
218
|
+
- mode switching
|
|
219
|
+
- side panels and inspectors
|
|
220
|
+
- search and command-palette entry
|
|
221
|
+
- route state and deep-linking
|
|
222
|
+
- server data fetching
|
|
223
|
+
- persistence of saved filters and views
|
|
224
|
+
|
|
225
|
+
## Package Boundary
|
|
226
|
+
|
|
227
|
+
- `packages/ui/package.json` declares Cytoscape on the published UI surface.
|
|
228
|
+
- `packages/ui/tsup.config.ts` and `packages/ui/rollup.dts.config.mjs` keep Cytoscape **externalized** for publish output.
|
|
229
|
+
- Graph DTO types are internal to `@repo/core`. The published `@elevasis/core` wrapper still exposes only the narrow organization-model API. External graph adoption should not be assumed.
|
|
230
|
+
|
|
231
|
+
## Theming
|
|
232
|
+
|
|
233
|
+
The shared Cytoscape page reads CSS custom properties at runtime via `window.getComputedStyle(document.documentElement)`. Nodes, edges, overlays, and glass panels stay aligned with the active UI theme instead of relying on a fixed graph-only palette.
|
|
234
|
+
|
|
235
|
+
## Cytoscape States
|
|
236
|
+
|
|
237
|
+
The renderer applies CSS-class-style state markers to highlight context and traces:
|
|
238
|
+
|
|
239
|
+
- `.is-faded`
|
|
240
|
+
- `.is-context`
|
|
241
|
+
- `.is-selected`
|
|
242
|
+
- `.is-connected`
|
|
243
|
+
- `.is-trace-node`
|
|
244
|
+
- `.is-trace-endpoint`
|
|
245
|
+
- `.is-trace-edge`
|
|
246
|
+
|
|
247
|
+
These classes drive neighborhood focus, selection emphasis, and trace-path highlighting without changing the underlying DTO.
|
|
248
|
+
|
|
249
|
+
## Migration Guardrails
|
|
250
|
+
|
|
251
|
+
- Do not move canonical graph interfaces into `packages/ui`.
|
|
252
|
+
- Do not redefine organization-model semantics in app-local graph config.
|
|
253
|
+
- Do not make the graph contract depend on Cytoscape-specific types.
|
|
254
|
+
- Existing Command View relationships bridge into `relationshipType = triggers | uses | approval` -- do not overload those operational labels with new semantic meaning.
|
|
255
|
+
|
|
256
|
+
## Verification
|
|
257
|
+
|
|
258
|
+
- `pnpm --filter @repo/core test -- organization-model graph`
|
|
259
|
+
- `pnpm --filter @repo/ui test -- commandViewDrillDown commandViewOperationalSummary organizationGraphDetail`
|
|
260
|
+
- `pnpm --filter @repo/ui build`
|
|
261
|
+
- `pnpm --filter @repo/ui build:publish`
|
|
262
|
+
- `pnpm --filter command-center build`
|
|
@@ -0,0 +1,257 @@
|
|
|
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 product shape to domains, features, navigation surfaces and groups, domain-specific semantics (CRM pipeline, lead-gen lifecycle, delivery 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 keys, navigation surfaces, CRM/lead-gen/delivery semantics
|
|
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
|
+
- `domains` -- semantic domains (`crm`, `lead-gen`, `delivery`, `operations`)
|
|
35
|
+
- `branding`
|
|
36
|
+
- `features` -- `enabled` map and `labels` overrides
|
|
37
|
+
- `navigation` -- surfaces, groups, `defaultSurfaceId`
|
|
38
|
+
- `crm` -- pipeline stages and stage semantics
|
|
39
|
+
- `leadGen` -- company/contact lifecycle stages
|
|
40
|
+
- `delivery` -- project/milestone/task statuses
|
|
41
|
+
- `resourceMappings`
|
|
42
|
+
|
|
43
|
+
### Branding Shape
|
|
44
|
+
|
|
45
|
+
`OrganizationModelBranding` holds display identity for the organization:
|
|
46
|
+
|
|
47
|
+
- `organizationName` -- the human-readable org name (required)
|
|
48
|
+
- `productName` -- the product label shown in the shell (required)
|
|
49
|
+
- `shortName` -- abbreviated name, max 40 chars (required)
|
|
50
|
+
- `description` -- optional long-form description
|
|
51
|
+
- `logos` -- optional object with `light` and `dark` URL strings (each max 2048 chars); defaults to `{}`
|
|
52
|
+
|
|
53
|
+
### ModelId Format Rules
|
|
54
|
+
|
|
55
|
+
All `id` fields, `parentId`, `defaultSurfaceId`, and reference ID arrays use `ModelIdSchema`:
|
|
56
|
+
|
|
57
|
+
- Regex: `/^[a-z0-9]+(?:[-._][a-z0-9]+)*$/`
|
|
58
|
+
- Max length: 100 chars
|
|
59
|
+
- Allowed separators: `-`, `_`, `.`
|
|
60
|
+
- Examples: `crm.pipeline`, `lead-gen.lists`, `operations.organization-graph`
|
|
61
|
+
|
|
62
|
+
This applies to domain IDs, surface IDs, navigation group IDs, and resource mapping IDs.
|
|
63
|
+
|
|
64
|
+
### Default Feature Keys
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
type OrganizationModelFeatureKey =
|
|
68
|
+
| 'acquisition'
|
|
69
|
+
| 'delivery'
|
|
70
|
+
| 'operations'
|
|
71
|
+
| 'monitoring'
|
|
72
|
+
| 'settings'
|
|
73
|
+
| 'seo'
|
|
74
|
+
| 'calibration'
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
These are the **grouped** published access/visibility keys. They differ from shell feature-module keys (`crm`, `lead-gen`, `delivery`). See [Feature Shell](../ui/feature-shell.mdx) for how the provider bridges the two.
|
|
78
|
+
|
|
79
|
+
### Default Semantic Domains
|
|
80
|
+
|
|
81
|
+
Four domains ship by default -- `crm`, `lead-gen`, `delivery`, `operations`. Each binds together entity IDs, surface IDs, resource IDs, and capability IDs. Domains are semantic, not purely navigational -- they describe what area of the business or resource model a thing belongs to, not which access key gates it.
|
|
82
|
+
|
|
83
|
+
### ResourceMapping Shape
|
|
84
|
+
|
|
85
|
+
`OrganizationModelResourceMapping` links a deployable resource into the semantic model:
|
|
86
|
+
|
|
87
|
+
- `id` -- unique mapping ID (ModelId format)
|
|
88
|
+
- `resourceId` -- the actual resource identifier (string, max 255 chars)
|
|
89
|
+
- `resourceType` -- one of `'workflow' | 'agent' | 'trigger' | 'integration' | 'external' | 'human_checkpoint'`
|
|
90
|
+
- `label`, `description`, `color`, `icon` -- display metadata (from `DisplayMetadataSchema`)
|
|
91
|
+
- `domainIds` -- domains this resource belongs to
|
|
92
|
+
- `entityIds` -- entities this resource operates on
|
|
93
|
+
- `surfaceIds` -- surfaces this resource is exposed in
|
|
94
|
+
- `capabilityIds` -- capabilities this resource fulfills
|
|
95
|
+
|
|
96
|
+
All four ID arrays are bidirectionally validated against their counterparts (see Referential Integrity).
|
|
97
|
+
|
|
98
|
+
### Default Navigation
|
|
99
|
+
|
|
100
|
+
Surfaces such as `crm.pipeline`, `lead-gen.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.
|
|
101
|
+
|
|
102
|
+
### SurfaceDefinition Shape
|
|
103
|
+
|
|
104
|
+
`OrganizationModelSurface` (inferred from `SurfaceDefinitionSchema`) defines a navigable view:
|
|
105
|
+
|
|
106
|
+
- `id` -- ModelId (e.g. `crm.pipeline`)
|
|
107
|
+
- `label` -- display name
|
|
108
|
+
- `path` -- route path, must start with `/`, max 300 chars
|
|
109
|
+
- `surfaceType` -- `'page' | 'dashboard' | 'graph' | 'detail' | 'list' | 'settings'`
|
|
110
|
+
- `description` -- optional
|
|
111
|
+
- `icon` -- optional icon name token (max 80 chars)
|
|
112
|
+
- `featureKey` -- optional `OrganizationModelFeatureKey` that gates this surface
|
|
113
|
+
- `parentId` -- optional ModelId referencing a parent surface; validated to exist
|
|
114
|
+
- `domainIds` -- domains this surface belongs to (bidirectionally validated)
|
|
115
|
+
- `entityIds` -- entity IDs relevant to this surface
|
|
116
|
+
- `resourceIds` -- resources exposed on this surface (bidirectionally validated against resource mappings)
|
|
117
|
+
- `capabilityIds` -- capabilities this surface fulfills
|
|
118
|
+
|
|
119
|
+
### NavigationGroup Placement
|
|
120
|
+
|
|
121
|
+
`NavigationGroupSchema` has a `placement` field with three allowed values:
|
|
122
|
+
|
|
123
|
+
- `'primary'` -- main workspace or operations nav rail
|
|
124
|
+
- `'secondary'` -- secondary grouping (below primary)
|
|
125
|
+
- `'bottom'` -- pinned to the bottom of the nav rail
|
|
126
|
+
|
|
127
|
+
The default groups (`primary-workspace`, `primary-operations`) both use `placement: 'primary'`.
|
|
128
|
+
|
|
129
|
+
### Domain-Specific Semantics
|
|
130
|
+
|
|
131
|
+
- **CRM** -- pipeline stages and stage semantics
|
|
132
|
+
- **Lead-gen** -- company and contact lifecycle stages
|
|
133
|
+
- **Delivery** -- project, milestone, and task statuses
|
|
134
|
+
|
|
135
|
+
This is why the organization model is semantic, not just nav config -- it owns product meaning for the business objects the shell surfaces expose.
|
|
136
|
+
|
|
137
|
+
## Authoring & Resolution
|
|
138
|
+
|
|
139
|
+
- `defineOrganizationModel()` -- typed authoring helper; returns the input unchanged but constrains the type.
|
|
140
|
+
- `resolveOrganizationModel(partial)` -- deep-merges a partial override into `DEFAULT_ORGANIZATION_MODEL` and validates the result against `OrganizationModelSchema`.
|
|
141
|
+
|
|
142
|
+
Merge semantics:
|
|
143
|
+
|
|
144
|
+
- plain objects merge recursively
|
|
145
|
+
- arrays **replace** defaults (no element-by-element merge)
|
|
146
|
+
- 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
|
|
147
|
+
- missing fields fall back to defaults
|
|
148
|
+
|
|
149
|
+
### Referential Integrity
|
|
150
|
+
|
|
151
|
+
`OrganizationModelSchema` validates more than top-level shape. The `superRefine` pass enforces:
|
|
152
|
+
|
|
153
|
+
**Uniqueness checks** -- IDs must be unique within their respective collections:
|
|
154
|
+
|
|
155
|
+
- `domains[].id`
|
|
156
|
+
- `navigation.surfaces[].id`
|
|
157
|
+
- `navigation.groups[].id`
|
|
158
|
+
- `resourceMappings[].id`
|
|
159
|
+
- `resourceMappings[].resourceId` (separate uniqueness check -- two mappings cannot share a `resourceId`)
|
|
160
|
+
|
|
161
|
+
**Dangling reference detection** -- every cross-reference must resolve:
|
|
162
|
+
|
|
163
|
+
- `navigation.defaultSurfaceId` must point at a declared surface
|
|
164
|
+
- every `surfaceId` in a navigation group must resolve to a declared surface
|
|
165
|
+
- every `surfaceId` in a domain must resolve to a declared surface
|
|
166
|
+
- every `resourceId` in a domain must resolve to a declared resource mapping (by `resourceId`)
|
|
167
|
+
- surface `parentId` must reference an existing surface
|
|
168
|
+
- every `domainId` on a surface must resolve to a declared domain
|
|
169
|
+
- every `resourceId` on a surface must resolve to a declared resource mapping
|
|
170
|
+
- every `domainId` on a resource mapping must resolve to a declared domain
|
|
171
|
+
- every `surfaceId` on a resource mapping must resolve to a declared surface
|
|
172
|
+
|
|
173
|
+
**Bidirectional reference enforcement** -- cross-references must be mutual, not one-sided:
|
|
174
|
+
|
|
175
|
+
- a domain listing `surfaceId` S requires surface S to list that domain's ID in its `domainIds`
|
|
176
|
+
- a surface listing `domainId` D requires domain D to list that surface's ID in its `surfaceIds`
|
|
177
|
+
- a domain listing `resourceId` R requires resource mapping R to list that domain's ID in its `domainIds`
|
|
178
|
+
- a resource mapping listing `domainId` D requires domain D to list that resource's `resourceId` in its `resourceIds`
|
|
179
|
+
- a surface listing `resourceId` R requires resource mapping R to list that surface's ID in its `surfaceIds`
|
|
180
|
+
- a resource mapping listing `surfaceId` S requires surface S to list that resource's `resourceId` in its `resourceIds`
|
|
181
|
+
|
|
182
|
+
This bidirectional enforcement is what keeps the organization model semantically consistent rather than loosely structured config.
|
|
183
|
+
|
|
184
|
+
## Provider Integration
|
|
185
|
+
|
|
186
|
+
`ElevasisFeaturesProvider` uses the organization model in three ways:
|
|
187
|
+
|
|
188
|
+
1. **Feature resolution** -- provider first checks `useFeatureAccess()`, then refines through organization-model feature state when the model knows the key.
|
|
189
|
+
2. **Nav label and path resolution** -- when `organizationModel` is present, feature labels resolve from `organizationModel.features.labels`, and surface labels and paths resolve from `organizationModel.navigation.surfaces`. Semantic customization without changing manifest code.
|
|
190
|
+
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).
|
|
191
|
+
|
|
192
|
+
## Published Package: `@elevasis/core`
|
|
193
|
+
|
|
194
|
+
`@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`.
|
|
195
|
+
|
|
196
|
+
### Published surface
|
|
197
|
+
|
|
198
|
+
Intentionally narrow:
|
|
199
|
+
|
|
200
|
+
- `.` -- curated root barrel (`packages/core/src/published.ts`)
|
|
201
|
+
- `./organization-model` -- curated organization-model barrel (`packages/core/src/organization-model/published.ts`)
|
|
202
|
+
|
|
203
|
+
Exports on the first published surface:
|
|
204
|
+
|
|
205
|
+
- `OrganizationModelSchema`
|
|
206
|
+
- top-level organization-model types
|
|
207
|
+
- `DEFAULT_ORGANIZATION_MODEL`
|
|
208
|
+
- `defineOrganizationModel`
|
|
209
|
+
- `resolveOrganizationModel`
|
|
210
|
+
|
|
211
|
+
### Intentionally excluded
|
|
212
|
+
|
|
213
|
+
- wider `@repo/core` browser barrel
|
|
214
|
+
- organization-graph types/builder (`buildOrganizationGraph`, DTO types) -- graph work remains monorepo-first; external consumers should not assume graph contracts are published
|
|
215
|
+
|
|
216
|
+
### Build
|
|
217
|
+
|
|
218
|
+
- `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`.
|
|
219
|
+
- Shipped types are browser-safe and verified to contain no `@repo/*` imports.
|
|
220
|
+
|
|
221
|
+
### Release
|
|
222
|
+
|
|
223
|
+
- `.claude/sub-commands/sdk/release-core.md` -- dedicated publish flow
|
|
224
|
+
- `$sdk verify` -- covers publish metadata, bundled declarations, and the first template-foundation compatibility guard
|
|
225
|
+
|
|
226
|
+
## Downstream Adoption
|
|
227
|
+
|
|
228
|
+
External foundations consume `@elevasis/core/organization-model` via an **adapter**, not a fork. The adapter pattern in `external/_template/foundations/config/organization-model.ts`:
|
|
229
|
+
|
|
230
|
+
1. Define a canonical override with `defineOrganizationModel(...)`.
|
|
231
|
+
2. Resolve it with `resolveOrganizationModel(...)`.
|
|
232
|
+
3. Adapt the result into a template-local helper shape that adds consumer-only fields (`homeLabel`, `quickAccessSurfaceIds`, icon aliases, `getOrganizationSurface()`).
|
|
233
|
+
|
|
234
|
+
Exports the foundations module provides to consumers:
|
|
235
|
+
|
|
236
|
+
- `canonicalOrganizationModel` -- passed to `ElevasisFeaturesProvider`
|
|
237
|
+
- `organizationModel` -- widened adapter shape for template-local helpers
|
|
238
|
+
- `FoundationFeatureKey`, `FoundationSurfaceIcon`, `FoundationNavigationSurface`, `FoundationOrganizationModel`
|
|
239
|
+
- `homeLabel`, `quickAccessSurfaceIds`, `getOrganizationSurface(surfaceId)`
|
|
240
|
+
|
|
241
|
+
Downstream template shells pass `canonicalOrganizationModel` into `ElevasisFeaturesProvider`, preserving host-local dashboard/nav customizations alongside the shared runtime. Grouped core features map onto template vocabulary -- `crm` and `lead-gen` project from `acquisition`, `projects` from `delivery`.
|
|
242
|
+
|
|
243
|
+
Derivative projects (`external/nirvana-marketing`, `external/ZentaraHQ`) follow the same adapter + provider-wiring baseline with their own project-local customizations.
|
|
244
|
+
|
|
245
|
+
## Verification
|
|
246
|
+
|
|
247
|
+
- `pnpm --filter @repo/core build:publish` -- published bundle
|
|
248
|
+
- `pnpm --filter @repo/core test -- publish template-foundations-compatibility` -- published surface + adapter guard
|
|
249
|
+
- `pnpm -C external/_template/foundations test` -- foundations adapter and import-boundary guard
|
|
250
|
+
- `pnpm -C external/_template/ui test -- src/routes/__tests__/__root.test.tsx` -- provider-level `organizationModel` wiring in the template shell
|
|
251
|
+
|
|
252
|
+
## Design Constraints
|
|
253
|
+
|
|
254
|
+
- `@elevasis/core` must stay browser-safe. Build output inlines or eliminates `@repo/*` references from shipped types.
|
|
255
|
+
- The published surface stays curated -- do not reflexively re-export new `@repo/core` internals. Widening the surface is a deliberate decision, not a default.
|
|
256
|
+
- Organization-graph helpers remain internal until a concrete external consumer needs them.
|
|
257
|
+
- 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.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Scaffold Reference
|
|
3
|
+
description: Universal scaffold documentation for Elevasis SDK projects -- recipes, patterns, architecture, and reference materials that apply to all workspaces.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Overview
|
|
7
|
+
|
|
8
|
+
This scaffold reference contains universal documentation that applies to all Elevasis SDK projects. Content is organized by package ownership:
|
|
9
|
+
|
|
10
|
+
- **recipes/** -- Cross-package pathway recipes (add a feature, add a resource, gating patterns)
|
|
11
|
+
- **ui/** -- UI patterns, feature shell architecture, composition, and customization
|
|
12
|
+
- **core/** -- Organization model architecture, graph layer, and semantic contracts
|
|
13
|
+
- **operations/** -- Workflow authoring patterns and adapter usage
|
|
14
|
+
- **reference/** -- Glossary, auto-generated contracts, and feature registry
|
|
15
|
+
|
|
16
|
+
## Quick Navigation
|
|
17
|
+
|
|
18
|
+
### Pathway Recipes
|
|
19
|
+
|
|
20
|
+
- [Add a Feature](./recipes/add-a-feature.md) -- end-to-end from org model key through manifest, routes, gating
|
|
21
|
+
- [Add a Resource](./recipes/add-a-resource.md) -- author and deploy a workflow or agent
|
|
22
|
+
- [Gate by Feature or Admin](./recipes/gate-by-feature-or-admin.md) -- decision table for access control patterns
|
|
23
|
+
|
|
24
|
+
### UI Patterns
|
|
25
|
+
|
|
26
|
+
- [UI Recipes](./ui/recipes.md) -- copy-paste recipes for pages, nav items, components, theme tokens
|
|
27
|
+
- [Feature Flags & Gating](./ui/feature-flags-and-gating.md) -- three-concept model for feature access
|
|
28
|
+
- [Customizing Features](./ui/customization.md) -- sidebar composition via manifest overrides
|
|
29
|
+
- [Feature Shell & Provider](./ui/feature-shell.mdx) -- FeatureModule manifest contract, provider runtime
|
|
30
|
+
- [Composition & Extensibility](./ui/composition-extensibility.mdx) -- layout primitives, router abstraction
|
|
31
|
+
|
|
32
|
+
### Core Architecture
|
|
33
|
+
|
|
34
|
+
- [Organization Model](./core/organization-model.mdx) -- semantic contract, schema, authoring helpers
|
|
35
|
+
- [Organization Graph](./core/organization-graph.mdx) -- graph derivation, node/edge taxonomy, lenses
|
|
36
|
+
|
|
37
|
+
### Operations
|
|
38
|
+
|
|
39
|
+
- [Workflow Recipes](./operations/workflow-recipes.md) -- workflow anatomy, adapter patterns, trigger patterns
|
|
40
|
+
|
|
41
|
+
### Reference
|
|
42
|
+
|
|
43
|
+
- [Glossary](./reference/glossary.md) -- term definitions for Organization OS concepts
|
|
44
|
+
- [Contracts](./reference/contracts.md) -- auto-generated TypeScript contract shapes
|
|
45
|
+
- [Feature Registry](./reference/feature-registry.md) -- auto-generated feature manifest catalog
|
|
46
|
+
|
|
47
|
+
## Source Locations
|
|
48
|
+
|
|
49
|
+
Content is co-located with its owning package and copied here during SDK build:
|
|
50
|
+
|
|
51
|
+
| Bundle Path | Source Location | Owner |
|
|
52
|
+
| ---------------------------------------- | --------------------------------------------------------- | --------------- |
|
|
53
|
+
| `scaffold/recipes/` | `packages/sdk/docs/scaffold/recipes/` | SDK |
|
|
54
|
+
| `scaffold/operations/` | `packages/sdk/docs/scaffold/operations/` | SDK |
|
|
55
|
+
| `scaffold/ui/` | `packages/ui/src/scaffold/` | UI |
|
|
56
|
+
| `scaffold/core/` | `packages/core/src/organization-model/` | Core |
|
|
57
|
+
| `scaffold/reference/glossary.md` | `packages/core/src/reference/glossary.md` | Core |
|
|
58
|
+
| `scaffold/reference/contracts.md` | `packages/core/src/reference/_generated/contracts.md` | Core (auto-gen) |
|
|
59
|
+
| `scaffold/reference/feature-registry.md` | `packages/ui/src/scaffold/_generated/feature-registry.md` | UI (auto-gen) |
|