@elevasis/sdk 1.19.0 → 1.20.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 (56) hide show
  1. package/dist/cli.cjs +1712 -72
  2. package/dist/index.d.ts +659 -5
  3. package/dist/index.js +565 -42
  4. package/dist/node/index.d.ts +1 -0
  5. package/dist/node/index.js +213 -2
  6. package/dist/test-utils/index.d.ts +459 -4
  7. package/dist/test-utils/index.js +509 -37
  8. package/dist/worker/index.js +365 -37
  9. package/package.json +4 -4
  10. package/reference/_navigation.md +2 -1
  11. package/reference/_reference-manifest.json +14 -0
  12. package/reference/claude-config/rules/agent-start-here.md +5 -5
  13. package/reference/claude-config/rules/deployment.md +4 -3
  14. package/reference/claude-config/rules/frontend.md +2 -2
  15. package/reference/claude-config/rules/operations.md +17 -13
  16. package/reference/claude-config/rules/organization-model.md +7 -5
  17. package/reference/claude-config/rules/organization-os.md +13 -11
  18. package/reference/claude-config/rules/ui.md +3 -3
  19. package/reference/claude-config/rules/vibe.md +4 -4
  20. package/reference/claude-config/skills/explore/SKILL.md +4 -4
  21. package/reference/claude-config/skills/knowledge/SKILL.md +8 -8
  22. package/reference/claude-config/skills/knowledge/operations/codify-level-a.md +7 -7
  23. package/reference/claude-config/skills/knowledge/operations/codify-level-b.md +13 -13
  24. package/reference/claude-config/skills/knowledge/operations/customers.md +1 -1
  25. package/reference/claude-config/skills/knowledge/operations/goals.md +1 -1
  26. package/reference/claude-config/skills/knowledge/operations/identity.md +1 -1
  27. package/reference/claude-config/skills/knowledge/operations/offerings.md +1 -1
  28. package/reference/claude-config/skills/knowledge/operations/roles.md +1 -1
  29. package/reference/claude-config/skills/knowledge/operations/techStack.md +19 -91
  30. package/reference/claude-config/skills/project/SKILL.md +73 -13
  31. package/reference/claude-config/skills/save/SKILL.md +5 -5
  32. package/reference/claude-config/skills/tutorial/technical.md +5 -6
  33. package/reference/claude-config/sync-notes/2026-05-07-sdk-changes-release-train.md +34 -0
  34. package/reference/claude-config/sync-notes/2026-05-08-resource-governance-scaffold-guidance.md +38 -0
  35. package/reference/claude-config/sync-notes/2026-05-09-clients-domain.md +32 -0
  36. package/reference/claude-config/sync-notes/2026-05-09-command-system.md +33 -0
  37. package/reference/claude-config/sync-notes/2026-05-09-resource-governance-and-misc.md +69 -0
  38. package/reference/examples/organization-model.ts +17 -5
  39. package/reference/framework/index.mdx +1 -1
  40. package/reference/framework/project-structure.mdx +10 -8
  41. package/reference/packages/core/src/business/README.md +2 -2
  42. package/reference/packages/core/src/organization-model/README.md +10 -3
  43. package/reference/resources/index.mdx +27 -17
  44. package/reference/scaffold/core/organization-model.mdx +33 -14
  45. package/reference/scaffold/operations/workflow-recipes.md +35 -29
  46. package/reference/scaffold/recipes/add-a-feature.md +18 -3
  47. package/reference/scaffold/recipes/add-a-resource.md +50 -10
  48. package/reference/scaffold/recipes/customize-crm-actions.md +12 -6
  49. package/reference/scaffold/recipes/customize-organization-model.md +18 -3
  50. package/reference/scaffold/recipes/extend-crm.md +17 -19
  51. package/reference/scaffold/recipes/extend-lead-gen.md +31 -31
  52. package/reference/scaffold/recipes/index.md +1 -1
  53. package/reference/scaffold/reference/contracts.md +501 -303
  54. package/reference/scaffold/reference/feature-registry.md +1 -1
  55. package/reference/scaffold/reference/glossary.md +8 -3
  56. package/reference/scaffold/ui/recipes.md +21 -6
@@ -6,7 +6,7 @@ loadWhen: "Understanding scaffolded files or project layout"
6
6
 
7
7
  `elevasis-sdk init` creates a complete workspace structure. This page explains what each file does and when you will interact with it.
8
8
 
9
- The current full-stack scaffold uses a workspace layout with `ui/`, `operations/`, `foundations/`, and a root `docs/` directory. When older examples refer to `src/shared/`, read that as the current `foundations/` package for cross-runtime types, schemas, and organization-model configuration.
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.
10
10
 
11
11
  ---
12
12
 
