@elevasis/sdk 1.20.2 → 1.22.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 (164) hide show
  1. package/dist/cli.cjs +4220 -1583
  2. package/dist/index.d.ts +1035 -481
  3. package/dist/index.js +7381 -4187
  4. package/dist/node/index.d.ts +1 -3
  5. package/dist/node/index.js +40 -49
  6. package/dist/test-utils/index.d.ts +699 -123
  7. package/dist/test-utils/index.js +3826 -630
  8. package/dist/worker/index.js +3616 -442
  9. package/package.json +3 -3
  10. package/reference/_navigation.md +9 -7
  11. package/reference/_reference-manifest.json +1 -1
  12. package/reference/claude-config/hooks/post-edit-validate.mjs +98 -98
  13. package/reference/claude-config/hooks/scaffold-registry-reminder.mjs +188 -188
  14. package/reference/claude-config/hooks/tool-failure-recovery.mjs +73 -73
  15. package/reference/claude-config/registries/graph-skills.json +4 -4
  16. package/reference/claude-config/registries/knowledge-flags.json +0 -2
  17. package/reference/claude-config/rules/active-change-index.md +80 -80
  18. package/reference/claude-config/rules/agent-start-here.md +277 -273
  19. package/reference/claude-config/rules/deployment.md +57 -57
  20. package/reference/claude-config/rules/error-handling.md +56 -56
  21. package/reference/claude-config/rules/execution.md +40 -40
  22. package/reference/claude-config/rules/frontend.md +4 -4
  23. package/reference/claude-config/rules/observability.md +31 -31
  24. package/reference/claude-config/rules/operations.md +29 -17
  25. package/reference/claude-config/rules/organization-model.md +108 -40
  26. package/reference/claude-config/rules/organization-os.md +115 -113
  27. package/reference/claude-config/rules/package-taxonomy.md +33 -33
  28. package/reference/claude-config/rules/platform.md +42 -42
  29. package/reference/claude-config/rules/shared-types.md +49 -46
  30. package/reference/claude-config/rules/task-tracking.md +47 -47
  31. package/reference/claude-config/rules/ui.md +200 -200
  32. package/reference/claude-config/rules/vibe.md +235 -231
  33. package/reference/claude-config/scripts/statusline-command.js +18 -18
  34. package/reference/claude-config/settings.json +34 -34
  35. package/reference/claude-config/skills/deploy/{SKILL.md → skill.md} +156 -156
  36. package/reference/claude-config/skills/dsp/SKILL.md +66 -66
  37. package/reference/claude-config/skills/elevasis/SKILL.md +235 -235
  38. package/reference/claude-config/skills/explore/SKILL.md +6 -6
  39. package/reference/claude-config/skills/git-sync/SKILL.md +126 -126
  40. package/reference/claude-config/skills/knowledge/SKILL.md +330 -271
  41. package/reference/claude-config/skills/knowledge/operations/codify-level-a.md +100 -100
  42. package/reference/claude-config/skills/knowledge/operations/codify-level-b.md +159 -158
  43. package/reference/claude-config/skills/knowledge/operations/customers.md +109 -109
  44. package/reference/claude-config/skills/knowledge/operations/features.md +76 -113
  45. package/reference/claude-config/skills/knowledge/operations/goals.md +118 -118
  46. package/reference/claude-config/skills/knowledge/operations/identity.md +93 -93
  47. package/reference/claude-config/skills/knowledge/operations/labels.md +94 -89
  48. package/reference/claude-config/skills/knowledge/operations/offerings.md +109 -109
  49. package/reference/claude-config/skills/knowledge/operations/roles.md +99 -99
  50. package/reference/claude-config/skills/knowledge/operations/techStack.md +30 -30
  51. package/reference/claude-config/skills/project/SKILL.md +1088 -1088
  52. package/reference/claude-config/skills/run-ui/SKILL.md +73 -73
  53. package/reference/claude-config/skills/save/SKILL.md +3 -3
  54. package/reference/claude-config/skills/setup/SKILL.md +275 -275
  55. package/reference/claude-config/skills/status/SKILL.md +59 -59
  56. package/reference/claude-config/skills/submit-request/SKILL.md +180 -180
  57. package/reference/claude-config/skills/sync/SKILL.md +47 -47
  58. package/reference/claude-config/skills/tutorial/SKILL.md +259 -259
  59. package/reference/claude-config/skills/tutorial/progress-template.md +74 -74
  60. package/reference/claude-config/skills/tutorial/technical.md +1303 -1306
  61. package/reference/claude-config/skills/tutorial/vibe-coder.md +890 -890
  62. package/reference/claude-config/sync-notes/2026-04-22-git-sync-and-sync-notes.md +27 -27
  63. package/reference/claude-config/sync-notes/2026-04-22-lead-gen-deliverability-removal.md +30 -30
  64. package/reference/claude-config/sync-notes/2026-04-24-test-utils-and-template-tests.md +73 -73
  65. package/reference/claude-config/sync-notes/2026-04-24-ui-consolidation-and-sdk-cli-train.md +86 -86
  66. package/reference/claude-config/sync-notes/2026-04-25-auth-role-system-and-settings-roles.md +55 -55
  67. package/reference/claude-config/sync-notes/2026-04-27-crm-hitl-action-layer-cutover.md +97 -97
  68. package/reference/claude-config/sync-notes/2026-04-27-lead-gen-substrate-train.md +112 -112
  69. package/reference/claude-config/sync-notes/2026-04-29-crm-state-and-lead-gen-processing-status.md +93 -93
  70. package/reference/claude-config/sync-notes/2026-05-02-crm-ownership-next-action.md +58 -58
  71. package/reference/claude-config/sync-notes/2026-05-02-template-hardcode-workos-config.md +56 -56
  72. package/reference/claude-config/sync-notes/2026-05-04-elevasis-workspace.md +71 -71
  73. package/reference/claude-config/sync-notes/2026-05-04-knowledge-bundle.md +83 -83
  74. package/reference/claude-config/sync-notes/2026-05-04-template-skills-run-ui-and-tutorial.md +59 -59
  75. package/reference/claude-config/sync-notes/2026-05-05-list-builder.md +42 -42
  76. package/reference/claude-config/sync-notes/2026-05-06-crm-spine.md +60 -60
  77. package/reference/claude-config/sync-notes/2026-05-06-sdk-changes-release-train.md +37 -37
  78. package/reference/claude-config/sync-notes/2026-05-07-sdk-changes-release-train.md +34 -34
  79. package/reference/claude-config/sync-notes/2026-05-08-resource-governance-scaffold-guidance.md +38 -38
  80. package/reference/claude-config/sync-notes/2026-05-09-clients-domain.md +32 -32
  81. package/reference/claude-config/sync-notes/2026-05-09-command-system.md +33 -33
  82. package/reference/claude-config/sync-notes/2026-05-09-resource-governance-and-misc.md +69 -69
  83. package/reference/claude-config/sync-notes/2026-05-12-sdk-ready-release-train.md +30 -0
  84. package/reference/claude-config/sync-notes/2026-05-14-organization-model-ontology-refactor.md +42 -0
  85. package/reference/claude-config/sync-notes/README.md +43 -43
  86. package/reference/cli.mdx +808 -668
  87. package/reference/concepts.mdx +146 -146
  88. package/reference/deployment/api.mdx +297 -297
  89. package/reference/deployment/command-center.mdx +209 -209
  90. package/reference/deployment/index.mdx +195 -195
  91. package/reference/deployment/provided-features.mdx +107 -93
  92. package/reference/deployment/ui-execution.mdx +250 -250
  93. package/reference/examples/organization-model.ts +147 -84
  94. package/reference/framework/agent.mdx +156 -156
  95. package/reference/framework/index.mdx +195 -195
  96. package/reference/framework/interaction-guidance.mdx +182 -182
  97. package/reference/framework/memory.mdx +326 -326
  98. package/reference/framework/project-structure.mdx +282 -282
  99. package/reference/framework/tutorial-system.mdx +135 -135
  100. package/reference/getting-started.mdx +142 -142
  101. package/reference/index.mdx +106 -106
  102. package/reference/packages/core/src/README.md +14 -14
  103. package/reference/packages/core/src/business/README.md +2 -2
  104. package/reference/packages/core/src/knowledge/README.md +33 -32
  105. package/reference/packages/core/src/organization-model/README.md +149 -109
  106. package/reference/packages/core/src/test-utils/README.md +37 -37
  107. package/reference/packages/ui/src/api/README.md +18 -18
  108. package/reference/packages/ui/src/app/README.md +24 -24
  109. package/reference/packages/ui/src/auth/README.md +18 -18
  110. package/reference/packages/ui/src/components/README.md +24 -24
  111. package/reference/packages/ui/src/execution/README.md +16 -16
  112. package/reference/packages/ui/src/features/README.md +28 -28
  113. package/reference/packages/ui/src/graph/README.md +16 -16
  114. package/reference/packages/ui/src/hooks/README.md +23 -23
  115. package/reference/packages/ui/src/initialization/README.md +19 -19
  116. package/reference/packages/ui/src/knowledge/README.md +31 -31
  117. package/reference/packages/ui/src/organization/README.md +18 -18
  118. package/reference/packages/ui/src/profile/README.md +19 -19
  119. package/reference/packages/ui/src/provider/README.md +32 -32
  120. package/reference/packages/ui/src/router/README.md +18 -18
  121. package/reference/packages/ui/src/sse/README.md +13 -13
  122. package/reference/packages/ui/src/test-utils/README.md +7 -7
  123. package/reference/packages/ui/src/theme/README.md +23 -23
  124. package/reference/packages/ui/src/theme/presets/README.md +19 -19
  125. package/reference/packages/ui/src/types/README.md +16 -16
  126. package/reference/packages/ui/src/utils/README.md +18 -18
  127. package/reference/packages/ui/src/zustand/README.md +18 -18
  128. package/reference/platform-tools/adapters-integration.mdx +301 -301
  129. package/reference/platform-tools/adapters-platform.mdx +553 -553
  130. package/reference/platform-tools/index.mdx +217 -217
  131. package/reference/platform-tools/type-safety.mdx +82 -82
  132. package/reference/resources/index.mdx +349 -349
  133. package/reference/resources/patterns.mdx +449 -449
  134. package/reference/resources/types.mdx +116 -116
  135. package/reference/roadmap.mdx +165 -165
  136. package/reference/runtime.mdx +173 -173
  137. package/reference/scaffold/core/organization-graph.mdx +110 -89
  138. package/reference/scaffold/core/organization-model.mdx +226 -171
  139. package/reference/scaffold/index.mdx +67 -67
  140. package/reference/scaffold/operations/propagation-pipeline.md +77 -77
  141. package/reference/scaffold/operations/scaffold-maintenance.md +10 -10
  142. package/reference/scaffold/operations/workflow-recipes.md +138 -138
  143. package/reference/scaffold/recipes/add-a-feature.md +310 -88
  144. package/reference/scaffold/recipes/add-a-resource.md +137 -117
  145. package/reference/scaffold/recipes/customize-crm-actions.md +439 -439
  146. package/reference/scaffold/recipes/customize-knowledge-browser.md +384 -0
  147. package/reference/scaffold/recipes/customize-organization-model.md +281 -118
  148. package/reference/scaffold/recipes/extend-a-base-entity.md +8 -8
  149. package/reference/scaffold/recipes/extend-crm.md +40 -39
  150. package/reference/scaffold/recipes/extend-lead-gen.md +400 -401
  151. package/reference/scaffold/recipes/gate-by-feature-or-admin.md +118 -114
  152. package/reference/scaffold/recipes/index.md +47 -46
  153. package/reference/scaffold/recipes/query-the-knowledge-graph.md +227 -0
  154. package/reference/scaffold/reference/contracts.md +2389 -2121
  155. package/reference/scaffold/reference/feature-registry.md +9 -20
  156. package/reference/scaffold/reference/glossary.md +76 -76
  157. package/reference/scaffold/ui/composition-extensibility.mdx +233 -233
  158. package/reference/scaffold/ui/customization.md +243 -243
  159. package/reference/scaffold/ui/feature-flags-and-gating.md +46 -46
  160. package/reference/scaffold/ui/feature-shell.mdx +72 -72
  161. package/reference/scaffold/ui/recipes.md +221 -213
  162. package/reference/spine/spine-primer.md +96 -96
  163. package/reference/templates/index.mdx +47 -47
  164. package/reference/troubleshooting.mdx +223 -223
@@ -1,116 +1,116 @@
1
- ---
2
- title: SDK Types
3
- description: Type reference for @elevasis/sdk package exports, resource metadata, platform types, ElevasConfig, StepHandler context, and runtime values.
4
- loadWhen: "Looking up type signatures or SDK exports"
5
- ---
6
-
7
- `@elevasis/sdk` bundles platform types into a self-contained package for external projects.
8
-
9
- ```bash
10
- pnpm add @elevasis/sdk zod
11
- ```
12
-
13
- Zod is a peer dependency.
14
-
15
- ## Package Exports
16
-
17
- ```json
18
- {
19
- "exports": {
20
- ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" },
21
- "./worker": { "import": "./dist/worker/index.js" }
22
- }
23
- }
24
- ```
25
-
26
- - `@elevasis/sdk` -- resource, workflow, agent, trigger, deployment, and execution types plus runtime errors.
27
- - `@elevasis/sdk/worker` -- worker runtime module, platform adapters, and worker helpers.
28
-
29
- ## Platform Types
30
-
31
- | Type | Description |
32
- | --- | --- |
33
- | `ResourceDefinition` | Base interface for resource definitions |
34
- | `ResourceType` | Resource kind such as `workflow`, `agent`, `trigger`, `integration`, `external`, or `human_checkpoint` |
35
- | `ResourceStatus` | Resource lifecycle status such as `dev` or `prod` |
36
- | `ResourceLink` | Graph link `{ nodeId, kind }` binding a resource to an Organization Model node |
37
- | `ResourceCategory` | Operational category: `production`, `diagnostic`, `internal`, or `testing` |
38
- | `DeploymentSpec` | Top-level export shape: `{ workflows, agents, triggers, integrations, humanCheckpoints, externalResources, relationships }` |
39
- | `TriggerDefinition` | Base for trigger configuration |
40
- | `IntegrationDefinition` | Integration configuration structure |
41
- | `WebhookProviderType` | Supported webhook providers |
42
- | `WebhookTriggerConfig` | Webhook trigger configuration |
43
- | `ScheduleTriggerConfig` | Cron/schedule trigger configuration |
44
- | `EventTriggerConfig` | Internal event trigger configuration |
45
- | `TriggerConfig` | Union of all trigger config types |
46
-
47
- Resource metadata uses graph links:
48
-
49
- ```ts
50
- config: {
51
- resourceId: 'lead-import',
52
- name: 'Lead Import',
53
- type: 'workflow',
54
- version: '1.0.0',
55
- status: 'prod',
56
- links: [{ nodeId: 'feature:sales.lead-gen', kind: 'operates-on' }],
57
- category: 'production'
58
- }
59
- ```
60
-
61
- ## Execution Types
62
-
63
- | Type | Description |
64
- | --- | --- |
65
- | `WorkflowDefinition` | Complete workflow definition including config, contract, steps, and entryPoint |
66
- | `WorkflowStep` | Individual step definition with type, handler, and next routing |
67
- | `WorkflowConfig` | Metadata block: name, description, status, links, category |
68
- | `StepHandler` | Function type: `(input: unknown, context: StepContext) => Promise<unknown>` |
69
- | `NextConfig` | Union of `LinearNext` and `ConditionalNext` |
70
- | `LinearNext` | Fixed next step routing |
71
- | `ConditionalNext` | Branching step routing |
72
- | `StepType` | Runtime enum for step routing |
73
- | `AgentDefinition` | Complete agent definition including config, agentConfig, and tools |
74
- | `ExecutionContext` | Runtime context passed to step handlers |
75
- | `ExecutionMetadata` | Metadata about a running execution |
76
- | `ExecutionInterface` | Interface for triggering and inspecting executions |
77
-
78
- ## ElevasConfig
79
-
80
- ```ts
81
- export interface ElevasConfig {
82
- defaultStatus?: ResourceStatus
83
- dev?: { port?: number }
84
- }
85
- ```
86
-
87
- | Field | Type | Default | Description |
88
- | --- | --- | --- | --- |
89
- | `defaultStatus` | `'dev' | 'prod'` | `'prod'` | Default status applied when resources do not set `config.status` |
90
- | `dev.port` | `number` | `3001` | Local worker development port |
91
-
92
- ## StepHandler Context
93
-
94
- ```ts
95
- import type { StepHandler, ExecutionContext } from '@elevasis/sdk'
96
-
97
- const handler: StepHandler = async (input, context: ExecutionContext) => {
98
- context.logger.info('Processing', {
99
- executionId: context.executionId,
100
- resourceId: context.resourceId
101
- })
102
-
103
- await context.store.set('checkpoint', JSON.stringify({ step: 'started' }))
104
- return { done: true }
105
- }
106
- ```
107
-
108
- ## Runtime Values
109
-
110
- Runtime exports include:
111
-
112
- - `StepType`
113
- - `ToolingError`
114
- - `ExecutionError`
115
-
116
- Use `ToolingError` for platform adapter failures and `ExecutionError` for execution-level failures that should be surfaced in run history.
1
+ ---
2
+ title: SDK Types
3
+ description: Type reference for @elevasis/sdk package exports, resource metadata, platform types, ElevasConfig, StepHandler context, and runtime values.
4
+ loadWhen: "Looking up type signatures or SDK exports"
5
+ ---
6
+
7
+ `@elevasis/sdk` bundles platform types into a self-contained package for external projects.
8
+
9
+ ```bash
10
+ pnpm add @elevasis/sdk zod
11
+ ```
12
+
13
+ Zod is a peer dependency.
14
+
15
+ ## Package Exports
16
+
17
+ ```json
18
+ {
19
+ "exports": {
20
+ ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" },
21
+ "./worker": { "import": "./dist/worker/index.js" }
22
+ }
23
+ }
24
+ ```
25
+
26
+ - `@elevasis/sdk` -- resource, workflow, agent, trigger, deployment, and execution types plus runtime errors.
27
+ - `@elevasis/sdk/worker` -- worker runtime module, platform adapters, and worker helpers.
28
+
29
+ ## Platform Types
30
+
31
+ | Type | Description |
32
+ | --- | --- |
33
+ | `ResourceDefinition` | Base interface for resource definitions |
34
+ | `ResourceType` | Resource kind such as `workflow`, `agent`, `trigger`, `integration`, `external`, or `human_checkpoint` |
35
+ | `ResourceStatus` | Resource lifecycle status such as `dev` or `prod` |
36
+ | `ResourceLink` | Graph link `{ nodeId, kind }` binding a resource to an Organization Model node |
37
+ | `ResourceCategory` | Operational category: `production`, `diagnostic`, `internal`, or `testing` |
38
+ | `DeploymentSpec` | Top-level export shape: `{ workflows, agents, triggers, integrations, humanCheckpoints, externalResources, relationships }` |
39
+ | `TriggerDefinition` | Base for trigger configuration |
40
+ | `IntegrationDefinition` | Integration configuration structure |
41
+ | `WebhookProviderType` | Supported webhook providers |
42
+ | `WebhookTriggerConfig` | Webhook trigger configuration |
43
+ | `ScheduleTriggerConfig` | Cron/schedule trigger configuration |
44
+ | `EventTriggerConfig` | Internal event trigger configuration |
45
+ | `TriggerConfig` | Union of all trigger config types |
46
+
47
+ Resource metadata uses graph links:
48
+
49
+ ```ts
50
+ config: {
51
+ resourceId: 'lead-import',
52
+ name: 'Lead Import',
53
+ type: 'workflow',
54
+ version: '1.0.0',
55
+ status: 'prod',
56
+ links: [{ nodeId: 'system:sales.lead-gen', kind: 'operates-on' }],
57
+ category: 'production'
58
+ }
59
+ ```
60
+
61
+ ## Execution Types
62
+
63
+ | Type | Description |
64
+ | --- | --- |
65
+ | `WorkflowDefinition` | Complete workflow definition including config, contract, steps, and entryPoint |
66
+ | `WorkflowStep` | Individual step definition with type, handler, and next routing |
67
+ | `WorkflowConfig` | Metadata block: name, description, status, links, category |
68
+ | `StepHandler` | Function type: `(input: unknown, context: StepContext) => Promise<unknown>` |
69
+ | `NextConfig` | Union of `LinearNext` and `ConditionalNext` |
70
+ | `LinearNext` | Fixed next step routing |
71
+ | `ConditionalNext` | Branching step routing |
72
+ | `StepType` | Runtime enum for step routing |
73
+ | `AgentDefinition` | Complete agent definition including config, agentConfig, and tools |
74
+ | `ExecutionContext` | Runtime context passed to step handlers |
75
+ | `ExecutionMetadata` | Metadata about a running execution |
76
+ | `ExecutionInterface` | Interface for triggering and inspecting executions |
77
+
78
+ ## ElevasConfig
79
+
80
+ ```ts
81
+ export interface ElevasConfig {
82
+ defaultStatus?: ResourceStatus
83
+ dev?: { port?: number }
84
+ }
85
+ ```
86
+
87
+ | Field | Type | Default | Description |
88
+ | --- | --- | --- | --- |
89
+ | `defaultStatus` | `'dev' | 'prod'` | `'prod'` | Default status applied when resources do not set `config.status` |
90
+ | `dev.port` | `number` | `3001` | Local worker development port |
91
+
92
+ ## StepHandler Context
93
+
94
+ ```ts
95
+ import type { StepHandler, ExecutionContext } from '@elevasis/sdk'
96
+
97
+ const handler: StepHandler = async (input, context: ExecutionContext) => {
98
+ context.logger.info('Processing', {
99
+ executionId: context.executionId,
100
+ resourceId: context.resourceId
101
+ })
102
+
103
+ await context.store.set('checkpoint', JSON.stringify({ step: 'started' }))
104
+ return { done: true }
105
+ }
106
+ ```
107
+
108
+ ## Runtime Values
109
+
110
+ Runtime exports include:
111
+
112
+ - `StepType`
113
+ - `ToolingError`
114
+ - `ExecutionError`
115
+
116
+ Use `ToolingError` for platform adapter failures and `ExecutionError` for execution-level failures that should be surfaced in run history.
@@ -1,165 +1,165 @@
1
- ---
2
- title: Roadmap
3
- description: Planned SDK features -- error taxonomy, retry semantics, circuit breaker, metrics, alerting, and resource lifecycle extensions
4
- loadWhen: "Asking about future features or planned capabilities"
5
- ---
6
-
7
- **Status:** Mixed -- some features below are implemented, others remain planned. Each section notes its current status.
8
-
9
- For currently implemented behavior, see [Runtime](runtime.mdx).
10
-
11
- ---
12
-
13
- ## Structured Error Taxonomy
14
-
15
- **Status: Partially implemented.** The runtime has a structured error hierarchy (`ExecutionError`, `PlatformToolError`, `ToolingError`) with error codes and context fields. The taxonomy below describes a planned _redesign_ that is not yet implemented.
16
-
17
- The current runtime reports errors as plain strings. A future SDK version will introduce a structured error taxonomy. All SDK errors will extend `ResourceError`, the base class for errors surfaced through the execution protocol.
18
-
19
- Every error carries: `message` (string), `code` (string enum), `details` (optional structured data), and `retryable` (boolean).
20
-
21
- **Error types:**
22
-
23
- - **`ResourceError`** -- Base class for all SDK errors
24
- - **`ValidationError`** -- Input or output schema validation failed. Thrown automatically when Zod `.parse()` fails. Code: `VALIDATION_ERROR`. Not retryable.
25
- - **`StepError`** -- A workflow step handler threw. Includes `stepId` and `stepName`. Code: `STEP_ERROR`. Retryable (transient failures may succeed on retry).
26
- - **`ToolError`** -- A tool execution failed. Includes `toolName`. Code: `TOOL_ERROR`. Retryability depends on the underlying error.
27
- - **`TimeoutError`** -- Execution exceeded the deadline. Code: `TIMEOUT`. Retryable.
28
- - **`CancellationError`** -- Execution was cancelled by the platform or user. Code: `CANCELLED`. Not retryable.
29
-
30
- ---
31
-
32
- ## Retry Semantics
33
-
34
- **Status: Planned.**
35
-
36
- Retries are platform-side only -- workers are ephemeral and never retry internally.
37
-
38
- - **Configuration:** Per-resource via `maxRetries` (default: 0) and `backoffStrategy` (exponential with jitter)
39
- - **Retryable conditions:** Worker crash or timeout (worker terminated by `AbortSignal`)
40
- - **Non-retryable conditions:** Worker reports `status: 'failed'` (handler ran and returned an error -- application logic, not infrastructure failure), user cancellation
41
- - **Idempotency:** On retry, the same `executionId` is reused. Design handlers to be idempotent where possible.
42
-
43
- ---
44
-
45
- ## Workflow Step Failure
46
-
47
- **Status: Planned.** The current runtime uses fail-fast behavior: when a step handler throws, the worker logs a `step-failed` context entry and re-throws the original error unchanged. The `onError` callback, `completedSteps`, and `partialOutput` features described below are not yet implemented.
48
-
49
- Default behavior is fail-fast: when a step throws, the workflow fails immediately.
50
-
51
- - **Error handler:** Optional `onError` callback per step. The callback receives the error and can return a recovery value or rethrow to propagate the failure.
52
- - **Partial output:** Steps completed before the failure are included in the error response. The platform receives: `failedStepId`, `completedSteps[]` (IDs of successfully completed steps), and `partialOutput` (the last successful step's output).
53
-
54
- **Proposed step error response format** (not yet implemented -- subject to change):
55
-
56
- ```json
57
- {
58
- "status": "failed",
59
- "error": {
60
- "code": "STEP_ERROR",
61
- "message": "Email delivery failed: invalid address",
62
- "stepId": "send-welcome",
63
- "stepName": "Send Welcome Email"
64
- },
65
- "completedSteps": ["validate"],
66
- "partialOutput": { "clientName": "Jane", "isValid": true }
67
- }
68
- ```
69
-
70
- ---
71
-
72
- ## Agent Failure Modes
73
-
74
- **Status: Planned.** Agent execution runs in ephemeral worker threads with full tool calling support via `PostMessageLLMAdapter`. The current runtime uses fail-fast behavior for all agent error paths; the richer failure handling described below is not yet implemented.
75
-
76
- **Current behavior:** Any unhandled error from the agent (including `AgentMaxIterationsError` thrown by `@repo/core` when the iteration limit is reached) propagates out of the worker and is reported as a failed execution. The worker sends: `{ type: 'result', status: 'failed', error: 'ErrorName: message', logs, metrics: { durationMs } }`. There is no graceful termination, partial output, or retry logic in the worker itself.
77
-
78
- **Planned improvements:**
79
-
80
- - **Max iterations reached:** Instead of throwing, the agent returns the best output produced so far, plus a warning flag (`maxIterationsReached: true`). This becomes a graceful termination rather than a failure.
81
- - **Tool crash:** Tool errors are caught by the SDK runtime, formatted as a tool result, and sent back to the LLM. The LLM decides whether to retry, try a different approach, or give up.
82
- - **Model refusal:** If the model refuses the prompt, the SDK retries once with an adjusted system prompt. If the retry also refuses, the agent fails with `code: 'MODEL_REFUSAL'`.
83
- - **Model API error:** Network errors, rate limits, or server errors from the model provider. The SDK retries with exponential backoff (3 attempts, 1s/2s/4s), then fails with `code: 'MODEL_ERROR'`.
84
- - **Agent error response includes:** `iterationCount` (LLM iterations completed), `toolCallHistory` (array of tool calls made), `lastModelResponse` (final response from the LLM before failure).
85
-
86
- ---
87
-
88
- ## Circuit Breaker
89
-
90
- **Status: Planned.**
91
-
92
- The platform will implement a circuit breaker to prevent runaway failures:
93
-
94
- - **Trip condition:** 5 consecutive failures on the same resource within a 10-minute window
95
- - **Action:** Pause executions for 60 seconds. New execution requests for that resource return `503` with: "Resource temporarily unavailable (circuit breaker tripped)"
96
- - **Auto-recovery:** After the 60-second pause, the next execution attempt is allowed through. If it succeeds, the circuit breaker resets. If it fails, the pause extends (120s, then 240s, capped at 5 minutes).
97
- - **Alerting:** You are notified via webhook callback or email when the circuit breaker trips. Configurable per organization.
98
-
99
- ---
100
-
101
- ## Metrics
102
-
103
- **Status: Planned.**
104
-
105
- ### Auto-Collected
106
-
107
- The SDK runtime and platform will automatically collect these metrics for every execution:
108
-
109
- - `execution_duration_ms` -- Total wall-clock time from request received to result sent
110
- - `step_duration_ms` -- Per-step timing for workflows (array of `{ stepId, durationMs }`)
111
- - `iteration_count` -- Number of LLM loop iterations for agents
112
- - `ai_token_usage` -- Token counts per model call: `{ prompt_tokens, completion_tokens, total_tokens }`
113
- - `ai_cost_usd` -- Calculated from model pricing multiplied by token usage
114
- - `tool_call_count` -- Total number of tool invocations during the execution
115
- - `tool_call_duration_ms` -- Per-tool timing (array of `{ toolName, durationMs }`)
116
- - `error_count` -- Number of errors encountered (including recovered errors)
117
-
118
- ### Cost Attribution
119
-
120
- Metrics are aggregated at multiple levels:
121
-
122
- - **Per-execution:** Total AI spend and total duration
123
- - **Per-resource:** Aggregated over configurable time periods (daily, weekly, monthly)
124
- - **Per-organization:** Total platform cost (execution time + AI spend + managed hosting compute)
125
- - **Visibility:** Platform dashboard and the CLI via `elevasis-sdk executions <resourceId>`
126
-
127
- ### Developer-Defined Metrics
128
-
129
- A future SDK version will support custom metrics emitted from your handlers:
130
-
131
- - `sdk.metrics.counter('custom_name', value)` -- Increment a counter
132
- - `sdk.metrics.gauge('queue_depth', value)` -- Set a point-in-time gauge value
133
- - Custom metrics are stored alongside auto-collected metrics and queryable through the same APIs
134
-
135
- ---
136
-
137
- ## Alerting
138
-
139
- **Status: Planned.**
140
-
141
- Developer-configurable alerts for production monitoring:
142
-
143
- - **Error rate threshold:** Notify when more than X% of executions fail within Y minutes
144
- - **Latency percentile:** Notify when p95 execution duration exceeds a threshold
145
- - **Cost budget:** Notify when daily or weekly AI spend exceeds a configured limit
146
- - **Channel:** Webhook callback to a developer-provided URL (integrates with Slack, PagerDuty, and similar services via webhook)
147
-
148
- ---
149
-
150
- ## Resource Lifecycle Extensions
151
-
152
- **Status: Planned.**
153
-
154
- ### Deprecation Status
155
-
156
- Beyond the current `dev` and `prod` statuses, two additional statuses are planned:
157
-
158
- - **`deprecated`** -- Marked via the platform UI. Existing executions continue working. New executions show a warning: "This resource is deprecated." The resource still appears in the platform and can still be triggered.
159
- - **`offline`** -- Set automatically when a deployment is unregistered (for example, after a failed deploy or explicit deletion). Clears automatically on the next successful deploy. No executions are accepted while a resource is offline.
160
-
161
- Deprecation requires no automatic removal -- the developer must explicitly delete the resource to remove it.
162
-
163
- ---
164
-
165
- **Last Updated:** 2026-03-08
1
+ ---
2
+ title: Roadmap
3
+ description: Planned SDK features -- error taxonomy, retry semantics, circuit breaker, metrics, alerting, and resource lifecycle extensions
4
+ loadWhen: "Asking about future features or planned capabilities"
5
+ ---
6
+
7
+ **Status:** Mixed -- some features below are implemented, others remain planned. Each section notes its current status.
8
+
9
+ For currently implemented behavior, see [Runtime](runtime.mdx).
10
+
11
+ ---
12
+
13
+ ## Structured Error Taxonomy
14
+
15
+ **Status: Partially implemented.** The runtime has a structured error hierarchy (`ExecutionError`, `PlatformToolError`, `ToolingError`) with error codes and context fields. The taxonomy below describes a planned _redesign_ that is not yet implemented.
16
+
17
+ The current runtime reports errors as plain strings. A future SDK version will introduce a structured error taxonomy. All SDK errors will extend `ResourceError`, the base class for errors surfaced through the execution protocol.
18
+
19
+ Every error carries: `message` (string), `code` (string enum), `details` (optional structured data), and `retryable` (boolean).
20
+
21
+ **Error types:**
22
+
23
+ - **`ResourceError`** -- Base class for all SDK errors
24
+ - **`ValidationError`** -- Input or output schema validation failed. Thrown automatically when Zod `.parse()` fails. Code: `VALIDATION_ERROR`. Not retryable.
25
+ - **`StepError`** -- A workflow step handler threw. Includes `stepId` and `stepName`. Code: `STEP_ERROR`. Retryable (transient failures may succeed on retry).
26
+ - **`ToolError`** -- A tool execution failed. Includes `toolName`. Code: `TOOL_ERROR`. Retryability depends on the underlying error.
27
+ - **`TimeoutError`** -- Execution exceeded the deadline. Code: `TIMEOUT`. Retryable.
28
+ - **`CancellationError`** -- Execution was cancelled by the platform or user. Code: `CANCELLED`. Not retryable.
29
+
30
+ ---
31
+
32
+ ## Retry Semantics
33
+
34
+ **Status: Planned.**
35
+
36
+ Retries are platform-side only -- workers are ephemeral and never retry internally.
37
+
38
+ - **Configuration:** Per-resource via `maxRetries` (default: 0) and `backoffStrategy` (exponential with jitter)
39
+ - **Retryable conditions:** Worker crash or timeout (worker terminated by `AbortSignal`)
40
+ - **Non-retryable conditions:** Worker reports `status: 'failed'` (handler ran and returned an error -- application logic, not infrastructure failure), user cancellation
41
+ - **Idempotency:** On retry, the same `executionId` is reused. Design handlers to be idempotent where possible.
42
+
43
+ ---
44
+
45
+ ## Workflow Step Failure
46
+
47
+ **Status: Planned.** The current runtime uses fail-fast behavior: when a step handler throws, the worker logs a `step-failed` context entry and re-throws the original error unchanged. The `onError` callback, `completedSteps`, and `partialOutput` features described below are not yet implemented.
48
+
49
+ Default behavior is fail-fast: when a step throws, the workflow fails immediately.
50
+
51
+ - **Error handler:** Optional `onError` callback per step. The callback receives the error and can return a recovery value or rethrow to propagate the failure.
52
+ - **Partial output:** Steps completed before the failure are included in the error response. The platform receives: `failedStepId`, `completedSteps[]` (IDs of successfully completed steps), and `partialOutput` (the last successful step's output).
53
+
54
+ **Proposed step error response format** (not yet implemented -- subject to change):
55
+
56
+ ```json
57
+ {
58
+ "status": "failed",
59
+ "error": {
60
+ "code": "STEP_ERROR",
61
+ "message": "Email delivery failed: invalid address",
62
+ "stepId": "send-welcome",
63
+ "stepName": "Send Welcome Email"
64
+ },
65
+ "completedSteps": ["validate"],
66
+ "partialOutput": { "clientName": "Jane", "isValid": true }
67
+ }
68
+ ```
69
+
70
+ ---
71
+
72
+ ## Agent Failure Modes
73
+
74
+ **Status: Planned.** Agent execution runs in ephemeral worker threads with full tool calling support via `PostMessageLLMAdapter`. The current runtime uses fail-fast behavior for all agent error paths; the richer failure handling described below is not yet implemented.
75
+
76
+ **Current behavior:** Any unhandled error from the agent (including `AgentMaxIterationsError` thrown by `@repo/core` when the iteration limit is reached) propagates out of the worker and is reported as a failed execution. The worker sends: `{ type: 'result', status: 'failed', error: 'ErrorName: message', logs, metrics: { durationMs } }`. There is no graceful termination, partial output, or retry logic in the worker itself.
77
+
78
+ **Planned improvements:**
79
+
80
+ - **Max iterations reached:** Instead of throwing, the agent returns the best output produced so far, plus a warning flag (`maxIterationsReached: true`). This becomes a graceful termination rather than a failure.
81
+ - **Tool crash:** Tool errors are caught by the SDK runtime, formatted as a tool result, and sent back to the LLM. The LLM decides whether to retry, try a different approach, or give up.
82
+ - **Model refusal:** If the model refuses the prompt, the SDK retries once with an adjusted system prompt. If the retry also refuses, the agent fails with `code: 'MODEL_REFUSAL'`.
83
+ - **Model API error:** Network errors, rate limits, or server errors from the model provider. The SDK retries with exponential backoff (3 attempts, 1s/2s/4s), then fails with `code: 'MODEL_ERROR'`.
84
+ - **Agent error response includes:** `iterationCount` (LLM iterations completed), `toolCallHistory` (array of tool calls made), `lastModelResponse` (final response from the LLM before failure).
85
+
86
+ ---
87
+
88
+ ## Circuit Breaker
89
+
90
+ **Status: Planned.**
91
+
92
+ The platform will implement a circuit breaker to prevent runaway failures:
93
+
94
+ - **Trip condition:** 5 consecutive failures on the same resource within a 10-minute window
95
+ - **Action:** Pause executions for 60 seconds. New execution requests for that resource return `503` with: "Resource temporarily unavailable (circuit breaker tripped)"
96
+ - **Auto-recovery:** After the 60-second pause, the next execution attempt is allowed through. If it succeeds, the circuit breaker resets. If it fails, the pause extends (120s, then 240s, capped at 5 minutes).
97
+ - **Alerting:** You are notified via webhook callback or email when the circuit breaker trips. Configurable per organization.
98
+
99
+ ---
100
+
101
+ ## Metrics
102
+
103
+ **Status: Planned.**
104
+
105
+ ### Auto-Collected
106
+
107
+ The SDK runtime and platform will automatically collect these metrics for every execution:
108
+
109
+ - `execution_duration_ms` -- Total wall-clock time from request received to result sent
110
+ - `step_duration_ms` -- Per-step timing for workflows (array of `{ stepId, durationMs }`)
111
+ - `iteration_count` -- Number of LLM loop iterations for agents
112
+ - `ai_token_usage` -- Token counts per model call: `{ prompt_tokens, completion_tokens, total_tokens }`
113
+ - `ai_cost_usd` -- Calculated from model pricing multiplied by token usage
114
+ - `tool_call_count` -- Total number of tool invocations during the execution
115
+ - `tool_call_duration_ms` -- Per-tool timing (array of `{ toolName, durationMs }`)
116
+ - `error_count` -- Number of errors encountered (including recovered errors)
117
+
118
+ ### Cost Attribution
119
+
120
+ Metrics are aggregated at multiple levels:
121
+
122
+ - **Per-execution:** Total AI spend and total duration
123
+ - **Per-resource:** Aggregated over configurable time periods (daily, weekly, monthly)
124
+ - **Per-organization:** Total platform cost (execution time + AI spend + managed hosting compute)
125
+ - **Visibility:** Platform dashboard and the CLI via `elevasis-sdk executions <resourceId>`
126
+
127
+ ### Developer-Defined Metrics
128
+
129
+ A future SDK version will support custom metrics emitted from your handlers:
130
+
131
+ - `sdk.metrics.counter('custom_name', value)` -- Increment a counter
132
+ - `sdk.metrics.gauge('queue_depth', value)` -- Set a point-in-time gauge value
133
+ - Custom metrics are stored alongside auto-collected metrics and queryable through the same APIs
134
+
135
+ ---
136
+
137
+ ## Alerting
138
+
139
+ **Status: Planned.**
140
+
141
+ Developer-configurable alerts for production monitoring:
142
+
143
+ - **Error rate threshold:** Notify when more than X% of executions fail within Y minutes
144
+ - **Latency percentile:** Notify when p95 execution duration exceeds a threshold
145
+ - **Cost budget:** Notify when daily or weekly AI spend exceeds a configured limit
146
+ - **Channel:** Webhook callback to a developer-provided URL (integrates with Slack, PagerDuty, and similar services via webhook)
147
+
148
+ ---
149
+
150
+ ## Resource Lifecycle Extensions
151
+
152
+ **Status: Planned.**
153
+
154
+ ### Deprecation Status
155
+
156
+ Beyond the current `dev` and `prod` statuses, two additional statuses are planned:
157
+
158
+ - **`deprecated`** -- Marked via the platform UI. Existing executions continue working. New executions show a warning: "This resource is deprecated." The resource still appears in the platform and can still be triggered.
159
+ - **`offline`** -- Set automatically when a deployment is unregistered (for example, after a failed deploy or explicit deletion). Clears automatically on the next successful deploy. No executions are accepted while a resource is offline.
160
+
161
+ Deprecation requires no automatic removal -- the developer must explicitly delete the resource to remove it.
162
+
163
+ ---
164
+
165
+ **Last Updated:** 2026-03-08