@elevasis/sdk 1.21.0 → 1.22.1

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 (160) hide show
  1. package/dist/cli.cjs +1239 -173
  2. package/dist/index.d.ts +1752 -464
  3. package/dist/index.js +3477 -143
  4. package/dist/node/index.d.ts +1 -0
  5. package/dist/node/index.js +19 -1
  6. package/dist/test-utils/index.d.ts +1188 -127
  7. package/dist/test-utils/index.js +3359 -152
  8. package/dist/worker/index.js +3148 -80
  9. package/package.json +2 -2
  10. package/reference/claude-config/hooks/post-edit-validate.mjs +98 -98
  11. package/reference/claude-config/hooks/scaffold-registry-reminder.mjs +188 -188
  12. package/reference/claude-config/hooks/tool-failure-recovery.mjs +73 -73
  13. package/reference/claude-config/registries/graph-skills.json +4 -4
  14. package/reference/claude-config/registries/knowledge-flags.json +0 -2
  15. package/reference/claude-config/rules/active-change-index.md +80 -80
  16. package/reference/claude-config/rules/agent-start-here.md +277 -277
  17. package/reference/claude-config/rules/deployment.md +57 -57
  18. package/reference/claude-config/rules/error-handling.md +56 -56
  19. package/reference/claude-config/rules/execution.md +40 -40
  20. package/reference/claude-config/rules/frontend.md +4 -4
  21. package/reference/claude-config/rules/observability.md +31 -31
  22. package/reference/claude-config/rules/operations.md +29 -17
  23. package/reference/claude-config/rules/organization-model.md +113 -81
  24. package/reference/claude-config/rules/organization-os.md +115 -113
  25. package/reference/claude-config/rules/package-taxonomy.md +33 -33
  26. package/reference/claude-config/rules/platform.md +42 -42
  27. package/reference/claude-config/rules/shared-types.md +49 -46
  28. package/reference/claude-config/rules/task-tracking.md +47 -47
  29. package/reference/claude-config/rules/ui.md +200 -200
  30. package/reference/claude-config/rules/vibe.md +235 -235
  31. package/reference/claude-config/scripts/statusline-command.js +18 -18
  32. package/reference/claude-config/settings.json +34 -34
  33. package/reference/claude-config/skills/deploy/{SKILL.md → skill.md} +156 -156
  34. package/reference/claude-config/skills/dsp/SKILL.md +66 -66
  35. package/reference/claude-config/skills/elevasis/SKILL.md +235 -235
  36. package/reference/claude-config/skills/explore/SKILL.md +6 -6
  37. package/reference/claude-config/skills/git-sync/SKILL.md +126 -126
  38. package/reference/claude-config/skills/knowledge/SKILL.md +314 -299
  39. package/reference/claude-config/skills/knowledge/operations/codify-level-a.md +100 -100
  40. package/reference/claude-config/skills/knowledge/operations/codify-level-b.md +159 -159
  41. package/reference/claude-config/skills/knowledge/operations/customers.md +109 -109
  42. package/reference/claude-config/skills/knowledge/operations/features.md +76 -76
  43. package/reference/claude-config/skills/knowledge/operations/goals.md +118 -118
  44. package/reference/claude-config/skills/knowledge/operations/identity.md +93 -93
  45. package/reference/claude-config/skills/knowledge/operations/labels.md +94 -94
  46. package/reference/claude-config/skills/knowledge/operations/offerings.md +109 -109
  47. package/reference/claude-config/skills/knowledge/operations/roles.md +99 -99
  48. package/reference/claude-config/skills/knowledge/operations/techStack.md +30 -30
  49. package/reference/claude-config/skills/project/SKILL.md +1088 -1088
  50. package/reference/claude-config/skills/run-ui/SKILL.md +73 -73
  51. package/reference/claude-config/skills/save/SKILL.md +3 -3
  52. package/reference/claude-config/skills/setup/SKILL.md +275 -275
  53. package/reference/claude-config/skills/status/SKILL.md +59 -59
  54. package/reference/claude-config/skills/submit-request/SKILL.md +180 -180
  55. package/reference/claude-config/skills/sync/SKILL.md +47 -47
  56. package/reference/claude-config/skills/tutorial/SKILL.md +259 -259
  57. package/reference/claude-config/skills/tutorial/progress-template.md +74 -74
  58. package/reference/claude-config/skills/tutorial/technical.md +1303 -1303
  59. package/reference/claude-config/skills/tutorial/vibe-coder.md +890 -890
  60. package/reference/claude-config/sync-notes/2026-04-22-git-sync-and-sync-notes.md +27 -27
  61. package/reference/claude-config/sync-notes/2026-04-22-lead-gen-deliverability-removal.md +30 -30
  62. package/reference/claude-config/sync-notes/2026-04-24-test-utils-and-template-tests.md +73 -73
  63. package/reference/claude-config/sync-notes/2026-04-24-ui-consolidation-and-sdk-cli-train.md +86 -86
  64. package/reference/claude-config/sync-notes/2026-04-25-auth-role-system-and-settings-roles.md +55 -55
  65. package/reference/claude-config/sync-notes/2026-04-27-crm-hitl-action-layer-cutover.md +97 -97
  66. package/reference/claude-config/sync-notes/2026-04-27-lead-gen-substrate-train.md +112 -112
  67. package/reference/claude-config/sync-notes/2026-04-29-crm-state-and-lead-gen-processing-status.md +93 -93
  68. package/reference/claude-config/sync-notes/2026-05-02-crm-ownership-next-action.md +58 -58
  69. package/reference/claude-config/sync-notes/2026-05-02-template-hardcode-workos-config.md +56 -56
  70. package/reference/claude-config/sync-notes/2026-05-04-elevasis-workspace.md +71 -71
  71. package/reference/claude-config/sync-notes/2026-05-04-knowledge-bundle.md +83 -83
  72. package/reference/claude-config/sync-notes/2026-05-04-template-skills-run-ui-and-tutorial.md +59 -59
  73. package/reference/claude-config/sync-notes/2026-05-05-list-builder.md +42 -42
  74. package/reference/claude-config/sync-notes/2026-05-06-crm-spine.md +60 -60
  75. package/reference/claude-config/sync-notes/2026-05-06-sdk-changes-release-train.md +37 -37
  76. package/reference/claude-config/sync-notes/2026-05-07-sdk-changes-release-train.md +34 -34
  77. package/reference/claude-config/sync-notes/2026-05-08-resource-governance-scaffold-guidance.md +38 -38
  78. package/reference/claude-config/sync-notes/2026-05-09-clients-domain.md +32 -32
  79. package/reference/claude-config/sync-notes/2026-05-09-command-system.md +33 -33
  80. package/reference/claude-config/sync-notes/2026-05-09-resource-governance-and-misc.md +69 -69
  81. package/reference/claude-config/sync-notes/2026-05-12-sdk-ready-release-train.md +30 -30
  82. package/reference/claude-config/sync-notes/2026-05-14-organization-model-ontology-refactor.md +45 -0
  83. package/reference/claude-config/sync-notes/README.md +43 -43
  84. package/reference/cli.mdx +808 -808
  85. package/reference/concepts.mdx +146 -146
  86. package/reference/deployment/api.mdx +297 -297
  87. package/reference/deployment/command-center.mdx +209 -209
  88. package/reference/deployment/index.mdx +195 -195
  89. package/reference/deployment/provided-features.mdx +107 -107
  90. package/reference/deployment/ui-execution.mdx +250 -250
  91. package/reference/examples/organization-model.ts +171 -84
  92. package/reference/framework/agent.mdx +156 -156
  93. package/reference/framework/index.mdx +195 -195
  94. package/reference/framework/interaction-guidance.mdx +182 -182
  95. package/reference/framework/memory.mdx +326 -326
  96. package/reference/framework/project-structure.mdx +282 -282
  97. package/reference/framework/tutorial-system.mdx +135 -135
  98. package/reference/getting-started.mdx +142 -142
  99. package/reference/index.mdx +106 -106
  100. package/reference/packages/core/src/README.md +14 -14
  101. package/reference/packages/core/src/business/README.md +2 -2
  102. package/reference/packages/core/src/knowledge/README.md +32 -32
  103. package/reference/packages/core/src/organization-model/README.md +149 -149
  104. package/reference/packages/core/src/test-utils/README.md +37 -37
  105. package/reference/packages/ui/src/api/README.md +18 -18
  106. package/reference/packages/ui/src/app/README.md +24 -24
  107. package/reference/packages/ui/src/auth/README.md +18 -18
  108. package/reference/packages/ui/src/components/README.md +24 -24
  109. package/reference/packages/ui/src/execution/README.md +16 -16
  110. package/reference/packages/ui/src/features/README.md +28 -28
  111. package/reference/packages/ui/src/graph/README.md +16 -16
  112. package/reference/packages/ui/src/hooks/README.md +23 -23
  113. package/reference/packages/ui/src/initialization/README.md +19 -19
  114. package/reference/packages/ui/src/knowledge/README.md +31 -31
  115. package/reference/packages/ui/src/organization/README.md +18 -18
  116. package/reference/packages/ui/src/profile/README.md +19 -19
  117. package/reference/packages/ui/src/provider/README.md +32 -32
  118. package/reference/packages/ui/src/router/README.md +18 -18
  119. package/reference/packages/ui/src/sse/README.md +13 -13
  120. package/reference/packages/ui/src/test-utils/README.md +7 -7
  121. package/reference/packages/ui/src/theme/README.md +23 -23
  122. package/reference/packages/ui/src/theme/presets/README.md +19 -19
  123. package/reference/packages/ui/src/types/README.md +16 -16
  124. package/reference/packages/ui/src/utils/README.md +18 -18
  125. package/reference/packages/ui/src/zustand/README.md +18 -18
  126. package/reference/platform-tools/adapters-integration.mdx +301 -301
  127. package/reference/platform-tools/adapters-platform.mdx +553 -553
  128. package/reference/platform-tools/index.mdx +217 -217
  129. package/reference/platform-tools/type-safety.mdx +82 -82
  130. package/reference/resources/index.mdx +349 -349
  131. package/reference/resources/patterns.mdx +449 -449
  132. package/reference/resources/types.mdx +116 -116
  133. package/reference/roadmap.mdx +165 -165
  134. package/reference/runtime.mdx +173 -173
  135. package/reference/scaffold/core/organization-graph.mdx +110 -90
  136. package/reference/scaffold/core/organization-model.mdx +225 -213
  137. package/reference/scaffold/index.mdx +67 -67
  138. package/reference/scaffold/operations/propagation-pipeline.md +77 -77
  139. package/reference/scaffold/operations/scaffold-maintenance.md +12 -12
  140. package/reference/scaffold/operations/workflow-recipes.md +138 -138
  141. package/reference/scaffold/recipes/add-a-feature.md +307 -85
  142. package/reference/scaffold/recipes/add-a-resource.md +137 -103
  143. package/reference/scaffold/recipes/customize-knowledge-browser.md +5 -5
  144. package/reference/scaffold/recipes/customize-organization-model.md +275 -138
  145. package/reference/scaffold/recipes/extend-a-base-entity.md +8 -8
  146. package/reference/scaffold/recipes/extend-crm.md +3 -3
  147. package/reference/scaffold/recipes/extend-lead-gen.md +394 -394
  148. package/reference/scaffold/recipes/gate-by-feature-or-admin.md +118 -118
  149. package/reference/scaffold/recipes/index.md +46 -46
  150. package/reference/scaffold/recipes/query-the-knowledge-graph.md +197 -170
  151. package/reference/scaffold/reference/contracts.md +2136 -2093
  152. package/reference/scaffold/reference/glossary.md +76 -76
  153. package/reference/scaffold/ui/composition-extensibility.mdx +233 -233
  154. package/reference/scaffold/ui/customization.md +243 -243
  155. package/reference/scaffold/ui/feature-flags-and-gating.md +46 -46
  156. package/reference/scaffold/ui/feature-shell.mdx +72 -72
  157. package/reference/scaffold/ui/recipes.md +221 -214
  158. package/reference/spine/spine-primer.md +96 -96
  159. package/reference/templates/index.mdx +47 -47
  160. 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