@@ -14,15 +14,17 @@ The current full-stack scaffold uses a workspace layout with `ui/`, `operations/
14
14
 
15
15
  ### `operations/src/index.ts`
16
16
 
17
- The registry entry point for your workspace. This file aggregates 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 aggregation:
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
18
 
19
19
  ```ts
20
20
  import type { DeploymentSpec } from '@elevasis/sdk'
21
+ import { resourceGovernanceModel } from '@core/config/organization-model'
21
22
  import * as example from './example/index.js'
22
23
  import * as emailNotification from './email-notification/exports.js'
23
24
 
24
25
  const org: DeploymentSpec = {
25
26
  version: '0.1.0',
27
+ organizationModel: resourceGovernanceModel,
26
28
  workflows: [...example.workflows, ...emailNotification.workflows],
27
29
  agents: [...example.agents, ...emailNotification.agents]
28
30
  }
@@ -39,9 +41,9 @@ A multi-step workflow demonstrating real platform API usage. Sends an email noti
39
41
 
40
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.
41
43
 
42
- ### `foundations/`
44
+ ### `core/`
43
45
 
44
- 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.
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`.
45
47
 
46
48
  ### `operations/elevasis.config.ts`
47
49
 
@@ -104,7 +106,7 @@ The following directories are included in the scaffold:
104
106
  | ------------------------------------ | --------------- | ------------------------------------------------------------------ |
105
107
  | `operations/src/example/` | Scaffold | Always -- echo starter workflow lives here (replace with your own) |
106
108
  | `operations/src/email-notification/` | Scaffold | Always -- multi-step notification workflow example |
107
- | `foundations/` | Scaffold | Always -- cross-runtime contracts, schemas, and organization model |
109
+ | `core/` | Scaffold | Always -- cross-runtime contracts, schemas, and organization model |
108
110
  | `ui/` | Scaffold | Always -- React frontend application |
109
111
  | `docs/` | Scaffold | Always |
110
112
  | `docs/in-progress/` | Agent | When you create a task doc for in-progress work |
@@ -117,7 +119,7 @@ This structure keeps the initial workspace minimal and adds directories only whe
117
119
 
118
120
  ### `operations/src/lib/`
119
121
 
120
- Shared code directory for utilities used by multiple workflows within the operations package. In the current workspace scaffold, prefer the top-level `foundations/` package for cross-runtime contracts. Included in the esbuild bundle alongside workflow code.
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.
121
123
 
122
124
  ### `data/`
123
125
 
@@ -182,7 +184,7 @@ The most important file for AI-assisted development. It provides Claude Code wit
182
184
 
183
185
  - **Project orientation** -- what an Elevasis SDK project is and how it works
184
186
  - **Project structure** -- which files contain resources, documentation, and configuration
185
- - **SDK patterns** -- working code examples for resource definitions, Zod schemas, and the `DeploymentSpec` export
187
+ - **SDK patterns** -- working code examples for descriptor-backed resource definitions, Zod schemas, and the `DeploymentSpec` export
186
188
  - **CLI reference** -- all commands with flags (`check`, `deploy`, `exec`, `resources`, `executions`, `execution`, `deployments`, `env list/set/remove`)
187
189
  - **Development rules** -- conventions the agent should enforce (source in `src/`, docs in `docs/`, use `@elevasis/sdk` types only)
188
190
 
@@ -249,7 +251,7 @@ Not all scaffolded files participate in template updates. Files fall into two ca
249
251
 
250
252
  - `package.json`, `pnpm-workspace.yaml`, `tsconfig.json`
251
253
  - `.env`, `.npmrc`
252
- - `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`, `foundations/`
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/`
253
255
  - `docs/index.md`, `docs/in-progress/.gitkeep`
254
256
 
255
257
  **MANAGED** -- Written during initial scaffold and updated when the template evolves:
@@ -2,7 +2,7 @@
2
2
 
3
3
  Published base entity contracts for the Elevasis platform. Each entity ships as a TypeScript interface, a matching Zod schema, and an inferred `Input` type, generic over a `<TMeta>` extension slot.
4
4
 
5
- External projects extend these in `foundations/types/entities.ts` to attach project-specific metadata while keeping the canonical shape stable.
5
+ External projects extend these in `core/types/entities.ts` to attach project-specific metadata while keeping the canonical shape stable.
6
6
 
7
7
  ## Published Exports
8
8
 
@@ -49,4 +49,4 @@ export type Deal = BaseDeal
49
49
 
50
50
  The full pattern is documented in the SDK scaffold bundle: `node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-a-base-entity.md`.
51
51
 
52
- The canonical template demo lives at `external/_template/foundations/types/entities.ts`.
52
+ The canonical template demo lives at `external/_template/core/types/entities.ts`.
@@ -47,10 +47,13 @@ Top-level fields:
47
47
  - `offerings`
