@elevasis/sdk 0.5.12 → 0.5.14

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 (37) hide show
  1. package/dist/cli.cjs +144 -118
  2. package/dist/index.d.ts +19 -253
  3. package/dist/index.js +20 -9
  4. package/dist/templates.js +62 -59
  5. package/dist/types/worker/adapters/index.d.ts +0 -1
  6. package/dist/worker/index.js +47 -53
  7. package/package.json +1 -1
  8. package/reference/_navigation.md +13 -57
  9. package/reference/{cli/index.mdx → cli.mdx} +568 -505
  10. package/reference/concepts.mdx +164 -0
  11. package/reference/deployment/api.mdx +297 -297
  12. package/reference/deployment/command-center.mdx +226 -0
  13. package/reference/deployment/index.mdx +158 -153
  14. package/reference/framework/agent.mdx +156 -151
  15. package/reference/framework/index.mdx +182 -103
  16. package/reference/{developer → framework}/interaction-guidance.mdx +182 -182
  17. package/reference/framework/memory.mdx +326 -347
  18. package/reference/framework/project-structure.mdx +277 -298
  19. package/reference/framework/tutorial-system.mdx +222 -0
  20. package/reference/{getting-started/index.mdx → getting-started.mdx} +152 -148
  21. package/reference/index.mdx +131 -114
  22. package/reference/platform-tools/adapters.mdx +868 -929
  23. package/reference/platform-tools/index.mdx +354 -195
  24. package/reference/resources/index.mdx +339 -336
  25. package/reference/resources/patterns.mdx +355 -354
  26. package/reference/resources/types.mdx +207 -207
  27. package/reference/{roadmap/index.mdx → roadmap.mdx} +163 -147
  28. package/reference/{runtime/index.mdx → runtime.mdx} +173 -141
  29. package/reference/{troubleshooting/common-errors.mdx → troubleshooting.mdx} +223 -210
  30. package/dist/types/worker/adapters/trello.d.ts +0 -14
  31. package/reference/concepts/index.mdx +0 -203
  32. package/reference/deployment/command-center-ui.mdx +0 -151
  33. package/reference/deployment/command-view.mdx +0 -154
  34. package/reference/framework/documentation.mdx +0 -92
  35. package/reference/platform-tools/examples.mdx +0 -170
  36. package/reference/runtime/limits.mdx +0 -75
  37. package/reference/security/credentials.mdx +0 -141
@@ -1,141 +1,173 @@
1
- ---
2
- title: Execution Runtime
3
- description: How your code runs on the Elevasis platform -- execution lifecycle, concurrency, timeouts, cancellation, error handling, and observability
4
- loadWhen: "Debugging execution behavior or understanding the runtime model"
5
- ---
6
-
7
- This page covers everything that happens after you deploy -- how resources execute as managed processes, how failures surface to you, and what observability data you can access. For resource limits and quotas, see [Resource Limits & Quotas](limits.mdx).
8
-
9
- ---
10
-
11
- ## Execution Lifecycle
12
-
13
- ### The Four Stages
14
-
15
- Every execution traverses four stages: trigger, route, execute, and return.
16
-
17
- 1. **Trigger** -- A user, CLI command, or API call initiates execution. The platform creates an execution record with `status: 'running'` and generates a unique `executionId`.
18
- 2. **Route** -- The platform resolves the target resource from the registry. All resources (static and external) coexist in a single in-memory registry with no database queries at lookup time.
19
- 3. **Execute** -- An ephemeral worker thread is created from your deployed bundle and sent the execution request. The worker matches the `resourceId` to your definition, validates the input against your Zod schema, and runs the handler. For workflows, steps execute sequentially following the `next` chain. The worker is terminated immediately after execution completes.
20
- 4. **Return** -- The worker posts the result back to the platform. The platform stores the final result, updates the execution record, and fans events out to AI Studio and CLI subscribers.
21
-
22
- ### Concurrency Model
23
-
24
- Workers are ephemeral -- each execution creates a new worker thread. There is no persistent pool:
25
-
26
- - **Per-execution isolation:** Each execution gets its own worker thread. Concurrent executions for the same organization run in separate workers with no shared state.
27
- - **Memory:** Each worker is capped at 256MB. Concurrent workers multiply memory usage proportionally.
28
- - **No cold start:** Workers are created fresh per execution. Your first execution and hundredth are identical in terms of startup behavior.
29
-
30
- ### Timeout Enforcement
31
-
32
- Timeouts are enforced by the platform. You do not handle them explicitly in your code:
33
-
34
- - **Default timeout:** A platform default applies to all resource types unless overridden.
35
- - **Per-resource override:** Agents can configure `constraints.timeout` in the agent definition. Workflows use the platform default.
36
- - **Enforcement:** When a timeout fires, the worker is terminated immediately -- even if it is stuck in a synchronous loop. No special handler signature is required on your part.
37
-
38
- ### Cancellation Protocol
39
-
40
- Cancellation is initiated by the platform and requires no special code in your handler:
41
-
42
- 1. A cancellation request is received -- via CLI, API, or platform timeout.
43
- 2. The platform aborts the execution controller registered for that `executionId`.
44
- 3. The worker is terminated immediately (kills the worker even if stuck in a synchronous loop).
45
- 4. The platform records the cancellation in the execution record.
46
-
47
- **What triggers cancellation:**
48
-
49
- - You call `POST /api/external/executions/:resourceId/:executionId/cancel` via CLI or API
50
- - The platform timeout expires
51
- - The resource is deleted while an execution is in-flight
52
-
53
- ---
54
-
55
- ## Error Handling
56
-
57
- ### How Errors Reach You
58
-
59
- Errors are displayed depending on the surface you use to inspect them:
60
-
61
- - **AI Studio:** Shows the error message and execution status. Example: `Remote resource 'onboard-client' failed: Email delivery failed: invalid address`
62
- - **CLI (`elevasis-sdk execution <resourceId> <id>`):** Shows full execution detail including the error message. The `--json` flag includes an `error` field in structured output.
63
- - **Error message source:** The error string comes directly from your handler's catch block (`String(err)`). The platform stores this verbatim and displays it as-is. Write descriptive error messages in your handlers -- they surface directly to users.
64
-
65
- ### What Causes a Failed Execution
66
-
67
- - **Unhandled exception in your handler:** The worker reports `status: 'failed'` with the error message.
68
- - **Memory limit exceeded (256MB):** The worker crashes with an out-of-memory error. The platform catches this; other tenants are unaffected.
69
- - **Timeout exceeded:** The platform terminates the worker and marks the execution failed with a timeout reason.
70
- - **Cancellation:** Execution is marked cancelled.
71
-
72
- ---
73
-
74
- ## Observability
75
-
76
- ### Logging
77
-
78
- You produce logs using standard `console` methods -- no special logger object is needed:
79
-
80
- - **Console interception:** The SDK worker runtime intercepts `console.log`, `console.warn`, and `console.error` during handler execution and captures them as structured `{ level, message }` entries.
81
- - **Level mapping:** `console.log` maps to `info`, `console.warn` maps to `warn`, `console.error` maps to `error`.
82
- - **No changes required:** Any code that already uses `console.log` automatically has its output captured. Existing code works without modification.
83
-
84
- ### Log Transport
85
-
86
- Logs are delivered to the platform atomically with the execution result:
87
-
88
- - **Bundled delivery:** All logs for an execution are included in the result message when the handler completes. There is no real-time streaming -- logs arrive with the final result.
89
- - **Crash behavior:** If the worker crashes before completing, logs captured up to the crash point are lost. The platform records only the crash error.
90
-
91
- ### Log Retention and Display
92
-
93
- - **Retention:** 30 days by default (configurable per plan).
94
- - **Real-time fanout:** After execution completes, logs are stored and fanned out to AI Studio and CLI subscribers. AI Studio shows them in the execution detail view.
95
- - **CLI access:** Use `elevasis-sdk execution <resourceId> <id>` to view execution details including logs.
96
-
97
- ---
98
-
99
- ## Resource Lifecycle
100
-
101
- ### Status
102
-
103
- Every resource on the platform has a status that you control in your definition:
104
-
105
- - **`dev`** -- Default for new resources. Visible in AI Studio and executable, but marked with a "Development" badge. Use this during testing and iteration.
106
- - **`prod`** -- Set `status: 'prod'` in your resource definition before deploying. No badge. This is the live, production-ready state.
107
-
108
- ### Versioning
109
-
110
- v1 versioning is intentionally simple:
111
-
112
- - **One active version per resource per org.** Deploying replaces the running version. There is no version history at the resource level; previous deploys are marked stopped.
113
- - **Immutable per deploy.** A resource definition is frozen at deploy time. Changing code requires a new deploy.
114
-
115
- ### Deletion
116
-
117
- - **Via CLI:** Remove the resource from your `OrganizationResources` export and run `elevasis-sdk deploy`. Resources absent from the new bundle are automatically deregistered from the platform.
118
- - **Via AI Studio:** The delete button unregisters the resource immediately and marks the deployment stopped.
119
- - **In-flight executions:** Workers already running complete normally. Deletion affects only new execution attempts.
120
- - **Data retention:** Execution logs and history for a deleted resource are retained for 30 days, then purged.
121
-
122
- ---
123
-
124
- ## Platform Storage
125
-
126
- Your deployed bundle is stored in Supabase Storage. On API restart, the platform re-registers all active deployments from the database and re-downloads bundles if needed. This means:
127
-
128
- - **No data loss on restart:** Your resources are automatically re-registered after platform restarts.
129
- - **No action required from you:** The platform handles recovery transparently.
130
-
131
- ---
132
-
133
- ## Platform Maintenance
134
-
135
- - **Rolling updates:** Platform upgrades trigger a re-registration of all active deployments on startup. No in-flight executions are lost (workers are ephemeral and complete independently).
136
- - **In-flight executions during restart:** Already-running workers complete normally. New executions use the newly reloaded registry after restart.
137
- - **Advance notice:** You will receive 24-hour advance notice for breaking maintenance windows. These are rare and reserved for major infrastructure changes.
138
-
139
- ---
140
-
141
- **Last Updated:** 2026-02-25
1
+ ---
2
+ title: Execution Runtime
3
+ description: How your code runs on the Elevasis platform -- execution lifecycle, concurrency, timeouts, cancellation, error handling, observability, resource limits, and v1 limitations
4
+ loadWhen: "Debugging execution behavior or understanding the runtime model"
5
+ ---
6
+
7
+ This page covers everything that happens after you deploy -- how resources execute as managed processes, how failures surface to you, what observability data you can access, and the hard limits enforced on all executions.
8
+
9
+ ---
10
+
11
+ ## Execution Lifecycle
12
+
13
+ ### The Four Stages
14
+
15
+ Every execution traverses four stages: trigger, route, execute, and return.
16
+
17
+ 1. **Trigger** -- A user, CLI command, or API call initiates execution. The platform creates an execution record with `status: 'running'` and generates a unique `executionId`.
18
+ 2. **Route** -- The platform resolves the target resource from the registry. All resources (static and external) coexist in a single in-memory registry with no database queries at lookup time.
19
+ 3. **Execute** -- An ephemeral worker thread is created from your deployed bundle and sent the execution request. The worker matches the `resourceId` to your definition, validates the input against your Zod schema, and runs the handler. For workflows, steps execute sequentially following the `next` chain. The worker is terminated immediately after execution completes.
20
+ 4. **Return** -- The worker posts the result back to the platform. The platform stores the final result, updates the execution record, and fans events out to AI Studio and CLI subscribers.
21
+
22
+ ### Concurrency Model
23
+
24
+ Workers are ephemeral -- each execution creates a new worker thread. There is no persistent pool:
25
+
26
+ - **Per-execution isolation:** Each execution gets its own worker thread. Concurrent executions for the same organization run in separate workers with no shared state.
27
+ - **Memory:** Each worker is capped at 256MB. Concurrent workers multiply memory usage proportionally.
28
+ - **No cold start:** Workers are created fresh per execution. Your first execution and hundredth are identical in terms of startup behavior.
29
+
30
+ ### Timeout Enforcement
31
+
32
+ Timeouts are enforced by the platform. You do not handle them explicitly in your code:
33
+
34
+ - **Default timeout:** A platform default applies to all resource types unless overridden.
35
+ - **Per-resource override:** Agents can configure `constraints.timeout` in the agent definition. Workflows use the platform default.
36
+ - **Enforcement:** When a timeout fires, the worker is terminated immediately -- even if it is stuck in a synchronous loop. No special handler signature is required on your part.
37
+
38
+ ### Cancellation
39
+
40
+ Cancellation is initiated by the platform and requires no special code in your handler. The worker is terminated immediately and the execution is recorded as cancelled.
41
+
42
+ **What triggers cancellation:**
43
+
44
+ - You call `POST /api/external/executions/:resourceId/:executionId/cancel` via CLI or API
45
+ - The platform timeout expires
46
+ - The resource is deleted while an execution is in-flight
47
+
48
+ ---
49
+
50
+ ## Error Handling
51
+
52
+ ### How Errors Reach You
53
+
54
+ Errors are displayed depending on the surface you use to inspect them:
55
+
56
+ - **AI Studio:** Shows the error message and execution status. Example: `Remote resource 'onboard-client' failed: Email delivery failed: invalid address`
57
+ - **CLI (`elevasis-sdk execution <resourceId> <id>`):** Shows full execution detail including the error message. The `--json` flag includes an `error` field in structured output.
58
+ - **Error message source:** The error string comes directly from your handler's catch block (`String(err)`). The platform stores this verbatim and displays it as-is. Write descriptive error messages in your handlers -- they surface directly to users.
59
+
60
+ ### What Causes a Failed Execution
61
+
62
+ - **Unhandled exception in your handler:** The worker reports `status: 'failed'` with the error message.
63
+ - **Memory limit exceeded (256MB):** The worker crashes with an out-of-memory error. The platform catches this; other tenants are unaffected.
64
+ - **Timeout exceeded:** The platform terminates the worker and marks the execution failed with a timeout reason.
65
+ - **Cancellation:** Execution is marked cancelled.
66
+
67
+ ---
68
+
69
+ ## Observability
70
+
71
+ ### Logging
72
+
73
+ You produce logs using standard `console` methods -- no special logger object is needed:
74
+
75
+ - **Console interception:** The SDK worker runtime intercepts `console.log`, `console.warn`, and `console.error` during handler execution and captures them as structured `{ level, message }` entries.
76
+ - **Level mapping:** `console.log` maps to `info`, `console.warn` maps to `warn`, `console.error` maps to `error`.
77
+ - **No changes required:** Any code that already uses `console.log` automatically has its output captured. Existing code works without modification.
78
+
79
+ ### Log Transport
80
+
81
+ Logs are delivered to the platform atomically with the execution result:
82
+
83
+ - **Bundled delivery:** All logs for an execution are included in the result message when the handler completes. There is no real-time streaming -- logs arrive with the final result.
84
+ - **Crash behavior:** If the worker crashes before completing, logs captured up to the crash point are lost. The platform records only the crash error.
85
+
86
+ ### Log Retention and Display
87
+
88
+ - **Retention:** 30 days by default (configurable per plan).
89
+ - **Real-time fanout:** After execution completes, logs are stored and fanned out to AI Studio and CLI subscribers. AI Studio shows them in the execution detail view.
90
+ - **CLI access:** Use `elevasis-sdk execution <resourceId> <id>` to view execution details including logs.
91
+
92
+ ---
93
+
94
+ ## Resource Lifecycle
95
+
96
+ ### Status
97
+
98
+ Every resource on the platform has a status that you control in your definition:
99
+
100
+ - **`dev`** -- Default for new resources. Visible in AI Studio and executable, but marked with a "Development" badge. Use this during testing and iteration.
101
+ - **`prod`** -- Set `status: 'prod'` in your resource definition before deploying. No badge. This is the live, production-ready state.
102
+
103
+ ### Versioning
104
+
105
+ v1 versioning is intentionally simple:
106
+
107
+ - **One active version per resource per org.** Deploying replaces the running version. There is no version history at the resource level; previous deploys are marked stopped.
108
+ - **Immutable per deploy.** A resource definition is frozen at deploy time. Changing code requires a new deploy.
109
+
110
+ ### Deletion
111
+
112
+ - **Via CLI:** Remove the resource from your `OrganizationResources` export and run `elevasis-sdk deploy`. Resources absent from the new bundle are automatically deregistered from the platform.
113
+ - **Via AI Studio:** The delete button unregisters the resource immediately and marks the deployment stopped.
114
+ - **In-flight executions:** Workers already running complete normally. Deletion affects only new execution attempts.
115
+ - **Data retention:** Execution logs and history for a deleted resource are retained for 30 days, then purged.
116
+
117
+ ---
118
+
119
+ ## Resource Limits & Quotas
120
+
121
+ ### Per-Worker Limits
122
+
123
+ Limits enforced per worker thread at runtime:
124
+
125
+ | Resource | Value |
126
+ | ---------------- | ----------------------------------------------------------- |
127
+ | Memory (V8 heap) | 256MB per worker |
128
+ | Disk | Bundle file only (ephemeral, not persistent across deploys) |
129
+
130
+ - **Memory:** Enforced by the platform. Exceeding 256MB crashes the worker. The platform catches the error; other tenants are unaffected. If your workflow processes large datasets, consider streaming or batching to stay within the limit.
131
+ - **Disk:** Your bundle is written to disk during deploy and available to the worker at execution time. It is not a persistent write surface -- do not write files to disk from within your handler expecting them to persist.
132
+
133
+ ### Scale Limits
134
+
135
+ Hard limits to prevent abuse and ensure platform stability:
136
+
137
+ | Limit | Value |
138
+ | ---------------------------------- | ------------- |
139
+ | Max execution duration (workflows) | 300s (5 min) |
140
+ | Max execution duration (agents) | 600s (10 min) |
141
+ | Max log volume | 100MB/day |
142
+ | Max deploy frequency | 60/day |
143
+
144
+ - **Execution duration:** Executions exceeding the timeout are terminated by the platform. The execution is marked failed with a timeout reason.
145
+ - **Log volume:** Total log output across all executions is capped at 100MB per day. Logs beyond this threshold may be truncated.
146
+ - **Deploy frequency:** 60 deploys per day is generous for normal development. This limit prevents accidental deploy loops (for example, a CI pipeline misconfigured to deploy on every commit).
147
+
148
+ ### Networking
149
+
150
+ - **Outbound:** Unrestricted. Your handlers can call any external API (OpenAI, Twilio, Stripe, etc.) from within the worker.
151
+ - **Inbound:** Workers receive input from the platform coordinator via internal message passing -- they are not exposed to the network directly.
152
+ - **No ports:** Workers communicate with the platform via zero-network-overhead message passing. No port allocation occurs.
153
+ - **Isolation:** Workers have no access to other organizations' data or platform credentials by default. Supabase credentials are not present in the worker environment.
154
+
155
+ ---
156
+
157
+ ## v1 Limitations
158
+
159
+ | Limitation | Reason | Future path |
160
+ | ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------- |
161
+ | **No nested execution from external resources** | External resources cannot call back to the platform's execution coordinator to trigger other resources as sub-executions. | A callback API endpoint that external processes can call to trigger nested executions (requires auth token forwarding). |
162
+ | **No streaming logs** | Execution logs are returned in the response body after completion. There is no real-time SSE streaming from within the worker. | SSE/WebSocket push from external processes to the platform log system. |
163
+ | **Static resource priority conflicts** | If your organization has a static (monorepo) resource with the same ID as a resource in your SDK bundle, the deploy will fail. Static definitions always take priority and cannot be overridden. | Conflict detection is surfaced in the CLI with a clear error message. |
164
+
165
+ ---
166
+
167
+ ## Organization Provisioning
168
+
169
+ Organization creation is currently admin-only. If you need a new organization provisioned for SDK access, contact the Elevasis team. Self-serve organization creation and API key generation is on the roadmap.
170
+
171
+ ---
172
+
173
+ **Last Updated:** 2026-03-06