@computesdk/gravixlayer 1.0.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 computesdk
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # @computesdk/gravixlayer
2
+
3
+ [GravixLayer](https://gravixlayer.ai) provider for ComputeSDK — cloud runtimes
4
+ with a native filesystem API, live command streaming, port publishing, templates,
5
+ and snapshots.
6
+
7
+ ```bash
8
+ npm install @computesdk/gravixlayer
9
+ ```
10
+
11
+ Requires Node.js 20 or later.
12
+
13
+ ```ts
14
+ import { gravixlayer } from '@computesdk/gravixlayer'
15
+
16
+ const compute = gravixlayer({
17
+ apiKey: process.env.GRAVIXLAYER_API_KEY,
18
+ })
19
+
20
+ const sandbox = await compute.sandbox.create({
21
+ templateId: 'base-small',
22
+ })
23
+ const result = await sandbox.runCommand('node --version')
24
+ console.log(result.stdout)
25
+ await sandbox.destroy()
26
+ ```
27
+
28
+ Get an API key at <https://gravixlayer.ai>. The TypeScript SDK is
29
+ [`gravixlayer`](https://www.npmjs.com/package/gravixlayer); product docs live at
30
+ <https://docs.gravixlayer.ai>.
31
+
32
+ ## Configuration
33
+
34
+ | Option | Environment variable | Description |
35
+ | ------------ | ----------------------- | ------------------------------------------------ |
36
+ | `apiKey` | `GRAVIXLAYER_API_KEY` | GravixLayer API key (required). |
37
+ | `baseUrl` | `GRAVIXLAYER_BASE_URL` | API origin. Defaults to `https://api.gravixlayer.ai`. |
38
+ | `cloud` | `GRAVIXLAYER_CLOUD` | Cloud for runtime and template placement. Defaults to `aws`. |
39
+ | `region` | `GRAVIXLAYER_REGION` | Region for runtime and template placement. Defaults to `us-east-1`. |
40
+ | `timeout` | — | Request timeout in milliseconds. |
41
+ | `maxRetries` | — | Retry budget. Defaults to `0`. |
42
+ | `http2` | — | Use HTTP/2. Defaults to `true`. |
43
+
44
+ `create` takes `templateId` (an existing template), or `snapshotId`, plus
45
+ `envs`, `timeout`, `metadata`, `cloud`, and `region`. Omitting `templateId`
46
+ boots `base-small`. Omitting `cloud` and `region` uses `aws` and `us-east-1`.
47
+ Sizing comes from the template. `image` is not accepted: build a template from
48
+ an image with `template.create({ name, fromImage })`, then pass its name as
49
+ `templateId`. `sandbox.getInstance()` returns the GravixLayer
50
+ `Runtime` handle for filesystem, services, and other SDK APIs.
51
+
52
+ Snapshots require a `name` on `snapshot.create`. Template builds need
53
+ `fromImage` or `dockerfile` on `template.create`; select an existing template
54
+ with `templateId` when creating a sandbox.
@@ -0,0 +1,59 @@
1
+ import { CreateTemplateOptions, Provider, ProviderTemplateManager } from '@computesdk/provider';
2
+ import { Runtime } from 'gravixlayer';
3
+ export { Runtime as GravixLayerRuntime } from 'gravixlayer';
4
+
5
+ /**
6
+ * @computesdk/gravixlayer — GravixLayer provider for ComputeSDK.
7
+ *
8
+ * Cloud runtimes with a native filesystem API, live command streaming,
9
+ * port publishing, templates, and snapshots.
10
+ *
11
+ * @see https://gravixlayer.ai
12
+ */
13
+
14
+ interface GravixLayerConfig {
15
+ apiKey?: string;
16
+ baseUrl?: string;
17
+ cloud?: string;
18
+ region?: string;
19
+ timeout?: number;
20
+ maxRetries?: number;
21
+ http2?: boolean;
22
+ }
23
+ /** Snapshot returned by this provider's snapshot manager. */
24
+ interface GravixLayerSnapshot {
25
+ id: string;
26
+ provider: 'gravixlayer';
27
+ createdAt: Date;
28
+ metadata: {
29
+ name: string;
30
+ state: string;
31
+ kind: string;
32
+ };
33
+ }
34
+ /** Template returned by this provider's template manager. */
35
+ interface GravixLayerTemplate {
36
+ id: string;
37
+ provider: 'gravixlayer';
38
+ name: string;
39
+ createdAt: Date;
40
+ }
41
+ /** Extra fields accepted on template.create beyond ComputeSDK's base options. */
42
+ interface GravixLayerCreateTemplateOptions extends CreateTemplateOptions {
43
+ fromImage?: string;
44
+ dockerfile?: string;
45
+ run?: string[];
46
+ vcpu?: number;
47
+ memoryMb?: number;
48
+ diskMb?: number;
49
+ }
50
+ /** Public provider with GravixLayer-specific template.create options. */
51
+ interface GravixLayerProvider extends Provider<Runtime, GravixLayerTemplate, GravixLayerSnapshot> {
52
+ template: ProviderTemplateManager<GravixLayerTemplate, GravixLayerCreateTemplateOptions>;
53
+ }
54
+ /** Clear the module-level GravixLayer client cache. For tests only. */
55
+ declare function clearGravixLayerClients(): void;
56
+ /** Preserve GravixLayer-specific template.create options on the public provider. */
57
+ declare function gravixlayer(config?: GravixLayerConfig): GravixLayerProvider;
58
+
59
+ export { type GravixLayerConfig, type GravixLayerCreateTemplateOptions, type GravixLayerProvider, type GravixLayerSnapshot, type GravixLayerTemplate, clearGravixLayerClients, gravixlayer };
@@ -0,0 +1,59 @@
1
+ import { CreateTemplateOptions, Provider, ProviderTemplateManager } from '@computesdk/provider';
2
+ import { Runtime } from 'gravixlayer';
3
+ export { Runtime as GravixLayerRuntime } from 'gravixlayer';
4
+
5
+ /**
6
+ * @computesdk/gravixlayer — GravixLayer provider for ComputeSDK.
7
+ *
8
+ * Cloud runtimes with a native filesystem API, live command streaming,
9
+ * port publishing, templates, and snapshots.
10
+ *
11
+ * @see https://gravixlayer.ai
12
+ */
13
+
14
+ interface GravixLayerConfig {
15
+ apiKey?: string;
16
+ baseUrl?: string;
17
+ cloud?: string;
18
+ region?: string;
19
+ timeout?: number;
20
+ maxRetries?: number;
21
+ http2?: boolean;
22
+ }
23
+ /** Snapshot returned by this provider's snapshot manager. */
24
+ interface GravixLayerSnapshot {
25
+ id: string;
26
+ provider: 'gravixlayer';
27
+ createdAt: Date;
28
+ metadata: {
29
+ name: string;
30
+ state: string;
31
+ kind: string;
32
+ };
33
+ }
34
+ /** Template returned by this provider's template manager. */
35
+ interface GravixLayerTemplate {
36
+ id: string;
37
+ provider: 'gravixlayer';
38
+ name: string;
39
+ createdAt: Date;
40
+ }
41
+ /** Extra fields accepted on template.create beyond ComputeSDK's base options. */
42
+ interface GravixLayerCreateTemplateOptions extends CreateTemplateOptions {
43
+ fromImage?: string;
44
+ dockerfile?: string;
45
+ run?: string[];
46
+ vcpu?: number;
47
+ memoryMb?: number;
48
+ diskMb?: number;
49
+ }
50
+ /** Public provider with GravixLayer-specific template.create options. */
51
+ interface GravixLayerProvider extends Provider<Runtime, GravixLayerTemplate, GravixLayerSnapshot> {
52
+ template: ProviderTemplateManager<GravixLayerTemplate, GravixLayerCreateTemplateOptions>;
53
+ }
54
+ /** Clear the module-level GravixLayer client cache. For tests only. */
55
+ declare function clearGravixLayerClients(): void;
56
+ /** Preserve GravixLayer-specific template.create options on the public provider. */
57
+ declare function gravixlayer(config?: GravixLayerConfig): GravixLayerProvider;
58
+
59
+ export { type GravixLayerConfig, type GravixLayerCreateTemplateOptions, type GravixLayerProvider, type GravixLayerSnapshot, type GravixLayerTemplate, clearGravixLayerClients, gravixlayer };