48
48
  - `roles`
49
49
  - `goals`
50
+ - `systems`
51
+ - `resources`
50
52
  - `statuses`
51
53
  - `operations`
54
+ - `knowledge`
52
55
 
53
- Resources bind to the graph from deployment metadata through `links` and `category`.
56
+ Resource identity is authored in `resources.entries`. Runtime workflows, agents, and integrations import those descriptors, derive `resourceId` and kind from them, and attach executable behavior in operations code.
54
57
 
55
58
  ## Feature Set
56
59
 
@@ -77,6 +80,10 @@ Cross-collection links use kind-prefixed IDs:
77
80
  - `resource:lead-import`
78
81
  - `capability:operations.queue.review`
79
82
 
83
+ ## Resource Descriptors
84
+
85
+ The OM Resources domain is governance-only. Descriptors declare canonical `id`, required `systemId`, governance `status`, and optional role ownership. `DeploymentSpec` remains the runtime/deploy assembly around those descriptors, not a second resource identity catalog.
86
+
80
87
  ## Resolution Semantics
81
88
 
82
89
  - `defineOrganizationModel()` is a typed helper.
@@ -92,11 +99,11 @@ Cross-collection links use kind-prefixed IDs:
92
99
  - Child feature IDs require ancestor feature nodes.
93
100
  - Container features omit `path`.
94
101
  - Leaf features provide `path`.
95
- - Resource links are validated against graph node IDs during registry registration.
102
+ - Systems, resources, roles, knowledge nodes, and goals must resolve their declared cross-references.
96
103
 
97
104
  ## Practical Guidance
98
105
 
99
106
  - Use `resolveOrganizationModel()` when you need a runtime-safe model.
100
107
  - Use `defineOrganizationModel()` when authoring static overrides.
101
108
  - Keep feature IDs stable because shell routing, gating, breadcrumbs, and docs depend on them.
102
- - Put semantic resource relationships on resource metadata, not on feature nodes.
109
+ - Put resource identity and governance in `resources.entries`; attach executable behavior in operations.
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  title: Writing Resources
3
- description: Guide to creating workflows and agents using WorkflowDefinition, AgentDefinition, and DeploymentSpec with the Elevasis SDK
3
+ description: Guide to creating descriptor-backed workflows and agents with the Elevasis SDK
4
4
  loadWhen: "Building or modifying a workflow"
5
5
  ---
6
6
 
7
- Resources are the building blocks of your Elevasis project. A resource is a workflow or agent definition that the platform can execute on your behalf. You define them in TypeScript, export them from a single entry point, and the platform handles scheduling, retries, logging, and execution.
7
+ Resources are the building blocks of your Elevasis project. Resource identity and governance metadata live in the Organization Model under `organizationModel.resources.entries`; operations code imports those descriptors, attaches executable workflow or agent behavior, and exports a `DeploymentSpec` for deployment.
8
8
 
9
- This page covers how to structure your resources, write step handlers, and export everything through `DeploymentSpec`.
9
+ This page covers how to structure executable resources, derive runtime IDs from OM descriptors, write step handlers, and assemble the deployment spec without creating a second identity catalog.
10
10
 
11
11
  ## WorkflowDefinition
12
12
 
