@elevasis/sdk 1.23.0 → 1.25.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 (55) hide show
  1. package/dist/cli.cjs +5927 -6985
  2. package/dist/index.d.ts +4893 -4759
  3. package/dist/index.js +1444 -3870
  4. package/dist/node/index.d.ts +3059 -2
  5. package/dist/node/index.js +163 -1
  6. package/dist/test-utils/index.d.ts +4413 -4439
  7. package/dist/test-utils/index.js +1766 -4753
  8. package/dist/types/worker/index.d.ts +5 -2
  9. package/dist/types/worker/platform.d.ts +2 -2
  10. package/dist/types/worker/utils.d.ts +9 -0
  11. package/dist/worker/index.js +427 -3708
  12. package/package.json +5 -4
  13. package/reference/_navigation.md +1 -0
  14. package/reference/claude-config/rules/active-change-index.md +11 -80
  15. package/reference/claude-config/rules/agent-start-here.md +11 -277
  16. package/reference/claude-config/rules/deployment.md +11 -57
  17. package/reference/claude-config/rules/error-handling.md +11 -56
  18. package/reference/claude-config/rules/execution.md +11 -40
  19. package/reference/claude-config/rules/frontend.md +11 -43
  20. package/reference/claude-config/rules/observability.md +11 -31
  21. package/reference/claude-config/rules/operations.md +11 -80
  22. package/reference/claude-config/rules/organization-model.md +5 -110
  23. package/reference/claude-config/rules/organization-os.md +7 -111
  24. package/reference/claude-config/rules/package-taxonomy.md +11 -33
  25. package/reference/claude-config/rules/platform.md +11 -42
  26. package/reference/claude-config/rules/shared-types.md +10 -48
  27. package/reference/claude-config/rules/task-tracking.md +11 -47
  28. package/reference/claude-config/rules/ui.md +11 -200
  29. package/reference/claude-config/rules/vibe.md +5 -229
  30. package/reference/claude-config/sync-notes/2026-05-04-knowledge-bundle.md +83 -83
  31. package/reference/claude-config/sync-notes/2026-05-15-om-skill-rename-and-write-family.md +2 -2
  32. package/reference/claude-config/sync-notes/2026-05-17-sdk-boundary-consolidation.md +33 -0
  33. package/reference/cli.mdx +1107 -808
  34. package/reference/rules/active-change-index.md +83 -0
  35. package/reference/rules/agent-start-here.md +280 -0
  36. package/reference/rules/deployment.md +60 -0
  37. package/reference/rules/error-handling.md +59 -0
  38. package/reference/rules/execution.md +43 -0
  39. package/reference/rules/frontend.md +46 -0
  40. package/reference/rules/observability.md +34 -0
  41. package/reference/rules/operations.md +85 -0
  42. package/reference/rules/organization-model.md +119 -0
  43. package/reference/rules/organization-os.md +118 -0
  44. package/reference/rules/package-taxonomy.md +36 -0
  45. package/reference/rules/platform.md +45 -0
  46. package/reference/rules/shared-types.md +52 -0
  47. package/reference/rules/task-tracking.md +50 -0
  48. package/reference/rules/ui.md +203 -0
  49. package/reference/rules/vibe.md +238 -0
  50. package/reference/scaffold/core/organization-graph.mdx +4 -5
  51. package/reference/scaffold/core/organization-model.mdx +1 -1
  52. package/reference/scaffold/recipes/customize-crm-actions.md +45 -46
  53. package/reference/scaffold/recipes/extend-crm.md +253 -255
  54. package/reference/scaffold/recipes/index.md +43 -44
  55. package/reference/scaffold/reference/contracts.md +990 -1065
