@elevasis/sdk 1.24.0 → 1.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/cli.cjs +875 -834
  2. package/dist/index.d.ts +4857 -4547
  3. package/dist/index.js +564 -2338
  4. package/dist/node/index.d.ts +693 -1356
  5. package/dist/node/index.js +1 -1
  6. package/dist/test-utils/index.d.ts +4186 -4139
  7. package/dist/test-utils/index.js +694 -2769
  8. package/dist/types/worker/adapters/clickup.d.ts +22 -0
  9. package/dist/types/worker/adapters/index.d.ts +1 -0
  10. package/dist/types/worker/index.d.ts +3 -2
  11. package/dist/types/worker/platform.d.ts +2 -2
  12. package/dist/worker/index.js +427 -2803
  13. package/package.json +2 -2
  14. package/reference/_navigation.md +11 -1
  15. package/reference/_reference-manifest.json +70 -0
  16. package/reference/claude-config/rules/organization-model.md +12 -1
  17. package/reference/claude-config/rules/organization-os.md +12 -1
  18. package/reference/claude-config/skills/om/SKILL.md +13 -5
  19. package/reference/claude-config/skills/om/operations/codify-level-a.md +109 -100
  20. package/reference/claude-config/skills/om/operations/customers.md +10 -6
  21. package/reference/claude-config/skills/om/operations/features.md +7 -3
  22. package/reference/claude-config/skills/om/operations/goals.md +10 -6
  23. package/reference/claude-config/skills/om/operations/identity.md +8 -5
  24. package/reference/claude-config/skills/om/operations/labels.md +17 -1
  25. package/reference/claude-config/skills/om/operations/offerings.md +11 -7
  26. package/reference/claude-config/skills/om/operations/roles.md +11 -7
  27. package/reference/claude-config/skills/om/operations/techStack.md +10 -2
  28. package/reference/claude-config/sync-notes/2026-05-20-om-define-helpers.md +32 -0
  29. package/reference/claude-config/sync-notes/2026-05-22-access-model-and-right-panel.md +43 -0
  30. package/reference/claude-config/sync-notes/2026-05-22-lead-gen-tenant-config.md +40 -0
  31. package/reference/claude-config/sync-notes/2026-05-22-org-model-multi-file-split.md +61 -0
  32. package/reference/cli-management.mdx +539 -0
  33. package/reference/cli.mdx +579 -808
  34. package/reference/concepts.mdx +134 -146
  35. package/reference/deployment/api.mdx +296 -297
  36. package/reference/deployment/command-center.mdx +208 -209
  37. package/reference/deployment/index.mdx +194 -195
  38. package/reference/deployment/provided-features.mdx +110 -107
  39. package/reference/deployment/ui-execution.mdx +249 -250
  40. package/reference/framework/index.mdx +111 -195
  41. package/reference/framework/resource-documentation.mdx +90 -0
  42. package/reference/framework/tutorial-system.mdx +135 -135
  43. package/reference/getting-started.mdx +141 -142
  44. package/reference/index.mdx +95 -106
  45. package/reference/packages/ui/src/auth/README.md +6 -6
  46. package/reference/platform-tools/adapters-integration.mdx +300 -301
  47. package/reference/platform-tools/adapters-platform.mdx +552 -553
  48. package/reference/platform-tools/index.mdx +216 -217
  49. package/reference/platform-tools/type-safety.mdx +82 -82
  50. package/reference/resources/index.mdx +348 -349
  51. package/reference/resources/patterns.mdx +446 -449
  52. package/reference/resources/types.mdx +115 -116
  53. package/reference/roadmap.mdx +164 -165
  54. package/reference/rules/organization-model.md +14 -0
  55. package/reference/runtime.mdx +172 -173
  56. package/reference/scaffold/operations/propagation-pipeline.md +1 -1
  57. package/reference/scaffold/recipes/customize-crm-actions.md +45 -46
  58. package/reference/scaffold/recipes/extend-crm.md +253 -255
  59. package/reference/scaffold/recipes/extend-lead-gen.md +130 -77
  60. package/reference/scaffold/recipes/index.md +43 -44
  61. package/reference/scaffold/reference/contracts.md +1275 -1432
  62. package/reference/scaffold/reference/glossary.md +8 -6
  63. package/reference/scaffold/ui/feature-flags-and-gating.md +59 -46
  64. package/reference/scaffold/ui/feature-shell.mdx +11 -11
  65. package/reference/scaffold/ui/recipes.md +24 -24
  66. package/reference/troubleshooting.mdx +222 -223
