@boxline/sdk 1.1.0 → 1.2.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 +56 -1
- package/README.md +57 -34
- package/dist/client.d.ts +46 -45
- package/dist/client.js +46 -60
- package/dist/client.js.map +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/errors.d.ts +17 -16
- package/dist/errors.js +24 -23
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/session.d.ts +16 -3
- package/dist/session.js +19 -3
- package/dist/session.js.map +1 -1
- package/dist/types.d.ts +196 -126
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ export interface LoginResponse {
|
|
|
42
42
|
project: Project;
|
|
43
43
|
}
|
|
44
44
|
/** 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" | "pauseResume" | "
|
|
45
|
+
export type PlanFeature = "shell" | "pauseResume" | "profiles" | "recording" | "realisticBrowser" | "residentialProxy" | "datacenterProxy" | "customProxy" | "captchaSolving" | "agentRuns" | "steps" | "extract" | "quickApis" | "crawl" | "extensions" | "webSearch" | "loginDetails"
|
|
46
46
|
/** Model calls on Boxline's keys; without it (Free) a project runs models on its own keys only. */
|
|
47
47
|
| "platformModels";
|
|
48
48
|
/** A plan's limits (null = no limit) and features. */
|
|
@@ -69,12 +69,12 @@ export interface Plan {
|
|
|
69
69
|
tasks?: number | null;
|
|
70
70
|
/** Tasks with a schedule switched on; 0 = no schedules, null = no limit. */
|
|
71
71
|
schedules?: number | null;
|
|
72
|
-
/**
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
|
|
76
|
-
/** Bytes a project's
|
|
77
|
-
|
|
72
|
+
/** Credentials (passwords and secrets together) a project may keep. */
|
|
73
|
+
maxCredentials?: number;
|
|
74
|
+
/** Browser profiles a project may keep; null = no limit. */
|
|
75
|
+
maxProfiles?: number | null;
|
|
76
|
+
/** Bytes a project's profiles may hold together; null = no limit. */
|
|
77
|
+
maxProfileBytes?: number | null;
|
|
78
78
|
features: Record<PlanFeature, boolean>;
|
|
79
79
|
public?: boolean;
|
|
80
80
|
}
|
|
@@ -280,9 +280,9 @@ export interface SessionData {
|
|
|
280
280
|
/** A CAPTCHA waiting for a person, or null. */
|
|
281
281
|
attention: CaptchaAttention | null;
|
|
282
282
|
workspacePath: string;
|
|
283
|
-
|
|
284
|
-
/** Whether the session saves its sign-ins back to `
|
|
285
|
-
|
|
283
|
+
profileId: string | null;
|
|
284
|
+
/** Whether the session saves its sign-ins back to `profileId` when it ends. */
|
|
285
|
+
profilePersist?: boolean;
|
|
286
286
|
userMetadata: Record<string, unknown>;
|
|
287
287
|
moves: number;
|
|
288
288
|
/** When the last automatic checkpoint was taken (null before the first one). */
|
|
@@ -307,8 +307,8 @@ export interface SessionData {
|
|
|
307
307
|
extensions: string[];
|
|
308
308
|
/** The names of the session's env variables (values are never returned). */
|
|
309
309
|
env?: string[];
|
|
310
|
-
/** The names of the
|
|
311
|
-
|
|
310
|
+
/** The names of the credentials its shell exports (a credential its profile links is listed too when it went into the shell). */
|
|
311
|
+
credentials?: string[];
|
|
312
312
|
usage: {
|
|
313
313
|
seconds: number;
|
|
314
314
|
costUsd: number;
|
|
@@ -340,8 +340,8 @@ export interface CreateSessionParams {
|
|
|
340
340
|
keepAlive?: boolean;
|
|
341
341
|
viewport?: Viewport;
|
|
342
342
|
userMetadata?: Record<string, unknown>;
|
|
343
|
-
/** Start from a
|
|
344
|
-
|
|
343
|
+
/** Start from a profile; `persist: true` saves the browser's logins back into it at the end. */
|
|
344
|
+
profile?: {
|
|
345
345
|
id: string;
|
|
346
346
|
persist?: boolean;
|
|
347
347
|
};
|
|
@@ -378,11 +378,13 @@ export interface CreateSessionParams {
|
|
|
378
378
|
*/
|
|
379
379
|
env?: Record<string, string | number | boolean>;
|
|
380
380
|
/**
|
|
381
|
-
*
|
|
382
|
-
*
|
|
383
|
-
*
|
|
381
|
+
* Credentials exported into the shell (needs shell: true; the credential needs scope "shell" or "all", or shell:
|
|
382
|
+
* true, else CredentialNotAllowedError): a secret as `$NAME`, a password as `$NAME_USERNAME` and `$NAME_PASSWORD`
|
|
383
|
+
* (its 2FA code comes from `boxline-otp NAME`, the key itself never enters the machine). Kept in the machine's
|
|
384
|
+
* memory only and hidden in exec, script and terminal output. Anything that runs in the shell can read them: export
|
|
385
|
+
* only what you accept that for.
|
|
384
386
|
*/
|
|
385
|
-
|
|
387
|
+
credentials?: string[];
|
|
386
388
|
}
|
|
387
389
|
export interface UpdateSessionParams {
|
|
388
390
|
keepAlive?: boolean;
|
|
@@ -437,13 +439,13 @@ export interface MoveTimings {
|
|
|
437
439
|
}
|
|
438
440
|
/**
|
|
439
441
|
* Sessions with a shell, after a move: where the shell continues and which exported variables came along (the
|
|
440
|
-
* session's env and
|
|
442
|
+
* session's env and credentials are set again as well). Running processes do not move; the ones that were stopped are listed.
|
|
441
443
|
*/
|
|
442
444
|
export interface MoveShell {
|
|
443
445
|
cwd: string;
|
|
444
446
|
/** Names of the variables the commands exported. */
|
|
445
447
|
exported: string[];
|
|
446
|
-
/** `command` with
|
|
448
|
+
/** `command` with credential values hidden, at most 200 characters; `seconds`: how long it had run. */
|
|
447
449
|
stoppedProcesses: {
|
|
448
450
|
pid: number;
|
|
449
451
|
command: string;
|
|
@@ -488,6 +490,18 @@ export type Action = {
|
|
|
488
490
|
text: string;
|
|
489
491
|
selector?: string;
|
|
490
492
|
delayMs?: number;
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Types a credential's value without it passing through you (see Session.typeCredential): `field` is `"username"`,
|
|
496
|
+
* `"password"` or `"otp"` (the current 2FA code) for a password, and left out for a secret. A credential with sites
|
|
497
|
+
* (every password) goes only into the field `selector` names, on one of those sites.
|
|
498
|
+
*/
|
|
499
|
+
| {
|
|
500
|
+
action: "type";
|
|
501
|
+
credential: string;
|
|
502
|
+
field?: CredentialField;
|
|
503
|
+
selector?: string;
|
|
504
|
+
allowWithExtensions?: boolean;
|
|
491
505
|
} | {
|
|
492
506
|
action: "press";
|
|
493
507
|
key: string;
|
|
@@ -599,9 +613,13 @@ export type Action = {
|
|
|
599
613
|
action: "step";
|
|
600
614
|
instruction: string;
|
|
601
615
|
variables?: Record<string, string>;
|
|
602
|
-
/**
|
|
603
|
-
|
|
604
|
-
|
|
616
|
+
/**
|
|
617
|
+
* Credentials usable as placeholders (scope "agent" or "all"): `%NAME%` for a secret, `%NAME.username%`,
|
|
618
|
+
* `%NAME.password%` and `%NAME.otp%` for a password, each on its own sites; never shown in the result. A
|
|
619
|
+
* credential the session's profile links is offered too.
|
|
620
|
+
*/
|
|
621
|
+
credentials?: string[];
|
|
622
|
+
/** Allow `credentials` in a session with Chrome extensions (VariablesWithExtensionsError otherwise). */
|
|
605
623
|
allowWithExtensions?: boolean;
|
|
606
624
|
provider?: AgentProvider;
|
|
607
625
|
model?: string;
|
|
@@ -761,14 +779,15 @@ export interface StepOptions {
|
|
|
761
779
|
/** Text values for %name% placeholders. */
|
|
762
780
|
variables?: Record<string, string>;
|
|
763
781
|
/**
|
|
764
|
-
*
|
|
765
|
-
*
|
|
766
|
-
*
|
|
782
|
+
* Credentials usable as placeholders (scope "agent" or "all"): `%NAME%` for a secret, `%NAME.username%`,
|
|
783
|
+
* `%NAME.password%` and `%NAME.otp%` for a password. Each is typed only on its own sites and, in the shell, only
|
|
784
|
+
* with `shell: true`. The step's result never shows their values. In a session whose profile links a password
|
|
785
|
+
* credential, that credential is offered too.
|
|
767
786
|
*/
|
|
768
|
-
|
|
787
|
+
credentials?: string[];
|
|
769
788
|
/**
|
|
770
|
-
* Allow `
|
|
771
|
-
* (
|
|
789
|
+
* Allow `credentials` in a session with Chrome extensions, which can read every typed value
|
|
790
|
+
* (VariablesWithExtensionsError otherwise). Logs a warning in the session's events.
|
|
772
791
|
*/
|
|
773
792
|
allowWithExtensions?: boolean;
|
|
774
793
|
provider?: AgentProvider;
|
|
@@ -780,8 +799,11 @@ export interface ExecOptions {
|
|
|
780
799
|
cwd?: string;
|
|
781
800
|
/** Variables for this command only (it may set PATH, HOME and the like for itself). */
|
|
782
801
|
env?: Record<string, string>;
|
|
783
|
-
/**
|
|
784
|
-
|
|
802
|
+
/**
|
|
803
|
+
* Credentials as environment variables for this command only (scope "shell" or "all", or shell: true): a secret as
|
|
804
|
+
* `$NAME`, a password as `$NAME_USERNAME` and `$NAME_PASSWORD`, and `boxline-otp NAME` prints its 2FA code. Hidden in the output.
|
|
805
|
+
*/
|
|
806
|
+
credentials?: string[];
|
|
785
807
|
/** Named persistent shell (default "default"); false runs in a fresh process with no kept state. */
|
|
786
808
|
shell?: string | false;
|
|
787
809
|
}
|
|
@@ -816,14 +838,13 @@ export interface RunScriptOptions {
|
|
|
816
838
|
model?: string;
|
|
817
839
|
};
|
|
818
840
|
/**
|
|
819
|
-
*
|
|
820
|
-
* machine: the platform fills them in when the step runs. The grant is for this run only.
|
|
841
|
+
* Credentials the script's step() calls may use as placeholders (scope "agent" or "all"). The values never enter the
|
|
842
|
+
* machine: the platform fills them in when the step runs. The grant is for this run only. A credential the
|
|
843
|
+
* session's profile links is used only when it is listed here.
|
|
821
844
|
*/
|
|
822
|
-
|
|
823
|
-
/** Let step() use the session's saved login details (%login.username%, %login.password%, %login.otp%). */
|
|
824
|
-
login?: boolean;
|
|
845
|
+
credentials?: string[];
|
|
825
846
|
/**
|
|
826
|
-
* Allow `
|
|
847
|
+
* Allow `credentials` in a session with Chrome extensions, which can read every typed value
|
|
827
848
|
* (VariablesWithExtensionsError otherwise); a warning goes into the session's events.
|
|
828
849
|
*/
|
|
829
850
|
allowWithExtensions?: boolean;
|
|
@@ -883,7 +904,7 @@ export interface Recording {
|
|
|
883
904
|
}[];
|
|
884
905
|
durationMs: number;
|
|
885
906
|
}
|
|
886
|
-
export interface
|
|
907
|
+
export interface Profile {
|
|
887
908
|
id: string;
|
|
888
909
|
name: string;
|
|
889
910
|
sizeBytes: number;
|
|
@@ -891,43 +912,22 @@ export interface ContextInfo {
|
|
|
891
912
|
updatedAt: string;
|
|
892
913
|
/** The running session using it. */
|
|
893
914
|
inUseBy: string | null;
|
|
894
|
-
/** Its login details (contexts.setLogin), never the password or the 2FA secret; null without any. */
|
|
895
|
-
login?: ContextLogin | null;
|
|
896
|
-
}
|
|
897
|
-
/** What a saved login shows of its login details. */
|
|
898
|
-
export interface ContextLogin {
|
|
899
|
-
origin: string;
|
|
900
|
-
username: string;
|
|
901
|
-
hasPassword: boolean;
|
|
902
|
-
hasTotp: boolean;
|
|
903
|
-
updatedAt?: string;
|
|
904
|
-
}
|
|
905
|
-
/**
|
|
906
|
-
* A saved login's sign-in details (plan feature `loginDetails`). Agent runs, plain-English steps and scripts' step() in
|
|
907
|
-
* a session started with that context get %login.username%, %login.password% and %login.otp% (a TOTP code made when it
|
|
908
|
-
* is typed), filled in only into fields whose frame is on `origin`, never into shell commands, never shown to the model.
|
|
909
|
-
*/
|
|
910
|
-
export interface LoginDetails {
|
|
911
|
-
/** The one site they may be typed on: "https://example.com" or "https://*.example.com" (any subdomain). */
|
|
912
|
-
origin: string;
|
|
913
|
-
/** At most 320 characters. */
|
|
914
|
-
username: string;
|
|
915
|
-
/** 1 to 1024 characters. */
|
|
916
|
-
password: string;
|
|
917
915
|
/**
|
|
918
|
-
* The
|
|
919
|
-
*
|
|
916
|
+
* The name of the password credential it signs in with (profiles.update with `credential`), or null. Sessions with
|
|
917
|
+
* the profile, and agent runs, task runs and steps in them, get it as if it were listed in their `credentials`.
|
|
920
918
|
*/
|
|
921
|
-
|
|
919
|
+
credential: string | null;
|
|
922
920
|
}
|
|
923
|
-
/**
|
|
924
|
-
export interface
|
|
925
|
-
/**
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
921
|
+
/** profiles.update: any of these (at least one). */
|
|
922
|
+
export interface ProfileUpdateParams {
|
|
923
|
+
/** 1 to 100 characters. */
|
|
924
|
+
name?: string;
|
|
925
|
+
/**
|
|
926
|
+
* Link the password credential this profile signs in with, so the AI can sign in again when its cookies have
|
|
927
|
+
* expired; null unlinks it. NotFoundError (404 `credential_not_found`) for a name the project does not have, 400 for a secret (only
|
|
928
|
+
* passwords sign in), FeatureNotInPlanError (402) without `loginDetails`.
|
|
929
|
+
*/
|
|
930
|
+
credential?: string | null;
|
|
931
931
|
}
|
|
932
932
|
/** Options shared by fetch, screenshot and pdf. */
|
|
933
933
|
export interface RenderOptions {
|
|
@@ -1197,15 +1197,17 @@ export interface AgentRunParams {
|
|
|
1197
1197
|
/** Keep the run's own session after it finishes (until its expiresAt, with keepAlive on). */
|
|
1198
1198
|
keepSession?: boolean;
|
|
1199
1199
|
/**
|
|
1200
|
-
*
|
|
1201
|
-
*
|
|
1200
|
+
* Credentials as placeholders, exactly like `variables`, each with the credential's own `origins` and `shell` rule
|
|
1201
|
+
* (scope "agent" or "all"; CredentialNotAllowedError for scope "shell"): `%NAME%` for a secret, `%NAME.username%`,
|
|
1202
|
+
* `%NAME.password%` and `%NAME.otp%` for a password. An explicit variable with the same name wins. A password
|
|
1203
|
+
* credential linked to the session's profile is added for you.
|
|
1202
1204
|
*/
|
|
1203
|
-
|
|
1205
|
+
credentials?: string[];
|
|
1204
1206
|
/**
|
|
1205
|
-
* For the run's own session: a
|
|
1206
|
-
*
|
|
1207
|
+
* For the run's own session: a profile to start with. When it links a password credential (profiles.update), the
|
|
1208
|
+
* run gets that credential as if it were listed in `credentials`.
|
|
1207
1209
|
*/
|
|
1208
|
-
|
|
1210
|
+
profile?: {
|
|
1209
1211
|
id: string;
|
|
1210
1212
|
persist?: boolean;
|
|
1211
1213
|
};
|
|
@@ -1436,7 +1438,7 @@ export interface TaskVariable {
|
|
|
1436
1438
|
/**
|
|
1437
1439
|
* The settings of each run's own session, as on sessions.create, checked when saved and again at each run. A custom
|
|
1438
1440
|
* proxy's password is stored encrypted and never returned. `allowWithExtensions` is needed for a task with secret
|
|
1439
|
-
* variables and extensions (VariablesWithExtensionsError otherwise).
|
|
1441
|
+
* variables or credentials and extensions (VariablesWithExtensionsError otherwise).
|
|
1440
1442
|
*/
|
|
1441
1443
|
export interface TaskBrowser extends BrowserOptions {
|
|
1442
1444
|
shell?: boolean;
|
|
@@ -1486,8 +1488,8 @@ export interface TaskLastRun {
|
|
|
1486
1488
|
createdAt: string;
|
|
1487
1489
|
finishedAt: string | null;
|
|
1488
1490
|
}
|
|
1489
|
-
/** A
|
|
1490
|
-
export type
|
|
1491
|
+
/** A browser profile each run's session starts with: its id, or `{id, persist}` (persist: keep what the run changes). */
|
|
1492
|
+
export type TaskProfile = string | {
|
|
1491
1493
|
id: string;
|
|
1492
1494
|
persist?: boolean;
|
|
1493
1495
|
};
|
|
@@ -1499,14 +1501,14 @@ export interface TaskCreateParams {
|
|
|
1499
1501
|
/** Up to 50. */
|
|
1500
1502
|
variables?: TaskVariable[];
|
|
1501
1503
|
/**
|
|
1502
|
-
*
|
|
1503
|
-
* "agent" or "all"; a scheduled task may use them (secret variables cannot be scheduled).
|
|
1504
|
+
* Credentials (by name, up to 50) each run gets as placeholders, as `credentials` on agent runs. They must exist with
|
|
1505
|
+
* scope "agent" or "all"; a scheduled task may use them (secret variables cannot be scheduled).
|
|
1504
1506
|
*/
|
|
1505
|
-
|
|
1507
|
+
credentials?: string[];
|
|
1506
1508
|
/** Structured output for every run (see OutputSchema). */
|
|
1507
1509
|
output?: OutputSchema;
|
|
1508
1510
|
browser?: TaskBrowser;
|
|
1509
|
-
|
|
1511
|
+
profile?: TaskProfile;
|
|
1510
1512
|
/** From agent.models() (default: the server's default model). */
|
|
1511
1513
|
model?: {
|
|
1512
1514
|
provider?: AgentProvider;
|
|
@@ -1527,10 +1529,10 @@ export interface TaskUpdateParams {
|
|
|
1527
1529
|
instruction?: string;
|
|
1528
1530
|
variables?: TaskVariable[];
|
|
1529
1531
|
/** The whole new list; null or [] removes them. */
|
|
1530
|
-
|
|
1532
|
+
credentials?: string[] | null;
|
|
1531
1533
|
output?: OutputSchema | null;
|
|
1532
1534
|
browser?: TaskBrowser | null;
|
|
1533
|
-
|
|
1535
|
+
profile?: TaskProfile | null;
|
|
1534
1536
|
model?: {
|
|
1535
1537
|
provider?: AgentProvider;
|
|
1536
1538
|
model?: string;
|
|
@@ -1549,11 +1551,11 @@ export interface Task {
|
|
|
1549
1551
|
name: string;
|
|
1550
1552
|
instruction: string;
|
|
1551
1553
|
variables: TaskVariable[];
|
|
1552
|
-
/** Names of the
|
|
1553
|
-
|
|
1554
|
+
/** Names of the credentials its runs get (never values). */
|
|
1555
|
+
credentials: string[];
|
|
1554
1556
|
output: OutputSchema | null;
|
|
1555
1557
|
browser: TaskBrowser | null;
|
|
1556
|
-
|
|
1558
|
+
profile: {
|
|
1557
1559
|
id: string;
|
|
1558
1560
|
persist: boolean;
|
|
1559
1561
|
} | null;
|
|
@@ -1619,7 +1621,7 @@ export interface TaskRun<T = unknown> {
|
|
|
1619
1621
|
export interface TaskRunParams {
|
|
1620
1622
|
/** Values by name. Secret variables must be given on every run; plain ones fall back to their defaults. */
|
|
1621
1623
|
variables?: Record<string, string | number | boolean>;
|
|
1622
|
-
/** Work in this session (its own settings apply; the task's `browser` and `
|
|
1624
|
+
/** Work in this session (its own settings apply; the task's `browser` and `profile` do not). */
|
|
1623
1625
|
sessionId?: string;
|
|
1624
1626
|
}
|
|
1625
1627
|
export interface TaskRunListParams extends ListParams {
|
|
@@ -1716,7 +1718,7 @@ export interface Pricing {
|
|
|
1716
1718
|
* The events an endpoint can subscribe to (`webhook.test` needs no subscription). New types may be added: an endpoint
|
|
1717
1719
|
* subscribed to "*" gets them too, so a receiver should ignore types it does not know.
|
|
1718
1720
|
*/
|
|
1719
|
-
export type WebhookEventType = "session.started" | "session.expiring" | "session.ended" | "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" | "
|
|
1721
|
+
export type WebhookEventType = "session.started" | "session.expiring" | "session.ended" | "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.changed" | "webhook.changed" | "webhook.disabled" | "extension.uploaded" | "extension.deleted";
|
|
1720
1722
|
/** What an endpoint subscribes to: event types, or "*" for all of them (those added later too). */
|
|
1721
1723
|
export type WebhookSubscription = WebhookEventType | "*";
|
|
1722
1724
|
/** One entry of bx.webhooks.eventTypes(): a type, its group (for pickers) and what it says. */
|
|
@@ -1995,13 +1997,13 @@ export interface WebhookApiKeyData {
|
|
|
1995
1997
|
name: string;
|
|
1996
1998
|
by: WebhookActor;
|
|
1997
1999
|
}
|
|
1998
|
-
export interface
|
|
1999
|
-
/** The
|
|
2000
|
+
export interface WebhookCredentialChangedData {
|
|
2001
|
+
/** The credential's name. */
|
|
2000
2002
|
name: string;
|
|
2001
2003
|
action: "created" | "updated" | "deleted";
|
|
2002
|
-
|
|
2004
|
+
type: CredentialType;
|
|
2003
2005
|
by: WebhookActor;
|
|
2004
|
-
/** Field names an update changed ("
|
|
2006
|
+
/** Field names an update changed ("password", "origins", …; "profiles" when it was linked to or unlinked from a profile). */
|
|
2005
2007
|
changed?: string[];
|
|
2006
2008
|
}
|
|
2007
2009
|
export interface WebhookChangedData {
|
|
@@ -2048,7 +2050,7 @@ export interface WebhookEventDataMap {
|
|
|
2048
2050
|
"usage.limit_reached": WebhookUsageLimitData;
|
|
2049
2051
|
"api_key.created": WebhookApiKeyData;
|
|
2050
2052
|
"api_key.revoked": WebhookApiKeyData;
|
|
2051
|
-
"
|
|
2053
|
+
"credential.changed": WebhookCredentialChangedData;
|
|
2052
2054
|
"webhook.changed": WebhookChangedData;
|
|
2053
2055
|
"webhook.disabled": WebhookDisabledData;
|
|
2054
2056
|
"extension.uploaded": WebhookExtensionData;
|
|
@@ -2064,69 +2066,136 @@ export type WebhookEventPayload = {
|
|
|
2064
2066
|
type: K;
|
|
2065
2067
|
};
|
|
2066
2068
|
}[keyof WebhookEventDataMap];
|
|
2069
|
+
/** A credential holds a website password (with an optional 2FA key) or a secret (one value). */
|
|
2070
|
+
export type CredentialType = "password" | "secret";
|
|
2067
2071
|
/**
|
|
2068
|
-
* Where a
|
|
2069
|
-
* scripts' step(); "shell": only as
|
|
2072
|
+
* Where a credential may be used: "agent" (default): only the AI, as placeholders in agent runs, plain-English steps,
|
|
2073
|
+
* scripts' step() and the type action; "shell": only as environment variables in session shells and commands; "all": both.
|
|
2070
2074
|
*/
|
|
2071
|
-
export type
|
|
2072
|
-
/**
|
|
2073
|
-
export
|
|
2075
|
+
export type CredentialScope = "agent" | "shell" | "all";
|
|
2076
|
+
/** What `Session.typeCredential` types from a password credential: its user name, its password or its current 2FA code. */
|
|
2077
|
+
export type CredentialField = "username" | "password" | "otp";
|
|
2078
|
+
interface CredentialBase {
|
|
2079
|
+
/** Also its placeholder (`%NAME%`, `%NAME.password%`) and its shell variable (`$NAME`, `$NAME_PASSWORD`). */
|
|
2074
2080
|
name: string;
|
|
2075
2081
|
description: string | null;
|
|
2076
|
-
/** Sites where the AI may type it (null = any site). */
|
|
2077
|
-
origins: string[] | null;
|
|
2078
2082
|
/** The AI may use it in bash commands; this also allows exporting it into shells. */
|
|
2079
2083
|
shell: boolean;
|
|
2080
|
-
scope:
|
|
2081
|
-
/** "••••1a2b": the last 4 characters of values of 24 characters or more; null for shorter values and secrets with origins. */
|
|
2082
|
-
preview: string | null;
|
|
2084
|
+
scope: CredentialScope;
|
|
2083
2085
|
createdAt: string;
|
|
2084
2086
|
updatedAt: string;
|
|
2085
2087
|
lastUsedAt: string | null;
|
|
2086
2088
|
}
|
|
2087
|
-
|
|
2089
|
+
/** A website password. Neither the password nor the 2FA key is ever returned. */
|
|
2090
|
+
export interface PasswordCredential extends CredentialBase {
|
|
2091
|
+
type: "password";
|
|
2092
|
+
/** The sites where the AI may type it (1 to 20). */
|
|
2093
|
+
origins: string[];
|
|
2094
|
+
username: string;
|
|
2095
|
+
/** It has a 2FA key: `%NAME.otp%` and `boxline-otp NAME` give the current code. */
|
|
2096
|
+
hasTotp: boolean;
|
|
2097
|
+
}
|
|
2098
|
+
/** A secret (an API key, a token). Its value is never returned. */
|
|
2099
|
+
export interface SecretCredential extends CredentialBase {
|
|
2100
|
+
type: "secret";
|
|
2101
|
+
/** Sites where the AI may type it (null = any site). */
|
|
2102
|
+
origins: string[] | null;
|
|
2103
|
+
/** "••••1a2b": the last 4 characters of values of 24 characters or more; null for shorter values and secrets with origins. */
|
|
2104
|
+
preview: string | null;
|
|
2105
|
+
}
|
|
2106
|
+
/** A credential without its values: `switch (c.type)` tells the two apart. */
|
|
2107
|
+
export type Credential = PasswordCredential | SecretCredential;
|
|
2108
|
+
interface CredentialCreateBase {
|
|
2088
2109
|
/**
|
|
2089
2110
|
* An environment variable name in capitals, [A-Z_][A-Z0-9_]*, at most 64 characters; not one the platform or bash
|
|
2090
|
-
* sets (PATH, HOME, PWD, IFS, …, or starting with BOXLINE_, SANDBOXD_ or BASH_). One per project.
|
|
2111
|
+
* sets (PATH, HOME, PWD, IFS, …, or starting with BOXLINE_, SANDBOXD_ or BASH_). One per project, whatever the type.
|
|
2091
2112
|
*/
|
|
2092
2113
|
name: string;
|
|
2093
|
-
/** 1 to 8000 characters, no NUL. Sealed when stored and never returned. */
|
|
2094
|
-
value: string;
|
|
2095
2114
|
/** Up to 500 characters. */
|
|
2096
2115
|
description?: string;
|
|
2097
|
-
/** Sites where the AI may type it, e.g. ["https://example.com"] (recommended for passwords); 1 to 20. */
|
|
2098
|
-
origins?: string[];
|
|
2099
2116
|
/** Let the AI use it in bash commands (and so export it into shells). Default false. */
|
|
2100
2117
|
shell?: boolean;
|
|
2101
2118
|
/** Default "agent". */
|
|
2102
|
-
scope?:
|
|
2119
|
+
scope?: CredentialScope;
|
|
2120
|
+
}
|
|
2121
|
+
/** A website password; needs the plan's `loginDetails`. */
|
|
2122
|
+
export interface PasswordCredentialCreateParams extends CredentialCreateBase {
|
|
2123
|
+
type: "password";
|
|
2124
|
+
/** The sites where the AI may type it, `"https://shop.example.com"` or `"https://*.example.com"` (any subdomain); 1 to 20. */
|
|
2125
|
+
origins: string[];
|
|
2126
|
+
/** 1 to 320 characters. */
|
|
2127
|
+
username: string;
|
|
2128
|
+
/** 1 to 1024 characters. Sealed when stored and never returned. */
|
|
2129
|
+
password: string;
|
|
2130
|
+
/**
|
|
2131
|
+
* 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).
|
|
2133
|
+
*/
|
|
2134
|
+
totpSecret?: string;
|
|
2103
2135
|
}
|
|
2104
|
-
/**
|
|
2105
|
-
export interface
|
|
2106
|
-
|
|
2136
|
+
/** A secret: one value. */
|
|
2137
|
+
export interface SecretCredentialCreateParams extends CredentialCreateBase {
|
|
2138
|
+
type: "secret";
|
|
2139
|
+
/** 1 to 8000 characters, no NUL. Sealed when stored and never returned. */
|
|
2140
|
+
value: string;
|
|
2141
|
+
/** Sites where the AI may type it, e.g. ["https://example.com"] (1 to 20); without, any site. */
|
|
2142
|
+
origins?: string[];
|
|
2143
|
+
}
|
|
2144
|
+
export type CredentialCreateParams = PasswordCredentialCreateParams | SecretCredentialCreateParams;
|
|
2145
|
+
/**
|
|
2146
|
+
* Changes to a password; what is not sent is kept. A change of `origins` that adds a site, or of `scope`/`shell` that
|
|
2147
|
+
* 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).
|
|
2149
|
+
*/
|
|
2150
|
+
export interface PasswordCredentialUpdateParams {
|
|
2151
|
+
origins?: string[];
|
|
2152
|
+
username?: string;
|
|
2153
|
+
password?: string;
|
|
2154
|
+
/** A new 2FA setup key or otpauth://totp/ link; null removes 2FA. */
|
|
2155
|
+
totpSecret?: string | null;
|
|
2156
|
+
/** null clears it. */
|
|
2107
2157
|
description?: string | null;
|
|
2158
|
+
shell?: boolean;
|
|
2159
|
+
scope?: CredentialScope;
|
|
2160
|
+
value?: never;
|
|
2161
|
+
}
|
|
2162
|
+
/**
|
|
2163
|
+
* Changes to a secret; what is not sent is kept. A change of `origins` that adds a site, or null, or of `scope`/`shell`
|
|
2164
|
+
* that makes an AI-only secret readable by shells, needs `value` again.
|
|
2165
|
+
*/
|
|
2166
|
+
export interface SecretCredentialUpdateParams {
|
|
2167
|
+
value?: string;
|
|
2168
|
+
/** null allows any site. */
|
|
2108
2169
|
origins?: string[] | null;
|
|
2170
|
+
description?: string | null;
|
|
2109
2171
|
shell?: boolean;
|
|
2110
|
-
scope?:
|
|
2172
|
+
scope?: CredentialScope;
|
|
2173
|
+
username?: never;
|
|
2174
|
+
password?: never;
|
|
2175
|
+
totpSecret?: never;
|
|
2111
2176
|
}
|
|
2112
|
-
/**
|
|
2113
|
-
export
|
|
2177
|
+
/** What credentials.update takes: the fields of a password or of a secret (the type cannot change). Changes apply to new uses. */
|
|
2178
|
+
export type CredentialUpdateParams = PasswordCredentialUpdateParams | SecretCredentialUpdateParams;
|
|
2179
|
+
/**
|
|
2180
|
+
* One entry of the credentials audit log: a change, or a use (once per session, command, agent run, step session,
|
|
2181
|
+
* script, task run, type action or boxline-otp session). Never values.
|
|
2182
|
+
*/
|
|
2183
|
+
export interface CredentialAuditEntry {
|
|
2114
2184
|
at: string;
|
|
2115
2185
|
action: "create" | "update" | "delete" | "use";
|
|
2116
|
-
|
|
2117
|
-
kind: "secret" | "login";
|
|
2186
|
+
type: CredentialType;
|
|
2118
2187
|
name: string;
|
|
2119
2188
|
/** Who changed it: "user:<email>", "key:<api key id>", or "support" (Boxline support acting as a user). */
|
|
2120
2189
|
actor: string | null;
|
|
2121
|
-
/** What used it. */
|
|
2190
|
+
/** What used it: `id` is the session, or for `agent_run` the run and for `task_run` the task run. Null for changes. */
|
|
2122
2191
|
usedBy: {
|
|
2123
|
-
type: "session" | "exec" | "agent_run" | "step" | "script" | "task_run";
|
|
2192
|
+
type: "session" | "exec" | "agent_run" | "step" | "script" | "task_run" | "action" | "otp";
|
|
2124
2193
|
id: string;
|
|
2125
2194
|
} | null;
|
|
2126
2195
|
details: Record<string, unknown>;
|
|
2127
2196
|
}
|
|
2128
|
-
export interface
|
|
2129
|
-
/** One
|
|
2197
|
+
export interface CredentialAuditParams extends ListParams {
|
|
2198
|
+
/** One credential. */
|
|
2130
2199
|
name?: string;
|
|
2131
2200
|
}
|
|
2132
2201
|
/** An uploaded Chrome extension (Manifest V3). */
|
|
@@ -2145,3 +2214,4 @@ export interface ExtensionInfo {
|
|
|
2145
2214
|
sha256: string;
|
|
2146
2215
|
createdAt: string;
|
|
2147
2216
|
}
|
|
2217
|
+
export {};
|
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 = "1.
|
|
2
|
+
export declare const VERSION = "1.2.0";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED