@scalebrowser/sdk 0.4.0 → 0.4.1

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.cjs CHANGED
@@ -1327,7 +1327,7 @@ var PROXY_KINDS = ["http", "socks5", "gateway"];
1327
1327
  var ROTATIONS = ["sticky", "rotating"];
1328
1328
 
1329
1329
  // src/index.ts
1330
- var VERSION = "0.3.0";
1330
+ var VERSION = "0.4.1";
1331
1331
 
1332
1332
  exports.ApiError = ApiError;
1333
1333
  exports.CdpError = CdpError;
package/dist/index.d.cts CHANGED
@@ -1,76 +1,5 @@
1
1
  import WebSocket from 'ws';
2
2
 
3
- /**
4
- * Error model: stable numeric API error codes (SPEC §5,
5
- * `crates/core/src/error.rs`) and the typed exceptions the SDK throws.
6
- */
7
- /** Stable numeric API error codes (4001–4012, append-only: a retired code stays
8
- * reserved rather than being reused). */
9
- declare const ErrorCode: {
10
- readonly NotFound: 4001;
11
- readonly ProxyGeo: 4002;
12
- readonly Capacity: 4003;
13
- readonly EngineMissing: 4004;
14
- readonly Preflight: 4005;
15
- readonly AlreadyRunning: 4006;
16
- /** Retired: the removed Methode-D (VM) tier produced this. Reserved (never reused)
17
- * to match the server's append-only code contract; never returned now. */
18
- readonly VmProvisionFailed: 4007;
19
- /** The subscription's abo-wide concurrent-browser allowance is used up (DEC-012).
20
- * Distinct from Capacity (4003 = this machine is full, wait): the caller's move
21
- * is to stop a running browser anywhere or upgrade the plan. */
22
- readonly ConcurrencyLimit: 4008;
23
- readonly Unauthorized: 4010;
24
- /** No account is connected to this machine, so nothing may run (DEC-014).
25
- * Distinct from Unauthorized (4010 = the daemon's own bearer token is wrong, so
26
- * re-read the token): 4011 means the machine needs to be signed in, and no token
27
- * a client holds can substitute for that. Connect it in the desktop app. */
28
- readonly NotSignedIn: 4011;
29
- /** This ONE profile is open on another machine of the same account (DEC-015).
30
- * Distinct from ConcurrencyLimit (4008 = the plan is full, buy more or free any
31
- * browser): the caller's move here costs nothing. Close it on that machine, or
32
- * take it over from the app running there. */
33
- readonly ProfileInUse: 4012;
34
- };
35
- type ErrorCodeValue = (typeof ErrorCode)[keyof typeof ErrorCode];
36
- /** Error body shape: `{ code, message }` (docs/features/api.md). */
37
- interface ApiErrorBody {
38
- code?: number;
39
- message?: string;
40
- }
41
- /** Base class for every error this SDK throws, so callers can `catch` one type. */
42
- declare class ScalebrowserError extends Error {
43
- constructor(message: string);
44
- }
45
- /**
46
- * A typed transport/contract error. Carries the HTTP `status` and the daemon's
47
- * numeric `code` so callers (and the auth layer) can react, e.g. 401 / code
48
- * 4010 → re-authenticate.
49
- */
50
- declare class ApiError extends ScalebrowserError {
51
- readonly status: number;
52
- readonly code?: number;
53
- readonly body?: ApiErrorBody;
54
- constructor(status: number, body?: ApiErrorBody, fallbackMessage?: string);
55
- /** True for auth failures that must trigger re-authentication. */
56
- get isAuthError(): boolean;
57
- /** Short label for the error code, if any. */
58
- get codeLabel(): string | undefined;
59
- }
60
- /** A network-level failure (daemon unreachable, socket error, fetch rejected). */
61
- declare class NetworkError extends ScalebrowserError {
62
- readonly cause?: unknown;
63
- constructor(message: string, cause?: unknown);
64
- }
65
- /** A CDP command that returned an `error` frame, or a closed CDP connection. */
66
- declare class CdpError extends ScalebrowserError {
67
- readonly code: number;
68
- readonly data?: unknown;
69
- constructor(code: number, message: string, data?: unknown);
70
- }
71
- /** Narrow an unknown thrown value to a user-facing message. */
72
- declare function errorMessage(err: unknown): string;
73
-
74
3
  interface Screen {
75
4
  width: number;
76
5
  height: number;
@@ -1747,6 +1676,77 @@ declare class ScalebrowserClient extends ClientCore {
1747
1676
  interface ScalebrowserClient extends IdentityApi, RunsApi, ControlApi, ExtensionsApi {
1748
1677
  }
1749
1678
 
1679
+ /**
1680
+ * Error model: stable numeric API error codes (SPEC §5,
1681
+ * `crates/core/src/error.rs`) and the typed exceptions the SDK throws.
1682
+ */
1683
+ /** Stable numeric API error codes (4001–4012, append-only: a retired code stays
1684
+ * reserved rather than being reused). */
1685
+ declare const ErrorCode: {
1686
+ readonly NotFound: 4001;
1687
+ readonly ProxyGeo: 4002;
1688
+ readonly Capacity: 4003;
1689
+ readonly EngineMissing: 4004;
1690
+ readonly Preflight: 4005;
1691
+ readonly AlreadyRunning: 4006;
1692
+ /** Retired: the removed Methode-D (VM) tier produced this. Reserved (never reused)
1693
+ * to match the server's append-only code contract; never returned now. */
1694
+ readonly VmProvisionFailed: 4007;
1695
+ /** The subscription's abo-wide concurrent-browser allowance is used up (DEC-012).
1696
+ * Distinct from Capacity (4003 = this machine is full, wait): the caller's move
1697
+ * is to stop a running browser anywhere or upgrade the plan. */
1698
+ readonly ConcurrencyLimit: 4008;
1699
+ readonly Unauthorized: 4010;
1700
+ /** No account is connected to this machine, so nothing may run (DEC-014).
1701
+ * Distinct from Unauthorized (4010 = the daemon's own bearer token is wrong, so
1702
+ * re-read the token): 4011 means the machine needs to be signed in, and no token
1703
+ * a client holds can substitute for that. Connect it in the desktop app. */
1704
+ readonly NotSignedIn: 4011;
1705
+ /** This ONE profile is open on another machine of the same account (DEC-015).
1706
+ * Distinct from ConcurrencyLimit (4008 = the plan is full, buy more or free any
1707
+ * browser): the caller's move here costs nothing. Close it on that machine, or
1708
+ * take it over from the app running there. */
1709
+ readonly ProfileInUse: 4012;
1710
+ };
1711
+ type ErrorCodeValue = (typeof ErrorCode)[keyof typeof ErrorCode];
1712
+ /** Error body shape: `{ code, message }` (docs/features/api.md). */
1713
+ interface ApiErrorBody {
1714
+ code?: number;
1715
+ message?: string;
1716
+ }
1717
+ /** Base class for every error this SDK throws, so callers can `catch` one type. */
1718
+ declare class ScalebrowserError extends Error {
1719
+ constructor(message: string);
1720
+ }
1721
+ /**
1722
+ * A typed transport/contract error. Carries the HTTP `status` and the daemon's
1723
+ * numeric `code` so callers (and the auth layer) can react, e.g. 401 / code
1724
+ * 4010 → re-authenticate.
1725
+ */
1726
+ declare class ApiError extends ScalebrowserError {
1727
+ readonly status: number;
1728
+ readonly code?: number;
1729
+ readonly body?: ApiErrorBody;
1730
+ constructor(status: number, body?: ApiErrorBody, fallbackMessage?: string);
1731
+ /** True for auth failures that must trigger re-authentication. */
1732
+ get isAuthError(): boolean;
1733
+ /** Short label for the error code, if any. */
1734
+ get codeLabel(): string | undefined;
1735
+ }
1736
+ /** A network-level failure (daemon unreachable, socket error, fetch rejected). */
1737
+ declare class NetworkError extends ScalebrowserError {
1738
+ readonly cause?: unknown;
1739
+ constructor(message: string, cause?: unknown);
1740
+ }
1741
+ /** A CDP command that returned an `error` frame, or a closed CDP connection. */
1742
+ declare class CdpError extends ScalebrowserError {
1743
+ readonly code: number;
1744
+ readonly data?: unknown;
1745
+ constructor(code: number, message: string, data?: unknown);
1746
+ }
1747
+ /** Narrow an unknown thrown value to a user-facing message. */
1748
+ declare function errorMessage(err: unknown): string;
1749
+
1750
1750
  /**
1751
1751
  * `@scalebrowser/sdk`: the official Node/TypeScript SDK for the Scalebrowser
1752
1752
  * daemon. A typed REST client plus a direct-CDP driver plane (nodriver-style,
@@ -1764,6 +1764,6 @@ interface ScalebrowserClient extends IdentityApi, RunsApi, ControlApi, Extension
1764
1764
  * ```
1765
1765
  */
1766
1766
 
1767
- declare const VERSION = "0.3.0";
1767
+ declare const VERSION = "0.4.1";
1768
1768
 
1769
1769
  export { type Account, type ActivitySnapshot, type AgentRun, ApiError, type ApiErrorBody, type ArtifactBytes, type ArtifactPutResult, type AttachOptions, type AuditDetectorReport, type AuditReport, type AuditStatus, type AuditVerdict, type BindInboxBody, type CdpConnectOptions, CdpError, type CdpEvent, CdpSession, type ClickOptions, type CreateGroupBody, type CreateInboxBody, type CreatePresetBody, DEFAULT_CAPACITY, type DeleteInterruptionRuleParams, type EffectiveInterruptionLock, ErrorCode, type ErrorCodeValue, type EvaluateOptions, type FetchLike, GEO_MODES, type GeoMode, type GoalSource, type Group, HOST_MODES, type HealthStatus, type HostMode, type Inbox, type InboxBinding, type InboxBindings, type InboxChannel, type InputClient, type InterruptionChoice, type InterruptionLock, type InterruptionLockRow, type InterruptionLockView, type InterruptionRuleRow, type LaunchHandle, type ListRunsParams, type ListStepsParams, type NavigateOptions, NetworkError, type OsFamily, type OutcomeSource, PROXY_KINDS, type PasskeyRow, type PersonaConstraintOptions, type Preset, type PresetConfig, type PresetConstraints, type Profile, type ProfileActivity, type ProtectionLevel, type ProtectionStatus, type Proxy, type ProxyKind, ROTATIONS, RUNTIME_STATES, type ReadyStatus, type RevealCookiesBody, type RevealCookiesResult, type RevealedCookie, type Rotation, type RunActor, type RunOutcome, type RunStep, type RuntimeState, ScalebrowserClient, type ScalebrowserClientOptions, ScalebrowserError, type ScrollOptions, type SecretBindingMode, type SecretDeleteResult, type SecretKind, type SecretListResult, type SecretOrigin, type SecretPatchBody, type SecretRow, type SecretRunBody, type SecretRunMention, type SecretRunResult, type SecretScrubResult, type SecretState, type SessionExportBody, type SessionExportResult, type SessionImportBody, type SessionKind, type SetInterruptionLockBody, type SetInterruptionRuleBody, type StepKind, type StepTarget, type StreamHandlers, type StreamParams, type StreamStatus, type TrustedInputBody, type UpdateGroupBody, type UpdateInboxBody, type UpdatePresetBody, VERSION, deriveMetricsFromProfiles, errorMessage, eventStream, openCdpSession, parseSseFrame, subscribeEvents };
package/dist/index.d.ts CHANGED
@@ -1,76 +1,5 @@
1
1
  import WebSocket from 'ws';
2
2
 
3
- /**
4
- * Error model: stable numeric API error codes (SPEC §5,
5
- * `crates/core/src/error.rs`) and the typed exceptions the SDK throws.
6
- */
7
- /** Stable numeric API error codes (4001–4012, append-only: a retired code stays
8
- * reserved rather than being reused). */
9
- declare const ErrorCode: {
10
- readonly NotFound: 4001;
11
- readonly ProxyGeo: 4002;
12
- readonly Capacity: 4003;
13
- readonly EngineMissing: 4004;
14
- readonly Preflight: 4005;
15
- readonly AlreadyRunning: 4006;
16
- /** Retired: the removed Methode-D (VM) tier produced this. Reserved (never reused)
17
- * to match the server's append-only code contract; never returned now. */
18
- readonly VmProvisionFailed: 4007;
19
- /** The subscription's abo-wide concurrent-browser allowance is used up (DEC-012).
20
- * Distinct from Capacity (4003 = this machine is full, wait): the caller's move
21
- * is to stop a running browser anywhere or upgrade the plan. */
22
- readonly ConcurrencyLimit: 4008;
23
- readonly Unauthorized: 4010;
24
- /** No account is connected to this machine, so nothing may run (DEC-014).
25
- * Distinct from Unauthorized (4010 = the daemon's own bearer token is wrong, so
26
- * re-read the token): 4011 means the machine needs to be signed in, and no token
27
- * a client holds can substitute for that. Connect it in the desktop app. */
28
- readonly NotSignedIn: 4011;
29
- /** This ONE profile is open on another machine of the same account (DEC-015).
30
- * Distinct from ConcurrencyLimit (4008 = the plan is full, buy more or free any
31
- * browser): the caller's move here costs nothing. Close it on that machine, or
32
- * take it over from the app running there. */
33
- readonly ProfileInUse: 4012;
34
- };
35
- type ErrorCodeValue = (typeof ErrorCode)[keyof typeof ErrorCode];
36
- /** Error body shape: `{ code, message }` (docs/features/api.md). */
37
- interface ApiErrorBody {
38
- code?: number;
39
- message?: string;
40
- }
41
- /** Base class for every error this SDK throws, so callers can `catch` one type. */
42
- declare class ScalebrowserError extends Error {
43
- constructor(message: string);
44
- }
45
- /**
46
- * A typed transport/contract error. Carries the HTTP `status` and the daemon's
47
- * numeric `code` so callers (and the auth layer) can react, e.g. 401 / code
48
- * 4010 → re-authenticate.
49
- */
50
- declare class ApiError extends ScalebrowserError {
51
- readonly status: number;
52
- readonly code?: number;
53
- readonly body?: ApiErrorBody;
54
- constructor(status: number, body?: ApiErrorBody, fallbackMessage?: string);
55
- /** True for auth failures that must trigger re-authentication. */
56
- get isAuthError(): boolean;
57
- /** Short label for the error code, if any. */
58
- get codeLabel(): string | undefined;
59
- }
60
- /** A network-level failure (daemon unreachable, socket error, fetch rejected). */
61
- declare class NetworkError extends ScalebrowserError {
62
- readonly cause?: unknown;
63
- constructor(message: string, cause?: unknown);
64
- }
65
- /** A CDP command that returned an `error` frame, or a closed CDP connection. */
66
- declare class CdpError extends ScalebrowserError {
67
- readonly code: number;
68
- readonly data?: unknown;
69
- constructor(code: number, message: string, data?: unknown);
70
- }
71
- /** Narrow an unknown thrown value to a user-facing message. */
72
- declare function errorMessage(err: unknown): string;
73
-
74
3
  interface Screen {
75
4
  width: number;
76
5
  height: number;
@@ -1747,6 +1676,77 @@ declare class ScalebrowserClient extends ClientCore {
1747
1676
  interface ScalebrowserClient extends IdentityApi, RunsApi, ControlApi, ExtensionsApi {
1748
1677
  }
1749
1678
 
1679
+ /**
1680
+ * Error model: stable numeric API error codes (SPEC §5,
1681
+ * `crates/core/src/error.rs`) and the typed exceptions the SDK throws.
1682
+ */
1683
+ /** Stable numeric API error codes (4001–4012, append-only: a retired code stays
1684
+ * reserved rather than being reused). */
1685
+ declare const ErrorCode: {
1686
+ readonly NotFound: 4001;
1687
+ readonly ProxyGeo: 4002;
1688
+ readonly Capacity: 4003;
1689
+ readonly EngineMissing: 4004;
1690
+ readonly Preflight: 4005;
1691
+ readonly AlreadyRunning: 4006;
1692
+ /** Retired: the removed Methode-D (VM) tier produced this. Reserved (never reused)
1693
+ * to match the server's append-only code contract; never returned now. */
1694
+ readonly VmProvisionFailed: 4007;
1695
+ /** The subscription's abo-wide concurrent-browser allowance is used up (DEC-012).
1696
+ * Distinct from Capacity (4003 = this machine is full, wait): the caller's move
1697
+ * is to stop a running browser anywhere or upgrade the plan. */
1698
+ readonly ConcurrencyLimit: 4008;
1699
+ readonly Unauthorized: 4010;
1700
+ /** No account is connected to this machine, so nothing may run (DEC-014).
1701
+ * Distinct from Unauthorized (4010 = the daemon's own bearer token is wrong, so
1702
+ * re-read the token): 4011 means the machine needs to be signed in, and no token
1703
+ * a client holds can substitute for that. Connect it in the desktop app. */
1704
+ readonly NotSignedIn: 4011;
1705
+ /** This ONE profile is open on another machine of the same account (DEC-015).
1706
+ * Distinct from ConcurrencyLimit (4008 = the plan is full, buy more or free any
1707
+ * browser): the caller's move here costs nothing. Close it on that machine, or
1708
+ * take it over from the app running there. */
1709
+ readonly ProfileInUse: 4012;
1710
+ };
1711
+ type ErrorCodeValue = (typeof ErrorCode)[keyof typeof ErrorCode];
1712
+ /** Error body shape: `{ code, message }` (docs/features/api.md). */
1713
+ interface ApiErrorBody {
1714
+ code?: number;
1715
+ message?: string;
1716
+ }
1717
+ /** Base class for every error this SDK throws, so callers can `catch` one type. */
1718
+ declare class ScalebrowserError extends Error {
1719
+ constructor(message: string);
1720
+ }
1721
+ /**
1722
+ * A typed transport/contract error. Carries the HTTP `status` and the daemon's
1723
+ * numeric `code` so callers (and the auth layer) can react, e.g. 401 / code
1724
+ * 4010 → re-authenticate.
1725
+ */
1726
+ declare class ApiError extends ScalebrowserError {
1727
+ readonly status: number;
1728
+ readonly code?: number;
1729
+ readonly body?: ApiErrorBody;
1730
+ constructor(status: number, body?: ApiErrorBody, fallbackMessage?: string);
1731
+ /** True for auth failures that must trigger re-authentication. */
1732
+ get isAuthError(): boolean;
1733
+ /** Short label for the error code, if any. */
1734
+ get codeLabel(): string | undefined;
1735
+ }
1736
+ /** A network-level failure (daemon unreachable, socket error, fetch rejected). */
1737
+ declare class NetworkError extends ScalebrowserError {
1738
+ readonly cause?: unknown;
1739
+ constructor(message: string, cause?: unknown);
1740
+ }
1741
+ /** A CDP command that returned an `error` frame, or a closed CDP connection. */
1742
+ declare class CdpError extends ScalebrowserError {
1743
+ readonly code: number;
1744
+ readonly data?: unknown;
1745
+ constructor(code: number, message: string, data?: unknown);
1746
+ }
1747
+ /** Narrow an unknown thrown value to a user-facing message. */
1748
+ declare function errorMessage(err: unknown): string;
1749
+
1750
1750
  /**
1751
1751
  * `@scalebrowser/sdk`: the official Node/TypeScript SDK for the Scalebrowser
1752
1752
  * daemon. A typed REST client plus a direct-CDP driver plane (nodriver-style,
@@ -1764,6 +1764,6 @@ interface ScalebrowserClient extends IdentityApi, RunsApi, ControlApi, Extension
1764
1764
  * ```
1765
1765
  */
1766
1766
 
1767
- declare const VERSION = "0.3.0";
1767
+ declare const VERSION = "0.4.1";
1768
1768
 
1769
1769
  export { type Account, type ActivitySnapshot, type AgentRun, ApiError, type ApiErrorBody, type ArtifactBytes, type ArtifactPutResult, type AttachOptions, type AuditDetectorReport, type AuditReport, type AuditStatus, type AuditVerdict, type BindInboxBody, type CdpConnectOptions, CdpError, type CdpEvent, CdpSession, type ClickOptions, type CreateGroupBody, type CreateInboxBody, type CreatePresetBody, DEFAULT_CAPACITY, type DeleteInterruptionRuleParams, type EffectiveInterruptionLock, ErrorCode, type ErrorCodeValue, type EvaluateOptions, type FetchLike, GEO_MODES, type GeoMode, type GoalSource, type Group, HOST_MODES, type HealthStatus, type HostMode, type Inbox, type InboxBinding, type InboxBindings, type InboxChannel, type InputClient, type InterruptionChoice, type InterruptionLock, type InterruptionLockRow, type InterruptionLockView, type InterruptionRuleRow, type LaunchHandle, type ListRunsParams, type ListStepsParams, type NavigateOptions, NetworkError, type OsFamily, type OutcomeSource, PROXY_KINDS, type PasskeyRow, type PersonaConstraintOptions, type Preset, type PresetConfig, type PresetConstraints, type Profile, type ProfileActivity, type ProtectionLevel, type ProtectionStatus, type Proxy, type ProxyKind, ROTATIONS, RUNTIME_STATES, type ReadyStatus, type RevealCookiesBody, type RevealCookiesResult, type RevealedCookie, type Rotation, type RunActor, type RunOutcome, type RunStep, type RuntimeState, ScalebrowserClient, type ScalebrowserClientOptions, ScalebrowserError, type ScrollOptions, type SecretBindingMode, type SecretDeleteResult, type SecretKind, type SecretListResult, type SecretOrigin, type SecretPatchBody, type SecretRow, type SecretRunBody, type SecretRunMention, type SecretRunResult, type SecretScrubResult, type SecretState, type SessionExportBody, type SessionExportResult, type SessionImportBody, type SessionKind, type SetInterruptionLockBody, type SetInterruptionRuleBody, type StepKind, type StepTarget, type StreamHandlers, type StreamParams, type StreamStatus, type TrustedInputBody, type UpdateGroupBody, type UpdateInboxBody, type UpdatePresetBody, VERSION, deriveMetricsFromProfiles, errorMessage, eventStream, openCdpSession, parseSseFrame, subscribeEvents };
package/dist/index.js CHANGED
@@ -1321,6 +1321,6 @@ var PROXY_KINDS = ["http", "socks5", "gateway"];
1321
1321
  var ROTATIONS = ["sticky", "rotating"];
1322
1322
 
1323
1323
  // src/index.ts
1324
- var VERSION = "0.3.0";
1324
+ var VERSION = "0.4.1";
1325
1325
 
1326
1326
  export { ApiError, CdpError, CdpSession, DEFAULT_CAPACITY, ErrorCode, GEO_MODES, HOST_MODES, NetworkError, PROXY_KINDS, ROTATIONS, RUNTIME_STATES, ScalebrowserClient, ScalebrowserError, VERSION, deriveMetricsFromProfiles, errorMessage, eventStream, openCdpSession, parseSseFrame, subscribeEvents };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalebrowser/sdk",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Official Node/TypeScript SDK for the Scalebrowser daemon — typed REST client + direct-CDP driver plane (nodriver-style, not Playwright).",
5
5
  "type": "module",
6
6
  "license": "MIT",