@hyperbrowser/sdk 1.1.0 → 1.2.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.
@@ -0,0 +1,16 @@
1
+ import { BaseService } from "./base";
2
+ import { WebMCPInvocation, WebMCPInvokeParams, WebMCPInvokeResult, WebMCPResultParams, WebMCPStartParams, WebMCPToolsResponse } from "../types/webmcp";
3
+ /** Page tools for sessions created with enableWebMcp: true. */
4
+ export declare class WebMCPService extends BaseService {
5
+ private path;
6
+ /** Discover current tools across the session's tabs and frames. */
7
+ listTools(sessionId: string): Promise<WebMCPToolsResponse>;
8
+ /** Invoke once. Transport failures never cause an automatic retry. */
9
+ invoke(sessionId: string, params: WebMCPInvokeParams): Promise<WebMCPInvokeResult>;
10
+ /** Start once and return a handle. A lost response may mean the tool already ran. */
11
+ start(sessionId: string, params: WebMCPStartParams): Promise<WebMCPInvocation>;
12
+ /** Read or long-poll a handle. Pending responses do not cancel or restart the tool. */
13
+ getResult(sessionId: string, invocationId: string, params?: WebMCPResultParams): Promise<WebMCPInvocation>;
14
+ /** Request cancellation; completion can win the race. Read getResult for the outcome. */
15
+ cancel(sessionId: string, invocationId: string): Promise<WebMCPInvocation>;
16
+ }
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WebMCPService = void 0;
4
+ const base_1 = require("./base");
5
+ function seconds(value, min, max, name) {
6
+ if (!Number.isInteger(value) || value < min || value > max) {
7
+ throw new RangeError(`${name} must be an integer between ${min} and ${max}`);
8
+ }
9
+ return value;
10
+ }
11
+ function invocationBody(params) {
12
+ if (typeof params.toolRef !== "string" || !params.toolRef.trim()) {
13
+ throw new TypeError("toolRef must be a non-empty string from listTools");
14
+ }
15
+ if (params.input !== undefined &&
16
+ (params.input === null || typeof params.input !== "object" || Array.isArray(params.input))) {
17
+ throw new TypeError("input must be a JSON object");
18
+ }
19
+ return JSON.stringify(params);
20
+ }
21
+ /** Page tools for sessions created with enableWebMcp: true. */
22
+ class WebMCPService extends base_1.BaseService {
23
+ path(sessionId) {
24
+ return `/session/${encodeURIComponent(sessionId)}/webmcp`;
25
+ }
26
+ /** Discover current tools across the session's tabs and frames. */
27
+ async listTools(sessionId) {
28
+ return this.request(`${this.path(sessionId)}/tools`, {
29
+ timeout: Math.max(this.timeout, 40000),
30
+ });
31
+ }
32
+ /** Invoke once. Transport failures never cause an automatic retry. */
33
+ async invoke(sessionId, params) {
34
+ const timeout = seconds(params.timeoutSeconds ?? 60, 1, 120, "timeoutSeconds");
35
+ return this.request(`${this.path(sessionId)}/invoke`, {
36
+ method: "POST",
37
+ body: invocationBody(params),
38
+ timeout: Math.max(this.timeout, (timeout + 35) * 1000),
39
+ });
40
+ }
41
+ /** Start once and return a handle. A lost response may mean the tool already ran. */
42
+ async start(sessionId, params) {
43
+ seconds(params.timeoutSeconds ?? 300, 1, 3600, "timeoutSeconds");
44
+ return this.request(`${this.path(sessionId)}/invocations`, {
45
+ method: "POST",
46
+ body: invocationBody(params),
47
+ timeout: Math.max(this.timeout, 40000),
48
+ });
49
+ }
50
+ /** Read or long-poll a handle. Pending responses do not cancel or restart the tool. */
51
+ async getResult(sessionId, invocationId, params = {}) {
52
+ const wait = seconds(params.waitSeconds ?? 0, 0, 30, "waitSeconds");
53
+ return this.request(`${this.path(sessionId)}/invocations/${encodeURIComponent(invocationId)}`, { timeout: Math.max(this.timeout, (wait + 20) * 1000) }, { waitSeconds: params.waitSeconds });
54
+ }
55
+ /** Request cancellation; completion can win the race. Read getResult for the outcome. */
56
+ async cancel(sessionId, invocationId) {
57
+ return this.request(`${this.path(sessionId)}/invocations/${encodeURIComponent(invocationId)}/cancel`, { method: "POST", timeout: Math.max(this.timeout, 20000) });
58
+ }
59
+ }
60
+ exports.WebMCPService = WebMCPService;
@@ -29,7 +29,7 @@ export type HyperAgentLlm = "gpt-5.6-luna" | "gpt-5.5" | "gpt-5.2" | "gpt-5.1" |
29
29
  export type GeminiComputerUseLlm = "gemini-3.8-flash" | "gemini-3.7-flash" | "gemini-3.6-flash" | "gemini-3.5-flash" | "gemini-3.5-flash-lite" | "gemini-3-flash-preview" | "gemini-2.5-computer-use-preview-10-2025";
30
30
  export type GrokComputerUseLlm = "grok-4.7" | "grok-4.6" | "grok-4.5";
31
31
  export type GrokReasoningEffort = "low" | "medium" | "high";
32
- export type MetaComputerUseLlm = "muse-spark-1.1" | "muse-spark-1.2" | "muse-spark-1.3";
32
+ export type MetaComputerUseLlm = "muse-spark-1.1" | "muse-spark-1.2" | "muse-spark-1.3" | "muse-wonder-1.0";
33
33
  export type MetaReasoningEffort = "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
34
34
  export type JevComputerUseLlm = "jev-1.13.0" | "jev-latest";
35
35
  export type JevTextLlm = "gemini-3.5-flash-lite";
@@ -1,4 +1,5 @@
1
1
  export { HyperbrowserConfig } from "./config";
2
+ export * from "./webmcp";
2
3
  export { StartCrawlJobParams, StartCrawlJobResponse, CrawledPage, CrawlJobResponse, GetCrawlJobParams, CrawlJobStatusResponse, } from "./crawl";
3
4
  export { StartScrapeJobParams, StartScrapeJobResponse, ScrapeJobData, ScrapeJobResponse, ScrapeOptions, ScrapeJobStatusResponse, BatchScrapeJobStatusResponse, StorageStateOptions, } from "./scrape";
4
5
  export { StartExtractJobParams, StartExtractJobResponse, ExtractJobResponse, ExtractJobStatusResponse, ExtractJobMetadata, } from "./extract";
