@elevasis/sdk 1.36.5 → 1.38.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 (57) hide show
  1. package/dist/cli.cjs +64 -22
  2. package/dist/index.d.ts +105 -7
  3. package/dist/index.js +81 -33
  4. package/dist/node/index.d.ts +6 -5
  5. package/dist/test-utils/index.d.ts +6 -5
  6. package/dist/test-utils/index.js +70 -32
  7. package/dist/worker/index.js +7 -11
  8. package/package.json +4 -4
  9. package/reference/claude-config/Overview.md +140 -32
  10. package/reference/claude-config/rules/active-change-index.md +13 -2
  11. package/reference/claude-config/rules/agent-start-here.md +13 -2
  12. package/reference/claude-config/rules/deployment.md +13 -2
  13. package/reference/claude-config/rules/error-handling.md +13 -2
  14. package/reference/claude-config/rules/execution.md +13 -2
  15. package/reference/claude-config/rules/frontend.md +13 -2
  16. package/reference/claude-config/rules/observability.md +13 -2
  17. package/reference/claude-config/rules/operations.md +13 -2
  18. package/reference/claude-config/rules/organization-model.md +1 -1
  19. package/reference/claude-config/rules/organization-os.md +1 -1
  20. package/reference/claude-config/rules/package-taxonomy.md +13 -2
  21. package/reference/claude-config/rules/platform.md +13 -2
  22. package/reference/claude-config/rules/shared-types.md +13 -2
  23. package/reference/claude-config/rules/task-tracking.md +13 -2
  24. package/reference/claude-config/rules/topbar-actions.md +2 -2
  25. package/reference/claude-config/rules/ui.md +13 -2
  26. package/reference/claude-config/rules/vibe.md +13 -2
  27. package/reference/claude-config/settings.json +30 -34
  28. package/reference/claude-config/skills/deploy/SKILL.md +159 -156
  29. package/reference/claude-config/skills/elevasis/SKILL.md +11 -4
  30. package/reference/claude-config/skills/explore/SKILL.md +78 -78
  31. package/reference/claude-config/skills/git-sync/SKILL.md +166 -126
  32. package/reference/claude-config/skills/om/SKILL.md +15 -15
  33. package/reference/claude-config/skills/om/operations/build.md +2 -2
  34. package/reference/claude-config/skills/project/SKILL.md +1 -1
  35. package/reference/claude-config/skills/save/SKILL.md +183 -183
  36. package/reference/claude-config/skills/setup/SKILL.md +9 -3
  37. package/reference/claude-config/skills/status/SKILL.md +59 -59
  38. package/reference/claude-config/skills/sync/SKILL.md +47 -47
  39. package/reference/claude-config/skills/tutorial/SKILL.md +1 -1
  40. package/reference/claude-config/skills/tutorial/technical.md +11 -11
  41. package/reference/claude-config/sync-notes/2026-06-15-session-chat-zero-wiring.md +46 -0
  42. package/reference/claude-config/sync-notes/2026-06-17-agent-session-ux-features.md +34 -0
  43. package/reference/claude-config/sync-notes/2026-06-25-shared-page-scroll-contract-guard.md +52 -0
  44. package/reference/claude-config/sync-notes/2026-06-26-leadgen-overview-om-telemetry.md +47 -0
  45. package/reference/claude-config/sync-notes/2026-07-21-agent-scaffold-hardening.md +75 -0
  46. package/reference/rules/active-change-index.md +5 -5
  47. package/reference/rules/agent-start-here.md +34 -30
  48. package/reference/rules/deployment.md +21 -8
  49. package/reference/rules/frontend.md +4 -4
  50. package/reference/rules/observability.md +1 -1
  51. package/reference/rules/organization-model.md +1 -1
  52. package/reference/rules/organization-os.md +29 -29
  53. package/reference/rules/ui.md +205 -202
  54. package/reference/rules/vibe.md +5 -4
  55. package/reference/scaffold/operations/propagation-pipeline.md +1 -1
  56. package/reference/scaffold/recipes/extend-lead-gen.md +505 -332
  57. package/reference/scaffold/reference/contracts.md +14 -21
@@ -34,7 +34,7 @@ As of the 2026-05 resource-governance expansion, `OrganizationModel` includes pl
34
34
 
35
35
  Resource identity is authored once in the id-keyed `resources` map. Each resource attaches to a System via `systemPath` and can declare ontology relationships through `resource.ontology`. Operations imports those descriptors and derives runtime `resourceId` / `type` while assembling the `DeploymentSpec`.
36
36
 
37
- `System.apiInterface` is an adopt-only marker for platform-provided API capabilities. Tenants may use only the supported profiles listed in `node_modules/@elevasis/sdk/reference/scaffold/reference/system-interface-capabilities.md`, at their convention-locked System paths such as `sales.lead-gen` and `sales.crm`. Custom Systems should not declare `apiInterface`; extend behavior through ontology, resources, catalogs, topology, navigation, and workflows/operations.
37
+ `System.apiInterface` is an adopt-only marker for platform-provided API capabilities. Tenants may use only the supported profiles listed in `operations/node_modules/@elevasis/sdk/reference/scaffold/reference/system-interface-capabilities.md`, at their convention-locked System paths such as `sales.lead-gen` and `sales.crm`. Custom Systems should not declare `apiInterface`; extend behavior through ontology, resources, catalogs, topology, navigation, and workflows/operations.
38
38
 
39
39
  Do not confuse `System.apiInterface` with ontology `interface` records. Ontology interface ids use the semantic record shape such as `<system>:interface/<local-id>`; `system.apiInterface` is a flat System field that declares intent to adopt a platform API capability and has derived readiness requirements.
40
40
 
@@ -54,27 +54,27 @@ Full Organization OS documentation ships with the SDK and is available locally a
54
54
 
55
55
  ### Scaffold Reference (via SDK)
56
56
 
57
- All paths under `node_modules/@elevasis/sdk/reference/scaffold/`:
58
-
59
- - `node_modules/@elevasis/sdk/reference/scaffold/index.mdx` -- scaffold root and navigation
60
- - `node_modules/@elevasis/sdk/reference/scaffold/core/organization-model.mdx` -- semantic contract, domains, adapter authoring, validation gate, `/om` entry point
61
- - `node_modules/@elevasis/sdk/reference/scaffold/core/organization-graph.mdx` -- graph derivation, node/edge taxonomy, lenses
62
- - `node_modules/@elevasis/sdk/reference/scaffold/ui/feature-shell.mdx` -- SystemModule manifest, provider runtime
63
- - `node_modules/@elevasis/sdk/reference/scaffold/ui/composition-extensibility.mdx` -- layout primitives, router abstraction
64
- - `node_modules/@elevasis/sdk/reference/scaffold/ui/recipes.md` -- copy-paste UI recipes for pages, nav items, components
65
- - `node_modules/@elevasis/sdk/reference/scaffold/ui/feature-flags-and-gating.md` -- three-concept gating model
66
- - `node_modules/@elevasis/sdk/reference/scaffold/ui/customization.md` -- sidebar composition via manifest overrides
67
- - `node_modules/@elevasis/sdk/reference/scaffold/recipes/add-a-feature.md` -- end-to-end OM-backed System recipe through manifest, routes, and gating
68
- - `node_modules/@elevasis/sdk/reference/scaffold/recipes/add-a-resource.md` -- author and deploy a workflow or agent
69
- - `node_modules/@elevasis/sdk/reference/scaffold/recipes/gate-by-feature-or-admin.md` -- decision table for access control patterns
70
- - `node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-lead-gen.md` -- build or extend lead-gen pages, sidebars, hooks, list/member state, artifacts, workflow adapters, and prospecting semantics
71
- - `node_modules/@elevasis/sdk/reference/scaffold/operations/workflow-recipes.md` -- workflow anatomy, adapter patterns, trigger patterns
72
- - `node_modules/@elevasis/sdk/reference/scaffold/operations/propagation-pipeline.md` -- how sync and verification work across projects
73
- - `node_modules/@elevasis/sdk/reference/scaffold/operations/scaffold-maintenance.md` -- content placement and auto-generation pipeline
74
- - `node_modules/@elevasis/sdk/reference/scaffold/reference/glossary.md` -- Organization OS term definitions
75
- - `node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md` -- auto-generated TypeScript contract shapes
76
- - `node_modules/@elevasis/sdk/reference/scaffold/reference/system-interface-capabilities.md` -- generated catalog of platform-owned `system.apiInterface` readiness profiles and requirements
77
- - `node_modules/@elevasis/sdk/reference/scaffold/reference/feature-registry.md` -- auto-generated feature manifest catalog
57
+ All paths under `operations/node_modules/@elevasis/sdk/reference/scaffold/`:
58
+
59
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/index.mdx` -- scaffold root and navigation
60
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/core/organization-model.mdx` -- semantic contract, domains, adapter authoring, validation gate, `/om` entry point
61
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/core/organization-graph.mdx` -- graph derivation, node/edge taxonomy, lenses
62
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/ui/feature-shell.mdx` -- SystemModule manifest, provider runtime
63
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/ui/composition-extensibility.mdx` -- layout primitives, router abstraction
64
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/ui/recipes.md` -- copy-paste UI recipes for pages, nav items, components
65
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/ui/feature-flags-and-gating.md` -- three-concept gating model
66
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/ui/customization.md` -- sidebar composition via manifest overrides
67
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/recipes/add-a-feature.md` -- end-to-end OM-backed System recipe through manifest, routes, and gating
68
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/recipes/add-a-resource.md` -- author and deploy a workflow or agent
69
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/recipes/gate-by-feature-or-admin.md` -- decision table for access control patterns
70
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-lead-gen.md` -- build or extend lead-gen pages, sidebars, hooks, list/member state, artifacts, workflow adapters, and prospecting semantics
71
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/operations/workflow-recipes.md` -- workflow anatomy, adapter patterns, trigger patterns
72
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/operations/propagation-pipeline.md` -- how sync and verification work across projects
73
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/operations/scaffold-maintenance.md` -- content placement and auto-generation pipeline
74
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/reference/glossary.md` -- Organization OS term definitions
75
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md` -- auto-generated TypeScript contract shapes
76
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/reference/system-interface-capabilities.md` -- generated catalog of platform-owned `system.apiInterface` readiness profiles and requirements
77
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/reference/feature-registry.md` -- auto-generated feature manifest catalog
78
78
 
79
79
  ### Local Project Docs
80
80
 
@@ -93,17 +93,17 @@ All paths under `node_modules/@elevasis/sdk/reference/scaffold/`:
93
93
  ## When Working with Organization OS
94
94
 
95
95
  - **Changing org model (structural reality):** Use `/om` as the entry point. Direct edits to `core/config/organization-model.ts` are discouraged -- `/om` runs the read -> propose -> confirm -> write -> validate ceremony. Run `/om` for the full layered flow or `/om \<domain>` for a targeted domain. See `.claude/rules/organization-model.md` for the concrete authoring boundary.
96
- - **Building or extending CRM:** Start with `node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-crm.md`. CRM spans Organization OS sales semantics, shared UI primitives, deal hooks, workflow adapters, and generated contracts.
97
- - **Building or extending lead gen:** Start with `node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-lead-gen.md`. Lead gen spans Organization OS prospecting semantics, shared UI primitives, list/member hooks, artifact hooks, workflow adapters, and generated contracts.
98
- - **Customizing CRM deal actions:** Follow `node_modules/@elevasis/sdk/reference/scaffold/recipes/customize-crm-actions.md`. Do not add `sales.actions` to the org model; the v1 server-side override surface is intentionally deferred.
96
+ - **Building or extending CRM:** Start with `operations/node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-crm.md`. CRM spans Organization OS sales semantics, shared UI primitives, deal hooks, workflow adapters, and generated contracts.
97
+ - **Building or extending lead gen:** Start with `operations/node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-lead-gen.md`. Lead gen spans Organization OS prospecting semantics, shared UI primitives, list/member hooks, artifact hooks, workflow adapters, and generated contracts.
98
+ - **Customizing CRM deal actions:** Follow `operations/node_modules/@elevasis/sdk/reference/scaffold/recipes/customize-crm-actions.md`. Do not add `sales.actions` to the org model; the v1 server-side override surface is intentionally deferred.
99
99
  - **Adding or toggling a System:** Follow the current scaffold recipes when they mention UI features, but translate Organization OS changes to Systems, navigation surfaces, and Actions. Use `/om systems` for availability/routing changes.
100
- - **Adding a resource:** Follow `node_modules/@elevasis/sdk/reference/scaffold/recipes/add-a-resource.md`.
100
+ - **Adding a resource:** Follow `operations/node_modules/@elevasis/sdk/reference/scaffold/recipes/add-a-resource.md`.
101
101
  - **Extending entities:** Start with `core/types/entities.ts` for the demo extension pattern. Base shapes come from `@elevasis/core/entities`.
102
102
  - **Authoring a workflow that takes a Project/Deal/etc.:** Reference entity types from `core/types/entities.ts` in the input schema -- do not redeclare them.
103
103
  - **Adding system-local ontology/config:** Put durable business schema in `System.ontology`, local defaults/settings in `System.config`, executable implementations in `resources`, and explanatory or governing material in `knowledge`.
104
- - **API-interface readiness questions:** Check `node_modules/@elevasis/sdk/reference/scaffold/reference/system-interface-capabilities.md` first. `apiInterface` is a closed platform adoption handshake: use the cataloged profile on the required System path, satisfy derived readiness with ontology/resource/catalog/topology authoring, and do not invent readiness profiles for custom Systems.
105
- - **Understanding generated type shapes:** Check `node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md` for current TypeScript shapes.
106
- - **Debugging sync issues:** Check `node_modules/@elevasis/sdk/reference/scaffold/operations/propagation-pipeline.md` for the verification pipeline.
104
+ - **API-interface readiness questions:** Check `operations/node_modules/@elevasis/sdk/reference/scaffold/reference/system-interface-capabilities.md` first. `apiInterface` is a closed platform adoption handshake: use the cataloged profile on the required System path, satisfy derived readiness with ontology/resource/catalog/topology authoring, and do not invent readiness profiles for custom Systems.
105
+ - **Understanding generated type shapes:** Check `operations/node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md` for current TypeScript shapes.
106
+ - **Debugging sync issues:** Check `operations/node_modules/@elevasis/sdk/reference/scaffold/operations/propagation-pipeline.md` for the verification pipeline.
107
107
 
108
108
  ## `/om` -- Org Model QA Entry Point
109
109
 
@@ -1,213 +1,216 @@
1
- ---
2
- description: UI shell, route structure, auth flow, API access, and template customization points for the ui/ surface
3
- paths:
4
- - ui/**
5
- ---
1
+ ---
2
+ description: UI shell, route structure, auth flow, API access, and template customization points for the ui/ surface
3
+ paths:
4
+ - ui/**
5
+ ---
6
6
  <!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
7
7
  <!-- Regenerate: pnpm scaffold:sync -->
8
8
 
9
-
10
- # UI Features
11
-
12
- **Status:** Stable
13
-
14
- ## App Shell Overview
15
-
16
- The template frontend is a React 19 + TanStack Router app that composes a local dashboard shell with published System modules from `@elevasis/ui`.
17
-
18
- The main join points are:
19
-
20
- - `ui/src/main.tsx` -- boots the app with `ElevasisUIProvider`, query client, theme config, WorkOS AuthKit, notifications, and the generated route tree
21
- - `ui/src/routes/__root.tsx` -- composes the authenticated shell with `ElevasisSystemsProvider`, published System modules, app-local dashboard nav, shell runtime dependencies, and `SystemShell`
22
- - `ui/src/config/nav-items.ts` -- keeps the host-local dashboard entry separate from the published feature manifests
23
- - `core/config/organization-model.ts` -- is the template's semantic source of truth, adapting `@elevasis/core/organization-model` into the preserved branding, dashboard label, quick-access, System labels, resource descriptors, and shell helpers
24
-
25
- Published System modules mounted by the template shell:
26
-
27
- - `lead-gen`
28
- - `crm`
29
- - `delivery` at `/projects`
30
- - `operations`
31
- - `monitoring`
32
- - `settings`
33
-
34
- Important distinction:
35
-
36
- - shared modules gate on current org-model System keys such as `sales.lead-gen` and `projects`
37
- - template routes and local nav may still use legacy aliases such as `crm`, `lead-gen`, and `projects`
38
- - `core/config/organization-model.ts` and `ui/src/lib/hooks/useFeatureAccess.ts` are the bridge between those two vocabularies
39
-
40
- Dashboard remains a host-local route at `/`, not a shared feature manifest.
41
-
42
- This template should be treated as the downstream reference implementation for this composition:
43
-
44
- - `core/config/organization-model.ts` owns the organization/runtime semantics
45
- - `ui/src/config/nav-items.ts` preserves the host-local dashboard entry instead of pushing that concern into shared manifests
46
- - `ui/src/routes/__root.tsx` threads `canonicalOrganizationModel` from `@core/config/organization-model` into `ElevasisSystemsProvider` so the shared shell/runtime uses the same semantic source of truth as the local template helpers
47
- - host-local customizations still stay local: dashboard remains app-owned nav, branding stays in app config, and quick-access/dashboard UX stays in the template app
48
-
49
- ## Auth and Initialization
50
-
51
- The app uses WorkOS AuthKit through `ElevasisUIProvider`. Authentication is enforced by the local `ProtectedRoute` wrapper in `ui/src/features/auth/ProtectedRoute.tsx`.
52
-
53
- **Sign-in flow:**
54
-
55
- 1. Unauthenticated user hits a protected route -- `ProtectedRoute` redirects to `/login?returnTo=<path>`
56
- 2. `/login` renders a sign-in card; user clicks Sign In, triggering `signIn({ returnTo })` from `useAuth()`
57
- 3. User authenticates on the WorkOS-hosted sign-in page
58
- 4. WorkOS redirects back to `/auth-redirect` -- `ui/src/routes/auth-redirect.tsx` waits for auth to complete, then navigates to the requested path or `/`
59
- 5. User lands on the home page, fully authenticated
60
-
61
- **Route protection:**
62
-
63
- Wrap protected route components with the local `ProtectedRoute` from `@/features/auth`, which adds the full-screen loader and delegates to the shared guard from `@elevasis/ui/auth`:
64
-
65
- ```tsx
66
- import { ProtectedRoute } from '@/features/auth'
67
-
68
- function HomePageGuarded() {
69
- return (
70
- <ProtectedRoute>
71
- <HomePage />
72
- </ProtectedRoute>
73
- )
74
- }
75
- ```
76
-
77
- **Initialization state:**
78
-
79
- Use `useInitialization()` from `@elevasis/ui/initialization` anywhere inside the app to read aggregated auth + org readiness:
80
-
81
- ```ts
82
- const { allReady, userReady, isInitializing, error, retry, profile } = useInitialization()
83
- ```
84
-
85
- **Organization context:**
86
-
87
- Use `useOrganization()` from `@elevasis/ui/organization` to access org-scoped IDs and memberships:
88
-
89
- ```ts
90
- const { currentWorkOSOrganizationId, currentSupabaseOrganizationId, memberships, switchOrganization } = useOrganization()
91
- ```
92
-
93
- ## API and Streaming
94
-
95
- Use `useApiClient()` from `@/lib/hooks/useApiClient` in route components and feature hooks:
96
-
97
- ```ts
98
- const { apiRequest, isOrganizationReady } = useApiClient()
99
- const data = await apiRequest('/executions', { method: 'GET' })
100
- ```
101
-
102
- The template also re-exports `useApiClientContext()` and the shared API client types from `@/lib/hooks/useApiClient`.
103
-
104
- For real-time updates, feature surfaces use the local singleton wrapper:
105
-
106
- ```ts
107
- import { sseConnectionManager } from '@/lib/sse/SSEConnectionManager'
108
- ```
109
-
110
- **WorkOS config:**
111
-
112
- WorkOS `clientId`, `redirectUri`, and `signoutUri` are resolved in `ui/src/config/workos.ts` from `VITE_WORKOS_CLIENT_ID`, `VITE_WORKOS_REDIRECT_URI`, `VITE_WORKOS_SIGNOUT_URI`, and `VITE_APP_ORIGIN`, with localhost fallbacks so the template runs locally without production env vars. For deployed apps, set the production env vars in the hosting provider and allow the exact redirect and sign-out URLs in the WorkOS application dashboard:
113
-
114
- - Redirect URI: `https://your-production-domain/auth-redirect`
115
- - Sign-out redirect: `https://your-production-domain/login`
116
- - Configure CORS origin: `https://your-production-domain`; required for browser AuthKit calls to `api.workos.com`
117
- - App homepage origin: `https://your-production-domain`
118
-
119
- The dev server runs on port `4300` with Vite `strictPort: true`, so a second `pnpm -C ui dev` on the same machine fails fast instead of drifting.
120
-
121
- The API URL is centralized in `ui/src/lib/constants/api.ts`. In the current template it is hard-coded to `https://api.elevasis.io`, so if the bootstrap is repointed to another API target, that file is the source of truth.
122
-
123
- ## Route Structure
124
-
9
+
10
+ # UI Features
11
+
12
+ **Status:** Stable
13
+
14
+ ## App Shell Overview
15
+
16
+ The template frontend is a React 19 + TanStack Router app that composes a local dashboard shell with published System modules from `@elevasis/ui`.
17
+
18
+ The main join points are:
19
+
20
+ - `ui/src/main.tsx` -- boots the app with `ElevasisUIProvider`, query client, theme config, WorkOS AuthKit, notifications, and the generated route tree
21
+ - `ui/src/routes/__root.tsx` -- composes the authenticated shell with `ElevasisSystemsProvider`, published System modules, app-local dashboard nav, shell runtime dependencies, and `SystemShell`
22
+ - `ui/src/config/nav-items.ts` -- keeps the host-local dashboard entry separate from the published feature manifests
23
+ - `core/config/organization-model.ts` -- is the template's semantic source of truth, adapting `@elevasis/core/organization-model` into the preserved branding, dashboard label, quick-access, System labels, resource descriptors, and shell helpers
24
+
25
+ Published System modules mounted by the template shell:
26
+
27
+ - `lead-gen`
28
+ - `crm`
29
+ - `delivery` at `/projects`
30
+ - `operations`
31
+ - `monitoring`
32
+ - `settings`
33
+
34
+ Important distinction:
35
+
36
+ - shared modules gate on current org-model System keys such as `sales.lead-gen` and `projects`
37
+ - template routes and local nav may still use legacy aliases such as `crm`, `lead-gen`, and `projects`
38
+ - `core/config/organization-model.ts` and feature-access gating built from `createFeatureAccessHook` (`@elevasis/ui/hooks`) are the bridge between those two vocabularies -- the template no longer ships a local `useFeatureAccess.ts`; the hook factory is the published equivalent
39
+
40
+ Dashboard remains a host-local route at `/`, not a shared feature manifest.
41
+
42
+ This template should be treated as the downstream reference implementation for this composition:
43
+
44
+ - `core/config/organization-model.ts` owns the organization/runtime semantics
45
+ - `ui/src/config/nav-items.ts` preserves the host-local dashboard entry instead of pushing that concern into shared manifests
46
+ - `ui/src/routes/__root.tsx` threads `canonicalOrganizationModel` from `@core/config/organization-model` into `ElevasisSystemsProvider` so the shared shell/runtime uses the same semantic source of truth as the local template helpers
47
+ - host-local customizations still stay local: dashboard remains app-owned nav, branding stays in app config, and quick-access/dashboard UX stays in the template app
48
+
49
+ ## Auth and Initialization
50
+
51
+ The app uses WorkOS AuthKit through `ElevasisUIProvider`. Authentication is enforced by `ProtectedRoute`, which ships from `@elevasis/ui` -- there is no local auth wrapper in the template.
52
+
53
+ **Sign-in flow:**
54
+
55
+ 1. Unauthenticated user hits a protected route -- `ProtectedRoute` redirects to `/login?returnTo=<path>`
56
+ 2. `/login` renders a sign-in card; user clicks Sign In, triggering `signIn({ returnTo })` from `useAuth()`
57
+ 3. User authenticates on the WorkOS-hosted sign-in page
58
+ 4. WorkOS redirects back to `/auth-redirect` -- `ui/src/routes/auth-redirect.tsx` waits for auth to complete, then navigates to the requested path or `/`
59
+ 5. User lands on the home page, fully authenticated
60
+
61
+ **Route protection:**
62
+
63
+ Wrap protected route components with `ProtectedRoute` from `@elevasis/ui/auth`. For access-gated feature routes, nest it with `AccessGuard` (see `ui/src/routes/lead-gen.tsx` and `crm.tsx` for the canonical pairing):
64
+
65
+ ```tsx
66
+ import { ProtectedRoute } from '@elevasis/ui/auth'
67
+
68
+ function HomePageGuarded() {
69
+ return (
70
+ <ProtectedRoute>
71
+ <HomePage />
72
+ </ProtectedRoute>
73
+ )
74
+ }
75
+ ```
76
+
77
+ **Initialization state:**
78
+
79
+ Use `useInitialization()` from `@elevasis/ui/initialization` anywhere inside the app to read aggregated auth + org readiness:
80
+
81
+ ```ts
82
+ const { allReady, userReady, isInitializing, error, retry, profile } = useInitialization()
83
+ ```
84
+
85
+ **Organization context:**
86
+
87
+ Use `useOrganization()` from `@elevasis/ui/organization` to access org-scoped IDs and memberships:
88
+
89
+ ```ts
90
+ const { currentWorkOSOrganizationId, currentSupabaseOrganizationId, memberships, switchOrganization } = useOrganization()
91
+ ```
92
+
93
+ ## API and Streaming
94
+
95
+ Use `useApiClient()` from `@elevasis/ui/api` in route components and feature hooks. It takes the API base URL as an argument -- pass `API_URL` from `@/lib/constants/api`:
96
+
97
+ ```ts
98
+ import { useApiClient } from '@elevasis/ui/api'
99
+ import { API_URL } from '@/lib/constants/api'
100
+
101
+ const { apiRequest } = useApiClient(API_URL)
102
+ const data = await apiRequest('/executions', { method: 'GET' })
103
+ ```
104
+
105
+ There is no `ui/src/lib/hooks/` directory in the template -- the API client comes from the published package, not a local wrapper.
106
+
107
+ For real-time updates, feature surfaces use the local singleton in `ui/src/lib/sse.ts`, which wraps `SSEConnectionManager` from `@elevasis/ui/sse`:
108
+
109
+ ```ts
110
+ import { sseConnectionManager } from '@/lib/sse'
111
+ ```
112
+
113
+ **WorkOS config:**
114
+
115
+ WorkOS `clientId`, `redirectUri`, and `signoutUri` are resolved in `ui/src/config/workos.ts` from `VITE_WORKOS_CLIENT_ID`, `VITE_WORKOS_REDIRECT_URI`, `VITE_WORKOS_SIGNOUT_URI`, and `VITE_APP_ORIGIN`, with localhost fallbacks so the template runs locally without production env vars. For deployed apps, set the production env vars in the hosting provider and allow the exact redirect and sign-out URLs in the WorkOS application dashboard:
116
+
117
+ - Redirect URI: `https://your-production-domain/auth-redirect`
118
+ - Sign-out redirect: `https://your-production-domain/login`
119
+ - Configure CORS origin: `https://your-production-domain`; required for browser AuthKit calls to `api.workos.com`
120
+ - App homepage origin: `https://your-production-domain`
121
+
122
+ The dev server runs on port `4300` with Vite `strictPort: true`, so a second `pnpm -C ui dev` on the same machine fails fast instead of drifting.
123
+
124
+ The API URL is centralized in `ui/src/lib/constants/api.ts`. In the current template it is hard-coded to `https://api.elevasis.io`, so if the bootstrap is repointed to another API target, that file is the source of truth.
125
+
126
+ ## Route Structure
127
+
125
128
  Current top-level app sections:
126
129
 
127
130
  - `/` -- host-local dashboard entrypoint with quick links derived from `organizationModel.navigation.quickAccessSurfaceIds`
128
131
  - `/public/agents/$slug` -- public, unauthenticated agent chat route for grant-backed public agents
129
132
  - `/lead-gen/*` -- lead generation pages (`lists`, `companies`, `contacts`)
130
- - `/crm/*` -- CRM overview, pipeline, and deals
131
- - `/projects/*` -- delivery feature pages (projects, milestones, tasks, notes)
132
- - `/operations/*` -- operations overview, resources, command queue, command view, sessions, task scheduler
133
- - `/monitoring/*` -- execution logs, execution health, activity log, cost analytics, notifications
134
- - `/settings/*` -- account, organization, credentials, API keys, deployments, webhooks, and appearance
133
+ - `/crm/*` -- CRM overview, pipeline, and deals
134
+ - `/projects/*` -- delivery feature pages (projects, milestones, tasks, notes)
135
+ - `/operations/*` -- operations overview, resources, command queue, command view, sessions, task scheduler
136
+ - `/monitoring/*` -- execution logs, execution health, activity log, cost analytics, notifications
137
+ - `/settings/*` -- account, organization, credentials, API keys, deployments, webhooks, and appearance
135
138
  - `/login` and `/auth-redirect` -- auth entry/callback routes
136
139
 
137
140
  Public routes use the `/public/` prefix and must render outside the authenticated app chrome. Public agent pages should import `PublicAgentChatRoutePage` from `@elevasis/ui/features/public-agent-chat` and mount it at `/public/agents/$slug`. Keep `/chat/$slug` only as a compatibility alias when preserving existing links.
138
-
139
- Section guards currently follow this pattern:
140
-
141
- - `ProtectedRoute` for all authenticated sections
142
- - `SystemGuard` on sections that should hard-stop when a System is disabled: `crm`, `lead-gen`, `projects`, `operations`, and `monitoring`
143
- - provider-level shell gating for shared System nav and sub-shell behavior
144
-
145
- The app shell in `__root.tsx` derives visible nav from `shellModel.systems` and `getSidebarLinks()`, filters admin-only entries locally using the signed-in profile, and passes `canonicalOrganizationModel` into `ElevasisSystemsProvider` so shared nav labels, paths, and graph runtime behavior resolve from the same organization-model semantic source.
146
-
147
- ## Dashboard and Feature Areas
148
-
149
- **Dashboard**
150
-
151
- `ui/src/features/dashboard/components/Dashboard.tsx` is intentionally lightweight. It acts as the host-owned landing page and renders quick access cards for the most important organization surfaces instead of duplicating the shared operations overview.
152
-
153
- **Operations**
154
-
155
- The operations area is the richest shared shell in the template. It includes:
156
-
157
- - resource inventory and detail pages
158
- - command queue and command view
159
- - sessions screens
160
- - the shared operations overview at `/operations/`
161
-
162
- **Monitoring**
163
-
164
- Monitoring is scaffolded as a shared feature area with route files for:
165
-
166
- - activity log
167
- - cost analytics
168
- - execution health
169
- - execution logs
170
- - notifications
171
-
172
- ## Customization Points
173
-
174
- The main template-owned customization surfaces are:
175
-
176
- - `ui/src/config/app-config.ts` -- brand name, logos, and app version
177
- - `ui/src/config/theme.ts` -- theme presets and defaults
178
- - `ui/src/config/background.tsx` -- shared background treatment
179
- - `ui/src/config/loader.tsx` -- global loader element
180
- - `ui/src/config/nav-items.ts` -- app-local nav entries, including the preserved dashboard/home entry
181
- - `core/config/organization-model.ts` -- product labels, System availability, resource descriptors, semantic surfaces, canonical-to-legacy surface aliases, and quick-access behavior
182
- - `ui/src/config/README.md` -- the deeper guide for those config files
183
-
184
- ## Customizing System Sidebars
185
-
186
- The template demonstrates one override pattern in `ui/src/routes/__root.tsx`: it extends `CRM_ITEMS` with a template-owned Reports link and replaces `crmManifest` with `customCrmManifest` in the System module array. The backing route lives at `ui/src/routes/crm/reports.tsx` -- delete both the nav item and the route if you don't need them.
187
-
188
- Two customization layers are available for every shared System sidebar:
189
-
190
- 1. **Nav-item shortcut (`items` prop)** -- when you just need to swap or extend the nav array, spread the published items constant and pass the result to `*SidebarMiddle`. The template's CRM customization uses this path.
191
-
192
- ```tsx
193
- import { crmManifest, CrmSidebar, CrmSidebarMiddle, CRM_ITEMS } from '@elevasis/ui/features/crm'
194
- import type { NavItem } from '@elevasis/ui/layout'
195
-
196
- const customItems: NavItem[] = [...CRM_ITEMS, { label: 'Reports', to: '/crm/reports', icon: IconFileText, exact: false }]
197
- const CustomCrmSidebar = () => <CrmSidebar><CrmSidebarMiddle items={customItems} /></CrmSidebar>
198
- const customCrmManifest = { ...crmManifest, sidebar: CustomCrmSidebar }
199
- ```
200
-
201
- 2. **Compose-primitives (structural changes)** -- when you need to inject panels, reorder sections, or add a new section, drop down to `CrmSidebarTop` + `SubshellNavList` + `SubshellSidebarSection` + published panels (`MyTasksPanel`, `QuickCreateActions`) and compose your own Middle.
202
-
203
- `manifest.sidebar` accepts any component, so arbitrary customization is always available. The `items` prop is an abstraction barrier for the common case, not a limit.
204
-
205
- See `node_modules/@elevasis/sdk/reference/scaffold/ui/customization.md` for the decision tree, page-wrapping pattern, and delivery's three-section variant. For broader CRM extension work across pages, hooks, actions, workflows, and org-model boundaries, start with `node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-crm.md`. For broader lead-gen extension work across pages, hooks, list/member state, artifacts, workflows, and org-model boundaries, start with `node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-lead-gen.md`. See `node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md` for `NavItem`, `SystemModule`, CRM platform primitives, Lead Gen platform primitives, and related TypeScript shapes.
206
-
207
- For CRM deal action buttons, read `node_modules/@elevasis/sdk/reference/scaffold/recipes/customize-crm-actions.md` before changing `crmActions`, `DealDetailPage`, `DealDrawer`, or custom workflow buttons. Start with the shared `crmActions` provider path for action visibility, labels, ordering, and render-time configuration. In v1, platform-known/default action endpoint behavior is server-constrained; use project-owned UI that calls the workflow directly when a custom key sits outside that server-dispatched set.
208
-
209
- ## Notes
210
-
211
- - `ui/src/routeTree.gen.ts` is generated by TanStack Router tooling. Do not hand-edit it.
212
- - The template ships a broad route surface so downstream projects can trim or reshape features without having to re-derive the shared shell contract from scratch.
213
- - For package-export discovery, glob `node_modules/@elevasis/sdk/reference/` or `node_modules/@repo/ui/dist/` for the current SDK/UI package surface.
141
+
142
+ Section guards currently follow this pattern:
143
+
144
+ - `ProtectedRoute` for all authenticated sections
145
+ - `SystemGuard` on sections that should hard-stop when a System is disabled: `crm`, `lead-gen`, `projects`, `operations`, and `monitoring`
146
+ - provider-level shell gating for shared System nav and sub-shell behavior
147
+
148
+ The app shell in `__root.tsx` derives visible nav from `shellModel.systems` and `getSidebarLinks()`, filters admin-only entries locally using the signed-in profile, and passes `canonicalOrganizationModel` into `ElevasisSystemsProvider` so shared nav labels, paths, and graph runtime behavior resolve from the same organization-model semantic source.
149
+
150
+ ## Dashboard and Feature Areas
151
+
152
+ **Dashboard**
153
+
154
+ `ui/src/features/dashboard/components/Dashboard.tsx` is intentionally lightweight. It acts as the host-owned landing page and renders quick access cards for the most important organization surfaces instead of duplicating the shared operations overview.
155
+
156
+ **Operations**
157
+
158
+ The operations area is the richest shared shell in the template. It includes:
159
+
160
+ - resource inventory and detail pages
161
+ - command queue and command view
162
+ - sessions screens
163
+ - the shared operations overview at `/operations/`
164
+
165
+ **Monitoring**
166
+
167
+ Monitoring is scaffolded as a shared feature area with route files for:
168
+
169
+ - activity log
170
+ - cost analytics
171
+ - execution health
172
+ - execution logs
173
+ - notifications
174
+
175
+ ## Customization Points
176
+
177
+ The main template-owned customization surfaces are:
178
+
179
+ - `ui/src/config/app-config.ts` -- brand name, logos, and app version
180
+ - `ui/src/config/theme.ts` -- theme presets and defaults
181
+ - `ui/src/config/background.tsx` -- shared background treatment
182
+ - `ui/src/config/loader.tsx` -- global loader element
183
+ - `ui/src/config/nav-items.ts` -- app-local nav entries, including the preserved dashboard/home entry
184
+ - `core/config/organization-model.ts` -- product labels, System availability, resource descriptors, semantic surfaces, canonical-to-legacy surface aliases, and quick-access behavior
185
+ - `ui/src/config/README.md` -- the deeper guide for those config files
186
+
187
+ ## Customizing System Sidebars
188
+
189
+ The template demonstrates one override pattern in `ui/src/routes/__root.tsx`: it extends `CRM_ITEMS` with a template-owned Reports link and replaces `crmManifest` with `customCrmManifest` in the System module array. The backing route lives at `ui/src/routes/crm/reports.tsx` -- delete both the nav item and the route if you don't need them.
190
+
191
+ Two customization layers are available for every shared System sidebar:
192
+
193
+ 1. **Nav-item shortcut (`items` prop)** -- when you just need to swap or extend the nav array, spread the published items constant and pass the result to `*SidebarMiddle`. The template's CRM customization uses this path.
194
+
195
+ ```tsx
196
+ import { crmManifest, CrmSidebar, CrmSidebarMiddle, CRM_ITEMS } from '@elevasis/ui/features/crm'
197
+ import type { NavItem } from '@elevasis/ui/layout'
198
+
199
+ const customItems: NavItem[] = [...CRM_ITEMS, { label: 'Reports', to: '/crm/reports', icon: IconFileText, exact: false }]
200
+ const CustomCrmSidebar = () => <CrmSidebar><CrmSidebarMiddle items={customItems} /></CrmSidebar>
201
+ const customCrmManifest = { ...crmManifest, sidebar: CustomCrmSidebar }
202
+ ```
203
+
204
+ 2. **Compose-primitives (structural changes)** -- when you need to inject panels, reorder sections, or add a new section, drop down to `CrmSidebarTop` + `SubshellNavList` + `SubshellSidebarSection` + published panels (`MyTasksPanel`, `QuickCreateActions`) and compose your own Middle.
205
+
206
+ `manifest.sidebar` accepts any component, so arbitrary customization is always available. The `items` prop is an abstraction barrier for the common case, not a limit.
207
+
208
+ See `operations/node_modules/@elevasis/sdk/reference/scaffold/ui/customization.md` for the decision tree, page-wrapping pattern, and delivery's three-section variant. For broader CRM extension work across pages, hooks, actions, workflows, and org-model boundaries, start with `operations/node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-crm.md`. For broader lead-gen extension work across pages, hooks, list/member state, artifacts, workflows, and org-model boundaries, start with `operations/node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-lead-gen.md`. See `operations/node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md` for `NavItem`, `SystemModule`, CRM platform primitives, Lead Gen platform primitives, and related TypeScript shapes.
209
+
210
+ For CRM deal action buttons, read `operations/node_modules/@elevasis/sdk/reference/scaffold/recipes/customize-crm-actions.md` before changing `crmActions`, `DealDetailPage`, `DealDrawer`, or custom workflow buttons. Start with the shared `crmActions` provider path for action visibility, labels, ordering, and render-time configuration. In v1, platform-known/default action endpoint behavior is server-constrained; use project-owned UI that calls the workflow directly when a custom key sits outside that server-dispatched set.
211
+
212
+ ## Notes
213
+
214
+ - `ui/src/routeTree.gen.ts` is generated by TanStack Router tooling. Do not hand-edit it.
215
+ - The template ships a broad route surface so downstream projects can trim or reshape features without having to re-derive the shared shell contract from scratch.
216
+ - For package-export discovery, glob `operations/node_modules/@elevasis/sdk/reference/` for the current SDK package surface or `ui/node_modules/@elevasis/ui/dist/` for the current UI package surface. `@repo/ui` is the monorepo-internal workspace name and is never installed in a tenant project -- the published package is `@elevasis/ui`, and it lives under `ui/node_modules/`, not the project root.
@@ -76,7 +76,7 @@ The user wants the agent to explain something -- a scope, an entity, a concept w
76
76
  bucket, catalog entry, progress step, pipeline column, or similarly closed business vocabulary,
77
77
  also show the cross-system impact before the normal description:
78
78
 
79
- 1. Read `node_modules/@elevasis/sdk/reference/spine/spine-primer.md` for the layering pattern.
79
+ 1. Read `operations/node_modules/@elevasis/sdk/reference/spine/spine-primer.md` for the layering pattern.
80
80
  2. Read the relevant domain in `core/config/organization-model.ts`.
81
81
  3. Explain the impact in vibe-coder language only: the business profile entry, the saved progress
82
82
  on each record, the automations that produce updates, and the dashboard or reports that read it.
@@ -154,11 +154,11 @@ This routing applies to both codify levels (decision #21 -- Codify ceremony dele
154
154
 
155
155
  Vibe detects the intent and delegates in both cases. It does not run either pipeline itself.
156
156
 
157
- For "build/extend the CRM" asks, classify the structural org-model portion as Codify, then read `node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-crm.md` before editing. CRM work often spans org-model sales semantics, shared UI routes, hooks, workflow adapters, and deal actions; do not reduce it to only `sales` config or only UI.
157
+ For "build/extend the CRM" asks, classify the structural org-model portion as Codify, then read `operations/node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-crm.md` before editing. CRM work often spans org-model sales semantics, shared UI routes, hooks, workflow adapters, and deal actions; do not reduce it to only `sales` config or only UI.
158
158
 
159
- For "build/extend lead gen" / "campaign creator" / "outbound list state" asks, classify the structural org-model portion as Codify, then read `node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-lead-gen.md` before editing. Lead-gen work often spans org-model prospecting semantics, shared UI routes, hooks, list/member state, artifacts, and workflow adapters; do not reduce it to only `prospecting` config or only UI.
159
+ For "build/extend lead gen" / "campaign creator" / "outbound list state" asks, classify the structural org-model portion as Codify, then read `operations/node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-lead-gen.md` before editing. Lead-gen work often spans org-model prospecting semantics, shared UI routes, hooks, list/member state, artifacts, and workflow adapters; do not reduce it to only `prospecting` config or only UI.
160
160
 
161
- For "add a custom CRM action" / "Send Quote button" asks, classify as Codify, then read `node_modules/@elevasis/sdk/reference/scaffold/recipes/customize-crm-actions.md` before editing. Start with the shared `crmActions` provider path for action visibility, labels, ordering, and render-time configuration. In v1, platform-known/default action endpoint behavior is server-constrained; use project-owned UI that calls the workflow directly when a custom key sits outside that server-dispatched set.
161
+ For "add a custom CRM action" / "Send Quote button" asks, classify as Codify, then read `operations/node_modules/@elevasis/sdk/reference/scaffold/recipes/customize-crm-actions.md` before editing. Start with the shared `crmActions` provider path for action visibility, labels, ordering, and render-time configuration. In v1, platform-known/default action endpoint behavior is server-constrained; use project-owned UI that calls the workflow directly when a custom key sits outside that server-dispatched set.
162
162
 
163
163
  Heuristics for when to propose codification (passed to `/om` as context):
164
164
 
@@ -270,3 +270,4 @@ Layers 2 (Public API), 3 (UI Shell Runtime), 5 (Toolkit), and 6 (Graph) require
270
270
  - Vibe is not a skill. It lives in this rule file + CLAUDE.md + the PreToolUse hook -- not in `.claude/skills/`.
271
271
  - Vibe does not own the codify ceremony. `/om` owns draft, confirm, write, and typecheck for both Level A and Level B codify pipelines (decision #21 -- Codify ceremony delegated to `/om`). Vibe detects intent and hands off.
272
272
  - Vibe is not active in the monorepo. If working inside the monorepo (not an `external/` project), this ambient routing does not apply.
273
+ - Vibe does not flip **public agent exposure**. Making a deployed agent reachable on the public internet (the `agent_access_grants` row behind `/public/agents/:slug`, managed via `grant:create` / `grant:update` / `grant:disable` or the Resource-page public/private toggle) is a **security boundary deliberately kept out of ambient routing** — a non-technical user describing their business must never be able to expose an agent by accident. This is a deliberate non-route, not an unhandled gap: do NOT classify "make my agent public" / "put the interview online" as Toggle (which is System on/off) and do NOT auto-execute. Surface the `grant:*` CLI or the Resource-page toggle in plain language and require explicit confirmation.
@@ -66,7 +66,7 @@ The canonical ownership vocabulary is:
66
66
  | Category | Strategy examples | Meaning |
67
67
  | ------------- | --------------------------------- | ------------------------------------------------------------------- |
68
68
  | `replace` | `replace-all` | Template-managed surface; copy from template baseline |
69
- | `merge` | `merge-baseline`, `merge-regions` | Merge-aware surface; preserve project customizations where required |
69
+ | `merge` | `merge-baseline`, `preserve-on-divergence` | Merge-aware surface; preserve project customizations where required |
70
70
  | `never-touch` | `verify-only` | Project-owned surface; planner may report drift but never writes |
71
71
  | `generated` | `generated-freshness` | Generated surface; verify/regen instead of copying |
72
72