@elevasis/core 0.5.0 → 0.7.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 (66) hide show
  1. package/dist/index.d.ts +428 -42
  2. package/dist/index.js +596 -47
  3. package/dist/organization-model/index.d.ts +428 -42
  4. package/dist/organization-model/index.js +596 -47
  5. package/package.json +4 -3
  6. package/src/__tests__/template-foundations-compatibility.test.ts +2 -2
  7. package/src/_gen/__tests__/__snapshots__/contracts.md.snap +1131 -0
  8. package/src/_gen/__tests__/scaffold-contracts.test.ts +53 -0
  9. package/src/_gen/scaffold-contracts.ts +45 -0
  10. package/src/business/acquisition/types.ts +2 -0
  11. package/src/commands/queue/types/task.ts +3 -3
  12. package/src/execution/engine/index.ts +8 -0
  13. package/src/execution/engine/tools/registry.ts +26 -24
  14. package/src/execution/engine/tools/tool-maps.ts +13 -9
  15. package/src/execution/engine/workflow/types.ts +2 -3
  16. package/src/index.ts +10 -0
  17. package/src/organization-model/README.md +16 -12
  18. package/src/organization-model/__tests__/defaults.test.ts +175 -0
  19. package/src/organization-model/__tests__/domains/customers.test.ts +295 -0
  20. package/src/organization-model/__tests__/domains/goals.test.ts +479 -0
  21. package/src/organization-model/__tests__/domains/identity.test.ts +279 -0
  22. package/src/organization-model/__tests__/domains/navigation.test.ts +212 -0
  23. package/src/organization-model/__tests__/domains/offerings.test.ts +419 -0
  24. package/src/organization-model/__tests__/domains/operations.test.ts +203 -0
  25. package/src/organization-model/__tests__/domains/resource-mappings.test.ts +362 -0
  26. package/src/organization-model/__tests__/domains/roles.test.ts +347 -0
  27. package/src/organization-model/__tests__/domains/statuses.test.ts +243 -0
  28. package/src/organization-model/__tests__/foundation.test.ts +3 -3
  29. package/src/organization-model/__tests__/resolve.test.ts +447 -3
  30. package/src/organization-model/__tests__/schema.test.ts +407 -0
  31. package/src/organization-model/contracts.ts +5 -5
  32. package/src/organization-model/defaults.ts +39 -16
  33. package/src/organization-model/domains/customers.ts +75 -0
  34. package/src/organization-model/domains/goals.ts +80 -0
  35. package/src/organization-model/domains/identity.ts +94 -0
  36. package/src/organization-model/domains/navigation.ts +43 -4
  37. package/src/organization-model/domains/offerings.ts +66 -0
  38. package/src/organization-model/domains/operations.ts +85 -0
  39. package/src/organization-model/domains/{delivery.ts → projects.ts} +6 -6
  40. package/src/organization-model/domains/{lead-gen.ts → prospecting.ts} +5 -5
  41. package/src/organization-model/domains/roles.ts +55 -0
  42. package/src/organization-model/domains/sales.ts +94 -0
  43. package/src/organization-model/domains/shared.ts +30 -1
  44. package/src/organization-model/domains/statuses.ts +130 -0
  45. package/src/organization-model/index.ts +3 -3
  46. package/src/organization-model/organization-graph.mdx +1 -0
  47. package/src/organization-model/organization-model.mdx +84 -19
  48. package/src/organization-model/published.ts +53 -8
  49. package/src/organization-model/schema.ts +67 -7
  50. package/src/organization-model/types.ts +31 -7
  51. package/src/platform/constants/versions.ts +1 -1
  52. package/src/platform/registry/types.ts +1 -1
  53. package/src/projects/api-schemas.ts +1 -0
  54. package/src/reference/_generated/contracts.md +116 -8
  55. package/src/reference/glossary.md +25 -4
  56. package/src/requests/__tests__/api-schemas.test.ts +277 -0
  57. package/src/requests/api-schemas.ts +83 -0
  58. package/src/requests/index.ts +1 -0
  59. package/src/scaffold-registry/__tests__/schema.test.ts +280 -0
  60. package/src/scaffold-registry/index.ts +194 -0
  61. package/src/scaffold-registry/schema.ts +144 -0
  62. package/src/supabase/database.types.ts +158 -6
  63. package/src/organization-model/domains/crm.ts +0 -46
  64. /package/src/business/{delivery → projects}/index.ts +0 -0
  65. /package/src/business/{delivery → projects}/types.ts +0 -0
  66. /package/src/business/{crm → sales}/api-schemas.ts +0 -0
