@omnirun/sdk 0.3.2 → 0.3.3

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.ts CHANGED
@@ -13,6 +13,6 @@ export { HTTPClient } from "./client.js";
13
13
  export { resolveConfig } from "./config.js";
14
14
  export type { ConnectionConfig } from "./config.js";
15
15
  export { SandboxError, SandboxNotFoundError, CommandExitException, StreamError, TimeoutError, } from "./errors.js";
16
- export type { CommandResult, EntryInfo, SandboxInfo, FullSandboxInfo, ExposureInfo, ExposureStatus, ExposureVisibility, ProcessInfo, PtyInfo, WriteEntry, FilesystemEvent, StreamEvent, RunCommandOptions, CreateSandboxOptions, CreateExposureOptions, ListSandboxOptions, RefreshExposureOptions, ContextInfo, ResultItem, LogOutput, ExecutionResult, SandboxMetrics, MetricsSnapshot, NetworkPolicy, WebhookInfo, CodeResult, } from "./models.js";
16
+ export type { CommandResult, EntryInfo, SandboxInfo, FullSandboxInfo, ExposureInfo, ExposureStatus, ExposureVisibility, ProcessInfo, PtyInfo, WriteEntry, FilesystemEvent, StreamEvent, RunCommandOptions, CreateSandboxOptions, CreateExposureOptions, ListSandboxOptions, RefreshExposureOptions, ContextInfo, ResultItem, LogOutput, ExecutionResult, SandboxMetrics, MetricsSnapshot, NetworkPolicy, WebhookInfo, CodeResult, SandboxHistoryInfo, } from "./models.js";
17
17
  export type { FileReadOptions, FileWriteOptions, FileListOptions } from "./filesystem.js";
18
18
  export type { ExecuteOptions } from "./contexts.js";
package/dist/models.d.ts CHANGED
@@ -90,6 +90,20 @@ export interface CreateExposureOptions {
90
90
  export interface RefreshExposureOptions {
91
91
  ttlSeconds?: number;
92
92
  }
93
+ export interface SandboxHistoryInfo {
94
+ sandboxId: string;
95
+ accountId?: string;
96
+ templateId: string;
97
+ status: string;
98
+ cpuCount: number;
99
+ memoryMB: number;
100
+ metadata?: Record<string, string>;
101
+ createdAt: string;
102
+ startedAt?: string;
103
+ stoppedAt?: string;
104
+ timeoutSeconds: number;
105
+ createdBy?: string;
106
+ }
93
107
  export interface RunCommandOptions {
94
108
  cwd?: string;
95
109
  timeout?: number;
package/dist/sandbox.d.ts CHANGED
@@ -2,7 +2,7 @@ import { Commands } from "./commands.js";
2
2
  import { Contexts } from "./contexts.js";
3
3
  import { Exposures } from "./exposures.js";
4
4
  import { Filesystem } from "./filesystem.js";
5
- import type { CodeResult, CreateSandboxOptions, CreateExposureOptions, ExposureInfo, FullSandboxInfo, ListSandboxOptions, MetricsSnapshot, NetworkPolicy, SandboxInfo } from "./models.js";
5
+ import type { CodeResult, CreateSandboxOptions, CreateExposureOptions, ExposureInfo, FullSandboxInfo, ListSandboxOptions, MetricsSnapshot, NetworkPolicy, SandboxHistoryInfo, SandboxInfo } from "./models.js";
6
6
  import { Production } from "./production.js";
7
7
  import { Pty } from "./pty.js";
8
8
  import { Webhooks } from "./webhooks.js";
@@ -41,6 +41,16 @@ export declare class Sandbox {
41
41
  }): Promise<Sandbox>;
42
42
  static list(opts?: ListSandboxOptions): Promise<SandboxInfo[]>;
43
43
  static paginate(opts?: ListSandboxOptions): SandboxPaginator;
44
+ static history(opts?: {
45
+ apiKey?: string;
46
+ apiUrl?: string;
47
+ limit?: number;
48
+ offset?: number;
49
+ }): Promise<SandboxHistoryInfo[]>;
50
+ static getHistory(sandboxId: string, opts?: {
51
+ apiKey?: string;
52
+ apiUrl?: string;
53
+ }): Promise<SandboxHistoryInfo | null>;
44
54
  kill(): Promise<void>;
45
55
  setTimeout(timeout: number): Promise<void>;
46
56
  isRunning(): Promise<boolean>;
package/dist/sandbox.js CHANGED
@@ -158,6 +158,27 @@ export class Sandbox {
158
158
  static paginate(opts) {
159
159
  return new SandboxPaginator(opts);
160
160
  }
161
+ static async history(opts) {
162
+ const config = resolveConfig(opts);
163
+ const client = new HTTPClient(config);
164
+ const params = {};
165
+ if (opts?.limit != null)
166
+ params.limit = String(opts.limit);
167
+ if (opts?.offset != null)
168
+ params.offset = String(opts.offset);
169
+ const data = await client.get("/sandboxes/history", Object.keys(params).length > 0 ? params : undefined);
170
+ return Array.isArray(data) ? data : [];
171
+ }
172
+ static async getHistory(sandboxId, opts) {
173
+ const config = resolveConfig(opts);
174
+ const client = new HTTPClient(config);
175
+ try {
176
+ return await client.get(`/sandboxes/history/${sandboxId}`);
177
+ }
178
+ catch {
179
+ return null;
180
+ }
181
+ }
161
182
  async kill() {
162
183
  if (this.keepAliveInterval) {
163
184
  clearInterval(this.keepAliveInterval);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnirun/sdk",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "TypeScript SDK for omnirun sandboxes (e2b-compatible)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",