@alibaba-group/opensandbox 0.1.0-dev1
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/README.md +212 -0
- package/dist/adapters/commandsAdapter.d.ts +22 -0
- package/dist/adapters/commandsAdapter.d.ts.map +1 -0
- package/dist/adapters/commandsAdapter.js +76 -0
- package/dist/adapters/filesystemAdapter.d.ts +52 -0
- package/dist/adapters/filesystemAdapter.d.ts.map +1 -0
- package/dist/adapters/filesystemAdapter.js +398 -0
- package/dist/adapters/healthAdapter.d.ts +8 -0
- package/dist/adapters/healthAdapter.d.ts.map +1 -0
- package/dist/adapters/healthAdapter.js +25 -0
- package/dist/adapters/metricsAdapter.d.ts +9 -0
- package/dist/adapters/metricsAdapter.d.ts.map +1 -0
- package/dist/adapters/metricsAdapter.js +43 -0
- package/dist/adapters/openapiError.d.ts +5 -0
- package/dist/adapters/openapiError.d.ts.map +1 -0
- package/dist/adapters/openapiError.js +33 -0
- package/dist/adapters/sandboxesAdapter.d.ts +18 -0
- package/dist/adapters/sandboxesAdapter.d.ts.map +1 -0
- package/dist/adapters/sandboxesAdapter.js +146 -0
- package/dist/adapters/sse.d.ts +9 -0
- package/dist/adapters/sse.d.ts.map +1 -0
- package/dist/adapters/sse.js +84 -0
- package/dist/api/execd.d.ts +1555 -0
- package/dist/api/execd.d.ts.map +1 -0
- package/dist/api/execd.js +14 -0
- package/dist/api/lifecycle.d.ts +787 -0
- package/dist/api/lifecycle.d.ts.map +1 -0
- package/dist/api/lifecycle.js +14 -0
- package/dist/config/connection.d.ts +58 -0
- package/dist/config/connection.d.ts.map +1 -0
- package/dist/config/connection.js +171 -0
- package/dist/core/constants.d.ts +9 -0
- package/dist/core/constants.d.ts.map +1 -0
- package/dist/core/constants.js +24 -0
- package/dist/core/exceptions.d.ts +74 -0
- package/dist/core/exceptions.d.ts.map +1 -0
- package/dist/core/exceptions.js +103 -0
- package/dist/factory/adapterFactory.d.ts +33 -0
- package/dist/factory/adapterFactory.d.ts.map +1 -0
- package/dist/factory/adapterFactory.js +14 -0
- package/dist/factory/defaultAdapterFactory.d.ts +7 -0
- package/dist/factory/defaultAdapterFactory.d.ts.map +1 -0
- package/dist/factory/defaultAdapterFactory.js +61 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/internal.d.ts +22 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +30 -0
- package/dist/manager.d.ts +40 -0
- package/dist/manager.d.ts.map +1 -0
- package/dist/manager.js +71 -0
- package/dist/models/execd.d.ts +54 -0
- package/dist/models/execd.d.ts.map +1 -0
- package/dist/models/execd.js +14 -0
- package/dist/models/execution.d.ts +52 -0
- package/dist/models/execution.d.ts.map +1 -0
- package/dist/models/execution.js +14 -0
- package/dist/models/executionEventDispatcher.d.ts +15 -0
- package/dist/models/executionEventDispatcher.d.ts.map +1 -0
- package/dist/models/executionEventDispatcher.js +95 -0
- package/dist/models/filesystem.d.ts +77 -0
- package/dist/models/filesystem.d.ts.map +1 -0
- package/dist/models/filesystem.js +14 -0
- package/dist/models/sandboxes.d.ts +105 -0
- package/dist/models/sandboxes.d.ts.map +1 -0
- package/dist/models/sandboxes.js +15 -0
- package/dist/openapi/execdClient.d.ts +25 -0
- package/dist/openapi/execdClient.d.ts.map +1 -0
- package/dist/openapi/execdClient.js +21 -0
- package/dist/openapi/lifecycleClient.d.ts +28 -0
- package/dist/openapi/lifecycleClient.d.ts.map +1 -0
- package/dist/openapi/lifecycleClient.js +35 -0
- package/dist/sandbox.d.ts +132 -0
- package/dist/sandbox.d.ts.map +1 -0
- package/dist/sandbox.js +250 -0
- package/dist/services/execdCommands.d.ts +19 -0
- package/dist/services/execdCommands.d.ts.map +1 -0
- package/dist/services/execdCommands.js +14 -0
- package/dist/services/execdHealth.d.ts +4 -0
- package/dist/services/execdHealth.d.ts.map +1 -0
- package/dist/services/execdHealth.js +14 -0
- package/dist/services/execdMetrics.d.ts +5 -0
- package/dist/services/execdMetrics.d.ts.map +1 -0
- package/dist/services/execdMetrics.js +14 -0
- package/dist/services/filesystem.d.ts +30 -0
- package/dist/services/filesystem.d.ts.map +1 -0
- package/dist/services/filesystem.js +14 -0
- package/dist/services/sandboxes.d.ts +12 -0
- package/dist/services/sandboxes.d.ts.map +1 -0
- package/dist/services/sandboxes.js +14 -0
- package/package.json +52 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,wBAAwB,EACxB,4BAA4B,EAC5B,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC;AAG9B,YAAY,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AAExG,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,YAAY,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE1F,YAAY,EACV,oBAAoB,EACpB,qBAAqB,EACrB,QAAQ,EACR,mBAAmB,EACnB,qBAAqB,EACrB,6BAA6B,EAC7B,8BAA8B,EAC9B,SAAS,EACT,WAAW,GACZ,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,YAAY,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAEzE,YAAY,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,YAAY,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,YAAY,EACV,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,cAAc,EACd,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAEhC,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,OAAO,EACP,cAAc,EACd,YAAY,GACb,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,YAAY,EACV,SAAS,EACT,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,aAAa,GACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAEhF,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,uBAAuB,EACvB,6BAA6B,EAC7B,4CAA4C,EAC5C,+BAA+B,GAChC,MAAM,qBAAqB,CAAC;AAE7B,YAAY,EACV,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,YAAY,EACV,mBAAmB,EACnB,SAAS,EACT,WAAW,EACX,kBAAkB,EAClB,UAAU,GACX,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Copyright 2026 Alibaba Group Holding Ltd.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
export { InvalidArgumentException, SandboxApiException, SandboxError, SandboxException, SandboxInternalException, SandboxReadyTimeoutException, SandboxUnhealthyException, } from "./core/exceptions.js";
|
|
15
|
+
export { DefaultAdapterFactory, createDefaultAdapterFactory } from "./factory/defaultAdapterFactory.js";
|
|
16
|
+
export { ConnectionConfig } from "./config/connection.js";
|
|
17
|
+
export { SandboxManager } from "./manager.js";
|
|
18
|
+
export { ExecutionEventDispatcher } from "./models/executionEventDispatcher.js";
|
|
19
|
+
export { DEFAULT_ENTRYPOINT, DEFAULT_EXECD_PORT, DEFAULT_RESOURCE_LIMITS, DEFAULT_TIMEOUT_SECONDS, DEFAULT_READY_TIMEOUT_SECONDS, DEFAULT_HEALTH_CHECK_POLLING_INTERVAL_MILLIS, DEFAULT_REQUEST_TIMEOUT_SECONDS, } from "./core/constants.js";
|
|
20
|
+
export { Sandbox } from "./sandbox.js";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* INTERNAL / ADVANCED ENTRYPOINT
|
|
3
|
+
*
|
|
4
|
+
* This subpath exposes low-level OpenAPI clients and adapters for advanced integrations.
|
|
5
|
+
* It is intentionally NOT exported from the root entrypoint (`@alibaba-group/opensandbox`),
|
|
6
|
+
* because generated OpenAPI types are not considered stable public API.
|
|
7
|
+
*
|
|
8
|
+
* Import path:
|
|
9
|
+
* - `@alibaba-group/opensandbox/internal`
|
|
10
|
+
*/
|
|
11
|
+
export { createLifecycleClient } from "./openapi/lifecycleClient.js";
|
|
12
|
+
export type { LifecycleClient } from "./openapi/lifecycleClient.js";
|
|
13
|
+
export { createExecdClient } from "./openapi/execdClient.js";
|
|
14
|
+
export type { ExecdClient } from "./openapi/execdClient.js";
|
|
15
|
+
export type { paths as LifecyclePaths } from "./api/lifecycle.js";
|
|
16
|
+
export type { paths as ExecdPaths } from "./api/execd.js";
|
|
17
|
+
export { SandboxesAdapter } from "./adapters/sandboxesAdapter.js";
|
|
18
|
+
export { HealthAdapter } from "./adapters/healthAdapter.js";
|
|
19
|
+
export { MetricsAdapter } from "./adapters/metricsAdapter.js";
|
|
20
|
+
export { FilesystemAdapter } from "./adapters/filesystemAdapter.js";
|
|
21
|
+
export { CommandsAdapter } from "./adapters/commandsAdapter.js";
|
|
22
|
+
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAcA;;;;;;;;;GASG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,YAAY,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,YAAY,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAG5D,YAAY,EAAE,KAAK,IAAI,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAClE,YAAY,EAAE,KAAK,IAAI,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC"}
|
package/dist/internal.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Copyright 2026 Alibaba Group Holding Ltd.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
/**
|
|
15
|
+
* INTERNAL / ADVANCED ENTRYPOINT
|
|
16
|
+
*
|
|
17
|
+
* This subpath exposes low-level OpenAPI clients and adapters for advanced integrations.
|
|
18
|
+
* It is intentionally NOT exported from the root entrypoint (`@alibaba-group/opensandbox`),
|
|
19
|
+
* because generated OpenAPI types are not considered stable public API.
|
|
20
|
+
*
|
|
21
|
+
* Import path:
|
|
22
|
+
* - `@alibaba-group/opensandbox/internal`
|
|
23
|
+
*/
|
|
24
|
+
export { createLifecycleClient } from "./openapi/lifecycleClient.js";
|
|
25
|
+
export { createExecdClient } from "./openapi/execdClient.js";
|
|
26
|
+
export { SandboxesAdapter } from "./adapters/sandboxesAdapter.js";
|
|
27
|
+
export { HealthAdapter } from "./adapters/healthAdapter.js";
|
|
28
|
+
export { MetricsAdapter } from "./adapters/metricsAdapter.js";
|
|
29
|
+
export { FilesystemAdapter } from "./adapters/filesystemAdapter.js";
|
|
30
|
+
export { CommandsAdapter } from "./adapters/commandsAdapter.js";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ConnectionConfig, type ConnectionConfigOptions } from "./config/connection.js";
|
|
2
|
+
import type { AdapterFactory } from "./factory/adapterFactory.js";
|
|
3
|
+
import type { ListSandboxesResponse, SandboxId, SandboxInfo } from "./models/sandboxes.js";
|
|
4
|
+
export interface SandboxManagerOptions {
|
|
5
|
+
connectionConfig?: ConnectionConfig | ConnectionConfigOptions;
|
|
6
|
+
adapterFactory?: AdapterFactory;
|
|
7
|
+
}
|
|
8
|
+
export interface SandboxFilter {
|
|
9
|
+
states?: string[];
|
|
10
|
+
metadata?: Record<string, string>;
|
|
11
|
+
page?: number;
|
|
12
|
+
pageSize?: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Administrative interface for managing sandboxes (list/get/pause/resume/kill/renew).
|
|
16
|
+
*
|
|
17
|
+
* For interacting *inside* a sandbox, use {@link Sandbox}.
|
|
18
|
+
*/
|
|
19
|
+
export declare class SandboxManager {
|
|
20
|
+
private readonly sandboxes;
|
|
21
|
+
private constructor();
|
|
22
|
+
static create(opts?: SandboxManagerOptions): SandboxManager;
|
|
23
|
+
listSandboxInfos(filter?: SandboxFilter): Promise<ListSandboxesResponse>;
|
|
24
|
+
getSandboxInfo(sandboxId: SandboxId): Promise<SandboxInfo>;
|
|
25
|
+
killSandbox(sandboxId: SandboxId): Promise<void>;
|
|
26
|
+
pauseSandbox(sandboxId: SandboxId): Promise<void>;
|
|
27
|
+
resumeSandbox(sandboxId: SandboxId): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Renew expiration by setting expiresAt to now + timeoutSeconds.
|
|
30
|
+
*/
|
|
31
|
+
renewSandbox(sandboxId: SandboxId, timeoutSeconds: number): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* No-op for now (fetch-based implementation doesn't own a pooled transport).
|
|
34
|
+
*
|
|
35
|
+
* This method exists so callers can consistently release resources when using
|
|
36
|
+
* a custom {@link AdapterFactory} implementation.
|
|
37
|
+
*/
|
|
38
|
+
close(): Promise<void>;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../src/manager.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,gBAAgB,EAAE,KAAK,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAExF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAElE,OAAO,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAG3F,MAAM,WAAW,qBAAqB;IACpC,gBAAgB,CAAC,EAAE,gBAAgB,GAAG,uBAAuB,CAAC;IAC9D,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;IAEtC,OAAO;IAIP,MAAM,CAAC,MAAM,CAAC,IAAI,GAAE,qBAA0B,GAAG,cAAc;IAU/D,gBAAgB,CAAC,MAAM,GAAE,aAAkB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAS5E,cAAc,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC;IAI1D,WAAW,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhD,YAAY,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjD,aAAa,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlD;;OAEG;IACG,YAAY,CAAC,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAK/E;;;;;OAKG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
|
package/dist/manager.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// Copyright 2026 Alibaba Group Holding Ltd.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
import { ConnectionConfig } from "./config/connection.js";
|
|
15
|
+
import { createDefaultAdapterFactory } from "./factory/defaultAdapterFactory.js";
|
|
16
|
+
/**
|
|
17
|
+
* Administrative interface for managing sandboxes (list/get/pause/resume/kill/renew).
|
|
18
|
+
*
|
|
19
|
+
* For interacting *inside* a sandbox, use {@link Sandbox}.
|
|
20
|
+
*/
|
|
21
|
+
export class SandboxManager {
|
|
22
|
+
sandboxes;
|
|
23
|
+
constructor(opts) {
|
|
24
|
+
this.sandboxes = opts.sandboxes;
|
|
25
|
+
}
|
|
26
|
+
static create(opts = {}) {
|
|
27
|
+
const connectionConfig = opts.connectionConfig instanceof ConnectionConfig
|
|
28
|
+
? opts.connectionConfig
|
|
29
|
+
: new ConnectionConfig(opts.connectionConfig);
|
|
30
|
+
const lifecycleBaseUrl = connectionConfig.getBaseUrl();
|
|
31
|
+
const adapterFactory = opts.adapterFactory ?? createDefaultAdapterFactory();
|
|
32
|
+
const { sandboxes } = adapterFactory.createLifecycleStack({ connectionConfig, lifecycleBaseUrl });
|
|
33
|
+
return new SandboxManager({ sandboxes });
|
|
34
|
+
}
|
|
35
|
+
listSandboxInfos(filter = {}) {
|
|
36
|
+
return this.sandboxes.listSandboxes({
|
|
37
|
+
states: filter.states,
|
|
38
|
+
metadata: filter.metadata,
|
|
39
|
+
page: filter.page,
|
|
40
|
+
pageSize: filter.pageSize,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
getSandboxInfo(sandboxId) {
|
|
44
|
+
return this.sandboxes.getSandbox(sandboxId);
|
|
45
|
+
}
|
|
46
|
+
killSandbox(sandboxId) {
|
|
47
|
+
return this.sandboxes.deleteSandbox(sandboxId);
|
|
48
|
+
}
|
|
49
|
+
pauseSandbox(sandboxId) {
|
|
50
|
+
return this.sandboxes.pauseSandbox(sandboxId);
|
|
51
|
+
}
|
|
52
|
+
resumeSandbox(sandboxId) {
|
|
53
|
+
return this.sandboxes.resumeSandbox(sandboxId);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Renew expiration by setting expiresAt to now + timeoutSeconds.
|
|
57
|
+
*/
|
|
58
|
+
async renewSandbox(sandboxId, timeoutSeconds) {
|
|
59
|
+
const expiresAt = new Date(Date.now() + timeoutSeconds * 1000).toISOString();
|
|
60
|
+
await this.sandboxes.renewSandboxExpiration(sandboxId, { expiresAt });
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* No-op for now (fetch-based implementation doesn't own a pooled transport).
|
|
64
|
+
*
|
|
65
|
+
* This method exists so callers can consistently release resources when using
|
|
66
|
+
* a custom {@link AdapterFactory} implementation.
|
|
67
|
+
*/
|
|
68
|
+
async close() {
|
|
69
|
+
// no-op
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Execution } from "./execution.js";
|
|
2
|
+
/**
|
|
3
|
+
* Domain models for execd interactions.
|
|
4
|
+
*
|
|
5
|
+
* IMPORTANT:
|
|
6
|
+
* - These are NOT OpenAPI-generated types.
|
|
7
|
+
* - They are intentionally stable and JS-friendly.
|
|
8
|
+
*/
|
|
9
|
+
export interface ServerStreamEvent extends Record<string, unknown> {
|
|
10
|
+
type: "init" | "stdout" | "stderr" | "result" | "execution_count" | "execution_complete" | "error" | string;
|
|
11
|
+
timestamp?: number;
|
|
12
|
+
text?: string;
|
|
13
|
+
results?: Record<string, unknown>;
|
|
14
|
+
error?: Record<string, unknown>;
|
|
15
|
+
}
|
|
16
|
+
export interface RunCommandRequest extends Record<string, unknown> {
|
|
17
|
+
command: string;
|
|
18
|
+
cwd?: string;
|
|
19
|
+
background?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface CodeContextRequest extends Record<string, unknown> {
|
|
22
|
+
language: string;
|
|
23
|
+
}
|
|
24
|
+
export type SupportedLanguage = "python" | "go" | "javascript" | "typescript" | "bash" | "java";
|
|
25
|
+
export interface RunCommandOpts {
|
|
26
|
+
/**
|
|
27
|
+
* Working directory for command execution (maps to API `cwd`).
|
|
28
|
+
*/
|
|
29
|
+
workingDirectory?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Run command in detached mode.
|
|
32
|
+
*/
|
|
33
|
+
background?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export type CommandExecution = Execution;
|
|
36
|
+
export interface Metrics extends Record<string, unknown> {
|
|
37
|
+
cpu_count?: number;
|
|
38
|
+
cpu_used_pct?: number;
|
|
39
|
+
mem_total_mib?: number;
|
|
40
|
+
mem_used_mib?: number;
|
|
41
|
+
timestamp?: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Normalized, JS-friendly metrics.
|
|
45
|
+
*/
|
|
46
|
+
export interface SandboxMetrics {
|
|
47
|
+
cpuCount: number;
|
|
48
|
+
cpuUsedPercentage: number;
|
|
49
|
+
memoryTotalMiB: number;
|
|
50
|
+
memoryUsedMiB: number;
|
|
51
|
+
timestamp: number;
|
|
52
|
+
}
|
|
53
|
+
export type PingResponse = Record<string, unknown>;
|
|
54
|
+
//# sourceMappingURL=execd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execd.d.ts","sourceRoot":"","sources":["../../src/models/execd.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD;;;;;;GAMG;AACH,MAAM,WAAW,iBAAkB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAChE,IAAI,EACA,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,QAAQ,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M,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Copyright 2026 Alibaba Group Holding Ltd.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export interface OutputMessage {
|
|
2
|
+
text: string;
|
|
3
|
+
timestamp: number;
|
|
4
|
+
isError?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface ExecutionResult {
|
|
7
|
+
text?: string;
|
|
8
|
+
timestamp: number;
|
|
9
|
+
/**
|
|
10
|
+
* Raw mime map from execd event (e.g. "text/plain", "text/html", ...)
|
|
11
|
+
*/
|
|
12
|
+
raw?: Record<string, unknown>;
|
|
13
|
+
}
|
|
14
|
+
export interface ExecutionError {
|
|
15
|
+
name: string;
|
|
16
|
+
value: string;
|
|
17
|
+
timestamp: number;
|
|
18
|
+
traceback: string[];
|
|
19
|
+
}
|
|
20
|
+
export interface ExecutionComplete {
|
|
21
|
+
timestamp: number;
|
|
22
|
+
executionTimeMs: number;
|
|
23
|
+
}
|
|
24
|
+
export interface ExecutionInit {
|
|
25
|
+
id: string;
|
|
26
|
+
timestamp: number;
|
|
27
|
+
}
|
|
28
|
+
export interface Execution {
|
|
29
|
+
id?: string;
|
|
30
|
+
executionCount?: number;
|
|
31
|
+
logs: {
|
|
32
|
+
stdout: OutputMessage[];
|
|
33
|
+
stderr: OutputMessage[];
|
|
34
|
+
};
|
|
35
|
+
result: ExecutionResult[];
|
|
36
|
+
error?: ExecutionError;
|
|
37
|
+
complete?: ExecutionComplete;
|
|
38
|
+
}
|
|
39
|
+
export interface ExecutionHandlers {
|
|
40
|
+
/**
|
|
41
|
+
* Optional low-level hook for every server-sent event (SSE) received.
|
|
42
|
+
* Kept as `unknown` to avoid coupling to a specific OpenAPI schema module.
|
|
43
|
+
*/
|
|
44
|
+
onEvent?: (ev: unknown) => void | Promise<void>;
|
|
45
|
+
onStdout?: (msg: OutputMessage) => void | Promise<void>;
|
|
46
|
+
onStderr?: (msg: OutputMessage) => void | Promise<void>;
|
|
47
|
+
onResult?: (res: ExecutionResult) => void | Promise<void>;
|
|
48
|
+
onExecutionComplete?: (c: ExecutionComplete) => void | Promise<void>;
|
|
49
|
+
onError?: (err: ExecutionError) => void | Promise<void>;
|
|
50
|
+
onInit?: (init: ExecutionInit) => void | Promise<void>;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=execution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../../src/models/execution.ts"],"names":[],"mappings":"AAcA,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,M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AI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Copyright 2026 Alibaba Group Holding Ltd.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Execution, ExecutionHandlers } from "./execution.js";
|
|
2
|
+
import type { ServerStreamEvent } from "./execd.js";
|
|
3
|
+
/**
|
|
4
|
+
* Dispatches streamed execution events to handlers.
|
|
5
|
+
*
|
|
6
|
+
* This mutates the provided `execution` object (appending logs/results and setting fields like
|
|
7
|
+
* `id`, `executionCount`, and `complete`) and invokes optional callbacks in {@link ExecutionHandlers}.
|
|
8
|
+
*/
|
|
9
|
+
export declare class ExecutionEventDispatcher {
|
|
10
|
+
private readonly execution;
|
|
11
|
+
private readonly handlers?;
|
|
12
|
+
constructor(execution: Execution, handlers?: ExecutionHandlers | undefined);
|
|
13
|
+
dispatch(ev: ServerStreamEvent): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=executionEventDispatcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executionEventDispatcher.d.ts","sourceRoot":"","sources":["../../src/models/executionEventDispatcher.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,SAAS,EAAqC,iBAAiB,EAAiD,MAAM,gBAAgB,CAAC;AACrJ,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AASpD;;;;;GAKG;AACH,qBAAa,wBAAwB;IAEjC,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;gBADT,SAAS,EAAE,SAAS,EACpB,QAAQ,CAAC,EAAE,iBAAiB,YAAA;IAGzC,QAAQ,CAAC,EAAE,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;CA4DrD"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// Copyright 2026 Alibaba Group Holding Ltd.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
function extractText(results) {
|
|
15
|
+
if (!results || typeof results !== "object")
|
|
16
|
+
return undefined;
|
|
17
|
+
const r = results;
|
|
18
|
+
const v = r["text/plain"] ?? r.text ?? r.textPlain;
|
|
19
|
+
return v == null ? undefined : String(v);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Dispatches streamed execution events to handlers.
|
|
23
|
+
*
|
|
24
|
+
* This mutates the provided `execution` object (appending logs/results and setting fields like
|
|
25
|
+
* `id`, `executionCount`, and `complete`) and invokes optional callbacks in {@link ExecutionHandlers}.
|
|
26
|
+
*/
|
|
27
|
+
export class ExecutionEventDispatcher {
|
|
28
|
+
execution;
|
|
29
|
+
handlers;
|
|
30
|
+
constructor(execution, handlers) {
|
|
31
|
+
this.execution = execution;
|
|
32
|
+
this.handlers = handlers;
|
|
33
|
+
}
|
|
34
|
+
async dispatch(ev) {
|
|
35
|
+
await this.handlers?.onEvent?.(ev);
|
|
36
|
+
const ts = ev.timestamp ?? Date.now();
|
|
37
|
+
switch (ev.type) {
|
|
38
|
+
case "init": {
|
|
39
|
+
const id = ev.text ?? "";
|
|
40
|
+
if (id)
|
|
41
|
+
this.execution.id = id;
|
|
42
|
+
const init = { id, timestamp: ts };
|
|
43
|
+
await this.handlers?.onInit?.(init);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
case "stdout": {
|
|
47
|
+
const msg = { text: ev.text ?? "", timestamp: ts, isError: false };
|
|
48
|
+
this.execution.logs.stdout.push(msg);
|
|
49
|
+
await this.handlers?.onStdout?.(msg);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
case "stderr": {
|
|
53
|
+
const msg = { text: ev.text ?? "", timestamp: ts, isError: true };
|
|
54
|
+
this.execution.logs.stderr.push(msg);
|
|
55
|
+
await this.handlers?.onStderr?.(msg);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
case "result": {
|
|
59
|
+
const r = { text: extractText(ev.results), timestamp: ts, raw: ev.results };
|
|
60
|
+
this.execution.result.push(r);
|
|
61
|
+
await this.handlers?.onResult?.(r);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
case "execution_count": {
|
|
65
|
+
const c = ev.execution_count;
|
|
66
|
+
if (typeof c === "number")
|
|
67
|
+
this.execution.executionCount = c;
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
case "execution_complete": {
|
|
71
|
+
const ms = ev.execution_time;
|
|
72
|
+
const complete = { timestamp: ts, executionTimeMs: typeof ms === "number" ? ms : 0 };
|
|
73
|
+
this.execution.complete = complete;
|
|
74
|
+
await this.handlers?.onExecutionComplete?.(complete);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
case "error": {
|
|
78
|
+
const e = ev.error;
|
|
79
|
+
if (e) {
|
|
80
|
+
const err = {
|
|
81
|
+
name: String(e.ename ?? e.name ?? ""),
|
|
82
|
+
value: String(e.evalue ?? e.value ?? ""),
|
|
83
|
+
timestamp: ts,
|
|
84
|
+
traceback: Array.isArray(e.traceback) ? e.traceback.map(String) : [],
|
|
85
|
+
};
|
|
86
|
+
this.execution.error = err;
|
|
87
|
+
await this.handlers?.onError?.(err);
|
|
88
|
+
}
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
default:
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain models for filesystem.
|
|
3
|
+
*
|
|
4
|
+
* IMPORTANT:
|
|
5
|
+
* - These are NOT OpenAPI-generated types.
|
|
6
|
+
* - They are intentionally stable and JS-friendly.
|
|
7
|
+
*/
|
|
8
|
+
export interface FileInfo extends Record<string, unknown> {
|
|
9
|
+
path: string;
|
|
10
|
+
size?: number;
|
|
11
|
+
/**
|
|
12
|
+
* Last modification time.
|
|
13
|
+
*/
|
|
14
|
+
modifiedAt?: Date;
|
|
15
|
+
/**
|
|
16
|
+
* Creation time.
|
|
17
|
+
*/
|
|
18
|
+
createdAt?: Date;
|
|
19
|
+
mode?: number;
|
|
20
|
+
owner?: string;
|
|
21
|
+
group?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface Permission extends Record<string, unknown> {
|
|
24
|
+
mode: number;
|
|
25
|
+
owner?: string;
|
|
26
|
+
group?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface FileMetadata extends Record<string, unknown> {
|
|
29
|
+
path: string;
|
|
30
|
+
mode?: number;
|
|
31
|
+
owner?: string;
|
|
32
|
+
group?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface RenameFileItem extends Record<string, unknown> {
|
|
35
|
+
src: string;
|
|
36
|
+
dest: string;
|
|
37
|
+
}
|
|
38
|
+
export interface ReplaceFileContentItem extends Record<string, unknown> {
|
|
39
|
+
old: string;
|
|
40
|
+
new: string;
|
|
41
|
+
}
|
|
42
|
+
export type FilesInfoResponse = Record<string, FileInfo>;
|
|
43
|
+
export type SearchFilesResponse = FileInfo[];
|
|
44
|
+
export interface WriteEntry {
|
|
45
|
+
path: string;
|
|
46
|
+
/**
|
|
47
|
+
* File data to upload.
|
|
48
|
+
*
|
|
49
|
+
* Supports:
|
|
50
|
+
* - string / bytes / Blob (in-memory)
|
|
51
|
+
* - AsyncIterable<Uint8Array> or ReadableStream<Uint8Array> (streaming upload for large files)
|
|
52
|
+
*/
|
|
53
|
+
data?: string | Uint8Array | ArrayBuffer | Blob | AsyncIterable<Uint8Array> | ReadableStream<Uint8Array>;
|
|
54
|
+
mode?: number;
|
|
55
|
+
owner?: string;
|
|
56
|
+
group?: string;
|
|
57
|
+
}
|
|
58
|
+
export interface SearchEntry {
|
|
59
|
+
path: string;
|
|
60
|
+
pattern?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface MoveEntry {
|
|
63
|
+
src: string;
|
|
64
|
+
dest: string;
|
|
65
|
+
}
|
|
66
|
+
export interface ContentReplaceEntry {
|
|
67
|
+
path: string;
|
|
68
|
+
oldContent: string;
|
|
69
|
+
newContent: string;
|
|
70
|
+
}
|
|
71
|
+
export interface SetPermissionEntry {
|
|
72
|
+
path: string;
|
|
73
|
+
mode: number;
|
|
74
|
+
owner?: string;
|
|
75
|
+
group?: string;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=filesystem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filesystem.d.ts","sourceRoot":"","sources":["../../src/models/filesystem.ts"],"names":[],"mappings":"AAcA;;;;;;GAMG;AAEH,MAAM,WAAW,QAAS,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;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EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Copyright 2026 Alibaba Group Holding Ltd.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
export {};
|