@elevasis/sdk 1.44.2 → 1.45.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 (245) hide show
  1. package/dist/cli.cjs +1001 -652
  2. package/dist/index.d.ts +1045 -509
  3. package/dist/index.js +748 -690
  4. package/dist/node/index.d.ts +105 -97
  5. package/dist/test-utils/index.d.ts +42 -28
  6. package/dist/test-utils/index.js +549 -732
  7. package/dist/worker/index.d.ts +12112 -0
  8. package/dist/worker/index.js +211 -186
  9. package/package.json +6 -9
  10. package/reference/_navigation.md +151 -21
  11. package/reference/_reference-manifest.json +186 -4
  12. package/reference/claude-config.md +8 -0
  13. package/reference/core/index.mdx +3 -3
  14. package/reference/examples/organization-model.ts +117 -111
  15. package/reference/index.mdx +4 -4
  16. package/reference/rules/active-change-index.md +40 -54
  17. package/reference/rules/agent-runtime.md +81 -0
  18. package/reference/rules/agent-start-here.md +71 -163
  19. package/reference/rules/deployment.md +33 -10
  20. package/reference/rules/error-handling.md +26 -0
  21. package/reference/rules/execution.md +13 -0
  22. package/reference/rules/frontend.md +10 -3
  23. package/reference/rules/observability.md +9 -1
  24. package/reference/rules/operations.md +26 -17
  25. package/reference/rules/organization-model.md +74 -88
  26. package/reference/rules/organization-os.md +71 -88
  27. package/reference/rules/package-taxonomy.md +11 -2
  28. package/reference/rules/platform.md +13 -7
  29. package/reference/rules/shared-types.md +15 -0
  30. package/reference/rules/task-tracking.md +30 -5
  31. package/reference/rules/ui.md +145 -3
  32. package/reference/rules/vibe-intents.md +271 -0
  33. package/reference/rules/vibe.md +17 -243
  34. package/reference/scaffold/core/organization-graph.mdx +111 -97
  35. package/reference/scaffold/core/organization-model.mdx +234 -214
  36. package/reference/scaffold/operations/propagation-pipeline.md +1 -1
  37. package/reference/scaffold/operations/scaffold-maintenance.md +19 -18
  38. package/reference/scaffold/operations/workflow-recipes.md +71 -19
  39. package/reference/scaffold/recipes/add-a-feature.md +156 -146
  40. package/reference/scaffold/recipes/add-a-resource.md +123 -117
  41. package/reference/scaffold/recipes/customize-crm-actions.md +25 -10
  42. package/reference/scaffold/recipes/customize-knowledge-browser.md +52 -117
  43. package/reference/scaffold/recipes/customize-organization-model.md +161 -149
  44. package/reference/scaffold/recipes/extend-a-base-entity.md +156 -140
  45. package/reference/scaffold/recipes/extend-crm.md +16 -11
  46. package/reference/scaffold/recipes/extend-lead-gen.md +25 -7
  47. package/reference/scaffold/recipes/gate-by-feature-or-admin.md +160 -118
  48. package/reference/scaffold/recipes/index.md +2 -2
  49. package/reference/scaffold/recipes/query-the-knowledge-graph.md +23 -23
  50. package/reference/scaffold/reference/contracts.md +12 -1
  51. package/reference/scaffold/reference/glossary.md +3 -3
  52. package/reference/scaffold/reference/system-interface-capabilities.md +5 -4
  53. package/reference/scaffold/ui/composition-extensibility.mdx +271 -232
  54. package/reference/scaffold/ui/feature-flags-and-gating.md +14 -6
  55. package/reference/scaffold/ui/feature-shell.mdx +279 -62
  56. package/reference/scaffold/ui/recipes.md +229 -197
  57. package/reference/sdk/cli-management.mdx +77 -29
  58. package/reference/sdk/concepts.mdx +2 -0
  59. package/reference/sdk/define-builders.mdx +76 -0
  60. package/reference/sdk/deployment/command-center.mdx +6 -2
  61. package/reference/sdk/deployment/execution-reference.mdx +64 -186
  62. package/reference/sdk/deployment/index.mdx +2 -0
  63. package/reference/sdk/exports.mdx +4 -4
  64. package/reference/sdk/framework/agent.mdx +49 -119
  65. package/reference/sdk/framework/index.mdx +46 -65
  66. package/reference/sdk/framework/project-structure.mdx +150 -205
  67. package/reference/sdk/framework/tutorial-system.mdx +2 -2
  68. package/reference/sdk/human-in-the-loop.mdx +152 -0
  69. package/reference/sdk/index.mdx +6 -7
  70. package/reference/sdk/platform-tools/index.mdx +12 -0
  71. package/reference/sdk/platform-tools/type-safety.mdx +4 -0
  72. package/reference/sdk/project-deployment-spec.mdx +131 -0
  73. package/reference/sdk/resources/index.mdx +23 -7
  74. package/reference/sdk/resources/patterns.mdx +54 -24
  75. package/reference/sdk/resources/types.mdx +7 -4
  76. package/reference/sdk/templates/data-enrichment.mdx +7 -3
  77. package/reference/sdk/templates/email-sender.mdx +139 -135
  78. package/reference/sdk/templates/lead-scorer.mdx +5 -1
  79. package/reference/sdk/templates/pdf-generator.mdx +155 -151
  80. package/reference/sdk/templates/recurring-job.mdx +195 -189
  81. package/reference/sdk/templates/text-classifier.mdx +4 -0
  82. package/reference/sdk/templates/web-scraper.mdx +139 -135
  83. package/reference/spine/spine-primer.md +135 -96
  84. package/reference/ui/index.mdx +14 -7
  85. package/dist/types/worker/adapters/anymailfinder.d.ts +0 -14
  86. package/dist/types/worker/adapters/apify.d.ts +0 -14
  87. package/dist/types/worker/adapters/approval.d.ts +0 -23
  88. package/dist/types/worker/adapters/attio.d.ts +0 -22
  89. package/dist/types/worker/adapters/clickup.d.ts +0 -22
  90. package/dist/types/worker/adapters/create-adapter.d.ts +0 -41
  91. package/dist/types/worker/adapters/crm.d.ts +0 -20
  92. package/dist/types/worker/adapters/dropbox.d.ts +0 -14
  93. package/dist/types/worker/adapters/email.d.ts +0 -25
  94. package/dist/types/worker/adapters/execution.d.ts +0 -22
  95. package/dist/types/worker/adapters/gmail.d.ts +0 -14
  96. package/dist/types/worker/adapters/google-sheets.d.ts +0 -14
  97. package/dist/types/worker/adapters/index.d.ts +0 -33
  98. package/dist/types/worker/adapters/instantly.d.ts +0 -14
  99. package/dist/types/worker/adapters/lead.d.ts +0 -28
  100. package/dist/types/worker/adapters/list.d.ts +0 -9
  101. package/dist/types/worker/adapters/llm.d.ts +0 -45
  102. package/dist/types/worker/adapters/millionverifier.d.ts +0 -14
  103. package/dist/types/worker/adapters/notification.d.ts +0 -28
  104. package/dist/types/worker/adapters/pdf.d.ts +0 -22
  105. package/dist/types/worker/adapters/projects.d.ts +0 -20
  106. package/dist/types/worker/adapters/resend.d.ts +0 -14
  107. package/dist/types/worker/adapters/scheduler.d.ts +0 -25
  108. package/dist/types/worker/adapters/signature-api.d.ts +0 -14
  109. package/dist/types/worker/adapters/storage.d.ts +0 -33
  110. package/dist/types/worker/adapters/stripe.d.ts +0 -14
  111. package/dist/types/worker/adapters/tomba.d.ts +0 -14
  112. package/dist/types/worker/index.d.ts +0 -60
  113. package/dist/types/worker/platform.d.ts +0 -90
  114. package/dist/types/worker/utils.d.ts +0 -9
  115. package/reference/claude-config/Overview.md +0 -230
  116. package/reference/claude-config/hooks/post-edit-validate.mjs +0 -98
  117. package/reference/claude-config/hooks/scaffold-registry-reminder.mjs +0 -187
  118. package/reference/claude-config/hooks/tool-failure-recovery.mjs +0 -73
  119. package/reference/claude-config/registries/graph-skills.json +0 -4
  120. package/reference/claude-config/registries/knowledge-flags.json +0 -154
  121. package/reference/claude-config/registries/skill-coverage.json +0 -20
  122. package/reference/claude-config/rules/active-change-index.md +0 -22
  123. package/reference/claude-config/rules/agent-start-here.md +0 -22
  124. package/reference/claude-config/rules/deployment.md +0 -22
  125. package/reference/claude-config/rules/error-handling.md +0 -22
  126. package/reference/claude-config/rules/execution.md +0 -22
  127. package/reference/claude-config/rules/frontend.md +0 -22
  128. package/reference/claude-config/rules/observability.md +0 -22
  129. package/reference/claude-config/rules/operations.md +0 -22
  130. package/reference/claude-config/rules/organization-model.md +0 -22
  131. package/reference/claude-config/rules/organization-os.md +0 -22
  132. package/reference/claude-config/rules/package-taxonomy.md +0 -22
  133. package/reference/claude-config/rules/platform.md +0 -22
  134. package/reference/claude-config/rules/shared-types.md +0 -22
  135. package/reference/claude-config/rules/task-tracking.md +0 -22
  136. package/reference/claude-config/rules/topbar-actions.md +0 -70
  137. package/reference/claude-config/rules/ui.md +0 -22
  138. package/reference/claude-config/rules/vibe.md +0 -22
  139. package/reference/claude-config/scripts/statusline-command.js +0 -18
  140. package/reference/claude-config/settings.json +0 -30
  141. package/reference/claude-config/skills/client/SKILL.md +0 -201
  142. package/reference/claude-config/skills/deploy/SKILL.md +0 -159
  143. package/reference/claude-config/skills/dsp/SKILL.md +0 -66
  144. package/reference/claude-config/skills/elevasis/SKILL.md +0 -251
  145. package/reference/claude-config/skills/explore/SKILL.md +0 -78
  146. package/reference/claude-config/skills/git-sync/SKILL.md +0 -166
  147. package/reference/claude-config/skills/om/SKILL.md +0 -475
  148. package/reference/claude-config/skills/om/operations/build.md +0 -237
  149. package/reference/claude-config/skills/om/operations/codify-level-a.md +0 -109
  150. package/reference/claude-config/skills/om/operations/codify-level-b.md +0 -159
  151. package/reference/claude-config/skills/om/operations/customers.md +0 -114
  152. package/reference/claude-config/skills/om/operations/features.md +0 -88
  153. package/reference/claude-config/skills/om/operations/goals.md +0 -123
  154. package/reference/claude-config/skills/om/operations/identity.md +0 -97
  155. package/reference/claude-config/skills/om/operations/labels.md +0 -110
  156. package/reference/claude-config/skills/om/operations/offerings.md +0 -114
  157. package/reference/claude-config/skills/om/operations/roles.md +0 -104
  158. package/reference/claude-config/skills/om/operations/scaffold.md +0 -163
  159. package/reference/claude-config/skills/om/operations/techStack.md +0 -38
  160. package/reference/claude-config/skills/project/SKILL.md +0 -1114
  161. package/reference/claude-config/skills/run-ui/SKILL.md +0 -73
  162. package/reference/claude-config/skills/save/SKILL.md +0 -183
  163. package/reference/claude-config/skills/setup/SKILL.md +0 -290
  164. package/reference/claude-config/skills/status/SKILL.md +0 -59
  165. package/reference/claude-config/skills/submit-request/SKILL.md +0 -180
  166. package/reference/claude-config/skills/sync/SKILL.md +0 -47
  167. package/reference/claude-config/skills/tutorial/SKILL.md +0 -259
  168. package/reference/claude-config/skills/tutorial/progress-template.md +0 -74
  169. package/reference/claude-config/skills/tutorial/technical.md +0 -1303
  170. package/reference/claude-config/skills/tutorial/vibe-coder.md +0 -890
  171. package/reference/claude-config/sync-notes/2026-04-22-git-sync-and-sync-notes.md +0 -27
  172. package/reference/claude-config/sync-notes/2026-04-22-lead-gen-deliverability-removal.md +0 -30
  173. package/reference/claude-config/sync-notes/2026-04-24-test-utils-and-template-tests.md +0 -73
  174. package/reference/claude-config/sync-notes/2026-04-24-ui-consolidation-and-sdk-cli-train.md +0 -86
  175. package/reference/claude-config/sync-notes/2026-04-25-auth-role-system-and-settings-roles.md +0 -55
  176. package/reference/claude-config/sync-notes/2026-04-27-crm-hitl-action-layer-cutover.md +0 -97
  177. package/reference/claude-config/sync-notes/2026-04-27-lead-gen-substrate-train.md +0 -112
  178. package/reference/claude-config/sync-notes/2026-04-29-crm-state-and-lead-gen-processing-status.md +0 -93
  179. package/reference/claude-config/sync-notes/2026-05-02-crm-ownership-next-action.md +0 -58
  180. package/reference/claude-config/sync-notes/2026-05-02-template-hardcode-workos-config.md +0 -56
  181. package/reference/claude-config/sync-notes/2026-05-04-elevasis-workspace.md +0 -71
  182. package/reference/claude-config/sync-notes/2026-05-04-knowledge-bundle.md +0 -83
  183. package/reference/claude-config/sync-notes/2026-05-04-template-skills-run-ui-and-tutorial.md +0 -59
  184. package/reference/claude-config/sync-notes/2026-05-05-list-builder.md +0 -42
  185. package/reference/claude-config/sync-notes/2026-05-06-crm-spine.md +0 -60
  186. package/reference/claude-config/sync-notes/2026-05-06-sdk-changes-release-train.md +0 -37
  187. package/reference/claude-config/sync-notes/2026-05-07-sdk-changes-release-train.md +0 -34
  188. package/reference/claude-config/sync-notes/2026-05-08-resource-governance-scaffold-guidance.md +0 -38
  189. package/reference/claude-config/sync-notes/2026-05-09-clients-domain.md +0 -32
  190. package/reference/claude-config/sync-notes/2026-05-09-command-system.md +0 -33
  191. package/reference/claude-config/sync-notes/2026-05-09-resource-governance-and-misc.md +0 -69
  192. package/reference/claude-config/sync-notes/2026-05-12-sdk-ready-release-train.md +0 -30
  193. package/reference/claude-config/sync-notes/2026-05-14-organization-model-ontology-refactor.md +0 -45
  194. package/reference/claude-config/sync-notes/2026-05-15-om-skill-rename-and-write-family.md +0 -52
  195. package/reference/claude-config/sync-notes/2026-05-17-sdk-boundary-consolidation.md +0 -33
  196. package/reference/claude-config/sync-notes/2026-05-20-om-define-helpers.md +0 -32
  197. package/reference/claude-config/sync-notes/2026-05-22-access-model-and-right-panel.md +0 -43
  198. package/reference/claude-config/sync-notes/2026-05-22-lead-gen-tenant-config.md +0 -40
  199. package/reference/claude-config/sync-notes/2026-05-22-org-model-multi-file-split.md +0 -61
  200. package/reference/claude-config/sync-notes/2026-05-23-branding-names-to-identity.md +0 -49
  201. package/reference/claude-config/sync-notes/2026-05-23-lead-gen-manage-access.md +0 -31
  202. package/reference/claude-config/sync-notes/2026-05-23-om-deployment-drift-detection.md +0 -42
  203. package/reference/claude-config/sync-notes/2026-05-23-om-full-model-deploy-contract.md +0 -33
  204. package/reference/claude-config/sync-notes/2026-05-23-ui-sdk-package-fixes.md +0 -37
  205. package/reference/claude-config/sync-notes/2026-05-24-platform-invite-router-core-baseline.md +0 -28
  206. package/reference/claude-config/sync-notes/2026-05-24-system-interface-readiness.md +0 -43
  207. package/reference/claude-config/sync-notes/2026-05-25-invitation-login-loader.md +0 -26
  208. package/reference/claude-config/sync-notes/2026-05-25-om-topbar-requests.md +0 -33
  209. package/reference/claude-config/sync-notes/2026-05-25-system-interface-profile-registry-and-substrate.md +0 -35
  210. package/reference/claude-config/sync-notes/2026-05-25-tenant-om-scaffold-cli.md +0 -49
  211. package/reference/claude-config/sync-notes/2026-05-25-vibe-operate-intent.md +0 -47
  212. package/reference/claude-config/sync-notes/2026-05-28-om-snapshot-sdk-workflow-config.md +0 -33
  213. package/reference/claude-config/sync-notes/2026-05-30-client-source-and-om-profiles.md +0 -39
  214. package/reference/claude-config/sync-notes/2026-06-02-knowledge-nested-group-routing.md +0 -27
  215. package/reference/claude-config/sync-notes/2026-06-02-nest-projects-under-platform.md +0 -45
  216. package/reference/claude-config/sync-notes/2026-06-03-skill-autogen-and-client-skill.md +0 -34
  217. package/reference/claude-config/sync-notes/2026-06-04-scaffold-registry-lane-severity.md +0 -34
  218. package/reference/claude-config/sync-notes/2026-06-05-appearance-app-mode-decouple.md +0 -29
  219. package/reference/claude-config/sync-notes/2026-06-05-ontology-endpoint-rename-and-knowledge-browser-ui.md +0 -86
  220. package/reference/claude-config/sync-notes/2026-06-06-om-build-systems-scaffold.md +0 -47
  221. package/reference/claude-config/sync-notes/2026-06-06-om-item-copy-references.md +0 -50
  222. package/reference/claude-config/sync-notes/2026-06-08-knowledge-base-page-not-found-fix.md +0 -76
  223. package/reference/claude-config/sync-notes/2026-06-09-agent-sessions-public-agent-chat-route.md +0 -75
  224. package/reference/claude-config/sync-notes/2026-06-09-sdk-cli-load-org-model-resolution.md +0 -42
  225. package/reference/claude-config/sync-notes/2026-06-12-agent-grants-visualizer-operations.md +0 -30
  226. package/reference/claude-config/sync-notes/2026-06-14-session-ux-and-project-cli-json.md +0 -33
  227. package/reference/claude-config/sync-notes/2026-06-14-shared-session-conversation-view.md +0 -26
  228. package/reference/claude-config/sync-notes/2026-06-15-session-chat-zero-wiring.md +0 -46
  229. package/reference/claude-config/sync-notes/2026-06-17-agent-session-ux-features.md +0 -34
  230. package/reference/claude-config/sync-notes/2026-06-25-shared-page-scroll-contract-guard.md +0 -52
  231. package/reference/claude-config/sync-notes/2026-06-26-leadgen-overview-om-telemetry.md +0 -47
  232. package/reference/claude-config/sync-notes/2026-07-21-agent-scaffold-hardening.md +0 -75
  233. package/reference/claude-config/sync-notes/2026-07-23-agent-session-memory.md +0 -49
  234. package/reference/claude-config/sync-notes/2026-07-23-workos-org-marker.md +0 -50
  235. package/reference/claude-config/sync-notes/2026-07-24-claude-5-models-and-session-surface-fixes.md +0 -116
  236. package/reference/claude-config/sync-notes/2026-07-27-agent-strict-output-and-turn-drift.md +0 -73
  237. package/reference/claude-config/sync-notes/2026-07-28-agent-reply-is-its-own-field.md +0 -84
  238. package/reference/claude-config/sync-notes/2026-07-30-login-screen-and-member-provisioning-state.md +0 -114
  239. package/reference/claude-config/sync-notes/2026-08-02-auth-guard-defaults-and-truncation-fix.md +0 -122
  240. package/reference/claude-config/sync-notes/2026-08-03-cli-gateway-errors-and-request-timeout.md +0 -120
  241. package/reference/claude-config/sync-notes/README.md +0 -43
  242. package/reference/sdk/framework/interaction-guidance.mdx +0 -182
  243. package/reference/sdk/framework/memory.mdx +0 -326
  244. package/reference/sdk/framework/resource-documentation.mdx +0 -90
  245. package/reference/sdk/roadmap.mdx +0 -164
