@promigence/sdk 0.1.0-beta.16 → 0.1.0-beta.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/client.d.ts +123 -10
- package/dist/cjs/client.js +374 -82
- package/dist/cjs/context.d.ts +2 -1
- package/dist/cjs/context.js +5 -0
- package/dist/cjs/core.d.ts +25 -2
- package/dist/cjs/core.js +25 -4
- package/dist/cjs/handles.js +2 -1
- package/dist/cjs/http2.js +5 -0
- package/dist/cjs/models.gen.d.ts +205 -23
- package/dist/cjs/proxy.js +32 -3
- package/dist/cjs/sandbox.d.ts +12 -5
- package/dist/cjs/sandbox.js +1 -1
- package/dist/client.d.ts +123 -10
- package/dist/client.js +375 -83
- package/dist/context.d.ts +2 -1
- package/dist/context.js +5 -0
- package/dist/core.d.ts +25 -2
- package/dist/core.js +23 -3
- package/dist/handles.js +2 -1
- package/dist/http2.js +5 -0
- package/dist/models.gen.d.ts +205 -23
- package/dist/proxy.js +33 -4
- package/dist/sandbox.d.ts +12 -5
- package/dist/sandbox.js +1 -1
- package/package.json +1 -1
package/dist/cjs/client.d.ts
CHANGED
|
@@ -178,6 +178,8 @@ export interface SandboxRef extends QueuedInfo {
|
|
|
178
178
|
}
|
|
179
179
|
/** How a grader's result is read. */
|
|
180
180
|
export type ScoreMode = M.ScoreMode;
|
|
181
|
+
/** Which of a run's sandboxes are kept to reopen where they ended (`RunStartOpts.capture`). */
|
|
182
|
+
export type CaptureMode = M.CaptureMode;
|
|
181
183
|
/**
|
|
182
184
|
* Score the agent's work after the episode, in a clean copy of the snapshot with the agent's
|
|
183
185
|
* changes applied. `holdout_cmd` is your own second test set; the report carries the gap
|
|
@@ -396,6 +398,12 @@ export interface SecretRecord {
|
|
|
396
398
|
raw?: "allowed" | "refused";
|
|
397
399
|
/** Whether the value is kept out of the bound hosts' answers (present when `hosts` is). */
|
|
398
400
|
scan_responses?: boolean;
|
|
401
|
+
/**
|
|
402
|
+
* On `secrets.set` only: things to know about the value just stored, one `code: sentence` each;
|
|
403
|
+
* absent when there are none. `api_key_value`: the value holds an API key of this service, which
|
|
404
|
+
* any command in a sandbox given this secret can use.
|
|
405
|
+
*/
|
|
406
|
+
warnings?: string[];
|
|
399
407
|
}
|
|
400
408
|
/**
|
|
401
409
|
* `secrets.set` options: bind the secret to hosts. Requests a sandbox sends to the host's address
|
|
@@ -745,8 +753,25 @@ export interface OrgRecord {
|
|
|
745
753
|
created_at: string;
|
|
746
754
|
/** Days command output is kept after a sandbox ends; `null` = the default, 7. */
|
|
747
755
|
output_retention_days?: number | null;
|
|
748
|
-
/**
|
|
756
|
+
/**
|
|
757
|
+
* This organization's choice: keep a failed sandbox to reopen where it broke, when a run does not say (`capture`);
|
|
758
|
+
* absent or `null` = not chosen, so the default applies: not kept unless the organization or project chose to keep
|
|
759
|
+
* them. What applies is `failure_captures_effective`.
|
|
760
|
+
*/
|
|
749
761
|
failure_captures?: boolean | null;
|
|
762
|
+
/** The length of new preview URLs when a request does not say; absent or `null` = the default, short. */
|
|
763
|
+
preview_link_length?: PreviewLinkLength | null;
|
|
764
|
+
/** What applies to a failed run that does not say: kept or not, and whose choice decided it. */
|
|
765
|
+
failure_captures_effective?: CapturesEffective;
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* What applies to a failed run's sandboxes when the run does not say (`capture`): `kept`, and `from`, whose choice
|
|
769
|
+
* decided it: `project`, `org`, or `default` (neither chose: not kept unless the organization or project chose to
|
|
770
|
+
* keep them). A run's own `capture` is followed either way.
|
|
771
|
+
*/
|
|
772
|
+
export interface CapturesEffective {
|
|
773
|
+
kept: boolean;
|
|
774
|
+
from: "project" | "org" | "default" | (string & {});
|
|
750
775
|
}
|
|
751
776
|
export interface ProjectRecord {
|
|
752
777
|
project_id: string;
|
|
@@ -758,8 +783,16 @@ export interface ProjectRecord {
|
|
|
758
783
|
monthly_cap_usd?: number | null;
|
|
759
784
|
/** Days this project's command output is kept after a sandbox ends; `null` = the organization's. */
|
|
760
785
|
output_retention_days?: number | null;
|
|
761
|
-
/**
|
|
786
|
+
/**
|
|
787
|
+
* This project's choice: keep its failed sandboxes to reopen, when a run does not say (`capture`); absent or `null` =
|
|
788
|
+
* the organization's choice, and where neither chose, the default: not kept unless the organization or project
|
|
789
|
+
* chose to keep them. What applies is `failure_captures_effective`.
|
|
790
|
+
*/
|
|
762
791
|
failure_captures?: boolean | null;
|
|
792
|
+
/** The length of this project's new preview URLs when a request does not say; absent or `null` = the organization's. */
|
|
793
|
+
preview_link_length?: PreviewLinkLength | null;
|
|
794
|
+
/** What applies to its failed runs that do not say: kept or not, and whose choice decided it. */
|
|
795
|
+
failure_captures_effective?: CapturesEffective;
|
|
763
796
|
created_at: string;
|
|
764
797
|
}
|
|
765
798
|
/** The longest command output may be kept after a sandbox ends, in days. */
|
|
@@ -1383,7 +1416,7 @@ export interface SshRevoked {
|
|
|
1383
1416
|
export interface PortRecord {
|
|
1384
1417
|
sandbox_id: string;
|
|
1385
1418
|
port: number;
|
|
1386
|
-
/**
|
|
1419
|
+
/** The URL's own name: anyone with the URL reaches the port. Pass it to `revoke` to take this one URL down. */
|
|
1387
1420
|
token: string;
|
|
1388
1421
|
url: string;
|
|
1389
1422
|
/** The same token as a DNS label, for a wildcard-DNS deployment (`<label>.<suffix>`). */
|
|
@@ -1391,6 +1424,25 @@ export interface PortRecord {
|
|
|
1391
1424
|
created_unix_ns?: number;
|
|
1392
1425
|
/** When the URL stops working on its own (`ttl_s`); `null` for one that works until revoked. */
|
|
1393
1426
|
expires_unix_ns?: number | null;
|
|
1427
|
+
/**
|
|
1428
|
+
* `"short"` (`https://brave-otter-48213.<domain>/`, the default) or `"long"` (a longer,
|
|
1429
|
+
* harder-to-guess URL, for apps with sensitive data).
|
|
1430
|
+
*/
|
|
1431
|
+
length?: PreviewLinkLength;
|
|
1432
|
+
}
|
|
1433
|
+
/**
|
|
1434
|
+
* How long a preview URL is: `"short"` (the default, `https://brave-otter-48213.<domain>/`) or
|
|
1435
|
+
* `"long"` (a longer, harder-to-guess URL, for apps with sensitive data). Custom domains are
|
|
1436
|
+
* coming soon.
|
|
1437
|
+
*/
|
|
1438
|
+
export type PreviewLinkLength = "short" | "long";
|
|
1439
|
+
/** Options of `ports.expose`. */
|
|
1440
|
+
export interface PortExposeOpts {
|
|
1441
|
+
/**
|
|
1442
|
+
* `"short"` or `"long"`. Omitted: the length the sandbox's project chose, else its
|
|
1443
|
+
* organization's, else short.
|
|
1444
|
+
*/
|
|
1445
|
+
length?: PreviewLinkLength;
|
|
1394
1446
|
}
|
|
1395
1447
|
/** A key named without its secret (`/me`'s `key`, the key lists). */
|
|
1396
1448
|
export interface KeyRef {
|
|
@@ -1422,8 +1474,31 @@ export interface MeResponse {
|
|
|
1422
1474
|
max_concurrency?: number;
|
|
1423
1475
|
max_session_s?: number | null;
|
|
1424
1476
|
max_sandbox_vcpus?: number | null;
|
|
1477
|
+
/** Everything stored together, in GB: snapshots, paused sandboxes and saved failures; `null` for no limit. */
|
|
1478
|
+
max_storage_gb?: number | null;
|
|
1479
|
+
/**
|
|
1480
|
+
* The storage saved failures may use, in GB: when a new one would pass it, the oldest are removed to make room;
|
|
1481
|
+
* `null` for no limit.
|
|
1482
|
+
*/
|
|
1483
|
+
max_capture_storage_gb?: number | null;
|
|
1484
|
+
/** Snapshots that may be kept; `null` for no limit. */
|
|
1485
|
+
max_snapshots?: number | null;
|
|
1486
|
+
/** Paused sandboxes that may be kept; `null` for no limit. */
|
|
1487
|
+
max_paused?: number | null;
|
|
1425
1488
|
[extra: string]: number | null | undefined;
|
|
1426
1489
|
};
|
|
1490
|
+
/**
|
|
1491
|
+
* What the organisation stores now, in bytes (a GB of `limits` is 2^30 bytes): everything together (`used_bytes`,
|
|
1492
|
+
* against `limits.max_storage_gb`) and its saved failures (`captures_bytes`, against
|
|
1493
|
+
* `limits.max_capture_storage_gb`), with the counts. Absent from a server before it.
|
|
1494
|
+
*/
|
|
1495
|
+
storage?: {
|
|
1496
|
+
used_bytes: number;
|
|
1497
|
+
captures_bytes: number;
|
|
1498
|
+
snapshots: number;
|
|
1499
|
+
paused: number;
|
|
1500
|
+
captures: number;
|
|
1501
|
+
} | null;
|
|
1427
1502
|
/**
|
|
1428
1503
|
* Sandboxes holding capacity now (queued, starting, ready or running; paused ones hold none)
|
|
1429
1504
|
* against the limit.
|
|
@@ -1603,6 +1678,12 @@ export interface RunStartOpts {
|
|
|
1603
1678
|
verifyEach?: boolean;
|
|
1604
1679
|
network?: NetworkMode;
|
|
1605
1680
|
optimizeFor?: OptimizeFor;
|
|
1681
|
+
/**
|
|
1682
|
+
* Which of this run's sandboxes are kept to reopen where they ended (`runs.open`): `on_failure`
|
|
1683
|
+
* keeps one whose command failed, `off` keeps none, `always` keeps every one. Left out, the
|
|
1684
|
+
* default applies.
|
|
1685
|
+
*/
|
|
1686
|
+
capture?: CaptureMode;
|
|
1606
1687
|
/**
|
|
1607
1688
|
* Secrets for every sandbox of this run. An `exec` is no longer required: a run that names
|
|
1608
1689
|
* its secrets here gives them to every command run against every one of its sandboxes,
|
|
@@ -1666,9 +1747,9 @@ export interface ExecOpts {
|
|
|
1666
1747
|
*/
|
|
1667
1748
|
secrets?: SecretBinding[];
|
|
1668
1749
|
/**
|
|
1669
|
-
* Cancel an in-flight exec, streamed or not: the client stops waiting and the
|
|
1670
|
-
*
|
|
1671
|
-
*
|
|
1750
|
+
* Cancel an in-flight exec, streamed or not: the client stops waiting and tells the service to
|
|
1751
|
+
* stop the command in the sandbox. A buffered exec then throws `TimeoutError` ("aborted by the
|
|
1752
|
+
* caller's signal"); a streamed one rejects with the signal's `AbortError`.
|
|
1672
1753
|
*/
|
|
1673
1754
|
signal?: AbortSignal;
|
|
1674
1755
|
/**
|
|
@@ -2062,6 +2143,9 @@ export declare class PromigenceClient {
|
|
|
2062
2143
|
private guardDispatcher;
|
|
2063
2144
|
private dispatcherFor;
|
|
2064
2145
|
private againKeyed;
|
|
2146
|
+
private heldExec;
|
|
2147
|
+
private reattachBuffered;
|
|
2148
|
+
private cancelHeldExec;
|
|
2065
2149
|
request<T>(opts: RequestOpts): Promise<T>;
|
|
2066
2150
|
/**
|
|
2067
2151
|
* A request whose body — in either direction — is **bytes, not JSON** (`files get|put`).
|
|
@@ -2259,15 +2343,29 @@ export declare class PromigenceClient {
|
|
|
2259
2343
|
/** `PATCH /orgs/:org/projects/:project {name}` — rename it (the `default` project keeps its name). */
|
|
2260
2344
|
rename: (org: string, project: string, name: string) => Promise<ProjectRecord>;
|
|
2261
2345
|
/**
|
|
2262
|
-
* `PATCH /orgs/:org/projects/:project` — rename it, set how long its command output is kept,
|
|
2263
|
-
* whether its failed sandboxes are kept to reopen (
|
|
2346
|
+
* `PATCH /orgs/:org/projects/:project` — rename it, set how long its command output is kept,
|
|
2347
|
+
* whether its failed sandboxes are kept to reopen (on its own; `null` = the organization's choice, and
|
|
2348
|
+
* where neither chose, not kept unless the organization or project chose to keep them), or how long
|
|
2349
|
+
* its new preview URLs are (on its own). The settings need an owner signed in.
|
|
2264
2350
|
*/
|
|
2265
2351
|
update: (org: string, project: string, update: {
|
|
2266
2352
|
name?: string;
|
|
2267
2353
|
outputRetentionDays?: number | null;
|
|
2268
2354
|
failureCaptures?: boolean | null;
|
|
2355
|
+
previewLinkLength?: PreviewLinkLength | null;
|
|
2269
2356
|
}) => Promise<ProjectRecord>;
|
|
2270
2357
|
};
|
|
2358
|
+
/**
|
|
2359
|
+
* `PATCH /orgs/:org` — rename it, set how long its command output is kept, whether its failed
|
|
2360
|
+
* sandboxes are kept to reopen, or how long its new preview URLs are (those two each on their
|
|
2361
|
+
* own). The settings need an owner signed in.
|
|
2362
|
+
*/
|
|
2363
|
+
update: (org: string, update: {
|
|
2364
|
+
name?: string;
|
|
2365
|
+
outputRetentionDays?: number | null;
|
|
2366
|
+
failureCaptures?: boolean | null;
|
|
2367
|
+
previewLinkLength?: PreviewLinkLength | null;
|
|
2368
|
+
}) => Promise<OrgRecord>;
|
|
2271
2369
|
};
|
|
2272
2370
|
private group_orgs;
|
|
2273
2371
|
readonly credits: {
|
|
@@ -2441,7 +2539,13 @@ export declare class PromigenceClient {
|
|
|
2441
2539
|
*/
|
|
2442
2540
|
private waitLoop;
|
|
2443
2541
|
readonly sandboxes: {
|
|
2444
|
-
/**
|
|
2542
|
+
/**
|
|
2543
|
+
* `POST /sandboxes/:id/execs` — foreground exec, inline output up to `maxOutputBytes`.
|
|
2544
|
+
*
|
|
2545
|
+
* If the connection drops while the command runs, the SDK picks the command up again where the
|
|
2546
|
+
* service keeps it and returns its own answer; when it cannot, it throws `ExecLostError`. The
|
|
2547
|
+
* command is never sent a second time.
|
|
2548
|
+
*/
|
|
2445
2549
|
exec: (sandboxId: string, opts: ExecOpts) => Promise<ExecResponse>;
|
|
2446
2550
|
/**
|
|
2447
2551
|
* `POST /sandboxes/:id/execs` with `Accept: text/event-stream`.
|
|
@@ -2453,6 +2557,10 @@ export declare class PromigenceClient {
|
|
|
2453
2557
|
*
|
|
2454
2558
|
* Uses `fetch`'s streaming body rather than `res.text()`, which is what `request()` does and
|
|
2455
2559
|
* why it cannot be reused here: `await res.text()` is precisely the buffering this removes.
|
|
2560
|
+
*
|
|
2561
|
+
* If the connection drops while the command runs, the SDK picks the command up again where the
|
|
2562
|
+
* service keeps it, and the stream goes on where it left off; when it cannot, it throws
|
|
2563
|
+
* `ExecLostError`. The command is never sent a second time.
|
|
2456
2564
|
*/
|
|
2457
2565
|
execStream: (sandboxId: string, opts: ExecOpts, on?: {
|
|
2458
2566
|
stdout?: (chunk: Uint8Array) => void;
|
|
@@ -2547,7 +2655,12 @@ export declare class PromigenceClient {
|
|
|
2547
2655
|
* `promigence sandbox ssh <sid> -- -N -L <port>:localhost:<port>`.
|
|
2548
2656
|
*/
|
|
2549
2657
|
ports: {
|
|
2550
|
-
|
|
2658
|
+
/**
|
|
2659
|
+
* Publish a port: `{ length: "long" }` for a longer, harder-to-guess URL (apps with
|
|
2660
|
+
* sensitive data); omitted, the length the sandbox's project or organization chose
|
|
2661
|
+
* (short by default).
|
|
2662
|
+
*/
|
|
2663
|
+
expose: (sandboxId: string, port: number, opts?: PortExposeOpts) => Promise<PortRecord>;
|
|
2551
2664
|
list: (sandboxId: string) => Promise<PortRecord[]>;
|
|
2552
2665
|
/** A token revokes that URL; a port number revokes every URL for that port. */
|
|
2553
2666
|
revoke: (sandboxId: string, tokenOrPort: string | number) => Promise<{
|