@@ -24,6 +24,7 @@ A complete workflow definition has four required properties:
24
24
  ```typescript
25
25
  import { z } from 'zod';
26
26
  import type { WorkflowDefinition } from '@elevasis/sdk';
27
+ import { resourceDescriptors } from '@core/config/organization-model';
27
28
 
28
29
  const echoInput = z.object({
29
30
  message: z.string(),
@@ -37,9 +38,10 @@ type EchoInput = z.infer<typeof echoInput>;
37
38
 
38
39
  const echoWorkflow: WorkflowDefinition = {
39
40
  config: {
40
- resourceId: 'echo',
41
+ resource: resourceDescriptors.echo,
42
+ resourceId: resourceDescriptors.echo.id,
41
43
  name: 'Echo',
42
- type: 'workflow',
44
+ type: resourceDescriptors.echo.kind,
43
45
  description: 'Returns the input message unchanged',
44
46
  version: '1.0.0',
45
47
  status: 'dev',
@@ -68,16 +70,17 @@ const echoWorkflow: WorkflowDefinition = {
68
70
 
69
71
  ### config
70
72
 
71
- The `config` block identifies the workflow on the platform:
72
-
73
- | Field | Type | Description |
74
- | ------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------- |
75
- | `resourceId` | `string` | Unique lowercase ID within your organization (e.g., `send-welcome-email`). Used by the CLI to target this resource. |
76
- | `name` | `string` | Human-readable display name shown in the dashboard. |
77
- | `type` | `'workflow'` | Always the literal string `'workflow'` for workflow resources. |
78
- | `description` | `string` | Summary shown in the dashboard and command center. |
79
- | `version` | `string` | Semver string (e.g., `'1.0.0'`). Increment when making breaking changes to the contract. |
80
- | `status` | `'dev' | 'prod'` | Controls availability. Use `'dev'` while building. See [Resource Status](#resource-status). |
73
+ The `config` block binds executable behavior to the OM resource descriptor:
74
+
75
+ | Field | Type | Description |
76
+ | ------------- | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
77
+ | `resource` | `ResourceEntry` | OM descriptor from `core/config/organization-model.ts`; owns stable identity, kind, system membership, ownership, and status. |
78
+ | `resourceId` | `string` | Derived from `resource.id`. Used by runtime invocation, CLI targeting, execution logs, and dashboard links. Do not invent it here. |
79
+ | `name` | `string` | Human-readable display name shown in the dashboard. |
80
+ | `type` | `'workflow'` | Derived from `resource.kind` for workflow resources. |
81
+ | `description` | `string` | Summary shown in the dashboard and command center. |
82
+ | `version` | `string` | Semver string (e.g., `'1.0.0'`). Increment when making breaking changes to the contract. |
83
+ | `status` | `'dev' | 'prod'` | Controls runtime availability. Use `'dev'` while building. See [Resource Status](#resource-status). |
81
84
  | `domains` | `string[]` | Optional. Groups resources in the command center view. |
82
85
 
83
86
  ### contract
@@ -271,10 +274,14 @@ Agents are autonomous resources that use an LLM and tools to complete a goal. Yo
271
274
 
272
275
  ```typescript
273
276
  import type { AgentDefinition } from '@elevasis/sdk';
277
+ import { resourceDescriptors } from '@core/config/organization-model';
274
278
 
