@hyperbrowser/sdk 1.2.2 → 1.4.0
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/README.md +427 -3
- package/dist/client.d.ts +2 -0
- package/dist/client.js +2 -0
- package/dist/error.d.ts +2 -0
- package/dist/error.js +4 -1
- package/dist/sandbox/process.d.ts +7 -3
- package/dist/sandbox/process.js +15 -3
- package/dist/sandbox/secret-references.d.ts +4 -0
- package/dist/sandbox/secret-references.js +11 -2
- package/dist/secret-values.d.ts +14 -0
- package/dist/secret-values.js +153 -0
- package/dist/secrets-envelope.d.ts +5 -0
- package/dist/secrets-envelope.js +17 -7
- package/dist/services/credentials.d.ts +24 -0
- package/dist/services/credentials.js +48 -0
- package/dist/services/sandboxes.d.ts +3 -2
- package/dist/services/sandboxes.js +20 -10
- package/dist/services/secrets.d.ts +19 -4
- package/dist/services/secrets.js +53 -17
- package/dist/services/sessions.d.ts +2 -0
- package/dist/services/sessions.js +2 -0
- package/dist/services/vaults.d.ts +26 -0
- package/dist/services/vaults.js +80 -0
- package/dist/tools/anthropic.d.ts +1 -0
- package/dist/tools/anthropic.js +6 -1
- package/dist/tools/gemini.d.ts +56 -0
- package/dist/tools/gemini.js +40 -0
- package/dist/tools/index.d.ts +92 -0
- package/dist/tools/index.js +81 -1
- package/dist/tools/openai.d.ts +1 -0
- package/dist/tools/openai.js +10 -1
- package/dist/tools/schema.d.ts +49 -0
- package/dist/tools/schema.js +53 -4
- package/dist/types/constants.d.ts +26 -4
- package/dist/types/credential.d.ts +120 -0
- package/dist/types/credential.js +2 -0
- package/dist/types/index.d.ts +4 -2
- package/dist/types/sandbox.d.ts +89 -2
- package/dist/types/secret.d.ts +61 -3
- package/dist/types/session.d.ts +14 -0
- package/dist/types/vault.d.ts +55 -0
- package/dist/types/vault.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/** A secret attached to a browser session, which fill may type into its pages. */
|
|
2
|
+
export interface SessionCredential {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* What to attach to a browser session at creation: a secret by name (or
|
|
8
|
+
* `{ secret }`), `{ vault }` for the secrets a vault's entries name, or
|
|
9
|
+
* `{ onePassword }` for an `op_token` secret that fills may read 1Password
|
|
10
|
+
* fields with.
|
|
11
|
+
*/
|
|
12
|
+
export type SessionCredentialSource = string | {
|
|
13
|
+
secret: string;
|
|
14
|
+
} | {
|
|
15
|
+
vault: string;
|
|
16
|
+
} | {
|
|
17
|
+
onePassword: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* A field of an item in the fill's 1Password vault. Names and IDs are 1-256
|
|
21
|
+
* characters without '/' or '?', and not "." or "..". The field may end
|
|
22
|
+
* with a query such as `?attribute=otp`.
|
|
23
|
+
*/
|
|
24
|
+
export interface CredentialFillRef {
|
|
25
|
+
/** The item's name or ID. */
|
|
26
|
+
item: string;
|
|
27
|
+
/** The section's name or ID, when the field is in one. */
|
|
28
|
+
section?: string;
|
|
29
|
+
/** The field's name or ID, optionally with a query such as `?attribute=otp`. */
|
|
30
|
+
field: string;
|
|
31
|
+
}
|
|
32
|
+
/** Which input to fill and, with a vault or 1Password, from which entry or field. */
|
|
33
|
+
export interface CredentialFillField {
|
|
34
|
+
/** A CSS selector for the input, 1-1024 UTF-8 bytes. Each selector at most once. */
|
|
35
|
+
selector: string;
|
|
36
|
+
/**
|
|
37
|
+
* The vault entry (its environment variable name, such as `PASSWORD`) to
|
|
38
|
+
* type. Required with `vault`, not allowed otherwise.
|
|
39
|
+
*/
|
|
40
|
+
field?: string;
|
|
41
|
+
/** The 1Password field to type. Required with `onePassword`, not allowed otherwise. */
|
|
42
|
+
ref?: CredentialFillRef;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Fill 1Password fields, read with an `op_token` secret attached to the
|
|
46
|
+
* session. Nothing on the platform says where a 1Password value belongs, so
|
|
47
|
+
* the request names the origins it may be typed on.
|
|
48
|
+
*/
|
|
49
|
+
export interface CredentialFillOnePassword {
|
|
50
|
+
/** The `op_token` secret attached to the session, by name; its latest version is used. */
|
|
51
|
+
token: string;
|
|
52
|
+
/** The 1Password vault's name or ID. */
|
|
53
|
+
vault: string;
|
|
54
|
+
/**
|
|
55
|
+
* Origins the values may be filled into, 1-20, with the same rules as a
|
|
56
|
+
* secret's: `scheme://host[:port]`, https (http only for localhost), and a
|
|
57
|
+
* leading `*.` matching subdomains of a registrable domain.
|
|
58
|
+
*/
|
|
59
|
+
allowedOrigins: string[];
|
|
60
|
+
}
|
|
61
|
+
export interface FillCredentialParams {
|
|
62
|
+
/** A secret attached to the session, by name or ID. Pass one of this, `vault` or `onePassword`. */
|
|
63
|
+
credential?: string;
|
|
64
|
+
/** A vault attached to the session, by name. Pass one of this, `credential` or `onePassword`. */
|
|
65
|
+
vault?: string;
|
|
66
|
+
/**
|
|
67
|
+
* 1Password fields, each named by its field's `ref`. Pass one of this,
|
|
68
|
+
* `credential` or `vault`.
|
|
69
|
+
*/
|
|
70
|
+
onePassword?: CredentialFillOnePassword;
|
|
71
|
+
/** 1-16 inputs. */
|
|
72
|
+
fields: CredentialFillField[];
|
|
73
|
+
/**
|
|
74
|
+
* The tab to fill (a CDP target ID). Needed when several tabs could be the
|
|
75
|
+
* target; see `CREDENTIAL_PAGE_AMBIGUOUS`. Not with `pageUrl`.
|
|
76
|
+
*/
|
|
77
|
+
pageId?: string;
|
|
78
|
+
/** Fill the tab whose URL starts with this. Not with `pageId`. */
|
|
79
|
+
pageUrl?: string;
|
|
80
|
+
/** Fill inside the iframe whose URL starts with this. */
|
|
81
|
+
frameUrl?: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* - `filled`: the input holds the value (for a TOTP secret, the current code).
|
|
85
|
+
* - `not_found`: no input matched the selector.
|
|
86
|
+
* - `ambiguous`: several visible inputs matched.
|
|
87
|
+
* - `not_editable`: disabled, read-only, hidden or not a text input.
|
|
88
|
+
* - `not_accepted`: the page didn't keep the value (for example `maxlength`).
|
|
89
|
+
*
|
|
90
|
+
* Outcomes added later come through as other strings.
|
|
91
|
+
*/
|
|
92
|
+
export type CredentialFillOutcome = "filled" | "not_found" | "ambiguous" | "not_editable" | "not_accepted" | (string & {});
|
|
93
|
+
export interface CredentialFillFieldResult {
|
|
94
|
+
selector: string;
|
|
95
|
+
outcome: CredentialFillOutcome;
|
|
96
|
+
/** The secret typed into this input; for 1Password, the `op_token` secret read with. */
|
|
97
|
+
secretId: string;
|
|
98
|
+
/** Its version. */
|
|
99
|
+
version: number;
|
|
100
|
+
/** The vault entry, for vault fills. */
|
|
101
|
+
field?: string;
|
|
102
|
+
/** The `op://vault/item/[section/]field` reference read, for 1Password fills. */
|
|
103
|
+
reference?: string;
|
|
104
|
+
/** For a TOTP secret, when the code that was typed stops being valid. */
|
|
105
|
+
expiresAt?: string;
|
|
106
|
+
}
|
|
107
|
+
/** Outcomes per input; never values. */
|
|
108
|
+
export interface CredentialFillResult {
|
|
109
|
+
/** The secret version filled, for a single-secret fill. Absent for vault and 1Password fills. */
|
|
110
|
+
version?: number;
|
|
111
|
+
pageId: string;
|
|
112
|
+
origin: string;
|
|
113
|
+
fields: CredentialFillFieldResult[];
|
|
114
|
+
}
|
|
115
|
+
/** One candidate tab in a `CREDENTIAL_PAGE_AMBIGUOUS` error's `details.pages`. */
|
|
116
|
+
export interface CredentialFillPage {
|
|
117
|
+
pageId: string;
|
|
118
|
+
url: string;
|
|
119
|
+
title: string;
|
|
120
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -12,9 +12,11 @@ export { StartGrokComputerUseTaskParams, StartGrokComputerUseTaskResponse, GrokC
|
|
|
12
12
|
export { StartMetaComputerUseTaskParams, StartMetaComputerUseTaskResponse, MetaComputerUseTaskStatusResponse, MetaComputerUseTaskResponse, MetaComputerUseTaskData, MetaComputerUseStepResponse, MetaComputerUseStepError, MetaComputerUseStepIncompleteDetails, MetaComputerUseStepReasoning, MetaComputerUseApiKeys, MetaComputerUseTaskMetadata, } from "./agents/meta-computer-use";
|
|
13
13
|
export { StartJevComputerUseTaskParams, StartJevComputerUseTaskResponse, JevComputerUseTaskStatusResponse, JevComputerUseTaskResponse, JevComputerUseTaskData, JevComputerUseStepResponse, JevComputerUseApiKeys, JevComputerUseTaskMetadata, } from "./agents/jev-computer-use";
|
|
14
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, SessionWebBotAuth, SessionCreditBreakdown, StartSessionFromSnapshotParams, WebBotAuthParams, ProxyRoute, UpdateSessionProfileParams, UpdateSessionProxyLocationParams, UpdateSessionProxyParams, UpdateSessionScreenParams, UpdateSessionSolveCaptchasParams, UpdateSessionSolveCaptchasResponse, } from "./session";
|
|
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
|
+
export { SandboxStatus, SandboxRuntimeTarget, SandboxNetworkPolicy, SandboxNetworkPolicyPatch, SandboxNetworkUpdateResult, Sandbox, SandboxDetail, SandboxVolumeMountType, SandboxVolumeMount, SandboxSecretReference, SandboxSecrets, SandboxResolvedSecret, SandboxStoredSecretBinding, SandboxOnePasswordBinding, SandboxSecretSource, SandboxOnePassword, SandboxOnePasswordField, 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";
|
|
16
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";
|
|
17
|
+
export { SecretValue, SecretType, SecretBrowserMetadata, SecretMetadata, UpdateSecretMetadata, SecretsPublicKey, SecretsPublicKeyJwk, Secret, SecretVersion, SecretDetail, CreateSecretParams, UpdateSecretParams, SecretListParams, SecretListResponse, SecretDeleteResult, SecretVersionDeleteResult, } from "./secret";
|
|
18
|
+
export { SessionCredential, SessionCredentialSource, CredentialFillField, CredentialFillRef, CredentialFillOnePassword, FillCredentialParams, CredentialFillOutcome, CredentialFillFieldResult, CredentialFillResult, CredentialFillPage, } from "./credential";
|
|
19
|
+
export { Vault, VaultEntry, VaultEntryParams, CreateVaultParams, UpdateVaultParams, VaultListParams, VaultListResponse, VaultDeleteResult, } from "./vault";
|
|
18
20
|
export { CreateProfileParams, ForkProfileParams, ProfileResponse, CreateProfileResponse, ProfileListParams, ProfileListResponse, } from "./profile";
|
|
19
21
|
export { CreateExtensionParams, CreateExtensionResponse, ListExtensionsResponse, } from "./extension";
|
|
20
22
|
export { ExtractJobStatus, BrowserUseTaskStatus, BrowserUseLlm, ClaudeComputerUseLlm, ClaudeComputerUseReasoningEffort, CuaLlm, CuaReasoningEffort, GeminiComputerUseLlm, GeminiComputerUseReasoningEffort, 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";
|
package/dist/types/sandbox.d.ts
CHANGED
|
@@ -68,6 +68,8 @@ export interface Sandbox {
|
|
|
68
68
|
export interface SandboxDetail extends Sandbox {
|
|
69
69
|
token: string | null;
|
|
70
70
|
tokenExpiresAt: string | null;
|
|
71
|
+
/** On create with `secrets`, `vault` or `onePassword`: what the startup command received. */
|
|
72
|
+
startupSecrets?: SandboxResolvedSecret[];
|
|
71
73
|
}
|
|
72
74
|
export type SandboxVolumeMountType = "rw" | "ro";
|
|
73
75
|
/**
|
|
@@ -80,13 +82,75 @@ export type SandboxSecretReference = string | {
|
|
|
80
82
|
};
|
|
81
83
|
/** Environment variable name to secret, at most 32 per process or sandbox. */
|
|
82
84
|
export type SandboxSecrets = Record<string, SandboxSecretReference>;
|
|
83
|
-
/**
|
|
84
|
-
|
|
85
|
+
/**
|
|
86
|
+
* Fields of one 1Password vault to deliver as environment variables, read
|
|
87
|
+
* with a service account token kept as an `op_token` secret when the process
|
|
88
|
+
* starts. Nothing about it is stored.
|
|
89
|
+
*/
|
|
90
|
+
export interface SandboxOnePassword {
|
|
91
|
+
/** The name of the `op_token` secret; its latest version is used. */
|
|
92
|
+
token: string;
|
|
93
|
+
/** The 1Password vault's name or ID. */
|
|
94
|
+
vault: string;
|
|
95
|
+
/**
|
|
96
|
+
* Environment variable name to field, 1-32. A variable set here can't also
|
|
97
|
+
* be set by `vault`, `secrets` or `env`.
|
|
98
|
+
*/
|
|
99
|
+
fields: Record<string, SandboxOnePasswordField>;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* A field of an item in the 1Password vault. Names and IDs are 1-256
|
|
103
|
+
* characters without '/' or '?', and not "." or "..". The field may end
|
|
104
|
+
* with a query such as `?attribute=totp`.
|
|
105
|
+
*/
|
|
106
|
+
export interface SandboxOnePasswordField {
|
|
107
|
+
/** The item's name or ID. */
|
|
108
|
+
item: string;
|
|
109
|
+
/** The section's name or ID, when the field is in one. */
|
|
110
|
+
section?: string;
|
|
111
|
+
/** The field's name or ID, optionally with a query such as `?attribute=otp`. */
|
|
112
|
+
field: string;
|
|
113
|
+
}
|
|
114
|
+
/** Where a delivered variable came from: a vault, `onePassword` or the request's `secrets`. */
|
|
115
|
+
export type SandboxSecretSource = {
|
|
116
|
+
type: "vault";
|
|
117
|
+
name: string;
|
|
118
|
+
} | {
|
|
119
|
+
type: "secrets";
|
|
120
|
+
} | {
|
|
121
|
+
type: "onePassword";
|
|
122
|
+
};
|
|
123
|
+
/** What a variable from a vault or `secrets` received: a stored secret's version. */
|
|
124
|
+
export interface SandboxStoredSecretBinding {
|
|
85
125
|
env: string;
|
|
126
|
+
/** The stored secret's name. */
|
|
86
127
|
name: string;
|
|
87
128
|
secretId: string;
|
|
88
129
|
version: number;
|
|
130
|
+
/** `"totp"` when the variable holds a TOTP secret's code from process start. */
|
|
131
|
+
secretType?: string;
|
|
132
|
+
source: {
|
|
133
|
+
type: "vault";
|
|
134
|
+
name: string;
|
|
135
|
+
} | {
|
|
136
|
+
type: "secrets";
|
|
137
|
+
};
|
|
138
|
+
/** Earlier sources that set the same variable and were overridden, oldest first. */
|
|
139
|
+
overrides?: SandboxSecretSource[];
|
|
140
|
+
}
|
|
141
|
+
/** What a variable from `onePassword` received: the `op://` reference that was read. */
|
|
142
|
+
export interface SandboxOnePasswordBinding {
|
|
143
|
+
env: string;
|
|
144
|
+
/** The 1Password reference, such as `op://Engineering/Postgres/password`. */
|
|
145
|
+
reference: string;
|
|
146
|
+
/** The name of the `op_token` secret that signed in to 1Password. */
|
|
147
|
+
tokenSecret: string;
|
|
148
|
+
source: {
|
|
149
|
+
type: "onePassword";
|
|
150
|
+
};
|
|
89
151
|
}
|
|
152
|
+
/** What an environment variable received. Never a value. */
|
|
153
|
+
export type SandboxResolvedSecret = SandboxStoredSecretBinding | SandboxOnePasswordBinding;
|
|
90
154
|
export interface SandboxVolumeMount {
|
|
91
155
|
id: string;
|
|
92
156
|
type?: SandboxVolumeMountType;
|
|
@@ -112,6 +176,8 @@ export type CreateSandboxParams = (SandboxCreateCommonParams & {
|
|
|
112
176
|
memoryMiB?: never;
|
|
113
177
|
diskMiB?: never;
|
|
114
178
|
secrets?: never;
|
|
179
|
+
vault?: never;
|
|
180
|
+
onePassword?: never;
|
|
115
181
|
}) | (SandboxCreateCommonParams & {
|
|
116
182
|
snapshotName?: never;
|
|
117
183
|
snapshotId?: never;
|
|
@@ -126,6 +192,14 @@ export type CreateSandboxParams = (SandboxCreateCommonParams & {
|
|
|
126
192
|
* "gvisor-cpu"`. The sandbox is marked as containing secrets.
|
|
127
193
|
*/
|
|
128
194
|
secrets?: SandboxSecrets;
|
|
195
|
+
/**
|
|
196
|
+
* A vault, by name, whose entries become the startup command's
|
|
197
|
+
* environment variables; `secrets` is merged over it and wins on a
|
|
198
|
+
* clash. Same requirements as `secrets`.
|
|
199
|
+
*/
|
|
200
|
+
vault?: string;
|
|
201
|
+
/** 1Password fields for the startup command. Same requirements as `secrets`. */
|
|
202
|
+
onePassword?: SandboxOnePassword;
|
|
129
203
|
});
|
|
130
204
|
export interface SandboxListParams {
|
|
131
205
|
status?: SandboxStatus;
|
|
@@ -451,6 +525,19 @@ export interface SandboxExecParams {
|
|
|
451
525
|
* start stream, so `maxOutputBytes` does not apply.
|
|
452
526
|
*/
|
|
453
527
|
secrets?: SandboxSecrets;
|
|
528
|
+
/**
|
|
529
|
+
* A vault, by name, whose entries become environment variables of this
|
|
530
|
+
* process, delivered like `secrets`. `secrets` is merged over it and wins
|
|
531
|
+
* on a clash; `env` can't set a variable either of them sets. Together
|
|
532
|
+
* they hold at most 32 variables.
|
|
533
|
+
*/
|
|
534
|
+
vault?: string;
|
|
535
|
+
/**
|
|
536
|
+
* Fields of a 1Password vault, read with an `op_token` secret when the
|
|
537
|
+
* process starts and delivered like `secrets`. A variable set here can't
|
|
538
|
+
* also be set by `vault`, `secrets` or `env`.
|
|
539
|
+
*/
|
|
540
|
+
onePassword?: SandboxOnePassword;
|
|
454
541
|
/** @deprecated Ignored for process APIs. */
|
|
455
542
|
useShell?: boolean;
|
|
456
543
|
}
|
package/dist/types/secret.d.ts
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
/** A secret value: a UTF-8 string or its raw bytes, used byte-for-byte. */
|
|
2
2
|
export type SecretValue = string | Uint8Array;
|
|
3
|
+
/**
|
|
4
|
+
* What a secret's value is, fixed at creation:
|
|
5
|
+
* - `"secret"`: an opaque value. It can be a sandbox environment variable,
|
|
6
|
+
* and once it has allowed origins it can be filled into browser pages.
|
|
7
|
+
* - `"totp"`: a TOTP seed, as base32 or an `otpauth://totp/` URI. Sandboxes
|
|
8
|
+
* and browser fills get its current one-time code, never the seed.
|
|
9
|
+
* - `"op_token"`: a 1Password service account token, used only as the
|
|
10
|
+
* `token` of a sandbox's or a browser fill's `onePassword` fields. It is
|
|
11
|
+
* never an environment variable or filled into a page itself.
|
|
12
|
+
*/
|
|
13
|
+
export type SecretType = "secret" | "totp" | "op_token";
|
|
14
|
+
export interface SecretBrowserMetadata {
|
|
15
|
+
/**
|
|
16
|
+
* Origins the secret may be filled into, as `scheme://host[:port]`. A
|
|
17
|
+
* leading `*.` matches any subdomain (not the domain itself).
|
|
18
|
+
*/
|
|
19
|
+
allowedOrigins: string[];
|
|
20
|
+
}
|
|
21
|
+
/** `{}` until allowed origins are set. */
|
|
22
|
+
export interface SecretMetadata {
|
|
23
|
+
browser?: SecretBrowserMetadata;
|
|
24
|
+
[member: string]: unknown;
|
|
25
|
+
}
|
|
3
26
|
export interface SecretsPublicKeyJwk {
|
|
4
27
|
kty: string;
|
|
5
28
|
n: string;
|
|
@@ -16,6 +39,12 @@ export interface Secret {
|
|
|
16
39
|
id: string;
|
|
17
40
|
name: string;
|
|
18
41
|
description: string;
|
|
42
|
+
/**
|
|
43
|
+
* A `SecretType`. Typed as a string so secrets of types added later are
|
|
44
|
+
* still read.
|
|
45
|
+
*/
|
|
46
|
+
type: string;
|
|
47
|
+
metadata: SecretMetadata;
|
|
19
48
|
/** Bound into every envelope for this secret; the SDK uses it when encrypting. */
|
|
20
49
|
encryptionContext: string;
|
|
21
50
|
/** Null until a value is stored. */
|
|
@@ -35,17 +64,46 @@ export interface CreateSecretParams {
|
|
|
35
64
|
/** 1-128 letters, digits, '_' or '-', starting with a letter or digit. */
|
|
36
65
|
name: string;
|
|
37
66
|
description?: string;
|
|
67
|
+
/** Defaults to `"secret"`. */
|
|
68
|
+
type?: SecretType;
|
|
38
69
|
/**
|
|
39
|
-
* The first version's value. It is
|
|
40
|
-
* before the secret is created
|
|
70
|
+
* The first version's value. It is checked against the type's rules and
|
|
71
|
+
* the platform key is checked before the secret is created; then it is
|
|
72
|
+
* encrypted locally and uploaded.
|
|
73
|
+
*
|
|
74
|
+
* - `"secret"`: any string or bytes.
|
|
75
|
+
* - `"totp"`: a base32 seed (spaces, hyphens, lowercase and trailing `=`
|
|
76
|
+
* padding are fine) or an `otpauth://totp/...?secret=...` URI, optionally
|
|
77
|
+
* with `algorithm` (SHA1, SHA256 or SHA512), `digits` (6 or 8) and
|
|
78
|
+
* `period` (1-300). A seed whose length can't be whole base32 (1, 3 or 6
|
|
79
|
+
* characters past a multiple of 8) is refused as incompletely copied.
|
|
80
|
+
* Seeds under 10 bytes (16 characters) are accepted but unusually short.
|
|
81
|
+
* - `"op_token"`: a 1Password service account token. These start with
|
|
82
|
+
* `ops_`, but other values are not refused.
|
|
41
83
|
*/
|
|
42
84
|
value?: SecretValue;
|
|
85
|
+
/**
|
|
86
|
+
* Origins the secret may be filled into in browser sessions, such as
|
|
87
|
+
* `["https://github.com"]`; 1-20 entries. Not for `"op_token"` secrets.
|
|
88
|
+
*/
|
|
89
|
+
allowedOrigins?: string[];
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Metadata members sent replace the stored ones, `null` removes a member, and
|
|
93
|
+
* members not sent are kept.
|
|
94
|
+
*/
|
|
95
|
+
export interface UpdateSecretMetadata {
|
|
96
|
+
browser?: SecretBrowserMetadata | null;
|
|
43
97
|
}
|
|
98
|
+
/** At least one field. */
|
|
44
99
|
export interface UpdateSecretParams {
|
|
45
|
-
description
|
|
100
|
+
description?: string;
|
|
101
|
+
metadata?: UpdateSecretMetadata;
|
|
46
102
|
}
|
|
47
103
|
export interface SecretListParams {
|
|
48
104
|
search?: string;
|
|
105
|
+
/** Only secrets of this type. */
|
|
106
|
+
type?: SecretType;
|
|
49
107
|
page?: number;
|
|
50
108
|
/** At most 100. */
|
|
51
109
|
limit?: number;
|
package/dist/types/session.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import { Country, DownloadsStatus, ISO639_1, OperatingSystem, Platform, RecordingStatus, SessionEventLogType, SessionRegion, State } from "./constants";
|
|
3
|
+
import { SessionCredential, SessionCredentialSource } from "./credential";
|
|
3
4
|
export type SessionStatus = "active" | "closed" | "close-error" | "error";
|
|
4
5
|
export type BrowserMemorySize = "small" | "medium" | "large";
|
|
5
6
|
export interface BasicResponse {
|
|
@@ -73,6 +74,8 @@ export interface SessionDetail extends Session {
|
|
|
73
74
|
liveUrl?: string;
|
|
74
75
|
liveDomain?: string;
|
|
75
76
|
token: string;
|
|
77
|
+
/** The secrets attached at creation, when any were requested. */
|
|
78
|
+
credentials?: SessionCredential[];
|
|
76
79
|
}
|
|
77
80
|
export interface SessionGetParams {
|
|
78
81
|
liveViewTtlSeconds?: number;
|
|
@@ -225,6 +228,17 @@ export interface CreateSessionParams {
|
|
|
225
228
|
disablePostQuantumKeyAgreement?: boolean;
|
|
226
229
|
browserMemorySize?: BrowserMemorySize;
|
|
227
230
|
startFromSnapshot?: StartSessionFromSnapshotParams;
|
|
231
|
+
/**
|
|
232
|
+
* Secrets that `sessions.credentials.fill` may type into pages, at most 20:
|
|
233
|
+
* a secret's name (or `{ secret: name }`), `{ vault: name }` for the
|
|
234
|
+
* secrets a vault's entries name when the session is created, or
|
|
235
|
+
* `{ onePassword: name }` for an `op_token` secret whose 1Password fields
|
|
236
|
+
* fills may read.
|
|
237
|
+
* Secrets need allowed origins to be filled. They can only be attached at
|
|
238
|
+
* creation; the session runs on Firecracker with Chrome's password manager
|
|
239
|
+
* off.
|
|
240
|
+
*/
|
|
241
|
+
credentials?: SessionCredentialSource[];
|
|
228
242
|
}
|
|
229
243
|
export interface CreateSessionSnapshotResponse {
|
|
230
244
|
snapshotName: string;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/** An entry of a vault: a stored secret. */
|
|
2
|
+
export interface VaultEntry {
|
|
3
|
+
/** The secret's name. */
|
|
4
|
+
name: string;
|
|
5
|
+
secretId: string;
|
|
6
|
+
/** A pinned version, or null to follow the secret's latest version. */
|
|
7
|
+
version: number | null;
|
|
8
|
+
}
|
|
9
|
+
/** Named environment variables whose values come from stored secrets. A vault holds no values itself. */
|
|
10
|
+
export interface Vault {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
description: string;
|
|
14
|
+
/** Environment variable name to entry. */
|
|
15
|
+
entries: Record<string, VaultEntry>;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
updatedAt: string;
|
|
18
|
+
}
|
|
19
|
+
/** A stored secret, following its latest version unless one is pinned. */
|
|
20
|
+
export interface VaultEntryParams {
|
|
21
|
+
/** The secret's name. */
|
|
22
|
+
name: string;
|
|
23
|
+
version?: number | "latest";
|
|
24
|
+
}
|
|
25
|
+
export interface CreateVaultParams {
|
|
26
|
+
/** 1-128 letters, digits, '_' or '-', starting with a letter or digit. */
|
|
27
|
+
name: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
/** Environment variable name to secret, at most 32. */
|
|
30
|
+
entries?: Record<string, VaultEntryParams>;
|
|
31
|
+
}
|
|
32
|
+
/** At least one field. */
|
|
33
|
+
export interface UpdateVaultParams {
|
|
34
|
+
description?: string;
|
|
35
|
+
/** Each entry given replaces that variable; `null` removes it. Others are kept. */
|
|
36
|
+
entries?: Record<string, VaultEntryParams | null>;
|
|
37
|
+
}
|
|
38
|
+
export interface VaultListParams {
|
|
39
|
+
/** Vaults whose name contains this. */
|
|
40
|
+
search?: string;
|
|
41
|
+
page?: number;
|
|
42
|
+
/** At most 100. */
|
|
43
|
+
limit?: number;
|
|
44
|
+
}
|
|
45
|
+
export interface VaultListResponse {
|
|
46
|
+
vaults: Vault[];
|
|
47
|
+
totalCount: number;
|
|
48
|
+
page: number;
|
|
49
|
+
perPage: number;
|
|
50
|
+
}
|
|
51
|
+
export interface VaultDeleteResult {
|
|
52
|
+
deleted: boolean;
|
|
53
|
+
id: string;
|
|
54
|
+
name: string;
|
|
55
|
+
}
|