@@ -1,282 +1,227 @@
1
1
  ---
2
2
  title: Project Structure
3
- description: Each file in an Elevasis SDK project and its purpose in the development workflow
3
+ description: Each directory and file in an Elevasis SDK project and its purpose, verified against the current external/_template scaffold
4
4
  loadWhen: "Understanding scaffolded files or project layout"
5
5
  ---
6
6
 
7
- Your Elevasis SDK project includes a complete workspace structure. This page explains what each file does and when you will interact with it.
7
+ Your Elevasis SDK project includes a complete workspace structure. This page explains what each directory and file does and when you will interact with it.
8
8
 
9
- The current full-stack scaffold uses a workspace layout with `ui/`, `operations/`, `core/`, and a root `docs/` directory. When older examples refer to `src/shared/`, read that as the current `core/` package for cross-runtime types, schemas, and organization-model configuration.
9
+ The scaffold is a workspace with `ui/`, `operations/`, and `core/` packages plus a `.claude/` agent-infrastructure directory. There is no top-level `docs/` directory -- documentation content is not part of the current deploy path.
10
10
 
11
11
  ---
12
12
 
13
- ## Source Files
13
+ ## Top-Level Layout
14
14
 
15
- ### `operations/src/index.ts`
16
-
17
- The registry entry point for your workspace. This file imports OM resource governance from `core/config/organization-model.ts`, aggregates executable resources from domain barrel files, and re-exports them as a `DeploymentSpec` default export. It does not contain workflow logic itself -- its sole job is assembly:
18
-
19
- ```ts
20
- import type { DeploymentSpec } from '@elevasis/sdk'
21
- import { organizationModel } from '@core/config/organization-model'
22
- import * as example from './example/index.js'
23
- import * as emailNotification from './email-notification/exports.js'
24
-
25
- const org: DeploymentSpec = {
26
- version: '0.1.0',
27
- organizationModel,
28
- workflows: [...example.workflows, ...emailNotification.workflows],
29
- agents: [...example.agents, ...emailNotification.agents]
30
- }
31
- export default org
32
15
  ```