@@ -1,173 +1,172 @@
1
- ---
2
- title: Execution Runtime
3
- description: How your code runs on the Elevasis platform -- execution lifecycle, concurrency, timeouts, cancellation, error handling, observability, resource limits, and v1 limitations
4
- loadWhen: "Debugging execution behavior or understanding the runtime model"
5
- ---
6
-
7
- This page covers everything that happens after you deploy -- how resources execute as managed processes, how failures surface to you, what observability data you can access, and the hard limits enforced on all executions.
8
-
9
- ---
10
-
11
- ## Execution Lifecycle
12
-
13
- ### The Four Stages
14
-
15
- Every execution traverses four stages: trigger, route, execute, and return.
16
-
17
- 1. **Trigger** -- A user, CLI command, or API call initiates execution. The platform creates an execution record with `status: 'running'` and generates a unique `executionId`.
18
- 2. **Route** -- The platform resolves the target resource from the registry. All resources (static and external) coexist in a single in-memory registry with no database queries at lookup time.
19
- 3. **Execute** -- An ephemeral worker thread is created from your deployed bundle and sent the execution request. The worker matches the `resourceId` to your definition, validates the input against your Zod schema, and runs the handler. For workflows, steps execute sequentially following the `next` chain. The worker is terminated immediately after execution completes.
20
- 4. **Return** -- The worker posts the result back to the platform. The platform stores the final result, updates the execution record, and fans events out to AI Studio and CLI subscribers.
21
-
22
- ### Concurrency Model
23
-
24
- Workers are ephemeral -- each execution creates a new worker thread. There is no persistent pool:
25
-
26
- - **Per-execution isolation:** Each execution gets its own worker thread. Concurrent executions for the same organization run in separate workers with no shared state.
27
- - **Memory:** Each worker is capped at 256MB. Concurrent workers multiply memory usage proportionally.
28
- - **No cold start:** Workers are created fresh per execution. Your first execution and hundredth are identical in terms of startup behavior.
29
-
30
- ### Timeout Enforcement
31
-
32
- Timeouts are enforced by the platform. You do not handle them explicitly in your code:
33
-
34
- - **Default timeout:** A platform default applies to all resource types unless overridden.
35
- - **Per-resource override:** Agents can configure `constraints.timeout` in the agent definition. Workflows use the platform default.
36
- - **Enforcement:** When a timeout fires, the worker is terminated immediately -- even if it is stuck in a synchronous loop. No special handler signature is required on your part.
37
-
38
- ### Cancellation
39
-
40
- Cancellation is initiated by the platform and requires no special code in your handler. The worker is terminated immediately and the execution is recorded as cancelled.
41
-
42
- **What triggers cancellation:**
43
-
44
- - You call `POST /api/external/executions/:resourceId/:executionId/cancel` via CLI or API
45
- - The platform timeout expires
46
- - The resource is deleted while an execution is in-flight
47
-
48
- ---
49
-
50
- ## Error Handling
51
-
52
- ### How Errors Reach You
53
-
54
- Errors are displayed depending on the surface you use to inspect them:
55
-
56
- - **AI Studio:** Shows the error message and execution status. Example: `Remote resource 'onboard-client' failed: Email delivery failed: invalid address`
57
- - **CLI (`elevasis-sdk execution <resourceId> <id>`):** Shows full execution detail including the error message. The `--json` flag includes an `error` field in structured output.
58
- - **Error message source:** The error string comes directly from your handler's catch block (`String(err)`). The platform stores this verbatim and displays it as-is. Write descriptive error messages in your handlers -- they surface directly to users.
59
-
60
- ### What Causes a Failed Execution
61
-
62
- - **Unhandled exception in your handler:** The worker reports `status: 'failed'` with the error message.
63
- - **Memory limit exceeded (256MB):** The worker crashes with an out-of-memory error. The platform catches this; other tenants are unaffected.
64
- - **Timeout exceeded:** The platform terminates the worker and marks the execution failed with a timeout reason.
65
- - **Cancellation:** Execution is marked cancelled.
66
-
67
- ---
68
-
69
- ## Observability
70
-
71
- ### Logging
72
-
73
- You produce logs using standard `console` methods -- no special logger object is needed:
74
-
75
- - **Console interception:** The SDK worker runtime intercepts `console.log`, `console.warn`, and `console.error` during handler execution and captures them as structured `{ level, message }` entries.
76
- - **Level mapping:** `console.log` maps to `info`, `console.warn` maps to `warn`, `console.error` maps to `error`.
77
- - **No changes required:** Any code that already uses `console.log` automatically has its output captured. Existing code works without modification.
78
-
79
- ### Log Transport
80
-
81
- Logs are delivered to the platform atomically with the execution result:
82
-
83
- - **Bundled delivery:** All logs for an execution are included in the result message when the handler completes. There is no real-time streaming -- logs arrive with the final result.
84
- - **Crash behavior:** If the worker crashes before completing, logs captured up to the crash point are lost. The platform records only the crash error.
85
-
86
- ### Log Retention and Display
87
-
88
- - **Retention:** 30 days by default (configurable per plan).
89
- - **Real-time fanout:** After execution completes, logs are stored and fanned out to AI Studio and CLI subscribers. AI Studio shows them in the execution detail view.
90
- - **CLI access:** Use `elevasis-sdk execution <resourceId> <id>` to view execution details including logs.
91
-
92
- ---
93
-
94
- ## Resource Lifecycle
95
-
96
- ### Status
97
-
98
- Every resource on the platform has a status that you control in your definition:
99
-
100
- - **`dev`** -- Default for new resources. Visible in AI Studio and executable, but marked with a "Development" badge. Use this during testing and iteration.
101
- - **`prod`** -- Set `status: 'prod'` in your resource definition before deploying. No badge. This is the live, production-ready state.
102
-
103
- ### Versioning
104
-
105
- v1 versioning is intentionally simple:
106
-
107
- - **One active version per resource per org.** Deploying replaces the running version. There is no version history at the resource level; previous deploys are marked stopped.
108
- - **Immutable per deploy.** A resource definition is frozen at deploy time. Changing code requires a new deploy.
109
-
110
- ### Deletion
111
-
112
- - **Via CLI:** Remove the resource from your `DeploymentSpec` export and run `elevasis-sdk deploy`. Resources absent from the new bundle are automatically deregistered from the platform.
113
- - **Via AI Studio:** The delete button unregisters the resource immediately and marks the deployment stopped.
114
- - **In-flight executions:** Workers already running complete normally. Deletion affects only new execution attempts.
115
- - **Data retention:** Execution logs and history for a deleted resource are retained for 30 days, then purged.
116
-
117
- ---
118
-
119
- ## Resource Limits & Quotas
120
-
121
- ### Per-Worker Limits
122
-
123
- Limits enforced per worker thread at runtime:
124
-
125
- | Resource | Value |
126
- | ---------------- | ----------------------------------------------------------- |
127
- | Memory (V8 heap) | 256MB per worker |
128
- | Disk | Bundle file only (ephemeral, not persistent across deploys) |
129
-
130
- - **Memory:** Enforced by the platform. Exceeding 256MB crashes the worker. The platform catches the error; other tenants are unaffected. If your workflow processes large datasets, consider streaming or batching to stay within the limit.
131
- - **Disk:** Your bundle is written to disk during deploy and available to the worker at execution time. It is not a persistent write surface -- do not write files to disk from within your handler expecting them to persist.
132
-
133
- ### Scale Limits
134
-
135
- Hard limits to prevent abuse and ensure platform stability:
136
-
137
- | Limit | Value |
138
- | ---------------------------------- | ------------- |
139
- | Max execution duration (workflows) | 300s (5 min) |
140
- | Max execution duration (agents) | 600s (10 min) |
141
- | Max log volume | 100MB/day |
142
- | Max deploy frequency | 60/day |
143
-
144
- - **Execution duration:** Executions exceeding the timeout are terminated by the platform. The execution is marked failed with a timeout reason.
145
- - **Log volume:** Total log output across all executions is capped at 100MB per day. Logs beyond this threshold may be truncated.
146
- - **Deploy frequency:** 60 deploys per day is generous for normal development. This limit prevents accidental deploy loops (for example, a CI pipeline misconfigured to deploy on every commit).
147
-
148
- ### Networking
149
-
150
- - **Outbound:** Unrestricted. Your handlers can call any external API (OpenAI, Twilio, Stripe, etc.) from within the worker.
151
- - **Inbound:** Workers receive input from the platform coordinator via internal message passing -- they are not exposed to the network directly.
152
- - **No ports:** Workers communicate with the platform via zero-network-overhead message passing. No port allocation occurs.
153
- - **Isolation:** Workers have no access to other organizations' data or platform credentials by default. Supabase credentials are not present in the worker environment.
154
-
155
- ---
156
-
157
- ## v1 Limitations
158
-
159
- | Limitation | Reason | Future path |
160
- | ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------- |
161
- | **No nested execution from external resources** | External resources cannot call back to the platform's execution coordinator to trigger other resources as sub-executions. | A callback API endpoint that external processes can call to trigger nested executions (requires auth token forwarding). |
162
- | **No streaming logs** | Execution logs are returned in the response body after completion. There is no real-time SSE streaming from within the worker. | SSE/WebSocket push from external processes to the platform log system. |
163
- | **Static resource priority conflicts** | If your organization has a static (monorepo) resource with the same ID as a resource in your SDK bundle, the deploy will fail. Static definitions always take priority and cannot be overridden. | Conflict detection is surfaced in the CLI with a clear error message. |
164
-
165
- ---
166
-
167
- ## Organization Provisioning
168
-
169
- Organization creation is currently admin-only. If you need a new organization provisioned for SDK access, contact the Elevasis team. Self-serve organization creation and API key generation is on the roadmap.
170
-
171
- ---
172
-
173
- **Last Updated:** 2026-03-06
1
+ ---
2
+ title: Execution Runtime
3
+ description: How your code runs on the Elevasis platform -- execution lifecycle, concurrency, timeouts, cancellation, error handling, observability, resource limits, and v1 limitations
4
+ ---
5
+
6
+ This page covers everything that happens after you deploy -- how resources execute as managed processes, how failures surface to you, what observability data you can access, and the hard limits enforced on all executions.
7
+
8
+ ---
9
+
10
+ ## Execution Lifecycle
11
+
12
+ ### The Four Stages
13
+
14
+ Every execution traverses four stages: trigger, route, execute, and return.
15
+
16
+ 1. **Trigger** -- A user, CLI command, or API call initiates execution. The platform creates an execution record with `status: 'running'` and generates a unique `executionId`.
17
+ 2. **Route** -- The platform resolves the target resource from the registry. All resources (static and external) coexist in a single in-memory registry with no database queries at lookup time.
18
+ 3. **Execute** -- An ephemeral worker thread is created from your deployed bundle and sent the execution request. The worker matches the `resourceId` to your definition, validates the input against your Zod schema, and runs the handler. For workflows, steps execute sequentially following the `next` chain. The worker is terminated immediately after execution completes.
19
+ 4. **Return** -- The worker posts the result back to the platform. The platform stores the final result, updates the execution record, and fans events out to AI Studio and CLI subscribers.
20
+
21
+ ### Concurrency Model
22
+
23
+ Workers are ephemeral -- each execution creates a new worker thread. There is no persistent pool:
24
+
25
+ - **Per-execution isolation:** Each execution gets its own worker thread. Concurrent executions for the same organization run in separate workers with no shared state.
26
+ - **Memory:** Each worker is capped at 256MB. Concurrent workers multiply memory usage proportionally.
27
+ - **No cold start:** Workers are created fresh per execution. Your first execution and hundredth are identical in terms of startup behavior.
28
+
29
+ ### Timeout Enforcement
30
+
31
+ Timeouts are enforced by the platform. You do not handle them explicitly in your code:
32
+
33
+ - **Default timeout:** A platform default applies to all resource types unless overridden.
34
+ - **Per-resource override:** Agents can configure `constraints.timeout` in the agent definition. Workflows use the platform default.
35
+ - **Enforcement:** When a timeout fires, the worker is terminated immediately -- even if it is stuck in a synchronous loop. No special handler signature is required on your part.
36
+
37
+ ### Cancellation
38
+
39
+ Cancellation is initiated by the platform and requires no special code in your handler. The worker is terminated immediately and the execution is recorded as cancelled.
40
+
41
+ **What triggers cancellation:**
42
+
43
+ - You call `POST /api/external/executions/:resourceId/:executionId/cancel` via CLI or API
44
+ - The platform timeout expires
45
+ - The resource is deleted while an execution is in-flight
46
+
47
+ ---
48
+
49
+ ## Error Handling
50
+
51
+ ### How Errors Reach You
52
+
53
+ Errors are displayed depending on the surface you use to inspect them:
54
+
55
+ - **AI Studio:** Shows the error message and execution status. Example: `Remote resource 'onboard-client' failed: Email delivery failed: invalid address`
56
+ - **CLI (`elevasis-sdk execution <resourceId> <id>`):** Shows full execution detail including the error message. The `--json` flag includes an `error` field in structured output.
57
+ - **Error message source:** The error string comes directly from your handler's catch block (`String(err)`). The platform stores this verbatim and displays it as-is. Write descriptive error messages in your handlers -- they surface directly to users.
58
+
59
+ ### What Causes a Failed Execution
60
+
61
+ - **Unhandled exception in your handler:** The worker reports `status: 'failed'` with the error message.
62
+ - **Memory limit exceeded (256MB):** The worker crashes with an out-of-memory error. The platform catches this; other tenants are unaffected.
63
+ - **Timeout exceeded:** The platform terminates the worker and marks the execution failed with a timeout reason.
64
+ - **Cancellation:** Execution is marked cancelled.
65
+
66
+ ---
67
+
68
+ ## Observability
69
+
70
+ ### Logging
71
+
72
+ You produce logs using standard `console` methods -- no special logger object is needed:
73
+
74
+ - **Console interception:** The SDK worker runtime intercepts `console.log`, `console.warn`, and `console.error` during handler execution and captures them as structured `{ level, message }` entries.
75
+ - **Level mapping:** `console.log` maps to `info`, `console.warn` maps to `warn`, `console.error` maps to `error`.
76
+ - **No changes required:** Any code that already uses `console.log` automatically has its output captured. Existing code works without modification.
77
+
78
+ ### Log Transport
79
+
80
+ Logs are delivered to the platform atomically with the execution result:
81
+
82
+ - **Bundled delivery:** All logs for an execution are included in the result message when the handler completes. There is no real-time streaming -- logs arrive with the final result.
83
+ - **Crash behavior:** If the worker crashes before completing, logs captured up to the crash point are lost. The platform records only the crash error.
84
+
85
+ ### Log Retention and Display
86
+
87
+ - **Retention:** 30 days by default (configurable per plan).
88
+ - **Real-time fanout:** After execution completes, logs are stored and fanned out to AI Studio and CLI subscribers. AI Studio shows them in the execution detail view.
89
+ - **CLI access:** Use `elevasis-sdk execution <resourceId> <id>` to view execution details including logs.
90
+
91
+ ---
92
+
93
+ ## Resource Lifecycle
94
+
95
+ ### Status
96
+
97
+ Every resource on the platform has a status that you control in your definition:
98
+
99
+ - **`dev`** -- Default for new resources. Visible in AI Studio and executable, but marked with a "Development" badge. Use this during testing and iteration.
100
+ - **`prod`** -- Set `status: 'prod'` in your resource definition before deploying. No badge. This is the live, production-ready state.
101
+
102
+ ### Versioning
103
+
104
+ v1 versioning is intentionally simple:
105
+
106
+ - **One active version per resource per org.** Deploying replaces the running version. There is no version history at the resource level; previous deploys are marked stopped.
107
+ - **Immutable per deploy.** A resource definition is frozen at deploy time. Changing code requires a new deploy.
108
+
109
+ ### Deletion
110
+
111
+ - **Via CLI:** Remove the resource from your `DeploymentSpec` export and run `elevasis-sdk deploy`. Resources absent from the new bundle are automatically deregistered from the platform.
112
+ - **Via AI Studio:** The delete button unregisters the resource immediately and marks the deployment stopped.
113
+ - **In-flight executions:** Workers already running complete normally. Deletion affects only new execution attempts.
114
+ - **Data retention:** Execution logs and history for a deleted resource are retained for 30 days, then purged.
115
+
116
+ ---
117
+
118
+ ## Resource Limits & Quotas
119
+
120
+ ### Per-Worker Limits
121
+
122
+ Limits enforced per worker thread at runtime:
123
+
124
+ | Resource | Value |
125
+ | ---------------- | ----------------------------------------------------------- |
126
+ | Memory (V8 heap) | 256MB per worker |
127
+ | Disk | Bundle file only (ephemeral, not persistent across deploys) |
128
+
129
+ - **Memory:** Enforced by the platform. Exceeding 256MB crashes the worker. The platform catches the error; other tenants are unaffected. If your workflow processes large datasets, consider streaming or batching to stay within the limit.
130
+ - **Disk:** Your bundle is written to disk during deploy and available to the worker at execution time. It is not a persistent write surface -- do not write files to disk from within your handler expecting them to persist.
131
+
132
+ ### Scale Limits
133
+
134
+ Hard limits to prevent abuse and ensure platform stability:
135
+
136
+ | Limit | Value |
137
+ | ---------------------------------- | ------------- |
138
+ | Max execution duration (workflows) | 300s (5 min) |
139
+ | Max execution duration (agents) | 600s (10 min) |
140
+ | Max log volume | 100MB/day |
141
+ | Max deploy frequency | 60/day |
142
+
143
+ - **Execution duration:** Executions exceeding the timeout are terminated by the platform. The execution is marked failed with a timeout reason.
144
+ - **Log volume:** Total log output across all executions is capped at 100MB per day. Logs beyond this threshold may be truncated.
145
+ - **Deploy frequency:** 60 deploys per day is generous for normal development. This limit prevents accidental deploy loops (for example, a CI pipeline misconfigured to deploy on every commit).
146
+
147
+ ### Networking
148
+
149
+ - **Outbound:** Unrestricted. Your handlers can call any external API (OpenAI, Twilio, Stripe, etc.) from within the worker.
150
+ - **Inbound:** Workers receive input from the platform coordinator via internal message passing -- they are not exposed to the network directly.
151
+ - **No ports:** Workers communicate with the platform via zero-network-overhead message passing. No port allocation occurs.
152
+ - **Isolation:** Workers have no access to other organizations' data or platform credentials by default. Supabase credentials are not present in the worker environment.
153
+
154
+ ---
155
+
156
+ ## v1 Limitations
157
+
158
+ | Limitation | Reason | Future path |
159
+ | ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------- |
160
+ | **No nested execution from external resources** | External resources cannot call back to the platform's execution coordinator to trigger other resources as sub-executions. | A callback API endpoint that external processes can call to trigger nested executions (requires auth token forwarding). |
161
+ | **No streaming logs** | Execution logs are returned in the response body after completion. There is no real-time SSE streaming from within the worker. | SSE/WebSocket push from external processes to the platform log system. |
162
+ | **Static resource priority conflicts** | If your organization has a static (monorepo) resource with the same ID as a resource in your SDK bundle, the deploy will fail. Static definitions always take priority and cannot be overridden. | Conflict detection is surfaced in the CLI with a clear error message. |
163
+
164
+ ---
165
+
166
+ ## Organization Provisioning
167
+
168
+ Organization creation is currently admin-only. If you need a new organization provisioned for SDK access, contact the Elevasis team. Self-serve organization creation and API key generation is on the roadmap.
169
+
170
+ ---
171
+
172
+ **Last Updated:** 2026-03-06
@@ -102,7 +102,7 @@ The external skill doc (`.claude/skills/external/SKILL.md`) remains the workflow
102
102
  | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
