@elevasis/sdk 1.21.0 → 1.22.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 (160) hide show
  1. package/dist/cli.cjs +951 -171
  2. package/dist/index.d.ts +632 -341
  3. package/dist/index.js +3102 -142
  4. package/dist/node/index.d.ts +1 -0
  5. package/dist/node/index.js +19 -1
  6. package/dist/test-utils/index.d.ts +313 -4
  7. package/dist/test-utils/index.js +3246 -281
  8. package/dist/worker/index.js +3041 -80
  9. package/package.json +3 -3
  10. package/reference/claude-config/hooks/post-edit-validate.mjs +98 -98
  11. package/reference/claude-config/hooks/scaffold-registry-reminder.mjs +188 -188
  12. package/reference/claude-config/hooks/tool-failure-recovery.mjs +73 -73
  13. package/reference/claude-config/registries/graph-skills.json +4 -4
  14. package/reference/claude-config/registries/knowledge-flags.json +0 -2
  15. package/reference/claude-config/rules/active-change-index.md +80 -80
  16. package/reference/claude-config/rules/agent-start-here.md +277 -277
  17. package/reference/claude-config/rules/deployment.md +57 -57
  18. package/reference/claude-config/rules/error-handling.md +56 -56
  19. package/reference/claude-config/rules/execution.md +40 -40
  20. package/reference/claude-config/rules/frontend.md +4 -4
  21. package/reference/claude-config/rules/observability.md +31 -31
  22. package/reference/claude-config/rules/operations.md +29 -17
  23. package/reference/claude-config/rules/organization-model.md +110 -84
  24. package/reference/claude-config/rules/organization-os.md +115 -113
  25. package/reference/claude-config/rules/package-taxonomy.md +33 -33
  26. package/reference/claude-config/rules/platform.md +42 -42
  27. package/reference/claude-config/rules/shared-types.md +49 -46
  28. package/reference/claude-config/rules/task-tracking.md +47 -47
  29. package/reference/claude-config/rules/ui.md +200 -200
  30. package/reference/claude-config/rules/vibe.md +235 -235
  31. package/reference/claude-config/scripts/statusline-command.js +18 -18
  32. package/reference/claude-config/settings.json +34 -34
  33. package/reference/claude-config/skills/deploy/{SKILL.md → skill.md} +156 -156
  34. package/reference/claude-config/skills/dsp/SKILL.md +66 -66
  35. package/reference/claude-config/skills/elevasis/SKILL.md +235 -235
  36. package/reference/claude-config/skills/explore/SKILL.md +6 -6
  37. package/reference/claude-config/skills/git-sync/SKILL.md +126 -126
  38. package/reference/claude-config/skills/knowledge/SKILL.md +314 -299
  39. package/reference/claude-config/skills/knowledge/operations/codify-level-a.md +100 -100
  40. package/reference/claude-config/skills/knowledge/operations/codify-level-b.md +159 -159
  41. package/reference/claude-config/skills/knowledge/operations/customers.md +109 -109
  42. package/reference/claude-config/skills/knowledge/operations/features.md +76 -76
  43. package/reference/claude-config/skills/knowledge/operations/goals.md +118 -118
  44. package/reference/claude-config/skills/knowledge/operations/identity.md +93 -93
  45. package/reference/claude-config/skills/knowledge/operations/labels.md +94 -94
  46. package/reference/claude-config/skills/knowledge/operations/offerings.md +109 -109
  47. package/reference/claude-config/skills/knowledge/operations/roles.md +99 -99
  48. package/reference/claude-config/skills/knowledge/operations/techStack.md +30 -30
  49. package/reference/claude-config/skills/project/SKILL.md +1088 -1088
  50. package/reference/claude-config/skills/run-ui/SKILL.md +73 -73
  51. package/reference/claude-config/skills/save/SKILL.md +3 -3
  52. package/reference/claude-config/skills/setup/SKILL.md +275 -275
  53. package/reference/claude-config/skills/status/SKILL.md +59 -59
  54. package/reference/claude-config/skills/submit-request/SKILL.md +180 -180
  55. package/reference/claude-config/skills/sync/SKILL.md +47 -47
  56. package/reference/claude-config/skills/tutorial/SKILL.md +259 -259
  57. package/reference/claude-config/skills/tutorial/progress-template.md +74 -74
  58. package/reference/claude-config/skills/tutorial/technical.md +1303 -1303
  59. package/reference/claude-config/skills/tutorial/vibe-coder.md +890 -890
  60. package/reference/claude-config/sync-notes/2026-04-22-git-sync-and-sync-notes.md +27 -27
  61. package/reference/claude-config/sync-notes/2026-04-22-lead-gen-deliverability-removal.md +30 -30
  62. package/reference/claude-config/sync-notes/2026-04-24-test-utils-and-template-tests.md +73 -73
  63. package/reference/claude-config/sync-notes/2026-04-24-ui-consolidation-and-sdk-cli-train.md +86 -86
  64. package/reference/claude-config/sync-notes/2026-04-25-auth-role-system-and-settings-roles.md +55 -55
  65. package/reference/claude-config/sync-notes/2026-04-27-crm-hitl-action-layer-cutover.md +97 -97
  66. package/reference/claude-config/sync-notes/2026-04-27-lead-gen-substrate-train.md +112 -112
  67. package/reference/claude-config/sync-notes/2026-04-29-crm-state-and-lead-gen-processing-status.md +93 -93
  68. package/reference/claude-config/sync-notes/2026-05-02-crm-ownership-next-action.md +58 -58
  69. package/reference/claude-config/sync-notes/2026-05-02-template-hardcode-workos-config.md +56 -56
  70. package/reference/claude-config/sync-notes/2026-05-04-elevasis-workspace.md +71 -71
  71. package/reference/claude-config/sync-notes/2026-05-04-knowledge-bundle.md +83 -83
  72. package/reference/claude-config/sync-notes/2026-05-04-template-skills-run-ui-and-tutorial.md +59 -59
  73. package/reference/claude-config/sync-notes/2026-05-05-list-builder.md +42 -42
  74. package/reference/claude-config/sync-notes/2026-05-06-crm-spine.md +60 -60
  75. package/reference/claude-config/sync-notes/2026-05-06-sdk-changes-release-train.md +37 -37
  76. package/reference/claude-config/sync-notes/2026-05-07-sdk-changes-release-train.md +34 -34
  77. package/reference/claude-config/sync-notes/2026-05-08-resource-governance-scaffold-guidance.md +38 -38
  78. package/reference/claude-config/sync-notes/2026-05-09-clients-domain.md +32 -32
  79. package/reference/claude-config/sync-notes/2026-05-09-command-system.md +33 -33
  80. package/reference/claude-config/sync-notes/2026-05-09-resource-governance-and-misc.md +69 -69
  81. package/reference/claude-config/sync-notes/2026-05-12-sdk-ready-release-train.md +30 -30
  82. package/reference/claude-config/sync-notes/2026-05-14-organization-model-ontology-refactor.md +42 -0
  83. package/reference/claude-config/sync-notes/README.md +43 -43
  84. package/reference/cli.mdx +808 -808
  85. package/reference/concepts.mdx +146 -146
  86. package/reference/deployment/api.mdx +297 -297
  87. package/reference/deployment/command-center.mdx +209 -209
  88. package/reference/deployment/index.mdx +195 -195
  89. package/reference/deployment/provided-features.mdx +107 -107
  90. package/reference/deployment/ui-execution.mdx +250 -250
  91. package/reference/examples/organization-model.ts +146 -83
  92. package/reference/framework/agent.mdx +156 -156
  93. package/reference/framework/index.mdx +195 -195
  94. package/reference/framework/interaction-guidance.mdx +182 -182
  95. package/reference/framework/memory.mdx +326 -326
  96. package/reference/framework/project-structure.mdx +282 -282
  97. package/reference/framework/tutorial-system.mdx +135 -135
  98. package/reference/getting-started.mdx +142 -142
  99. package/reference/index.mdx +106 -106
  100. package/reference/packages/core/src/README.md +14 -14
  101. package/reference/packages/core/src/business/README.md +2 -2
  102. package/reference/packages/core/src/knowledge/README.md +32 -32
  103. package/reference/packages/core/src/organization-model/README.md +149 -149
  104. package/reference/packages/core/src/test-utils/README.md +37 -37
  105. package/reference/packages/ui/src/api/README.md +18 -18
  106. package/reference/packages/ui/src/app/README.md +24 -24
  107. package/reference/packages/ui/src/auth/README.md +18 -18
  108. package/reference/packages/ui/src/components/README.md +24 -24
  109. package/reference/packages/ui/src/execution/README.md +16 -16
  110. package/reference/packages/ui/src/features/README.md +28 -28
  111. package/reference/packages/ui/src/graph/README.md +16 -16
  112. package/reference/packages/ui/src/hooks/README.md +23 -23
  113. package/reference/packages/ui/src/initialization/README.md +19 -19
  114. package/reference/packages/ui/src/knowledge/README.md +31 -31
  115. package/reference/packages/ui/src/organization/README.md +18 -18
  116. package/reference/packages/ui/src/profile/README.md +19 -19
  117. package/reference/packages/ui/src/provider/README.md +32 -32
  118. package/reference/packages/ui/src/router/README.md +18 -18
  119. package/reference/packages/ui/src/sse/README.md +13 -13
  120. package/reference/packages/ui/src/test-utils/README.md +7 -7
  121. package/reference/packages/ui/src/theme/README.md +23 -23
  122. package/reference/packages/ui/src/theme/presets/README.md +19 -19
  123. package/reference/packages/ui/src/types/README.md +16 -16
  124. package/reference/packages/ui/src/utils/README.md +18 -18
  125. package/reference/packages/ui/src/zustand/README.md +18 -18
  126. package/reference/platform-tools/adapters-integration.mdx +301 -301
  127. package/reference/platform-tools/adapters-platform.mdx +553 -553
  128. package/reference/platform-tools/index.mdx +217 -217
  129. package/reference/platform-tools/type-safety.mdx +82 -82
  130. package/reference/resources/index.mdx +349 -349
  131. package/reference/resources/patterns.mdx +449 -449
  132. package/reference/resources/types.mdx +116 -116
  133. package/reference/roadmap.mdx +165 -165
  134. package/reference/runtime.mdx +173 -173
  135. package/reference/scaffold/core/organization-graph.mdx +110 -90
  136. package/reference/scaffold/core/organization-model.mdx +226 -219
  137. package/reference/scaffold/index.mdx +67 -67
  138. package/reference/scaffold/operations/propagation-pipeline.md +77 -77
  139. package/reference/scaffold/operations/scaffold-maintenance.md +12 -12
  140. package/reference/scaffold/operations/workflow-recipes.md +138 -138
  141. package/reference/scaffold/recipes/add-a-feature.md +308 -88
  142. package/reference/scaffold/recipes/add-a-resource.md +134 -110
  143. package/reference/scaffold/recipes/customize-knowledge-browser.md +5 -5
  144. package/reference/scaffold/recipes/customize-organization-model.md +273 -138
  145. package/reference/scaffold/recipes/extend-a-base-entity.md +8 -8
  146. package/reference/scaffold/recipes/extend-crm.md +3 -3
  147. package/reference/scaffold/recipes/extend-lead-gen.md +400 -400
  148. package/reference/scaffold/recipes/gate-by-feature-or-admin.md +118 -118
  149. package/reference/scaffold/recipes/index.md +46 -46
  150. package/reference/scaffold/recipes/query-the-knowledge-graph.md +197 -170
  151. package/reference/scaffold/reference/contracts.md +2101 -2096
  152. package/reference/scaffold/reference/glossary.md +76 -76
  153. package/reference/scaffold/ui/composition-extensibility.mdx +233 -233
  154. package/reference/scaffold/ui/customization.md +243 -243
  155. package/reference/scaffold/ui/feature-flags-and-gating.md +46 -46
  156. package/reference/scaffold/ui/feature-shell.mdx +72 -72
  157. package/reference/scaffold/ui/recipes.md +221 -214
  158. package/reference/spine/spine-primer.md +96 -96
  159. package/reference/templates/index.mdx +47 -47
  160. package/reference/troubleshooting.mdx +223 -223