@@ -0,0 +1,130 @@
1
+ import { z } from 'zod'
2
+
3
+ // ---------------------------------------------------------------------------
4
+ // Semantic class enum — one value per status category.
5
+ // Every status entry declares which category it belongs to via semanticClass.
6
+ // ---------------------------------------------------------------------------
7
+
8
+ export const StatusSemanticClassSchema = z.enum([
9
+ 'delivery.task',
10
+ 'delivery.project',
11
+ 'delivery.milestone',
12
+ 'queue',
13
+ 'execution',
14
+ 'schedule',
15
+ 'schedule.run',
16
+ 'request'
17
+ ])
18
+
19
+ // ---------------------------------------------------------------------------
20
+ // Status entry schema
21
+ // ---------------------------------------------------------------------------
22
+
23
+ export const StatusEntrySchema = z.object({
24
+ id: z.string().trim().min(1).max(100),
25
+ label: z.string().trim().min(1).max(120),
26
+ semanticClass: StatusSemanticClassSchema,
27
+ category: z.string().trim().min(1).max(80).optional()
28
+ })
29
+
30
+ // ---------------------------------------------------------------------------
31
+ // Domain schema — a flat array of status entries keyed by id
32
+ // ---------------------------------------------------------------------------
33
+
34
+ export const StatusesDomainSchema = z.object({
35
+ entries: z.array(StatusEntrySchema).default([])
36
+ })
37
+
38
+ // ---------------------------------------------------------------------------
39
+ // Seed — covers all status enums in scope (delivery, queue, execution,
40
+ // schedule, schedule.run, request). Delivery project/milestone statuses are
41
+ // included here as semantic references; they mirror delivery.ts but live in
42
+ // the statuses domain as the vibe-readable registry.
43
+ // ---------------------------------------------------------------------------
44
+
45
+ export const DEFAULT_ORGANIZATION_MODEL_STATUSES: z.infer<typeof StatusesDomainSchema> = {
46
+ entries: [
47
+ // --- delivery.task (TaskStatus — 9 values) ---
48
+ { id: 'delivery.task.planned', label: 'Planned', semanticClass: 'delivery.task', category: 'delivery' },
49
+ { id: 'delivery.task.in_progress', label: 'In Progress', semanticClass: 'delivery.task', category: 'delivery' },
50
+ { id: 'delivery.task.blocked', label: 'Blocked', semanticClass: 'delivery.task', category: 'delivery' },
51
+ { id: 'delivery.task.submitted', label: 'Submitted', semanticClass: 'delivery.task', category: 'delivery' },
52
+ { id: 'delivery.task.approved', label: 'Approved', semanticClass: 'delivery.task', category: 'delivery' },
53
+ {
54
+ id: 'delivery.task.revision_requested',
55
+ label: 'Revision Requested',
56
+ semanticClass: 'delivery.task',
57
+ category: 'delivery'
58
+ },
59
+ { id: 'delivery.task.rejected', label: 'Rejected', semanticClass: 'delivery.task', category: 'delivery' },
60
+ { id: 'delivery.task.cancelled', label: 'Cancelled', semanticClass: 'delivery.task', category: 'delivery' },
61
+ { id: 'delivery.task.completed', label: 'Completed', semanticClass: 'delivery.task', category: 'delivery' },
62
+
63
+ // --- delivery.project (ProjectStatus — 6 values) ---
64
+ { id: 'delivery.project.active', label: 'Active', semanticClass: 'delivery.project', category: 'delivery' },
65
+ { id: 'delivery.project.on_track', label: 'On Track', semanticClass: 'delivery.project', category: 'delivery' },
66
+ { id: 'delivery.project.at_risk', label: 'At Risk', semanticClass: 'delivery.project', category: 'delivery' },
67
+ { id: 'delivery.project.blocked', label: 'Blocked', semanticClass: 'delivery.project', category: 'delivery' },
68
+ { id: 'delivery.project.paused', label: 'Paused', semanticClass: 'delivery.project', category: 'delivery' },
69
+ { id: 'delivery.project.completed', label: 'Completed', semanticClass: 'delivery.project', category: 'delivery' },
70
+
71
+ // --- delivery.milestone (MilestoneStatus — 5 values) ---
72
+ {
73
+ id: 'delivery.milestone.upcoming',
74
+ label: 'Upcoming',
75
+ semanticClass: 'delivery.milestone',
76
+ category: 'delivery'
77
+ },
78
+ {
79
+ id: 'delivery.milestone.in_progress',
80
+ label: 'In Progress',
81
+ semanticClass: 'delivery.milestone',
82
+ category: 'delivery'
83
+ },
84
+ {
85
+ id: 'delivery.milestone.blocked',
86
+ label: 'Blocked',
87
+ semanticClass: 'delivery.milestone',
88
+ category: 'delivery'
89
+ },
90
+ { id: 'delivery.milestone.overdue', label: 'Overdue', semanticClass: 'delivery.milestone', category: 'delivery' },
91
+ {
92
+ id: 'delivery.milestone.completed',
93
+ label: 'Completed',
94
+ semanticClass: 'delivery.milestone',
95
+ category: 'delivery'
96
+ },
97
+
98
+ // --- queue (QueueTaskStatus — 5 values, maps hitl/command-queue tasks) ---
99
+ { id: 'queue.pending', label: 'Pending', semanticClass: 'queue', category: 'queue' },
100
+ { id: 'queue.processing', label: 'Processing', semanticClass: 'queue', category: 'queue' },
101
+ { id: 'queue.completed', label: 'Completed', semanticClass: 'queue', category: 'queue' },
102
+ { id: 'queue.failed', label: 'Failed', semanticClass: 'queue', category: 'queue' },
103
+ { id: 'queue.expired', label: 'Expired', semanticClass: 'queue', category: 'queue' },
104
+
105
+ // --- execution (ExecutionStatus — 5 values) ---
106
+ { id: 'execution.pending', label: 'Pending', semanticClass: 'execution', category: 'execution' },
107
+ { id: 'execution.running', label: 'Running', semanticClass: 'execution', category: 'execution' },
108
+ { id: 'execution.completed', label: 'Completed', semanticClass: 'execution', category: 'execution' },
109
+ { id: 'execution.failed', label: 'Failed', semanticClass: 'execution', category: 'execution' },
110
+ { id: 'execution.warning', label: 'Warning', semanticClass: 'execution', category: 'execution' },
111
+
112
+ // --- schedule (schedule status — 4 values) ---
113
+ { id: 'schedule.active', label: 'Active', semanticClass: 'schedule', category: 'schedule' },
114
+ { id: 'schedule.paused', label: 'Paused', semanticClass: 'schedule', category: 'schedule' },
115
+ { id: 'schedule.completed', label: 'Completed', semanticClass: 'schedule', category: 'schedule' },
116
+ { id: 'schedule.cancelled', label: 'Cancelled', semanticClass: 'schedule', category: 'schedule' },
117
+
118
+ // --- schedule.run (schedule run status — 4 values) ---
119
+ { id: 'schedule.run.running', label: 'Running', semanticClass: 'schedule.run', category: 'schedule' },
120
+ { id: 'schedule.run.completed', label: 'Completed', semanticClass: 'schedule.run', category: 'schedule' },
121
+ { id: 'schedule.run.failed', label: 'Failed', semanticClass: 'schedule.run', category: 'schedule' },
122
+ { id: 'schedule.run.cancelled', label: 'Cancelled', semanticClass: 'schedule.run', category: 'schedule' },
123
+
124
+ // --- request (RequestStatus — 4 values, maps reported_requests) ---
125
+ { id: 'request.open', label: 'Open', semanticClass: 'request', category: 'request' },
126
+ { id: 'request.investigating', label: 'Investigating', semanticClass: 'request', category: 'request' },
127
+ { id: 'request.resolved', label: 'Resolved', semanticClass: 'request', category: 'request' },
128
+ { id: 'request.wont_fix', label: "Won't Fix", semanticClass: 'request', category: 'request' }
129
+ ]
130
+ }
@@ -6,8 +6,8 @@ export * from './resolve'
6
6
  export * from './foundation'
