@fastgpt-sdk/sandbox-adapter 0.0.34 → 0.0.36

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.
@@ -61,6 +61,12 @@ export declare abstract class BaseSandboxAdapter implements ISandbox {
61
61
  listDirectory(path: string): Promise<DirectoryEntry[]>;
62
62
  readFileStream(path: string): AsyncIterable<Uint8Array>;
63
63
  writeFileStream(path: string, stream: ReadableStream<Uint8Array>): Promise<void>;
64
+ /**
65
+ * Stream a ReadableStream into a file via a temporary file that is
66
+ * atomically renamed on success. If the stream fails mid-write, the
67
+ * original file is left untouched and the temp file is cleaned up.
68
+ */
69
+ private writeStreamToFile;
64
70
  getFileInfo(paths: string[]): Promise<Map<string, FileInfo>>;
65
71
  setPermissions(entries: PermissionEntry[]): Promise<void>;
66
72
  search(pattern: string, path?: string): Promise<SearchResult[]>;
@@ -1,4 +1,4 @@
1
- import type { Endpoint, ExecuteOptions, ExecuteResult, SandboxId, SandboxInfo, SandboxMetrics, StreamHandlers } from '@/types';
1
+ import type { Endpoint, ExecuteOptions, ExecuteResult, FileWriteEntry, FileWriteResult, SandboxId, SandboxInfo, SandboxMetrics, StreamHandlers } from '@/types';
2
2
  import { BaseSandboxAdapter } from '../BaseSandboxAdapter';
3
3
  import type { OpenSandboxConfigType } from './type';
4
4
  export type { OpenSandboxConfigType } from './type';
@@ -51,13 +51,13 @@ export interface OpenSandboxConnectionConfig {
51
51
  */
52
52
  export declare class OpenSandboxAdapter extends BaseSandboxAdapter {
53
53
  private connectionConfig;
54
- private createConfig;
54
+ private createConfig?;
55
55
  readonly provider: "opensandbox";
56
56
  readonly runtime: SandboxRuntimeType;
57
57
  private _sandbox?;
58
58
  private _connection;
59
59
  private _id?;
60
- constructor(connectionConfig: OpenSandboxConnectionConfig, createConfig: OpenSandboxConfigType);
60
+ constructor(connectionConfig: OpenSandboxConnectionConfig, createConfig?: OpenSandboxConfigType | undefined);
61
61
  get rootPath(): string;
62
62
  get id(): SandboxId | undefined;
63
63
  private set sandbox(value);
@@ -92,6 +92,7 @@ export declare class OpenSandboxAdapter extends BaseSandboxAdapter {
92
92
  getEndpoint(port: number): Promise<Endpoint>;
93
93
  getInfo(): Promise<SandboxInfo | null>;
94
94
  renewExpiration(additionalSeconds: number): Promise<void>;
95
+ writeFiles(entries: FileWriteEntry[]): Promise<FileWriteResult[]>;
95
96
  execute(command: string, options?: ExecuteOptions): Promise<ExecuteResult>;
96
97
  executeStream(command: string, handlers: StreamHandlers, options?: ExecuteOptions): Promise<void>;
97
98
  executeBackground(command: string, options?: ExecuteOptions): Promise<{
@@ -1,5 +1,5 @@
1
1
  import { ImageSpec, NetworkPolicy, ResourceLimits } from '@/types';
2
- import type { Volume } from '../../../opensandbox';
2
+ import type { Volume } from '@alibaba-group/opensandbox';
3
3
  /**
4
4
  * Configuration for creating a sandbox.
5
5
  */
@@ -6,7 +6,7 @@ export { SealosDevboxAdapter } from './SealosDevboxAdapter';
6
6
  export type { SealosDevboxConfig } from './SealosDevboxAdapter';
7
7
  export { OpenSandboxAdapter } from './OpenSandboxAdapter';
8
8
  export type { OpenSandboxConfigType, OpenSandboxConnectionConfig } from './OpenSandboxAdapter';
9
- export type { Volume as OpenSandboxVolume } from '../../opensandbox';
9
+ export type { Volume as OpenSandboxVolume } from '@alibaba-group/opensandbox';
10
10
  export { E2BAdapter } from './E2BAdapter';
11
11
  export type { E2BConfig } from './E2BAdapter';
12
12
  export type SandboxProviderType = 'opensandbox' | 'sealosdevbox' | 'e2b';