@alineo-labs/opensandbox 0.1.0 → 0.2.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.
package/dist/index.d.mts CHANGED
@@ -40,6 +40,28 @@ interface Sandbox {
40
40
  metadata?: Record<string, string>;
41
41
  platform?: unknown;
42
42
  }
43
+ /** A single ordered rule in a `NetworkPolicy`. `target` is an FQDN or wildcard domain — no CIDR/IP targets yet. */
44
+ interface NetworkRule {
45
+ action: "allow" | "deny";
46
+ target: string;
47
+ }
48
+ /**
49
+ * Outbound network policy for a sandbox, enforced by its egress sidecar. Requires the
50
+ * OpenSandbox server to have `egress.image` configured — see `alineo init`'s generated
51
+ * `server.toml`. `defaultAction` defaults server-side to `"deny"` if omitted.
52
+ */
53
+ interface NetworkPolicy {
54
+ defaultAction?: "allow" | "deny";
55
+ egress: NetworkRule[];
56
+ }
57
+ /**
58
+ * Opts a sandbox into transparent MITM credential injection via the egress sidecar's
59
+ * Credential Vault (OSEP-0012). Requires `networkPolicy` to also be set and the server to be
60
+ * running `egress.mode = "dns+nft"` — see `@alineo-labs/vault`.
61
+ */
62
+ interface CredentialProxyConfig {
63
+ enabled: boolean;
64
+ }
43
65
  interface CreateSandboxOptions {
44
66
  image?: ImageSpec;
45
67
  snapshotId?: string;
@@ -49,6 +71,8 @@ interface CreateSandboxOptions {
49
71
  env?: Record<string, string>;
50
72
  metadata?: Record<string, string>;
51
73
  secureAccess?: boolean;
74
+ networkPolicy?: NetworkPolicy;
75
+ credentialProxy?: CredentialProxyConfig;
52
76
  }
53
77
  interface ListSandboxesOptions {
54
78
  state?: SandboxState;
@@ -334,4 +358,4 @@ declare class PtyClient {
334
358
  close(): void;
335
359
  }
336
360
  //#endregion
337
- export { type CodeContext, CodeLanguage, type CommandStatus, ControlClient, type CreatePtyOptions, type CreatePtyResponse, type CreateSandboxOptions, type CreateSessionRequest, type CreateSessionResponse, type DiagnosticEvent, type DiagnosticLog, ExecClient, type ExecuteCodeOptions, type ExecuteCommandOptions, type FileInfo, type FileReplacement, type ImageAuth, type ImageSpec, type ListSandboxesOptions, type ListSnapshotsOptions, type Metrics, OpenSandboxError, PtyClient, type PtyClientMessage, type PtyExitListener, type PtyOutputListener, type PtyServerMessage, type Resources, type RunInSessionRequest, type SSEEvent, SSEEventType, type Sandbox, type SandboxEndpoint, SandboxState, type SandboxStatus, type Snapshot, SnapshotState };
361
+ export { type CodeContext, CodeLanguage, type CommandStatus, ControlClient, type CreatePtyOptions, type CreatePtyResponse, type CreateSandboxOptions, type CreateSessionRequest, type CreateSessionResponse, type CredentialProxyConfig, type DiagnosticEvent, type DiagnosticLog, ExecClient, type ExecuteCodeOptions, type ExecuteCommandOptions, type FileInfo, type FileReplacement, type ImageAuth, type ImageSpec, type ListSandboxesOptions, type ListSnapshotsOptions, type Metrics, type NetworkPolicy, type NetworkRule, OpenSandboxError, PtyClient, type PtyClientMessage, type PtyExitListener, type PtyOutputListener, type PtyServerMessage, type Resources, type RunInSessionRequest, type SSEEvent, SSEEventType, type Sandbox, type SandboxEndpoint, SandboxState, type SandboxStatus, type Snapshot, SnapshotState };
package/dist/index.mjs CHANGED
@@ -445,8 +445,12 @@ var PtyClient = class {
445
445
  const decoder = new TextDecoder();
446
446
  let gotExitFrame = false;
447
447
  return new Promise((resolve, reject) => {
448
- ws.onopen = () => resolve();
449
- ws.onerror = (ev) => reject(/* @__PURE__ */ new Error(`pty websocket error: ${String(ev)}`));
448
+ ws.onopen = () => {
449
+ resolve();
450
+ };
451
+ ws.onerror = (ev) => {
452
+ reject(/* @__PURE__ */ new Error(`pty websocket error: ${ev.type}`));
453
+ };
450
454
  ws.onclose = () => {
451
455
  if (!gotExitFrame) onExit(-1);
452
456
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alineo-labs/opensandbox",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",