7
7
  export * from './graph'
8
8
  export * from './domains/branding'
9
- export * from './domains/crm'
10
- export * from './domains/delivery'
9
+ export * from './domains/sales'
10
+ export * from './domains/projects'
11
11
  export * from './domains/features'
12
- export * from './domains/lead-gen'
12
+ export * from './domains/prospecting'
13
13
  export * from './domains/navigation'
@@ -62,6 +62,7 @@ This means runtime topology is represented as bridged `resource` nodes plus rela
62
62
  - Implementation-resource bridging prefers `organizationModel.resourceMappings`.
63
63
  - Semantic grouping now comes from the unified `organizationModel.features` array. The builder no longer emits separate `domain` nodes.
64
64
  - Command View resource `domains` metadata is currently bridged onto `feature` references, not onto a distinct domain-node layer.
65
+ - The 2026-04-20 reality-domain expansion (identity, customers, offerings, roles, goals, statuses, operations, techStack) does not introduce new graph node kinds. Those domains are model-layer data; they are not independently represented as graph nodes. They can be surfaced as metadata on the organization root node when a consumer needs to expose them through a graph lens.
65
66
  - Graph defaults remain valid when produced by `resolveOrganizationModel()`.
66
67
  - If the graph needs a concept the model cannot express, extend the model first.