33
-
34
- Each domain directory exports `workflows` and `agents` arrays via an `index.ts` barrel. When you add a new domain, import it here and spread its arrays.
35
-
36
- ### `operations/src/email-notification/index.ts`
37
-
38
- A multi-step workflow demonstrating real platform API usage. Sends an email notification using the `notifications` adapter and chains steps with `StepType.LINEAR`. Shows the pattern for workflows that use platform tool adapters and pass data between steps.
39
-
40
- ### `operations/src/example/echo.ts`
41
-
42
- The starter workflow, scaffolded to demonstrate the per-file pattern: one workflow per file with its own Zod input/output schemas, config object, contract, and step handler. Replace this domain with your own when you're ready.
43
-
44
- ### `core/`
45
-
46
- Cross-runtime types, schemas, constants, and organization-model configuration shared between the UI and operations packages. Put contracts here when both runtimes need the same validation or labels without depending on app-specific code. Resource descriptors live in `core/config/organization-model.ts`.
47
-
48
- ### `operations/elevasis.config.ts`
49
-
50
- Project-level configuration. The scaffolded file includes commented-out options (`defaultStatus`, `dev.port`):
51
-
52
- ```ts
53
- import type { ElevasConfig } from '@elevasis/sdk'
54
-
55
- export default {
56
- // defaultStatus: 'dev', // Default status for new resources ('dev' | 'prod')
57
- // dev: { port: 5170 }, // Local API port (internal development only)
58
- } satisfies ElevasConfig
16
+ ├── .claude/ # Agent infrastructure -- skills, rules, hooks (see Agent System)
17
+ ├── core/ # Cross-runtime contracts, schemas, organization model
18
+ ├── operations/ # Platform workflows, agents, and deploy config
19
+ ├── ui/ # React frontend application
20
+ ├── tmp/ # Transient agent-generated input files (kept via .gitkeep)
21
+ ├── .elevasis # Project marker: slug, templateVersion, appMode, workosOrgId
22
+ ├── .env / .env.example # ELEVASIS_PLATFORM_KEY and other root-level environment values
23
+ ├── .gitattributes # Line-ending normalization
24
+ ├── .gitignore # Excludes node_modules, dist, .env, .tanstack, and more
25
+ ├── .npmrc # auto-install-peers = true (Zod is a peer dependency)
26
+ ├── CLAUDE.md # Project-owned identity and preferences (never overwritten by sync)
27
+ ├── CONNECTIONS.md # Tenant-owned production wiring values (never overwritten)
28
+ ├── OPERATIONS.md # Tenant-owned operational quirks (never overwritten, outranks generic guidance)
29
+ ├── package.json # Root workspace manifest
30
+ ├── pnpm-lock.yaml # Project's own lockfile (this is a standalone repo, not part of the monorepo)
31
+ ├── pnpm-workspace.yaml # Workspace definition for core/operations/ui
32
+ └── tsconfig.json # Root TypeScript configuration
59
33
  ```
60
34
 
61
- ---
62
-
63
- ## Documentation
64
-
65
- ### `docs/index.md`
66
-
67
- The entry point for your workspace's documentation. Documentation files in `docs/` are deployed alongside your code during `elevasis-sdk deploy` and rendered in the Elevasis platform UI.
35
+ This project is **not** part of the Elevasis monorepo pnpm workspace. It has its own `.git/`, its own `pnpm-lock.yaml`, its own `node_modules/`. The monorepo boundary hook does not apply here.
68
36
 
69
- Use MDX frontmatter to set page metadata:
70
-
71
- ```yaml
72
- ---
73
- title: Overview
74
- description: Documentation for this project
75
- order: 0
76
37
  ---
77
- ```
78
-
79
- Add more pages by creating additional `.mdx` files in `docs/`. Nested directories create sections: `docs/guides/setup.mdx` becomes a `guides/setup` page under your deployment's documentation.
80
38
 
81
- ### `docs/project-map.mdx`
39
+ ## `core/`
82
40
 
83
- Auto-generated by `elevasis-sdk deploy` on every deploy and by `/meta fix` step 8. Contains a full project snapshot: organization, SDK version, template version, last deploy date, source domains, resource tables (workflows and agents), documentation index, SDK reference summary, commands/rules/skills, memory system listing, and configuration state. The agent reads this file at session start for project orientation.
41
+ Cross-runtime types, schemas, constants, and organization-model configuration shared between `ui/` and `operations/`. Runtime-agnostic only -- no React, no Node APIs, no SDK worker imports.
84
42
 
85
- This file is fully auto-generated -- do not edit manually. Changes are overwritten on the next deploy.
43
+ ```
44
+ core/
45
+ ├── config/
46
+ │ ├── organization-model.ts # Canonical model + resource descriptor resolvers
47
+ │ ├── organization-model.test.ts
48
+ │ ├── organization-model.contract.test.ts
49
+ │ ├── extensions/ # Project-specific model extensions
50
+ │ ├── knowledge/ # Knowledge graph nodes
51
+ │ └── README.md
52
+ ├── test-utils/
53
+ │ └── core-contract-factories.ts
54
+ ├── types/
55
+ │ ├── index.ts # Zod input/output schemas for workflows
56
+ │ ├── index.test.ts
57
+ │ ├── entities.ts # BaseProject/BaseDeal-style entity extension examples
58
+ │ └── entities.test.ts / entities.contract.test.ts
59
+ ├── package.json
60
+ ├── tsconfig.json
61
+ └── vitest.config.ts
62
+ ```
86
63
 
87
- ### `docs/priorities.mdx`
64
+ ### `core/config/organization-model.ts`
88
65
 
89
- Created by the agent during your first goal discussion. Records current goals, priorities, and next steps for the workspace. Updated as goals change across sessions.
66
+ Defines and resolves the canonical organization model (`canonicalOrganizationModel`) plus the resource-descriptor getters (`getTemplateWorkflowResourceDescriptor`, `getTemplateAgentResourceDescriptor`) that `operations/src/index.ts` imports. Direct edits are discouraged -- the file's own resolver (`resolveOrganizationModel()`) runs Zod cross-reference validation that a syntactically valid edit can still fail. All edits go through `/om`.
90
67
 
91
- This file is NOT scaffolded by default. The agent creates it the first time you discuss project goals or priorities in a session.
68
+ ### `core/types/index.ts`
92
69
 
