@declaw/sdk 1.0.0 → 1.0.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.cts CHANGED
@@ -68,6 +68,11 @@ declare class ApiClient {
68
68
  * Does NOT parse the response body.
69
69
  */
70
70
  stream(path: string, opts?: RequestOpts): Promise<Response>;
71
+ /**
72
+ * Send a GET request and return the raw Response for SSE streaming.
73
+ * Does NOT parse the response body. Used by PTY stream consumers.
74
+ */
75
+ streamGet(path: string, opts?: RequestOpts): Promise<Response>;
71
76
  /**
72
77
  * Abort all in-flight requests and release resources.
73
78
  */
@@ -217,18 +222,23 @@ declare function parseNetworkPolicy(data: Record<string, any>): NetworkPolicy;
217
222
  */
218
223
  declare function networkPolicyToOpts(policy: NetworkPolicy): SandboxNetworkOpts;
219
224
 
220
- /** Configuration for audit logging. */
225
+ /**
226
+ * Toggle for per-sandbox audit logging.
227
+ *
228
+ * Declaw records a fixed set of lifecycle + security events (vm_created,
229
+ * vm_killed, snapshot_*, egress_blocked, …). Set `enabled: false` to opt
230
+ * the sandbox out entirely; events for that sandbox are not shipped to
231
+ * the collector and nothing is persisted.
232
+ *
233
+ * Retention is a platform-wide setting (global 7-day default), not a
234
+ * per-sandbox knob. Body logging is not user-configurable today.
235
+ */
221
236
  interface AuditConfig {
222
237
  enabled: boolean;
223
- logRequestBody: boolean;
224
- logResponseBody: boolean;
225
- retentionHours: number;
226
238
  }
227
- /**
228
- * Create an AuditConfig with defaults.
229
- */
239
+ /** Create an AuditConfig with defaults (enabled=true). */
230
240
  declare function createAuditConfig(opts?: Partial<AuditConfig>): AuditConfig;
231
- /** Parse raw JSON data into AuditConfig. */
241
+ /** Parse raw JSON data into AuditConfig. Defaults to enabled=true when the field is absent. */
232
242
  declare function parseAuditConfig(data: Record<string, any>): AuditConfig;
233
243
  /** A single audit log entry. */
234
244
  interface AuditEntry {
@@ -693,6 +703,11 @@ declare class Filesystem {
693
703
  /**
694
704
  * Write data to a file.
695
705
  *
706
+ * When `data` is a `Uint8Array`, the SDK streams the raw bytes to the
707
+ * binary-safe `PUT /files/raw` endpoint (500 MiB cap). When it's a string,
708
+ * the SDK uses the JSON `POST /files` endpoint. Callers do not need to
709
+ * pick the transport.
710
+ *
696
711
  * @param path - Absolute path to the file.
697
712
  * @param data - String or Uint8Array content to write.
698
713
  * @param opts - Optional user and request timeout.
@@ -705,9 +720,14 @@ declare class Filesystem {
705
720
  /**
706
721
  * Write multiple files in a single batch request.
707
722
  *
723
+ * The batch endpoint is JSON-only and cannot carry binary. Entries are
724
+ * partitioned: string entries go through `POST /files/batch` in one call,
725
+ * `Uint8Array` entries are streamed individually to `PUT /files/raw`.
726
+ * Results are merged back in input order.
727
+ *
708
728
  * @param files - Array of files to write.
709
729
  * @param opts - Optional user and request timeout.
710
- * @returns Array of write info for each file.
730
+ * @returns Array of write info for each file, in input order.
711
731
  */
712
732
  writeFiles(files: WriteEntry[], opts?: {
713
733
  user?: string;
@@ -798,6 +818,19 @@ declare class Filesystem {
798
818
  }): Promise<WatchHandle>;
799
819
  }
800
820
 
821
+ /** Outcome of a PTY session — produced by `PtyHandle.wait()`. */
822
+ interface PtyResult {
823
+ /** Remote shell exit code. `-1` if the stream dropped before a clean exit frame. */
824
+ exitCode: number;
825
+ }
826
+ /** Options for attaching to a running PTY via `Pty.connect()`. */
827
+ interface PtyConnectOpts {
828
+ /**
829
+ * Callback invoked with every chunk of PTY output as raw bytes.
830
+ * Optional — omit to drive the stream via the handle's async iterator.
831
+ */
832
+ onData?: (data: Uint8Array) => void;
833
+ }
801
834
  /** Options for creating a PTY session. */
802
835
  interface PtyCreateOpts {
803
836
  /** Terminal size. Defaults to { cols: 80, rows: 24 }. */
@@ -808,46 +841,87 @@ interface PtyCreateOpts {
808
841
  cwd?: string;
809
842
  /** Environment variables. */
810
843
  envs?: Record<string, string>;
811
- /** Command timeout in seconds. */
844
+ /**
845
+ * PTY session TTL in seconds. Defaults to 3600 (1 hour). Pass `0` to
846
+ * keep the session alive indefinitely — it will still die when the
847
+ * parent sandbox's timeout fires.
848
+ */
812
849
  timeout?: number;
813
- /** Per-request timeout in milliseconds. */
850
+ /** Per-request timeout in milliseconds (applies to the initial create call only). */
814
851
  requestTimeout?: number;
852
+ /**
853
+ * Callback invoked with every chunk of PTY output as raw bytes.
854
+ * Setting this implicitly opens the SSE stream; the returned handle's
855
+ * `wait()` resolves when the remote process exits. Drop this option
856
+ * and call `handle.stream()` directly if you want to drive the iterator
857
+ * explicitly instead.
858
+ */
859
+ onData?: (data: Uint8Array) => void;
815
860
  }
816
861
  /**
817
- * PTY (pseudo-terminal) interface for a sandbox.
862
+ * Handle to a running PTY session. Returned from `Pty.create()`.
818
863
  *
819
- * Provides methods to create, kill, resize, and send input to PTY sessions.
864
+ * Exposes stdin / resize / kill plus a `wait()` that resolves with the
865
+ * remote exit code once the process terminates. The output stream runs
866
+ * over Server-Sent Events — configured via `onData` at create time or
867
+ * consumed manually with `stream()`.
820
868
  */
821
- declare class Pty {
869
+ declare class PtyHandle {
870
+ readonly pid: number;
822
871
  private readonly sandboxId;
823
872
  private readonly client;
824
- constructor(sandboxId: string, client: ApiClient);
873
+ private readonly exitPromise;
874
+ private resolveExit;
875
+ private aborter;
876
+ constructor(pid: number, sandboxId: string, client: ApiClient, onData?: (data: Uint8Array) => void);
877
+ /** Forward keystrokes to the PTY. */
878
+ sendInput(data: Uint8Array | string, requestTimeout?: number): Promise<void>;
879
+ /** Update the terminal size (TIOCSWINSZ inside the VM). */
880
+ resize(size: PtySize, requestTimeout?: number): Promise<void>;
881
+ /** SIGKILL the remote process and close any open streams. */
882
+ kill(requestTimeout?: number): Promise<boolean>;
825
883
  /**
826
- * Create a new PTY session.
827
- *
828
- * Sends POST /sandboxes/:id/pty.
829
- * @returns A CommandHandle for the PTY process.
884
+ * Stop consuming output without killing the process. The PTY keeps
885
+ * running server-side and a fresh `stream()` call reattaches.
830
886
  */
831
- create(opts?: PtyCreateOpts): Promise<CommandHandle>;
887
+ disconnect(): void;
888
+ /** Resolves with the remote exit result when the PTY process exits. */
889
+ wait(): Promise<PtyResult>;
832
890
  /**
833
- * Kill a PTY session.
891
+ * Async iterator over raw output chunks. Use when you want to drive
892
+ * the stream yourself:
834
893
  *
835
- * Sends DELETE /sandboxes/:id/pty/:pid.
836
- * @returns true if the process was killed, false if already dead.
837
- */
838
- kill(pid: number, requestTimeout?: number): Promise<boolean>;
839
- /**
840
- * Send input to a PTY session.
894
+ * for await (const chunk of handle.stream()) { ... }
841
895
  *
842
- * Sends POST /sandboxes/:id/pty/:pid/stdin.
843
- * If data is a Uint8Array, it is decoded to a string using TextDecoder.
896
+ * Don't mix this with `onData` on the same handle — they both try to
897
+ * consume the same underlying SSE connection.
844
898
  */
845
- sendStdin(pid: number, data: Uint8Array | string, requestTimeout?: number): Promise<void>;
899
+ stream(): AsyncGenerator<Uint8Array, void, void>;
900
+ private consumeStream;
901
+ }
902
+ /**
903
+ * PTY (pseudo-terminal) interface for a sandbox.
904
+ *
905
+ * Use `create()` to launch a fresh shell session. The returned
906
+ * `PtyHandle` exposes stdin / resize / kill plus a live output stream
907
+ * (callback or async iterator).
908
+ */
909
+ declare class Pty {
910
+ private readonly sandboxId;
911
+ private readonly client;
912
+ constructor(sandboxId: string, client: ApiClient);
913
+ create(opts?: PtyCreateOpts): Promise<PtyHandle>;
846
914
  /**
847
- * Resize a PTY session.
915
+ * Reattach to an already-running PTY by its pid.
848
916
  *
849
- * Sends PATCH /sandboxes/:id/pty/:pid.
917
+ * Returns a fresh `PtyHandle` that streams the live output of the
918
+ * existing session. Multiple clients can subscribe to the same pid
919
+ * concurrently — each receives output from the moment it connects
920
+ * (no scrollback replay).
850
921
  */
922
+ connect(pid: number, opts?: PtyConnectOpts): PtyHandle;
923
+ kill(pid: number, requestTimeout?: number): Promise<boolean>;
924
+ sendStdin(pid: number, data: Uint8Array | string, requestTimeout?: number): Promise<void>;
851
925
  resize(pid: number, size: PtySize, requestTimeout?: number): Promise<void>;
852
926
  }
853
927
 
@@ -1334,4 +1408,4 @@ declare class Template {
1334
1408
  static getBuildStatus(buildId: string, opts?: GetBuildStatusOpts): Promise<TemplateBuildStatus>;
1335
1409
  }
1336
1410
 
1337
- export { ALL_TRAFFIC, ApiClient, type AuditConfig, type AuditEntry, AuthenticationError, BuildError, type BuildInfo, type CodeSecurityConfig, CommandExitError, CommandHandle, type CommandResult, type CommandWaitOpts, Commands, ConnectionConfig, type ConnectionConfigOptions, type CopyItem, DEFAULT_MASK_PATTERNS, type EntryInfo, type EnvSecurityConfig, FileType, FileUploadError, Filesystem, type FilesystemEvent, FilesystemEventType, type GetBuildStatusOpts, GitAuthError, GitUpstreamError, InjectionAction, type InjectionDefenseConfig, InjectionSensitivity, InvalidArgumentError, type InvisibleTextConfig, type NetworkPolicy, NotEnoughSpaceError, NotFoundError, type PIIConfig, PIIType, type ProcessInfo, Pty, type PtyCreateOpts, type PtyOutput, type PtySize, RedactionAction, type RequestOpts, type RunOpts, type RunStreamOpts, Sandbox, SandboxError, type SandboxInfo, type SandboxLifecycle, type SandboxMetrics, type SandboxNetworkOpts, type SandboxOpts, SandboxPaginator, type SandboxQuery, SandboxState, type SecureEnvVar, type SecurityPolicy, type Snapshot, type SnapshotInfo, SnapshotPaginator, type SnapshotSource, type Stderr, type Stdout, Template, TemplateBase, type TemplateBuildOpts, type TemplateBuildStatus, TemplateError, TimeoutError, type ToxicityConfig, TransformDirection, type TransformationRule, WatchHandle, type WriteEntry, type WriteInfo, applyTransformation, codeSecurityConfigToJSON, createAuditConfig, createCodeSecurityConfig, createEnvSecurityConfig, createInjectionDefenseConfig, createInvisibleTextConfig, createNetworkPolicy, createPIIConfig, createSecurityPolicy, createToxicityConfig, createTransformationRule, domainMatches, invisibleTextConfigToJSON, isSensitive, networkPolicyToOpts, parseAuditConfig, parseAuditEntry, parseBuildInfo, parseCodeSecurityConfig, parseCommandResult, parseEntryInfo, parseEnvSecurityConfig, parseFilesystemEvent, parseInjectionDefenseConfig, parseInvisibleTextConfig, parseNetworkPolicy, parsePIIConfig, parseProcessInfo, parseSandboxInfo, parseSandboxLifecycle, parseSandboxMetrics, parseSecurityPolicy, parseSnapshot, parseSnapshotInfo, parseTemplateBuildStatus, parseToxicityConfig, parseWriteInfo, requiresTlsInterception, securityPolicyToJSON, toxicityConfigToJSON, validateNetworkEntry };
1411
+ export { ALL_TRAFFIC, ApiClient, type AuditConfig, type AuditEntry, AuthenticationError, BuildError, type BuildInfo, type CodeSecurityConfig, CommandExitError, CommandHandle, type CommandResult, type CommandWaitOpts, Commands, ConnectionConfig, type ConnectionConfigOptions, type CopyItem, DEFAULT_MASK_PATTERNS, type EntryInfo, type EnvSecurityConfig, FileType, FileUploadError, Filesystem, type FilesystemEvent, FilesystemEventType, type GetBuildStatusOpts, GitAuthError, GitUpstreamError, InjectionAction, type InjectionDefenseConfig, InjectionSensitivity, InvalidArgumentError, type InvisibleTextConfig, type NetworkPolicy, NotEnoughSpaceError, NotFoundError, type PIIConfig, PIIType, type ProcessInfo, Pty, type PtyConnectOpts, type PtyCreateOpts, PtyHandle, type PtyOutput, type PtyResult, type PtySize, RedactionAction, type RequestOpts, type RunOpts, type RunStreamOpts, Sandbox, SandboxError, type SandboxInfo, type SandboxLifecycle, type SandboxMetrics, type SandboxNetworkOpts, type SandboxOpts, SandboxPaginator, type SandboxQuery, SandboxState, type SecureEnvVar, type SecurityPolicy, type Snapshot, type SnapshotInfo, SnapshotPaginator, type SnapshotSource, type Stderr, type Stdout, Template, TemplateBase, type TemplateBuildOpts, type TemplateBuildStatus, TemplateError, TimeoutError, type ToxicityConfig, TransformDirection, type TransformationRule, WatchHandle, type WriteEntry, type WriteInfo, applyTransformation, codeSecurityConfigToJSON, createAuditConfig, createCodeSecurityConfig, createEnvSecurityConfig, createInjectionDefenseConfig, createInvisibleTextConfig, createNetworkPolicy, createPIIConfig, createSecurityPolicy, createToxicityConfig, createTransformationRule, domainMatches, invisibleTextConfigToJSON, isSensitive, networkPolicyToOpts, parseAuditConfig, parseAuditEntry, parseBuildInfo, parseCodeSecurityConfig, parseCommandResult, parseEntryInfo, parseEnvSecurityConfig, parseFilesystemEvent, parseInjectionDefenseConfig, parseInvisibleTextConfig, parseNetworkPolicy, parsePIIConfig, parseProcessInfo, parseSandboxInfo, parseSandboxLifecycle, parseSandboxMetrics, parseSecurityPolicy, parseSnapshot, parseSnapshotInfo, parseTemplateBuildStatus, parseToxicityConfig, parseWriteInfo, requiresTlsInterception, securityPolicyToJSON, toxicityConfigToJSON, validateNetworkEntry };
package/dist/index.d.ts CHANGED
@@ -68,6 +68,11 @@ declare class ApiClient {
68
68
  * Does NOT parse the response body.
69
69
  */
70
70
  stream(path: string, opts?: RequestOpts): Promise<Response>;
71
+ /**
72
+ * Send a GET request and return the raw Response for SSE streaming.
73
+ * Does NOT parse the response body. Used by PTY stream consumers.
74
+ */
75
+ streamGet(path: string, opts?: RequestOpts): Promise<Response>;
71
76
  /**
72
77
  * Abort all in-flight requests and release resources.
73
78
  */
@@ -217,18 +222,23 @@ declare function parseNetworkPolicy(data: Record<string, any>): NetworkPolicy;
217
222
  */
218
223
  declare function networkPolicyToOpts(policy: NetworkPolicy): SandboxNetworkOpts;
219
224
 
220
- /** Configuration for audit logging. */
225
+ /**
226
+ * Toggle for per-sandbox audit logging.
227
+ *
228
+ * Declaw records a fixed set of lifecycle + security events (vm_created,
229
+ * vm_killed, snapshot_*, egress_blocked, …). Set `enabled: false` to opt
230
+ * the sandbox out entirely; events for that sandbox are not shipped to
231
+ * the collector and nothing is persisted.
232
+ *
233
+ * Retention is a platform-wide setting (global 7-day default), not a
234
+ * per-sandbox knob. Body logging is not user-configurable today.
235
+ */
221
236
  interface AuditConfig {
222
237
  enabled: boolean;
223
- logRequestBody: boolean;
224
- logResponseBody: boolean;
225
- retentionHours: number;
226
238
  }
227
- /**
228
- * Create an AuditConfig with defaults.
229
- */
239
+ /** Create an AuditConfig with defaults (enabled=true). */
230
240
  declare function createAuditConfig(opts?: Partial<AuditConfig>): AuditConfig;
231
- /** Parse raw JSON data into AuditConfig. */
241
+ /** Parse raw JSON data into AuditConfig. Defaults to enabled=true when the field is absent. */
232
242
  declare function parseAuditConfig(data: Record<string, any>): AuditConfig;
233
243
  /** A single audit log entry. */
234
244
  interface AuditEntry {
@@ -693,6 +703,11 @@ declare class Filesystem {
693
703
  /**
694
704
  * Write data to a file.
695
705
  *
706
+ * When `data` is a `Uint8Array`, the SDK streams the raw bytes to the
707
+ * binary-safe `PUT /files/raw` endpoint (500 MiB cap). When it's a string,
708
+ * the SDK uses the JSON `POST /files` endpoint. Callers do not need to
709
+ * pick the transport.
710
+ *
696
711
  * @param path - Absolute path to the file.
697
712
  * @param data - String or Uint8Array content to write.
698
713
  * @param opts - Optional user and request timeout.
@@ -705,9 +720,14 @@ declare class Filesystem {
705
720
  /**
706
721
  * Write multiple files in a single batch request.
707
722
  *
723
+ * The batch endpoint is JSON-only and cannot carry binary. Entries are
724
+ * partitioned: string entries go through `POST /files/batch` in one call,
725
+ * `Uint8Array` entries are streamed individually to `PUT /files/raw`.
726
+ * Results are merged back in input order.
727
+ *
708
728
  * @param files - Array of files to write.
709
729
  * @param opts - Optional user and request timeout.
710
- * @returns Array of write info for each file.
730
+ * @returns Array of write info for each file, in input order.
711
731
  */
712
732
  writeFiles(files: WriteEntry[], opts?: {
713
733
  user?: string;
@@ -798,6 +818,19 @@ declare class Filesystem {
798
818
  }): Promise<WatchHandle>;
799
819
  }
800
820
 
821
+ /** Outcome of a PTY session — produced by `PtyHandle.wait()`. */
822
+ interface PtyResult {
823
+ /** Remote shell exit code. `-1` if the stream dropped before a clean exit frame. */
824
+ exitCode: number;
825
+ }
826
+ /** Options for attaching to a running PTY via `Pty.connect()`. */
827
+ interface PtyConnectOpts {
828
+ /**
829
+ * Callback invoked with every chunk of PTY output as raw bytes.
830
+ * Optional — omit to drive the stream via the handle's async iterator.
831
+ */
832
+ onData?: (data: Uint8Array) => void;
833
+ }
801
834
  /** Options for creating a PTY session. */
802
835
  interface PtyCreateOpts {
803
836
  /** Terminal size. Defaults to { cols: 80, rows: 24 }. */
@@ -808,46 +841,87 @@ interface PtyCreateOpts {
808
841
  cwd?: string;
809
842
  /** Environment variables. */
810
843
  envs?: Record<string, string>;
811
- /** Command timeout in seconds. */
844
+ /**
845
+ * PTY session TTL in seconds. Defaults to 3600 (1 hour). Pass `0` to
846
+ * keep the session alive indefinitely — it will still die when the
847
+ * parent sandbox's timeout fires.
848
+ */
812
849
  timeout?: number;
813
- /** Per-request timeout in milliseconds. */
850
+ /** Per-request timeout in milliseconds (applies to the initial create call only). */
814
851
  requestTimeout?: number;
852
+ /**
853
+ * Callback invoked with every chunk of PTY output as raw bytes.
854
+ * Setting this implicitly opens the SSE stream; the returned handle's
855
+ * `wait()` resolves when the remote process exits. Drop this option
856
+ * and call `handle.stream()` directly if you want to drive the iterator
857
+ * explicitly instead.
858
+ */
859
+ onData?: (data: Uint8Array) => void;
815
860
  }
816
861
  /**
817
- * PTY (pseudo-terminal) interface for a sandbox.
862
+ * Handle to a running PTY session. Returned from `Pty.create()`.
818
863
  *
819
- * Provides methods to create, kill, resize, and send input to PTY sessions.
864
+ * Exposes stdin / resize / kill plus a `wait()` that resolves with the
865
+ * remote exit code once the process terminates. The output stream runs
866
+ * over Server-Sent Events — configured via `onData` at create time or
867
+ * consumed manually with `stream()`.
820
868
  */
821
- declare class Pty {
869
+ declare class PtyHandle {
870
+ readonly pid: number;
822
871
  private readonly sandboxId;
823
872
  private readonly client;
824
- constructor(sandboxId: string, client: ApiClient);
873
+ private readonly exitPromise;
874
+ private resolveExit;
875
+ private aborter;
876
+ constructor(pid: number, sandboxId: string, client: ApiClient, onData?: (data: Uint8Array) => void);
877
+ /** Forward keystrokes to the PTY. */
878
+ sendInput(data: Uint8Array | string, requestTimeout?: number): Promise<void>;
879
+ /** Update the terminal size (TIOCSWINSZ inside the VM). */
880
+ resize(size: PtySize, requestTimeout?: number): Promise<void>;
881
+ /** SIGKILL the remote process and close any open streams. */
882
+ kill(requestTimeout?: number): Promise<boolean>;
825
883
  /**
826
- * Create a new PTY session.
827
- *
828
- * Sends POST /sandboxes/:id/pty.
829
- * @returns A CommandHandle for the PTY process.
884
+ * Stop consuming output without killing the process. The PTY keeps
885
+ * running server-side and a fresh `stream()` call reattaches.
830
886
  */
831
- create(opts?: PtyCreateOpts): Promise<CommandHandle>;
887
+ disconnect(): void;
888
+ /** Resolves with the remote exit result when the PTY process exits. */
889
+ wait(): Promise<PtyResult>;
832
890
  /**
833
- * Kill a PTY session.
891
+ * Async iterator over raw output chunks. Use when you want to drive
892
+ * the stream yourself:
834
893
  *
835
- * Sends DELETE /sandboxes/:id/pty/:pid.
836
- * @returns true if the process was killed, false if already dead.
837
- */
838
- kill(pid: number, requestTimeout?: number): Promise<boolean>;
839
- /**
840
- * Send input to a PTY session.
894
+ * for await (const chunk of handle.stream()) { ... }
841
895
  *
842
- * Sends POST /sandboxes/:id/pty/:pid/stdin.
843
- * If data is a Uint8Array, it is decoded to a string using TextDecoder.
896
+ * Don't mix this with `onData` on the same handle — they both try to
897
+ * consume the same underlying SSE connection.
844
898
  */
845
- sendStdin(pid: number, data: Uint8Array | string, requestTimeout?: number): Promise<void>;
899
+ stream(): AsyncGenerator<Uint8Array, void, void>;
900
+ private consumeStream;
901
+ }
902
+ /**
903
+ * PTY (pseudo-terminal) interface for a sandbox.
904
+ *
905
+ * Use `create()` to launch a fresh shell session. The returned
906
+ * `PtyHandle` exposes stdin / resize / kill plus a live output stream
907
+ * (callback or async iterator).
908
+ */
909
+ declare class Pty {
910
+ private readonly sandboxId;
911
+ private readonly client;
912
+ constructor(sandboxId: string, client: ApiClient);
913
+ create(opts?: PtyCreateOpts): Promise<PtyHandle>;
846
914
  /**
847
- * Resize a PTY session.
915
+ * Reattach to an already-running PTY by its pid.
848
916
  *
849
- * Sends PATCH /sandboxes/:id/pty/:pid.
917
+ * Returns a fresh `PtyHandle` that streams the live output of the
918
+ * existing session. Multiple clients can subscribe to the same pid
919
+ * concurrently — each receives output from the moment it connects
920
+ * (no scrollback replay).
850
921
  */
922
+ connect(pid: number, opts?: PtyConnectOpts): PtyHandle;
923
+ kill(pid: number, requestTimeout?: number): Promise<boolean>;
924
+ sendStdin(pid: number, data: Uint8Array | string, requestTimeout?: number): Promise<void>;
851
925
  resize(pid: number, size: PtySize, requestTimeout?: number): Promise<void>;
852
926
  }
853
927
 
@@ -1334,4 +1408,4 @@ declare class Template {
1334
1408
  static getBuildStatus(buildId: string, opts?: GetBuildStatusOpts): Promise<TemplateBuildStatus>;
1335
1409
  }
1336
1410
 
1337
- export { ALL_TRAFFIC, ApiClient, type AuditConfig, type AuditEntry, AuthenticationError, BuildError, type BuildInfo, type CodeSecurityConfig, CommandExitError, CommandHandle, type CommandResult, type CommandWaitOpts, Commands, ConnectionConfig, type ConnectionConfigOptions, type CopyItem, DEFAULT_MASK_PATTERNS, type EntryInfo, type EnvSecurityConfig, FileType, FileUploadError, Filesystem, type FilesystemEvent, FilesystemEventType, type GetBuildStatusOpts, GitAuthError, GitUpstreamError, InjectionAction, type InjectionDefenseConfig, InjectionSensitivity, InvalidArgumentError, type InvisibleTextConfig, type NetworkPolicy, NotEnoughSpaceError, NotFoundError, type PIIConfig, PIIType, type ProcessInfo, Pty, type PtyCreateOpts, type PtyOutput, type PtySize, RedactionAction, type RequestOpts, type RunOpts, type RunStreamOpts, Sandbox, SandboxError, type SandboxInfo, type SandboxLifecycle, type SandboxMetrics, type SandboxNetworkOpts, type SandboxOpts, SandboxPaginator, type SandboxQuery, SandboxState, type SecureEnvVar, type SecurityPolicy, type Snapshot, type SnapshotInfo, SnapshotPaginator, type SnapshotSource, type Stderr, type Stdout, Template, TemplateBase, type TemplateBuildOpts, type TemplateBuildStatus, TemplateError, TimeoutError, type ToxicityConfig, TransformDirection, type TransformationRule, WatchHandle, type WriteEntry, type WriteInfo, applyTransformation, codeSecurityConfigToJSON, createAuditConfig, createCodeSecurityConfig, createEnvSecurityConfig, createInjectionDefenseConfig, createInvisibleTextConfig, createNetworkPolicy, createPIIConfig, createSecurityPolicy, createToxicityConfig, createTransformationRule, domainMatches, invisibleTextConfigToJSON, isSensitive, networkPolicyToOpts, parseAuditConfig, parseAuditEntry, parseBuildInfo, parseCodeSecurityConfig, parseCommandResult, parseEntryInfo, parseEnvSecurityConfig, parseFilesystemEvent, parseInjectionDefenseConfig, parseInvisibleTextConfig, parseNetworkPolicy, parsePIIConfig, parseProcessInfo, parseSandboxInfo, parseSandboxLifecycle, parseSandboxMetrics, parseSecurityPolicy, parseSnapshot, parseSnapshotInfo, parseTemplateBuildStatus, parseToxicityConfig, parseWriteInfo, requiresTlsInterception, securityPolicyToJSON, toxicityConfigToJSON, validateNetworkEntry };
1411
+ export { ALL_TRAFFIC, ApiClient, type AuditConfig, type AuditEntry, AuthenticationError, BuildError, type BuildInfo, type CodeSecurityConfig, CommandExitError, CommandHandle, type CommandResult, type CommandWaitOpts, Commands, ConnectionConfig, type ConnectionConfigOptions, type CopyItem, DEFAULT_MASK_PATTERNS, type EntryInfo, type EnvSecurityConfig, FileType, FileUploadError, Filesystem, type FilesystemEvent, FilesystemEventType, type GetBuildStatusOpts, GitAuthError, GitUpstreamError, InjectionAction, type InjectionDefenseConfig, InjectionSensitivity, InvalidArgumentError, type InvisibleTextConfig, type NetworkPolicy, NotEnoughSpaceError, NotFoundError, type PIIConfig, PIIType, type ProcessInfo, Pty, type PtyConnectOpts, type PtyCreateOpts, PtyHandle, type PtyOutput, type PtyResult, type PtySize, RedactionAction, type RequestOpts, type RunOpts, type RunStreamOpts, Sandbox, SandboxError, type SandboxInfo, type SandboxLifecycle, type SandboxMetrics, type SandboxNetworkOpts, type SandboxOpts, SandboxPaginator, type SandboxQuery, SandboxState, type SecureEnvVar, type SecurityPolicy, type Snapshot, type SnapshotInfo, SnapshotPaginator, type SnapshotSource, type Stderr, type Stdout, Template, TemplateBase, type TemplateBuildOpts, type TemplateBuildStatus, TemplateError, TimeoutError, type ToxicityConfig, TransformDirection, type TransformationRule, WatchHandle, type WriteEntry, type WriteInfo, applyTransformation, codeSecurityConfigToJSON, createAuditConfig, createCodeSecurityConfig, createEnvSecurityConfig, createInjectionDefenseConfig, createInvisibleTextConfig, createNetworkPolicy, createPIIConfig, createSecurityPolicy, createToxicityConfig, createTransformationRule, domainMatches, invisibleTextConfigToJSON, isSensitive, networkPolicyToOpts, parseAuditConfig, parseAuditEntry, parseBuildInfo, parseCodeSecurityConfig, parseCommandResult, parseEntryInfo, parseEnvSecurityConfig, parseFilesystemEvent, parseInjectionDefenseConfig, parseInvisibleTextConfig, parseNetworkPolicy, parsePIIConfig, parseProcessInfo, parseSandboxInfo, parseSandboxLifecycle, parseSandboxMetrics, parseSecurityPolicy, parseSnapshot, parseSnapshotInfo, parseTemplateBuildStatus, parseToxicityConfig, parseWriteInfo, requiresTlsInterception, securityPolicyToJSON, toxicityConfigToJSON, validateNetworkEntry };