@@ -0,0 +1,83 @@
1
+ ---
2
+ description: Bridge between stable scaffold docs and higher-volatility in-progress architecture work that may override assumptions for agents working in the template
3
+ ---
4
+ <!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
5
+ <!-- Regenerate: pnpm scaffold:sync -->
6
+
7
+
8
+ # Active Change Index
9
+
10
+ Use this rule to decide whether stable scaffold docs are enough, or whether you also need to load in-progress platform architecture docs from the monorepo.
11
+
12
+ > **Note:** Paths prefixed with `apps/` or `packages/` are monorepo-internal and unavailable in standalone projects. For those areas, use the stable scaffold docs under `node_modules/@elevasis/sdk/reference/scaffold/` as the primary reference. The monorepo paths are retained for contributors working within the monorepo.
13
+
14
+ ## Current Watch Areas
15
+
16
+ ### Organization OS
17
+
18
+ Use when the task touches:
19
+
20
+ - organization model semantics
21
+ - feature/provider runtime
22
+ - feature manifests or shell composition
23
+ - graph or command-view concepts
24
+ - downstream propagation of scaffold contract changes
25
+
26
+ Load:
27
+
28
+ - `apps/docs/content/docs/technical/architecture/core/organization-model/index.mdx`
29
+ - `apps/docs/content/docs/technical/architecture/core/organization-model/graph.mdx`
30
+ - `apps/docs/content/docs/technical/architecture/ui/feature-shell.mdx`
31
+ - `apps/docs/content/docs/technical/architecture/ui/composition-extensibility.mdx`
32
+
33
+ Stable scaffold docs affected:
34
+
35
+ - `node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md`
36
+ - `.claude/rules/ui.md`
37
+ - `node_modules/@elevasis/sdk/reference/scaffold/ui/customization.md`
38
+ - `node_modules/@elevasis/sdk/reference/scaffold/ui/feature-flags-and-gating.md`
39
+
40
+ ### Package Surface / Reference System
41
+
42
+ Use when the task touches:
43
+
44
+ - published `@elevasis/core`, `@elevasis/ui`, or `@elevasis/sdk` surfaces
45
+ - generated package maps
46
+ - contract drift between source and scaffold docs
47
+
48
+ Load:
49
+
50
+ - `packages/core/src/organization-model/README.md`
51
+ - `packages/ui/src/provider/README.md`
52
+ - `packages/ui/src/features/README.md`
53
+ - `packages/sdk/reference/_navigation.md`
54
+
55
+ Stable scaffold docs affected:
56
+
57
+ - `node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md`
58
+
59
+ ### Resource / Topology Mapping
60
+
61
+ Use when the task touches:
62
+
63
+ - resource registration
64
+ - triggers, integrations, relationships, human checkpoints
65
+ - topology-aware navigation or impact analysis
66
+
67
+ Load:
68
+
69
+ - `operations/src/README.md`
70
+ - `operations/src/index.ts`
71
+
72
+ Stable scaffold docs affected:
73
+
74
+ - `.claude/rules/operations.md`
75
+
76
+ ## Working Rule
77
+
78
+ When a task touches one of the watch areas above:
79
+
80
+ 1. Read the stable scaffold doc.
81
+ 2. Read the listed in-progress or package-local source-of-truth docs.
82
+ 3. Prefer source and in-progress architecture docs if they disagree with scaffold prose.
83
+ 4. Flag drift instead of silently trusting the scaffold doc.
@@ -0,0 +1,280 @@
1
+ ---
2
+ description: Canonical first-read for agents entering the template scaffold -- project continuity, task-class routing, and boundary resolution
3
+ ---
4
+ <!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
5
+ <!-- Regenerate: pnpm scaffold:sync -->
6
+
7
+
8
+ # Agent Start Here
9
+
10
+ Read this file first when entering a freshly scaffolded project.
11
+
12
+ ## Project Profile
13
+
14
+ Before doing anything else, check for `.claude/memory/profile.md`. It is created by `/tutorial` on first invocation and persists across sessions.
15
+
16
+ If present, read it. The file declares which onboarding **track** is active -- `vibe-coder` (non-technical user, agent does the work) or `technical` (developer, code-first) -- and ships a tone block describing how to communicate.
17
+
18
+ Apply the tone block to ALL agent output for the rest of the session, not just inside `/tutorial`:
19
+
20
+ - **vibe-coder track:** never use technical vocabulary in user-facing dialogue (workflow -> automation, deploy -> make it live, schema -> "the information your automation needs"). Tool calls are made silently -- do not narrate slash commands, file paths, or build steps. The full swap table lives in `profile.md`.
21
+ - **technical track:** code-first, current command surface, real file paths. The user reads diffs and stacktraces; do not over-explain.
22
+
23
+ If the file does not exist, the user has not run `/tutorial` yet. Proceed normally and note that running `/tutorial` would establish a project tone for future sessions.
24
+
25
+ ## First Action: Check Active Projects
26
+
27
+ Before loading any docs for a new session, check whether the user's ask resumes or relates to an in-flight client project. Project context (milestones, tasks, resume notes) is DB-canonical -- agents and CLI read/write it through the `elevasis-sdk project:*` surface.
28
+
29
+ 1. **Portfolio snapshot.** Run this first to see what is active or blocked:
30
+
31
+ ```bash
32
+ pnpm elevasis-sdk project:list --status active --pretty
33
+ pnpm elevasis-sdk project:list --status blocked --pretty
34
+ ```
35
+
36
+ 2. **Resume-style asks.** If the user says "continue", "pick up", references a client name, or names a task/milestone, resolve it via:
37
+
38
+ ```bash
39
+ pnpm elevasis-sdk project:work <query>
40
+ ```
41
+
42
+ `project:work` fuzzy-matches a project or task by name/ID and returns the current resume context -- the canonical continuity payload (current state, next steps, files modified, key docs).
43
+
44
+ 3. **Fresh non-project asks.** Only if the portfolio snapshot and the request show no overlap with active projects, fall back to the docs-index flow below. Even then, if the work will take more than a single file edit, offer to create a project first (`/project create` or `project:create`) so continuity is captured from the start.
45
+
46
+ ### Resume Context Source of Truth
47
+
48
+ `resume_context` lives in the `prj_tasks` table in the database, not in task-doc frontmatter. There is one source of truth:
49
+
50
+ - **Humans write** via the inline resume-context editor on the Project Detail page in Command Center.
51
+ - **Agents and the CLI write** via `pnpm elevasis-sdk project:task:save <task-id> --current-state ... --next-steps ... --files-modified ...`.
52
+ - **Readers** consume it via `project:work <query>` or `project:task:resume <id>`.
53
+
54
+ Do not write resume state into markdown frontmatter. Task-doc frontmatter is limited to `title`, `description`, and `status`.
55
+
56
+ ### Session-Start Dashboard
57
+
58
+ The session-start dashboard directive lives in `CLAUDE.md`. If you see it there, follow it on the first response of a session. This file (`agent-start-here` rule) is the drill-down reference layer; `CLAUDE.md` owns session bootstrap.
59
+
60
+ ## Template Surfaces
61
+
62
+ Once project continuity is resolved (or confirmed irrelevant), the template is not just an app starter. It is an agent operating environment with several distinct surfaces:
63
+
64
+ - `ui/` -- React frontend app and shell composition
65
+ - `operations/` -- Elevasis SDK resources deployed to the platform
66
+ - `core/` -- runtime-agnostic shared contracts and organization model adaptation
67
+ - `.claude/` -- local agent rules, skills, and hooks
68
+ - `client-workspace/` -- optional separate knowledge workspace for richer team knowledge management
69
+ - `node_modules/@elevasis/sdk/reference/scaffold/` -- SDK reference scaffold: canonical recipes, UI patterns, gating model, contracts, and glossary. Entry point: `index.mdx`.
70
+
71
+ ## Discovery Order
72
+
73
+ Use this order unless a more specific doc tells you otherwise:
74
+
75
+ 1. Complete the "First Action: Check Active Projects" flow above.
76
+ 2. Read `CLAUDE.md` for project rules, command surface, and navigation pointers.
77
+ 3. Read this rule and classify the task using the Task Classes below.
78
+ 4. Read `identity.clientBrief` from the OrganizationModel (`core/config/organization-model.ts`) for organization context and naming.
79
+ 5. Read the relevant structural map:
80
+ - Glob `node_modules/@elevasis/sdk/reference/` for published package surfaces
81
+ - Read `operations/src/index.ts` for deployment assembly, `core/config/organization-model.ts` for resource descriptors, or run `pnpm elevasis-sdk project:list --pretty` for live DB state
82
+ 6. For feature integration, resource authoring, or UI customization tasks, read `node_modules/@elevasis/sdk/reference/scaffold/index.mdx` to find the canonical recipe or reference doc.
83
+ 7. Drill into the co-located local explainer for the abstraction boundary you are changing.
84
+ 8. Check the `.claude/rules/active-change-index.md` rule before trusting stable assumptions in areas that are under active architecture work.
85
+
86
+ ## SDK Reference Scaffold
87
+
88
+ Universal scaffold documentation (recipes, patterns, architecture, reference) has been centralized in the SDK reference. After `pnpm install`, the entry point is:
89
+
90
+ `node_modules/@elevasis/sdk/reference/scaffold/index.mdx`
91
+
92
+ This index links to all scaffold docs including pathway recipes, UI patterns, core architecture, and auto-generated contracts/feature registry.
93
+
94
+ For task classes that involve feature integration, resource authoring, or UI customization, start with the scaffold index rather than local docs.
95
+
96
+ ## Task Classes
97
+
98
+ Classify the request, then follow the load/inspect/verify sequence for that class.
99
+
100
+ ### 1. UI / Shell Work
101
+
102
+ Examples: add a page, change sidebar behavior, adjust feature visibility, update dashboard labels.
103
+
104
+ Load first:
105
+
106
+ - `node_modules/@elevasis/sdk/reference/scaffold/index.mdx` (scaffold index -- UI recipes, feature flags, customization)
107
+ - `.claude/rules/ui.md`
108
+ - `ui/src/routes/README.md`
109
+ - `core/config/README.md`
110
+ - `node_modules/@elevasis/sdk/reference/scaffold/ui/recipes.md` -- specifically recipe 6 when building a "run this resource" surface
111
+ - `node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-crm.md` -- when building or extending CRM pages, sidebars, hooks, workflows, or deal data surfaces
112
+ - `node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-lead-gen.md` -- when building or extending lead-gen pages, sidebars, hooks, workflows, list/member state, or artifacts
113
+ - `node_modules/@elevasis/sdk/reference/scaffold/recipes/customize-crm-actions.md` -- when changing CRM deal action buttons or adding a workflow-backed deal action
114
+
115
+ Then inspect:
116
+
117
+ - `ui/src/routes/__root.tsx`
118
+ - `ui/src/config/*`
119
+ - relevant `ui/src/routes/*`
120
+ - relevant `ui/src/features/*`
121
+ - `core/config/organization-model.ts`
122
+
123
+ Verify with:
124
+
125
+ - route and manifest source
126
+ - any relevant package README from `packages/ui`
127
+
128
+ ### 2. Workflow / Agent / Operations Work
129
+
130
+ Examples: add a workflow, update an agent, change resource registration, understand deployable resources.
131
+
132
+ Load first:
133
+
134
+ - `node_modules/@elevasis/sdk/reference/scaffold/index.mdx` (scaffold index -- workflow recipes, resource authoring)
135
+ - `.claude/rules/operations.md`
136
+ - `operations/src/README.md`
137
+
138
+ Then inspect:
139
+
140
+ - `operations/src/index.ts`
141
+ - relevant `operations/src/<feature>/*`
142
+ - `core/types/index.ts` -- workflow input/output Zod schemas
143
+ - `core/types/entities.ts` -- typed entity contracts (Project, Deal, etc.) extending `@elevasis/core/entities` base types. Read this when authoring a workflow that takes or returns these entities so the input/output schemas reference the canonical entity shapes rather than redeclaring them.
144
+ - `operations/elevasis.config.ts`
145
+
146
+ Verify with:
147
+
148
+ - Read `operations/src/index.ts` for deployment assembly, `core/config/organization-model.ts` for resource descriptors, or run `pnpm elevasis-sdk project:list --pretty` for live DB state
149
+ - local SDK guidance in `.claude/skills/elevasis/SKILL.md`
150
+
151
+ ### 3. Organization Model / Feature Access Work
152
+
153
+ Examples: rename a feature area, change quick access surfaces, map new business terms into the shell, adjust feature gating.
154
+
155
+ Load first:
156
+
157
+ - `node_modules/@elevasis/sdk/reference/scaffold/index.mdx` (scaffold index -- contracts, gating patterns, glossary)
158
+ - `core/config/README.md`
159
+ - `node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md`
160
+ - typed feature/surface constants from `@elevasis/core/organization-model` -- `CRM_FEATURE_ID`, `LEAD_GEN_FEATURE_ID`, `PROJECTS_FEATURE_ID`, `OPERATIONS_FEATURE_ID`, `MONITORING_FEATURE_ID`, `SETTINGS_FEATURE_ID`, `SEO_FEATURE_ID`, `CRM_PIPELINE_SURFACE_ID`, `LEAD_GEN_LISTS_SURFACE_ID`, `PROJECTS_INDEX_SURFACE_ID`, `OPERATIONS_ORGANIZATION_GRAPH_SURFACE_ID`. Use these typed constants instead of magic strings when overriding feature/surface IDs.
161
+ - `node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-crm.md` -- CRM is an Organization OS + UI + hooks + workflow-adapter surface; read this before extending CRM structure.
162
+ - `node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-lead-gen.md` -- lead gen is an Organization OS + UI + hooks + workflow-adapter surface; read this before extending lead-gen lists, members, artifacts, or state transitions.
163
+ - `node_modules/@elevasis/sdk/reference/scaffold/recipes/customize-crm-actions.md` -- CRM action buttons are not `sales.actions` org-model config in v1; use the recipe's provider/custom-button path.
164
+ - `node_modules/@elevasis/sdk/reference/scaffold/ui/feature-flags-and-gating.md`
165
+
166
+ Then inspect:
167
+
168
+ - `core/config/organization-model.ts`
169
+ - `core/config/organization-model.ts` -- Organization Model overrides plus Systems and Resources descriptors. Start here for feature labels, surface mapping, and resource identity/governance changes.
170
+ - `ui/src/routes/__root.tsx`
171
+ - `ui/src/lib/hooks/useFeatureAccess.ts`
172
+ - relevant nav config files
173
+
174
+ Verify with:
175
+
176
+ - published package docs for `@elevasis/core/organization-model`
177
+ - current scaffold routes and manifests
178
+
179
+ ### 4. Debugging / Impact Analysis
180
+
181
+ Examples: why is this automation disconnected, what does this workflow affect, what should I inspect before changing this resource.
182
+
183
+ Load first:
184
+
185
+ - `operations/src/README.md`
186
+ - `.claude/rules/active-change-index.md`
187
+ - Read `operations/src/index.ts` for deployment assembly, `core/config/organization-model.ts` for resource descriptors, or run `pnpm elevasis-sdk project:list --pretty` for live DB state
188
+ - For "why didn't this run?", "why is this still pending?", "what needs approval?", or schedule/queue debugging, inspect live operations state with `pnpm elevasis-sdk schedule:list --pretty`, `pnpm elevasis-sdk queue:list --status pending --pretty`, and `pnpm elevasis-sdk queue:status --pretty`.
189
+
190
+ Then inspect:
191
+
192
+ - `operations/src/index.ts`
193
+ - resource definitions
194
+ - related UI route and feature files
195
+ - related core contracts
196
+ - pending HITL items via `elevasis-sdk queue:get <id>` before selecting or expiring an action
197
+ - recurring automation via `elevasis-sdk schedule:get <id>` before pausing, resuming, or cancelling it
198
+
199
+ Verify with:
200
+
201
+ - resource registration and relationship declarations
202
+ - generated maps
203
+ - package and source ownership boundaries
204
+ - `queue:*` or `schedule:*` CLI output when runtime state is part of the question
205
+
206
+ ### 5. Platform Extension / Package Contract Work
207
+
208
+ Examples: extend a published package contract, understand how a scaffold surface maps to `@elevasis/ui`, update a package-facing reference doc.
209
+
210
+ Load first:
211
+
212
+ - `.claude/rules/active-change-index.md`
213
+ - Glob `node_modules/@elevasis/sdk/reference/` for the current SDK package surface
214
+ - package README found via that glob
215
+
216
+ Then inspect:
217
+
218
+ - package source entrypoints
219
+ - package reference manifests
220
+ - scaffold files that consume that contract
221
+
222
+ Verify with:
223
+
224
+ - published package docs
225
+ - source exports
226
+ - scaffold consumption points
227
+
228
+ ## Boundary Resolution
229
+
230
+ Once the request is classified, determine which boundary owns the change:
231
+
232
+ - **Core boundary** -- semantics, aliases, labels, shared schemas
233
+ - **UI shell boundary** -- provider composition, manifests, navigation, route ownership
234
+ - **Operations boundary** -- deployable resource registration, workflow/agent contracts, topology
235
+ - **Package boundary** -- public exports, shared platform behavior, reusable contracts
236
+
237
+ If a task spans boundaries, start at the semantic boundary, then move to runtime composition, then to registration/deployment.
238
+
239
+ ## Main Boundaries
240
+
241
+ ### `core/config/organization-model.ts`
242
+
243
+ The semantic adaptation point between platform contracts and scaffold-local terminology. Start here for feature labels, legacy aliases, quick-access surfaces, and shell-facing organization semantics.
244
+
245
+ ### `ui/src/routes/__root.tsx`
246
+
247
+ The shell composition point. Start here for manifest mounting, provider wiring, app-local nav, and how the scaffold combines published feature surfaces with project-owned shell concerns.
248
+
249
+ ### `operations/src/index.ts`
250
+
251
+ The deployment aggregation point. Start here for what resources are registered and deployed as part of the scaffold.
252
+
253
+ ## Source of Truth
254
+
255
+ Trust these in order:
256
+
257
+ 1. Source code and published package docs
258
+ 2. Co-located boundary docs
259
+ 3. Generated structural maps
260
+ 4. Hand-authored template guidance
261
+ 5. In-progress architecture docs when `.claude/rules/active-change-index.md` says the area is actively evolving
262
+
263
+ If a hand-authored doc conflicts with source or published package docs, trust source and flag the doc drift.
264
+
265
+ ## Common Traps
266
+
267
+ - Do not assume feature directories are exhaustive without also checking `operations/src/index.ts` and `core/config/organization-model.ts` directly.
268
+ - Do not assume placeholder knowledge is sufficient for real client context. Read `identity.clientBrief` from the OrganizationModel (`core/config/organization-model.ts`).
269
+ - Do not trust stable docs blindly when `.claude/rules/active-change-index.md` flags related in-progress architecture work.
270
+ - Do not write `resume_context` into task-doc frontmatter. DB is canonical; write via `project:task:save` or the inline editor in Command Center.
271
+
272
+ ## Operations-Only Projects
273
+
274
+ Some projects derived from this template are operations-only. They have `operations/` (or a top-level `src/`) but NO `ui/`, NO `core/config/organization-model.ts`, and NO frontend. Finding none of these is not missing scaffolding -- it is by design.
275
+
276
+ **What applies:** Only Task Classes 2 (Workflow / Agent / Operations Work) and 4 (Debugging / Impact Analysis) apply to operations-only projects. Task Classes 1 (UI / Shell Work), 3 (Organization Model / Feature Access Work), and 5 (Platform Extension / Package Contract Work) do not apply and can be skipped.
277
+
278
+ **Primary entrypoint:** For operations-only projects, the project's own `CLAUDE.md` and its Navigation table are the canonical first-read. This rule provides task-routing context but its full surface map is irrelevant for that project type.
279
+
280
+ **Signal:** The `CLAUDE.md` of an operations-only project includes `Project type: operations-only` in its `## Project` section. When you see this signal, skip all template surfaces that don't exist and go directly to the operations task class.
@@ -0,0 +1,60 @@
1
+ ---
2
+ description: Deployment workflow -- check-first, dev vs prod, version bumping, common errors
3
+ paths:
4
+ - operations/**
5
+ ---
6
+ <!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
7
+ <!-- Regenerate: pnpm scaffold:sync -->
8
+
9
+
10
+ # Deployment
11
+
12
+ ## Always Check Before Deploy
13
+
14
+ ```bash
15
+ pnpm -C operations run check # Validate resource definitions
16
+ pnpm -C operations run check-types # TypeScript type-check
17
+ pnpm -C operations run deploy # Deploy to dev (only after both pass)
18
+ ```
19
+
20
+ `check` catches duplicate resource IDs, OM descriptor/code mismatches, invalid step chains, broken relationships, and schema serialization issues. Same validation runs during deploy -- if `check` passes, deploy validation will pass.
21
+
22
+ ## Dev vs Prod
23
+
24
+ | Command | Target | When |
25
+ | ------------------------------------ | ----------------- | ----------------------- |
26
+ | `pnpm -C operations run deploy` | Local dev API | Development and testing |
27
+ | `pnpm -C operations run deploy:prod` | `api.elevasis.io` | Production release |
28
+
29
+ Always test in dev first, verify with `elevasis-sdk exec`, then deploy to prod.
30
+
31
+ ## Version Bumping
32
+
33
+ Deploy accepts `--major`, `--minor`, `--patch` flags to bump the deployment version. The bumped version is written back to `src/index.ts`. Bump on contract changes (input/output schema modifications).
34
+
35
+ ## What Gets Deployed
36
+
37
+ 1. **Bundle:** esbuild compiles `src/index.ts` + all dependencies into a single self-contained CJS file. No `node_modules` needed at runtime.
38
+ 2. **Metadata:** Resource definitions, OM Resources descriptor bindings, Zod schemas (converted to JSON Schema), relationships, triggers.
39
+
40
+ ## Environment
41
+
42
+ - `ELEVASIS_PLATFORM_KEY` in `.env` is required for CLI auth
43
+ - `.env` is never included in the bundle -- it stays local
44
+ - Integration credentials live in Command Center, not `.env`
45
+
46
+ ## Common Errors
47
+
48
+ | Error | Fix |
49
+ | ---------------------------------------- | --------------------------------------------------------------------------------------------------- |
50
+ | `401: Invalid API key` | Check `ELEVASIS_PLATFORM_KEY` in `.env` |
51
+ | `Duplicate resource ID` | Fix the duplicated OM Resource descriptor ID, then derive runtime `resourceId` from that descriptor |
52
+ | `Missing OM Resource descriptor` | Add the descriptor to `core/config/organization-model.ts` under the id-keyed `resources` map |
53
+ | `Step references non-existent next step` | Fix the `next:` field in the step chain |
54
+ | `Schema serialization failed` | Simplify the Zod schema (warning, still deploys) |
55
+ | `No default export found` | `src/index.ts` must `export default` a `DeploymentSpec` |
56
+ | `Documentation file exceeds 100KB` | Split the `.md` file |
57
+
58
+ ## Deployment Replaces Previous
59
+
60
+ Only one deployment can be `active` at a time. Deploying again automatically marks the previous deployment as `stopped`. Resources become executable immediately after deploy succeeds.
@@ -0,0 +1,59 @@
1
+ ---
2
+ description: Error handling -- ExecutionError vs PlatformToolError, retry logic, no auto-retry
3
+ paths:
4
+ - operations/**
5
+ ---
6
+ <!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
7
+ <!-- Regenerate: pnpm scaffold:sync -->
8
+
9
+
10
+ # Error Handling
11
+
12
+ ## Error Types
13
+
14
+ Two error classes from `@elevasis/sdk`:
15
+
16
+ **`ExecutionError`** -- base class for workflow/step failures.
17
+
18
+ ```typescript
19
+ import { ExecutionError } from '@elevasis/sdk'
20
+
21
+ throw new ExecutionError('Payment processing failed', {
22
+ context: { invoiceId: '123', amount: 500 }
23
+ })
24
+ ```
25
+
26
+ **`PlatformToolError`** -- thrown by `platform.call()` and typed adapters.
27
+
28
+ ```typescript
29
+ import { PlatformToolError } from '@elevasis/sdk'
30
+
31
+ try {
32
+ await attio.createRecord({ ... })
33
+ } catch (err) {
34
+ if (err instanceof PlatformToolError && err.retryable) {
35
+ // Transient error (rate limit, timeout, network) -- safe to retry
36
+ } else {
37
+ // Permanent error (invalid credentials, bad input) -- don't retry
38
+ }
39
+ }
40
+ ```
41
+
42
+ ## No Auto-Retry
43
+
44
+ The platform does NOT automatically retry failed steps. Your handler is responsible for retry logic. Check `PlatformToolError.retryable` to decide whether retrying is safe.
45
+
46
+ ## Error Visibility
47
+
48
+ - Unhandled exceptions in handlers surface directly to CLI output and AI Studio.
49
+ - Use `context.logger.error()` to log errors -- `console.error()` is NOT captured by the platform.
50
+ - Write clear, descriptive error messages -- they're the primary debugging signal for end users.
51
+
52
+ ## Common PlatformToolError Codes
53
+
54
+ | Code | Retryable | Cause |
55
+ | --------------------- | --------- | --------------------------------- |
56
+ | `rate_limit_exceeded` | Yes | Integration API rate limit hit |
57
+ | `timeout_error` | Yes | Integration call timed out |
58
+ | `credentials_invalid` | No | Credential not found or expired |
59
+ | `validation_error` | No | Invalid parameters passed to tool |
@@ -0,0 +1,43 @@
1
+ ---
2
+ description: Execution model -- timeouts, memory, concurrency, org isolation, runtime constraints
3
+ paths:
4
+ - operations/**
5
+ ---
6
+ <!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
7
+ <!-- Regenerate: pnpm scaffold:sync -->
8
+
9
+
10
+ # Execution Model
11
+
12
+ ## Runtime Environment
13
+
14
+ Each execution runs in an isolated Node.js worker thread spawned from the deployed bundle. Workers are ephemeral -- created on execution start, terminated on completion. No state persists between executions.
15
+
16
+ ## Constraints
17
+
18
+ | Constraint | Workflows | Agents |
19
+ | ---------- | ------------------------------- | ----------------------------------------------------- |
20
+ | Timeout | 300s (5 min) | 600s (10 min, configurable via `constraints.timeout`) |
21
+ | Memory | 256MB hard limit | 256MB hard limit |
22
+ | Disk | None (no persistent filesystem) | None |
23
+
24
+ - Platform enforces timeouts -- no handler code needed, worker terminates automatically.
25
+ - Memory overflow crashes the worker. Other tenants are unaffected.
26
+ - For long-running tasks, break work into multiple steps or use agents with extended timeout.
27
+
28
+ ## Concurrency
29
+
30
+ Concurrent executions for the same organization run in completely separate workers with zero shared state. No locking, no race conditions between executions.
31
+
32
+ ## Organization Isolation
33
+
34
+ - `organizationId` is injected server-side from the JWT context -- workers never see it.
35
+ - Storage paths are automatically org-prefixed.
36
+ - Resource IDs are scoped per organization (not global).
37
+ - External developers cannot access other organizations' data by construction.
38
+
39
+ No developer action needed for multi-tenancy -- the platform handles it.
40
+
41
+ ## Cancellation
42
+
43
+ The platform can cancel in-flight executions. The worker terminates immediately with no cleanup handler.
@@ -0,0 +1,46 @@
1
+ ---
2
+ description: Frontend conventions -- React, routing, state, styling, testing, pages
3
+ paths:
4
+ - ui/src/**
5
+ ---
6
+ <!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
7
+ <!-- Regenerate: pnpm scaffold:sync -->
8
+
9
+
10
+ # Frontend
11
+
12
+ ## Safety Invariants
13
+
14
+ - `ElevasisUIProvider` in `ui/src/main.tsx` auto-composes shared UI, auth, and API surface -- route files do not wire providers manually
15
+ - `useApiClient()` from `@/lib/hooks/useApiClient` for authenticated API calls -- never raw `fetch` with auth headers
16
+ - `routeTree.gen.ts` is auto-generated on `pnpm dev` -- never edit manually
17
+ - Auth protection: wrap page content with `ProtectedRoute` from `@elevasis/ui/auth`. Admin pages nest `AdminGuard` inside `ProtectedRoute`
18
+ - Never fork `@elevasis/ui` components -- if a published component needs a tweak, that missing capability is a bug in `@elevasis/ui`
19
+
20
+ ## Silent-Break Gotchas
21
+
22
+ - Route files vs layout files: `operations.tsx` is a layout (renders `<Outlet />`), `operations/my-page.index.tsx` is a page. Confusing the two breaks routing silently
23
+ - `core/` cannot import React or `@elevasis/sdk/worker` -- it is runtime-agnostic shared types and organization configuration only
24
+ - `@/*` resolves to `ui/src/*`, `@core/*` resolves to `core/*` -- never import from `operations/` (separate runtime)
25
+
26
+ ## Stack Constraints
27
+
28
+ - Mantine 8.2.7 for all UI components -- no Radix UI, no Tailwind CSS, no shadcn
29
+ - `@tabler/icons-react` for icons -- never Lucide
30
+ - Server state: TanStack Query. Client state: Zustand + Immer. Never mix the two
31
+ - Glass background is the primary surface treatment: `var(--glass-background)` with `backdrop-filter: var(--glass-blur)`
32
+ - Import shared components from `@elevasis/ui/components`, `@elevasis/ui/layout`, `@elevasis/ui/charts`
33
+ - Import charts from `@elevasis/ui/charts`, not directly from `@mantine/charts`
34
+
35
+ ## Integration UI Surfaces
36
+
37
+ When building pages that display external data, use published `@elevasis/ui` components before building custom UI. Use Mantine components and CSS variables exclusively -- no inline hex colors, no custom design tokens. Match existing page density and spacing.
38
+
39
+ ## Detailed Reference
40
+
41
+ - `node_modules/@elevasis/sdk/reference/scaffold/ui/recipes.md` -- add a page, add a nav item, theme tokens, feature-scoped components, route patterns (static, nested, dynamic)
42
+ - `node_modules/@elevasis/sdk/reference/scaffold/ui/feature-flags-and-gating.md` -- `systemKey` / `SystemGuard` / `AdminGuard` model
43
+ - `node_modules/@elevasis/sdk/reference/scaffold/ui/customization.md` -- sidebar composition via manifest overrides
44
+ - `node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md` -- TypeScript shapes (`SystemModule`, `NavItem`, `OrganizationModel`)
45
+ - `ui/src/config/theme.ts` -- theme configuration and CSS variable definitions
46
+ - `ui/src/config/nav-items.ts` -- sidebar navigation entries
@@ -0,0 +1,34 @@
1
+ ---
2
+ description: Observability -- context.logger API, execution inspection, step-level context
3
+ paths:
4
+ - operations/**
5
+ ---
6
+ <!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
7
+ <!-- Regenerate: pnpm scaffold:sync -->
8
+
9
+
10
+ # Observability
11
+
12
+ ## Safety Invariants
13
+
14
+ - Use `context.logger` for all logging in step handlers -- `console.*` is NOT captured by the platform
15
+ - Log levels: `debug` (verbose), `info` (normal progress), `warn` (non-fatal, processing continues), `error` (fatal, processing stops)
16
+ - Step lifecycle events (started, completed, failed, route taken) are auto-logged by the SDK worker -- no handler code needed
17
+
18
+ ## Key Rules
19
+
20
+ - Every handler should log at: entry (step name + key params), decisions (skips, branches), progress (per-item in loops), summary (counts at end)
21
+ - Error messages in handlers surface as the execution's error message -- write for humans, not machines
22
+ - String values truncated at 200 characters in logs
23
+ - 30-day log retention (includes logs from deleted resources)
24
+
25
+ ## Inspecting Executions
26
+
27
+ ```bash
28
+ pnpm elevasis-sdk execution <resourceId> <executionId>
29
+ pnpm elevasis-sdk executions <resourceId>
30
+ ```
31
+
32
+ ## Detailed Reference
33
+
34
+ - `node_modules/@elevasis/sdk/reference/scaffold/operations/workflow-recipes.md` -- full logging patterns and handler examples