@declaw/sdk 1.0.0 → 1.0.2
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/CHANGELOG.md +20 -0
- package/dist/index.cjs +231 -70
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +82 -34
- package/dist/index.d.ts +82 -34
- package/dist/index.js +230 -70
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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
|
-
/**
|
|
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;
|
|
@@ -810,44 +830,72 @@ interface PtyCreateOpts {
|
|
|
810
830
|
envs?: Record<string, string>;
|
|
811
831
|
/** Command timeout in seconds. */
|
|
812
832
|
timeout?: number;
|
|
813
|
-
/** Per-request timeout in milliseconds. */
|
|
833
|
+
/** Per-request timeout in milliseconds (applies to the initial create call only). */
|
|
814
834
|
requestTimeout?: number;
|
|
835
|
+
/**
|
|
836
|
+
* Callback invoked with every chunk of PTY output as raw bytes.
|
|
837
|
+
* Setting this implicitly opens the SSE stream; the returned handle's
|
|
838
|
+
* `wait()` resolves when the remote process exits. Drop this option
|
|
839
|
+
* and call `handle.stream()` directly if you want to drive the iterator
|
|
840
|
+
* explicitly instead.
|
|
841
|
+
*/
|
|
842
|
+
onData?: (data: Uint8Array) => void;
|
|
815
843
|
}
|
|
816
844
|
/**
|
|
817
|
-
*
|
|
845
|
+
* Handle to a running PTY session. Returned from `Pty.create()`.
|
|
818
846
|
*
|
|
819
|
-
*
|
|
847
|
+
* Exposes stdin / resize / kill plus a `wait()` that resolves with the
|
|
848
|
+
* remote exit code once the process terminates. The output stream runs
|
|
849
|
+
* over Server-Sent Events — configured via `onData` at create time or
|
|
850
|
+
* consumed manually with `stream()`.
|
|
820
851
|
*/
|
|
821
|
-
declare class
|
|
852
|
+
declare class PtyHandle {
|
|
853
|
+
readonly pid: number;
|
|
822
854
|
private readonly sandboxId;
|
|
823
855
|
private readonly client;
|
|
824
|
-
|
|
856
|
+
private readonly exitPromise;
|
|
857
|
+
private resolveExit;
|
|
858
|
+
private aborter;
|
|
859
|
+
constructor(pid: number, sandboxId: string, client: ApiClient, onData?: (data: Uint8Array) => void);
|
|
860
|
+
/** Forward keystrokes to the PTY. */
|
|
861
|
+
sendInput(data: Uint8Array | string, requestTimeout?: number): Promise<void>;
|
|
862
|
+
/** Update the terminal size (TIOCSWINSZ inside the VM). */
|
|
863
|
+
resize(size: PtySize, requestTimeout?: number): Promise<void>;
|
|
864
|
+
/** SIGKILL the remote process and close any open streams. */
|
|
865
|
+
kill(requestTimeout?: number): Promise<boolean>;
|
|
825
866
|
/**
|
|
826
|
-
*
|
|
827
|
-
*
|
|
828
|
-
* Sends POST /sandboxes/:id/pty.
|
|
829
|
-
* @returns A CommandHandle for the PTY process.
|
|
867
|
+
* Stop consuming output without killing the process. The PTY keeps
|
|
868
|
+
* running server-side and a fresh `stream()` call reattaches.
|
|
830
869
|
*/
|
|
831
|
-
|
|
870
|
+
disconnect(): void;
|
|
871
|
+
/** Resolves with the remote exit code when the PTY process exits. */
|
|
872
|
+
wait(): Promise<number>;
|
|
832
873
|
/**
|
|
833
|
-
*
|
|
874
|
+
* Async iterator over raw output chunks. Use when you want to drive
|
|
875
|
+
* the stream yourself:
|
|
834
876
|
*
|
|
835
|
-
*
|
|
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.
|
|
877
|
+
* for await (const chunk of handle.stream()) { ... }
|
|
841
878
|
*
|
|
842
|
-
*
|
|
843
|
-
*
|
|
879
|
+
* Don't mix this with `onData` on the same handle — they both try to
|
|
880
|
+
* consume the same underlying SSE connection.
|
|
844
881
|
*/
|
|
882
|
+
stream(): AsyncGenerator<Uint8Array, void, void>;
|
|
883
|
+
private consumeStream;
|
|
884
|
+
}
|
|
885
|
+
/**
|
|
886
|
+
* PTY (pseudo-terminal) interface for a sandbox.
|
|
887
|
+
*
|
|
888
|
+
* Use `create()` to launch a fresh shell session. The returned
|
|
889
|
+
* `PtyHandle` exposes stdin / resize / kill plus a live output stream
|
|
890
|
+
* (callback or async iterator).
|
|
891
|
+
*/
|
|
892
|
+
declare class Pty {
|
|
893
|
+
private readonly sandboxId;
|
|
894
|
+
private readonly client;
|
|
895
|
+
constructor(sandboxId: string, client: ApiClient);
|
|
896
|
+
create(opts?: PtyCreateOpts): Promise<PtyHandle>;
|
|
897
|
+
kill(pid: number, requestTimeout?: number): Promise<boolean>;
|
|
845
898
|
sendStdin(pid: number, data: Uint8Array | string, requestTimeout?: number): Promise<void>;
|
|
846
|
-
/**
|
|
847
|
-
* Resize a PTY session.
|
|
848
|
-
*
|
|
849
|
-
* Sends PATCH /sandboxes/:id/pty/:pid.
|
|
850
|
-
*/
|
|
851
899
|
resize(pid: number, size: PtySize, requestTimeout?: number): Promise<void>;
|
|
852
900
|
}
|
|
853
901
|
|
|
@@ -1334,4 +1382,4 @@ declare class Template {
|
|
|
1334
1382
|
static getBuildStatus(buildId: string, opts?: GetBuildStatusOpts): Promise<TemplateBuildStatus>;
|
|
1335
1383
|
}
|
|
1336
1384
|
|
|
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 };
|
|
1385
|
+
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, PtyHandle, 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 };
|
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
|
-
/**
|
|
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;
|
|
@@ -810,44 +830,72 @@ interface PtyCreateOpts {
|
|
|
810
830
|
envs?: Record<string, string>;
|
|
811
831
|
/** Command timeout in seconds. */
|
|
812
832
|
timeout?: number;
|
|
813
|
-
/** Per-request timeout in milliseconds. */
|
|
833
|
+
/** Per-request timeout in milliseconds (applies to the initial create call only). */
|
|
814
834
|
requestTimeout?: number;
|
|
835
|
+
/**
|
|
836
|
+
* Callback invoked with every chunk of PTY output as raw bytes.
|
|
837
|
+
* Setting this implicitly opens the SSE stream; the returned handle's
|
|
838
|
+
* `wait()` resolves when the remote process exits. Drop this option
|
|
839
|
+
* and call `handle.stream()` directly if you want to drive the iterator
|
|
840
|
+
* explicitly instead.
|
|
841
|
+
*/
|
|
842
|
+
onData?: (data: Uint8Array) => void;
|
|
815
843
|
}
|
|
816
844
|
/**
|
|
817
|
-
*
|
|
845
|
+
* Handle to a running PTY session. Returned from `Pty.create()`.
|
|
818
846
|
*
|
|
819
|
-
*
|
|
847
|
+
* Exposes stdin / resize / kill plus a `wait()` that resolves with the
|
|
848
|
+
* remote exit code once the process terminates. The output stream runs
|
|
849
|
+
* over Server-Sent Events — configured via `onData` at create time or
|
|
850
|
+
* consumed manually with `stream()`.
|
|
820
851
|
*/
|
|
821
|
-
declare class
|
|
852
|
+
declare class PtyHandle {
|
|
853
|
+
readonly pid: number;
|
|
822
854
|
private readonly sandboxId;
|
|
823
855
|
private readonly client;
|
|
824
|
-
|
|
856
|
+
private readonly exitPromise;
|
|
857
|
+
private resolveExit;
|
|
858
|
+
private aborter;
|
|
859
|
+
constructor(pid: number, sandboxId: string, client: ApiClient, onData?: (data: Uint8Array) => void);
|
|
860
|
+
/** Forward keystrokes to the PTY. */
|
|
861
|
+
sendInput(data: Uint8Array | string, requestTimeout?: number): Promise<void>;
|
|
862
|
+
/** Update the terminal size (TIOCSWINSZ inside the VM). */
|
|
863
|
+
resize(size: PtySize, requestTimeout?: number): Promise<void>;
|
|
864
|
+
/** SIGKILL the remote process and close any open streams. */
|
|
865
|
+
kill(requestTimeout?: number): Promise<boolean>;
|
|
825
866
|
/**
|
|
826
|
-
*
|
|
827
|
-
*
|
|
828
|
-
* Sends POST /sandboxes/:id/pty.
|
|
829
|
-
* @returns A CommandHandle for the PTY process.
|
|
867
|
+
* Stop consuming output without killing the process. The PTY keeps
|
|
868
|
+
* running server-side and a fresh `stream()` call reattaches.
|
|
830
869
|
*/
|
|
831
|
-
|
|
870
|
+
disconnect(): void;
|
|
871
|
+
/** Resolves with the remote exit code when the PTY process exits. */
|
|
872
|
+
wait(): Promise<number>;
|
|
832
873
|
/**
|
|
833
|
-
*
|
|
874
|
+
* Async iterator over raw output chunks. Use when you want to drive
|
|
875
|
+
* the stream yourself:
|
|
834
876
|
*
|
|
835
|
-
*
|
|
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.
|
|
877
|
+
* for await (const chunk of handle.stream()) { ... }
|
|
841
878
|
*
|
|
842
|
-
*
|
|
843
|
-
*
|
|
879
|
+
* Don't mix this with `onData` on the same handle — they both try to
|
|
880
|
+
* consume the same underlying SSE connection.
|
|
844
881
|
*/
|
|
882
|
+
stream(): AsyncGenerator<Uint8Array, void, void>;
|
|
883
|
+
private consumeStream;
|
|
884
|
+
}
|
|
885
|
+
/**
|
|
886
|
+
* PTY (pseudo-terminal) interface for a sandbox.
|
|
887
|
+
*
|
|
888
|
+
* Use `create()` to launch a fresh shell session. The returned
|
|
889
|
+
* `PtyHandle` exposes stdin / resize / kill plus a live output stream
|
|
890
|
+
* (callback or async iterator).
|
|
891
|
+
*/
|
|
892
|
+
declare class Pty {
|
|
893
|
+
private readonly sandboxId;
|
|
894
|
+
private readonly client;
|
|
895
|
+
constructor(sandboxId: string, client: ApiClient);
|
|
896
|
+
create(opts?: PtyCreateOpts): Promise<PtyHandle>;
|
|
897
|
+
kill(pid: number, requestTimeout?: number): Promise<boolean>;
|
|
845
898
|
sendStdin(pid: number, data: Uint8Array | string, requestTimeout?: number): Promise<void>;
|
|
846
|
-
/**
|
|
847
|
-
* Resize a PTY session.
|
|
848
|
-
*
|
|
849
|
-
* Sends PATCH /sandboxes/:id/pty/:pid.
|
|
850
|
-
*/
|
|
851
899
|
resize(pid: number, size: PtySize, requestTimeout?: number): Promise<void>;
|
|
852
900
|
}
|
|
853
901
|
|
|
@@ -1334,4 +1382,4 @@ declare class Template {
|
|
|
1334
1382
|
static getBuildStatus(buildId: string, opts?: GetBuildStatusOpts): Promise<TemplateBuildStatus>;
|
|
1335
1383
|
}
|
|
1336
1384
|
|
|
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 };
|
|
1385
|
+
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, PtyHandle, 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 };
|