@hasna/sandboxes 0.1.23 → 0.1.24

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 (81) hide show
  1. package/dist/cli/index.d.ts +0 -1
  2. package/dist/cli/index.js +3690 -2940
  3. package/dist/db/agents.d.ts +0 -1
  4. package/dist/db/database.d.ts +1 -2
  5. package/dist/db/events.d.ts +0 -1
  6. package/dist/db/pg-migrations.d.ts +0 -1
  7. package/dist/db/projects.d.ts +0 -1
  8. package/dist/db/sandboxes.d.ts +0 -1
  9. package/dist/db/sessions.d.ts +0 -1
  10. package/dist/db/snapshots.d.ts +0 -1
  11. package/dist/db/templates.d.ts +0 -1
  12. package/dist/db/webhooks.d.ts +0 -1
  13. package/dist/index.d.ts +2 -1
  14. package/dist/index.js +4197 -3171
  15. package/dist/lib/agent-runner.d.ts +0 -1
  16. package/dist/lib/agents/claude.d.ts +0 -1
  17. package/dist/lib/agents/codex.d.ts +0 -1
  18. package/dist/lib/agents/gemini.d.ts +0 -1
  19. package/dist/lib/agents/index.d.ts +0 -1
  20. package/dist/lib/agents/opencode.d.ts +0 -1
  21. package/dist/lib/agents/pi.d.ts +0 -1
  22. package/dist/lib/agents/takumi.d.ts +9 -0
  23. package/dist/lib/agents/types.d.ts +0 -1
  24. package/dist/lib/archive.d.ts +31 -0
  25. package/dist/lib/config.d.ts +0 -1
  26. package/dist/lib/images.d.ts +0 -1
  27. package/dist/lib/keepalive.d.ts +0 -1
  28. package/dist/lib/runtime-state.d.ts +0 -1
  29. package/dist/lib/secrets.d.ts +26 -0
  30. package/dist/lib/stream.d.ts +0 -1
  31. package/dist/lib/version.d.ts +0 -1
  32. package/dist/lib/webhook.d.ts +0 -1
  33. package/dist/mcp/index.d.ts +0 -1
  34. package/dist/mcp/index.js +9916 -8415
  35. package/dist/providers/daytona.d.ts +2 -2
  36. package/dist/providers/e2b.d.ts +2 -2
  37. package/dist/providers/index.d.ts +0 -1
  38. package/dist/providers/modal.d.ts +2 -2
  39. package/dist/providers/types.d.ts +3 -2
  40. package/dist/sdk.d.ts +65 -0
  41. package/dist/server/index.d.ts +0 -1
  42. package/dist/server/index.js +3875 -3134
  43. package/dist/server/serve.d.ts +0 -1
  44. package/dist/types/index.d.ts +9 -2
  45. package/package.json +1 -1
  46. package/dist/cli/index.d.ts.map +0 -1
  47. package/dist/db/agents.d.ts.map +0 -1
  48. package/dist/db/database.d.ts.map +0 -1
  49. package/dist/db/events.d.ts.map +0 -1
  50. package/dist/db/pg-migrations.d.ts.map +0 -1
  51. package/dist/db/projects.d.ts.map +0 -1
  52. package/dist/db/sandboxes.d.ts.map +0 -1
  53. package/dist/db/sessions.d.ts.map +0 -1
  54. package/dist/db/snapshots.d.ts.map +0 -1
  55. package/dist/db/templates.d.ts.map +0 -1
  56. package/dist/db/webhooks.d.ts.map +0 -1
  57. package/dist/index.d.ts.map +0 -1
  58. package/dist/lib/agent-runner.d.ts.map +0 -1
  59. package/dist/lib/agents/claude.d.ts.map +0 -1
  60. package/dist/lib/agents/codex.d.ts.map +0 -1
  61. package/dist/lib/agents/gemini.d.ts.map +0 -1
  62. package/dist/lib/agents/index.d.ts.map +0 -1
  63. package/dist/lib/agents/opencode.d.ts.map +0 -1
  64. package/dist/lib/agents/pi.d.ts.map +0 -1
  65. package/dist/lib/agents/types.d.ts.map +0 -1
  66. package/dist/lib/config.d.ts.map +0 -1
  67. package/dist/lib/images.d.ts.map +0 -1
  68. package/dist/lib/keepalive.d.ts.map +0 -1
  69. package/dist/lib/runtime-state.d.ts.map +0 -1
  70. package/dist/lib/stream.d.ts.map +0 -1
  71. package/dist/lib/version.d.ts.map +0 -1
  72. package/dist/lib/webhook.d.ts.map +0 -1
  73. package/dist/mcp/index.d.ts.map +0 -1
  74. package/dist/providers/daytona.d.ts.map +0 -1
  75. package/dist/providers/e2b.d.ts.map +0 -1
  76. package/dist/providers/index.d.ts.map +0 -1
  77. package/dist/providers/modal.d.ts.map +0 -1
  78. package/dist/providers/types.d.ts.map +0 -1
  79. package/dist/server/index.d.ts.map +0 -1
  80. package/dist/server/serve.d.ts.map +0 -1
  81. package/dist/types/index.d.ts.map +0 -1