103
103
  | `deps` | `@elevasis/ui`, `@elevasis/sdk`, `@elevasis/core` versions match template |
104
104
  | `tier1` | registry-backed replace surfaces match template where verification still models them as exact baselines |
105
- | `org-os` | Organization model exists, exports canonical symbols, imports from `@elevasis/core/organization-model`, calls `createFoundationOrganizationModel`, app-config references org model, `__root.tsx` uses `ElevasisSystemsProvider` + `canonicalOrganizationModel`, `main.tsx` uses `createElevasisApp`, all 3 CSS subpath imports present |
105
+ | `org-os` | Organization model exists, exports canonical symbols, imports from `@elevasis/core/organization-model`, either calls `createFoundationOrganizationModel` or uses explicit `resolveOrganizationModel(..., { mergeDefaults: false })` canonical assembly, app-config references org model, `__root.tsx` uses `ElevasisAuthenticatedShell` / `ElevasisSystemsProvider` + `canonicalOrganizationModel`, `main.tsx` uses `createElevasisApp`, all 3 CSS subpath imports present |
106
106
  | `placeholders` | No unresolved `__PROJECT_SLUG__`, `__PROJECT_NAME__`, `__PROJECT_DESCRIPTION__` in key config files |
107
107
  | `scripts` | `ui` and `operations` `package.json` have required npm scripts |