@@ -1,93 +1,93 @@
1
- # CRM State-Change UI + Lead-Gen Processing Status Migration
2
-
3
- ## Why this note exists
4
-
5
- This release train ships two coordinated changes that both flow through the `@elevasis/core` + `@elevasis/ui` + `@elevasis/sdk` package family.
6
-
7
- 1. **CRM state-change UI + canonical state source.** CRM `state_key` values are now defined canonically in `@elevasis/core/organization-model` as `CRM_PIPELINE_DEFINITION` (mirrors lead-gen's `ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE` shape). Eight `CRM_*_STATE` constants and a `getValidStatesForStage(definition, stageKey)` helper are exported. The API now exposes `PATCH /api/deals/:dealId/state` with server-side validation against the per-stage allowed-state set, and the deal drawer ships a `StateSelect` plus an Unstaged-deal staging affordance. Manual state changes log `state_changed_manually` (vs. workflow-driven `state_change`).
8
-
9
- 2. **Lead-gen processing-status migration.** `processing_state` JSONB stage values shift from boolean flags to status strings drawn from `ProcessingStageStatusSchema = 'success' | 'no_result' | 'skipped' | 'error'`. Legacy boolean `true` values continue to read as `success` for the foreseeable future via API normalization. `ListStageProgressSchema` expands from `{ done, total }` to attempted-coverage + per-status counts (`total`, `attempted`, `success`, `noResult`, `skipped`, `error`, `other`, `notAttempted`). Lead-gen list-detail UI renders attempted percentage with stacked status segments. Local `listTool` writers (`updateCompanyStage` / `updateContactStage`) now accept an optional `status` argument; omitted writes default to `success`.
10
-
11
- ## Applies to
12
-
13
- All template-derived projects that:
14
-
15
- - consume `@elevasis/core/business/acquisition` types (`ListStageProgressSchema`, `ProcessingStageStatusSchema`, `UpdateCompanyStageParams`, `UpdateContactStageParams`, `TransitionDealStateRequestSchema`)
16
- - import from `@elevasis/core/organization-model` (the new `CRM_PIPELINE_DEFINITION` + `CRM_*_STATE` constants are exposed for the first time in this release)
17
- - render the CRM deal drawer or kanban surfaces from `@elevasis/ui` (the drawer now slots `StateSelect` and an Unstaged staging block; `useTransitionState` is a new exported hook)
18
- - render the lead-gen list-detail progress bars from `@elevasis/ui` (stacked segment rendering replaces single fills)
19
- - author lead-gen workflows that call `acqDb.updateCompanyStage(...)` / `acqDb.updateContactStage(...)`
20
- - author CRM workflows that hardcode `state_key` string literals (`discovery_link_sent`, `discovery_replied`, `reply_sent`, `followup_{1,2,3}_sent`, etc.) — these should now import named constants from `@elevasis/core/organization-model`
21
-
22
- Operations-only projects with no CRM surface, no `acq_deals` table, and no lead-gen list workflows can ignore this train.
23
-
24
- ## Required actions
25
-
26
- 1. Pull template changes with `/git-sync` so the refreshed package baselines (`core/package.json`, `ui/package.json`, `operations/package.json`) and any propagated scaffold doc updates land.
27
-
28
- 2. After the release train is published, update package versions in the project:
29
-
30
- ```bash
31
- pnpm up @elevasis/core @elevasis/ui @elevasis/sdk --latest
32
- ```
33
-
34
- 3. **Lead-gen workflows** — extend any local `listTool` wrapper signatures to accept the new optional `status` parameter and pass an explicit non-success status where the workflow can distinguish outcomes:
35
-
36
- ```ts
37
- updateCompanyStage: (params: {
38
- listId: string
39
- companyId: string
40
- stage: 'extracted'
41
- status?: 'success' | 'no_result' | 'skipped' | 'error'
42
- executionId?: string
43
- }) => platform.call({ tool: 'list', method: 'updateCompanyStage', params }) as Promise<void>
44
- ```
45
-
46
- Recommended status mapping per stage (`populated`, `extracted`, `discovered`, `verified`, `qualified`, `personalized`, `uploaded`) is documented in `apps/docs/content/docs/in-progress/active-development/sdk-changes/ship/lead-gen-processing-status-migration.mdx` (Step 4 table). Omitted `status` defaults to `success` so existing call sites keep working unchanged.
47
-
48
- 4. **CRM workflows** — replace any hardcoded CRM `state_key` string literals with imports from `@elevasis/core/organization-model`:
49
-
50
- ```ts
51
- import {
52
- CRM_DISCOVERY_REPLIED_STATE,
53
- CRM_DISCOVERY_LINK_SENT_STATE,
54
- CRM_REPLY_SENT_STATE,
55
- CRM_FOLLOWUP_1_SENT_STATE,
56
- // ...
57
- } from '@elevasis/core/organization-model'
58
-
59
- // before:
60
- await acqDb.transitionItem({ ..., stateKey: 'reply_sent' })
61
-
62
- // after:
63
- await acqDb.transitionItem({ ..., stateKey: CRM_REPLY_SENT_STATE.stateKey })
64
- ```
65
-
66
- The runtime string values are unchanged; this is a mechanical substitution that aligns workflows with the canonical source. The API now validates `stateKey` for the new `PATCH /deals/:dealId/state` route, but `transitionItem` retains existing acceptance behavior for backward compatibility during rollout.
67
-
68
- 5. **Reading `acq_deal_activity_log`** — pattern-matchers should accept `state_changed_manually` as a new event kind alongside the existing `state_change`. Manual state edits carry a user id and optional reason; workflow-driven state writes continue to use `state_change`.
69
-
70
- 6. **Lead-gen progress consumers** — if your project reads `GET /acquisition/lists/:listId/progress`, the response shape now exposes attempted-coverage fields. The legacy `{ done, total }` shape no longer ships; consumers should switch to `attempted / total` for completion percentages and use the per-status counts (`success`, `noResult`, `skipped`, `error`, `other`, `notAttempted`) for outcome rendering.
71
-
72
- 7. **`processing_state` data shape** — running rows now carry string statuses (`"success" | "no_result" | "skipped" | "error"`). Legacy `true` values continue to be normalized server-side. Direct SQL consumers should treat both shapes as readable; new writes should always emit strings.
73
-
74
- ## Verification
75
-
76
- After upgrading and applying the actions above:
77
-
78
- - `pnpm check-types` clean across project packages
79
- - `pnpm test` for any operations workflows that exercise `listTool.update*Stage` signatures
80
- - Spot-check a CRM deal drawer in your project's command-center: state dropdown should appear under the Summary block when the deal has a stage; an "Unstaged" staging affordance should appear when `stage_key` is null
81
- - Spot-check a lead-gen list-detail page: progress bars should render stacked segments, with the headline percentage reflecting attempted coverage rather than only successful rows
82
- - `GET /acquisition/lists/:listId/progress` response should carry the new attempted-coverage shape
83
- - Manual deal state changes through the new UI should append `state_changed_manually` rows in `acq_deal_activity_log`
84
-
85
- ## Not handled by /git-sync
86
-
87
- `/git-sync` propagates template-authored files (package baselines, scaffold doc copies, sync-managed shells) but does NOT:
88
-
89
- - run `pnpm up @elevasis/core @elevasis/ui @elevasis/sdk --latest` for you — bump deps explicitly after this train publishes
90
- - rewrite hardcoded `state_key` literals in your CRM workflows — Action 4 is a manual substitution
91
- - backfill historical `processing_state: true` JSONB values to `"success"` strings — the platform monorepo ran a one-shot SQL conversion for its prod data on 2026-04-29; your project owns its own backfill if you want clean string-only rows. API normalization makes the backfill optional for correctness.
92
- - regenerate workflow status writes — Action 3 is a code-level change in your operations workflows
93
- - rebuild your `command-center` after the `@elevasis/ui` upgrade — run your project's normal build/dev cycle
1
+ # CRM State-Change UI + Lead-Gen Processing Status Migration
2
+
3
+ ## Why this note exists
4
+
5
+ This release train ships two coordinated changes that both flow through the `@elevasis/core` + `@elevasis/ui` + `@elevasis/sdk` package family.
6
+
7
+ 1. **CRM state-change UI + canonical state source.** CRM `state_key` values are now defined canonically in `@elevasis/core/organization-model` as `CRM_PIPELINE_DEFINITION` (mirrors lead-gen's `ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE` shape). Eight `CRM_*_STATE` constants and a `getValidStatesForStage(definition, stageKey)` helper are exported. The API now exposes `PATCH /api/deals/:dealId/state` with server-side validation against the per-stage allowed-state set, and the deal drawer ships a `StateSelect` plus an Unstaged-deal staging affordance. Manual state changes log `state_changed_manually` (vs. workflow-driven `state_change`).
8
+
9
+ 2. **Lead-gen processing-status migration.** `processing_state` JSONB stage values shift from boolean flags to status strings drawn from `ProcessingStageStatusSchema = 'success' | 'no_result' | 'skipped' | 'error'`. Legacy boolean `true` values continue to read as `success` for the foreseeable future via API normalization. `ListStageProgressSchema` expands from `{ done, total }` to attempted-coverage + per-status counts (`total`, `attempted`, `success`, `noResult`, `skipped`, `error`, `other`, `notAttempted`). Lead-gen list-detail UI renders attempted percentage with stacked status segments. Local `listTool` writers (`updateCompanyStage` / `updateContactStage`) now accept an optional `status` argument; omitted writes default to `success`.
10
+
11
+ ## Applies to
12
+
13
+ All template-derived projects that:
14
+
15
+ - consume `@elevasis/core/business/acquisition` types (`ListStageProgressSchema`, `ProcessingStageStatusSchema`, `UpdateCompanyStageParams`, `UpdateContactStageParams`, `TransitionDealStateRequestSchema`)
16
+ - import from `@elevasis/core/organization-model` (the new `CRM_PIPELINE_DEFINITION` + `CRM_*_STATE` constants are exposed for the first time in this release)
17
+ - render the CRM deal drawer or kanban surfaces from `@elevasis/ui` (the drawer now slots `StateSelect` and an Unstaged staging block; `useTransitionState` is a new exported hook)
18
+ - render the lead-gen list-detail progress bars from `@elevasis/ui` (stacked segment rendering replaces single fills)
19
+ - author lead-gen workflows that call `acqDb.updateCompanyStage(...)` / `acqDb.updateContactStage(...)`
20
+ - author CRM workflows that hardcode `state_key` string literals (`discovery_link_sent`, `discovery_replied`, `reply_sent`, `followup_{1,2,3}_sent`, etc.) — these should now import named constants from `@elevasis/core/organization-model`
21
+
22
+ Operations-only projects with no CRM surface, no `acq_deals` table, and no lead-gen list workflows can ignore this train.
23
+
24
+ ## Required actions
25
+
26
+ 1. Pull template changes with `/git-sync` so the refreshed package baselines (`core/package.json`, `ui/package.json`, `operations/package.json`) and any propagated scaffold doc updates land.
27
+
28
+ 2. After the release train is published, update package versions in the project:
29
+
30
+ ```bash
31
+ pnpm up @elevasis/core @elevasis/ui @elevasis/sdk --latest
32
+ ```
33
+
34
+ 3. **Lead-gen workflows** — extend any local `listTool` wrapper signatures to accept the new optional `status` parameter and pass an explicit non-success status where the workflow can distinguish outcomes:
35
+
36
+ ```ts
37
+ updateCompanyStage: (params: {
38
+ listId: string
39
+ companyId: string
40
+ stage: 'extracted'
41
+ status?: 'success' | 'no_result' | 'skipped' | 'error'
42
+ executionId?: string
43
+ }) => platform.call({ tool: 'list', method: 'updateCompanyStage', params }) as Promise<void>
44
+ ```
45
+
46
+ Recommended status mapping per stage (`populated`, `extracted`, `discovered`, `verified`, `qualified`, `personalized`, `uploaded`) is documented in `apps/docs/content/docs/in-progress/active-development/sdk-changes/ship/lead-gen-processing-status-migration.mdx` (Step 4 table). Omitted `status` defaults to `success` so existing call sites keep working unchanged.
47
+
48
+ 4. **CRM workflows** — replace any hardcoded CRM `state_key` string literals with imports from `@elevasis/core/organization-model`:
49
+
50
+ ```ts
51
+ import {
52
+ CRM_DISCOVERY_REPLIED_STATE,
53
+ CRM_DISCOVERY_LINK_SENT_STATE,
54
+ CRM_REPLY_SENT_STATE,
55
+ CRM_FOLLOWUP_1_SENT_STATE,
56
+ // ...
57
+ } from '@elevasis/core/organization-model'
58
+
59
+ // before:
60
+ await acqDb.transitionItem({ ..., stateKey: 'reply_sent' })
61
+
62
+ // after:
63
+ await acqDb.transitionItem({ ..., stateKey: CRM_REPLY_SENT_STATE.stateKey })
64
+ ```
65
+
66
+ The runtime string values are unchanged; this is a mechanical substitution that aligns workflows with the canonical source. The API now validates `stateKey` for the new `PATCH /deals/:dealId/state` route, but `transitionItem` retains existing acceptance behavior for backward compatibility during rollout.
67
+
68
+ 5. **Reading `acq_deal_activity_log`** — pattern-matchers should accept `state_changed_manually` as a new event kind alongside the existing `state_change`. Manual state edits carry a user id and optional reason; workflow-driven state writes continue to use `state_change`.
69
+
70
+ 6. **Lead-gen progress consumers** — if your project reads `GET /acquisition/lists/:listId/progress`, the response shape now exposes attempted-coverage fields. The legacy `{ done, total }` shape no longer ships; consumers should switch to `attempted / total` for completion percentages and use the per-status counts (`success`, `noResult`, `skipped`, `error`, `other`, `notAttempted`) for outcome rendering.
71
+
72
+ 7. **`processing_state` data shape** — running rows now carry string statuses (`"success" | "no_result" | "skipped" | "error"`). Legacy `true` values continue to be normalized server-side. Direct SQL consumers should treat both shapes as readable; new writes should always emit strings.
73
+
74
+ ## Verification
75
+
76
+ After upgrading and applying the actions above:
77
+
78
+ - `pnpm check-types` clean across project packages
79
+ - `pnpm test` for any operations workflows that exercise `listTool.update*Stage` signatures
80
+ - Spot-check a CRM deal drawer in your project's command-center: state dropdown should appear under the Summary block when the deal has a stage; an "Unstaged" staging affordance should appear when `stage_key` is null
81
+ - Spot-check a lead-gen list-detail page: progress bars should render stacked segments, with the headline percentage reflecting attempted coverage rather than only successful rows
82
+ - `GET /acquisition/lists/:listId/progress` response should carry the new attempted-coverage shape
83
+ - Manual deal state changes through the new UI should append `state_changed_manually` rows in `acq_deal_activity_log`
84
+
85
+ ## Not handled by /git-sync
86
+
87
+ `/git-sync` propagates template-authored files (package baselines, scaffold doc copies, sync-managed shells) but does NOT:
88
+
89
+ - run `pnpm up @elevasis/core @elevasis/ui @elevasis/sdk --latest` for you — bump deps explicitly after this train publishes
90
+ - rewrite hardcoded `state_key` literals in your CRM workflows — Action 4 is a manual substitution
91
+ - backfill historical `processing_state: true` JSONB values to `"success"` strings — the platform monorepo ran a one-shot SQL conversion for its prod data on 2026-04-29; your project owns its own backfill if you want clean string-only rows. API normalization makes the backfill optional for correctness.
92
+ - regenerate workflow status writes — Action 3 is a code-level change in your operations workflows
93
+ - rebuild your `command-center` after the `@elevasis/ui` upgrade — run your project's normal build/dev cycle
@@ -1,58 +1,58 @@
1
- # CRM Ownership and Next-Action Projection
2
-
3
- ## Why this note exists
4
-
5
- This release train ships CRM ownership and next-action projection across the shared core, UI, API, and Elevasis operations bundle.
6
-
7
- Shared CRM deal responses now carry nullable `ownership` and `nextAction` values derived from activity history. The CRM list and detail surfaces render the move owner directly, and detail actions prefer the projected `nextAction` before falling back to ownership-aware derivation. The Elevasis operations bundle also writes canonical follow-up and deferred-next-step activity events so ownership can sort consistently.
8
-
9
- ## Applies to
10
-
11
- Template-derived projects that:
12
-
13
- - consume `@elevasis/core/business/acquisition/api-schemas` deal list or detail response types
14
- - render CRM list, detail, or action surfaces from `@elevasis/ui`
15
- - author CRM operations workflows that append or interpret deal activity events
16
- - read `activity_log` rows and classify who owns the next move
17
-
18
- Projects with no CRM surface and no `acq_deals` workflow logic can ignore this train.
19
-
20
- ## Required actions
21
-
22
- 1. Pull template changes with `/git-sync` after this train publishes so package baselines for `@elevasis/core` and `@elevasis/ui` are refreshed.
23
-
24
- 2. Upgrade shared packages in the derived project after the publish stages complete:
25
-
26
- ```bash
27
- pnpm up @elevasis/core @elevasis/ui --latest
28
- ```
29
-
30
- 3. Audit any project-owned CRM workflow code that writes activity events. Outbound follow-up should emit `followup_email_sent`, and "lead will check / get back to us" replies should emit `lead_deferred_next_step` when they defer our next action.
31
-
32
- 4. Audit any project-owned CRM UI code that computes available actions locally. Prefer the server-projected `nextAction` when present, and suppress send-reply affordances when `ownership` is `them`.
33
-
34
- 5. If the project deploys an operations bundle with CRM reply or follow-up handlers, redeploy that bundle after package upgrades so runtime activity writes match the new ownership derivation:
35
-
36
- ```bash
37
- pnpm -C operations exec elevasis-sdk deploy --prod
38
- ```
39
-
40
- ## Verification
41
-
42
- After upgrading:
43
-
44
- - `pnpm check-types` passes in project packages that consume CRM types or UI.
45
- - CRM list rows show the expected move owner for deals with inbound replies, outbound replies, follow-ups, reminders, booking nudges, and deferred-next-step replies.
46
- - CRM detail actions expose Send Reply only when the server-projected action and ownership allow it.
47
- - Operations tests or smoke probes confirm follow-up handlers emit `followup_email_sent`.
48
- - A CRM reply where the lead says they will check internally records `lead_deferred_next_step` and sorts after the inbound reply event.
49
-
50
- ## Not handled by /git-sync
51
-
52
- `/git-sync` does not:
53
-
54
- - publish `@elevasis/core` or `@elevasis/ui`
55
- - run package upgrades inside derived projects
56
- - redeploy project-owned operations bundles
57
- - rewrite project-owned CRM workflow logic that still emits legacy activity event names
58
- - verify or repair historical `activity_log` rows in project databases
1
+ # CRM Ownership and Next-Action Projection
2
+
3
+ ## Why this note exists
4
+
5
+ This release train ships CRM ownership and next-action projection across the shared core, UI, API, and Elevasis operations bundle.
6
+
7
+ Shared CRM deal responses now carry nullable `ownership` and `nextAction` values derived from activity history. The CRM list and detail surfaces render the move owner directly, and detail actions prefer the projected `nextAction` before falling back to ownership-aware derivation. The Elevasis operations bundle also writes canonical follow-up and deferred-next-step activity events so ownership can sort consistently.
8
+
9
+ ## Applies to
10
+
11
+ Template-derived projects that:
12
+
13
+ - consume `@elevasis/core/business/acquisition/api-schemas` deal list or detail response types
14
+ - render CRM list, detail, or action surfaces from `@elevasis/ui`
15
+ - author CRM operations workflows that append or interpret deal activity events
16
+ - read `activity_log` rows and classify who owns the next move
17
+
18
+ Projects with no CRM surface and no `acq_deals` workflow logic can ignore this train.
19
+
20
+ ## Required actions
21
+
22
+ 1. Pull template changes with `/git-sync` after this train publishes so package baselines for `@elevasis/core` and `@elevasis/ui` are refreshed.
23
+
24
+ 2. Upgrade shared packages in the derived project after the publish stages complete:
25
+
26
+ ```bash
27
+ pnpm up @elevasis/core @elevasis/ui --latest
28
+ ```
29
+
30
+ 3. Audit any project-owned CRM workflow code that writes activity events. Outbound follow-up should emit `followup_email_sent`, and "lead will check / get back to us" replies should emit `lead_deferred_next_step` when they defer our next action.
31
+
32
+ 4. Audit any project-owned CRM UI code that computes available actions locally. Prefer the server-projected `nextAction` when present, and suppress send-reply affordances when `ownership` is `them`.
33
+
34
+ 5. If the project deploys an operations bundle with CRM reply or follow-up handlers, redeploy that bundle after package upgrades so runtime activity writes match the new ownership derivation:
35
+
36
+ ```bash
37
+ pnpm -C operations exec elevasis-sdk deploy --prod
38
+ ```
39
+
40
+ ## Verification
41
+
42
+ After upgrading:
43
+
44
+ - `pnpm check-types` passes in project packages that consume CRM types or UI.
45
+ - CRM list rows show the expected move owner for deals with inbound replies, outbound replies, follow-ups, reminders, booking nudges, and deferred-next-step replies.
46
+ - CRM detail actions expose Send Reply only when the server-projected action and ownership allow it.
47
+ - Operations tests or smoke probes confirm follow-up handlers emit `followup_email_sent`.
48
+ - A CRM reply where the lead says they will check internally records `lead_deferred_next_step` and sorts after the inbound reply event.
49
+
50
+ ## Not handled by /git-sync
51
+
52
+ `/git-sync` does not:
53
+
54
+ - publish `@elevasis/core` or `@elevasis/ui`
55
+ - run package upgrades inside derived projects
56
+ - redeploy project-owned operations bundles
57
+ - rewrite project-owned CRM workflow logic that still emits legacy activity event names
58
+ - verify or repair historical `activity_log` rows in project databases
@@ -1,56 +1,56 @@
1
- # Template WorkOS Hardcode + Strict Dev Port
2
-
3
- ## Why this note exists
4
-
5
- The template UI no longer reads WorkOS configuration from `VITE_WORKOS_*` env vars. WorkOS `clientId`, `redirectUri`, and `signoutUri` are hardcoded in a new file `ui/src/config/workos.ts` so a freshly bootstrapped template runs without any UI `.env` setup. The Vite dev server now uses `strictPort: true` on port `4300` so a second `pnpm -C ui dev` on the same machine fails fast instead of silently drifting to another port.
6
-
7
- This sync moves three pieces into derived projects:
8
-
9
- - `ui/src/config/workos.ts` -- new merge-baseline file holding `clientId`, `redirectUri`, `signoutUri`
10
- - `ui/src/main.tsx` and `ui/src/routes/__root.tsx` -- merge-regions updates that import `WORKOS_CONFIG` from `@/config/workos` instead of reading `import.meta.env.VITE_WORKOS_*`
11
- - `ui/vite.config.ts` -- `strictPort: true` added next to `port: 4300`
12
- - `ui/.env.example` -- WorkOS section removed (replaced with a single comment pointing at `ui/src/config/workos.ts`)
13
- - `.claude/rules/ui.md` and `CLAUDE.md` -- prose updated; project-owned `CLAUDE.md` is verify-only and the project keeps its own narrative
14
-
15
- `nirvana-marketing` and `ZentaraHQ` already received `ui/src/config/workos.ts`, the `strictPort` flag, and the `.claude/rules/ui.md` baseline as prep-gate repairs in the previous train. This note formally attributes those changes to an owning task doc and covers any remaining template-derived projects.
16
-
17
- ## Applies to
18
-
19
- Template-derived projects that:
20
-
21
- - run a WorkOS-authenticated UI from `ui/src/main.tsx` and `ui/src/routes/__root.tsx`
22
- - run the Vite dev server on port `4300`
23
- - have a project-owned `ui/src/config/workos.ts` (created via prep-gate repair) or are seeing it land for the first time on this sync
24
- - maintain a `ui/.env` file that previously set `VITE_WORKOS_CLIENT_ID`, `VITE_WORKOS_REDIRECT_URI`, or `VITE_WORKOS_SIGNOUT_URI`
25
-
26
- Projects with no WorkOS surface or no Vite dev server are not affected.
27
-
28
- ## Required actions
29
-
30
- 1. Pull template changes with `/git-sync` after this train publishes so the WorkOS hardcode and strict-port baselines reach the project's UI shell.
31
-
32
- 2. Confirm the project's `ui/src/config/workos.ts` reflects the WorkOS client ID the project should authenticate against. The template ships the platform team's dev-tier `clientId`; client-facing projects must overwrite that value with the project's own WorkOS client ID before going to production. Edit the literal in `ui/src/config/workos.ts` -- no env vars are involved.
33
-
34
- 3. Stop providing `VITE_WORKOS_CLIENT_ID`, `VITE_WORKOS_REDIRECT_URI`, and `VITE_WORKOS_SIGNOUT_URI` in `ui/.env`. They are no longer read. Delete the entries to keep the file honest. The WorkOS values now live in `ui/src/config/workos.ts`.
35
-
36
- 4. Confirm `ui/vite.config.ts` carries `strictPort: true` next to `server.port: 4300`. If a second dev server starts on the same port, expect a hard failure instead of a drift to `4301`.
37
-
38
- 5. If the project hand-rolled an env-vars notice component or a `REQUIRED_ENV_VARS` array around WorkOS, remove it. `createElevasisApp` no longer needs the `MissingEnvNotice` prop now that `clientId` is always truthy.
39
-
40
- ## Verification
41
-
42
- After upgrading:
43
-
44
- - `pnpm -C ui check-types` and `pnpm -C ui build` pass with `WORKOS_CONFIG` imported from `@/config/workos`.
45
- - `pnpm -C ui dev` boots on `4300`. Starting a second `pnpm -C ui dev` in another terminal fails with a port-in-use error instead of incrementing to `4301`.
46
- - WorkOS sign-in and sign-out still round-trip through the project's WorkOS tenant. Sign-out lands on the URL configured in `ui/src/config/workos.ts` (`signoutUri`).
47
- - `grep -r VITE_WORKOS_ ui/src` returns nothing.
48
-
49
- ## Not handled by /git-sync
50
-
51
- `/git-sync` does not:
52
-
53
- - delete `VITE_WORKOS_*` entries from project-local `ui/.env` files
54
- - overwrite `ui/src/config/workos.ts` if the project has already customized the `clientId` for a non-default WorkOS tenant (the file is merge-baseline; customizations are preserved)
55
- - update WorkOS dashboard redirect URIs or CORS origins for projects that run the dev server on a non-`4300` port; if the project changed the dev port, it must also change the WorkOS dashboard accordingly
56
- - redeploy any project-owned operations bundle; this train is UI-shell only
1
+ # Template WorkOS Hardcode + Strict Dev Port
2
+
3
+ ## Why this note exists
4
+
5
+ The template UI no longer reads WorkOS configuration from `VITE_WORKOS_*` env vars. WorkOS `clientId`, `redirectUri`, and `signoutUri` are hardcoded in a new file `ui/src/config/workos.ts` so a freshly bootstrapped template runs without any UI `.env` setup. The Vite dev server now uses `strictPort: true` on port `4300` so a second `pnpm -C ui dev` on the same machine fails fast instead of silently drifting to another port.
6
+
7
+ This sync moves three pieces into derived projects:
8
+
9
+ - `ui/src/config/workos.ts` -- new merge-baseline file holding `clientId`, `redirectUri`, `signoutUri`
10
+ - `ui/src/main.tsx` and `ui/src/routes/__root.tsx` -- merge-regions updates that import `WORKOS_CONFIG` from `@/config/workos` instead of reading `import.meta.env.VITE_WORKOS_*`
11
+ - `ui/vite.config.ts` -- `strictPort: true` added next to `port: 4300`
12
+ - `ui/.env.example` -- WorkOS section removed (replaced with a single comment pointing at `ui/src/config/workos.ts`)
13
+ - `.claude/rules/ui.md` and `CLAUDE.md` -- prose updated; project-owned `CLAUDE.md` is verify-only and the project keeps its own narrative
14
+
15
+ `nirvana-marketing` and `ZentaraHQ` already received `ui/src/config/workos.ts`, the `strictPort` flag, and the `.claude/rules/ui.md` baseline as prep-gate repairs in the previous train. This note formally attributes those changes to an owning task doc and covers any remaining template-derived projects.
16
+
17
+ ## Applies to
18
+
19
+ Template-derived projects that:
20
+
21
+ - run a WorkOS-authenticated UI from `ui/src/main.tsx` and `ui/src/routes/__root.tsx`
22
+ - run the Vite dev server on port `4300`
23
+ - have a project-owned `ui/src/config/workos.ts` (created via prep-gate repair) or are seeing it land for the first time on this sync
24
+ - maintain a `ui/.env` file that previously set `VITE_WORKOS_CLIENT_ID`, `VITE_WORKOS_REDIRECT_URI`, or `VITE_WORKOS_SIGNOUT_URI`
25
+
26
+ Projects with no WorkOS surface or no Vite dev server are not affected.
27
+
28
+ ## Required actions
29
+
30
+ 1. Pull template changes with `/git-sync` after this train publishes so the WorkOS hardcode and strict-port baselines reach the project's UI shell.
31
+
32
+ 2. Confirm the project's `ui/src/config/workos.ts` reflects the WorkOS client ID the project should authenticate against. The template ships the platform team's dev-tier `clientId`; client-facing projects must overwrite that value with the project's own WorkOS client ID before going to production. Edit the literal in `ui/src/config/workos.ts` -- no env vars are involved.
33
+
34
+ 3. Stop providing `VITE_WORKOS_CLIENT_ID`, `VITE_WORKOS_REDIRECT_URI`, and `VITE_WORKOS_SIGNOUT_URI` in `ui/.env`. They are no longer read. Delete the entries to keep the file honest. The WorkOS values now live in `ui/src/config/workos.ts`.
35
+
36
+ 4. Confirm `ui/vite.config.ts` carries `strictPort: true` next to `server.port: 4300`. If a second dev server starts on the same port, expect a hard failure instead of a drift to `4301`.
37
+
38
+ 5. If the project hand-rolled an env-vars notice component or a `REQUIRED_ENV_VARS` array around WorkOS, remove it. `createElevasisApp` no longer needs the `MissingEnvNotice` prop now that `clientId` is always truthy.
39
+
40
+ ## Verification
41
+
42
+ After upgrading:
43
+
44
+ - `pnpm -C ui check-types` and `pnpm -C ui build` pass with `WORKOS_CONFIG` imported from `@/config/workos`.
45
+ - `pnpm -C ui dev` boots on `4300`. Starting a second `pnpm -C ui dev` in another terminal fails with a port-in-use error instead of incrementing to `4301`.
46
+ - WorkOS sign-in and sign-out still round-trip through the project's WorkOS tenant. Sign-out lands on the URL configured in `ui/src/config/workos.ts` (`signoutUri`).
47
+ - `grep -r VITE_WORKOS_ ui/src` returns nothing.
48
+
49
+ ## Not handled by /git-sync
50
+
51
+ `/git-sync` does not:
52
+
53
+ - delete `VITE_WORKOS_*` entries from project-local `ui/.env` files
54
+ - overwrite `ui/src/config/workos.ts` if the project has already customized the `clientId` for a non-default WorkOS tenant (the file is merge-baseline; customizations are preserved)
55
+ - update WorkOS dashboard redirect URIs or CORS origins for projects that run the dev server on a non-`4300` port; if the project changed the dev port, it must also change the WorkOS dashboard accordingly
56
+ - redeploy any project-owned operations bundle; this train is UI-shell only
@@ -1,71 +1,71 @@
1
- # Elevasis Workspace Ship-Train
2
-
3
- ## Why this note exists
4
-
5
- The Elevasis runtime (`external/elevasis/`) was promoted into the pnpm workspace as `packages/elevasis-{core,operations}/`. That migration exposed two latent SDK pipeline failures -- a rollup `.dts` resolver bug affecting transitive type-only peers (`openai`, `@supabase/*`, `@workos-inc/node`, etc.) and a deploy-validator crash on ESM-only `exports` maps -- both of which are now fixed in `@elevasis/sdk`. The same migration forced a formal subpath boundary contract for `@elevasis/sdk`: the default barrel is now browser-safe only, with `@elevasis/sdk/worker`, `@elevasis/sdk/node`, and `@elevasis/sdk/test-utils` as explicit runtime-gated subpaths, enforced by `no-restricted-imports` lint rules and a build-time bundle-leak test suite. Separately, workflow input/output schemas are now codified as the canonical SSOT through a three-layer pattern (operations contract owns schemas; CC imports from the workflow contract; `apps/api` stays envelope-only). The result is minor bumps to `@elevasis/core`, `@elevasis/ui`, and `@elevasis/sdk`, a `_template` dependency-baseline update, and new boundary rules that external SDK consumers must follow.
6
-
7
- ## Applies to
8
-
9
- All template-derived projects that consume `@elevasis/sdk`, `@elevasis/core`, or `@elevasis/ui`. Specifically:
10
-
11
- - `nirvana-marketing`
12
- - `ZentaraHQ`
13
- - Any future external SDK consumer derived from the `_template` baseline
14
-
15
- `@elevasis/sdk` is now boundary-enforced. Any external project that previously imported Node-only modules from the default `@elevasis/sdk` barrel -- including `knowledge-codegen`, anything touching `node:fs`, or `worker_threads` -- must migrate those imports to `@elevasis/sdk/node`. Workflow handler code that uses `platform.call`, `acqDb`, or adapter factories should already be on `@elevasis/sdk/worker`; verify this is the case.
16
-
17
- ## Required actions
18
-
19
- 1. Pull template changes with `/git-sync` after this train publishes so the refreshed package baselines (`core/package.json`, `ui/package.json`, `operations/package.json`) reach the project.
20
-
21
- 2. After the baseline lands, update package versions in the project:
22
-
23
- ```bash
24
- pnpm up @elevasis/core @elevasis/ui @elevasis/sdk --latest
25
- ```
26
-
27
- Version baselines are written into the `_template` package files by the release train. Match the versions from `_template` after sync or run `--latest` to pull the published minors.
28
-
29
- 3. Run `pnpm install` from the project root after the dep bump to ensure the lockfile is updated.
30
-
31
- 4. **Audit `@elevasis/sdk` import subpaths.** In `operations/src/`, search for any import from `@elevasis/sdk` that touches `knowledge-codegen`, `node:fs`, `worker_threads`, or any other Node-only module. These must move to `@elevasis/sdk/node`. Workflow handler files that use `platform`, `acqDb`, or adapter factories belong on `@elevasis/sdk/worker` -- verify the subpath is explicit.
32
-
33
- ```ts
34
- // Before (incorrect for Node-only tooling)
35
- import { knowledgeCodegen } from '@elevasis/sdk'
36
-
37
- // After
38
- import { knowledgeCodegen } from '@elevasis/sdk/node'
39
- ```
40
-
41
- 5. **Audit for `@repo/elevasis-core` or `@repo/elevasis-operations` imports.** These package names are workspace-internal to the platform monorepo and are not published. External consumers must use the published packages (`@elevasis/sdk`, `@elevasis/core`, `@elevasis/ui`) exclusively. If a tenant project forked or copied an import path using the `@repo/elevasis-*` namespace, replace it with the appropriate published subpath.
42
-
43
- 6. **Audit workflow input/output schema usage in `ui/src/`.** Per the schema SSOT pattern, CC code should import schemas from the workflow's `contract.inputSchema` or `contract.outputSchema`, not from hand-duplicated local type declarations. If the project has hand-written copies of workflow input or output schemas in `ui/src/`, flag them for migration to direct imports from the workflow contract. If a workflow's main file imports Node-only code, use the browser-safe sibling-schema pattern (a separate `<workflow-name>-schema.ts` file, importing `node:*`-free schema definitions only) so CC can consume the schema without triggering Vite's `"fs" has been externalized` error.
44
-
45
- 7. **Rebuild and type-check:**
46
-
47
- ```bash
48
- pnpm -C ui build
49
- pnpm -C ui exec tsc --noEmit
50
- pnpm -C operations exec tsc --noEmit
51
- ```
52
-
53
- ## Verification
54
-
55
- After applying all actions above:
56
-
57
- - `pnpm install` completes cleanly with no unresolved peer warnings.
58
- - `pnpm check-types` passes across all project packages (`ui`, `operations`, `core`).
59
- - `pnpm test` passes where test suites exist.
60
- - `pnpm -C ui dev` starts the CC dev server. Navigating to any workflow detail route (e.g., a lead-gen list action form) produces no `Module "fs" has been externalized for browser compatibility` console errors. If those errors appeared before this upgrade, they should be gone.
61
- - A workflow execution round-trips end-to-end in dev: trigger a workflow from the CC UI, confirm the execution record appears in the monitoring view.
62
-
63
- ## Not handled by /git-sync
64
-
65
- `/git-sync` propagates template-authored files (package baselines, scaffold doc copies, sync-managed surfaces) but does NOT:
66
-
67
- - Run `pnpm up @elevasis/core @elevasis/ui @elevasis/sdk --latest` -- dep bumps are manual after the baseline lands.
68
- - Infer or apply subpath migrations for `@elevasis/sdk`. If any workflow in `operations/src/` was importing Node-only modules from the default `@elevasis/sdk` barrel, `/git-sync` will not rewrite those import paths to `@elevasis/sdk/node`. That migration is manual per project.
69
- - Replace hand-duplicated workflow schemas in `ui/src/` with imports from workflow contracts. Tenant-side schema copies need manual migration to use `contract.inputSchema` / `contract.outputSchema`.
70
- - Remove or update any `no-restricted-imports` lint rule overrides that the project may have added to disable `@elevasis/sdk` subpath enforcement. If the project disabled the rule, re-enable it after sync and resolve any violations it surfaces.
71
- - Clear the Vite module-graph cache (`ui/node_modules/.vite`). After upgrading the SDK, clear this directory manually and restart the dev server before verifying that browser-safety errors are gone -- stale cache can make fixed boundary violations appear to persist.
1
+ # Elevasis Workspace Ship-Train
2
+
3
+ ## Why this note exists
4
+
5
+ The Elevasis runtime (`external/elevasis/`) was promoted into the pnpm workspace as `packages/elevasis-{core,operations}/`. That migration exposed two latent SDK pipeline failures -- a rollup `.dts` resolver bug affecting transitive type-only peers (`openai`, `@supabase/*`, `@workos-inc/node`, etc.) and a deploy-validator crash on ESM-only `exports` maps -- both of which are now fixed in `@elevasis/sdk`. The same migration forced a formal subpath boundary contract for `@elevasis/sdk`: the default barrel is now browser-safe only, with `@elevasis/sdk/worker`, `@elevasis/sdk/node`, and `@elevasis/sdk/test-utils` as explicit runtime-gated subpaths, enforced by `no-restricted-imports` lint rules and a build-time bundle-leak test suite. Separately, workflow input/output schemas are now codified as the canonical SSOT through a three-layer pattern (operations contract owns schemas; CC imports from the workflow contract; `apps/api` stays envelope-only). The result is minor bumps to `@elevasis/core`, `@elevasis/ui`, and `@elevasis/sdk`, a `_template` dependency-baseline update, and new boundary rules that external SDK consumers must follow.
6
+
7
+ ## Applies to
8
+
9
+ All template-derived projects that consume `@elevasis/sdk`, `@elevasis/core`, or `@elevasis/ui`. Specifically:
10
+
11
+ - `nirvana-marketing`
12
+ - `ZentaraHQ`
13
+ - Any future external SDK consumer derived from the `_template` baseline
14
+
15
+ `@elevasis/sdk` is now boundary-enforced. Any external project that previously imported Node-only modules from the default `@elevasis/sdk` barrel -- including `knowledge-codegen`, anything touching `node:fs`, or `worker_threads` -- must migrate those imports to `@elevasis/sdk/node`. Workflow handler code that uses `platform.call`, `acqDb`, or adapter factories should already be on `@elevasis/sdk/worker`; verify this is the case.
16
+
17
+ ## Required actions
18
+
19
+ 1. Pull template changes with `/git-sync` after this train publishes so the refreshed package baselines (`core/package.json`, `ui/package.json`, `operations/package.json`) reach the project.
20
+
21
+ 2. After the baseline lands, update package versions in the project:
22
+
23
+ ```bash
24
+ pnpm up @elevasis/core @elevasis/ui @elevasis/sdk --latest
25
+ ```
26
+
27
+ Version baselines are written into the `_template` package files by the release train. Match the versions from `_template` after sync or run `--latest` to pull the published minors.
28
+
29
+ 3. Run `pnpm install` from the project root after the dep bump to ensure the lockfile is updated.
30
+
31
+ 4. **Audit `@elevasis/sdk` import subpaths.** In `operations/src/`, search for any import from `@elevasis/sdk` that touches `knowledge-codegen`, `node:fs`, `worker_threads`, or any other Node-only module. These must move to `@elevasis/sdk/node`. Workflow handler files that use `platform`, `acqDb`, or adapter factories belong on `@elevasis/sdk/worker` -- verify the subpath is explicit.
32
+
33
+ ```ts
34
+ // Before (incorrect for Node-only tooling)
35
+ import { knowledgeCodegen } from '@elevasis/sdk'
36
+
37
+ // After
38
+ import { knowledgeCodegen } from '@elevasis/sdk/node'
39
+ ```
40
+
41
+ 5. **Audit for `@repo/elevasis-core` or `@repo/elevasis-operations` imports.** These package names are workspace-internal to the platform monorepo and are not published. External consumers must use the published packages (`@elevasis/sdk`, `@elevasis/core`, `@elevasis/ui`) exclusively. If a tenant project forked or copied an import path using the `@repo/elevasis-*` namespace, replace it with the appropriate published subpath.
42
+
43
+ 6. **Audit workflow input/output schema usage in `ui/src/`.** Per the schema SSOT pattern, CC code should import schemas from the workflow's `contract.inputSchema` or `contract.outputSchema`, not from hand-duplicated local type declarations. If the project has hand-written copies of workflow input or output schemas in `ui/src/`, flag them for migration to direct imports from the workflow contract. If a workflow's main file imports Node-only code, use the browser-safe sibling-schema pattern (a separate `<workflow-name>-schema.ts` file, importing `node:*`-free schema definitions only) so CC can consume the schema without triggering Vite's `"fs" has been externalized` error.
44
+
45
+ 7. **Rebuild and type-check:**
46
+
47
+ ```bash
48
+ pnpm -C ui build
49
+ pnpm -C ui exec tsc --noEmit
50
+ pnpm -C operations exec tsc --noEmit
51
+ ```
52
+
53
+ ## Verification
54
+
55
+ After applying all actions above:
56
+
57
+ - `pnpm install` completes cleanly with no unresolved peer warnings.
58
+ - `pnpm check-types` passes across all project packages (`ui`, `operations`, `core`).
59
+ - `pnpm test` passes where test suites exist.
60
+ - `pnpm -C ui dev` starts the CC dev server. Navigating to any workflow detail route (e.g., a lead-gen list action form) produces no `Module "fs" has been externalized for browser compatibility` console errors. If those errors appeared before this upgrade, they should be gone.
61
+ - A workflow execution round-trips end-to-end in dev: trigger a workflow from the CC UI, confirm the execution record appears in the monitoring view.
62
+
63
+ ## Not handled by /git-sync
64
+
65
+ `/git-sync` propagates template-authored files (package baselines, scaffold doc copies, sync-managed surfaces) but does NOT:
66
+
67
+ - Run `pnpm up @elevasis/core @elevasis/ui @elevasis/sdk --latest` -- dep bumps are manual after the baseline lands.
68
+ - Infer or apply subpath migrations for `@elevasis/sdk`. If any workflow in `operations/src/` was importing Node-only modules from the default `@elevasis/sdk` barrel, `/git-sync` will not rewrite those import paths to `@elevasis/sdk/node`. That migration is manual per project.
69
+ - Replace hand-duplicated workflow schemas in `ui/src/` with imports from workflow contracts. Tenant-side schema copies need manual migration to use `contract.inputSchema` / `contract.outputSchema`.
70
+ - Remove or update any `no-restricted-imports` lint rule overrides that the project may have added to disable `@elevasis/sdk` subpath enforcement. If the project disabled the rule, re-enable it after sync and resolve any violations it surfaces.
71
+ - Clear the Vite module-graph cache (`ui/node_modules/.vite`). After upgrading the SDK, clear this directory manually and restart the dev server before verifying that browser-safety errors are gone -- stale cache can make fixed boundary violations appear to persist.