93
- ### `docs/in-progress/`
70
+ Where workflow input/output Zod schemas are defined (for example `echoInputSchema`), so both `ui/` and `operations/` can import the same schema without a runtime dependency cycle.
94
71
 
95
- Work-in-progress task documents managed by `/work`. Each file represents an active work item with objective, plan, progress markers, and resume context. This is separate from the Projects data model exposed through `elevasis-sdk project:*`. When all steps are complete, the agent suggests finalizing the task, which moves finished items to their permanent location in `docs/`.
72
+ ### `core/types/entities.ts`
96
73
 
97
- This directory is NOT deployed -- it is filtered out during the doc scan in `elevasis-sdk deploy`.
74
+ Demonstrates the entity-extension pattern: extend a base entity (`BaseProjectSchema`, `BaseDealSchema`, and similar, imported from `@elevasis/core/entities`) with project-specific metadata, or re-export a base entity unchanged when no extension is needed.
98
75
 
99
76
  ---
100
77
 
101
- ## Progressive Disclosure Directories
102
-
103
- The following directories are included in the scaffold:
104
-
105
- | Directory | Created by | When |
106
- | ------------------------------------ | --------------- | ------------------------------------------------------------------ |
107
- | `operations/src/example/` | Scaffold | Always -- echo starter workflow lives here (replace with your own) |
108
- | `operations/src/email-notification/` | Scaffold | Always -- multi-step notification workflow example |
109
- | `core/` | Scaffold | Always -- cross-runtime contracts, schemas, and organization model |
110
- | `ui/` | Scaffold | Always -- React frontend application |
111
- | `docs/` | Scaffold | Always |
112
- | `docs/in-progress/` | Agent | When you create a task doc for in-progress work |
113
- | `docs/resources.md` | `/deploy` skill | Auto-generated on every deploy |
114
- | `data/` | Agent | When you connect a database |
115
- | `scripts/` | Agent | When you need local scripts not deployed to the platform |
116
- | `operations/src/lib/` | Agent | When shared code exists between two or more workflows |
117
-
118
- This structure keeps the initial workspace minimal and adds directories only when they earn their place.
119
-
120
- ### `operations/src/lib/`
121
-
122
- Shared code directory for utilities used by multiple workflows within the operations package. In the current workspace scaffold, prefer the top-level `core/` package for cross-runtime contracts. Included in the esbuild bundle alongside workflow code.
123
-
124
- ### `data/`
78
+ ## `operations/`
125
79
 
126
- Created by the agent when you connect a database. Contains `schema.ts` which documents your database schema as TypeScript types. The agent reads this file to understand your data model when writing workflow steps that call the Supabase tool. Not deployed -- it is local documentation for the agent.
80
+ Platform workflows, agents, and deploy configuration -- the code that runs on the Elevasis platform.
127
81
 
128
- ### `scripts/`
129
-
130
- Local utility scripts for tasks that do not run on the platform: database seeds, data migrations, one-off transformations, local testing helpers. Created on demand when you need a local script. Not deployed, not bundled.
131
-
132
- ---
133
-
134
- ## `elevasis-sdk deploy` Scope
82
+ ```
83
+ operations/
84
+ ├── src/
85
+ │ ├── index.ts # DeploymentSpec entry point (registry assembly)
86
+ │ ├── metadata.ts # Trigger/integration/human-checkpoint metadata (starts empty)
87
+ │ ├── resource-registry.test.ts
88
+ │ ├── README.md
89
+ │ ├── example/
90
+ │ │ ├── echo.ts # Starter workflow
91
+ │ │ ├── example-agent.ts # Starter agent
92
+ │ │ └── index.ts # Domain barrel (exports workflows + agents)
93
+ │ ├── email-notification/
94
+ │ │ ├── exports.ts # Domain barrel
95
+ │ │ ├── index.ts # Multi-step workflow using the notifications adapter
96
+ │ │ └── adapter-contract.test.ts
97
+ │ └── shared/ # Empty by default (.gitkeep) -- code shared across domains
98
+ ├── elevasis.config.ts # Project-level SDK config
99
+ ├── package.json
100
+ ├── tsconfig.json
101
+ └── vitest.config.ts
102
+ ```
135
103
 
136
- `elevasis-sdk deploy` touches only two directories:
104
+ ### `operations/src/index.ts`
137
105
 
138
- | Directory | Action | Deployed? |
139
- | ------------------- | ------------------------------------------------------------------------------------ | --------- |
140
- | `operations/src/` | Bundle into `dist/bundle.js` via esbuild (includes `operations/src/lib/` if present) | Yes |
141
- | `docs/` | Scan `.md` and `.mdx` files, upload as documentation | Yes |
142
- | `docs/in-progress/` | Ignored -- work-in-progress, not deployed | No |
143
- | `data/` | Ignored -- local documentation for the agent | No |
144
- | `scripts/` | Ignored -- local scripts, not deployed | No |
145
- | `.claude/` | Ignored -- local development only | No |
146
- | `ui/` | Ignored -- frontend application, deployed separately | No |
106
+ The registry entry point. It imports the organization model and resource-descriptor resolvers from `core/config/organization-model.ts`, aggregates each domain's `workflows` and `agents` arrays, and calls the SDK's `projectDeploymentSpec()` to assemble the deployable `DeploymentSpec`, binding each resource to its OM Resource descriptor. Add a new domain by importing its barrel here and spreading its `workflows` / `agents` arrays.
147
107
 
148
- ---
108
+ ### `operations/src/metadata.ts`
149
109
 
150
- ## Configuration Files
110
+ Convention seed for deployment mechanics that are not resource identity: trigger definitions (webhook, event, schedule), integration definitions (third-party credential handles), and human-checkpoint queue metadata. All three arrays (`triggers`, `integrations`, `humanCheckpoints`) start empty and are wired into `index.ts`.
151
111
 
152
- ### `.env`
112
+ ### `operations/src/example/echo.ts`
153
113
 
154
- Contains your `ELEVASIS_PLATFORM_KEY`. This file is gitignored. Never commit it.
114
+ The starter workflow: one workflow per file with its own `config`, Zod `contract`, `steps` map, and `entryPoint`. Replace this domain with your own when ready. `operations/src/example/example-agent.ts` is the equivalent starter for an agent resource.
155
115
 
156
- ### `.npmrc`
116
+ ### `operations/src/email-notification/index.ts`
157
117
 
158
- Sets `auto-install-peers = true`. The SDK uses Zod as a peer dependency, so this ensures Zod installs automatically.
118
+ A multi-step workflow demonstrating a real platform tool adapter (`notifications`), chaining steps and passing data between them.
159
119
 
160
- ### `tsconfig.json`
120
+ ### `operations/elevasis.config.ts`
161
121
 
162
- App-focused TypeScript configuration. It does not include `declaration` or `declarationMap` settings because your project is a deployable application, not a library.
122
+ Project-level SDK configuration. The scaffolded file has two commented-out options:
163
123
 
164
- ### `.gitignore`
124
+ ```ts
125
+ import type { ElevasConfig } from '@elevasis/sdk'
165
126
 
166
- Pre-configured to exclude:
127
+ export default {
128
+ // defaultStatus: 'dev', // Default status for new resources ('dev' | 'prod')
129
+ // dev: { port: 5170 }, // Local API port (internal development only)
130
+ } satisfies ElevasConfig
131
+ ```
167
132
 