108
108
  | `lib` | `ui/src/lib/`, `lib/`, `test-utils/` exist with minimum file counts |
@@ -23,14 +23,14 @@ Use this recipe when a user asks for work like:
23
23
 
24
24
  ## How Platform Action Dispatch Works
25
25
 
26
- Every default action in `DEFAULT_CRM_ACTIONS` maps to a deployed workflow via its `workflowId` field. When the shared UI calls `POST /deals/:dealId/actions/:actionKey`, the platform:
26
+ Every action in the CRM action catalog maps to a deployed workflow via its `workflowId` field. When the shared UI calls `POST /deals/:dealId/actions/:actionKey`, the platform:
27
27
 
28
28
  1. Validates `isAvailableFor(deal)` server-side (security gate -- cannot be skipped).
29
29
  2. Resolves `actionDef.workflowId` to a deployed resource.
30
30
  3. Dispatches through `SingleExecutionCoordinator` -- same execution engine as every other workflow.
31
31
  4. Returns the refetched deal.
32
32
 
33
- External projects override an action's behavior by deploying a workflow with the same `workflowId` as the default. The resource registry picks the project-owned workflow over the platform default. The `isAvailableFor` predicate is not overridable in V1 -- it stays in `@core` `DEFAULT_CRM_ACTIONS`. Override what the action does, not when the button shows.
33
+ External projects override an action's behavior by deploying a workflow with the same `workflowId` as the action entry. The resource registry picks the project-owned workflow over the platform default. The `isAvailableFor` predicate comes from the caller-supplied action catalog; override what the action does and keep button availability aligned with the server-side gate.
34
34
 
