@elevasis/sdk 0.5.13 → 0.5.15

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.
@@ -1,207 +1,207 @@
1
- ---
2
- title: SDK Types
3
- description: Complete type reference for @elevasis/sdk -- package exports, re-exported platform types, ElevasConfig interface, StepHandler context, and runtime values
4
- loadWhen: "Looking up type signatures or SDK exports"
5
- ---
6
-
7
- `@elevasis/sdk` is published to the public npm registry. It bundles all platform types from `@repo/core` into a single self-contained type declaration file with zero internal monorepo references. External developers install the package and get full TypeScript support without any monorepo tooling.
8
-
9
- ```bash
10
- pnpm add @elevasis/sdk zod
11
- ```
12
-
13
- Zod is a peer dependency and must be installed separately.
14
-
15
- ---
16
-
17
- ## Package Exports
18
-
19
- The package exposes two subpaths:
20
-
21
- ```json
22
- {
23
- "exports": {
24
- ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" },
25
- "./worker": { "import": "./dist/worker/index.js" }
26
- }
27
- }
28
- ```
29
-
30
- - `@elevasis/sdk` -- all types plus runtime values (`StepType`, `ExecutionError`, `ToolingError`)
31
- - `@elevasis/sdk/worker` -- worker runtime module (`startWorker`, `platform`, `PlatformToolError`)
32
-
33
- ---
34
-
35
- ## Type Re-exports
36
-
37
- All types come from the platform core. The SDK re-exports them grouped by source domain:
38
-
39
- ### Platform Types
40
-
41
- | Type | Description |
42
- | ---- | ----------- |
43
- | `ResourceDefinition` | Base interface for all resource types |
44
- | `ResourceType` | Enum: `'workflow' | 'agent'` |
45
- | `ResourceStatus` | Enum: `'dev' | 'production'` |
46
- | `ResourceDomain` | Domain classification for a resource |
47
- | `DomainDefinition` | Structure for grouping resources by domain |
48
- | `OrganizationResources` | Top-level export shape: `{ workflows, agents }` |
49
- | `TriggerDefinition` | Base for trigger configuration |
50
- | `IntegrationDefinition` | Integration configuration structure |
51
- | `WebhookProviderType` | Supported webhook providers |
52
- | `WebhookTriggerConfig` | Webhook trigger configuration |
53
- | `ScheduleTriggerConfig` | Cron/schedule trigger configuration |
54
- | `EventTriggerConfig` | Internal event trigger configuration |
55
- | `TriggerConfig` | Union of all trigger config types |
56
-
57
- ### Execution Types
58
-
59
- | Type | Description |
60
- | ---- | ----------- |
61
- | `WorkflowDefinition` | Complete workflow definition including config, contract, steps, entryPoint |
62
- | `WorkflowStep` | Individual step definition with type, handler, and next routing |
63
- | `WorkflowConfig` | Metadata block: name, description, status |
64
- | `StepHandler` | Function type: `(input: unknown, context: StepContext) => Promise<unknown>` |
65
- | `NextConfig` | Union of `LinearNext` and `ConditionalNext` |
66
- | `LinearNext` | `{ target: string }` -- fixed next step |
67
- | `ConditionalNext` | `{ routes: Route[], defaultTarget: string }` -- branching routing |
68
- | `StepType` | Runtime enum: `LINEAR | CONDITIONAL` (also a runtime value -- see below) |
69
- | `AgentDefinition` | Complete agent definition including config, agentConfig, tools |
70
- | `AgentConfig` | Agent metadata: name, description, status |
71
- | `AgentConstraints` | Execution limits for agents |
72
- | `Tool` | Tool definition for agent use |
73
- | `ToolExecutionOptions` | Options passed when a tool executes |
74
- | `ToolingErrorType` | Enum of tool error categories |
75
- | `ToolingError` | Error class for tool execution failures (also a runtime value -- see below) |
76
- | `ExecutionError` | Error class for execution-level failures (also a runtime value -- see below) |
77
- | `Contract` | Input/output Zod schema pair |
78
- | `ExecutionContext` | Runtime context passed to step handlers |
79
- | `ExecutionMetadata` | Metadata about a running execution |
80
- | `LLMModel` | Model identifier: provider + model name |
81
- | `ModelConfig` | Full model configuration including temperature and token limits |
82
- | `ExecutionInterface` | Interface for triggering and inspecting executions |
83
-
84
- ### Form and Metrics Types
85
-
86
- | Type | Description |
87
- | ---- | ----------- |
88
- | `FormField` | Individual form field definition |
89
- | `FormSchema` | Collection of form fields |
90
- | `FormFieldType` | Enum of supported field types |
91
- | `ResourceMetricsConfig` | Observability configuration for a resource |
92
-
93
- ---
94
-
95
- ## ElevasConfig
96
-
97
- `ElevasConfig` is the only type defined by the SDK itself (not re-exported from the platform). It configures SDK behavior via `elevasis.config.ts` in your project root.
98
-
99
- ```typescript
100
- export interface ElevasConfig {
101
- defaultStatus?: ResourceStatus
102
- dev?: { port?: number }
103
- }
104
- ```
105
-
106
- | Field | Type | Default | Description |
107
- | ----- | ---- | ------- | ----------- |
108
- | `defaultStatus` | `'dev' | 'production'` | `'production'` | Default status applied to all resources that do not set their own `config.status`. Set to `'dev'` to keep resources inactive while building. |
109
- | `dev.port` | `number` | `3001` | Local port for the development worker process. Change this if port 3001 conflicts with another service. |
110
-
111
- Usage:
112
-
113
- ```typescript
114
- import type { ElevasConfig } from '@elevasis/sdk';
115
-
116
- const config: ElevasConfig = {
117
- defaultStatus: 'dev',
118
- dev: { port: 3002 },
119
- };
120
-
121
- export default config;
122
- ```
123
-
124
- ---
125
-
126
- ## StepHandler Context
127
-
128
- `StepHandler` accepts two parameters: `input` (validated by your contract schema) and `context` (runtime metadata). The `context` parameter is not optional in the type definition, but TypeScript allows you to omit it in your handler function -- writing `async (input) => { ... }` works without error.
129
-
130
- ```typescript
131
- import type { StepHandler, ExecutionContext } from '@elevasis/sdk';
132
-
133
- const handler: StepHandler = async (input, context: ExecutionContext) => {
134
- const { executionId, organizationId, resourceId, logger, store } = context;
135
-
136
- logger.info('Processing', { executionId, resourceId });
137
-
138
- await store.set('checkpoint', JSON.stringify({ step: 'started' }));
139
-
140
- return { done: true };
141
- };
142
- ```
143
-
144
- ### ExecutionContext Fields
145
-
146
- | Field | Type | Description |
147
- | ----- | ---- | ----------- |
148
- | `executionId` | `string` | Unique identifier for this execution run |
149
- | `organizationId` | `string` | Your organization identifier |
150
- | `resourceId` | `string` | Identifier of the executing workflow or agent |
151
- | `logger` | `Logger` | Structured logger -- messages appear in the Elevasis dashboard under the execution |
152
- | `store` | `Store` | Key-value store scoped to the current execution. Useful for passing data between steps or checkpointing progress. |
153
-
154
- ---
155
-
156
- ## Runtime Values
157
-
158
- Three runtime values are exported from `@elevasis/sdk` as JavaScript values (not just types). They are defined directly in the SDK package to avoid pulling in the full platform execution engine.
159
-
160
- ### StepType
161
-
162
- An enum used to configure step routing in multi-step workflows.
163
-
164
- ```typescript
165
- import { StepType } from '@elevasis/sdk';
166
-
167
- // StepType.LINEAR -- fixed next step via { target: 'stepName' }
168
- // StepType.CONDITIONAL -- branching via { routes: [...], defaultTarget: 'stepName' }
169
- ```
170
-
171
- ### ToolingError
172
-
173
- Thrown by platform tool calls when a tool fails. Use this class to distinguish tool failures from general errors in `try/catch` blocks.
174
-
175
- ```typescript
176
- import { ToolingError } from '@elevasis/sdk';
177
-
178
- try {
179
- const result = await platform.call({ ... });
180
- } catch (err) {
181
- if (err instanceof ToolingError) {
182
- // tool-specific failure -- check err.type for category
183
- console.error('Tool failed:', err.type, err.message);
184
- } else {
185
- throw err; // re-throw unexpected errors
186
- }
187
- }
188
- ```
189
-
190
- ### ExecutionError
191
-
192
- Represents a failure at the execution level (distinct from a tool-level failure). Throw this from a step handler to signal that the execution should be marked as failed with a structured error message.
193
-
194
- ```typescript
195
- import { ExecutionError } from '@elevasis/sdk';
196
-
197
- const handler = async (input) => {
198
- if (!input.userId) {
199
- throw new ExecutionError('userId is required', { code: 'MISSING_INPUT' });
200
- }
201
- return { result: 'ok' };
202
- };
203
- ```
204
-
205
- ---
206
-
207
- **Last Updated:** 2026-02-25
1
+ ---
2
+ title: SDK Types
3
+ description: Complete type reference for @elevasis/sdk -- package exports, re-exported platform types, ElevasConfig interface, StepHandler context, and runtime values
4
+ loadWhen: "Looking up type signatures or SDK exports"
5
+ ---
6
+
7
+ `@elevasis/sdk` is published to the public npm registry. It bundles all platform types from `@repo/core` into a single self-contained type declaration file with zero internal monorepo references. External developers install the package and get full TypeScript support without any monorepo tooling.
8
+
9
+ ```bash
10
+ pnpm add @elevasis/sdk zod
11
+ ```
12
+
13
+ Zod is a peer dependency and must be installed separately.
14
+
15
+ ---
16
+
17
+ ## Package Exports
18
+
19
+ The package exposes two subpaths:
20
+
21
+ ```json
22
+ {
23
+ "exports": {
24
+ ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" },
25
+ "./worker": { "import": "./dist/worker/index.js" }
26
+ }
27
+ }
28
+ ```
29
+
30
+ - `@elevasis/sdk` -- all types plus runtime values (`StepType`, `ExecutionError`, `ToolingError`)
31
+ - `@elevasis/sdk/worker` -- worker runtime module (`startWorker`, `platform`, `PlatformToolError`)
32
+
33
+ ---
34
+
35
+ ## Type Re-exports
36
+
37
+ All types come from the platform core. The SDK re-exports them grouped by source domain:
38
+
39
+ ### Platform Types
40
+
41
+ | Type | Description |
42
+ | ----------------------- | ----------------------------------------------- |
43
+ | `ResourceDefinition` | Base interface for all resource types |
44
+ | `ResourceType` | Enum: `'workflow' | 'agent'` |
45
+ | `ResourceStatus` | Enum: `'dev' | 'prod'` |
46
+ | `ResourceDomain` | Domain classification for a resource |
47
+ | `DomainDefinition` | Structure for grouping resources by domain |
48
+ | `OrganizationResources` | Top-level export shape: `{ workflows, agents }` |
49
+ | `TriggerDefinition` | Base for trigger configuration |
50
+ | `IntegrationDefinition` | Integration configuration structure |
51
+ | `WebhookProviderType` | Supported webhook providers |
52
+ | `WebhookTriggerConfig` | Webhook trigger configuration |
53
+ | `ScheduleTriggerConfig` | Cron/schedule trigger configuration |
54
+ | `EventTriggerConfig` | Internal event trigger configuration |
55
+ | `TriggerConfig` | Union of all trigger config types |
56
+
57
+ ### Execution Types
58
+
59
+ | Type | Description |
60
+ | ---------------------- | -------------------------------------------------------------------------------- |
61
+ | `WorkflowDefinition` | Complete workflow definition including config, contract, steps, entryPoint |
62
+ | `WorkflowStep` | Individual step definition with type, handler, and next routing |
63
+ | `WorkflowConfig` | Metadata block: name, description, status |
64
+ | `StepHandler` | Function type: `(input: unknown, context: StepContext) => Promise<unknown>` |
65
+ | `NextConfig` | Union of `LinearNext` and `ConditionalNext` |
66
+ | `LinearNext` | `{ type: 'linear', target: string }` -- fixed next step |
67
+ | `ConditionalNext` | `{ type: 'conditional', routes: Route[], default: string }` -- branching routing |
68
+ | `StepType` | Runtime enum: `LINEAR | CONDITIONAL` (also a runtime value -- see below) |
69
+ | `AgentDefinition` | Complete agent definition including config, agentConfig, tools |
70
+ | `AgentConfig` | Agent metadata: name, description, status |
71
+ | `AgentConstraints` | Execution limits for agents |
72
+ | `Tool` | Tool definition for agent use |
73
+ | `ToolExecutionOptions` | Options passed when a tool executes |
74
+ | `ToolingErrorType` | Enum of tool error categories |
75
+ | `ToolingError` | Error class for tool execution failures (also a runtime value -- see below) |
76
+ | `ExecutionError` | Error class for execution-level failures (also a runtime value -- see below) |
77
+ | `Contract` | Input/output Zod schema pair |
78
+ | `ExecutionContext` | Runtime context passed to step handlers |
79
+ | `ExecutionMetadata` | Metadata about a running execution |
80
+ | `LLMModel` | Model identifier: provider + model name |
81
+ | `ModelConfig` | Full model configuration including temperature and token limits |
82
+ | `ExecutionInterface` | Interface for triggering and inspecting executions |
83
+
84
+ ### Form and Metrics Types
85
+
86
+ | Type | Description |
87
+ | ----------------------- | ------------------------------------------ |
88
+ | `FormField` | Individual form field definition |
89
+ | `FormSchema` | Collection of form fields |
90
+ | `FormFieldType` | Enum of supported field types |
91
+ | `ResourceMetricsConfig` | Observability configuration for a resource |
92
+
93
+ ---
94
+
95
+ ## ElevasConfig
96
+
97
+ `ElevasConfig` is the only type defined by the SDK itself (not re-exported from the platform). It configures SDK behavior via `elevasis.config.ts` in your project root.
98
+
99
+ ```typescript
100
+ export interface ElevasConfig {
101
+ defaultStatus?: ResourceStatus
102
+ dev?: { port?: number }
103
+ }
104
+ ```
105
+
106
+ | Field | Type | Default | Description |
107
+ | --------------- | ----------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
108
+ | `defaultStatus` | `'dev' | 'prod'` | `'prod'` | Default status applied to all resources that do not set their own `config.status`. Set to `'dev'` to keep resources inactive while building. |
109
+ | `dev.port` | `number` | `3001` | Local port for the development worker process. Change this if port 3001 conflicts with another service. |
110
+
111
+ Usage:
112
+
113
+ ```typescript
114
+ import type { ElevasConfig } from '@elevasis/sdk';
115
+
116
+ const config: ElevasConfig = {
117
+ defaultStatus: 'dev',
118
+ dev: { port: 3002 },
119
+ };
120
+
121
+ export default config;
122
+ ```
123
+
124
+ ---
125
+
126
+ ## StepHandler Context
127
+
128
+ `StepHandler` accepts two parameters: `input` (validated by your contract schema) and `context` (runtime metadata). The `context` parameter is not optional in the type definition, but TypeScript allows you to omit it in your handler function -- writing `async (input) => { ... }` works without error.
129
+
130
+ ```typescript
131
+ import type { StepHandler, ExecutionContext } from '@elevasis/sdk';
132
+
133
+ const handler: StepHandler = async (input, context: ExecutionContext) => {
134
+ const { executionId, organizationId, resourceId, logger, store } = context;
135
+
136
+ logger.info('Processing', { executionId, resourceId });
137
+
138
+ await store.set('checkpoint', JSON.stringify({ step: 'started' }));
139
+
140
+ return { done: true };
141
+ };
142
+ ```
143
+
144
+ ### ExecutionContext Fields
145
+
146
+ | Field | Type | Description |
147
+ | ---------------- | -------- | ----------------------------------------------------------------------------------------------------------------- |
148
+ | `executionId` | `string` | Unique identifier for this execution run |
149
+ | `organizationId` | `string` | Your organization identifier |
150
+ | `resourceId` | `string` | Identifier of the executing workflow or agent |
151
+ | `logger` | `Logger` | Structured logger -- messages appear in the Elevasis dashboard under the execution |
152
+ | `store` | `Store` | Key-value store scoped to the current execution. Useful for passing data between steps or checkpointing progress. |
153
+
154
+ ---
155
+
156
+ ## Runtime Values
157
+
158
+ Three runtime values are exported from `@elevasis/sdk` as JavaScript values (not just types). They are defined directly in the SDK package to avoid pulling in the full platform execution engine.
159
+
160
+ ### StepType
161
+
162
+ An enum used to configure step routing in multi-step workflows.
163
+
164
+ ```typescript
165
+ import { StepType } from '@elevasis/sdk';
166
+
167
+ // StepType.LINEAR -- fixed next step via { target: 'stepName' }
168
+ // StepType.CONDITIONAL -- branching via { type: 'conditional', routes: [...], default: 'stepName' }
169
+ ```
170
+
171
+ ### ToolingError
172
+
173
+ Thrown by platform tool calls when a tool fails. Use this class to distinguish tool failures from general errors in `try/catch` blocks.
174
+
175
+ ```typescript
176
+ import { ToolingError } from '@elevasis/sdk';
177
+
178
+ try {
179
+ const result = await platform.call({ ... });
180
+ } catch (err) {
181
+ if (err instanceof ToolingError) {
182
+ // tool-specific failure -- check err.type for category
183
+ console.error('Tool failed:', err.type, err.message);
184
+ } else {
185
+ throw err; // re-throw unexpected errors
186
+ }
187
+ }
188
+ ```
189
+
190
+ ### ExecutionError
191
+
192
+ Represents a failure at the execution level (distinct from a tool-level failure). Throw this from a step handler to signal that the execution should be marked as failed with a structured error message.
193
+
194
+ ```typescript
195
+ import { ExecutionError } from '@elevasis/sdk';
196
+
197
+ const handler = async (input) => {
198
+ if (!input.userId) {
199
+ throw new ExecutionError('userId is required', { code: 'MISSING_INPUT' });
200
+ }
201
+ return { result: 'ok' };
202
+ };
203
+ ```
204
+
205
+ ---
206
+
207
+ **Last Updated:** 2026-02-25