@elevasis/sdk 1.44.3 → 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.
- package/dist/cli.cjs +991 -650
- package/dist/index.d.ts +1045 -509
- package/dist/index.js +738 -688
- package/dist/node/index.d.ts +105 -97
- package/dist/test-utils/index.d.ts +42 -28
- package/dist/test-utils/index.js +514 -783
- package/dist/worker/index.d.ts +12112 -0
- package/dist/worker/index.js +121 -182
- package/package.json +6 -9
- package/reference/_navigation.md +151 -21
- package/reference/_reference-manifest.json +186 -4
- package/reference/claude-config.md +8 -0
- package/reference/core/index.mdx +3 -3
- package/reference/examples/organization-model.ts +117 -111
- package/reference/index.mdx +4 -4
- package/reference/rules/active-change-index.md +40 -54
- package/reference/rules/agent-runtime.md +81 -0
- package/reference/rules/agent-start-here.md +71 -163
- package/reference/rules/deployment.md +33 -10
- package/reference/rules/error-handling.md +26 -0
- package/reference/rules/execution.md +13 -0
- package/reference/rules/frontend.md +10 -3
- package/reference/rules/observability.md +9 -1
- package/reference/rules/operations.md +26 -17
- package/reference/rules/organization-model.md +74 -88
- package/reference/rules/organization-os.md +71 -88
- package/reference/rules/package-taxonomy.md +11 -2
- package/reference/rules/platform.md +13 -7
- package/reference/rules/shared-types.md +15 -0
- package/reference/rules/task-tracking.md +30 -5
- package/reference/rules/ui.md +145 -3
- package/reference/rules/vibe-intents.md +271 -0
- package/reference/rules/vibe.md +17 -243
- package/reference/scaffold/core/organization-graph.mdx +111 -97
- package/reference/scaffold/core/organization-model.mdx +234 -214
- package/reference/scaffold/operations/propagation-pipeline.md +1 -1
- package/reference/scaffold/operations/scaffold-maintenance.md +19 -18
- package/reference/scaffold/operations/workflow-recipes.md +71 -19
- package/reference/scaffold/recipes/add-a-feature.md +156 -146
- package/reference/scaffold/recipes/add-a-resource.md +123 -117
- package/reference/scaffold/recipes/customize-crm-actions.md +25 -10
- package/reference/scaffold/recipes/customize-knowledge-browser.md +52 -117
- package/reference/scaffold/recipes/customize-organization-model.md +161 -149
- package/reference/scaffold/recipes/extend-a-base-entity.md +156 -140
- package/reference/scaffold/recipes/extend-crm.md +16 -11
- package/reference/scaffold/recipes/extend-lead-gen.md +25 -7
- package/reference/scaffold/recipes/gate-by-feature-or-admin.md +160 -118
- package/reference/scaffold/recipes/index.md +2 -2
- package/reference/scaffold/recipes/query-the-knowledge-graph.md +23 -23
- package/reference/scaffold/reference/contracts.md +12 -1
- package/reference/scaffold/reference/glossary.md +3 -3
- package/reference/scaffold/reference/system-interface-capabilities.md +5 -4
- package/reference/scaffold/ui/composition-extensibility.mdx +271 -232
- package/reference/scaffold/ui/feature-flags-and-gating.md +14 -6
- package/reference/scaffold/ui/feature-shell.mdx +279 -62
- package/reference/scaffold/ui/recipes.md +229 -197
- package/reference/sdk/cli-management.mdx +77 -29
- package/reference/sdk/concepts.mdx +2 -0
- package/reference/sdk/define-builders.mdx +76 -0
- package/reference/sdk/deployment/command-center.mdx +6 -2
- package/reference/sdk/deployment/execution-reference.mdx +64 -186
- package/reference/sdk/deployment/index.mdx +2 -0
- package/reference/sdk/exports.mdx +4 -4
- package/reference/sdk/framework/agent.mdx +49 -119
- package/reference/sdk/framework/index.mdx +46 -65
- package/reference/sdk/framework/project-structure.mdx +150 -205
- package/reference/sdk/framework/tutorial-system.mdx +2 -2
- package/reference/sdk/human-in-the-loop.mdx +152 -0
- package/reference/sdk/index.mdx +6 -7
- package/reference/sdk/platform-tools/index.mdx +12 -0
- package/reference/sdk/platform-tools/type-safety.mdx +4 -0
- package/reference/sdk/project-deployment-spec.mdx +131 -0
- package/reference/sdk/resources/index.mdx +21 -7
- package/reference/sdk/resources/patterns.mdx +54 -24
- package/reference/sdk/resources/types.mdx +7 -4
- package/reference/sdk/templates/data-enrichment.mdx +7 -3
- package/reference/sdk/templates/email-sender.mdx +139 -135
- package/reference/sdk/templates/lead-scorer.mdx +5 -1
- package/reference/sdk/templates/pdf-generator.mdx +155 -151
- package/reference/sdk/templates/recurring-job.mdx +195 -189
- package/reference/sdk/templates/text-classifier.mdx +4 -0
- package/reference/sdk/templates/web-scraper.mdx +139 -135
- package/reference/spine/spine-primer.md +135 -96
- package/reference/ui/index.mdx +14 -7
- package/dist/types/worker/adapters/anymailfinder.d.ts +0 -14
- package/dist/types/worker/adapters/apify.d.ts +0 -14
- package/dist/types/worker/adapters/approval.d.ts +0 -23
- package/dist/types/worker/adapters/attio.d.ts +0 -22
- package/dist/types/worker/adapters/clickup.d.ts +0 -22
- package/dist/types/worker/adapters/create-adapter.d.ts +0 -41
- package/dist/types/worker/adapters/crm.d.ts +0 -20
- package/dist/types/worker/adapters/dropbox.d.ts +0 -14
- package/dist/types/worker/adapters/email.d.ts +0 -25
- package/dist/types/worker/adapters/execution.d.ts +0 -22
- package/dist/types/worker/adapters/gmail.d.ts +0 -14
- package/dist/types/worker/adapters/google-sheets.d.ts +0 -14
- package/dist/types/worker/adapters/index.d.ts +0 -33
- package/dist/types/worker/adapters/instantly.d.ts +0 -14
- package/dist/types/worker/adapters/lead.d.ts +0 -28
- package/dist/types/worker/adapters/list.d.ts +0 -9
- package/dist/types/worker/adapters/llm.d.ts +0 -45
- package/dist/types/worker/adapters/millionverifier.d.ts +0 -14
- package/dist/types/worker/adapters/notification.d.ts +0 -28
- package/dist/types/worker/adapters/pdf.d.ts +0 -22
- package/dist/types/worker/adapters/projects.d.ts +0 -20
- package/dist/types/worker/adapters/resend.d.ts +0 -14
- package/dist/types/worker/adapters/scheduler.d.ts +0 -25
- package/dist/types/worker/adapters/signature-api.d.ts +0 -14
- package/dist/types/worker/adapters/storage.d.ts +0 -33
- package/dist/types/worker/adapters/stripe.d.ts +0 -14
- package/dist/types/worker/adapters/tomba.d.ts +0 -14
- package/dist/types/worker/index.d.ts +0 -60
- package/dist/types/worker/platform.d.ts +0 -90
- package/dist/types/worker/utils.d.ts +0 -9
- package/reference/claude-config/Overview.md +0 -230
- package/reference/claude-config/hooks/post-edit-validate.mjs +0 -98
- package/reference/claude-config/hooks/scaffold-registry-reminder.mjs +0 -187
- package/reference/claude-config/hooks/tool-failure-recovery.mjs +0 -73
- package/reference/claude-config/registries/graph-skills.json +0 -4
- package/reference/claude-config/registries/knowledge-flags.json +0 -154
- package/reference/claude-config/registries/skill-coverage.json +0 -20
- package/reference/claude-config/rules/active-change-index.md +0 -22
- package/reference/claude-config/rules/agent-start-here.md +0 -22
- package/reference/claude-config/rules/deployment.md +0 -22
- package/reference/claude-config/rules/error-handling.md +0 -22
- package/reference/claude-config/rules/execution.md +0 -22
- package/reference/claude-config/rules/frontend.md +0 -22
- package/reference/claude-config/rules/observability.md +0 -22
- package/reference/claude-config/rules/operations.md +0 -22
- package/reference/claude-config/rules/organization-model.md +0 -22
- package/reference/claude-config/rules/organization-os.md +0 -22
- package/reference/claude-config/rules/package-taxonomy.md +0 -22
- package/reference/claude-config/rules/platform.md +0 -22
- package/reference/claude-config/rules/shared-types.md +0 -22
- package/reference/claude-config/rules/task-tracking.md +0 -22
- package/reference/claude-config/rules/topbar-actions.md +0 -70
- package/reference/claude-config/rules/ui.md +0 -22
- package/reference/claude-config/rules/vibe.md +0 -22
- package/reference/claude-config/scripts/statusline-command.js +0 -18
- package/reference/claude-config/settings.json +0 -30
- package/reference/claude-config/skills/client/SKILL.md +0 -201
- package/reference/claude-config/skills/deploy/SKILL.md +0 -159
- package/reference/claude-config/skills/dsp/SKILL.md +0 -66
- package/reference/claude-config/skills/elevasis/SKILL.md +0 -251
- package/reference/claude-config/skills/explore/SKILL.md +0 -78
- package/reference/claude-config/skills/git-sync/SKILL.md +0 -166
- package/reference/claude-config/skills/om/SKILL.md +0 -475
- package/reference/claude-config/skills/om/operations/build.md +0 -237
- package/reference/claude-config/skills/om/operations/codify-level-a.md +0 -109
- package/reference/claude-config/skills/om/operations/codify-level-b.md +0 -159
- package/reference/claude-config/skills/om/operations/customers.md +0 -114
- package/reference/claude-config/skills/om/operations/features.md +0 -88
- package/reference/claude-config/skills/om/operations/goals.md +0 -123
- package/reference/claude-config/skills/om/operations/identity.md +0 -97
- package/reference/claude-config/skills/om/operations/labels.md +0 -110
- package/reference/claude-config/skills/om/operations/offerings.md +0 -114
- package/reference/claude-config/skills/om/operations/roles.md +0 -104
- package/reference/claude-config/skills/om/operations/scaffold.md +0 -163
- package/reference/claude-config/skills/om/operations/techStack.md +0 -38
- package/reference/claude-config/skills/project/SKILL.md +0 -1114
- package/reference/claude-config/skills/run-ui/SKILL.md +0 -73
- package/reference/claude-config/skills/save/SKILL.md +0 -183
- package/reference/claude-config/skills/setup/SKILL.md +0 -290
- package/reference/claude-config/skills/status/SKILL.md +0 -59
- package/reference/claude-config/skills/submit-request/SKILL.md +0 -180
- package/reference/claude-config/skills/sync/SKILL.md +0 -47
- package/reference/claude-config/skills/tutorial/SKILL.md +0 -259
- package/reference/claude-config/skills/tutorial/progress-template.md +0 -74
- package/reference/claude-config/skills/tutorial/technical.md +0 -1303
- package/reference/claude-config/skills/tutorial/vibe-coder.md +0 -890
- package/reference/claude-config/sync-notes/2026-04-22-git-sync-and-sync-notes.md +0 -27
- package/reference/claude-config/sync-notes/2026-04-22-lead-gen-deliverability-removal.md +0 -30
- package/reference/claude-config/sync-notes/2026-04-24-test-utils-and-template-tests.md +0 -73
- package/reference/claude-config/sync-notes/2026-04-24-ui-consolidation-and-sdk-cli-train.md +0 -86
- package/reference/claude-config/sync-notes/2026-04-25-auth-role-system-and-settings-roles.md +0 -55
- package/reference/claude-config/sync-notes/2026-04-27-crm-hitl-action-layer-cutover.md +0 -97
- package/reference/claude-config/sync-notes/2026-04-27-lead-gen-substrate-train.md +0 -112
- package/reference/claude-config/sync-notes/2026-04-29-crm-state-and-lead-gen-processing-status.md +0 -93
- package/reference/claude-config/sync-notes/2026-05-02-crm-ownership-next-action.md +0 -58
- package/reference/claude-config/sync-notes/2026-05-02-template-hardcode-workos-config.md +0 -56
- package/reference/claude-config/sync-notes/2026-05-04-elevasis-workspace.md +0 -71
- package/reference/claude-config/sync-notes/2026-05-04-knowledge-bundle.md +0 -83
- package/reference/claude-config/sync-notes/2026-05-04-template-skills-run-ui-and-tutorial.md +0 -59
- package/reference/claude-config/sync-notes/2026-05-05-list-builder.md +0 -42
- package/reference/claude-config/sync-notes/2026-05-06-crm-spine.md +0 -60
- package/reference/claude-config/sync-notes/2026-05-06-sdk-changes-release-train.md +0 -37
- package/reference/claude-config/sync-notes/2026-05-07-sdk-changes-release-train.md +0 -34
- package/reference/claude-config/sync-notes/2026-05-08-resource-governance-scaffold-guidance.md +0 -38
- package/reference/claude-config/sync-notes/2026-05-09-clients-domain.md +0 -32
- package/reference/claude-config/sync-notes/2026-05-09-command-system.md +0 -33
- package/reference/claude-config/sync-notes/2026-05-09-resource-governance-and-misc.md +0 -69
- package/reference/claude-config/sync-notes/2026-05-12-sdk-ready-release-train.md +0 -30
- package/reference/claude-config/sync-notes/2026-05-14-organization-model-ontology-refactor.md +0 -45
- package/reference/claude-config/sync-notes/2026-05-15-om-skill-rename-and-write-family.md +0 -52
- package/reference/claude-config/sync-notes/2026-05-17-sdk-boundary-consolidation.md +0 -33
- package/reference/claude-config/sync-notes/2026-05-20-om-define-helpers.md +0 -32
- package/reference/claude-config/sync-notes/2026-05-22-access-model-and-right-panel.md +0 -43
- package/reference/claude-config/sync-notes/2026-05-22-lead-gen-tenant-config.md +0 -40
- package/reference/claude-config/sync-notes/2026-05-22-org-model-multi-file-split.md +0 -61
- package/reference/claude-config/sync-notes/2026-05-23-branding-names-to-identity.md +0 -49
- package/reference/claude-config/sync-notes/2026-05-23-lead-gen-manage-access.md +0 -31
- package/reference/claude-config/sync-notes/2026-05-23-om-deployment-drift-detection.md +0 -42
- package/reference/claude-config/sync-notes/2026-05-23-om-full-model-deploy-contract.md +0 -33
- package/reference/claude-config/sync-notes/2026-05-23-ui-sdk-package-fixes.md +0 -37
- package/reference/claude-config/sync-notes/2026-05-24-platform-invite-router-core-baseline.md +0 -28
- package/reference/claude-config/sync-notes/2026-05-24-system-interface-readiness.md +0 -43
- package/reference/claude-config/sync-notes/2026-05-25-invitation-login-loader.md +0 -26
- package/reference/claude-config/sync-notes/2026-05-25-om-topbar-requests.md +0 -33
- package/reference/claude-config/sync-notes/2026-05-25-system-interface-profile-registry-and-substrate.md +0 -35
- package/reference/claude-config/sync-notes/2026-05-25-tenant-om-scaffold-cli.md +0 -49
- package/reference/claude-config/sync-notes/2026-05-25-vibe-operate-intent.md +0 -47
- package/reference/claude-config/sync-notes/2026-05-28-om-snapshot-sdk-workflow-config.md +0 -33
- package/reference/claude-config/sync-notes/2026-05-30-client-source-and-om-profiles.md +0 -39
- package/reference/claude-config/sync-notes/2026-06-02-knowledge-nested-group-routing.md +0 -27
- package/reference/claude-config/sync-notes/2026-06-02-nest-projects-under-platform.md +0 -45
- package/reference/claude-config/sync-notes/2026-06-03-skill-autogen-and-client-skill.md +0 -34
- package/reference/claude-config/sync-notes/2026-06-04-scaffold-registry-lane-severity.md +0 -34
- package/reference/claude-config/sync-notes/2026-06-05-appearance-app-mode-decouple.md +0 -29
- package/reference/claude-config/sync-notes/2026-06-05-ontology-endpoint-rename-and-knowledge-browser-ui.md +0 -86
- package/reference/claude-config/sync-notes/2026-06-06-om-build-systems-scaffold.md +0 -47
- package/reference/claude-config/sync-notes/2026-06-06-om-item-copy-references.md +0 -50
- package/reference/claude-config/sync-notes/2026-06-08-knowledge-base-page-not-found-fix.md +0 -76
- package/reference/claude-config/sync-notes/2026-06-09-agent-sessions-public-agent-chat-route.md +0 -75
- package/reference/claude-config/sync-notes/2026-06-09-sdk-cli-load-org-model-resolution.md +0 -42
- package/reference/claude-config/sync-notes/2026-06-12-agent-grants-visualizer-operations.md +0 -30
- package/reference/claude-config/sync-notes/2026-06-14-session-ux-and-project-cli-json.md +0 -33
- package/reference/claude-config/sync-notes/2026-06-14-shared-session-conversation-view.md +0 -26
- package/reference/claude-config/sync-notes/2026-06-15-session-chat-zero-wiring.md +0 -46
- package/reference/claude-config/sync-notes/2026-06-17-agent-session-ux-features.md +0 -34
- package/reference/claude-config/sync-notes/2026-06-25-shared-page-scroll-contract-guard.md +0 -52
- package/reference/claude-config/sync-notes/2026-06-26-leadgen-overview-om-telemetry.md +0 -47
- package/reference/claude-config/sync-notes/2026-07-21-agent-scaffold-hardening.md +0 -75
- package/reference/claude-config/sync-notes/2026-07-23-agent-session-memory.md +0 -49
- package/reference/claude-config/sync-notes/2026-07-23-workos-org-marker.md +0 -50
- package/reference/claude-config/sync-notes/2026-07-24-claude-5-models-and-session-surface-fixes.md +0 -116
- package/reference/claude-config/sync-notes/2026-07-27-agent-strict-output-and-turn-drift.md +0 -73
- package/reference/claude-config/sync-notes/2026-07-28-agent-reply-is-its-own-field.md +0 -84
- package/reference/claude-config/sync-notes/2026-07-30-login-screen-and-member-provisioning-state.md +0 -114
- package/reference/claude-config/sync-notes/2026-08-02-auth-guard-defaults-and-truncation-fix.md +0 -122
- package/reference/claude-config/sync-notes/2026-08-03-agent-prose-escape-normalization.md +0 -88
- package/reference/claude-config/sync-notes/2026-08-03-cli-gateway-errors-and-request-timeout.md +0 -120
- package/reference/claude-config/sync-notes/README.md +0 -43
- package/reference/sdk/framework/interaction-guidance.mdx +0 -182
- package/reference/sdk/framework/memory.mdx +0 -326
- package/reference/sdk/framework/resource-documentation.mdx +0 -90
- 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
|
|
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
|
|
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
|
-
##
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
-
|
|
39
|
+
## `core/`
|
|
82
40
|
|
|
83
|
-
|
|
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
|
-
|
|
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
|
-
### `
|
|
64
|
+
### `core/config/organization-model.ts`
|
|
88
65
|
|
|
89
|
-
|
|
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
|
-
|
|
68
|
+
### `core/types/index.ts`
|
|
92
69
|
|
|
93
|
-
|
|
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
|
-
|
|
72
|
+
### `core/types/entities.ts`
|
|
96
73
|
|
|
97
|
-
|
|
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
|
-
##
|
|
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
|
-
|
|
80
|
+
Platform workflows, agents, and deploy configuration -- the code that runs on the Elevasis platform.
|
|
127
81
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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
|
-
|
|
104
|
+
### `operations/src/index.ts`
|
|
137
105
|
|
|
138
|
-
|
|
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
|
-
|
|
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
|
-
###
|
|
112
|
+
### `operations/src/example/echo.ts`
|
|
153
113
|
|
|
154
|
-
|
|
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
|
-
###
|
|
116
|
+
### `operations/src/email-notification/index.ts`
|
|
157
117
|
|
|
158
|
-
|
|
118
|
+
A multi-step workflow demonstrating a real platform tool adapter (`notifications`), chaining steps and passing data between them.
|
|
159
119
|
|
|
160
|
-
### `
|
|
120
|
+
### `operations/elevasis.config.ts`
|
|
161
121
|
|
|
162
|
-
|
|
122
|
+
Project-level SDK configuration. The scaffolded file has two commented-out options:
|
|
163
123
|
|
|
164
|
-
|
|
124
|
+
```ts
|
|
125
|
+
import type { ElevasConfig } from '@elevasis/sdk'
|
|
165
126
|
|
|
166
|
-
|
|
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
|
-
|
|
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
|
-
##
|
|
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
|
-
|
|
139
|
+
The React frontend application.
|
|
182
140
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
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
|
-
|
|
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
|
-
|
|
163
|
+
---
|
|
196
164
|
|
|
197
|
-
|
|
165
|
+
## Claude Code Integration (`.claude/`)
|
|
198
166
|
|
|
199
|
-
|
|
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/
|
|
203
|
-
├──
|
|
204
|
-
├──
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
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
|
-
|
|
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
|
-
##
|
|
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
|
-
|
|
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
|
-
|
|
237
|
-
- `/work` manages docs-backed work tracking
|
|
238
|
-
- `/adev` handles implementation and execution work
|
|
188
|
+
---
|
|
239
189
|
|
|
240
|
-
|
|
190
|
+
## Configuration Files
|
|
241
191
|
|
|
242
|
-
|
|
192
|
+
### `.elevasis`
|
|
243
193
|
|
|
244
|
-
|
|
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
|
-
|
|
196
|
+
### `.env`
|
|
247
197
|
|
|
248
|
-
|
|
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
|
-
|
|
200
|
+
### `.npmrc`
|
|
251
201
|
|
|
252
|
-
|
|
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
|
-
|
|
204
|
+
### `.gitignore`
|
|
258
205
|
|
|
259
|
-
|
|
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
|
|
270
|
-
|
|
|
271
|
-
| `operations/src/index.ts`
|
|
272
|
-
| `operations/src/<domain>/*.ts`
|
|
273
|
-
| `
|
|
274
|
-
| `
|
|
275
|
-
| `
|
|
276
|
-
|
|
|
277
|
-
| `
|
|
278
|
-
| `.
|
|
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-
|
|
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 /
|
|
80
|
+
9 /om ceremony -- identity, customers, [ ]
|
|
81
81
|
offerings via the layered flow
|
|
82
|
-
10
|
|
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
|