35
35
  ## ActionDef Shape
36
36
 
@@ -120,7 +120,7 @@ export const moveToProposalWorkflow: WorkflowDefinition = {
120
120
  }
121
121
  ```
122
122
 
123
- To add side effects (create a task, send a Slack message, log a deal activity), extend the handler before the `return`. The OM descriptor ID must match the action's `workflowId` in `DEFAULT_CRM_ACTIONS` from `@elevasis/sdk` exactly.
123
+ To add side effects (create a task, send a Slack message, log a deal activity), extend the handler before the `return`. The OM descriptor ID must match the action entry's `workflowId` exactly.
124
124
 
125
125
  Register the workflow in the operations manifest:
126
126
 
@@ -144,23 +144,23 @@ pnpm exec elevasis-sdk deploy
144
144
 
145
145
  To hide, reorder, or relabel buttons in the shared deal UI, create a local action config module:
146
146
 
147
- ```ts
148
- // ui/src/config/crm-actions.ts
149
- import { DEFAULT_CRM_ACTIONS, type ActionDef } from '@elevasis/sdk'
150
-
151
- export const crmActions: ActionDef[] = [
152
- ...DEFAULT_CRM_ACTIONS.filter((action) => action.key !== 'move_to_closed_lost')
153
- ]
154
- ```
147
+ ```ts
148
+ // ui/src/config/crm-actions.ts
149
+ import type { ActionDef } from '@elevasis/sdk'
150
+ import { platformCrmActions } from './platform-crm-actions'
151
+
152
+ export const crmActions: ActionDef[] = platformCrmActions.filter((action) => action.key !== 'move_to_closed_lost')
153
+ ```
155
154
 
156
155
  To add a new action entry alongside the defaults (note: brand-new keys are not server-dispatched until the platform knows their `workflowId`):
157
156
 
158
- ```ts
159
- // ui/src/config/crm-actions.ts
160
- import { DEFAULT_CRM_ACTIONS, type ActionDef } from '@elevasis/sdk'
161
-
162
- export const crmActions: ActionDef[] = [
163
- ...DEFAULT_CRM_ACTIONS,
157
+ ```ts
158
+ // ui/src/config/crm-actions.ts
159
+ import type { ActionDef } from '@elevasis/sdk'
160
+ import { platformCrmActions } from './platform-crm-actions'
161
+
162
+ export const crmActions: ActionDef[] = [
163
+ ...platformCrmActions,
164
164
  {
165
165
  key: 'send_quote',
166
166
  label: 'Send Quote',
@@ -357,20 +357,21 @@ When you own the full page, use the primitives directly:
357
357
  - `useExecuteAction({ dealId })` dispatches platform-known action keys.
358
358
  - Project-owned workflow buttons call `/execute` or `/execute-async` directly when they are outside the server-dispatched action set.
359
359
 
360
- ```tsx
361
- import { DEFAULT_CRM_ACTIONS, deriveActions } from '@elevasis/sdk'
362
- import { Group, Stack } from '@mantine/core'
363
- import { useMemo } from 'react'
364
- import { useDealDetail, useExecuteAction } from '@elevasis/ui/hooks'
365
- import { SendQuoteButton } from './SendQuoteButton'
360
+ ```tsx
361
+ import { deriveActions } from '@elevasis/sdk'
362
+ import { Group, Stack } from '@mantine/core'
363
+ import { useMemo } from 'react'
364
+ import { useDealDetail, useExecuteAction } from '@elevasis/ui/hooks'
365
+ import { crmActions } from '../config/crm-actions'
366
+ import { SendQuoteButton } from './SendQuoteButton'
366
367
 
367
368
  export function CustomDealPage({ dealId }: { dealId: string }) {
368
369
  const { data: deal } = useDealDetail(dealId)
369
- const executeAction = useExecuteAction({ dealId })
370
-
371
- const platformActions = useMemo(() => {
372
- return deal ? deriveActions(deal, DEFAULT_CRM_ACTIONS) : []
373
- }, [deal])
370
+ const executeAction = useExecuteAction({ dealId })
371
+
372
+ const platformActions = useMemo(() => {
373
+ return deal ? deriveActions(deal, crmActions) : []
374
+ }, [deal])
374
375
 
375
376
  if (!deal) return null
376
377
 
@@ -395,24 +396,22 @@ export function CustomDealPage({ dealId }: { dealId: string }) {
395
396
 
396
397
  ## CRM State-Key Source of Truth
397
398
 
398
- `CRM_PIPELINE_DEFINITION` in `packages/core/src/organization-model/domains/sales.ts` is the single canonical source for CRM `state_key` values. It exports a `StatefulPipelineDefinition` that enumerates every valid state per stage (e.g. `interested` → `discovery_replied`, `discovery_link_sent`, `discovery_nudging`, etc.). Named per-state constants (`CRM_DISCOVERY_REPLIED_STATE`, `CRM_DISCOVERY_LINK_SENT_STATE`, and siblings) are also exported for use in conditional logic.
399
-
400
- Import via `@repo/core/organization-model`:
401
-
402
- ```ts
403
- import {
404
- CRM_PIPELINE_DEFINITION,
405
- CRM_DISCOVERY_REPLIED_STATE,
406
- getValidStatesForStage
407
- } from '@repo/core/organization-model'
408
-
409
- const validStates = getValidStatesForStage(CRM_PIPELINE_DEFINITION, 'interested')
410
- // [{ stateKey: 'discovery_replied', label: '...' }, ...]
411
- ```
412
-
413
- Workflows that write `state_key` should import from this definition rather than hardcoding string literals. This keeps the vocabulary in one place and lets the API validate against the allowed set for a deal's current stage.
414
-
415
- **Current gap:** `@elevasis/core` v0.13.0 does not yet expose the `organization-model` subpath. Until a new release ships that export, hardcoded strings in `packages/elevasis-operations/...` are tracked as follow-up. Document usages with a `// TODO: replace with CRM_PIPELINE_DEFINITION import once @elevasis/core exposes organization-model` comment so they are easy to find.
399
+ CRM `stage_key` and `state_key` values are tenant/runtime data. In the Elevasis workspace, the canonical CRM pipeline definition lives in `@repo/elevasis-core/organization-model` and is authored into the `sales.crm:catalog/crm.pipeline` ontology catalog on the canonical organization model. Published `@elevasis/core` keeps only generic `StatefulPipelineDefinition` types/helpers and transport schemas.
400
+
401
+ Within the Elevasis monorepo, import runtime CRM definitions from `@repo/elevasis-core/organization-model`:
402
+
403
+ ```ts
404
+ import {
405
+ CRM_PIPELINE_DEFINITION,
406
+ CRM_DISCOVERY_REPLIED_STATE,
407
+ getValidStatesForStage
408
+ } from '@repo/elevasis-core/organization-model'
409
+
410
+ const validStates = getValidStatesForStage(CRM_PIPELINE_DEFINITION, 'interested')
411
+ // [{ stateKey: 'discovery_replied', label: '...' }, ...]
412
+ ```
413
+
414
+ Template-derived projects should define their own CRM catalog/action config in project code rather than importing Elevasis runtime constants from published core.
416
415
 
417
416
  ## Activity Log Conventions
418
417