168
- - `node_modules/` -- installed packages
169
- - `.env` -- API key
170
- - `dist/` -- generated by deploy, never commit
171
- - `__elevasis_worker.ts` -- temporary file generated during deployment
172
- - `.claude/settings.local.json` -- local Claude Code overrides
173
- - `.claude/memory/` -- your personal cross-session project memory (profile, errors, decisions)
133
+ `ElevasConfig` only accepts `defaultStatus` and `dev.port` -- there is no `templateVersion` field here. The template version marker lives in the project-root `.elevasis` file instead.
174
134
 
175
135
  ---
176
136
 
177
- ## Claude Code Integration
178
-
179
- The `.claude/` directory and `CLAUDE.md` give Claude Code full awareness of the SDK, CLI, and your project structure from the first session.
137
+ ## `ui/`
180
138
 
181
- ### `CLAUDE.md`
139
+ The React frontend application.
182
140
 
183
- The most important file for AI-assisted development. It provides Claude Code with:
184
-
185
- - **Project orientation** -- what an Elevasis SDK project is and how it works
186
- - **Project structure** -- which files contain resources, documentation, and configuration
187
- - **SDK patterns** -- working code examples for descriptor-backed resource definitions, Zod schemas, and the `DeploymentSpec` export
188
- - **CLI reference** -- all commands with flags (`check`, `deploy`, `exec`, `resources`, `executions`, `execution`, `deployments`, `env list/set/remove`)
189
- - **Development rules** -- conventions the agent should enforce (source in `src/`, docs in `docs/`, use `@elevasis/sdk` types only)
190
-
191
- Do not remove or heavily edit `CLAUDE.md`. It is the primary context source that makes the slash commands work well.
141
+ ```
142
+ ui/
143
+ ├── src/
144
+ │ ├── assets/
145
+ │ ├── config/
146
+ │ ├── features/
147
+ │ ├── lib/
148
+ │ ├── routes/ # TanStack Router file-based routes
149
+ │ ├── test-utils/
150
+ │ ├── main.tsx
151
+ │ └── routeTree.gen.ts # Generated by TanStack Router -- do not edit
152
+ ├── public/
153
+ ├── index.html
154
+ ├── package.json
155
+ ├── tsconfig.json
156
+ ├── vercel.json
157
+ ├── vite.config.ts
158
+ └── vitest.config.ts
159
+ ```
192
160
 
193
- ### `.claude/settings.json`
161
+ Path aliases: `@/*` maps to `ui/src/*`, `@core/*` maps to `core/*`. Frontend and platform code are separate runtimes -- they share only types via `core/`, and never import each other's `src/` directly.
194
162
 
195
- Configures Claude Code for the workspace: registers a PostToolUse formatting/type-check hook (runs after Write, Edit, and MultiEdit) and a PostToolUseFailure error recovery hook (runs after Bash failures).
163
+ ---
196
164
 
197
- ### `.claude/memory/`
165
+ ## Claude Code Integration (`.claude/`)
198
166
 
199
- Created when you run `/meta init` in Claude Code. The agent asks six onboarding questions about your organization, project goals, integrations, and experience level. Answers are stored here as markdown files and used to personalize subsequent sessions.
167
+ The `.claude/` directory and `CLAUDE.md` give Claude Code full awareness of the SDK, CLI, and project structure from the first session. See [Agent System](agent.mdx) for the full skill and rule inventory. Summary of what lives here:
200
168
 
201
169
  ```
202
- .claude/memory/
203
- ├── index.md # Root index linking all memory topics
204
- ├── profile/ # Developer profile (created by /meta init)
205
- ├── index.md
206
- ├── identity.md # Organization, goals, integrations
207
- ├── skills.md # Skill dimensions and Growth Log
208
- │ └── preferences.md # Verbosity and guidance style
209
- ├── deployment-state.md # Latest deployment outcomes
210
- ├── decisions.md # Architecture decisions recorded over time
211
- └── errors/ # Error patterns and resolutions
170
+ .claude/
171
+ ├── Overview.md # Template-owned routing map: skills, rules, structure, stack, commands
172
+ ├── settings.json # PostToolUse/PostToolUseFailure hook registrations, statusline command
173
+ ├── hooks/ # post-edit-validate.mjs, scaffold-registry-reminder.mjs, tool-failure-recovery.mjs
174
+ ├── skills/ # One directory per slash command, each with a SKILL.md
175
+ ├── rules/ # Path-scoped pointers to rule bodies bundled with @elevasis/sdk
176
+ ├── registries/ # Scaffold, skill-coverage, and knowledge registry data
177
+ └── logs/ # Hook-written runtime state
212
178
  ```
213
179
 
214
- This directory is gitignored -- it is personal to you and not shared with collaborators. All cross-session knowledge (profile, errors, deployment state, decisions) lives here as plain markdown.
180
+ `.claude/memory/` is not part of the shipped scaffold -- it is gitignored and created at runtime the first time a skill needs to persist state (for example, `/tutorial` writes `.claude/memory/profile.md` on first invocation).
215
181
 
216
182
  ---
217
183
 
218
- ## Slash Commands
219
-
220
- The `.claude/skills/` directory contains skills covering the core development loop:
221
-
222
- - **`/setup`** -- First-time project setup: placeholder replacement, deps, verification
223
- - **`/deploy`** -- Full deploy pipeline: test, build, commit, push
224
- - **`/elevasis`** -- SDK operations: check, deploy, exec
225
- - **`/work`** -- Task tracking across sessions: auto-detects intent (create, save, resume); suggests complete
226
- - **`/status`** -- Quick project health check
227
- - **`/save`** -- Auto-manage docs from conversation context
228
- - **`/explore`** -- Codebase exploration anchored to docs
229
- - **`/continue`** -- Resume in-progress work from docs
230
- - **`/project`** -- Routes project management to the canonical `elevasis-sdk project:*` commands
231
- - **`/dsp`** -- Parallel agent dispatch for implementation tasks
232
- - **`/sync`** -- Pull latest, wipe caches, fresh reinstall
184
+ ## `elevasis-sdk deploy` Scope
233
185
 
234
- Boundary summary:
186
+ `elevasis-sdk deploy` (run as `pnpm -C operations deploy` or `pnpm -C operations deploy:prod`) bundles `operations/src/` into a single file via esbuild and uploads it. There is no documentation-upload step in the current deploy path -- `ui/`, `core/`, and `.claude/` are not touched by deploy.
235
187
 
236
- - `/project` updates shared project records
237
- - `/work` manages docs-backed work tracking
238
- - `/adev` handles implementation and execution work
188
+ ---
239
189
 
240
- For detailed command documentation, see [Agent System](agent).
190
+ ## Configuration Files
241
191
 
242
- ---
192
+ ### `.elevasis`
243
193
 
244
- ## File Classification
194
+ A flat marker file at the project root recording `projectSlug`, `templateVersion`, `appMode` (`dev-centric` or `client-centric`), and `workosOrgId`. This is the canonical location for the template version -- not `elevasis.config.ts`.
245
195
 
246
- Not all scaffolded files participate in template updates. Files fall into two categories:
196
+ ### `.env`
247
197
 
248
- **SCAFFOLD_FILES total: 32**
198
+ Contains `ELEVASIS_PLATFORM_KEY` (and optionally `ELEVASIS_PLATFORM_KEY_DEV`). Gitignored -- never commit it. `ui/` and `operations/` also have their own `.env` files for runtime-specific values.
249
199
 
250
- **INIT_ONLY** -- Written once during initial scaffold, never overwritten by updates:
200
+ ### `.npmrc`
251
201
 
252
- - `package.json`, `pnpm-workspace.yaml`, `tsconfig.json`
253
- - `.env`, `.npmrc`
254
- - `operations/src/index.ts`, `operations/src/email-notification/index.ts`, `operations/src/email-notification/exports.ts`, `operations/src/example/echo.ts`, `operations/src/example/index.ts`, `core/`
255
- - `docs/index.md`, `docs/in-progress/.gitkeep`
202
+ Sets `auto-install-peers = true`. The SDK uses Zod as a peer dependency, so this ensures Zod installs automatically.
256
203
 
257
- **MANAGED** -- Written during initial scaffold and updated when the template evolves:
204
+ ### `.gitignore`
258
205
 
259
- - `operations/elevasis.config.ts`, `.gitignore`, `CLAUDE.md`, `.claude/settings.json`
260
- - Two hooks: `.claude/hooks/post-edit-validate.mjs`, `.claude/hooks/tool-failure-recovery.mjs`
261
- - Skills: `.claude/skills/work/SKILL.md`, `.claude/skills/elevasis/SKILL.md`, `.claude/skills/deploy/skill.md`, `.claude/skills/setup/SKILL.md`
262
- - Rule files: `.claude/rules/task-tracking.md`, `.claude/rules/platform.md`, `.claude/rules/error-handling.md`, `.claude/rules/docs.md`, `.claude/rules/execution.md`, `.claude/rules/observability.md`
263
- - One script: `.claude/scripts/statusline-command.js`
206
+ Excludes `node_modules/`, `dist/`, `*.tsbuildinfo`, `.tanstack/`, `.env` and `.env.*` (except `.env.example`), `*.log`, `.claude/settings.local.json`, hook-written state in `.claude/logs/*.state.json`, `operations/dist/`, `operations/__elevasis_worker.ts` (a temporary file generated during deployment), and `tmp/*` (except `.gitkeep`).
264
207
 
265
208
  ---
266
209
 
267
210
  ## File Reference
268
211
 
269
- | File | When You Edit It |
270
- | ------------------------------- | ------------------------------------------------------------------- |
271
- | `operations/src/index.ts` | Adding or removing resources |
272
- | `operations/src/<domain>/*.ts` | Writing and modifying workflow logic (organized by business domain) |
273
- | `docs/index.md` | Updating project documentation |
274
- | `docs/resources.md` | Never -- auto-generated by `/deploy` and `/elevasis deploy` |
275
- | `operations/elevasis.config.ts` | Changing project-level settings |
276
- | `.env` | Adding environment variables |
277
- | `CLAUDE.md` | Rarely -- only to add project-specific context |
278
- | `.claude/skills/*/SKILL.md` | Rarely -- skills work well as scaffolded |
212
+ | File / Directory | When You Edit It |
213
+ | ----------------------------------- | ---------------------------------------------------------------------- |
214
+ | `operations/src/index.ts` | Adding or removing resources, wiring a new domain |
215
+ | `operations/src/<domain>/*.ts` | Writing and modifying workflow or agent logic |
216
+ | `operations/src/metadata.ts` | Adding triggers, integrations, or human-checkpoint queue metadata |
217
+ | `core/types/index.ts` | Defining or changing a workflow's Zod contract |
218
+ | `core/config/organization-model.ts` | Never directly -- run `/om` instead |
219
+ | `operations/elevasis.config.ts` | Changing project-level SDK settings (`defaultStatus`, `dev.port`) |
220
+ | `.elevasis` | Never manually -- updated by `/git-sync` and platform tooling |
221
+ | `.env` | Adding environment variables |
222
+ | `CLAUDE.md` | Rarely -- project identity and preferences, mostly written by `/setup` |
223
+ | `.claude/skills/*/SKILL.md` | Never in a derived project -- these arrive via `/git-sync` |
279
224
 
280
225
  ---
281
226
 
282
- **Last Updated:** 2026-04-17
227
+ **Last Updated:** 2026-08-06
@@ -77,9 +77,9 @@ SECTION B -- Build your first thing (5 items)
77
77
  8 Going to production [ ]
78
78
 
79
79
  SECTION C -- The Organization Model (3 items)
80
- 9 /knowledge ceremony -- identity, customers, [ ]
80
+ 9 /om ceremony -- identity, customers, [ ]
81
81
  offerings via the layered flow
82
- 10 Features and labels [ ]
82
+ 10 Systems, actions, and labels [ ]
83
83
  11 Entity extensions -- BaseProject, BaseDeal [ ]
84
84
 
85
85
  SECTION D -- Modules (load on demand) (~6 items)
@@ -0,0 +1,152 @@
1
+ ---
2
+ title: Human-in-the-Loop (HITL) Workflows
3
+ description: How a workflow step opens an approval task, how it reaches the command queue, and how selecting an action resumes work -- the story that connects the approval adapter, checkpoint metadata, and the queue CLI.
4
+ ---
5
+
6
+ The platform ships three separate pieces of HITL surface: the `approval` platform adapter, the `humanCheckpoints` entry in `operations/src/metadata.ts`, and the `queue:*` CLI family. Each is documented on its own elsewhere in this bundle, but nothing connects them into one story. This page is that story: a workflow step opens a task, the task lands in the command queue, a human or an agent resolves it, and resolution triggers whatever comes next.
7
+
8
+ ## The Three Pieces, In One Sentence Each
9
+
10
+ - **`approval`** (`@elevasis/sdk/worker`) -- the typed adapter a step handler calls to open a task. See [Platform Adapters](platform-tools/adapters-platform.mdx).
11
+ - **`humanCheckpoints`** (`operations/src/metadata.ts`) -- optional deployment metadata that gives a checkpoint a friendly name and documents what feeds it and what it hands off to. It does not route anything at runtime.
12
+ - **`queue:*`** (`elevasis-sdk` CLI) -- how a human, or an agent debugging on a human's behalf, lists, inspects, and resolves tasks. See [CLI Management](cli-management.mdx#elevasis-sdk-queue).
13
+
14
+ ## The Story: Workflow to Resolution
15
+
16
+ ### 1. A step calls `approval.create()`
17
+
18
+ A step handler imports the `approval` adapter from the worker runtime and opens a task. The step that does this is typically the workflow's last step -- once it returns, that execution is done. Calling `approval.create()` does **not** pause or suspend the workflow; there is no built-in mechanism that holds an execution open while a human decides. What happens after a decision is a separate execution, described below.
19
+
20
+ ```typescript
21
+ import type { WorkflowDefinition } from '@elevasis/sdk'
22
+ import { approval } from '@elevasis/sdk/worker'
23
+ import { z } from 'zod'
24
+
25
+ const inputSchema = z.object({
26
+ dealId: z.string(),
27
+ amount: z.number()
28
+ })
29
+ const outputSchema = z.object({
30
+ taskId: z.string()
31
+ })
32
+
33
+ export const requestDiscountApproval: WorkflowDefinition = {
34
+ config: {
35
+ resourceId: 'request-discount-approval',
36
+ name: 'Request Discount Approval',
37
+ type: 'workflow',
38
+ description: 'Opens a queue task for a human to approve or reject a discount',
39
+ version: '1.0.0',
40
+ status: 'dev'
41
+ },
42
+ contract: { inputSchema, outputSchema },
43
+ steps: {
44
+ createTask: {
45
+ id: 'createTask',
46
+ name: 'Create Approval Task',
47
+ description: 'Opens a HITL task for the discount amount',
48
+ handler: async (rawInput, context) => {
49
+ const input = rawInput as z.infer<typeof inputSchema>
50
+
51
+ const created = await approval.create({
52
+ actions: [
53
+ {
54
+ id: 'approve',
55
+ label: 'Approve',
56
+ type: 'primary',
57
+ target: { resourceType: 'workflow', resourceId: 'apply-discount' }
58
+ },
59
+ { id: 'reject', label: 'Reject', type: 'secondary' }
60
+ ],
61
+ context: { dealId: input.dealId, amount: input.amount },
62
+ description: `Approve a $${input.amount} discount for deal ${input.dealId}`,
63
+ humanCheckpoint: 'discount-review'
64
+ })
65
+
66
+ context.logger.info(`[createTask] Opened approval task ${created.id}`)
67
+ return { taskId: created.id }
68
+ },
69
+ inputSchema,
70
+ outputSchema,
71
+ next: null
72
+ }
73
+ },
74
+ entryPoint: 'createTask'
75
+ }
76
+ ```
77
+
78
+ `actions` is the set of buttons a reviewer can choose between. Each action needs `id`, `label`, and `type` (`'primary' | 'secondary' | 'danger' | 'outline'`, a semantic category, not a visual style -- see the constraint below). `target` is optional per action and is what makes resolution do something: it names the resource that runs next when that specific action is selected. `context` is whatever the reviewer needs to decide, shown alongside the task. `humanCheckpoint` is a free-form grouping id, covered in step 3.
79
+
80
+ An action with no `target` is a valid pattern too -- a plain sign-off with nothing automated after it. Selecting it just marks the task completed; nothing else executes.
81
+
82
+ ### 2. The task lands in the command queue
83
+
84
+ `approval.create()` inserts a row visible through the `queue:*` CLI immediately -- there is no deploy step in between. A workflow you already deployed starts producing tasks the moment a step calls the adapter.
85
+
86
+ ```bash
87
+ elevasis-sdk queue:list --status pending --pretty
88
+ elevasis-sdk queue:get <id> --pretty
89
+ ```
90
+
91
+ ### 3. Declaring the checkpoint (optional, but worth doing)
92
+
93
+ `humanCheckpoint: 'discount-review'` in the call above is just a string -- the platform never validates it against anything at creation time. Declaring a matching entry in `operations/src/metadata.ts` is what gives that string a friendly name and a description in `queue:status` output, and documents the checkpoint in your Organization Model:
94
+
95
+ ```typescript
96
+ import type { HumanCheckpointDefinition } from '@elevasis/sdk'
97
+
98
+ export const humanCheckpoints: HumanCheckpointDefinition[] = [
99
+ {
100
+ resourceId: 'discount-review',
101
+ type: 'human',
102
+ name: 'Discount Review',
103
+ description: 'Review discounts above the auto-approve threshold',
104
+ version: '1.0.0',
105
+ status: 'prod',
106
+ links: [{ nodeId: 'system:sales.crm', kind: 'applies_to' }],
107
+ requestedBy: { workflows: ['request-discount-approval'] },
108
+ routesTo: { workflows: ['apply-discount'] }
109
+ }
110
+ ]
111
+ ```
112
+
113
+ `requestedBy` and `routesTo` are documentation fields for the graph -- they record which resources typically create tasks at this checkpoint and which ones typically pick them up. **Neither field drives execution.** The actual continuation is decided per-action by that action's own `target`, from step 1. A checkpoint entry with a `routesTo.workflows` list that no action actually targets is a documentation mismatch, not a broken pipeline -- it will not stop anything from running, but it will describe a story your code does not tell.
114
+
115
+ ### 4. A human -- or an agent debugging on a human's behalf -- resolves the task
116
+
117
+ ```bash
118
+ elevasis-sdk queue:get <id> --pretty
119
+ elevasis-sdk queue:select <id> --action-id approve --pretty
120
+ ```
121
+
122
+ Always run `queue:get` before `queue:select` on a task you did not just create -- read the context before you act on it. `queue:select` accepts `--payload` for structured input the continuation needs (a rejection reason, an adjusted amount) and `--notes` for a free-text decision note. See [CLI Management](cli-management.mdx#elevasis-sdk-queue) for the full flag reference and `@json:<path>` payload syntax.
123
+
124
+ ### 5. Resolution triggers the selected action's target
125
+
126
+ Selecting `approve` executes the resource named in that action's `target` -- in the example above, the `apply-discount` workflow. This is a **new execution of a different resource**, not the original workflow resuming. Its input is the task's `context` merged with `actionId` and `actionPayload`:
127
+
128
+ {/* doc-snippet:skip: illustrative excerpt, not a standalone compilable file */}
129
+
130
+ ```typescript
131
+ // what apply-discount's entry step receives, shaped roughly like:
132
+ const continuationInput = {
133
+ dealId: '...',
134
+ amount: 500,
135
+ actionId: 'approve',
136
+ actionPayload: {} // whatever --payload carried, or {}
137
+ }
138
+ ```
139
+
140
+ If the continuation's `inputSchema` does not declare `actionId` or `actionPayload`, Zod strips them by default -- only declare the ones you actually read.
141
+
142
+ ## Constraint: Never Pass `variant`
143
+
144
+ The action shape accepts `id`, `label`, `type`, `icon`, `color`, `target`, `form`, `requiresConfirmation`, `confirmationMessage`, and `description`. There is no `variant` field, and the Command Center always renders every action button with a fixed `'light'` variant regardless of `type` or `color`. Do not add a `variant` property to an action object -- it is not part of the adapter's type and does not control anything the UI renders.
145
+
146
+ The rendering lives in `CommandQueueDetailPage` in `@repo/ui`'s operations feature, where the action list maps to Mantine `Button`s with `variant` hardcoded and `color` resolved as `action.color || (action.type === 'danger' ? 'red' : 'blue')`. So the two levers you do have are real: use `type` to categorize the action semantically (`'danger'` for a destructive path), and `color` to override the derived color directly.
147
+
148
+ ## Related Reading
149
+
150
+ - [Platform Adapters](platform-tools/adapters-platform.mdx) -- the full adapter catalog, including `approval`
151
+ - [CLI Management](cli-management.mdx#elevasis-sdk-queue) -- every `queue:*` command and flag
152
+ - [Resources](resources/index.mdx) -- `WorkflowDefinition` shape and step routing