@boxline/sdk 1.2.0 → 2.0.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/CHANGELOG.md +75 -0
- package/README.md +49 -12
- package/dist/client.d.ts +44 -19
- package/dist/client.js +58 -15
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +65 -2
- package/dist/errors.js +69 -3
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/session.d.ts +23 -6
- package/dist/session.js +37 -10
- package/dist/session.js.map +1 -1
- package/dist/types.d.ts +147 -34
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The API's objects, as in docs/openapi.yaml (and docs/CONTRACT.md). Dates are ISO 8601 strings.
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
/** RUNNING; STOPPED (saved, no machine, free: resume it); DELETED (ended for good); ERROR (never started). */
|
|
5
|
+
export type SessionStatus = "RUNNING" | "STOPPED" | "DELETED" | "ERROR";
|
|
5
6
|
/** What happens when a CAPTCHA waits for a person: "ask" (default) pauses and hands over, "ignore" carries on, "solve" tries to solve it first. */
|
|
6
7
|
export type CaptchaMode = "ask" | "ignore" | "solve";
|
|
7
8
|
/** A CAPTCHA provider the platform recognises. */
|
|
@@ -42,7 +43,7 @@ export interface LoginResponse {
|
|
|
42
43
|
project: Project;
|
|
43
44
|
}
|
|
44
45
|
/** What a plan may use; set per plan in the admin panel. Calls that need a missing one fail with 402 `feature_not_in_plan`. */
|
|
45
|
-
export type PlanFeature = "shell" | "
|
|
46
|
+
export type PlanFeature = "shell" | "profiles" | "recording" | "realisticBrowser" | "residentialProxy" | "datacenterProxy" | "customProxy" | "captchaSolving" | "agentRuns" | "steps" | "extract" | "quickApis" | "crawl" | "extensions" | "webSearch" | "loginDetails"
|
|
46
47
|
/** Model calls on Boxline's keys; without it (Free) a project runs models on its own keys only. */
|
|
47
48
|
| "platformModels";
|
|
48
49
|
/** A plan's limits (null = no limit) and features. */
|
|
@@ -255,14 +256,20 @@ export interface SessionData {
|
|
|
255
256
|
keepAlive: boolean;
|
|
256
257
|
/** Seconds. */
|
|
257
258
|
timeout: number;
|
|
258
|
-
/** Seconds without activity after which the session
|
|
259
|
+
/** Seconds without activity after which the session stops (stopReason "idle"); null: off. */
|
|
259
260
|
idleTimeout?: number | null;
|
|
260
261
|
createdAt: string;
|
|
261
262
|
startedAt: string | null;
|
|
262
|
-
endedAt: string | null;
|
|
263
263
|
expiresAt: string;
|
|
264
|
-
|
|
265
|
-
|
|
264
|
+
/** When it stopped (null while it runs; a resume clears it). */
|
|
265
|
+
stoppedAt: string | null;
|
|
266
|
+
stopReason: SessionStopReason | null;
|
|
267
|
+
/** When a stopped session is deleted automatically: `stoppedAt` plus the plan's `retentionDays`, fixed when it stops. */
|
|
268
|
+
deletesAt: string | null;
|
|
269
|
+
/** When it was deleted, and by whom: `requested` (sessions.delete) or `retention` (its `deletesAt` passed). */
|
|
270
|
+
deletedAt: string | null;
|
|
271
|
+
deleteReason: SessionDeleteReason | null;
|
|
272
|
+
/** CDP WebSocket for Playwright/Puppeteer (null without a browser or unless the session is running). Treat it like a password. */
|
|
266
273
|
connectUrl: string | null;
|
|
267
274
|
/** The live view page. Treat it like a password. */
|
|
268
275
|
liveUrl: string | null;
|
|
@@ -281,7 +288,7 @@ export interface SessionData {
|
|
|
281
288
|
attention: CaptchaAttention | null;
|
|
282
289
|
workspacePath: string;
|
|
283
290
|
profileId: string | null;
|
|
284
|
-
/** Whether the session saves its sign-ins back to `profileId` when it
|
|
291
|
+
/** Whether the session saves its sign-ins back to `profileId` when it stops. */
|
|
285
292
|
profilePersist?: boolean;
|
|
286
293
|
userMetadata: Record<string, unknown>;
|
|
287
294
|
moves: number;
|
|
@@ -292,8 +299,6 @@ export interface SessionData {
|
|
|
292
299
|
error: string | null;
|
|
293
300
|
recordSession: boolean;
|
|
294
301
|
hasRecording: boolean;
|
|
295
|
-
/** When the recording, logs and agent-run steps were deleted under the plan's `retentionDays` (null until then). */
|
|
296
|
-
dataDeletedAt?: string | null;
|
|
297
302
|
setup: string[];
|
|
298
303
|
setupStatus: "none" | "running" | "done" | "failed";
|
|
299
304
|
setupError: string | null;
|
|
@@ -315,11 +320,21 @@ export interface SessionData {
|
|
|
315
320
|
};
|
|
316
321
|
}
|
|
317
322
|
/**
|
|
318
|
-
* Why a session
|
|
319
|
-
* keepAlive whose last client left, with no agent run, script or step working in it;
|
|
320
|
-
*
|
|
323
|
+
* Why a session stopped. "requested": sessions.stop; "idle": its idleTimeout passed without activity; "no_clients": a
|
|
324
|
+
* browser-only session without keepAlive whose last client left, with no agent run, script or step working in it;
|
|
325
|
+
* "agent_run" / "task": the session an agent run (a task's run) started, stopped when the run ended (or when its continue
|
|
326
|
+
* window passed unused); "machine_lost": its machine failed and could not be replaced (its last checkpoint is what it saved);
|
|
327
|
+
* "suspended": an admin suspended the organization.
|
|
321
328
|
*/
|
|
322
|
-
export type
|
|
329
|
+
export type SessionStopReason = "requested" | "timeout" | "idle" | "no_clients" | "agent_run" | "task" | "api_restart" | "machine_lost" | "account_recovered"
|
|
330
|
+
/** The organization was suspended: its running sessions stopped. */
|
|
331
|
+
| "suspended"
|
|
332
|
+
/** The organization or the project reached its monthly spending limit. */
|
|
333
|
+
| "spend_limit"
|
|
334
|
+
/** The organization had no credit left (only where the platform enforces credit). */
|
|
335
|
+
| "out_of_credit" | (string & {});
|
|
336
|
+
/** Why a session was deleted: `requested` (sessions.delete) or `retention` (its `deletesAt` passed). */
|
|
337
|
+
export type SessionDeleteReason = "requested" | "retention";
|
|
323
338
|
/** "reject" (the default for new sessions): answer consent banners with "Reject all" or "Necessary only" (never accept), else hide them. */
|
|
324
339
|
export type CookieBanners = "reject" | "off";
|
|
325
340
|
export interface CreateSessionParams {
|
|
@@ -330,7 +345,7 @@ export interface CreateSessionParams {
|
|
|
330
345
|
/** Seconds (default 300), up to the plan's maxTimeoutSeconds. */
|
|
331
346
|
timeout?: number;
|
|
332
347
|
/**
|
|
333
|
-
* Opt-in: the session
|
|
348
|
+
* Opt-in: the session stops (stopReason "idle") after this many seconds without activity, 30 to `timeout`. Activity:
|
|
334
349
|
* CDP commands, live-view input, terminal keys, exec, files, actions and steps, scripts, agent steps and messages;
|
|
335
350
|
* an agent run working in it (or one that can still be continued) counts the whole time. Protects keepAlive and
|
|
336
351
|
* shell sessions whose client crashed.
|
|
@@ -401,7 +416,7 @@ export interface UpdateSessionParams {
|
|
|
401
416
|
cookieBanners?: CookieBanners;
|
|
402
417
|
}
|
|
403
418
|
export interface SessionListParams {
|
|
404
|
-
/** One status or several, e.g. ["RUNNING", "
|
|
419
|
+
/** One status or several, e.g. ["RUNNING", "STOPPED"]. */
|
|
405
420
|
status?: SessionStatus | SessionStatus[];
|
|
406
421
|
/** "browser" (no shell), "combined" (browser and shell) or "shell" (no browser). */
|
|
407
422
|
kind?: "browser" | "combined" | "shell";
|
|
@@ -633,6 +648,16 @@ export type Action = {
|
|
|
633
648
|
provider?: AgentProvider;
|
|
634
649
|
model?: string;
|
|
635
650
|
targetId?: string;
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* Signs the browser in with a password credential (default: the one the session's profile links) in one call, see
|
|
654
|
+
* Session.login. It runs alone: the only action of its request.
|
|
655
|
+
*/
|
|
656
|
+
| {
|
|
657
|
+
action: "login";
|
|
658
|
+
credential?: string;
|
|
659
|
+
url?: string;
|
|
660
|
+
allowWithExtensions?: boolean;
|
|
636
661
|
};
|
|
637
662
|
/** An action, or a plain-English step written as a bare string ("click Sign in"). */
|
|
638
663
|
export type ActionItem = Action | string;
|
|
@@ -644,10 +669,18 @@ export interface ActionResult {
|
|
|
644
669
|
/** One line saying what happened ("Dragged from (180, 200) to (400, 200) in 10 steps"); never typed text. */
|
|
645
670
|
text?: string;
|
|
646
671
|
error?: string;
|
|
647
|
-
/** A stable error code when there is one (e.g. "captcha_timeout", "out_of_viewport"). */
|
|
672
|
+
/** A stable error code when there is one (e.g. "captcha_timeout", "out_of_viewport"; for `login`: "credential_login_failed", "credential_login_timeout", "credential_code_timeout", "credential_link_wrong_site"). */
|
|
648
673
|
code?: string;
|
|
674
|
+
/** `login`: the agent run that signed in (also in its value when it worked). */
|
|
675
|
+
runId?: string;
|
|
649
676
|
ms: number;
|
|
650
677
|
}
|
|
678
|
+
/** What `Session.login` returns: the page the browser is on after signing in (no query or fragment) and the run that did it. */
|
|
679
|
+
export interface LoginValue {
|
|
680
|
+
url: string;
|
|
681
|
+
title: string;
|
|
682
|
+
runId: string;
|
|
683
|
+
}
|
|
651
684
|
export interface GotoResult {
|
|
652
685
|
url: string;
|
|
653
686
|
title: string;
|
|
@@ -1268,7 +1301,7 @@ export interface AgentRunStarted {
|
|
|
1268
1301
|
* its session ended another way (`error` names how); "output_invalid": the answer did not match the output schema;
|
|
1269
1302
|
* "internal": an error on the platform's side. Other codes are those of the platform error that stopped it.
|
|
1270
1303
|
*/
|
|
1271
|
-
export type AgentRunErrorCode = "spend_limit" | "max_steps" | "max_cost" | "too_many_errors" | "no_progress" | "server_restarted" | "session_timeout" | "session_ended" | "output_invalid" | "internal" | "spend_limit" | "captcha_timeout" | "handover_timeout" | (string & {});
|
|
1304
|
+
export type AgentRunErrorCode = "spend_limit" | "max_steps" | "max_cost" | "too_many_errors" | "no_progress" | "server_restarted" | "session_timeout" | "session_ended" | "output_invalid" | "internal" | "spend_limit" | "out_of_credit" | "captcha_timeout" | "handover_timeout" | (string & {});
|
|
1272
1305
|
/** The body of agent.continueRun. */
|
|
1273
1306
|
export interface ContinueRunParams {
|
|
1274
1307
|
/** 1–1000, or null for no step limit (default: the run's own). */
|
|
@@ -1293,7 +1326,8 @@ export interface AgentMessageSent {
|
|
|
1293
1326
|
}
|
|
1294
1327
|
export interface AgentStep {
|
|
1295
1328
|
/** message: a message you sent (agent.sendMessage), recorded when the model received it. */
|
|
1296
|
-
|
|
1329
|
+
/** code: the run waits for a password's 2FA code or sign-in link (`credentials.pushCode`, or your `codeUrl`), see `state`. */
|
|
1330
|
+
type: "text" | "tool" | "handover" | "handback" | "captcha" | "message" | "code";
|
|
1297
1331
|
at: string;
|
|
1298
1332
|
/** message steps: who wrote it, its id, when it was sent (`at` is when the model got it). */
|
|
1299
1333
|
from?: "user";
|
|
@@ -1311,9 +1345,14 @@ export interface AgentStep {
|
|
|
1311
1345
|
output?: string;
|
|
1312
1346
|
isError?: boolean;
|
|
1313
1347
|
ms?: number;
|
|
1314
|
-
/**
|
|
1315
|
-
|
|
1316
|
-
|
|
1348
|
+
/**
|
|
1349
|
+
* captcha steps: "solving" (automatic solving), "waiting" (a person's turn), "solved" (the run goes on); code steps:
|
|
1350
|
+
* "waiting" (a wait began: push the code or link now), then "received" or "timeout". Never the code or the link.
|
|
1351
|
+
*/
|
|
1352
|
+
state?: "solving" | "waiting" | "solved" | "received" | "timeout";
|
|
1353
|
+
/** code steps: the password credential whose code or link the run waits for. */
|
|
1354
|
+
credential?: string;
|
|
1355
|
+
/** captcha steps: the CAPTCHA kind and the host of its page; code steps: "code" or "link". */
|
|
1317
1356
|
kind?: string;
|
|
1318
1357
|
host?: string;
|
|
1319
1358
|
/** captcha "waiting": why a person is asked. */
|
|
@@ -1691,9 +1730,9 @@ export interface Pricing {
|
|
|
1691
1730
|
gib: number;
|
|
1692
1731
|
perHour: number;
|
|
1693
1732
|
};
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1733
|
+
/** A stopped session is free: `perHour` is 0. */
|
|
1734
|
+
stoppedSessions: {
|
|
1735
|
+
perHour: number;
|
|
1697
1736
|
};
|
|
1698
1737
|
proxies: {
|
|
1699
1738
|
residentialPerGb: number;
|
|
@@ -1718,7 +1757,7 @@ export interface Pricing {
|
|
|
1718
1757
|
* The events an endpoint can subscribe to (`webhook.test` needs no subscription). New types may be added: an endpoint
|
|
1719
1758
|
* subscribed to "*" gets them too, so a receiver should ignore types it does not know.
|
|
1720
1759
|
*/
|
|
1721
|
-
export type WebhookEventType = "session.started" | "session.expiring" | "session.
|
|
1760
|
+
export type WebhookEventType = "session.started" | "session.expiring" | "session.stopped" | "session.deleted" | "agent_run.started" | "agent_run.waiting" | "agent_run.resumed" | "agent_run.finished" | "captcha.waiting" | "captcha.solved" | "captcha.failed" | "crawl.finished" | "task_run.started" | "task_run.finished" | "task.schedule_paused" | "usage.limit_reached" | "api_key.created" | "api_key.revoked" | "credential.code_needed" | "credential.changed" | "webhook.changed" | "webhook.disabled" | "extension.uploaded" | "extension.deleted";
|
|
1722
1761
|
/** What an endpoint subscribes to: event types, or "*" for all of them (those added later too). */
|
|
1723
1762
|
export type WebhookSubscription = WebhookEventType | "*";
|
|
1724
1763
|
/** One entry of bx.webhooks.eventTypes(): a type, its group (for pickers) and what it says. */
|
|
@@ -1827,7 +1866,7 @@ export interface WebhookEvent<T = Record<string, unknown>> {
|
|
|
1827
1866
|
}
|
|
1828
1867
|
/** Who made a change: "user:<email>" (a console login), "key:<api key id>", "support" (support acting as you) or "platform". */
|
|
1829
1868
|
export type WebhookActor = string;
|
|
1830
|
-
/** session.started and session.
|
|
1869
|
+
/** session.started, session.stopped and session.deleted: the session as sessions.get returns it, with every URL (and attention) null. */
|
|
1831
1870
|
export type WebhookSessionData = Omit<SessionData, "setup" | "setupError"> & {
|
|
1832
1871
|
userMetadataTruncated?: true;
|
|
1833
1872
|
};
|
|
@@ -1981,8 +2020,12 @@ export interface WebhookSchedulePausedData {
|
|
|
1981
2020
|
pausedAt: string;
|
|
1982
2021
|
}
|
|
1983
2022
|
export interface WebhookUsageLimitData {
|
|
1984
|
-
|
|
1985
|
-
|
|
2023
|
+
/**
|
|
2024
|
+
* The plan's limits, or the organization's money: its monthly spending limit (`spend_limit`), the project's own
|
|
2025
|
+
* (`project_spend_limit`), or its credit used up (`credit`).
|
|
2026
|
+
*/
|
|
2027
|
+
kind: "model_spend" | "proxy_gb" | "captcha_solves" | "searches" | "concurrency" | "spend_limit" | "project_spend_limit" | "credit";
|
|
2028
|
+
/** The limit: USD (model spend, spending limits; for `credit` the credit used this month), GB, a count, or sessions at once. */
|
|
1986
2029
|
limit: number;
|
|
1987
2030
|
used: number;
|
|
1988
2031
|
/** "2026-09" (a UTC month), or "2026-09-30T14" (a UTC hour) for concurrency. */
|
|
@@ -1997,6 +2040,15 @@ export interface WebhookApiKeyData {
|
|
|
1997
2040
|
name: string;
|
|
1998
2041
|
by: WebhookActor;
|
|
1999
2042
|
}
|
|
2043
|
+
export interface WebhookCredentialCodeNeededData {
|
|
2044
|
+
/** The password credential whose code or sign-in link is awaited. */
|
|
2045
|
+
credential: string;
|
|
2046
|
+
/** What the site sends: a 2FA code or a sign-in link. Forward it now with `credentials.pushCode`. */
|
|
2047
|
+
type: "code" | "link";
|
|
2048
|
+
sessionId: string;
|
|
2049
|
+
/** The agent run that waits; null for an action or `boxline-otp`. */
|
|
2050
|
+
runId: string | null;
|
|
2051
|
+
}
|
|
2000
2052
|
export interface WebhookCredentialChangedData {
|
|
2001
2053
|
/** The credential's name. */
|
|
2002
2054
|
name: string;
|
|
@@ -2033,7 +2085,8 @@ export interface WebhookExtensionData {
|
|
|
2033
2085
|
export interface WebhookEventDataMap {
|
|
2034
2086
|
"session.started": WebhookSessionData;
|
|
2035
2087
|
"session.expiring": WebhookSessionExpiringData;
|
|
2036
|
-
"session.
|
|
2088
|
+
"session.stopped": WebhookSessionData;
|
|
2089
|
+
"session.deleted": WebhookSessionData;
|
|
2037
2090
|
"agent_run.started": WebhookAgentRunStartedData;
|
|
2038
2091
|
"agent_run.waiting": WebhookAgentRunWaitingData;
|
|
2039
2092
|
"agent_run.resumed": WebhookAgentRunResumedData;
|
|
@@ -2050,6 +2103,7 @@ export interface WebhookEventDataMap {
|
|
|
2050
2103
|
"usage.limit_reached": WebhookUsageLimitData;
|
|
2051
2104
|
"api_key.created": WebhookApiKeyData;
|
|
2052
2105
|
"api_key.revoked": WebhookApiKeyData;
|
|
2106
|
+
"credential.code_needed": WebhookCredentialCodeNeededData;
|
|
2053
2107
|
"credential.changed": WebhookCredentialChangedData;
|
|
2054
2108
|
"webhook.changed": WebhookChangedData;
|
|
2055
2109
|
"webhook.disabled": WebhookDisabledData;
|
|
@@ -2073,8 +2127,17 @@ export type CredentialType = "password" | "secret";
|
|
|
2073
2127
|
* scripts' step() and the type action; "shell": only as environment variables in session shells and commands; "all": both.
|
|
2074
2128
|
*/
|
|
2075
2129
|
export type CredentialScope = "agent" | "shell" | "all";
|
|
2076
|
-
/**
|
|
2130
|
+
/**
|
|
2131
|
+
* What `Session.typeCredential` types from a password credential: its user name, its password or its current 2FA code
|
|
2132
|
+
* (with a `codeSource` of "push" or "url" it waits for a fresh one, up to `codeTimeoutSeconds`).
|
|
2133
|
+
*/
|
|
2077
2134
|
export type CredentialField = "username" | "password" | "otp";
|
|
2135
|
+
/**
|
|
2136
|
+
* Where a password's 2FA codes come from: "totp" (an authenticator key, `totpSecret`), "push" (your system sends each
|
|
2137
|
+
* code or sign-in link the site emails or texts: `credentials.pushCode`) or "url" (the platform asks your endpoint
|
|
2138
|
+
* `codeUrl`, signed like a webhook). A password without one has no 2FA (`codeSource: null`).
|
|
2139
|
+
*/
|
|
2140
|
+
export type CredentialCodeSource = "totp" | "push" | "url";
|
|
2078
2141
|
interface CredentialBase {
|
|
2079
2142
|
/** Also its placeholder (`%NAME%`, `%NAME.password%`) and its shell variable (`$NAME`, `$NAME_PASSWORD`). */
|
|
2080
2143
|
name: string;
|
|
@@ -2092,8 +2155,14 @@ export interface PasswordCredential extends CredentialBase {
|
|
|
2092
2155
|
/** The sites where the AI may type it (1 to 20). */
|
|
2093
2156
|
origins: string[];
|
|
2094
2157
|
username: string;
|
|
2095
|
-
/** It has a 2FA key: `%NAME.otp%` and `boxline-otp NAME` give the current code. */
|
|
2158
|
+
/** It has a 2FA key (`codeSource` is "totp"): `%NAME.otp%` and `boxline-otp NAME` give the current code. */
|
|
2096
2159
|
hasTotp: boolean;
|
|
2160
|
+
/** Where its 2FA codes come from; null: no 2FA. */
|
|
2161
|
+
codeSource: CredentialCodeSource | null;
|
|
2162
|
+
/** The endpoint the platform asks for codes (`codeSource` "url"); null otherwise. Its signing secret is never shown again. */
|
|
2163
|
+
codeUrl: string | null;
|
|
2164
|
+
/** How long a wait for a pushed or asked code or link lasts (5 to 900 s, default 300). */
|
|
2165
|
+
codeTimeoutSeconds: number;
|
|
2097
2166
|
}
|
|
2098
2167
|
/** A secret (an API key, a token). Its value is never returned. */
|
|
2099
2168
|
export interface SecretCredential extends CredentialBase {
|
|
@@ -2105,6 +2174,14 @@ export interface SecretCredential extends CredentialBase {
|
|
|
2105
2174
|
}
|
|
2106
2175
|
/** A credential without its values: `switch (c.type)` tells the two apart. */
|
|
2107
2176
|
export type Credential = PasswordCredential | SecretCredential;
|
|
2177
|
+
/**
|
|
2178
|
+
* A credential as `credentials.create` and `credentials.update` return it: when `codeUrl` was set or changed it also
|
|
2179
|
+
* has `codeUrlSecret` (`whsec_…`), the key that signs the platform's requests to `codeUrl`, shown this once (a new one
|
|
2180
|
+
* any time with `credentials.rotateCodeUrlSecret`).
|
|
2181
|
+
*/
|
|
2182
|
+
export type CredentialWritten<C extends Credential = Credential> = C & {
|
|
2183
|
+
codeUrlSecret?: string;
|
|
2184
|
+
};
|
|
2108
2185
|
interface CredentialCreateBase {
|
|
2109
2186
|
/**
|
|
2110
2187
|
* An environment variable name in capitals, [A-Z_][A-Z0-9_]*, at most 64 characters; not one the platform or bash
|
|
@@ -2127,11 +2204,23 @@ export interface PasswordCredentialCreateParams extends CredentialCreateBase {
|
|
|
2127
2204
|
username: string;
|
|
2128
2205
|
/** 1 to 1024 characters. Sealed when stored and never returned. */
|
|
2129
2206
|
password: string;
|
|
2207
|
+
/**
|
|
2208
|
+
* Where its 2FA codes come from: "totp" (with `totpSecret`; `totpSecret` alone means "totp"), "push" (send each code
|
|
2209
|
+
* or link with `credentials.pushCode`), "url" (with `codeUrl`), or left out / null for no 2FA.
|
|
2210
|
+
*/
|
|
2211
|
+
codeSource?: CredentialCodeSource | null;
|
|
2130
2212
|
/**
|
|
2131
2213
|
* The site's 2FA setup key (base32, any case, spaces allowed) or an otpauth://totp/ link from its QR code (SHA1,
|
|
2132
|
-
* SHA256 or SHA512, 6 to 8 digits, a 15 to 120 s period; defaults SHA-1, 6 digits, 30 s).
|
|
2214
|
+
* SHA256 or SHA512, 6 to 8 digits, a 15 to 120 s period; defaults SHA-1, 6 digits, 30 s). Only with "totp".
|
|
2133
2215
|
*/
|
|
2134
2216
|
totpSecret?: string;
|
|
2217
|
+
/**
|
|
2218
|
+
* `codeSource` "url" (required then): a public HTTPS endpoint (never a private or internal address) the platform
|
|
2219
|
+
* asks with a signed POST every 5 s while a run waits for a code; the answer has `codeUrlSecret` once.
|
|
2220
|
+
*/
|
|
2221
|
+
codeUrl?: string;
|
|
2222
|
+
/** How long a "push" or "url" wait lasts: 5 to 900 seconds, default 300. */
|
|
2223
|
+
codeTimeoutSeconds?: number;
|
|
2135
2224
|
}
|
|
2136
2225
|
/** A secret: one value. */
|
|
2137
2226
|
export interface SecretCredentialCreateParams extends CredentialCreateBase {
|
|
@@ -2145,14 +2234,20 @@ export type CredentialCreateParams = PasswordCredentialCreateParams | SecretCred
|
|
|
2145
2234
|
/**
|
|
2146
2235
|
* Changes to a password; what is not sent is kept. A change of `origins` that adds a site, or of `scope`/`shell` that
|
|
2147
2236
|
* makes an AI-only password readable by shells, needs `password` again in the same call (and `totpSecret`, a new one or
|
|
2148
|
-
* null, when it has 2FA)
|
|
2237
|
+
* null, when it has 2FA); so does a change of `codeSource` (removing 2FA included) or `codeUrl`.
|
|
2149
2238
|
*/
|
|
2150
2239
|
export interface PasswordCredentialUpdateParams {
|
|
2151
2240
|
origins?: string[];
|
|
2152
2241
|
username?: string;
|
|
2153
2242
|
password?: string;
|
|
2243
|
+
/** Where the codes come from; null removes 2FA. Needs `password` again. */
|
|
2244
|
+
codeSource?: CredentialCodeSource | null;
|
|
2154
2245
|
/** A new 2FA setup key or otpauth://totp/ link; null removes 2FA. */
|
|
2155
2246
|
totpSecret?: string | null;
|
|
2247
|
+
/** The endpoint asked for codes ("url"). Needs `password` again; the answer has a new `codeUrlSecret`. */
|
|
2248
|
+
codeUrl?: string;
|
|
2249
|
+
/** 5 to 900 seconds. */
|
|
2250
|
+
codeTimeoutSeconds?: number;
|
|
2156
2251
|
/** null clears it. */
|
|
2157
2252
|
description?: string | null;
|
|
2158
2253
|
shell?: boolean;
|
|
@@ -2172,6 +2267,9 @@ export interface SecretCredentialUpdateParams {
|
|
|
2172
2267
|
scope?: CredentialScope;
|
|
2173
2268
|
username?: never;
|
|
2174
2269
|
password?: never;
|
|
2270
|
+
codeSource?: never;
|
|
2271
|
+
codeUrl?: never;
|
|
2272
|
+
codeTimeoutSeconds?: never;
|
|
2175
2273
|
totpSecret?: never;
|
|
2176
2274
|
}
|
|
2177
2275
|
/** What credentials.update takes: the fields of a password or of a secret (the type cannot change). Changes apply to new uses. */
|
|
@@ -2182,7 +2280,8 @@ export type CredentialUpdateParams = PasswordCredentialUpdateParams | SecretCred
|
|
|
2182
2280
|
*/
|
|
2183
2281
|
export interface CredentialAuditEntry {
|
|
2184
2282
|
at: string;
|
|
2185
|
-
|
|
2283
|
+
/** "code": a pushed 2FA code or sign-in link (`details.kind`), never its value. */
|
|
2284
|
+
action: "create" | "update" | "delete" | "use" | "code";
|
|
2186
2285
|
type: CredentialType;
|
|
2187
2286
|
name: string;
|
|
2188
2287
|
/** Who changed it: "user:<email>", "key:<api key id>", or "support" (Boxline support acting as a user). */
|
|
@@ -2198,6 +2297,20 @@ export interface CredentialAuditParams extends ListParams {
|
|
|
2198
2297
|
/** One credential. */
|
|
2199
2298
|
name?: string;
|
|
2200
2299
|
}
|
|
2300
|
+
/** What `credentials.pushCode` sends: a 2FA code (1 to 64 characters, no spaces) or a sign-in link on one of the credential's sites. */
|
|
2301
|
+
export type CredentialCodePush = {
|
|
2302
|
+
code: string;
|
|
2303
|
+
link?: never;
|
|
2304
|
+
} | {
|
|
2305
|
+
link: string;
|
|
2306
|
+
code?: never;
|
|
2307
|
+
};
|
|
2308
|
+
/** What `credentials.pushCode` returns: the code or link is kept for a wait in progress (used once, at most 10 minutes). */
|
|
2309
|
+
export interface CredentialCodeAccepted {
|
|
2310
|
+
accepted: true;
|
|
2311
|
+
kind: "code" | "link";
|
|
2312
|
+
expiresAt: string;
|
|
2313
|
+
}
|
|
2201
2314
|
/** An uploaded Chrome extension (Manifest V3). */
|
|
2202
2315
|
export interface ExtensionInfo {
|
|
2203
2316
|
id: string;
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** The SDK's version, sent to the API as `Boxline-SDK: node/<version>`. Keep it equal to package.json. */
|
|
2
|
-
export declare const VERSION = "
|
|
2
|
+
export declare const VERSION = "2.0.0";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED