@usestatemachines/sdk 0.3.0 → 0.5.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 (69) hide show
  1. package/README.md +122 -19
  2. package/agents/SKILL.md +10 -7
  3. package/agents/index.js +6 -6
  4. package/agents/llms.txt +19 -11
  5. package/agents/prompt.md +1 -1
  6. package/esm/extensions/client.d.ts +24 -2
  7. package/esm/extensions/client.js +26 -3
  8. package/esm/extensions/index.d.ts +2 -2
  9. package/esm/extensions/running-environment.d.ts +18 -4
  10. package/esm/extensions/running-environment.js +24 -2
  11. package/esm/extensions/wait.d.ts +3 -1
  12. package/esm/extensions/wait.js +17 -2
  13. package/esm/funcs/environments-get-request-payload.d.ts +11 -0
  14. package/esm/funcs/environments-get-request-payload.js +100 -0
  15. package/esm/funcs/environments-get-request-stats.d.ts +11 -0
  16. package/esm/funcs/environments-get-request-stats.js +103 -0
  17. package/esm/funcs/environments-get-request.d.ts +11 -0
  18. package/esm/funcs/environments-get-request.js +96 -0
  19. package/esm/funcs/environments-list-requests.d.ts +11 -0
  20. package/esm/funcs/environments-list-requests.js +105 -0
  21. package/esm/funcs/environments-resume.d.ts +11 -0
  22. package/esm/funcs/environments-resume.js +93 -0
  23. package/esm/funcs/environments-stop.js +1 -0
  24. package/esm/funcs/environments-suspend.d.ts +11 -0
  25. package/esm/funcs/environments-suspend.js +93 -0
  26. package/esm/lib/config.d.ts +2 -2
  27. package/esm/lib/config.js +2 -2
  28. package/esm/models/environment-app.d.ts +2 -0
  29. package/esm/models/environment-app.js +2 -0
  30. package/esm/models/environment-request-detail.d.ts +40 -0
  31. package/esm/models/environment-request-detail.js +39 -0
  32. package/esm/models/environment-request-stats.d.ts +26 -0
  33. package/esm/models/environment-request-stats.js +31 -0
  34. package/esm/models/environment-request.d.ts +31 -0
  35. package/esm/models/environment-request.js +34 -0
  36. package/esm/models/environment-snapshot.d.ts +3 -2
  37. package/esm/models/environment-snapshot.js +3 -2
  38. package/esm/models/environment.d.ts +4 -0
  39. package/esm/models/environment.js +4 -0
  40. package/esm/models/error-response.d.ts +7 -0
  41. package/esm/models/error-response.js +7 -0
  42. package/esm/models/index.d.ts +4 -0
  43. package/esm/models/index.js +4 -0
  44. package/esm/models/operations/create-environment-definition.d.ts +10 -0
  45. package/esm/models/operations/create-environment-definition.js +3 -0
  46. package/esm/models/operations/get-environment-request-payload.d.ts +23 -0
  47. package/esm/models/operations/get-environment-request-payload.js +19 -0
  48. package/esm/models/operations/get-environment-request-stats.d.ts +70 -0
  49. package/esm/models/operations/get-environment-request-stats.js +55 -0
  50. package/esm/models/operations/get-environment-request.d.ts +25 -0
  51. package/esm/models/operations/get-environment-request.js +21 -0
  52. package/esm/models/operations/index.d.ts +6 -0
  53. package/esm/models/operations/index.js +6 -0
  54. package/esm/models/operations/list-environment-requests.d.ts +75 -0
  55. package/esm/models/operations/list-environment-requests.js +59 -0
  56. package/esm/models/operations/resume-environment.d.ts +25 -0
  57. package/esm/models/operations/resume-environment.js +26 -0
  58. package/esm/models/operations/stop-environment.d.ts +3 -1
  59. package/esm/models/operations/stop-environment.js +8 -2
  60. package/esm/models/operations/suspend-environment.d.ts +25 -0
  61. package/esm/models/operations/suspend-environment.js +26 -0
  62. package/esm/models/release.d.ts +11 -0
  63. package/esm/models/release.js +10 -0
  64. package/esm/models/request-payload-preview.d.ts +31 -0
  65. package/esm/models/request-payload-preview.js +33 -0
  66. package/esm/sdk/environments.d.ts +6 -0
  67. package/esm/sdk/environments.js +24 -0
  68. package/openapi.json +1380 -29
  69. package/package.json +4 -3
package/agents/llms.txt CHANGED
@@ -1,18 +1,20 @@
1
1
  # State Machines
2
2
 
3
- > State Machines runs disposable environments of replica SaaS apps, such as Salesforce, for tests and coding agents. Start, connect to and stop them with the TypeScript SDK `@usestatemachines/sdk`.
3
+ > State Machines runs disposable environments of replica SaaS apps, such as Salesforce, for tests and coding agents. Start, connect to, suspend, resume and stop them with the TypeScript SDK `@usestatemachines/sdk`.
4
4
 
5
5
  Install with `npm install @usestatemachines/sdk`. It is ESM only and runs on Node.js 20.20 or later (22 or 24 recommended) and Cloudflare Workers, not browsers. TypeScript needs `lib: ["DOM"]` or `@types/node`. `new StateMachines()` reads the API key from `STATE_API_KEY` and doesn't read `.env` files; in Cloudflare Workers, pass `apiKey` explicitly. Never print the key. The installed `node_modules/@usestatemachines/sdk/README.md` matches your version: read it before relying on memory.
6
6
 
7
7
  ## Concepts
8
8
 
9
9
  - Environment: one disposable run of one or more apps. `const env = await sm.environments.start({ apps: ['salesforce'] })` creates it, waits until it is `running` and returns a `RunningEnvironment`. If the environment fails or the wait times out or is aborted, `start()` stops the environment and rethrows the original error; an `EnvironmentFailedError` or `TimeoutError` carries `err.environmentId` and `err.stopped`. Always call `env.stop()` in a `finally`.
10
+ - Suspend and resume: `env.suspend()` ends the sandboxes and keeps the data; the lifetime pauses. Await `env.waitUntilSuspended()`, later `env.resume()` and `env.waitUntilReady()` to run again on the same data. `env.stop()` ends the environment and discards its data; a suspended environment still needs it.
10
11
  - Apps: a string is shorthand for `{ key: s, appId: s }`, nothing more. Use the object form, such as `{ key: 'crm', appId: 'salesforce' }`, for your own key or two instances of one app. `appId` names the app in the catalog (`sm.catalog.get()`); `key` is your name for it in this environment, and later calls take the key.
11
12
  - Actor: one of the app's users; requests run with that user's permissions. Salesforce actor IDs are its user IDs, such as `005…`, never a role name. `await env.actors('salesforce')` lists them in the release's order. connect() acts as the environment's declared default connection's actor, or else the first actor, the administrator, unless you pass `actorId`; pick a less-privileged actor to test permissions.
12
13
  - API profile: one API of the app, with its path and versions. Salesforce offers several (`rest`, `soap-partner`, `bulk2`, `oauth`) and has no default, so always pass `apiId`: `env.connect('salesforce', { apiId: 'rest' })`.
13
14
  - Connection: `connection.fetch` never sends your API key, never follows redirects and never retries. `connection.headers()` returns live tokens: treat them as secrets. Salesforce's SOAP profile (`soap-partner`) takes the actor token in the envelope instead: put `connection.actorToken()`, also a secret, in `SessionHeader/sessionId`; `headers()` then carries only `X-State-Environment-Token`.
14
15
  - Full control: `sm.environments.create(input)` returns one `Environment` before the apps boot, `sm.environments.waitUntilReady(environment.id)` waits, and `sm.environments.connect(environment.id, key, options)` connects. Nothing on this path stops the environment for you; use it to keep a failed environment for inspection.
15
- - Snapshot: the saved data of a running environment's apps, taken per app instance. `const snapshot = await env.snapshot({ name: 'seeded' })` captures it and waits until it is `ready`. `sm.environments.start({ snapshotId: snapshot.id })` starts a new environment from it, in place of `apps`; each app keeps its key. Capturing needs `snapshots:create` and `snapshots:read`, restoring needs `snapshots:read`, `rename` needs `snapshots:create`, and `sm.snapshots.delete(id)` needs `snapshots:delete`, which keys created by members don't hold. Snapshots are never deleted automatically, not even failed or timed-out ones: `SnapshotFailedError` and `SnapshotTimeoutError` carry `err.snapshotId`. `sm.snapshots` also has `create`, `waitUntilReady`, `get`, `list` and `rename`.
16
+ - Snapshot: the saved data of a running environment's apps. Every app is paused while it is cut, so a multi-app snapshot is one instant (`consistency: 'environment'`); a single app is `'app_instance'`. `const snapshot = await env.snapshot({ name: 'seeded' })` captures it and waits until it is `ready`. `sm.environments.start({ snapshotId: snapshot.id })` starts a new environment from it, in place of `apps`; each app keeps its key. Capturing needs `snapshots:create` and `snapshots:read`, restoring needs `snapshots:read`, `rename` needs `snapshots:create`, and `sm.snapshots.delete(id)` needs `snapshots:delete`, which keys created by members don't hold. Snapshots are never deleted automatically, not even failed or timed-out ones: `SnapshotFailedError` and `SnapshotTimeoutError` carry `err.snapshotId`. `sm.snapshots` also has `create`, `waitUntilReady`, `get`, `list` and `rename`.
17
+ - Recorded requests: `sm.environments.listRequests(env.id)` pages the calls made to the environment's apps (method, path, status, duration); `getRequest(env.id, id)` adds headers and bodies. Recording is best effort and SOAP bodies are not stored.
16
18
  - Vendor clients: the gateway needs `X-State-Environment-Token` on every request. A client such as jsforce only sends it if you configure custom headers. Prefer `connection.fetch`; if you pass `headers()` to another client, send them only to `connection.baseUrl` and disable redirects.
17
19
  - Pagination: `environments.list`, `environments.events`, `workspaces.events` and `snapshots.list` return one page, `{ data, nextCursor }`. Pass `nextCursor` back as `cursor` until it is `null`.
18
20
 
@@ -20,17 +22,19 @@ Install with `npm install @usestatemachines/sdk`. It is ESM only and runs on Nod
20
22
 
21
23
  Enums are open: handle values you don't recognise.
22
24
 
23
- - Environment `status`: `queued`, `starting`, `running`, `stopping`, `stopped`, `failed`. `stopReason`: `requested`, `expired`, `app_failed`, `owner_lost`.
24
- - App `status`: `pending`, `starting`, `ready`, `stopping`, `stopped`, `failed`. A failed app carries `errorCode`.
25
+ - Environment `status`: `queued`, `starting`, `running`, `suspending`, `suspended`, `stopping`, `stopped`, `failed`. `stopReason`: `requested`, `expired`, `app_failed`, `owner_lost`. A suspended environment keeps its data and carries `suspendedAt`.
26
+ - App `status`: `pending`, `starting`, `ready`, `recovering`, `suspended`, `stopping`, `stopped`, `failed`. A failed app carries `errorCode`.
25
27
  - App `disposal`: `pending`, `complete`, `failed`, `unknown`.
26
- - Snapshot `status`: `capturing`, `ready`, `failed`. A failed snapshot carries `errorCode`: `capture-failed`, or `capture-interrupted` when the API restarted mid-capture.
27
- - `start()` and `waitUntilReady` throw `EnvironmentFailedError` if the environment becomes `failed`, `stopping` or `stopped`, and `TimeoutError` after 10 minutes by default (`readyTimeoutMs` for `start()`, `timeoutMs` for `waitUntilReady`). `start()` then stops the environment; `waitUntilReady` never does.
28
- - `waitUntilStopped` resolves when the environment is `stopped` or `failed` and every app's disposal is `complete`. It throws `DisposalIncompleteError` if a disposal is `failed` or `unknown`, and `TimeoutError` if disposal stays `pending`.
28
+ - Snapshot `status`: `capturing`, `ready`, `failed`. A failed snapshot carries `errorCode`: `capture-failed`, `pause-failed` or `pause-lost` when the apps could not be held paused for the capture, or `capture-interrupted` when the API restarted mid-capture.
29
+ - `start()` and `waitUntilReady` throw `EnvironmentFailedError` if the environment becomes `failed`, `suspending`, `suspended`, `stopping` or `stopped`, and `TimeoutError` after 10 minutes by default (`readyTimeoutMs` for `start()`, `timeoutMs` for `waitUntilReady`). `start()` then stops the environment; `waitUntilReady` never does.
30
+ - `waitUntilSuspended` resolves when the environment is `suspended`, and throws `EnvironmentFailedError` if it ends instead.
31
+ - `waitUntilStopped` resolves when the environment is `stopped` and every app's disposal is `complete`. A `failed` environment keeps its data for `resume()` and is not stopped until you call `stop()`. It throws `DisposalIncompleteError` if a disposal is `failed` or `unknown`, and `TimeoutError` if disposal stays `pending`.
29
32
 
30
33
  ## Limits
31
34
 
32
35
  - Live environments are capped per organization: `(await sm.credential.get()).limits.liveEnvironments`.
33
- - `lifetimeMinutes` defaults to 15 minutes, or the deployment maximum if that is lower. Both are in `(await sm.credential.get()).limits.environmentLifetime`. Lifetime counts from the start, so boot uses part of it; at the end the environment stops with `stopReason: 'expired'`.
36
+ - `lifetimeMinutes` defaults to 15 minutes, or the deployment maximum if that is lower. Both are in `(await sm.credential.get()).limits.environmentLifetime`. Lifetime counts from the start, so boot uses part of it, and pauses while suspended; at the end the environment stops with `stopReason: 'expired'`.
37
+ - A suspended environment doesn't count toward the live cap; resuming it does.
34
38
  - Always call `env.stop()` in a `finally`. In CI, then await `env.waitUntilStopped()`.
35
39
 
36
40
  ## Errors and retries
@@ -39,13 +43,17 @@ A failed API call throws `StateMachinesError` with `status`, `code`, `requestId`
39
43
 
40
44
  | Code | Status | What to do |
41
45
  | --- | --- | --- |
42
- | `environment-limit` | 429 | Not retried. Stop a live environment (`sm.environments.list({ status: 'live' })`), then start again. |
46
+ | `environment-limit` | 429 | Not retried. Suspend or stop a live environment (`sm.environments.list({ status: 'live' })`), then start or resume again. |
47
+ | `not-ready` | 409 | Only a running environment whose apps are all ready can be suspended. Wait for it, or stop it. |
48
+ | `not-suspended` | 409 | Only a suspended environment can resume. After `suspend()`, await `waitUntilSuspended()` first. |
49
+ | `suspend-in-progress` | 409 | The environment is suspending. Await `waitUntilSuspended()`, then stop it. |
43
50
  | `lifetime-too-long` | 422 | Lower `lifetimeMinutes` to at most `limits.environmentLifetime.maximumMinutes`. |
44
51
  | `release-unavailable` | 422 | Unknown or retired app or release. Check `appId` and `appReleaseId` against `sm.catalog.get()`. |
45
52
  | `release-unavailable` | 503 | This deployment doesn't serve the release. Retried within the budget; omit `appReleaseId` to use the default release, or contact support with the `requestId`. A failed app can carry it as `errorCode`. |
