@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.
- package/dist/cli.cjs +875 -834
- package/dist/index.d.ts +4857 -4547
- package/dist/index.js +564 -2338
- package/dist/node/index.d.ts +693 -1356
- package/dist/node/index.js +1 -1
- package/dist/test-utils/index.d.ts +4186 -4139
- package/dist/test-utils/index.js +694 -2769
- package/dist/types/worker/adapters/clickup.d.ts +22 -0
- package/dist/types/worker/adapters/index.d.ts +1 -0
- package/dist/types/worker/index.d.ts +3 -2
- package/dist/types/worker/platform.d.ts +2 -2
- package/dist/worker/index.js +427 -2803
- package/package.json +2 -2
- package/reference/_navigation.md +11 -1
- package/reference/_reference-manifest.json +70 -0
- package/reference/claude-config/rules/organization-model.md +12 -1
- package/reference/claude-config/rules/organization-os.md +12 -1
- package/reference/claude-config/skills/om/SKILL.md +13 -5
- package/reference/claude-config/skills/om/operations/codify-level-a.md +109 -100
- package/reference/claude-config/skills/om/operations/customers.md +10 -6
- package/reference/claude-config/skills/om/operations/features.md +7 -3
- package/reference/claude-config/skills/om/operations/goals.md +10 -6
- package/reference/claude-config/skills/om/operations/identity.md +8 -5
- package/reference/claude-config/skills/om/operations/labels.md +17 -1
- package/reference/claude-config/skills/om/operations/offerings.md +11 -7
- package/reference/claude-config/skills/om/operations/roles.md +11 -7
- package/reference/claude-config/skills/om/operations/techStack.md +10 -2
- package/reference/claude-config/sync-notes/2026-05-20-om-define-helpers.md +32 -0
- package/reference/claude-config/sync-notes/2026-05-22-access-model-and-right-panel.md +43 -0
- package/reference/claude-config/sync-notes/2026-05-22-lead-gen-tenant-config.md +40 -0
- package/reference/claude-config/sync-notes/2026-05-22-org-model-multi-file-split.md +61 -0
- package/reference/cli-management.mdx +539 -0
- package/reference/cli.mdx +579 -808
- package/reference/concepts.mdx +134 -146
- package/reference/deployment/api.mdx +296 -297
- package/reference/deployment/command-center.mdx +208 -209
- package/reference/deployment/index.mdx +194 -195
- package/reference/deployment/provided-features.mdx +110 -107
- package/reference/deployment/ui-execution.mdx +249 -250
- package/reference/framework/index.mdx +111 -195
- package/reference/framework/resource-documentation.mdx +90 -0
- package/reference/framework/tutorial-system.mdx +135 -135
- package/reference/getting-started.mdx +141 -142
- package/reference/index.mdx +95 -106
- package/reference/packages/ui/src/auth/README.md +6 -6
- package/reference/platform-tools/adapters-integration.mdx +300 -301
- package/reference/platform-tools/adapters-platform.mdx +552 -553
- package/reference/platform-tools/index.mdx +216 -217
- package/reference/platform-tools/type-safety.mdx +82 -82
- package/reference/resources/index.mdx +348 -349
- package/reference/resources/patterns.mdx +446 -449
- package/reference/resources/types.mdx +115 -116
- package/reference/roadmap.mdx +164 -165
- package/reference/rules/organization-model.md +14 -0
- package/reference/runtime.mdx +172 -173
- package/reference/scaffold/operations/propagation-pipeline.md +1 -1
- package/reference/scaffold/recipes/customize-crm-actions.md +45 -46
- package/reference/scaffold/recipes/extend-crm.md +253 -255
- package/reference/scaffold/recipes/extend-lead-gen.md +130 -77
- package/reference/scaffold/recipes/index.md +43 -44
- package/reference/scaffold/reference/contracts.md +1275 -1432
- package/reference/scaffold/reference/glossary.md +8 -6
- package/reference/scaffold/ui/feature-flags-and-gating.md +59 -46
- package/reference/scaffold/ui/feature-shell.mdx +11 -11
- package/reference/scaffold/ui/recipes.md +24 -24
- package/reference/troubleshooting.mdx +222 -223
package/reference/runtime.mdx
CHANGED
|
@@ -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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
- **
|
|
27
|
-
- **
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
- **
|
|
35
|
-
- **
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
-
|
|
45
|
-
- The
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
- **
|
|
57
|
-
- **
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
- **
|
|
63
|
-
- **
|
|
64
|
-
- **
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
- **
|
|
76
|
-
- **
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
- **
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
- **
|
|
89
|
-
- **
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
- **`
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
- **
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
- **Via
|
|
113
|
-
- **
|
|
114
|
-
- **
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
|
126
|
-
|
|
|
127
|
-
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
- **
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
|
138
|
-
|
|
|
139
|
-
| Max execution duration (
|
|
140
|
-
| Max
|
|
141
|
-
| Max
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
- **
|
|
145
|
-
- **
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
- **
|
|
151
|
-
- **
|
|
152
|
-
- **
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
|
160
|
-
|
|
|
161
|
-
| **No
|
|
162
|
-
| **
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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
|
|
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
|
|
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
|
|
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`
|
|
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 {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
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 {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
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 {
|
|
362
|
-
import { Group, Stack } from '@mantine/core'
|
|
363
|
-
import { useMemo } from 'react'
|
|
364
|
-
import { useDealDetail, useExecuteAction } from '@elevasis/ui/hooks'
|
|
365
|
-
import {
|
|
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,
|
|
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
|
-
`
|
|
399
|
-
|
|
400
|
-
|
|
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
|
-
|
|
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
|
|