@@ -1,4 +1,4 @@
1
- import type { ExecResult, ExecHandle, FileInfo } from "../types/index.js";
1
+ import type { ExecResult, ExecHandle, FileInfo, UploadDirOptions, UploadDirResult } from "../types/index.js";
2
2
  import type { SandboxProvider, ProviderSandbox, CreateSandboxOpts, ExecOptions } from "./types.js";
3
3
  export declare class DaytonaProvider implements SandboxProvider {
4
4
  readonly name = "daytona";
@@ -10,6 +10,7 @@ export declare class DaytonaProvider implements SandboxProvider {
10
10
  readFile(sandboxId: string, path: string): Promise<string>;
11
11
  writeFile(sandboxId: string, path: string, content: string): Promise<void>;
12
12
  listFiles(sandboxId: string, path: string): Promise<FileInfo[]>;
13
+ uploadDir(sandboxId: string, localDir: string, remoteDir: string, opts?: UploadDirOptions): Promise<UploadDirResult>;
13
14
  stop(sandboxId: string): Promise<void>;
14
15
  delete(sandboxId: string): Promise<void>;
15
16
  getPublicUrl(_sandboxId: string, _port: number, _protocol?: string): Promise<string>;
@@ -17,4 +18,3 @@ export declare class DaytonaProvider implements SandboxProvider {
17
18
  resume(_sandboxId: string): Promise<void>;
18
19
  keepAlive(sandboxId: string, durationMs?: number): Promise<void>;
19
20
  }
20
- //# sourceMappingURL=daytona.d.ts.map
@@ -1,4 +1,4 @@
1
- import type { ExecResult, ExecHandle, FileInfo } from "../types/index.js";
1
+ import type { ExecResult, ExecHandle, FileInfo, UploadDirOptions, UploadDirResult } from "../types/index.js";
2
2
  import type { SandboxProvider, ProviderSandbox, CreateSandboxOpts, ExecOptions } from "./types.js";
3
3
  export declare class E2BProvider implements SandboxProvider {
4
4
  readonly name = "e2b";
@@ -17,6 +17,7 @@ export declare class E2BProvider implements SandboxProvider {
17
17
  recursive?: boolean;
18
18
  glob?: string;
19
19
  }): Promise<FileInfo[]>;
20
+ uploadDir(sandboxId: string, localDir: string, remoteDir: string, opts?: UploadDirOptions): Promise<UploadDirResult>;
20
21
  stop(sandboxId: string): Promise<void>;
21
22
  delete(sandboxId: string): Promise<void>;
22
23
  pause(sandboxId: string): Promise<void>;
@@ -24,4 +25,3 @@ export declare class E2BProvider implements SandboxProvider {
24
25
  getPublicUrl(sandboxId: string, port: number, _protocol?: string): Promise<string>;
25
26
  keepAlive(sandboxId: string, durationMs?: number): Promise<void>;
26
27
  }
27
- //# sourceMappingURL=e2b.d.ts.map
@@ -2,4 +2,3 @@ import type { SandboxProviderName } from "../types/index.js";
2
2
  import type { SandboxProvider } from "./types.js";
3
3
  export declare function getProvider(name: SandboxProviderName, apiKey?: string): Promise<SandboxProvider>;
4
4
  export { type SandboxProvider } from "./types.js";
5
- //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- import type { ExecResult, ExecHandle, FileInfo } from "../types/index.js";
1
+ import type { ExecResult, ExecHandle, FileInfo, UploadDirOptions, UploadDirResult } from "../types/index.js";
2
2
  import type { SandboxProvider, ProviderSandbox, CreateSandboxOpts, ExecOptions } from "./types.js";
3
3
  export declare class ModalProvider implements SandboxProvider {
4
4
  readonly name = "modal";
@@ -13,6 +13,7 @@ export declare class ModalProvider implements SandboxProvider {
13
13
  readFile(sandboxId: string, path: string): Promise<string>;
14
14
  writeFile(sandboxId: string, path: string, content: string): Promise<void>;
15
15
  listFiles(sandboxId: string, path: string): Promise<FileInfo[]>;
16
+ uploadDir(sandboxId: string, localDir: string, remoteDir: string, opts?: UploadDirOptions): Promise<UploadDirResult>;
16
17
  stop(sandboxId: string): Promise<void>;
17
18
  delete(sandboxId: string): Promise<void>;
18
19
  getPublicUrl(_sandboxId: string, _port: number, _protocol?: string): Promise<string>;
@@ -28,4 +29,3 @@ export declare class ModalProvider implements SandboxProvider {
28
29
  */
29
30
  private shellEscape;
30
31
  }
31
- //# sourceMappingURL=modal.d.ts.map
@@ -1,4 +1,4 @@
1
- import type { ExecResult, ExecHandle, FileInfo } from "../types/index.js";
1
+ import type { ExecResult, ExecHandle, FileInfo, UploadDirOptions, UploadDirResult } from "../types/index.js";
2
2
  export interface CreateSandboxOpts {
3
3
  image?: string;
4
4
  timeout?: number;
@@ -34,6 +34,8 @@ export interface SandboxProvider {
34
34
  recursive?: boolean;
35
35
  glob?: string;
36
36
  }): Promise<FileInfo[]>;
37
+ /** Upload a local directory tree into the sandbox at `remoteDir`, fast (single archive), without a git clone. */
38
+ uploadDir(sandboxId: string, localDir: string, remoteDir: string, opts?: UploadDirOptions): Promise<UploadDirResult>;
37
39
  stop(sandboxId: string): Promise<void>;
38
40
  delete(sandboxId: string): Promise<void>;
39
41
  keepAlive(sandboxId: string, durationMs?: number): Promise<void>;
@@ -41,4 +43,3 @@ export interface SandboxProvider {
41
43
  resume(sandboxId: string): Promise<void>;
42
44
  getPublicUrl(sandboxId: string, port: number, protocol?: string): Promise<string>;
43
45
  }
44
- //# sourceMappingURL=types.d.ts.map
package/dist/sdk.d.ts ADDED
@@ -0,0 +1,65 @@
1
+ import { listSandboxes } from "./db/sandboxes.js";
2
+ import { listEvents } from "./db/events.js";
3
+ import type { SandboxProvider } from "./providers/types.js";
4
+ import type { ExecOptions } from "./providers/types.js";
5
+ import type { SecretMapping, SecretResolver } from "./lib/secrets.js";
6
+ import type { AgentType, CreateSandboxInput, ExecResult, FileInfo, Sandbox, SandboxEvent, SandboxProviderName, SandboxSession, UploadDirOptions, UploadDirResult } from "./types/index.js";
7
+ import type { StreamListener } from "./lib/stream.js";
8
+ export type ProviderFactory = (name: SandboxProviderName, apiKey?: string) => Promise<SandboxProvider>;
9
+ export interface SandboxesSDKOptions {
10
+ defaultProvider?: SandboxProviderName;
11
+ providerApiKeys?: Partial<Record<SandboxProviderName, string>>;
12
+ providerFactory?: ProviderFactory;
13
+ }
14
+ export interface ExecCommandResult {
15
+ session: SandboxSession;
16
+ result: ExecResult;
17
+ }
18
+ export interface RunAgentOptions {
19
+ agentType: AgentType;
20
+ prompt: string;
21
+ agentName?: string;
22
+ command?: string;
23
+ callEnvVars?: Record<string, string>;
24
+ /** Secrets to resolve from the vault and inject as per-call env vars (never persisted). */
25
+ secrets?: SecretMapping[];
26
+ /** Override the secret resolver (defaults to the `secrets` CLI). Useful for tests. */
27
+ secretResolver?: SecretResolver;
28
+ onStdout?: (data: string) => void;
29
+ onStderr?: (data: string) => void;
30
+ }
31
+ export interface WaitForSessionOptions {
32
+ timeoutMs?: number;
33
+ pollIntervalMs?: number;
34
+ }
35
+ export declare class SandboxesSDK {
36
+ private readonly defaultProvider?;
37
+ private readonly providerApiKeys;
38
+ private readonly providerFactory;
39
+ constructor(options?: SandboxesSDKOptions);
40
+ createSandbox(input?: CreateSandboxInput): Promise<Sandbox>;
41
+ getSandbox(id: string): Sandbox;
42
+ listSandboxes(filters?: Parameters<typeof listSandboxes>[0]): Sandbox[];
43
+ stopSandbox(id: string): Promise<Sandbox>;
44
+ deleteSandbox(id: string): Promise<void>;
45
+ execCommand(sandboxId: string, command: string, opts?: ExecOptions): Promise<ExecCommandResult>;
46
+ readFile(sandboxId: string, path: string, opts?: {
47
+ encoding?: "utf8" | "base64" | "hex";
48
+ offset?: number;
49
+ limit?: number;
50
+ }): Promise<string>;
51
+ writeFile(sandboxId: string, path: string, content: string): Promise<void>;
52
+ listFiles(sandboxId: string, path: string, opts?: {
53
+ recursive?: boolean;
54
+ glob?: string;
55
+ }): Promise<FileInfo[]>;
56
+ uploadDir(sandboxId: string, localDir: string, remoteDir: string, opts?: UploadDirOptions): Promise<UploadDirResult>;
57
+ runAgent(sandboxId: string, opts: RunAgentOptions): Promise<SandboxSession>;
58
+ getSession(sessionId: string): SandboxSession;
59
+ waitForSession(sessionId: string, opts?: WaitForSessionOptions): Promise<SandboxSession>;
60
+ listEvents(filters?: Parameters<typeof listEvents>[0]): SandboxEvent[];
61
+ onSandboxEvent(sandboxId: string, listener: StreamListener): () => void;
62
+ private getProvider;
63
+ private requireProviderSandbox;
64
+ }
65
+ export declare function createSandboxesSDK(options?: SandboxesSDKOptions): SandboxesSDK;
@@ -1,3 +1,2 @@
1
1
  #!/usr/bin/env bun
2
2
  export {};
3
- //# sourceMappingURL=index.d.ts.map