275
279
  const myAgent: AgentDefinition = {
276
280
  config: {
281
+ resource: resourceDescriptors.myAgent,
282
+ resourceId: resourceDescriptors.myAgent.id,
277
283
  name: 'my-agent',
284
+ type: resourceDescriptors.myAgent.kind,
278
285
  description: 'Answers questions using platform tools',
279
286
  status: 'dev',
280
287
  },
@@ -291,12 +298,15 @@ const myAgent: AgentDefinition = {
291
298
 
292
299
  ## DeploymentSpec
293
300
 
294
- All resources must be exported through a `DeploymentSpec` default export from `src/index.ts`. This is the entry point the platform reads when you deploy.
301
+ All executable resources must be assembled through a `DeploymentSpec` default export from `operations/src/index.ts`. This is the entry point the platform reads when you deploy. Include the Organization Model payload so the validator can compare code-backed resources against OM descriptors.
295
302
 
296
303
  ```typescript
297
304
  import type { DeploymentSpec } from '@elevasis/sdk';
305
+ import { resourceGovernanceModel } from '@core/config/organization-model';
298
306
 
299
307
  const org: DeploymentSpec = {
308
+ version: '0.1.0',
309
+ organizationModel: resourceGovernanceModel,
300
310
  workflows: [echoWorkflow, pipeline],
301
311
  agents: [
302
312
  // myAgent,
@@ -306,7 +316,7 @@ const org: DeploymentSpec = {
306
316
  export default org;
307
317
  ```
308
318
 
309
- Each resource's `config.resourceId` is used as its identifier on the platform. These IDs appear in CLI output (`elevasis-sdk resources`), execution commands (`elevasis-sdk exec`), and the dashboard.
319
+ Each resource's `config.resourceId` is still the deployed runtime identifier. The important authoring rule is that `config.resourceId` derives from the OM descriptor (`resource.id`) instead of being duplicated by hand.
310
320
 
311
321
  ### Resource Status
312
322
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Organization Model
3
- description: Organization OS Model layer documentation for the flat feature hierarchy, semantic domains, resource graph links, and curated @elevasis/core public API.
3
+ description: Organization OS Model layer documentation for the flat feature hierarchy, semantic domains, resource descriptors, and curated @elevasis/core public API.
4
4
  ---
5
5
  <!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
6
6
  <!-- Regenerate: pnpm scaffold:sync -->
@@ -38,10 +38,13 @@ Top-level fields on `OrganizationModel`:
38
38
  - `offerings`
39
39
  - `roles`
40
40
  - `goals`
41
+ - `systems`
42
+ - `resources`
41
43
  - `statuses`
42
44
  - `operations`
45
+ - `knowledge`
43
46
 
44
- Resources are not authored inside `OrganizationModel`. Deployable workflows, agents, triggers, integrations, external resources, and human checkpoints declare graph links on their resource metadata.
47
+ Resource identity is authored inside `OrganizationModel.resources.entries`. Runtime workflows, agents, and integrations import those descriptors, derive `resourceId` and kind from them, and attach executable behavior in operations code.
45
48
 
46
49
  ## Feature Shape
47
50
 
@@ -74,7 +77,7 @@ Development-only features remain defined and enabled with `devOnly: true`; shell
74
77
 
75
78
  Navigation surfaces may also carry `devOnly` for compatibility with the legacy/domain navigation model. `knowledge.command-view` is intentionally development-only while its graph visualization modes continue to mature.
76
79
 
77
- ## Graph IDs and Resource Links
80
+ ## Graph IDs and Resource Descriptors
78
81
 
79
82
  Cross-collection links use kind-prefixed graph IDs:
80
83
 
@@ -83,18 +86,30 @@ Cross-collection links use kind-prefixed graph IDs:
83
86
  - `resource:lead-import`
84
87
  - `capability:operations.queue.review`
85
88
 
86
- Example resource metadata:
89
+ Resource identity is authored in the OM Resources domain. Operations imports descriptors from `organizationModel.resources.entries` and derives runtime `resourceId` / `type` while attaching executable behavior.
87
90
 
88
91
  ```ts
89
- config: {
90
- resourceId: 'lead-import',
91
- name: 'Lead Import',
92
- type: 'workflow',
93
- version: '1.0.0',
94
- status: 'prod',
95
- links: [{ nodeId: 'feature:sales.lead-gen', kind: 'operates-on' }],
96
- category: 'production'
97
- }
92
+ import { defineResources } from '@elevasis/core/organization-model'
93
+
94
+ export const resourceDescriptors = defineResources({
95
+ leadImport: {
96
+ id: 'lead-import',
97
+ kind: 'workflow',
98
+ systemId: 'sys.prospecting',
99
+ ownerRoleId: 'role-ops-lead',
100
+ status: 'active',
101
+ capabilityKey: 'prospecting.lead-import'
102
+ }
103
+ })
104
+
105
+ export const resourceGovernanceModel = {
106
+ systems: {
107
+ systems
108
+ },
109
+ resources: {
110
+ entries: Object.values(resourceDescriptors)
111
+ }
112
+ } as const
98
113
  ```
99
114
 
100
115
  ## Domain Semantics
@@ -105,7 +120,10 @@ The model keeps business semantics in named domains:
105
120
  - `prospecting` -- company/contact lifecycle stages
106
121
  - `projects` -- project, milestone, and task statuses
107
122
  - `identity`, `customers`, `offerings`, `roles`, `goals` -- organizational reality
123
+ - `systems` -- bounded contexts that group governed operational resources
124
+ - `resources` -- governance-only workflow, agent, and integration descriptors
108
125
  - `statuses` and `operations` -- runtime/vibe-layer semantic registries
126
+ - `knowledge` -- playbooks, strategies, references, and graph-governing links
109
127
 
110
128
  ## Authoring and Resolution
111
129
 
@@ -124,8 +142,9 @@ The model keeps business semantics in named domains:
124
142
  - container/leaf path rules
125
143
  - valid sidebar positions
126
144
  - reality-domain cross references such as offering target segments and role reporting lines
145
+ - system, resource, role, knowledge, and goal cross references used by resource governance
127
146
 
128
- Resource graph links are validated during resource registry registration because resources live in deployment specs.
147
+ `DeploymentSpec` remains the runtime/deploy assembly around these descriptors. It is not the source of resource identity.
129
148
 
130
149
  ## Provider Integration
131
150
 
@@ -16,21 +16,24 @@ description: Anatomy of a workflow, adapter usage, and trigger patterns -- runna
16
16
 
17
17
  Every workflow is a `WorkflowDefinition` object with four top-level keys: `config`, `contract`, `steps`, and `entryPoint`. The `email-notification` workflow at `operations/src/email-notification/index.ts` is used as the running example throughout this section.
18
18
 
19
- ### Config
20
-
21
- ```typescript
22
- config: {
23
- resourceId: 'email-notification', // Unique ID -- used in API calls and CLI
24
- name: 'Email Notification', // Human-readable display name
25
- type: 'workflow', // Always 'workflow' (vs 'agent')
26
- description: 'Sends a notification email to a user...',
27
- version: '1.0.0', // Bump on contract changes
28
- status: 'dev' // 'dev' or 'prod'
29
- }
30
- ```
31
-
32
- - `resourceId` is the stable identifier used by `pnpm exec elevasis exec` and `/execute` API calls.
33
- - Bump `version` whenever you change `contract.inputSchema` or `contract.outputSchema`.
19
+ ### Config
20
+
21
+ ```typescript
22
+ import { resourceDescriptors } from '@core/config/organization-model'
23
+
24
+ config: {
25
+ resource: resourceDescriptors.emailNotification,
26
+ resourceId: resourceDescriptors.emailNotification.id,
27
+ name: 'Email Notification',
28
+ type: resourceDescriptors.emailNotification.kind,
29
+ description: 'Sends a notification email to a user...',
30
+ version: '1.0.0',
31
+ status: 'dev'
32
+ }
33
+ ```
34
+
35
+ - The OM Resources descriptor owns the stable ID and kind. Runtime execution still uses that deployed `resourceId`, but workflow authoring should derive it from the descriptor.
36
+ - Bump `version` whenever you change `contract.inputSchema` or `contract.outputSchema`.
34
37
 
35
38
  ### Contract
36
39
 
@@ -389,7 +392,7 @@ pnpm exec elevasis --prod exec Elevasis/email-notification --input '{...}'
389
392
 
390
393
  ## 4. Registry Pattern
391
394
 
392
- Workflows are discovered through `operations/src/index.ts`, which exports a `DeploymentSpec` as its default export.
395
+ Workflows are discovered through `operations/src/index.ts`, which exports a `DeploymentSpec` as its default export. The spec assembles deployable runtime resources; it is not a second resource identity catalog.
393
396
 
394
397
  **Pattern:** each feature group in `operations/src/` has its own exports barrel. The top-level spec spreads all groups:
395
398
 
@@ -407,15 +410,17 @@ operations/src/
407
410
  Top-level registry (`operations/src/index.ts`):
408
411
 
409
412
  ```typescript
410
- import type { DeploymentSpec } from '@elevasis/sdk'
411
- import * as example from './example/index.js'
412
- import * as emailNotification from './email-notification/exports.js'
413
-
414
- const org: DeploymentSpec = {
415
- version: '0.1.0',
416
- workflows: [...example.workflows, ...emailNotification.workflows],
417
- agents: [...example.agents, ...emailNotification.agents]
418
- }
413
+ import type { DeploymentSpec } from '@elevasis/sdk'
414
+ import { resourceGovernanceModel } from '@core/config/organization-model'
415
+ import * as example from './example/index.js'
416
+ import * as emailNotification from './email-notification/exports.js'
417
+
418
+ const org: DeploymentSpec = {
419
+ version: '0.1.0',
420
+ organizationModel: resourceGovernanceModel,
421
+ workflows: [...example.workflows, ...emailNotification.workflows],
422
+ agents: [...example.agents, ...emailNotification.agents]
423
+ }
419
424
  export default org
420
425
  ```
421
426
 
@@ -431,10 +436,11 @@ export const agents: never[] = []
431
436
 
432
437
  **Adding a new workflow:**
433
438
 
434
- 1. Create `operations/src/<feature>/index.ts` with the `WorkflowDefinition`.
435
- 2. Create `operations/src/<feature>/exports.ts` with `workflows` and `agents` arrays.
436
- 3. Import the group barrel in `operations/src/index.ts` and spread into `workflows`/`agents`.
437
- 4. Run `pnpm -C operations check` to validate, then `pnpm -C operations deploy` to publish.
439
+ 1. Add the resource descriptor to `core/config/organization-model.ts`.
440
+ 2. Create `operations/src/<feature>/index.ts` with the `WorkflowDefinition`, deriving `config.resourceId` and `config.type` from the descriptor.
441
+ 3. Create `operations/src/<feature>/exports.ts` with `workflows` and `agents` arrays.
442
+ 4. Import the group barrel in `operations/src/index.ts` and spread into `workflows`/`agents`.
443
+ 5. Run `pnpm -C operations check` to validate descriptor/code alignment, then `pnpm -C operations deploy` to publish.
438
444
 
439
445
  **Note:** Use `.js` extensions in imports even though the source is TypeScript. The TypeScript compiler and esbuild bundler both require this for ESM interoperability.
440
446
 
@@ -82,13 +82,28 @@ function AnalyticsLayout() {
82
82
 
83
83
  ## 4. Add backing resources
84
84
 
85
- For workflows or agents that power the feature, declare graph links on the resource metadata:
85
+ For workflows or agents that power the feature, author an OM Resource descriptor first, then derive runtime metadata from it:
86
86
 
87
87
  ```ts
88
+ // core/config/organization-model.ts
89
+ import { defineResources } from '@elevasis/core/organization-model'
90
+
91
+ export const resourceDescriptors = defineResources({
92
+ analyticsRefresh: {
93
+ id: 'analytics-refresh',
94
+ kind: 'workflow',
95
+ systemId: 'sys.analytics',
96
+ ownerRoleId: 'role-ops-lead',
97
+ status: 'active'
98
+ }
99
+ })
100
+
101
+ // operations/src/analytics-refresh/index.ts
88
102
  config: {
89
- resourceId: 'analytics-refresh',
103
+ resource: resourceDescriptors.analyticsRefresh,
104
+ resourceId: resourceDescriptors.analyticsRefresh.id,
90
105
  name: 'Analytics Refresh',
91
- type: 'workflow',
106
+ type: resourceDescriptors.analyticsRefresh.kind,
92
107
  version: '1.0.0',
93
108
  status: 'prod',
94
109
  links: [{ nodeId: 'feature:analytics', kind: 'operates-on' }],
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Add a Resource
3
- description: Add a workflow or agent with resource metadata, graph links, and deployment verification.
3
+ description: Add an OM-owned workflow or agent descriptor, bind executable behavior in operations, and verify descriptor-backed deployment.
4
4
  ---
5
5
  <!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
6
6
  <!-- Regenerate: pnpm scaffold:sync -->
@@ -8,18 +8,58 @@ description: Add a workflow or agent with resource metadata, graph links, and de
8
8
 
9
9
  # Add a Resource
10
10
 
11
- Resources are workflows, agents, triggers, integrations, external systems, or human checkpoints collected in a `DeploymentSpec`. They link into the Organization Model graph through resource metadata, not through `OrganizationModel` mapping tables.
11
+ Resources are governed descriptors in the Organization Model. The OM owns resource identity, System membership, owner role, and lifecycle status. Operations code imports those descriptors, attaches executable workflow or agent behavior, and exports a `DeploymentSpec` for deployment.
12
12
 
13
- ## 1. Author the resource
13
+ Do not keep a second identity catalog in operations. `DeploymentSpec` is the runtime/deploy assembly artifact; it should not be the place where a workflow ID is invented.
14
+
15
+ ## 1. Author the OM descriptor
16
+
17
+ Add the descriptor in `core/config/organization-model.ts`:
18
+
19
+ ```ts
20
+ import { defineResources } from '@elevasis/core/organization-model'
21
+
22
+ export const resourceDescriptors = defineResources({
23
+ myWorkflow: {
24
+ id: 'my-workflow',
25
+ kind: 'workflow',
26
+ systemId: 'sys.operations',
27
+ ownerRoleId: 'role-ops-lead',
28
+ status: 'active',
29
+ capabilityKey: 'operations.my-workflow'
30
+ }
31
+ })
32
+ ```
33
+
34
+ Then expose the descriptor catalog through the Organization Model:
35
+
36
+ ```ts
37
+ export const resourceGovernanceModel = {
38
+ systems: {
39
+ systems
40
+ },
41
+ resources: {
42
+ entries: Object.values(resourceDescriptors)
43
+ }
44
+ } as const
45
+ ```
46
+
47
+ Use `organizationModel.resources.entries` as the Resources descriptor catalog. `links[].nodeId` still uses the kind-prefixed graph grammar, such as `feature:sales.crm`, `integration:instantly`, or `capability:operations.queue.review`, when a runtime resource needs semantic graph binding.
48
+
49
+ ## 2. Author executable behavior
50
+
51
+ Operations code owns schemas, steps, handlers, triggers, and UI execution metadata. Import the descriptor and derive runtime identity from it at the binding boundary:
14
52
 
15
53
  ```ts
16
54
  import type { WorkflowDefinition } from '@elevasis/sdk'
55
+ import { resourceDescriptors } from '@core/config/organization-model'
17
56
 
18
57
  export const myWorkflow: WorkflowDefinition = {
19
58
  config: {
20
- resourceId: 'my-workflow',
59
+ resource: resourceDescriptors.myWorkflow,
60
+ resourceId: resourceDescriptors.myWorkflow.id,
21
61
  name: 'My Workflow',
22
- type: 'workflow',
62
+ type: resourceDescriptors.myWorkflow.kind,
23
63
  version: '1.0.0',
24
64
  status: 'dev',
25
65
  links: [{ nodeId: 'feature:operations', kind: 'operates-on' }],
@@ -46,17 +86,17 @@ export const myWorkflow: WorkflowDefinition = {
46
86
  }
47
87
  ```
48
88
 
49
- `links[].nodeId` uses the kind-prefixed graph grammar, such as `feature:sales.crm`, `integration:instantly`, or `capability:operations.queue.review`.
50
-
51
89
  `category` is one of `production`, `diagnostic`, `internal`, or `testing`.
52
90
 
53
- ## 2. Register in the deployment spec
91
+ ## 3. Register in the deployment spec
54
92
 
55
93
  ```ts
94
+ import { resourceGovernanceModel } from '@core/config/organization-model'
56
95
  import { myWorkflow } from './my-workflow/index.js'
57
96
 
58
97
  export const org = {
59
98
  version: '0.1.0',
99
+ organizationModel: resourceGovernanceModel,
60
100
  workflows: [myWorkflow],
61
101
  agents: []
62
102
  }
@@ -64,7 +104,7 @@ export const org = {
64
104
 
65
105
  Use `.js` extensions in TypeScript source imports for ESM compatibility.
66
106
 
67
- ## 3. Declare runtime relationships
107
+ ## 4. Declare runtime relationships
68
108
 
69
109
  Use `DeploymentSpec.relationships` for execution topology:
70
110
 
@@ -79,7 +119,7 @@ relationships: {
79
119
 
80
120
  Use `config.links` for semantic graph binding and `relationships` for runtime execution relationships.
81
121
 
82
- ## 4. Verify
122
+ ## 5. Verify
83
123
 
84
124
  ```bash
85
125
  pnpm -C operations check
@@ -84,13 +84,15 @@ The canonical transition workflow (see `packages/elevasis-operations/src/sales/c
84
84
  // operations/src/sales/crm/actions/move-to-proposal.ts
85
85
  import type { WorkflowDefinition } from '@elevasis/sdk'
86
86
  import { acqDb } from '@elevasis/sdk/worker'
87
+ import { resourceDescriptors } from '@core/config/organization-model'
87
88
  import { ActionWorkflowInputSchema, ActionWorkflowOutputSchema } from '../shared/action-workflow-schemas.js'
88
89
 
89
90
  export const moveToProposalWorkflow: WorkflowDefinition = {
90
91
  config: {
91
- resourceId: 'move_to_proposal-workflow',
92
+ resource: resourceDescriptors.moveToProposal,
93
+ resourceId: resourceDescriptors.moveToProposal.id,
92
94
  name: 'Move to Proposal',
93
- type: 'workflow',
95
+ type: resourceDescriptors.moveToProposal.kind,
94
96
  version: '1.0.0',
95
97
  status: 'prod',
96
98
  category: 'internal',
@@ -119,7 +121,7 @@ export const moveToProposalWorkflow: WorkflowDefinition = {
119
121
  }
120
122
  ```
121
123
 
122
- To add side effects (create a task, send a Slack message, log a deal activity), extend the handler before the `return`. The `resourceId` must match the action's `workflowId` in `DEFAULT_CRM_ACTIONS` from `@elevasis/sdk` exactly.
124
+ To add side effects (create a task, send a Slack message, log a deal activity), extend the handler before the `return`. The OM descriptor ID must match the action's `workflowId` in `DEFAULT_CRM_ACTIONS` from `@elevasis/sdk` exactly.
123
125
 
124
126
  Register the workflow in the operations manifest:
125
127
 
@@ -232,6 +234,7 @@ export type SendQuoteOutput = z.infer<typeof sendQuoteOutputSchema>
232
234
  // operations/src/sales/send-quote.ts
233
235
  import type { WorkflowDefinition } from '@elevasis/sdk'
234
236
  import { acqDb, createResendAdapter } from '@elevasis/sdk/worker'
237
+ import { resourceDescriptors } from '@core/config/organization-model'
235
238
  import {
236
239
  sendQuoteInputSchema,
237
240
  sendQuoteOutputSchema
@@ -239,9 +242,10 @@ import {
239
242
 
240
243
  export const sendQuoteWorkflow: WorkflowDefinition = {
241
244
  config: {
242
- resourceId: 'send-quote-workflow',
245
+ resource: resourceDescriptors.sendQuote,
246
+ resourceId: resourceDescriptors.sendQuote.id,
243
247
  name: 'Send Quote',
244
- type: 'workflow',
248
+ type: resourceDescriptors.sendQuote.kind,
245
249
  version: '1.0.0',
246
250
  status: 'dev',
247
251
  category: 'internal',
@@ -315,9 +319,11 @@ A custom `ActionDef` entry with `workflowId: 'send-quote-workflow'` can be rende
315
319
  import { Button } from '@mantine/core'
316
320
  import { useMutation } from '@tanstack/react-query'
317
321
  import { useElevasisServices } from '@elevasis/ui/provider'
322
+ import { resourceDescriptors } from '@core/config/organization-model'
318
323
 
319
324
  export function SendQuoteButton({ dealId }: { dealId: string }) {
320
325
  const { apiRequest, organizationId } = useElevasisServices()
326
+ const resourceId = resourceDescriptors.sendQuote.id
321
327
 
322
328
  const sendQuote = useMutation({
323
329
  mutationFn: async () => {
@@ -327,7 +333,7 @@ export function SendQuoteButton({ dealId }: { dealId: string }) {
327
333
  method: 'POST',
328
334
  body: JSON.stringify({
329
335
  resourceType: 'workflow',
330
- resourceId: 'send-quote-workflow',
336
+ resourceId,
331
337
  input: { dealId, organizationId }
332
338
  })
333
339
  })