67
68
 
@@ -5,7 +5,7 @@ description: Organization OS Model layer documentation for the semantic organiza
5
5
 
6
6
  ## Overview
7
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.
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
9
 
10
10
  The model is authored in `@repo/core` and published as a curated external package `@elevasis/core`. It is consumed by:
11
11
 
@@ -21,7 +21,7 @@ The model does **not** replace the shared feature-provider system. It enriches a
21
21
  - `packages/core/src/organization-model/types.ts` -- exported TypeScript types
22
22
  - `packages/core/src/organization-model/defaults.ts` -- `DEFAULT_ORGANIZATION_MODEL`
23
23
  - `packages/core/src/organization-model/resolve.ts` -- `defineOrganizationModel`, `resolveOrganizationModel`
24
- - `packages/core/src/organization-model/domains/*.ts` -- feature schema, navigation surfaces, CRM/lead-gen/delivery semantics
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
25
  - `packages/core/src/published.ts` -- curated root barrel for the published package
26
26
  - `packages/core/src/organization-model/published.ts` -- curated organization-model barrel
27
27
  - `packages/core/src/__tests__/template-foundations-compatibility.test.ts` -- adapter-baseline guard
@@ -32,12 +32,31 @@ Top-level fields on `OrganizationModel`:
32
32
 
33
33
  - `version`
34
34
  - `features` -- unified feature array (`OrganizationModelFeature[]`); each entry combines access gating, semantic grouping, and display metadata
35
- - `branding`
35
+ - `branding` -- display identity (org name, product name, logos)
36
36
  - `navigation` -- surfaces, groups, `defaultSurfaceId`
37
- - `crm` -- pipeline stages and stage semantics
38
- - `leadGen` -- company/contact lifecycle stages
39
- - `delivery` -- project/milestone/task statuses
40
- - `resourceMappings`
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.
41
60
 
42
61
  ### Branding Shape
43
62
 
@@ -56,22 +75,25 @@ All `id` fields, `parentId`, `defaultSurfaceId`, and reference ID arrays use `Mo
56
75
  - Regex: `/^[a-z0-9]+(?:[-._][a-z0-9]+)*$/`
57
76
  - Max length: 100 chars
58
77
  - Allowed separators: `-`, `_`, `.`
59
- - Examples: `crm.pipeline`, `lead-gen.lists`, `operations.organization-graph`
78
+ - Examples: `sales.pipeline`, `prospecting.lists`, `operations.organization-graph`
60
79
 
61
80
  This applies to domain IDs, surface IDs, navigation group IDs, and resource mapping IDs.
62
81
 
63
82
  ### Default Features
64
83
 
65
- Seven features ship by default in `DEFAULT_ORGANIZATION_MODEL.features`:
84
+ Eight features ship by default in `DEFAULT_ORGANIZATION_MODEL.features`:
66
85
 
67
- - `crm` -- enabled; CRM pipeline and deal management
68
- - `lead-gen` -- enabled; prospecting, qualification, and outreach
69
- - `projects` -- enabled; projects, milestones, and client work execution (formerly `delivery`)
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
70
89
  - `operations` -- enabled; organizational topology and orchestration visibility
71
90
  - `monitoring` -- enabled; execution monitoring
72
91
  - `settings` -- enabled; organization settings
92
+ - `submitted-requests` -- enabled; submitted-request lifecycle surface
73
93
  - `seo` -- disabled by default; SEO surface
74
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
+
75
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.
76
98
 
77
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.
@@ -88,18 +110,30 @@ Each feature entry (`OrganizationModelFeature`) combines what were previously th
88
110
  - `entityIds` -- entities this resource operates on
89
111
  - `surfaceIds` -- surfaces this resource is exposed in
90
112
  - `capabilityIds` -- capabilities this resource fulfills
113
+ - `techStack` (optional) -- external-SaaS integration metadata; see TechStack Extension below
91
114
 
92
115
  All four ID arrays are bidirectionally validated against their counterparts (see Referential Integrity).
93
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
+
94
128
  ### Default Navigation
95
129
 
96
- 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.
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.
97
131
 
98
132
  ### SurfaceDefinition Shape
99
133
 
100
134
  `OrganizationModelSurface` (inferred from `SurfaceDefinitionSchema`) defines a navigable view:
101
135
 
102
- - `id` -- ModelId (e.g. `crm.pipeline`)
136
+ - `id` -- ModelId (e.g. `sales.pipeline`)
103
137
  - `label` -- display name
104
138
  - `path` -- route path, must start with `/`, max 300 chars
105
139
  - `surfaceType` -- `'page' | 'dashboard' | 'graph' | 'detail' | 'list' | 'settings'`
@@ -124,14 +158,36 @@ The default groups (`primary-workspace`, `primary-operations`) both use `placeme
124
158
 