46
- | `connection-unavailable` | 409 | The app stopped or the environment is no longer `running`. If it stopped or expired, start a new one. (Before revealing any token, connect() throws a `TypeError` for an app that isn't ready, an unknown actor, or a missing `apiId`.) |
53
+ | `connection-unavailable` | 409 | The app stopped or the environment is no longer `running`. If it is suspended, resume it; if it stopped or expired, start a new one. (Before revealing any token, connect() throws a `TypeError` for an app that isn't ready, an unknown actor, or a missing `apiId`.) |
47
54
  | `idempotency-conflict` | 409 | The idempotency key was used with a different input. Replay with the exact same input. |
48
- | `snapshot-limit` | 429 | Too many captures are running. `capture` and `env.snapshot()` retry it for up to 60 seconds; if it still fails, wait and capture again. |
55
+ | `capture-in-progress` | 409 | This environment is already capturing a snapshot; one runs at a time. Wait for it, then capture again. |
56
+ | `snapshot-limit` | 429 | Older APIs only. `capture` and `env.snapshot()` retry it for up to 60 seconds; if it still fails, wait and capture again. |
49
57
  | `not-ready` | 409 | Capture: the environment isn't `running` or an app isn't `ready`. Restore: the snapshot isn't `ready` yet; `await sm.snapshots.waitUntilReady(id)`. Delete: the snapshot is still `capturing`. |
50
58
  | `version-conflict` | 409 | `rename` sent a stale `expectedVersion`, or the snapshot was deleted. `get` it: if `deletedAt` is set it's gone, otherwise retry with its `version`. |
51
59
  | `release-unavailable` | 422 | On a restore: no release on this deployment matches the snapshot's apps. Start from `apps`, seed again and capture a new snapshot. |
package/agents/prompt.md CHANGED
@@ -20,7 +20,7 @@ try {
20
20
  ```
21
21
 
22
22
  4. Adapt it to my task. Log `await sm.catalog.get()` to find each app's ID and the actors and API profiles its release offers; don't guess IDs. Start only the apps the task needs; a string such as `'salesforce'` means `{ key: 'salesforce', appId: 'salesforce' }`. Salesforce always needs an `apiId`. `connect()` acts as the declared default connection's actor, or else the app's first actor, the administrator; to act as a specific user, pass an `actorId` from `await env.actors('salesforce')`. To reuse seeded data, `await env.snapshot()` once, then `sm.environments.start({ snapshotId })`.
23
- 5. Always call `env.stop()` in a `finally`. In CI, then await `env.waitUntilStopped()` so the run fails if cleanup isn't confirmed. If `start()` fails after creating the environment, it stops it; an `EnvironmentFailedError` or `TimeoutError` carries `err.environmentId` and `err.stopped`. If the create itself fails, call `sm.environments.start(input, { idempotencyKey: err.idempotencyKey })` with the same `input`; never retry without the key, which can start a second environment.
23
+ 5. Always call `env.stop()` in a `finally`; it ends the environment and discards its data. In CI, then await `env.waitUntilStopped()` so the run fails if cleanup isn't confirmed. If `start()` fails after creating the environment, it stops it; an `EnvironmentFailedError` or `TimeoutError` carries `err.environmentId` and `err.stopped`. If the create itself fails, call `sm.environments.start(input, { idempotencyKey: err.idempotencyKey })` with the same `input`; never retry without the key, which can start a second environment.
24
24
  6. Never print, log or commit keys or tokens, including `connection.headers()` and `connection.actorToken()`, which return live tokens.
25
25
 
26
26
  Read more: `node_modules/@usestatemachines/sdk/README.md`, https://state-web.usestatemachines.workers.dev/llms.txt and https://www.npmjs.com/package/@usestatemachines/sdk
@@ -4,9 +4,14 @@ import type { Connection as ConnectionDetails } from '../models/connection.js';
4
4
  import type { ConnectionSecret } from '../models/connection-secret.js';
5
5
  import type { Credential } from '../models/credential.js';
6
6
  import type { Environment } from '../models/environment.js';
7
+ import type { EnvironmentRequest } from '../models/environment-request.js';
8
+ import type { EnvironmentRequestDetail } from '../models/environment-request-detail.js';
9
+ import type { EnvironmentRequestStats } from '../models/environment-request-stats.js';
7
10
  import type { EnvironmentSnapshot } from '../models/environment-snapshot.js';
8
11
  import type { EventPage } from '../models/event-page.js';
9
12
  import type { CaptureSnapshotRequestBody } from '../models/operations/capture-snapshot.js';
13
+ import type { GetEnvironmentRequestStatsRequest } from '../models/operations/get-environment-request-stats.js';
14
+ import type { ListEnvironmentRequestsRequest } from '../models/operations/list-environment-requests.js';
10
15
  import type { ListEnvironmentsRequest } from '../models/operations/list-environments.js';
11
16
  import type { ListSnapshotsRequest } from '../models/operations/list-snapshots.js';
12
17
  import type { ListWorkspacesRequest } from '../models/operations/list-workspaces.js';
@@ -33,6 +38,9 @@ export interface StateMachinesOptions {
33
38
  export interface CallOptions {
34
39
  signal?: AbortSignal;
35
40
  }
41
+ export interface LifecycleOptions extends CallOptions {
42
+ idempotencyKey?: string;
43
+ }
36
44
  export interface CreateOptions extends CallOptions {
37
45
  idempotencyKey?: string;
38
46
  workspaceId?: string;
@@ -92,17 +100,31 @@ export declare class StateMachines {
92
100
  * failure carries the `idempotencyKey`; replaying the create with it is safe.
93
101
  */
94
102
  create: (input: EnvironmentSource, options?: CreateOptions) => Promise<Environment>;
95
- stop: (environmentId: string, options?: CallOptions | undefined) => Promise<Environment>;
103
+ /** Ends the environment and discards its data. Safe to repeat. */
104
+ stop: (environmentId: string, options?: LifecycleOptions | undefined) => Promise<Environment>;
105
+ /**
106
+ * Suspends a running environment: its sandboxes end and its data stays for `resume`.
107
+ * Its lifetime is paused meanwhile. Use `stop` to end it.
108
+ */
109
+ suspend: (environmentId: string, options?: LifecycleOptions | undefined) => Promise<Environment>;
110
+ /** Resumes a suspended or failed environment using its retained data. */
111
+ resume: (environmentId: string, options?: LifecycleOptions | undefined) => Promise<Environment>;
96
112
  events: (environmentId: string, query?: {
97
113
  limit?: number;
98
114
  cursor?: string;
99
115
  }, options?: CallOptions | undefined) => Promise<EventPage>;
116
+ listRequests: (environmentId: string, query?: Omit<ListEnvironmentRequestsRequest, "environmentId">, options?: CallOptions | undefined) => Promise<Page<EnvironmentRequest>>;
117
+ getRequestStats: (environmentId: string, query: Omit<GetEnvironmentRequestStatsRequest, "environmentId">, options?: CallOptions | undefined) => Promise<EnvironmentRequestStats>;
118
+ getRequest: (environmentId: string, requestId: string, options?: CallOptions | undefined) => Promise<EnvironmentRequestDetail>;
119
+ getRequestPayload: (environmentId: string, requestId: string, direction: "request" | "response", options?: CallOptions | undefined) => Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
100
120
  /** The app's users, in the release's order. */
101
121
  actors: (environmentId: string, appKey: string, options?: CallOptions | undefined) => Promise<ReleaseActor[]>;
102
122
  getConnection: (environmentId: string, appKey: string, options?: CallOptions | undefined) => Promise<ConnectionDetails>;
103
123
  reveal: (environmentId: string, appKey: string, actorId: string, options?: CallOptions | undefined) => Promise<ConnectionSecret>;
104
- /** Resolves when the environment is running. Never stops it. */
124
+ /** Resolves when the environment is running. Never suspends or stops it. */
105
125
  waitUntilReady: (environmentId: string, options?: WaitOptions | undefined) => Promise<Environment>;
126
+ /** Resolves when the environment is suspended and can resume. */
127
+ waitUntilSuspended: (environmentId: string, options?: WaitOptions | undefined) => Promise<Environment>;
106
128
  /** Resolves when the environment ended and every sandbox is confirmed disposed. */
107
129
  waitUntilStopped: (environmentId: string, options?: WaitOptions | undefined) => Promise<Environment>;
108
130
  /**
@@ -6,7 +6,7 @@ import { Connection } from './connection.js';
6
6
  import { CallerAbortedError, EnvironmentFailedError, SnapshotFailedError, SnapshotTimeoutError, StateMachinesError, TimeoutError, toStateMachinesError, } from './errors.js';
7
7
  import { RunningEnvironment } from './running-environment.js';
8
8
  import { linkSignal } from './signal.js';
9
- import { backoff, defaultTimeoutMs, disposed, poll, pollUntil, ready, sleep, snapshotReady, } from './wait.js';
9
+ import { backoff, defaultTimeoutMs, disposed, poll, pollUntil, ready, sleep, snapshotReady, suspended, } from './wait.js';
10
10
  const stopAfterFailureMs = 30000;
11
11
  const busyBudgetMs = 60000;
12
12
  export class StateMachines {
@@ -127,15 +127,29 @@ export class StateMachines {
127
127
  throw new StateMachinesError(error, { idempotencyKey });
128
128
  }
129
129
  },
130
- stop: (environmentId, options) => this.#unwrap(options, (call) => this.#sdk.environments.stop({ environmentId }, call)),
130
+ /** Ends the environment and discards its data. Safe to repeat. */
131
+ stop: (environmentId, options) => this.#command('stop', environmentId, options),
132
+ /**
133
+ * Suspends a running environment: its sandboxes end and its data stays for `resume`.
134
+ * Its lifetime is paused meanwhile. Use `stop` to end it.
135
+ */
136
+ suspend: (environmentId, options) => this.#command('suspend', environmentId, options),
137
+ /** Resumes a suspended or failed environment using its retained data. */
138
+ resume: (environmentId, options) => this.#command('resume', environmentId, options),
131
139
  events: (environmentId, query = {}, options) => this.#call(options, (call) => this.#sdk.environments.events({ ...query, environmentId }, call)),
140
+ listRequests: (environmentId, query = {}, options) => this.#call(options, (call) => this.#sdk.environments.listRequests({ ...query, environmentId }, call)),
141
+ getRequestStats: (environmentId, query, options) => this.#unwrap(options, (call) => this.#sdk.environments.getRequestStats({ ...query, environmentId }, call)),
142
+ getRequest: (environmentId, requestId, options) => this.#unwrap(options, (call) => this.#sdk.environments.getRequest({ environmentId, requestId }, call)),
143
+ getRequestPayload: (environmentId, requestId, direction, options) => this.#call(options, (call) => this.#sdk.environments.getRequestPayload({ environmentId, requestId, direction }, call)),
132
144
  /** The app's users, in the release's order. */
133
145
  actors: async (environmentId, appKey, options) => (await this.environments.getConnection(environmentId, appKey, options))
134
146
  .actors,
135
147
  getConnection: (environmentId, appKey, options) => this.#unwrap(options, (call) => this.#sdk.environments.getConnection({ environmentId, appKey }, call)),
136
148
  reveal: (environmentId, appKey, actorId, options) => this.#reveal(environmentId, appKey, { actorId }, options),
137
- /** Resolves when the environment is running. Never stops it. */
149
+ /** Resolves when the environment is running. Never suspends or stops it. */
138
150
  waitUntilReady: (environmentId, options) => poll((signal) => this.#poll(environmentId, signal), ready, options),
151
+ /** Resolves when the environment is suspended and can resume. */
152
+ waitUntilSuspended: (environmentId, options) => poll((signal) => this.#poll(environmentId, signal), suspended, options),
139
153
  /** Resolves when the environment ended and every sandbox is confirmed disposed. */
140
154
  waitUntilStopped: (environmentId, options) => poll((signal) => this.#poll(environmentId, signal), disposed, options),
141
155
  /**
@@ -217,6 +231,15 @@ export class StateMachines {
217
231
  /** Marks the snapshot deleted and returns it; safe to repeat. A capturing snapshot is a 409 `not-ready`. */
218
232
  delete: (snapshotId, options) => this.#unwrap(options, (call) => this.#sdk.snapshots.delete({ snapshotId }, call)),
219
233
  };
234
+ async #command(verb, environmentId, options = {}) {
235
+ const idempotencyKey = options.idempotencyKey ?? crypto.randomUUID();
236
+ try {
237
+ return await this.#unwrap(options, (call) => this.#sdk.environments[verb]({ environmentId, idempotencyKey }, call));
238
+ }
239
+ catch (error) {
240
+ throw new StateMachinesError(error, { idempotencyKey });
241
+ }
242
+ }
220
243
  async #createSnapshot(environmentId, input, options, busyMs) {
221
244
  const idempotencyKey = options.idempotencyKey ?? crypto.randomUUID();
222
245
  try {
@@ -1,11 +1,11 @@
1
1
  export type { Fetcher, HTTPClientOptions } from '../lib/http.js';
2
2
  export { HTTPClient } from '../lib/http.js';
3
3
  export { ConnectionError, ErrorResponse, HTTPClientError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, ResponseValidationError, SDKValidationError, StateMachinesHTTPError, UnexpectedClientError, UnexpectedResponseError, } from '../models/errors/index.js';
4
- export type { ApiProfile, App, AppInstanceSnapshot, Catalog, Connection as ConnectionDetails, ConnectionSecret, CreateEnvironmentInput, Credential, Environment, EnvironmentApp, EnvironmentSnapshot, Event, EventPage, Release, ReleaseActor, Workspace, } from '../models/index.js';
4
+ export type { ApiProfile, App, AppInstanceSnapshot, Catalog, Connection as ConnectionDetails, ConnectionSecret, CreateEnvironmentInput, Credential, Environment, EnvironmentApp, EnvironmentRequest, EnvironmentRequestDetail, EnvironmentRequestStats, EnvironmentSnapshot, Event, EventPage, Release, ReleaseActor, Workspace, } from '../models/index.js';
5
5
  export { Code as ErrorCode, Disposal, EnvironmentStatus, StopReason, } from '../models/index.js';
6
6
  export { Status as EnvironmentListStatus } from '../models/operations/list-environments.js';
7
7
  export type { AppInput, EnvironmentInput, SnapshotEnvironmentInput, } from './apps.js';
8
- export type { CallOptions, CaptureInput, CaptureOptions, ConnectOptions, CreateOptions, ListEnvironmentsQuery, ListSnapshotsQuery, Page, StartOptions, StateMachinesOptions, } from './client.js';
8
+ export type { CallOptions, CaptureInput, CaptureOptions, ConnectOptions, CreateOptions, LifecycleOptions, ListEnvironmentsQuery, ListSnapshotsQuery, Page, StartOptions, StateMachinesOptions, } from './client.js';
9
9
  export { StateMachines } from './client.js';
10
10
  export { Connection, formatActorHeader } from './connection.js';
11
11
  export { DisposalIncompleteError, EnvironmentFailedError, SnapshotFailedError, SnapshotTimeoutError, StateMachinesError, TimeoutError, } from './errors.js';
@@ -1,10 +1,10 @@
1
1
  import type { Environment } from '../models/environment.js';
2
2
  import type { EnvironmentSnapshot } from '../models/environment-snapshot.js';
3
3
  import type { ReleaseActor } from '../models/release-actor.js';
4
- import type { CallOptions, CaptureInput, CaptureOptions, ConnectOptions, StateMachines } from './client.js';
4
+ import type { CallOptions, CaptureInput, CaptureOptions, ConnectOptions, LifecycleOptions, StateMachines } from './client.js';
5
5
  import type { Connection } from './connection.js';
6
6
  import type { WaitOptions } from './wait.js';
7
- /** A started environment. It remains the handle after `stop()`. */
7
+ /** A started environment. It remains the handle after `suspend()` and `stop()`. */
8
8
  export declare class RunningEnvironment {
9
9
  #private;
10
10
  readonly id: string;
@@ -21,8 +21,22 @@ export declare class RunningEnvironment {
21
21
  actors(appKey: string, options?: CallOptions): Promise<ReleaseActor[]>;
22
22
  /** Captures a snapshot in the environment's own workspace and waits until it's `ready`. */
23
23
  snapshot(input?: CaptureInput, options?: CaptureOptions): Promise<EnvironmentSnapshot>;
24
- /** Safe to call twice. Doesn't wait for disposal: use `waitUntilStopped()`. */
25
- stop(options?: CallOptions): Promise<Environment>;
24
+ /**
25
+ * Ends the sandboxes and keeps the data for `resume()`. Doesn't wait: use
26
+ * `waitUntilSuspended()` before resuming.
27
+ */
28
+ suspend(options?: LifecycleOptions): Promise<Environment>;
29
+ /** Resolves when the environment is suspended and can resume. */
30
+ waitUntilSuspended(options?: WaitOptions): Promise<Environment>;
31
+ /** Runs a suspended or failed environment again on its data. Use `waitUntilReady()` before connecting. */
32
+ resume(options?: LifecycleOptions): Promise<Environment>;
33
+ /** Resolves when the environment is running again. */
34
+ waitUntilReady(options?: WaitOptions): Promise<Environment>;
35
+ /**
36
+ * Ends the environment and discards its data. Safe to call twice. Doesn't wait for
37
+ * disposal: use `waitUntilStopped()`.
38
+ */
39
+ stop(options?: LifecycleOptions): Promise<Environment>;
26
40
  /** Resolves when the environment ended and every sandbox is confirmed disposed. */
27
41
  waitUntilStopped(options?: WaitOptions): Promise<Environment>;
28
42
  toJSON(): {
@@ -1,4 +1,4 @@
1
- /** A started environment. It remains the handle after `stop()`. */
1
+ /** A started environment. It remains the handle after `suspend()` and `stop()`. */
2
2
  export class RunningEnvironment {
3
3
  id;
4
4
  /** The record when `start()` resolved. Use `sm.environments.get(id)` for fresh state. */
@@ -30,7 +30,29 @@ export class RunningEnvironment {
30
30
  workspaceId: options.workspaceId ?? this.environment.workspaceId,
31
31
  });
32
32
  }
33
- /** Safe to call twice. Doesn't wait for disposal: use `waitUntilStopped()`. */
33
+ /**
34
+ * Ends the sandboxes and keeps the data for `resume()`. Doesn't wait: use
35
+ * `waitUntilSuspended()` before resuming.
36
+ */
37
+ suspend(options) {
38
+ return this.#environments.suspend(this.id, options);
39
+ }
40
+ /** Resolves when the environment is suspended and can resume. */
41
+ waitUntilSuspended(options) {
42
+ return this.#environments.waitUntilSuspended(this.id, options);
43
+ }
44
+ /** Runs a suspended or failed environment again on its data. Use `waitUntilReady()` before connecting. */
45
+ resume(options) {
46
+ return this.#environments.resume(this.id, options);
47
+ }
48
+ /** Resolves when the environment is running again. */
49
+ waitUntilReady(options) {
50
+ return this.#environments.waitUntilReady(this.id, options);
51
+ }
52
+ /**
53
+ * Ends the environment and discards its data. Safe to call twice. Doesn't wait for
54
+ * disposal: use `waitUntilStopped()`.
55
+ */
34
56
  stop(options) {
35
57
  return this.#environments.stop(this.id, options);
36
58
  }
@@ -15,8 +15,10 @@ export declare function poll(read: Read<Environment>, done: Decide<Environment>,
15
15
  * Transient read failures are retried with backoff until the deadline.
16
16
  */
17
17
  export declare function pollUntil<T>(read: Read<T>, done: Decide<T>, options: WaitOptions | undefined, timeout: (timeoutMs: number, last: T | null) => Error): Promise<T>;
18
- /** Resolves on `running`. Never stops the environment. */
18
+ /** Resolves on `running`. Never suspends or stops the environment. */
19
19
  export declare function ready(environment: Environment): boolean;
20
+ /** Resolves on `suspended`, when the environment can resume. */
21
+ export declare function suspended(environment: Environment): boolean;
20
22
  /** Resolves once the environment ended and every app's sandbox is confirmed disposed. */
21
23
  export declare function disposed(environment: Environment): boolean;
22
24
  /** Resolves on `ready`. A failed or deleted snapshot ends the wait. */
@@ -58,12 +58,27 @@ export async function pollUntil(read, done, options = {}, timeout) {
58
58
  await sleep(Math.min(waitMs, deadline - Date.now()), signal);
59
59
  }
60
60
  }
61
- /** Resolves on `running`. Never stops the environment. */
61
+ /** Resolves on `running`. Never suspends or stops the environment. */
62
62
  export function ready(environment) {
63
63
  switch (environment.status) {
64
64
  case 'running':
65
65
  return true;
66
66
  case 'failed':
67
+ case 'suspending':
68
+ case 'suspended':
69
+ case 'stopping':
70
+ case 'stopped':
71
+ throw new EnvironmentFailedError(environment);
72
+ default:
73
+ return false;
74
+ }
75
+ }
76
+ /** Resolves on `suspended`, when the environment can resume. */
77
+ export function suspended(environment) {
78
+ switch (environment.status) {
79
+ case 'suspended':
80
+ return true;
81
+ case 'failed':
67
82
  case 'stopping':
68
83
  case 'stopped':
69
84
  throw new EnvironmentFailedError(environment);
@@ -73,7 +88,7 @@ export function ready(environment) {
73
88
  }
74
89
  /** Resolves once the environment ended and every app's sandbox is confirmed disposed. */
75
90
  export function disposed(environment) {
76
- if (environment.status !== 'stopped' && environment.status !== 'failed') {
91
+ if (environment.status !== 'stopped') {
77
92
  return false;
78
93
  }
79
94
  const unconfirmed = environment.apps.some(({ disposal }) => disposal === 'failed' || disposal === 'unknown');
@@ -0,0 +1,11 @@
1
+ import { StateMachinesCore } from "../core.js";
2
+ import { RequestOptions } from "../lib/sdks.js";
3
+ import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/http-client-errors.js";
4
+ import * as errors from "../models/errors/index.js";
5
+ import { ResponseValidationError } from "../models/errors/response-validation-error.js";
6
+ import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
7
+ import { StateMachinesHTTPError } from "../models/errors/state-machines-http-error.js";
8
+ import * as operations from "../models/operations/index.js";
9
+ import { APIPromise } from "../types/async.js";
10
+ import { Result } from "../types/fp.js";
11
+ export declare function environmentsGetRequestPayload(client: StateMachinesCore, request: operations.GetEnvironmentRequestPayloadRequest, options?: RequestOptions): APIPromise<Result<ReadableStream<Uint8Array>, errors.ErrorResponse | StateMachinesHTTPError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
@@ -0,0 +1,100 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+ import * as z from "zod/v4-mini";
5
+ import { encodeSimple } from "../lib/encodings.js";
6
+ import { matchStatusCode } from "../lib/http.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
11
+ import { pathToFunc } from "../lib/url.js";
12
+ import * as errors from "../models/errors/index.js";
13
+ import * as operations from "../models/operations/index.js";
14
+ import { APIPromise } from "../types/async.js";
15
+ export function environmentsGetRequestPayload(client, request, options) {
16
+ return new APIPromise($do(client, request, options));
17
+ }
18
+ async function $do(client, request, options) {
19
+ const parsed = safeParse(request, (value) => z.parse(operations.GetEnvironmentRequestPayloadRequest$outboundSchema, value), "Input validation failed");
20
+ if (!parsed.ok) {
21
+ return [parsed, { status: "invalid" }];
22
+ }
23
+ const payload = parsed.value;
24
+ const body = null;
25
+ const pathParams = {
26
+ direction: encodeSimple("direction", payload.direction, {
27
+ explode: false,
28
+ charEncoding: "percent",
29
+ }),
30
+ environmentId: encodeSimple("environmentId", payload.environmentId, {
31
+ explode: false,
32
+ charEncoding: "percent",
33
+ }),
34
+ requestId: encodeSimple("requestId", payload.requestId, {
35
+ explode: false,
36
+ charEncoding: "percent",
37
+ }),
38
+ };
39
+ const path = pathToFunc("/v1/environments/{environmentId}/requests/{requestId}/payload/{direction}")(pathParams);
40
+ const headers = new Headers(compactMap({
41
+ Accept: "application/octet-stream",
42
+ }));
43
+ const secConfig = await extractSecurity(client._options.apiKey);
44
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
45
+ const requestSecurity = resolveGlobalSecurity(securityInput);
46
+ const context = {
47
+ options: client._options,
48
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
49
+ operationID: "getEnvironmentRequestPayload",
50
+ oAuth2Scopes: null,
51
+ resolvedSecurity: requestSecurity,
52
+ securitySource: client._options.apiKey,
53
+ retryConfig: options?.retries
54
+ || client._options.retryConfig
55
+ || {
56
+ strategy: "backoff",
57
+ backoff: {
58
+ initialInterval: 1000,
59
+ maxInterval: 5000,
60
+ exponent: 1.5,
61
+ maxElapsedTime: 600000,
62
+ },
63
+ retryConnectionErrors: true,
64
+ }
65
+ || { strategy: "none" },
66
+ retryCodes: options?.retryCodes || ["502", "503", "504"],
67
+ };
68
+ const requestRes = client._createRequest(context, {
69
+ security: requestSecurity,
70
+ method: "GET",
71
+ baseURL: options?.serverURL,
72
+ path: path,
73
+ headers: headers,
74
+ body: body,
75
+ userAgent: client._options.userAgent,
76
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
77
+ }, options);
78
+ if (!requestRes.ok) {
79
+ return [requestRes, { status: "invalid" }];
80
+ }
81
+ const req = requestRes.value;
82
+ const doResult = await client._do(req, {
83
+ context,
84
+ isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
85
+ retryConfig: context.retryConfig,
86
+ retryCodes: context.retryCodes,
87
+ });
88
+ if (!doResult.ok) {
89
+ return [doResult, { status: "request-error", request: req }];
90
+ }
91
+ const response = doResult.value;
92
+ const responseFields = {
93
+ HttpMeta: { Response: response, Request: req },
94
+ };
95
+ const [result] = await M.match(M.stream(200, z.custom(x => x instanceof ReadableStream)), M.jsonErr([400, 401, 403, 404, 409, 413, 422, 429], errors.ErrorResponse$inboundSchema), M.jsonErr([500, 503], errors.ErrorResponse$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
96
+ if (!result.ok) {
97
+ return [result, { status: "complete", request: req, response }];
98
+ }
99
+ return [result, { status: "complete", request: req, response }];
100
+ }
@@ -0,0 +1,11 @@
1
+ import { StateMachinesCore } from "../core.js";
2
+ import { RequestOptions } from "../lib/sdks.js";
3
+ import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/http-client-errors.js";
4
+ import * as errors from "../models/errors/index.js";
5
+ import { ResponseValidationError } from "../models/errors/response-validation-error.js";
6
+ import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
7
+ import { StateMachinesHTTPError } from "../models/errors/state-machines-http-error.js";
8
+ import * as operations from "../models/operations/index.js";
9
+ import { APIPromise } from "../types/async.js";
10
+ import { Result } from "../types/fp.js";
11
+ export declare function environmentsGetRequestStats(client: StateMachinesCore, request: operations.GetEnvironmentRequestStatsRequest, options?: RequestOptions): APIPromise<Result<operations.GetEnvironmentRequestStatsResponse, errors.ErrorResponse | StateMachinesHTTPError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
@@ -0,0 +1,103 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+ import * as z from "zod/v4-mini";
5
+ import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
6
+ import { matchStatusCode } from "../lib/http.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
11
+ import { pathToFunc } from "../lib/url.js";
12
+ import * as errors from "../models/errors/index.js";
13
+ import * as operations from "../models/operations/index.js";
14
+ import { APIPromise } from "../types/async.js";
15
+ export function environmentsGetRequestStats(client, request, options) {
16
+ return new APIPromise($do(client, request, options));
17
+ }
18
+ async function $do(client, request, options) {
19
+ const parsed = safeParse(request, (value) => z.parse(operations.GetEnvironmentRequestStatsRequest$outboundSchema, value), "Input validation failed");
20
+ if (!parsed.ok) {
21
+ return [parsed, { status: "invalid" }];
22
+ }
23
+ const payload = parsed.value;
24
+ const body = null;
25
+ const pathParams = {
26
+ environmentId: encodeSimple("environmentId", payload.environmentId, {
27
+ explode: false,
28
+ charEncoding: "percent",
29
+ }),
30
+ };
31
+ const path = pathToFunc("/v1/environments/{environmentId}/requests/stats")(pathParams);
32
+ const query = encodeFormQuery({
33
+ "appKey": payload.appKey,
34
+ "from": payload.from,
35
+ "method": payload.method,
36
+ "search": payload.search,
37
+ "status": payload.status,
38
+ "statusClass": payload.statusClass,
39
+ "to": payload.to,
40
+ "writesOnly": payload.writesOnly,
41
+ });
42
+ const headers = new Headers(compactMap({
43
+ Accept: "application/json",
44
+ }));
45
+ const secConfig = await extractSecurity(client._options.apiKey);
46
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
47
+ const requestSecurity = resolveGlobalSecurity(securityInput);
48
+ const context = {
49
+ options: client._options,
50
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
51
+ operationID: "getEnvironmentRequestStats",
52
+ oAuth2Scopes: null,
53
+ resolvedSecurity: requestSecurity,
54
+ securitySource: client._options.apiKey,
55
+ retryConfig: options?.retries
56
+ || client._options.retryConfig
57
+ || {
58
+ strategy: "backoff",
59
+ backoff: {
60
+ initialInterval: 1000,
61
+ maxInterval: 5000,
62
+ exponent: 1.5,
63
+ maxElapsedTime: 600000,
64
+ },
65
+ retryConnectionErrors: true,
66
+ }
67
+ || { strategy: "none" },
68
+ retryCodes: options?.retryCodes || ["502", "503", "504"],
69
+ };
70
+ const requestRes = client._createRequest(context, {
71
+ security: requestSecurity,
72
+ method: "GET",
73
+ baseURL: options?.serverURL,
74
+ path: path,
75
+ headers: headers,
76
+ query: query,
77
+ body: body,
78
+ userAgent: client._options.userAgent,
79
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
80
+ }, options);
81
+ if (!requestRes.ok) {
82
+ return [requestRes, { status: "invalid" }];
83
+ }
84
+ const req = requestRes.value;
85
+ const doResult = await client._do(req, {
86
+ context,
87
+ isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
88
+ retryConfig: context.retryConfig,
89
+ retryCodes: context.retryCodes,
90
+ });
91
+ if (!doResult.ok) {
92
+ return [doResult, { status: "request-error", request: req }];
93
+ }
94
+ const response = doResult.value;
95
+ const responseFields = {
96
+ HttpMeta: { Response: response, Request: req },
97
+ };
98
+ const [result] = await M.match(M.json(200, operations.GetEnvironmentRequestStatsResponse$inboundSchema), M.jsonErr([400, 401, 403, 404, 409, 413, 422, 429], errors.ErrorResponse$inboundSchema), M.jsonErr([500, 503], errors.ErrorResponse$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
99
+ if (!result.ok) {
100
+ return [result, { status: "complete", request: req, response }];
101
+ }
102
+ return [result, { status: "complete", request: req, response }];
103
+ }
@@ -0,0 +1,11 @@
1
+ import { StateMachinesCore } from "../core.js";
2
+ import { RequestOptions } from "../lib/sdks.js";
3
+ import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/http-client-errors.js";
4
+ import * as errors from "../models/errors/index.js";
5
+ import { ResponseValidationError } from "../models/errors/response-validation-error.js";
6
+ import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
7
+ import { StateMachinesHTTPError } from "../models/errors/state-machines-http-error.js";
8
+ import * as operations from "../models/operations/index.js";
9
+ import { APIPromise } from "../types/async.js";
10
+ import { Result } from "../types/fp.js";
11
+ export declare function environmentsGetRequest(client: StateMachinesCore, request: operations.GetEnvironmentRequestRequest, options?: RequestOptions): APIPromise<Result<operations.GetEnvironmentRequestResponse, errors.ErrorResponse | StateMachinesHTTPError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;