@@ -11,8 +12,9 @@ export { StartGrokComputerUseTaskParams, StartGrokComputerUseTaskResponse, GrokC
11
12
  export { StartMetaComputerUseTaskParams, StartMetaComputerUseTaskResponse, MetaComputerUseTaskStatusResponse, MetaComputerUseTaskResponse, MetaComputerUseTaskData, MetaComputerUseStepResponse, MetaComputerUseStepError, MetaComputerUseStepIncompleteDetails, MetaComputerUseStepReasoning, MetaComputerUseApiKeys, MetaComputerUseTaskMetadata, } from "./agents/meta-computer-use";
12
13
  export { StartJevComputerUseTaskParams, StartJevComputerUseTaskResponse, JevComputerUseTaskStatusResponse, JevComputerUseTaskResponse, JevComputerUseTaskData, JevComputerUseStepResponse, JevComputerUseApiKeys, JevComputerUseTaskMetadata, } from "./agents/jev-computer-use";
13
14
  export { BasicResponse, BrowserMemorySize, SessionStatus, Session, SessionDetail, SessionGetParams, SessionListParams, SessionListResponse, ScreenConfig, CaptchaEvaluationPageResult, CaptchaEvaluationParams, CaptchaEvaluationResponse, CaptchaEvaluationTarget, CaptchaEvaluationType, CaptchaSolverType, CreateSessionParams, CreateSessionSnapshotResponse, GetSessionDownloadsUrlResponse, GetSessionVideoRecordingUrlResponse, GetSessionRecordingUrlResponse, ImageCaptchaParam, UploadFileResponse, UploadFileOptions, GetActiveSessionsCountResponse, SessionEventLogListParams, SessionEventLogListResponse, SessionEventLog, SessionProfile, SessionLaunchState, SessionCreditBreakdown, StartSessionFromSnapshotParams, UpdateSessionProfileParams, UpdateSessionProxyLocationParams, UpdateSessionProxyParams, UpdateSessionScreenParams, UpdateSessionSolveCaptchasParams, UpdateSessionSolveCaptchasResponse, } from "./session";
14
- export { SandboxStatus, SandboxRuntimeTarget, SandboxNetworkPolicy, SandboxNetworkPolicyPatch, SandboxNetworkUpdateResult, Sandbox, SandboxDetail, SandboxVolumeMountType, SandboxVolumeMount, SandboxListParams, SandboxListResponse, SandboxImageSource, SandboxImageSummary, SandboxImageListParams, SandboxImageListResponse, SandboxSnapshotStatus, SandboxSnapshotSummary, SandboxSnapshotListParams, SandboxSnapshotListResponse, SandboxSnapshotDeleteResult, SandboxImageDeleteResult, SandboxImageInit, SandboxImageBuildStatus, SandboxImageBuildInputFormat, SandboxImageBuildSourcePlatform, SandboxImageBuildUpload, SandboxImageBuild, SandboxBuildContextBundle, SandboxBuildContextMode, SandboxBuildContextManifest, SandboxDockerImageConfig, SandboxDockerImageLayer, SandboxDockerImageManifest, CreateSandboxImageBuildParams, ReuseSandboxDockerImageParams, CompleteSandboxImageBuildParams, SandboxImageBuildCreateResult, SandboxDockerImageReuseResult, SandboxImageBuildResolutionOutcome, SandboxImageBuildResolution, SandboxImageBuildWaitOptions, BuildSandboxImageFromDockerImageOptions, BuildSandboxImageFromDockerfileOptions, GetOrBuildSandboxImageOptions, SandboxImageBuildListParams, SandboxImageBuildListResponse, CreateSandboxParams, SandboxMemorySnapshotParams, SandboxMemorySnapshotResult, SandboxExposeParams, SandboxExposeResult, SandboxUnexposeResult, SandboxProcessStatus, SandboxExecParams, SandboxExecOptions, SandboxProcessSummary, SandboxProcessResult, SandboxProcessListParams, SandboxProcessListResponse, SandboxProcessWaitParams, SandboxProcessSignal, SandboxProcessStdinParams, SandboxProcessOutputEvent, SandboxProcessExitEvent, SandboxProcessStreamEvent, SandboxFileType, SandboxFileInfo, SandboxFileWriteInfo, SandboxFileListOptions, SandboxFileReadFormat, SandboxFileReadOptions, SandboxFileWriteData, SandboxFileWriteEntry, SandboxFileTextWriteOptions, SandboxFileBytesWriteOptions, SandboxFileMakeDirOptions, SandboxFileCopyParams, SandboxFileChmodParams, SandboxFileChownParams, SandboxFileTransferResult, SandboxFileSystemEventType, SandboxFileSystemEvent, SandboxWatchDirOptions, SandboxPresignFileParams, SandboxPresignedUrl, SandboxTerminalCreateParams, SandboxTerminalOutputChunk, SandboxTerminalStatus, SandboxTerminalWaitParams, SandboxTerminalKillParams, SandboxTerminalEvent, } from "./sandbox";
15
+ export { SandboxStatus, SandboxRuntimeTarget, SandboxNetworkPolicy, SandboxNetworkPolicyPatch, SandboxNetworkUpdateResult, Sandbox, SandboxDetail, SandboxVolumeMountType, SandboxVolumeMount, SandboxSecretReference, SandboxSecrets, SandboxResolvedSecret, SandboxListParams, SandboxListResponse, SandboxImageSource, SandboxImageSummary, SandboxImageListParams, SandboxImageListResponse, SandboxSnapshotStatus, SandboxSnapshotSummary, SandboxSnapshotListParams, SandboxSnapshotListResponse, SandboxSnapshotDeleteResult, SandboxImageDeleteResult, SandboxImageInit, SandboxImageBuildStatus, SandboxImageBuildInputFormat, SandboxImageBuildSourcePlatform, SandboxImageBuildUpload, SandboxImageBuild, SandboxBuildContextBundle, SandboxBuildContextMode, SandboxBuildContextManifest, SandboxDockerImageConfig, SandboxDockerImageLayer, SandboxDockerImageManifest, CreateSandboxImageBuildParams, ReuseSandboxDockerImageParams, CompleteSandboxImageBuildParams, SandboxImageBuildCreateResult, SandboxDockerImageReuseResult, SandboxImageBuildResolutionOutcome, SandboxImageBuildResolution, SandboxImageBuildWaitOptions, BuildSandboxImageFromDockerImageOptions, BuildSandboxImageFromDockerfileOptions, GetOrBuildSandboxImageOptions, SandboxImageBuildListParams, SandboxImageBuildListResponse, CreateSandboxParams, SandboxMemorySnapshotParams, SandboxMemorySnapshotResult, SandboxExposeParams, SandboxExposeResult, SandboxUnexposeResult, SandboxProcessStatus, SandboxExecParams, SandboxExecOptions, SandboxProcessSummary, SandboxProcessResult, SandboxProcessListParams, SandboxProcessListResponse, SandboxProcessWaitParams, SandboxProcessSignal, SandboxProcessStdinParams, SandboxProcessOutputEvent, SandboxProcessExitEvent, SandboxProcessStreamEvent, SandboxFileType, SandboxFileInfo, SandboxFileWriteInfo, SandboxFileListOptions, SandboxFileReadFormat, SandboxFileReadOptions, SandboxFileWriteData, SandboxFileWriteEntry, SandboxFileTextWriteOptions, SandboxFileBytesWriteOptions, SandboxFileMakeDirOptions, SandboxFileCopyParams, SandboxFileChmodParams, SandboxFileChownParams, SandboxFileTransferResult, SandboxFileSystemEventType, SandboxFileSystemEvent, SandboxWatchDirOptions, SandboxPresignFileParams, SandboxPresignedUrl, SandboxTerminalCreateParams, SandboxTerminalOutputChunk, SandboxTerminalStatus, SandboxTerminalWaitParams, SandboxTerminalKillParams, SandboxTerminalEvent, } from "./sandbox";
15
16
  export { CreateVolumeParams, Volume, VolumeListParams, VolumeListResponse, VolumeDeleteResult, } from "./volume";
17
+ export { SecretValue, SecretsPublicKey, SecretsPublicKeyJwk, Secret, SecretVersion, SecretDetail, CreateSecretParams, UpdateSecretParams, SecretListParams, SecretListResponse, SecretDeleteResult, SecretVersionDeleteResult, } from "./secret";
16
18
  export { CreateProfileParams, ForkProfileParams, ProfileResponse, CreateProfileResponse, ProfileListParams, ProfileListResponse, } from "./profile";
17
19
  export { CreateExtensionParams, CreateExtensionResponse, ListExtensionsResponse, } from "./extension";
18
20
  export { ExtractJobStatus, BrowserUseTaskStatus, BrowserUseLlm, ClaudeComputerUseLlm, ClaudeComputerUseReasoningEffort, CuaLlm, CuaReasoningEffort, GeminiComputerUseLlm, GrokComputerUseLlm, GrokReasoningEffort, MetaComputerUseLlm, MetaReasoningEffort, JevComputerUseLlm, JevTextLlm, ScrapeScreenshotFormat, ScrapeJobStatus, CrawlJobStatus, Country, State, ISO639_1, OperatingSystem, Platform, ScrapeFormat, ScrapeWaitUntil, ScrapePageStatus, CrawlPageStatus, RecordingStatus, DownloadsStatus, HyperAgentLlm, HyperAgentTaskStatus, ClaudeComputerUseTaskStatus, CuaTaskStatus, GeminiComputerUseTaskStatus, GrokComputerUseTaskStatus, MetaComputerUseTaskStatus, JevComputerUseTaskStatus, SessionEventLogType, SessionRegion, BrowserUseVersion, HyperAgentVersion, } from "./constants";
@@ -1,5 +1,20 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
17
  exports.ComputerAction = void 0;
18
+ __exportStar(require("./webmcp"), exports);
4
19
  var computer_action_1 = require("./computer-action");
5
20
  Object.defineProperty(exports, "ComputerAction", { enumerable: true, get: function () { return computer_action_1.ComputerAction; } });
@@ -59,12 +59,34 @@ export interface Sandbox {
59
59
  network?: SandboxNetworkPolicy | null;
60
60
  runtime: SandboxRuntimeTarget;
61
61
  exposedPorts: SandboxExposeResult[];
62
+ /**
63
+ * Secrets were delivered into the sandbox, or it was restored from a
64
+ * snapshot that may hold them.
65
+ */
66
+ containsSecrets?: boolean;
62
67
  }
63
68
  export interface SandboxDetail extends Sandbox {
64
69
  token: string | null;
65
70
  tokenExpiresAt: string | null;
66
71
  }
67
72
  export type SandboxVolumeMountType = "rw" | "ro";
73
+ /**
74
+ * A stored secret to deliver as an environment variable: its name, or
75
+ * `{ name, version }` to pin a version. The latest version is used otherwise.
76
+ */
77
+ export type SandboxSecretReference = string | {
78
+ name: string;
79
+ version?: number | "latest";
80
+ };
81
+ /** Environment variable name to secret, at most 32 per process or sandbox. */
82
+ export type SandboxSecrets = Record<string, SandboxSecretReference>;
83
+ /** The secret version an environment variable received. */
84
+ export interface SandboxResolvedSecret {
85
+ env: string;
86
+ name: string;
87
+ secretId: string;
88
+ version: number;
89
+ }
68
90
  export interface SandboxVolumeMount {
69
91
  id: string;
70
92
  type?: SandboxVolumeMountType;
@@ -89,6 +111,7 @@ export type CreateSandboxParams = (SandboxCreateCommonParams & {
89
111
  cpu?: never;
90
112
  memoryMiB?: never;
91
113
  diskMiB?: never;
114
+ secrets?: never;
92
115
  }) | (SandboxCreateCommonParams & {
93
116
  snapshotName?: never;
94
117
  snapshotId?: never;
@@ -97,6 +120,12 @@ export type CreateSandboxParams = (SandboxCreateCommonParams & {
97
120
  cpu?: number;
98
121
  memoryMiB?: number;
99
122
  diskMiB?: number;
123
+ /**
124
+ * Secrets for the image's startup command only; requires the API key's
125
+ * `secrets.use` scope and is not supported with `runtimeClass:
126
+ * "gvisor-cpu"`. The sandbox is marked as containing secrets.
127
+ */
128
+ secrets?: SandboxSecrets;
100
129
  });
101
130
  export interface SandboxListParams {
102
131
  status?: SandboxStatus;
@@ -157,6 +186,8 @@ export interface SandboxSnapshotSummary {
157
186
  compatibilityTag?: string | null;
158
187
  metadata: Record<string, unknown>;
159
188
  uploaded: boolean;
189
+ /** The snapshot's memory may hold secrets. */
190
+ containsSecrets?: boolean;
160
191
  createdAt: string;
161
192
  updatedAt: string;
162
193
  }
@@ -409,6 +440,17 @@ export interface SandboxExecParams {
409
440
  timeoutMs?: number;
410
441
  timeoutSec?: number;
411
442
  runAs?: string;
443
+ /**
444
+ * Stored secrets to deliver as environment variables of this process only.
445
+ * The process is started through the control API, which has the sandbox
446
+ * service decrypt them; requires the API key's `secrets.use` scope. Anything
447
+ * running as the same user (or root) in the sandbox can read the process's
448
+ * environment, and the sandbox is marked as containing secrets.
449
+ *
450
+ * Output is read back from the process's retained output rather than the
451
+ * start stream, so `maxOutputBytes` does not apply.
452
+ */
453
+ secrets?: SandboxSecrets;
412
454
  /** @deprecated Ignored for process APIs. */
413
455
  useShell?: boolean;
414
456
  }
@@ -0,0 +1,67 @@
1
+ /** A secret value: a UTF-8 string or its raw bytes, used byte-for-byte. */
2
+ export type SecretValue = string | Uint8Array;
3
+ export interface SecretsPublicKeyJwk {
4
+ kty: string;
5
+ n: string;
6
+ e: string;
7
+ }
8
+ /** The platform key that secret values are encrypted to before upload. */
9
+ export interface SecretsPublicKey {
10
+ kid: string;
11
+ alg: string;
12
+ enc: string;
13
+ jwk: SecretsPublicKeyJwk;
14
+ }
15
+ export interface Secret {
16
+ id: string;
17
+ name: string;
18
+ description: string;
19
+ /** Bound into every envelope for this secret; the SDK uses it when encrypting. */
20
+ encryptionContext: string;
21
+ /** Null until a value is stored. */
22
+ latestVersion: number | null;
23
+ createdAt: string;
24
+ updatedAt: string;
25
+ }
26
+ export interface SecretVersion {
27
+ version: number;
28
+ kid: string;
29
+ createdAt: string;
30
+ }
31
+ export interface SecretDetail extends Secret {
32
+ versions: SecretVersion[];
33
+ }
34
+ export interface CreateSecretParams {
35
+ /** 1-128 letters, digits, '_' or '-', starting with a letter or digit. */
36
+ name: string;
37
+ description?: string;
38
+ /**
39
+ * The first version's value. It is validated and the platform key is checked
40
+ * before the secret is created, then encrypted locally and uploaded.
41
+ */
42
+ value?: SecretValue;
43
+ }
44
+ export interface UpdateSecretParams {
45
+ description: string;
46
+ }
47
+ export interface SecretListParams {
48
+ search?: string;
49
+ page?: number;
50
+ /** At most 100. */
51
+ limit?: number;
52
+ }
53
+ export interface SecretListResponse {
54
+ secrets: Secret[];
55
+ totalCount: number;
56
+ page: number;
57
+ perPage: number;
58
+ }
59
+ export interface SecretDeleteResult {
60
+ deleted: boolean;
61
+ id: string;
62
+ name: string;
63
+ }
64
+ export interface SecretVersionDeleteResult {
65
+ deleted: boolean;
66
+ version: number;
67
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -10,6 +10,7 @@ export interface SessionProfile {
10
10
  persistChanges?: boolean;
11
11
  }
12
12
  export interface SessionLaunchState {
13
+ enableWebMcp?: boolean;
13
14
  useUltraStealth?: boolean;
14
15
  useStealth?: boolean;
15
16
  useProxy?: boolean;
@@ -128,6 +129,8 @@ export interface StartSessionFromSnapshotParams {
128
129
  snapshotId: string;
129
130
  }
130
131
  export interface CreateSessionParams {
132
+ /** Enable page-provided WebMCP tools. Defaults to false on the server. */
133
+ enableWebMcp?: boolean;
131
134
  useUltraStealth?: boolean;
132
135
  useStealth?: boolean;
133
136
  useProxy?: boolean;
@@ -0,0 +1,84 @@
1
+ /** Page-provided hints; these are not browser-enforced guarantees. */
2
+ export interface WebMCPAnnotations {
3
+ readOnly: boolean;
4
+ untrustedContent: boolean;
5
+ consequential: boolean;
6
+ autosubmit: boolean;
7
+ destructive?: boolean;
8
+ idempotent?: boolean;
9
+ openWorld?: boolean;
10
+ }
11
+ export interface WebMCPFrame {
12
+ id: string;
13
+ url: string;
14
+ isMainFrame: boolean;
15
+ }
16
+ export interface WebMCPSource {
17
+ provider: "native" | "polyfill";
18
+ tabId: string;
19
+ pageUrl: string;
20
+ pageTitle: string;
21
+ frame: WebMCPFrame;
22
+ }
23
+ export interface WebMCPTool {
24
+ /** Opaque reference to this document. Discover tools again after navigation. */
25
+ toolRef: string;
26
+ name: string;
27
+ title?: string;
28
+ description: string;
29
+ inputSchema?: Record<string, unknown>;
30
+ outputSchema?: Record<string, unknown>;
31
+ annotations: WebMCPAnnotations;
32
+ declarative: boolean;
33
+ /** Native DOM node identifier, when available, in the source target/frame. */
34
+ backendNodeId?: number;
35
+ source: WebMCPSource;
36
+ }
37
+ export interface WebMCPToolsResponse {
38
+ tools: WebMCPTool[];
39
+ nativeSupported: boolean;
40
+ truncated: boolean;
41
+ }
42
+ export interface WebMCPInvokeParams {
43
+ toolRef: string;
44
+ /** Page-defined keys are passed through unchanged. Defaults to {}. */
45
+ input?: Record<string, unknown>;
46
+ /** Execution deadline in seconds: 1–120, default 60. */
47
+ timeoutSeconds?: number;
48
+ }
49
+ export interface WebMCPStartParams extends WebMCPInvokeParams {
50
+ /** Execution deadline including human submission: 1–3600 seconds, default 300. */
51
+ timeoutSeconds?: number;
52
+ }
53
+ export interface WebMCPResultParams {
54
+ /** Wait 0–30 seconds, default 0. A pending response does not cancel the tool. */
55
+ waitSeconds?: number;
56
+ }
57
+ export type WebMCPInvokeStatus = "completed" | "error" | "canceled" | "awaiting_submission";
58
+ export type WebMCPInvocationStatus = WebMCPInvokeStatus | "running" | "outcome_unknown";
59
+ export interface WebMCPInvokeResult {
60
+ invocationId?: string;
61
+ status: WebMCPInvokeStatus;
62
+ output?: unknown;
63
+ errorText?: string;
64
+ outputBytes: number;
65
+ outputTruncated?: boolean;
66
+ outputPreview?: string;
67
+ untrustedContent: boolean;
68
+ durationMs: number;
69
+ }
70
+ export interface WebMCPInvocationError {
71
+ code: string;
72
+ message: string;
73
+ }
74
+ /** Session-local record; results expire and do not survive receiver restarts. */
75
+ export interface WebMCPInvocation {
76
+ invocationId: string;
77
+ toolRef: string;
78
+ status: WebMCPInvocationStatus;
79
+ cancellationRequested: boolean;
80
+ createdAt: string;
81
+ expiresAt?: string;
82
+ result?: WebMCPInvokeResult;
83
+ error?: WebMCPInvocationError;
84
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperbrowser/sdk",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "description": "Node SDK for Hyperbrowser API",
5
5
  "author": "",
6
6
  "repository": {