125
159
  ### Feature-Specific Semantics
126
160
 
127
- The top-level `crm`, `leadGen`, and `delivery` fields on `OrganizationModel` remain as named fields (not moved into per-feature config) and carry domain-specific semantic shapes:
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:
128
162
 
129
- - `crm` -- pipeline stages and stage semantics
130
- - `leadGen` -- company and contact lifecycle stages
131
- - `delivery` -- project, milestone, and task statuses (used by the `projects` feature)
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`)
132
166
 
133
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.
134
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
+
135
191
  ## Authoring & Resolution
136
192
 
137
193
  - `defineOrganizationModel()` -- typed authoring helper; returns the input unchanged but constrains the type.
@@ -179,6 +235,13 @@ Merge semantics:
179
235
 
180
236
  This bidirectional enforcement is what keeps the organization model semantically consistent rather than loosely structured config.
181
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
+
182
245
  ## Provider Integration
183
246
 
184
247
  `ElevasisFeaturesProvider` uses the organization model in three ways:
@@ -236,7 +299,9 @@ Exports the foundations module provides to consumers:
236
299
  - `FoundationFeatureKey`, `FoundationSurfaceIcon`, `FoundationNavigationSurface`, `FoundationOrganizationModel`
237
300
  - `homeLabel`, `quickAccessSurfaceIds`, `getOrganizationSurface(surfaceId)`
238
301
 
239
- Downstream template shells pass `canonicalOrganizationModel` into `ElevasisFeaturesProvider`, preserving host-local dashboard/nav customizations alongside the shared runtime. Feature IDs are now direct matches -- `crm`, `lead-gen`, `projects` in the org model correspond directly to the same IDs on `FeatureModule.featureId`. No alias layer is needed.
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.
240
305
 
241
306
  Derivative projects (`external/nirvana-marketing`, `external/ZentaraHQ`) follow the same adapter + provider-wiring baseline with their own project-local customizations.
242
307
 
@@ -1,20 +1,47 @@
1
1
  export { OrganizationModelSchema } from './schema'
2
2
  export { FeatureSchema } from './domains/features'
3
+ export { TechStackEntrySchema } from './domains/shared'
3
4
  export {
4
5
  PROJECTS_FEATURE_ID,
5
6
  PROJECTS_INDEX_SURFACE_ID,
6
- DELIVERY_PROJECTS_VIEW_CAPABILITY_ID,
7
- CRM_FEATURE_ID,
8
- LEAD_GEN_FEATURE_ID,
7
+ PROJECTS_VIEW_CAPABILITY_ID,
8
+ SALES_FEATURE_ID,
9
+ PROSPECTING_FEATURE_ID,
9
10
  OPERATIONS_FEATURE_ID,
10
11
  MONITORING_FEATURE_ID,
11
12
  SETTINGS_FEATURE_ID,
12
13
  SEO_FEATURE_ID,
13
- CRM_PIPELINE_SURFACE_ID,
14
- LEAD_GEN_LISTS_SURFACE_ID,
14
+ SALES_PIPELINE_SURFACE_ID,
15
+ PROSPECTING_LISTS_SURFACE_ID,
15
16
  OPERATIONS_ORGANIZATION_GRAPH_SURFACE_ID
16
17
  } from './contracts'
17
18
  export { DEFAULT_ORGANIZATION_MODEL } from './defaults'
19
+ export {
20
+ DEFAULT_ORGANIZATION_MODEL_STATUSES,
21
+ StatusesDomainSchema,
22
+ StatusEntrySchema,
23
+ StatusSemanticClassSchema
24
+ } from './domains/statuses'
25
+ export {
26
+ DEFAULT_ORGANIZATION_MODEL_OPERATIONS,
27
+ OperationsDomainSchema,
28
+ OperationEntrySchema,
29
+ OperationSemanticClassSchema
30
+ } from './domains/operations'
31
+ export {
32
+ DEFAULT_ORGANIZATION_MODEL_CUSTOMERS,
33
+ CustomersDomainSchema,
34
+ CustomerSegmentSchema,
35
+ FirmographicsSchema
36
+ } from './domains/customers'
37
+ export {
38
+ DEFAULT_ORGANIZATION_MODEL_OFFERINGS,
39
+ OfferingsDomainSchema,
40
+ ProductSchema,
41
+ PricingModelSchema
42
+ } from './domains/offerings'
43
+ export { DEFAULT_ORGANIZATION_MODEL_ROLES, RolesDomainSchema, RoleSchema } from './domains/roles'
44
+ export { DEFAULT_ORGANIZATION_MODEL_GOALS, GoalsDomainSchema, ObjectiveSchema, KeyResultSchema } from './domains/goals'
18
45
  export { defineOrganizationModel, resolveOrganizationModel } from './resolve'
19
46
  export { createFoundationOrganizationModel } from './foundation'
20
47
 
@@ -22,12 +49,30 @@ export type {
22
49
  DeepPartial,
23
50
  OrganizationModel,
24
51
  OrganizationModelBranding,
25
- OrganizationModelCrm,
26
- OrganizationModelDelivery,
52
+ OrganizationModelSales,
53
+ OrganizationModelProspecting,
54
+ OrganizationModelProjects,
55
+ OrganizationModelCustomerFirmographics,
56
+ OrganizationModelCustomers,
57
+ OrganizationModelCustomerSegment,
27
58
  OrganizationModelFeature,
28
- OrganizationModelLeadGen,
59
+ OrganizationModelGoals,
60
+ OrganizationModelKeyResult,
29
61
  OrganizationModelNavigation,
62
+ OrganizationModelObjective,
63
+ OrganizationModelOfferings,
64
+ OrganizationModelOperationEntry,
65
+ OrganizationModelOperationSemanticClass,
66
+ OrganizationModelOperations,
67
+ OrganizationModelPricingModel,
68
+ OrganizationModelProduct,
30
69
  OrganizationModelResourceMapping,
70
+ OrganizationModelRole,
71
+ OrganizationModelTechStackEntry,
72
+ OrganizationModelRoles,
73
+ OrganizationModelStatuses,
74
+ OrganizationModelStatusEntry,
75
+ OrganizationModelStatusSemanticClass,
31
76
  OrganizationModelSurface
32
77
  } from './types'
33
78
 
@@ -1,20 +1,34 @@
1
1
  import { z } from 'zod'
2
2
  import { OrganizationModelBrandingSchema } from './domains/branding'
3
- import { OrganizationModelCrmSchema } from './domains/crm'
4
- import { OrganizationModelDeliverySchema } from './domains/delivery'
3
+ import { OrganizationModelSalesSchema } from './domains/sales'
4
+ import { OrganizationModelProjectsSchema } from './domains/projects'
5
5
  import { FeatureSchema } from './domains/features'
6
- import { OrganizationModelLeadGenSchema } from './domains/lead-gen'
6
+ import { OrganizationModelProspectingSchema } from './domains/prospecting'
7
7
  import { OrganizationModelNavigationSchema } from './domains/navigation'
8
8
  import { ResourceMappingSchema } from './domains/shared'
9
+ import { IdentityDomainSchema, DEFAULT_ORGANIZATION_MODEL_IDENTITY } from './domains/identity'
10
+ import { CustomersDomainSchema, DEFAULT_ORGANIZATION_MODEL_CUSTOMERS } from './domains/customers'
11
+ import { OfferingsDomainSchema, DEFAULT_ORGANIZATION_MODEL_OFFERINGS } from './domains/offerings'
12
+ import { RolesDomainSchema, DEFAULT_ORGANIZATION_MODEL_ROLES } from './domains/roles'
13
+ import { GoalsDomainSchema, DEFAULT_ORGANIZATION_MODEL_GOALS } from './domains/goals'
14
+ import { OperationsDomainSchema } from './domains/operations'
15
+ import { StatusesDomainSchema } from './domains/statuses'
9
16
 
10
17
  const OrganizationModelSchemaBase = z.object({
11
18
  version: z.literal(1).default(1),
12
19
  features: z.array(FeatureSchema).default([]),
13
20
  branding: OrganizationModelBrandingSchema,
14
21
  navigation: OrganizationModelNavigationSchema,
15
- crm: OrganizationModelCrmSchema,
16
- leadGen: OrganizationModelLeadGenSchema,
17
- delivery: OrganizationModelDeliverySchema,
22
+ sales: OrganizationModelSalesSchema,
23
+ prospecting: OrganizationModelProspectingSchema,
24
+ projects: OrganizationModelProjectsSchema,
25
+ identity: IdentityDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_IDENTITY),
26
+ customers: CustomersDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_CUSTOMERS),
27
+ offerings: OfferingsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_OFFERINGS),
28
+ roles: RolesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ROLES),
29
+ goals: GoalsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_GOALS),
30
+ statuses: StatusesDomainSchema.default({ entries: [] }),
31
+ operations: OperationsDomainSchema.default({ entries: [] }),
18
32
  resourceMappings: z.array(ResourceMappingSchema).default([])
19
33
  })
20
34
 
@@ -176,12 +190,58 @@ export const OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((
176
190
  addIssue(
177
191
  ctx,
178
192
  ['navigation', 'surfaces', surfaceIndex, 'resourceIds', resourceIndex],
179
- `Surface "${surface.id}" references resource "${resourceId}" but that resource mapping does not include surface "${surface.id}"`
193
+ `Surface "${surface.id}" references resource "${resourceId}" but that surface does not include resource "${surface.id}"`
180
194
  )
181
195
  }
182
196
  })
183
197
  })
184
198
 
199
+ // Offerings -> CustomerSegment cross-ref: targetSegmentIds must resolve
200
+ const segmentsById = new Map(model.customers.segments.map((seg) => [seg.id, seg]))
201
+ model.offerings.products.forEach((product, productIndex) => {
202
+ product.targetSegmentIds.forEach((segmentId, segmentIndex) => {
203
+ if (!segmentsById.has(segmentId)) {
204
+ addIssue(
205
+ ctx,
206
+ ['offerings', 'products', productIndex, 'targetSegmentIds', segmentIndex],
207
+ `Product "${product.id}" references unknown customer segment "${segmentId}"`
208
+ )
209
+ }
210
+ })
211
+
212
+ // Offerings -> Feature cross-ref: deliveryFeatureId must resolve (when present)
213
+ if (product.deliveryFeatureId !== undefined && !featuresById.has(product.deliveryFeatureId)) {
214
+ addIssue(
215
+ ctx,
216
+ ['offerings', 'products', productIndex, 'deliveryFeatureId'],
217
+ `Product "${product.id}" references unknown delivery feature "${product.deliveryFeatureId}"`
218
+ )
219
+ }
220
+ })
221
+
222
+ // Goals -> period-range validation: periodEnd must be strictly after periodStart
223
+ model.goals.objectives.forEach((objective, index) => {
224
+ if (objective.periodEnd <= objective.periodStart) {
225
+ addIssue(
226
+ ctx,
227
+ ['goals', 'objectives', index, 'periodEnd'],
228
+ `Goal "${objective.id}" has periodEnd "${objective.periodEnd}" which must be strictly after periodStart "${objective.periodStart}"`
229
+ )
230
+ }
231
+ })
232
+
233
+ // Roles -> reportsToId cross-ref: each reportsToId must resolve to another role in the same collection
234
+ const rolesById = new Map(model.roles.roles.map((role) => [role.id, role]))
235
+ model.roles.roles.forEach((role, roleIndex) => {
236
+ if (role.reportsToId !== undefined && !rolesById.has(role.reportsToId)) {
237
+ addIssue(
238
+ ctx,
239
+ ['roles', 'roles', roleIndex, 'reportsToId'],
240
+ `Role "${role.id}" references unknown reportsToId "${role.reportsToId}"`
241
+ )
242
+ }
243
+ })
244
+
185
245
  // ResourceMapping -> Feature and Surface bidirectional validation
186
246
  model.resourceMappings.forEach((resourceMapping, resourceIndex) => {
187
247
  resourceMapping.featureIds.forEach((featureId, featureIndex) => {
@@ -1,22 +1,46 @@
1
1
  import type { z } from 'zod'
2
2
  import { OrganizationModelBrandingSchema } from './domains/branding'
3
- import { OrganizationModelCrmSchema } from './domains/crm'
4
- import { OrganizationModelDeliverySchema } from './domains/delivery'
3
+ import { OrganizationModelSalesSchema } from './domains/sales'
4
+ import { OrganizationModelProjectsSchema } from './domains/projects'
5
5
  import { FeatureSchema } from './domains/features'
6
- import { OrganizationModelLeadGenSchema } from './domains/lead-gen'
6
+ import { OrganizationModelProspectingSchema } from './domains/prospecting'
7
7
  import { OrganizationModelNavigationSchema, SurfaceDefinitionSchema } from './domains/navigation'
8
- import { ResourceMappingSchema } from './domains/shared'
8
+ import { ResourceMappingSchema, TechStackEntrySchema } from './domains/shared'
9
+ import { OperationsDomainSchema, OperationEntrySchema, OperationSemanticClassSchema } from './domains/operations'
10
+ import { StatusesDomainSchema, StatusEntrySchema, StatusSemanticClassSchema } from './domains/statuses'
11
+ import { CustomersDomainSchema, CustomerSegmentSchema, FirmographicsSchema } from './domains/customers'
12
+ import { OfferingsDomainSchema, ProductSchema, PricingModelSchema } from './domains/offerings'
13
+ import { RolesDomainSchema, RoleSchema } from './domains/roles'
14
+ import { GoalsDomainSchema, ObjectiveSchema, KeyResultSchema } from './domains/goals'
9
15
  import { OrganizationModelSchema } from './schema'
10
16
 
11
17
  export type OrganizationModel = z.infer<typeof OrganizationModelSchema>
12
18
  export type OrganizationModelBranding = z.infer<typeof OrganizationModelBrandingSchema>
13
- export type OrganizationModelCrm = z.infer<typeof OrganizationModelCrmSchema>
14
- export type OrganizationModelLeadGen = z.infer<typeof OrganizationModelLeadGenSchema>
15
- export type OrganizationModelDelivery = z.infer<typeof OrganizationModelDeliverySchema>
19
+ export type OrganizationModelSales = z.infer<typeof OrganizationModelSalesSchema>
20
+ export type OrganizationModelProspecting = z.infer<typeof OrganizationModelProspectingSchema>
21
+ export type OrganizationModelProjects = z.infer<typeof OrganizationModelProjectsSchema>
16
22
  export type OrganizationModelFeature = z.infer<typeof FeatureSchema>
17
23
  export type OrganizationModelNavigation = z.infer<typeof OrganizationModelNavigationSchema>
18
24
  export type OrganizationModelSurface = z.infer<typeof SurfaceDefinitionSchema>
19
25
  export type OrganizationModelResourceMapping = z.infer<typeof ResourceMappingSchema>
26
+ export type OrganizationModelTechStackEntry = z.infer<typeof TechStackEntrySchema>
27
+ export type OrganizationModelStatuses = z.infer<typeof StatusesDomainSchema>
28
+ export type OrganizationModelStatusEntry = z.infer<typeof StatusEntrySchema>
29
+ export type OrganizationModelStatusSemanticClass = z.infer<typeof StatusSemanticClassSchema>
30
+ export type OrganizationModelOperations = z.infer<typeof OperationsDomainSchema>
31
+ export type OrganizationModelOperationEntry = z.infer<typeof OperationEntrySchema>
32
+ export type OrganizationModelOperationSemanticClass = z.infer<typeof OperationSemanticClassSchema>
33
+ export type OrganizationModelCustomers = z.infer<typeof CustomersDomainSchema>
34
+ export type OrganizationModelCustomerSegment = z.infer<typeof CustomerSegmentSchema>
35
+ export type OrganizationModelCustomerFirmographics = z.infer<typeof FirmographicsSchema>
36
+ export type OrganizationModelOfferings = z.infer<typeof OfferingsDomainSchema>
37
+ export type OrganizationModelProduct = z.infer<typeof ProductSchema>
38
+ export type OrganizationModelPricingModel = z.infer<typeof PricingModelSchema>
39
+ export type OrganizationModelRoles = z.infer<typeof RolesDomainSchema>
40
+ export type OrganizationModelRole = z.infer<typeof RoleSchema>
41
+ export type OrganizationModelGoals = z.infer<typeof GoalsDomainSchema>
42
+ export type OrganizationModelObjective = z.infer<typeof ObjectiveSchema>
43
+ export type OrganizationModelKeyResult = z.infer<typeof KeyResultSchema>
20
44
 
21
45
  export type DeepPartial<T> =
22
46
  T extends Array<infer U> ? Array<DeepPartial<U>> : T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T
@@ -1,3 +1,3 @@
1
1
  export const VERSION = {
2
- CURRENT: '1.6.1'
2
+ CURRENT: '1.6.3'
3
3
  }
@@ -119,7 +119,7 @@ export interface ResourceList {
119
119
  // ============================================================================
120
120
 
121
121
  /** Webhook provider identifiers */
122
- export type WebhookProviderType = 'cal-com' | 'stripe' | 'signature-api' | 'instantly' | 'apify'
122
+ export type WebhookProviderType = 'cal-com' | 'stripe' | 'signature-api' | 'instantly' | 'apify' | 'test'
123
123
 
124
124
  /** Webhook trigger configuration */
125
125
  export interface WebhookTriggerConfig {
@@ -132,6 +132,7 @@ export const UpdateMilestoneRequestSchema = z
132
132
  due_date: z.string().nullable().optional(),
133
133
  completed_at: z.string().nullable().optional(),
134
134
  sequence: z.number().int().min(0).optional(),
135
+ checklist: ChecklistSchema.optional(),
135
136
  metadata: z.record(z.string(), z.unknown()).nullable().optional()
136
137
  })
137
138
  .strict()