@withgateway/sdk 0.3.1 → 0.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 +8 -6
- package/dist/cli.js +4372 -2265
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +4362 -2256
- package/dist/cli.mjs.map +1 -1
- package/dist/files/index.d.mts +1 -1
- package/dist/files/index.d.ts +1 -1
- package/dist/files/index.js +259 -58
- package/dist/files/index.js.map +1 -1
- package/dist/files/index.mjs +249 -50
- package/dist/files/index.mjs.map +1 -1
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +124 -11
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +124 -11
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/{index-C3UzD0G3.d.mts → index-CDPQBsU5.d.mts} +19 -3
- package/dist/{index-C3UzD0G3.d.ts → index-CDPQBsU5.d.ts} +19 -3
- package/dist/{index-CBqbB_0J.d.ts → index-DUHmS74p.d.ts} +1 -1
- package/dist/{index-D-AMnAMa.d.mts → index-mJhG3vZU.d.mts} +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +2240 -789
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2150 -739
- package/dist/index.mjs.map +1 -1
- package/dist/{media-CbcAfQvd.d.mts → media-BIApiPzS.d.mts} +21 -2
- package/dist/{media-CbcAfQvd.d.ts → media-BIApiPzS.d.ts} +21 -2
- package/dist/traces/index.d.mts +1 -1
- package/dist/traces/index.d.ts +1 -1
- package/dist/traces/index.js +253 -52
- package/dist/traces/index.js.map +1 -1
- package/dist/traces/index.mjs +243 -44
- package/dist/traces/index.mjs.map +1 -1
- package/dist/tracing/index.d.mts +2 -2
- package/dist/tracing/index.d.ts +2 -2
- package/dist/tracing/index.js +75 -13
- package/dist/tracing/index.js.map +1 -1
- package/dist/tracing/index.mjs +75 -13
- package/dist/tracing/index.mjs.map +1 -1
- package/dist/worlds/index.d.mts +893 -482
- package/dist/worlds/index.d.ts +893 -482
- package/dist/worlds/index.js +1968 -669
- package/dist/worlds/index.js.map +1 -1
- package/dist/worlds/index.mjs +1960 -662
- package/dist/worlds/index.mjs.map +1 -1
- package/package.json +1 -1
- package/runtime/gatewaysdk/environment/_bundle.py +2 -27
- package/runtime/gatewaysdk/environment/_materialize.py +48 -88
- package/runtime/gatewaysdk/environment/_world.py +155 -237
- package/runtime/gatewaysdk/environment/backing.py +133 -0
- package/runtime/gatewaysdk/environment/core.py +2 -17
- package/runtime/gatewaysdk/environment/legacy_sqlite.py +288 -0
- package/runtime/gatewaysdk/environment/reward_keys.py +25 -0
- package/runtime/gatewaysdk/environment/runtime.py +8 -13
- package/runtime/gatewaysdk/environment/schema/__init__.py +4 -4
- package/runtime/gatewaysdk/environment/schema/admin_routes.py +86 -0
- package/runtime/gatewaysdk/environment/schema/admission.py +174 -0
- package/runtime/gatewaysdk/environment/schema/api.py +347 -892
- package/runtime/gatewaysdk/environment/schema/assertions.py +458 -0
- package/runtime/gatewaysdk/environment/schema/batch.py +44 -39
- package/runtime/gatewaysdk/environment/schema/bundle_runtime.py +17 -5
- package/runtime/gatewaysdk/environment/schema/cache_layout.py +5 -0
- package/runtime/gatewaysdk/environment/schema/call_capture.py +309 -0
- package/runtime/gatewaysdk/environment/schema/call_log.py +503 -0
- package/runtime/gatewaysdk/environment/schema/call_redaction.py +526 -0
- package/runtime/gatewaysdk/environment/schema/cast.py +15 -35
- package/runtime/gatewaysdk/environment/schema/compiler.py +334 -158
- package/runtime/gatewaysdk/environment/schema/conform.py +14 -39
- package/runtime/gatewaysdk/environment/schema/connector.py +113 -211
- package/runtime/gatewaysdk/environment/schema/connectors/confluence/connector.toml +1 -12
- package/runtime/gatewaysdk/environment/schema/connectors/github/connector.toml +1 -0
- package/runtime/gatewaysdk/environment/schema/connectors/servicenow/connector.toml +2 -5
- package/runtime/gatewaysdk/environment/schema/cors.py +54 -0
- package/runtime/gatewaysdk/environment/schema/credentials.py +313 -8
- package/runtime/gatewaysdk/environment/schema/data.py +60 -216
- package/runtime/gatewaysdk/environment/schema/database/__init__.py +24 -0
- package/runtime/gatewaysdk/environment/schema/database/audit.py +121 -0
- package/runtime/gatewaysdk/environment/schema/database/base.py +936 -0
- package/runtime/gatewaysdk/environment/schema/database/budget.py +33 -0
- package/runtime/gatewaysdk/environment/schema/database/connections.py +101 -0
- package/runtime/gatewaysdk/environment/schema/database/engines.py +8 -0
- package/runtime/gatewaysdk/environment/schema/database/guard.py +215 -0
- package/runtime/gatewaysdk/environment/schema/database/ingest.py +154 -0
- package/runtime/gatewaysdk/environment/schema/database/matching.py +58 -0
- package/runtime/gatewaysdk/environment/schema/database/provenance.py +30 -0
- package/runtime/gatewaysdk/environment/schema/database/reads.py +169 -0
- package/runtime/gatewaysdk/environment/schema/database/rows.py +53 -0
- package/runtime/gatewaysdk/environment/schema/database/runtime_rows.py +39 -0
- package/runtime/gatewaysdk/environment/schema/database/sqlite.py +393 -0
- package/runtime/gatewaysdk/environment/schema/declared_routes.py +210 -0
- package/runtime/gatewaysdk/environment/schema/domain_migration.py +236 -0
- package/runtime/gatewaysdk/environment/schema/door.py +899 -0
- package/runtime/gatewaysdk/environment/schema/envelope.py +227 -0
- package/runtime/gatewaysdk/environment/schema/extract.py +6 -13
- package/runtime/gatewaysdk/environment/schema/grading.py +90 -103
- package/runtime/gatewaysdk/environment/schema/handler_errors.py +163 -12
- package/runtime/gatewaysdk/environment/schema/host.py +237 -1795
- package/runtime/gatewaysdk/environment/schema/host_control.py +144 -0
- package/runtime/gatewaysdk/environment/schema/host_handoff.py +370 -0
- package/runtime/gatewaysdk/environment/schema/host_loops.py +97 -0
- package/runtime/gatewaysdk/environment/schema/host_owners.py +121 -0
- package/runtime/gatewaysdk/environment/schema/host_proxy.py +111 -0
- package/runtime/gatewaysdk/environment/schema/host_requests.py +6 -0
- package/runtime/gatewaysdk/environment/schema/host_session.py +126 -0
- package/runtime/gatewaysdk/environment/schema/host_surfaces.py +79 -21
- package/runtime/gatewaysdk/environment/schema/host_transfers.py +127 -0
- package/runtime/gatewaysdk/environment/schema/host_versions.py +242 -0
- package/runtime/gatewaysdk/environment/schema/host_workers.py +577 -0
- package/runtime/gatewaysdk/environment/schema/journal.py +437 -0
- package/runtime/gatewaysdk/environment/schema/lanes.py +53 -0
- package/runtime/gatewaysdk/environment/schema/ledger_spill.py +828 -0
- package/runtime/gatewaysdk/environment/schema/local.py +58 -170
- package/runtime/gatewaysdk/environment/schema/mapping.py +5 -25
- package/runtime/gatewaysdk/environment/schema/openapi_import.py +112 -73
- package/runtime/gatewaysdk/environment/schema/openapi_paging.py +147 -0
- package/runtime/gatewaysdk/environment/schema/openapi_payloads.py +288 -0
- package/runtime/gatewaysdk/environment/schema/openapi_routes.py +97 -102
- package/runtime/gatewaysdk/environment/schema/openapi_schemas.py +113 -30
- package/runtime/gatewaysdk/environment/schema/platform.py +137 -187
- package/runtime/gatewaysdk/environment/schema/platform_import.py +2 -3
- package/runtime/gatewaysdk/environment/schema/platform_query.py +61 -5
- package/runtime/gatewaysdk/environment/schema/primary_key.py +61 -0
- package/runtime/gatewaysdk/environment/schema/proof.py +19 -12
- package/runtime/gatewaysdk/environment/schema/request_body.py +238 -0
- package/runtime/gatewaysdk/environment/schema/request_ledger.py +958 -0
- package/runtime/gatewaysdk/environment/schema/route_bindings.py +25 -3
- package/runtime/gatewaysdk/environment/schema/route_miss.py +54 -0
- package/runtime/gatewaysdk/environment/schema/runtime.py +178 -308
- package/runtime/gatewaysdk/environment/schema/served_names.py +58 -0
- package/runtime/gatewaysdk/environment/schema/session_files.py +275 -0
- package/runtime/gatewaysdk/environment/schema/session_move.py +275 -0
- package/runtime/gatewaysdk/environment/schema/skills/agents/connector-template-author.md +5 -1
- package/runtime/gatewaysdk/environment/schema/skills/benchmarks-getting-started/SKILL.md +10 -11
- package/runtime/gatewaysdk/environment/schema/skills/connector-schema-authoring/SKILL.md +49 -16
- package/runtime/gatewaysdk/environment/schema/skills/world-data-ingestion/ROWS.md +39 -9
- package/runtime/gatewaysdk/environment/schema/skills/world-data-ingestion/SKILL.md +27 -27
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/SKILL.md +33 -33
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/cli-mcp-map.md +13 -7
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/gotchas.md +49 -1
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/journal-checks.md +182 -0
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/openapi-import.md +50 -21
- package/runtime/gatewaysdk/environment/schema/slack.py +4 -8
- package/runtime/gatewaysdk/environment/schema/snapshot.py +516 -140
- package/runtime/gatewaysdk/environment/schema/spill_files.py +228 -0
- package/runtime/gatewaysdk/environment/schema/store_contract.py +8 -14
- package/runtime/gatewaysdk/environment/schema/tasks.py +267 -276
- package/runtime/gatewaysdk/environment/schema/tools_world.py +146 -242
- package/runtime/gatewaysdk/environment/schema/ui.py +24 -5
- package/runtime/gatewaysdk/environment/schema/ui_static/app.js +100 -130
- package/runtime/gatewaysdk/environment/schema/ui_static/index.html +1 -8
- package/runtime/gatewaysdk/environment/schema/validation.py +235 -41
- package/runtime/gatewaysdk/environment/schema/verbs.py +32 -36
- package/runtime/gatewaysdk/environment/schema/worker.py +6 -4
- package/runtime/gatewaysdk/environment/schema/workers.py +345 -96
- package/runtime/gatewaysdk/environment/schema/world_host.py +953 -0
- package/runtime/gatewaysdk/environment/schema/world_sql.py +81 -0
- package/runtime/gatewaysdk/environment/schema/world_tests.py +80 -50
- package/runtime/gatewaysdk/environment/score.py +57 -0
- package/runtime/gatewaysdk/environment/secret_values.py +36 -0
- package/runtime/gatewaysdk/environment/world.py +43 -4
- package/runtime/gatewaysdk/environment/world_session_contract.py +46 -5
- package/skills/agents/connector-template-author.md +5 -1
- package/skills/benchmarks-getting-started/SKILL.md +10 -11
- package/skills/connector-schema-authoring/SKILL.md +49 -16
- package/skills/connector-schema-authoring/connector-worlds.md +142 -11
- package/skills/connector-schema-authoring/world-schema.md +103 -51
- package/skills/world-data-ingestion/ROWS.md +39 -9
- package/skills/world-data-ingestion/SKILL.md +27 -27
- package/skills/worlds-getting-started/SKILL.md +33 -33
- package/skills/worlds-getting-started/references/cli-mcp-map.md +13 -7
- package/skills/worlds-getting-started/references/gotchas.md +49 -1
- package/skills/worlds-getting-started/references/journal-checks.md +182 -0
- package/skills/worlds-getting-started/references/openapi-import.md +50 -21
- package/runtime/gatewaysdk/environment/schema/store.py +0 -1013
package/dist/worlds/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as MediaUploader, c as PlatformMethod } from '../media-
|
|
2
|
-
export { P as PLATFORM_TIMEOUT_DEFAULT_MS, a as PLATFORM_TIMEOUT_ENV, b as PlatformEndpoint, d as PlatformReply, e as PlatformTransport, T as TransportCause, U as UnreachableError, p as platformTimeoutMs } from '../media-
|
|
1
|
+
import { i as MediaUploader, R as RetryPolicy, c as PlatformMethod } from '../media-BIApiPzS.js';
|
|
2
|
+
export { P as PLATFORM_TIMEOUT_DEFAULT_MS, a as PLATFORM_TIMEOUT_ENV, b as PlatformEndpoint, d as PlatformReply, e as PlatformTransport, T as TransportCause, U as UnreachableError, p as platformTimeoutMs } from '../media-BIApiPzS.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* A HOSTED BROWSER THAT COMES BACK. A World Host session's browser is a pool
|
|
@@ -622,10 +622,6 @@ type WorldTaskWorldValidation = {
|
|
|
622
622
|
slug: string;
|
|
623
623
|
ref: string;
|
|
624
624
|
versionId: string;
|
|
625
|
-
/** True when the caller's open edit session's tip stood in for `main`;
|
|
626
|
-
* null when the alias did not resolve; absent from a platform that does
|
|
627
|
-
* not report it. */
|
|
628
|
-
private?: boolean | null;
|
|
629
625
|
ok: boolean;
|
|
630
626
|
checked: "entities" | "none";
|
|
631
627
|
problems: string[];
|
|
@@ -637,10 +633,6 @@ type WorldTaskValidation = {
|
|
|
637
633
|
/** The world version the task was checked against; null for a task with
|
|
638
634
|
* `worlds`, whose versions are per alias under `worlds`. */
|
|
639
635
|
versionId: string | null;
|
|
640
|
-
/** True when the caller's open edit session's tip stood in for `main`;
|
|
641
|
-
* null for a task with `worlds` (per alias there); absent from a platform
|
|
642
|
-
* that does not report it. */
|
|
643
|
-
private?: boolean | null;
|
|
644
636
|
ok: boolean;
|
|
645
637
|
/** `entities` when the world's contract was read and every seed and check
|
|
646
638
|
* entity was matched against it; `none` when the version has no contract
|
|
@@ -698,85 +690,161 @@ declare function validateTask(taskId: string, target?: {
|
|
|
698
690
|
versionId?: string;
|
|
699
691
|
}, options?: WorldsClientOptions): Promise<WorldTaskValidation>;
|
|
700
692
|
|
|
693
|
+
declare const modelToolName: (name: string) => string;
|
|
701
694
|
/**
|
|
702
|
-
*
|
|
703
|
-
*
|
|
704
|
-
*
|
|
705
|
-
*
|
|
695
|
+
* Turn a world's Python signature into a JSON schema the model can call.
|
|
696
|
+
*
|
|
697
|
+
* `crm_update_deal(id, stage=None, owner=None, amount=None)` becomes an
|
|
698
|
+
* object with `id` required and the rest optional. Types are read from the
|
|
699
|
+
* DEFAULTS the world declares — a numeric default means a number, a boolean
|
|
700
|
+
* default a boolean — because that is the only type information a signature
|
|
701
|
+
* actually carries. Everything else is a string, which is what a tool CLI
|
|
702
|
+
* receives anyway.
|
|
706
703
|
*/
|
|
707
|
-
declare
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
704
|
+
declare function schemaFromSignature(spec: WorldToolSpec): {
|
|
705
|
+
type: "function";
|
|
706
|
+
function: {
|
|
707
|
+
name: string;
|
|
708
|
+
description: string;
|
|
709
|
+
parameters: Record<string, unknown>;
|
|
710
|
+
};
|
|
711
|
+
};
|
|
715
712
|
|
|
713
|
+
/** One entry of a world's request ledger as a list carries it: what was asked
|
|
714
|
+
* and what came back, without its headers and bodies. */
|
|
715
|
+
type WorldRequest = {
|
|
716
|
+
id: string;
|
|
717
|
+
seq: number;
|
|
718
|
+
at: string;
|
|
719
|
+
durationMs: number | null;
|
|
720
|
+
worldSlug: string;
|
|
721
|
+
sessionId: string;
|
|
722
|
+
versionId: string;
|
|
723
|
+
via: "api" | "ui" | "tool" | null;
|
|
724
|
+
operation: string | null;
|
|
725
|
+
method: string | null;
|
|
726
|
+
path: string | null;
|
|
727
|
+
query: Record<string, unknown>;
|
|
728
|
+
request: {
|
|
729
|
+
bodyBytes: number | null;
|
|
730
|
+
truncated: boolean;
|
|
731
|
+
contentType: string | null;
|
|
732
|
+
};
|
|
733
|
+
response: {
|
|
734
|
+
status: number;
|
|
735
|
+
bodyBytes: number | null;
|
|
736
|
+
truncated: boolean;
|
|
737
|
+
contentType: string | null;
|
|
738
|
+
};
|
|
739
|
+
rows: number | null;
|
|
740
|
+
found: boolean | null;
|
|
741
|
+
};
|
|
742
|
+
/** One page of a ledger list, newest first, with what its scope did not record: `shed` requests kept without
|
|
743
|
+
* their headers and bodies, `lost` requests a host counted as never recorded or the platform refused, and
|
|
744
|
+
* `hostsLost` hosts lost before they stored every request, whose unsent requests no count holds; none of them on
|
|
745
|
+
* a page whose filters narrow past its world, session or version. */
|
|
746
|
+
type WorldRequestPage = {
|
|
747
|
+
requests: WorldRequest[];
|
|
748
|
+
nextCursor: string | null;
|
|
749
|
+
shed?: number;
|
|
750
|
+
lost?: number;
|
|
751
|
+
hostsLost?: number;
|
|
752
|
+
};
|
|
753
|
+
/** The one line every reader shows for a page's `shed`, `lost` and `hostsLost`, none when all are 0; twin of
|
|
754
|
+
* `worldRequestsUnrecorded` in the platform and `unrecorded` in `gatewaysdk/world_requests.py`, all pinned to
|
|
755
|
+
* `conformance/world-request-log.json` `unrecorded`. */
|
|
756
|
+
declare function worldRequestsUnrecorded(counts: {
|
|
757
|
+
shed?: unknown;
|
|
758
|
+
lost?: unknown;
|
|
759
|
+
hostsLost?: unknown;
|
|
760
|
+
}): string | null;
|
|
716
761
|
/**
|
|
717
|
-
*
|
|
718
|
-
*
|
|
719
|
-
*
|
|
720
|
-
*
|
|
721
|
-
*
|
|
722
|
-
*
|
|
723
|
-
* inside it, so your agent never touches the world.
|
|
724
|
-
*
|
|
725
|
-
* A session is both: the platform boots the task's container and holds it
|
|
726
|
-
* warm, and every `call()` here executes inside THAT container. Your agent
|
|
727
|
-
* stays where it is — this file is just the wire.
|
|
728
|
-
*
|
|
729
|
-
* const world = await openWorld("revenue-ops-sim@main");
|
|
730
|
-
* const session = await openSession(world.slug, { task: "revops-mara-dedupe-contacts" });
|
|
731
|
-
* await session.ready(); // wait for the container
|
|
732
|
-
* await session.call("crm_search", { entity: "deals" });
|
|
733
|
-
* await session.withTraceContext(() => myAgent(session)); // traced under session.sessionId
|
|
734
|
-
* const { reward, rewards } = await session.grade();
|
|
735
|
-
* await session.close({ keepWarm: true }); // hand it back to the pool
|
|
736
|
-
*
|
|
737
|
-
* The task can also be YOURS rather than the bundle's — an instruction, the
|
|
738
|
-
* rows the session starts with and how it is graded, for one end user:
|
|
739
|
-
*
|
|
740
|
-
* const session = await openSession("acme-billing@main", {
|
|
741
|
-
* task: {
|
|
742
|
-
* instruction: "Mark invoice INV-7 as paid.",
|
|
743
|
-
* seed: { rows: { invoices: [{ id: "INV-7", status: "open" }] } },
|
|
744
|
-
* grader: { kind: "assertions", checks: [
|
|
745
|
-
* { entity: "invoices", where: { id: "INV-7", status: "paid" } },
|
|
746
|
-
* ] },
|
|
747
|
-
* metadata: { externalUserId: "u_42" },
|
|
748
|
-
* },
|
|
749
|
-
* surfaces: ["api"],
|
|
750
|
-
* });
|
|
751
|
-
*
|
|
752
|
-
* Every call is a row on the platform before it is an effect in a container,
|
|
753
|
-
* so the episode is on the record — and the platform traces the session
|
|
754
|
-
* itself, which is why these sessions show up under Sessions without the
|
|
755
|
-
* caller instrumenting anything.
|
|
762
|
+
* A session's entries in its world's request ledger: every request the world
|
|
763
|
+
* received, through every door (`via`: api, ui, tool), kept for the life of
|
|
764
|
+
* the world. Read page by page without recording anything in the session; the
|
|
765
|
+
* platform's call ledger (`export()`) holds what it brokered — tool calls,
|
|
766
|
+
* seeds, grades. One entry's headers and bodies are `GET
|
|
767
|
+
* worlds/{slug}/requests/{requestId}`.
|
|
756
768
|
*/
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
769
|
+
declare class WorldRequestLog {
|
|
770
|
+
readonly requests: WorldRequest[];
|
|
771
|
+
readonly notRecorded: string | null;
|
|
772
|
+
readonly unrecorded: string | null;
|
|
773
|
+
private constructor();
|
|
774
|
+
/** Every entry the ledger holds for the session, oldest first, and the line for what it did not record;
|
|
775
|
+
* for a session the World Host did not serve, none, and `notRecorded` says why. */
|
|
776
|
+
static load(session: WorldSession): Promise<WorldRequestLog>;
|
|
777
|
+
private static pages;
|
|
778
|
+
/** Each entry in the shape of a ledger line, `kind: "request"`, so one JSONL
|
|
779
|
+
* file holds both: `args` what was asked, `result` what came back under the
|
|
780
|
+
* entry's `requestId`. */
|
|
781
|
+
asCalls(): WorldSessionCall[];
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
/**
|
|
785
|
+
* A world's grade as the SDK reads it, by the one score rule every grader
|
|
786
|
+
* answers by: a finite number from 0 to 1, a passed check 1, a failed one 0,
|
|
787
|
+
* null ungraded. The World Host's twin is `gatewaysdk/environment/score.py`;
|
|
788
|
+
* both are pinned by `gatewaysdk/fixtures/tasks/grade-vectors.json`.
|
|
789
|
+
*/
|
|
790
|
+
declare const messageOf: (error: unknown) => string;
|
|
791
|
+
type GradeResult = {
|
|
792
|
+
reward: number | null;
|
|
793
|
+
rewards: Record<string, number>;
|
|
794
|
+
/** Why there is no reward: `no grader` on an exploratory session. */
|
|
795
|
+
reason?: string;
|
|
796
|
+
/** Why this world could not grade; the task's grade is then that error. */
|
|
797
|
+
error?: string;
|
|
798
|
+
/** The task's cross-world verifiers anchored on this session, by name:
|
|
799
|
+
* each its own reward and named rewards, or `error` when it could not
|
|
800
|
+
* grade (evidence missing, verify.py failed) — null, never zero. */
|
|
801
|
+
verifiers?: Record<string, VerifierGrade>;
|
|
802
|
+
raw: unknown;
|
|
763
803
|
};
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
schemas: {
|
|
769
|
-
type: "function";
|
|
770
|
-
function: {
|
|
771
|
-
name: string;
|
|
772
|
-
description: string;
|
|
773
|
-
parameters: Record<string, unknown>;
|
|
774
|
-
};
|
|
775
|
-
}[];
|
|
776
|
-
/** name -> implementation, each one a call into THIS session. */
|
|
777
|
-
impls: Record<string, (args: Record<string, unknown>) => Promise<unknown>>;
|
|
778
|
-
specs: WorldToolSpec[];
|
|
804
|
+
type VerifierGrade = {
|
|
805
|
+
reward: number | null;
|
|
806
|
+
rewards: Record<string, number>;
|
|
807
|
+
error?: string;
|
|
779
808
|
};
|
|
809
|
+
declare class Score {
|
|
810
|
+
static readonly RULE = "a score is a number from 0 to 1";
|
|
811
|
+
static admits(value: number): boolean;
|
|
812
|
+
/** Every number among `scores` that is not a score, as `'<key>' = <value>`
|
|
813
|
+
* and the rule, or null when all of them are. Pairs, not a map, so that no
|
|
814
|
+
* key hides another. */
|
|
815
|
+
static problem(scores: Iterable<[string, unknown]>): string | null;
|
|
816
|
+
}
|
|
817
|
+
/** A world's grade that is never filed: it is not an object, a number in it
|
|
818
|
+
* is not a score (a World Host older than the rule), a check is named both
|
|
819
|
+
* beside and inside its rewards, or its rewards or verifiers are not objects
|
|
820
|
+
* by name. */
|
|
821
|
+
declare class GradeRefused extends Error {
|
|
822
|
+
readonly name = "GradeRefused";
|
|
823
|
+
}
|
|
824
|
+
declare class GradePayload {
|
|
825
|
+
/** A grade payload's numbers, checked: every number in it must be a score,
|
|
826
|
+
* and its rewards and verifiers objects by name, or the grade is refused; a
|
|
827
|
+
* cross-world verifier's grade that breaks either rule is that verifier's
|
|
828
|
+
* error, the way the World Host answers one that could not grade. */
|
|
829
|
+
static read(raw: unknown): Omit<GradeResult, "raw">;
|
|
830
|
+
/** A world whose grade call failed (the platform refused it, the host had
|
|
831
|
+
* lost the session): that world's error, never a score. */
|
|
832
|
+
static failedCall(error: unknown): GradeResult;
|
|
833
|
+
private static problem;
|
|
834
|
+
private static twice;
|
|
835
|
+
private static verifiersProblem;
|
|
836
|
+
private static scores;
|
|
837
|
+
private static isRecord;
|
|
838
|
+
private static objectOrAbsent;
|
|
839
|
+
private static record;
|
|
840
|
+
/** `reward`, and every numeric key under `rewards` (the host's shape) or at
|
|
841
|
+
* the top level (a bundled verifier's). */
|
|
842
|
+
private static numbers;
|
|
843
|
+
private static verifiers;
|
|
844
|
+
private static verifier;
|
|
845
|
+
private static failed;
|
|
846
|
+
}
|
|
847
|
+
|
|
780
848
|
/** A JSON scalar: what `where` filters and field predicates compare against. */
|
|
781
849
|
type WorldTaskScalar = string | number | boolean | null;
|
|
782
850
|
/** The rows a task starts the session with — the `seed()` contract, applied
|
|
@@ -818,6 +886,10 @@ type WorldTaskCheck = {
|
|
|
818
886
|
field?: string;
|
|
819
887
|
op?: WorldTaskFieldOp;
|
|
820
888
|
value?: WorldTaskScalar | WorldTaskScalar[];
|
|
889
|
+
/** On `gateway_requests` or `calls`: only the requests before the first one this matches. */
|
|
890
|
+
before?: Record<string, WorldTaskScalar>;
|
|
891
|
+
/** On `gateway_requests` or `calls`: only the requests after the first one this matches. */
|
|
892
|
+
after?: Record<string, WorldTaskScalar>;
|
|
821
893
|
};
|
|
822
894
|
/** One thing a rubric judge scores in [0, 1]; `id` names its entry in
|
|
823
895
|
* `rewards`, `weight` (default 1) its share of the task's reward. */
|
|
@@ -850,6 +922,8 @@ type WorldTaskGrader = {
|
|
|
850
922
|
kind: "python";
|
|
851
923
|
source: string;
|
|
852
924
|
timeoutSeconds?: number;
|
|
925
|
+
readsJournal?: boolean;
|
|
926
|
+
acceptsIncompleteJournal?: boolean;
|
|
853
927
|
} | WorldTaskRubricGrader;
|
|
854
928
|
/** A task supplied at open, for one session, instead of a bundled scenario.
|
|
855
929
|
* `instruction` is what the agent is told; without `seed` the session starts
|
|
@@ -917,6 +991,101 @@ type WorldSessionTask = {
|
|
|
917
991
|
version?: number | null;
|
|
918
992
|
metadata: Record<string, unknown>;
|
|
919
993
|
};
|
|
994
|
+
|
|
995
|
+
/**
|
|
996
|
+
* The three shapes a task reaches `openSession` in — a bundled scenario's
|
|
997
|
+
* name, a stored task's `{ id, version? }`, an inline spec — and how each is
|
|
998
|
+
* told apart, labelled and checked. No task at all (`undefined`) is the
|
|
999
|
+
* fourth case, an exploratory session, and is not a ref.
|
|
1000
|
+
*/
|
|
1001
|
+
declare const isTaskIdRef: (task: WorldTaskRef) => task is WorldTaskIdRef;
|
|
1002
|
+
declare const isTaskSpec: (task: WorldTaskRef) => task is WorldTaskSpec;
|
|
1003
|
+
/** The label a task goes by in results: its name, `inline:<hash>` for an
|
|
1004
|
+
* unnamed inline task once the platform has hashed it, or the stored task's
|
|
1005
|
+
* name (its id until the platform has answered). */
|
|
1006
|
+
declare const taskLabel: (task: WorldTaskRef, info?: WorldSessionTask | null) => string;
|
|
1007
|
+
/** A task given to `openSession` must be one of the three shapes. */
|
|
1008
|
+
declare const assertTaskRef: (task: WorldTaskRef) => void;
|
|
1009
|
+
|
|
1010
|
+
declare class WorldSessionTimeout extends Error {
|
|
1011
|
+
}
|
|
1012
|
+
declare class WorldSessionCallError extends Error {
|
|
1013
|
+
}
|
|
1014
|
+
/** The session ended before it was ready: it FAILED to open, or was STOPPED.
|
|
1015
|
+
* `code` is the platform's when it named one; `browser_capacity` and
|
|
1016
|
+
* `host_unavailable` are worth opening again. */
|
|
1017
|
+
declare class WorldSessionOpenFailed extends WorldSessionCallError {
|
|
1018
|
+
readonly sessionId: string;
|
|
1019
|
+
readonly state: string;
|
|
1020
|
+
readonly code: string | null;
|
|
1021
|
+
constructor(sessionId: string, state: string, code: string | null, reason: string | null);
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
/**
|
|
1025
|
+
* LIVE WORLD SESSIONS from TypeScript: your agent, the platform's container.
|
|
1026
|
+
*
|
|
1027
|
+
* The other two ways of running a world each give up something. Pulling the
|
|
1028
|
+
* bundle and executing it locally tests your agent against a COPY — your
|
|
1029
|
+
* python, your sqlite, your machine's idea of the environment. Dispatching a
|
|
1030
|
+
* hosted run gives you the real container but runs the platform's agent
|
|
1031
|
+
* inside it, so your agent never touches the world.
|
|
1032
|
+
*
|
|
1033
|
+
* A session is both: the platform boots the task's container and holds it
|
|
1034
|
+
* warm, and every `call()` here executes inside THAT container. Your agent
|
|
1035
|
+
* stays where it is — this file is just the wire.
|
|
1036
|
+
*
|
|
1037
|
+
* const world = await openWorld("revenue-ops-sim@main");
|
|
1038
|
+
* const session = await openSession(world.slug, { task: "revops-mara-dedupe-contacts" });
|
|
1039
|
+
* await session.ready(); // wait for the container
|
|
1040
|
+
* await session.call("crm_search", { entity: "deals" });
|
|
1041
|
+
* await session.withTraceContext(() => myAgent(session)); // traced under session.sessionId
|
|
1042
|
+
* const { reward, rewards } = await session.grade();
|
|
1043
|
+
* await session.close({ keepWarm: true }); // hand it back to the pool
|
|
1044
|
+
*
|
|
1045
|
+
* The task can also be YOURS rather than the bundle's — an instruction, the
|
|
1046
|
+
* rows the session starts with and how it is graded, for one end user:
|
|
1047
|
+
*
|
|
1048
|
+
* const session = await openSession("acme-billing@main", {
|
|
1049
|
+
* task: {
|
|
1050
|
+
* instruction: "Mark invoice INV-7 as paid.",
|
|
1051
|
+
* seed: { rows: { invoices: [{ id: "INV-7", status: "open" }] } },
|
|
1052
|
+
* grader: { kind: "assertions", checks: [
|
|
1053
|
+
* { entity: "invoices", where: { id: "INV-7", status: "paid" } },
|
|
1054
|
+
* ] },
|
|
1055
|
+
* metadata: { externalUserId: "u_42" },
|
|
1056
|
+
* },
|
|
1057
|
+
* surfaces: ["api"],
|
|
1058
|
+
* });
|
|
1059
|
+
*
|
|
1060
|
+
* Every call is a row on the platform before it is an effect in a container,
|
|
1061
|
+
* so the episode is on the record — and the platform traces the session
|
|
1062
|
+
* itself, which is why these sessions show up under Sessions without the
|
|
1063
|
+
* caller instrumenting anything.
|
|
1064
|
+
*/
|
|
1065
|
+
type WorldToolSpec = {
|
|
1066
|
+
name: string;
|
|
1067
|
+
/** The world's own signature, e.g. `crm_search(q=None, entity="deals")`. */
|
|
1068
|
+
signature: string;
|
|
1069
|
+
doc: string | null;
|
|
1070
|
+
inputSchema?: Record<string, unknown>;
|
|
1071
|
+
};
|
|
1072
|
+
/** What a model needs to call a world: the schemas to advertise, and the
|
|
1073
|
+
* implementations that run them in the container. */
|
|
1074
|
+
type WorldToolkit = {
|
|
1075
|
+
/** OpenAI-shaped tool definitions, derived from the world's signatures. */
|
|
1076
|
+
schemas: {
|
|
1077
|
+
type: "function";
|
|
1078
|
+
function: {
|
|
1079
|
+
name: string;
|
|
1080
|
+
description: string;
|
|
1081
|
+
parameters: Record<string, unknown>;
|
|
1082
|
+
};
|
|
1083
|
+
}[];
|
|
1084
|
+
/** name -> implementation, each one a call into THIS session. */
|
|
1085
|
+
impls: Record<string, (args: Record<string, unknown>) => Promise<unknown>>;
|
|
1086
|
+
specs: WorldToolSpec[];
|
|
1087
|
+
};
|
|
1088
|
+
|
|
920
1089
|
type SeedResult = {
|
|
921
1090
|
seeded: number;
|
|
922
1091
|
mode: "append" | "replace";
|
|
@@ -957,6 +1126,22 @@ type WorldSessionState = {
|
|
|
957
1126
|
* schema worlds are the supported shape), with what to run instead. Empty
|
|
958
1127
|
* for a schema world; absent on platforms that predate the notice. */
|
|
959
1128
|
deprecations?: WorldDeprecation[];
|
|
1129
|
+
/** Why a FAILED session failed to open, when the platform named it. */
|
|
1130
|
+
failure?: {
|
|
1131
|
+
code: string | null;
|
|
1132
|
+
message: string;
|
|
1133
|
+
} | null;
|
|
1134
|
+
};
|
|
1135
|
+
/** A request the old world received has an `at` before `boundaryAt`; one the new world received, after it. */
|
|
1136
|
+
type WorldSessionRestart = {
|
|
1137
|
+
previousVersionId: string;
|
|
1138
|
+
versionId: string;
|
|
1139
|
+
pin: {
|
|
1140
|
+
ref: string | null;
|
|
1141
|
+
versionId: string | null;
|
|
1142
|
+
};
|
|
1143
|
+
boundarySeq: number;
|
|
1144
|
+
boundaryAt: string;
|
|
960
1145
|
};
|
|
961
1146
|
/** One notice a worlds-path answer carries: a deprecated shape or layout
|
|
962
1147
|
* and the command that replaces it. A retired shape is refused instead,
|
|
@@ -966,45 +1151,7 @@ type WorldDeprecation = {
|
|
|
966
1151
|
message: string;
|
|
967
1152
|
replacement: string;
|
|
968
1153
|
};
|
|
969
|
-
|
|
970
|
-
reward: number | null;
|
|
971
|
-
rewards: Record<string, number>;
|
|
972
|
-
/** Why there is no reward: `no grader` on an exploratory session. */
|
|
973
|
-
reason?: string;
|
|
974
|
-
/** The task's cross-world verifiers anchored on this session, by name:
|
|
975
|
-
* each its own reward and named rewards, or `error` when it could not
|
|
976
|
-
* grade (evidence missing, verify.py failed) — null, never zero. */
|
|
977
|
-
verifiers?: Record<string, VerifierGrade>;
|
|
978
|
-
raw: unknown;
|
|
979
|
-
};
|
|
980
|
-
type VerifierGrade = {
|
|
981
|
-
reward: number | null;
|
|
982
|
-
rewards: Record<string, number>;
|
|
983
|
-
error?: string;
|
|
984
|
-
};
|
|
985
|
-
declare const modelToolName: (name: string) => string;
|
|
986
|
-
/**
|
|
987
|
-
* Turn a world's Python signature into a JSON schema the model can call.
|
|
988
|
-
*
|
|
989
|
-
* `crm_update_deal(id, stage=None, owner=None, amount=None)` becomes an
|
|
990
|
-
* object with `id` required and the rest optional. Types are read from the
|
|
991
|
-
* DEFAULTS the world declares — a numeric default means a number, a boolean
|
|
992
|
-
* default a boolean — because that is the only type information a signature
|
|
993
|
-
* actually carries. Everything else is a string, which is what a tool CLI
|
|
994
|
-
* receives anyway.
|
|
995
|
-
*/
|
|
996
|
-
declare function schemaFromSignature(spec: WorldToolSpec): {
|
|
997
|
-
type: "function";
|
|
998
|
-
function: {
|
|
999
|
-
name: string;
|
|
1000
|
-
description: string;
|
|
1001
|
-
parameters: Record<string, unknown>;
|
|
1002
|
-
};
|
|
1003
|
-
};
|
|
1004
|
-
declare class WorldSessionTimeout extends Error {
|
|
1005
|
-
}
|
|
1006
|
-
declare class WorldSessionCallError extends Error {
|
|
1007
|
-
}
|
|
1154
|
+
|
|
1008
1155
|
declare class WorldSession {
|
|
1009
1156
|
readonly sessionId: string;
|
|
1010
1157
|
private current;
|
|
@@ -1038,9 +1185,9 @@ declare class WorldSession {
|
|
|
1038
1185
|
surfaces(): Promise<SessionSurfaces>;
|
|
1039
1186
|
/** Base URL of the world's own HTTP API for this session. */
|
|
1040
1187
|
api(): Promise<string>;
|
|
1041
|
-
/** Headers every request to `api()` needs
|
|
1042
|
-
*
|
|
1043
|
-
* world's own declared auth
|
|
1188
|
+
/** Headers every request to `api()` needs: a World Host session's token in the
|
|
1189
|
+
* platform's `X-World-Session` header, which every world takes; `{}` for a pod
|
|
1190
|
+
* or hosted twin, which answers with the world's own declared auth. */
|
|
1044
1191
|
apiHeaders(): Promise<Record<string, string>>;
|
|
1045
1192
|
/** URL of the world's UI entry page for this session. */
|
|
1046
1193
|
ui(): Promise<string>;
|
|
@@ -1075,9 +1222,20 @@ declare class WorldSession {
|
|
|
1075
1222
|
nativeComputer<P extends NativeComputerProvider = "anthropic">(browser: WorldBrowser, provider?: P, options?: NativeComputerOptions): NativeComputerKinds[P];
|
|
1076
1223
|
/** The session's latest platform state (one request, no waiting). */
|
|
1077
1224
|
status(): Promise<WorldSessionState>;
|
|
1225
|
+
/** The world started over under the same id, URLs and token, on what its pin (or `version`, which becomes
|
|
1226
|
+
* its pin) resolves to now: base data plus the task's seed. A grade then reads only the new world's requests. */
|
|
1227
|
+
restart(opts?: {
|
|
1228
|
+
version?: string;
|
|
1229
|
+
}): Promise<WorldSessionState & {
|
|
1230
|
+
restart: WorldSessionRestart;
|
|
1231
|
+
}>;
|
|
1232
|
+
private refresh;
|
|
1078
1233
|
/**
|
|
1079
|
-
* Wait until the
|
|
1080
|
-
* asked the platform for work
|
|
1234
|
+
* Wait until the session answers calls: a World Host holds it, or the
|
|
1235
|
+
* process inside a pod has asked the platform for work. Throws
|
|
1236
|
+
* `WorldSessionOpenFailed` (with the platform's reason) when it ended
|
|
1237
|
+
* first, and `WorldSessionTimeout` when `timeoutMs` (default ten minutes)
|
|
1238
|
+
* ran out while it was still starting.
|
|
1081
1239
|
*/
|
|
1082
1240
|
ready(opts?: {
|
|
1083
1241
|
timeoutMs?: number;
|
|
@@ -1119,7 +1277,9 @@ declare class WorldSession {
|
|
|
1119
1277
|
* calls); assertions and python graders ignore it. `worlds` names the
|
|
1120
1278
|
* task's other sessions by alias (`{alias: sessionId}`): the platform
|
|
1121
1279
|
* reads each one's evidence and hands it to the cross-world verifiers
|
|
1122
|
-
* anchored on this session, whose grades come back under `verifiers`.
|
|
1280
|
+
* anchored on this session, whose grades come back under `verifiers`. A
|
|
1281
|
+
* score that is not a number from 0 to 1 is refused by key and value
|
|
1282
|
+
* (`GradeRefused`); a verifier's is that verifier's `error`. */
|
|
1123
1283
|
grade(opts?: {
|
|
1124
1284
|
timeoutMs?: number;
|
|
1125
1285
|
report?: string;
|
|
@@ -1151,6 +1311,14 @@ declare class WorldSession {
|
|
|
1151
1311
|
reset(opts?: {
|
|
1152
1312
|
timeoutMs?: number;
|
|
1153
1313
|
}): Promise<void>;
|
|
1314
|
+
/** One page of the session's entries in its world's request ledger, newest
|
|
1315
|
+
* first and without bodies: at most `limit` after `cursor` (the last page's
|
|
1316
|
+
* `nextCursor`). Reading it records nothing in the session. */
|
|
1317
|
+
requests(opts?: {
|
|
1318
|
+
cursor?: string;
|
|
1319
|
+
limit?: number;
|
|
1320
|
+
}): Promise<WorldRequestPage>;
|
|
1321
|
+
private page;
|
|
1154
1322
|
/** The session's call log, oldest first: every tool call, seed, reset,
|
|
1155
1323
|
* grade with its result — the record of the episode. */
|
|
1156
1324
|
export(): Promise<WorldSessionCall[]>;
|
|
@@ -1205,6 +1373,10 @@ type OpenSessionOptions = {
|
|
|
1205
1373
|
/** Capacity for a World Host session's browser: `standard` (spot, may be
|
|
1206
1374
|
* reclaimed) or `premium` (on-demand). Unset, the organization's default. */
|
|
1207
1375
|
browserTier?: BrowserTier;
|
|
1376
|
+
/** `open`: the session asks for no credential; its api and ui answer on a
|
|
1377
|
+
* capability hostname whose url is the secret. Unset, the world's
|
|
1378
|
+
* `[auth] mode`. World Host sessions only. */
|
|
1379
|
+
auth?: SessionAuthMode;
|
|
1208
1380
|
options?: WorldsClientOptions;
|
|
1209
1381
|
};
|
|
1210
1382
|
/**
|
|
@@ -1340,6 +1512,15 @@ declare function runSessions(opts: {
|
|
|
1340
1512
|
*/
|
|
1341
1513
|
declare const SURFACE_KINDS: readonly ["tools", "api", "ui", "browser"];
|
|
1342
1514
|
type WorldSurfaceKind = (typeof SURFACE_KINDS)[number];
|
|
1515
|
+
/** The platform's own header for a session's token, which a World Host takes on
|
|
1516
|
+
* every world whatever its vendor's auth; no vendor's client sends it. */
|
|
1517
|
+
declare const PLATFORM_SESSION_HEADER = "X-World-Session";
|
|
1518
|
+
declare const SESSION_AUTH_MODES: readonly ["vendor", "open"];
|
|
1519
|
+
/** `open`: the session asks for no credential, reached on its capability
|
|
1520
|
+
* hostname alone; `vendor`: the session's token, the way the world's `[auth]`
|
|
1521
|
+
* says its vendor takes a key. Unset, the world's `[auth] mode`. */
|
|
1522
|
+
type SessionAuthMode = (typeof SESSION_AUTH_MODES)[number];
|
|
1523
|
+
declare function assertSessionAuthMode(value: unknown): asserts value is SessionAuthMode;
|
|
1343
1524
|
/** Capacity behind a World Host session's browser. `standard` runs on spot
|
|
1344
1525
|
* capacity first (about half the price) and may be reclaimed with two
|
|
1345
1526
|
* minutes' notice, ending the browser but never the world; `premium` is
|
|
@@ -1367,11 +1548,14 @@ type SessionSurfaces = {
|
|
|
1367
1548
|
};
|
|
1368
1549
|
api?: {
|
|
1369
1550
|
url: string;
|
|
1370
|
-
/** Per-session credential of a World Host session: send it
|
|
1371
|
-
* `
|
|
1372
|
-
*
|
|
1373
|
-
* itself answers with its declared auth (a pod or a customer-hosted twin)
|
|
1551
|
+
/** Per-session credential of a World Host session: send it in the
|
|
1552
|
+
* platform's `X-World-Session` header (`apiHeaders()`), or the way the
|
|
1553
|
+
* world's `[auth]` says its vendor takes a key. Absent when the world
|
|
1554
|
+
* itself answers with its declared auth (a pod or a customer-hosted twin),
|
|
1555
|
+
* and for an open session, whose url is its secret. */
|
|
1374
1556
|
token?: string;
|
|
1557
|
+
/** `open`: `url` is the session's capability hostname; send no credential. */
|
|
1558
|
+
auth?: "open";
|
|
1375
1559
|
};
|
|
1376
1560
|
ui?: {
|
|
1377
1561
|
url: string;
|
|
@@ -1381,8 +1565,10 @@ type SessionSurfaces = {
|
|
|
1381
1565
|
apiPath?: string | null;
|
|
1382
1566
|
/** Per-session credential of a World Host UI. A browser navigation cannot
|
|
1383
1567
|
* carry a header, so the first page load presents it once as `?token=`
|
|
1384
|
-
* and the host answers with an HttpOnly cookie. Absent for pod UIs
|
|
1568
|
+
* and the host answers with an HttpOnly cookie. Absent for pod UIs and
|
|
1569
|
+
* open sessions. */
|
|
1385
1570
|
token?: string;
|
|
1571
|
+
auth?: "open";
|
|
1386
1572
|
};
|
|
1387
1573
|
browser?: {
|
|
1388
1574
|
wsUrl: string;
|
|
@@ -1460,10 +1646,10 @@ type BrowserActionEvent = {
|
|
|
1460
1646
|
/** base64 JPEG of the screen after the action; null if it could not be taken. */
|
|
1461
1647
|
screenshot: string | null;
|
|
1462
1648
|
};
|
|
1463
|
-
/**
|
|
1464
|
-
*
|
|
1465
|
-
*
|
|
1466
|
-
|
|
1649
|
+
/** The secret label of an open session's capability hostname in `url`
|
|
1650
|
+
* (`o-<sid>-<label>[-api].<domain>`), else null: a credential, scrubbed from
|
|
1651
|
+
* everything a browser records. Twin of the Python `capability_label`. */
|
|
1652
|
+
declare function capabilityLabel(url: string | null | undefined): string | null;
|
|
1467
1653
|
declare function redactActionArgs(action: string, args: Record<string, unknown>): Record<string, unknown>;
|
|
1468
1654
|
/**
|
|
1469
1655
|
* Ships browser action events to the platform, off the action's hot path.
|
|
@@ -1693,9 +1879,7 @@ type ListSessionsFilter = {
|
|
|
1693
1879
|
declare function listSessions(filter?: ListSessionsFilter, options?: WorldsClientOptions): Promise<WorldSessionListItem[]>;
|
|
1694
1880
|
|
|
1695
1881
|
/**
|
|
1696
|
-
*
|
|
1697
|
-
*
|
|
1698
|
-
* The platform declares them once in
|
|
1882
|
+
* The platform declares these once in
|
|
1699
1883
|
* `gateway/packages/shared/src/server/services/worldSessionContract.ts`; this
|
|
1700
1884
|
* module and `gatewaysdk/environment/world_session_contract.py` repeat them, and each is
|
|
1701
1885
|
* pinned to `conformance/world-sessions.json` by a test, so the route, the
|
|
@@ -1708,6 +1892,12 @@ declare const CALL_BODY_LIMIT_BYTES: number;
|
|
|
1708
1892
|
declare const CALL_BODY_LIMIT_LABEL = "4mb";
|
|
1709
1893
|
/** `session status` warns once an unpinned session has less than this left. */
|
|
1710
1894
|
declare const IDLE_WARNING_MINUTES = 5;
|
|
1895
|
+
/** The most entries one page of a world's request ledger holds. */
|
|
1896
|
+
declare const REQUEST_LOG_PAGE_MAX = 200;
|
|
1897
|
+
/** How much of each body the request ledger keeps: the first this many bytes of its text. */
|
|
1898
|
+
declare const REQUEST_BODY_CAPTURE_BYTES: number;
|
|
1899
|
+
/** The code a session the World Host did not serve answers its request ledger read with. */
|
|
1900
|
+
declare const REQUESTS_NOT_RECORDED = "requests_not_recorded";
|
|
1711
1901
|
/** The task an exploratory session runs on when the caller names none, and
|
|
1712
1902
|
* the `task.source` the platform reports for it. */
|
|
1713
1903
|
declare const EXPLORATORY_TASK: Readonly<{
|
|
@@ -1733,12 +1923,109 @@ declare class WorldCallTooLarge extends Error {
|
|
|
1733
1923
|
size: number;
|
|
1734
1924
|
};
|
|
1735
1925
|
}
|
|
1736
|
-
/** Measure a call body the way the route will and refuse an oversized one
|
|
1737
|
-
* before it leaves the machine. Returns the serialized body. */
|
|
1738
|
-
declare function serializeCallBody(body: unknown): string;
|
|
1739
|
-
/**
|
|
1740
|
-
|
|
1741
|
-
|
|
1926
|
+
/** Measure a call body the way the route will and refuse an oversized one
|
|
1927
|
+
* before it leaves the machine. Returns the serialized body. */
|
|
1928
|
+
declare function serializeCallBody(body: unknown): string;
|
|
1929
|
+
/** What `session open` adds when its wait ran out: the session keeps opening. */
|
|
1930
|
+
declare const stillStartingHint: (sessionId: string) => string;
|
|
1931
|
+
/** The line `session status` prints when an unpinned session has under
|
|
1932
|
+
* `IDLE_WARNING_MINUTES` left, else null. `now` is for tests. */
|
|
1933
|
+
declare function idleWarning(idleExpiresAt: string | null | undefined, now?: Date): string | null;
|
|
1934
|
+
|
|
1935
|
+
type TaskTrialRequest = {
|
|
1936
|
+
seq: number;
|
|
1937
|
+
at: string;
|
|
1938
|
+
via: string | null;
|
|
1939
|
+
operation: string | null;
|
|
1940
|
+
method: string | null;
|
|
1941
|
+
path: string | null;
|
|
1942
|
+
status: number;
|
|
1943
|
+
};
|
|
1944
|
+
type TaskTrialCheck = {
|
|
1945
|
+
passed: boolean;
|
|
1946
|
+
reason?: string;
|
|
1947
|
+
matched: TaskTrialRequest[];
|
|
1948
|
+
maybe: TaskTrialRequest[];
|
|
1949
|
+
};
|
|
1950
|
+
type GradedJournal = {
|
|
1951
|
+
complete: boolean;
|
|
1952
|
+
reason: string | null;
|
|
1953
|
+
requests: number;
|
|
1954
|
+
throughSeq: number | null;
|
|
1955
|
+
};
|
|
1956
|
+
/** A task's grader over one stored World Host session, filed nowhere. */
|
|
1957
|
+
type TaskTrial = {
|
|
1958
|
+
sessionId: string;
|
|
1959
|
+
taskId: string | null;
|
|
1960
|
+
version: number | null;
|
|
1961
|
+
graded: "live" | "checkpoint" | "journal";
|
|
1962
|
+
reward: number | null;
|
|
1963
|
+
rewards: Record<string, number | null>;
|
|
1964
|
+
reasons: Record<string, string>;
|
|
1965
|
+
reason: string | null;
|
|
1966
|
+
checks: Record<string, TaskTrialCheck>;
|
|
1967
|
+
journal: GradedJournal | null;
|
|
1968
|
+
summary: {
|
|
1969
|
+
via: string | null;
|
|
1970
|
+
operation: string | null;
|
|
1971
|
+
method: string | null;
|
|
1972
|
+
status: number;
|
|
1973
|
+
count: number;
|
|
1974
|
+
path: string | null;
|
|
1975
|
+
}[];
|
|
1976
|
+
};
|
|
1977
|
+
type RegradedRollout = {
|
|
1978
|
+
sampleId: string;
|
|
1979
|
+
sessionId: string | null;
|
|
1980
|
+
state: "regraded" | "skipped";
|
|
1981
|
+
reward: number | null;
|
|
1982
|
+
previous: {
|
|
1983
|
+
reward: number | null;
|
|
1984
|
+
verifierVersion: number | null;
|
|
1985
|
+
};
|
|
1986
|
+
reason?: string;
|
|
1987
|
+
graded?: TaskTrial["graded"];
|
|
1988
|
+
rewards?: Record<string, number | null>;
|
|
1989
|
+
reasons?: Record<string, string>;
|
|
1990
|
+
};
|
|
1991
|
+
type TaskRegrade = {
|
|
1992
|
+
taskId: string;
|
|
1993
|
+
version: number;
|
|
1994
|
+
runs: {
|
|
1995
|
+
evaluationId: string;
|
|
1996
|
+
verifierVersions: number[];
|
|
1997
|
+
verifiers: string | null;
|
|
1998
|
+
reward: number | null;
|
|
1999
|
+
rollouts: RegradedRollout[];
|
|
2000
|
+
}[];
|
|
2001
|
+
regraded: number;
|
|
2002
|
+
skipped: number;
|
|
2003
|
+
};
|
|
2004
|
+
type TaskTrialTarget = {
|
|
2005
|
+
taskId: string;
|
|
2006
|
+
version?: number;
|
|
2007
|
+
} | {
|
|
2008
|
+
spec: WorldTaskSpec;
|
|
2009
|
+
};
|
|
2010
|
+
type TaskRegradeScope = {
|
|
2011
|
+
version?: number;
|
|
2012
|
+
runs?: string[];
|
|
2013
|
+
allRuns?: boolean;
|
|
2014
|
+
sessions?: string[];
|
|
2015
|
+
limit?: number;
|
|
2016
|
+
};
|
|
2017
|
+
/**
|
|
2018
|
+
* A stored task's grader over stored World Host sessions: `try` grades one
|
|
2019
|
+
* session and files nothing (each check with the journal requests it
|
|
2020
|
+
* matched), `regrade` grades a task's past runs again by one of its versions
|
|
2021
|
+
* and files the grades in place. Twin of the Python `TaskGrades`.
|
|
2022
|
+
*/
|
|
2023
|
+
declare class TaskGrades {
|
|
2024
|
+
private readonly options;
|
|
2025
|
+
constructor(options?: WorldsClientOptions);
|
|
2026
|
+
try(sessionId: string, target: TaskTrialTarget): Promise<TaskTrial>;
|
|
2027
|
+
regrade(taskId: string, scope?: TaskRegradeScope): Promise<TaskRegrade>;
|
|
2028
|
+
}
|
|
1742
2029
|
|
|
1743
2030
|
/** Where a session answers, in the shape `session open` prints and a
|
|
1744
2031
|
* `task up` manifest keeps per world. */
|
|
@@ -1747,6 +2034,7 @@ type SurfaceDescriptor = {
|
|
|
1747
2034
|
api?: {
|
|
1748
2035
|
url: string;
|
|
1749
2036
|
token?: string;
|
|
2037
|
+
auth?: "open";
|
|
1750
2038
|
};
|
|
1751
2039
|
ui?: {
|
|
1752
2040
|
url: string;
|
|
@@ -1769,23 +2057,17 @@ type WorldTaskWorld = {
|
|
|
1769
2057
|
grader?: WorldTaskSpec["grader"];
|
|
1770
2058
|
tools?: string[];
|
|
1771
2059
|
};
|
|
1772
|
-
/** One world's session as the platform answered it at up.
|
|
1773
|
-
* world came up on the caller's own unsealed edits (its edit session's tip
|
|
1774
|
-
* answered `main`). */
|
|
2060
|
+
/** One world's session as the platform answered it at up. */
|
|
1775
2061
|
type TaskWorldSessionState = WorldSessionState & {
|
|
1776
2062
|
alias: string;
|
|
1777
2063
|
slug: string;
|
|
1778
2064
|
ref: string;
|
|
1779
|
-
private: boolean;
|
|
1780
2065
|
reusedWarm: boolean;
|
|
1781
2066
|
};
|
|
1782
|
-
/** Which world an alias is, as recorded at up or attach.
|
|
1783
|
-
* when it is not known (attached by task id, or a manifest written before
|
|
1784
|
-
* the platform reported it). */
|
|
2067
|
+
/** Which world an alias is, as recorded at up or attach. */
|
|
1785
2068
|
type TaskWorldRef = {
|
|
1786
2069
|
slug: string;
|
|
1787
2070
|
ref: string | null;
|
|
1788
|
-
private: boolean | null;
|
|
1789
2071
|
};
|
|
1790
2072
|
/** What `POST /world-task-sessions` answers. */
|
|
1791
2073
|
type TaskSessionsResponse = {
|
|
@@ -1801,7 +2083,6 @@ type TaskSessionsResponse = {
|
|
|
1801
2083
|
type TaskManifestSession = {
|
|
1802
2084
|
slug: string;
|
|
1803
2085
|
ref: string | null;
|
|
1804
|
-
private: boolean | null;
|
|
1805
2086
|
versionId: string;
|
|
1806
2087
|
sessionId: string;
|
|
1807
2088
|
ready: boolean;
|
|
@@ -1835,22 +2116,28 @@ type LiveTaskSession = {
|
|
|
1835
2116
|
* is listed under `ungraded` (a verifier as `x.<name>`), never counted as
|
|
1836
2117
|
* 0. `rewards` flattens each world's named rewards as `<alias>.<key>`
|
|
1837
2118
|
* beside `<alias>` for the world's own reward, and a verifier's as
|
|
1838
|
-
* `x.<name>` / `x.<name>.<key>`.
|
|
2119
|
+
* `x.<name>` / `x.<name>.<key>`. `errors` names, by key, each world or
|
|
2120
|
+
* verifier that could not grade and each key two rewards claimed; any error
|
|
2121
|
+
* makes `reward` null, never the mean of the rest. */
|
|
1839
2122
|
type TaskGrade = {
|
|
1840
2123
|
reward: number | null;
|
|
1841
2124
|
rewards: Record<string, number>;
|
|
1842
2125
|
worlds: Record<string, GradeResult>;
|
|
1843
2126
|
ungraded: string[];
|
|
1844
2127
|
verifiers: Record<string, VerifierGrade>;
|
|
2128
|
+
errors: Record<string, string>;
|
|
1845
2129
|
};
|
|
1846
|
-
/** A cross-world verifier's rewards flatten under `x.<name
|
|
1847
|
-
*
|
|
2130
|
+
/** A cross-world verifier's rewards flatten under `x.<name>`. The platform
|
|
2131
|
+
* refuses `x` and `x.<…>` as a world alias, and the fold refuses a key two
|
|
2132
|
+
* rewards claim, so a world's check never scores as a verifier. */
|
|
1848
2133
|
declare const VERIFIER_REWARD_PREFIX = "x.";
|
|
1849
2134
|
/** Every world's call log, keyed by alias. */
|
|
1850
2135
|
type TaskExport = Record<string, WorldSessionCall[]>;
|
|
1851
2136
|
/** Combine per-world grades into the task's. Pure, so the CLI and the tests
|
|
1852
2137
|
* share it with `TaskSessions.grade()`. */
|
|
1853
2138
|
declare function aggregateTaskGrade(worlds: Record<string, GradeResult>): TaskGrade;
|
|
2139
|
+
/** Every error of a task's grade on one line (`<key>: <why>; …`), or null. */
|
|
2140
|
+
declare function taskGradeError(grade: TaskGrade): string | null;
|
|
1854
2141
|
declare class TaskSessions {
|
|
1855
2142
|
/** The stored task's id, or null for a task given as a spec. */
|
|
1856
2143
|
readonly taskId: string | null;
|
|
@@ -1897,7 +2184,9 @@ declare class TaskSessions {
|
|
|
1897
2184
|
* agent's own account of the whole investigation) goes to every world's
|
|
1898
2185
|
* judge; a world graded by assertions or python ignores it. Each grade
|
|
1899
2186
|
* names the task's other sessions by alias, so the cross-world verifiers
|
|
1900
|
-
* anchored on that world can read them.
|
|
2187
|
+
* anchored on that world can read them. A world whose grade call fails is
|
|
2188
|
+
* that world's error: the task's grade names it and keeps every other
|
|
2189
|
+
* world's grade. */
|
|
1901
2190
|
grade(opts?: {
|
|
1902
2191
|
timeoutMs?: number;
|
|
1903
2192
|
report?: string;
|
|
@@ -1952,6 +2241,74 @@ declare function attachManifest(manifest: TaskManifest, options?: WorldsClientOp
|
|
|
1952
2241
|
* rather than a task spec. */
|
|
1953
2242
|
declare function isTaskManifest(value: unknown): value is TaskManifest;
|
|
1954
2243
|
|
|
2244
|
+
type EvalSample = {
|
|
2245
|
+
exampleId: string;
|
|
2246
|
+
task?: string;
|
|
2247
|
+
rolloutIndex?: number;
|
|
2248
|
+
prompt?: unknown;
|
|
2249
|
+
completion?: unknown;
|
|
2250
|
+
reward?: number;
|
|
2251
|
+
score?: number;
|
|
2252
|
+
correct?: boolean;
|
|
2253
|
+
/** A number, or null for a check that answered nothing; the platform refuses anything else. */
|
|
2254
|
+
rewards?: Record<string, number | null>;
|
|
2255
|
+
info?: Record<string, unknown>;
|
|
2256
|
+
};
|
|
2257
|
+
type CreateEvaluationOptions = {
|
|
2258
|
+
model?: string;
|
|
2259
|
+
/** A set run to file under; the platform refuses a run that does not admit this result. */
|
|
2260
|
+
runId?: string;
|
|
2261
|
+
rolloutsPerExample?: number;
|
|
2262
|
+
metadata?: Record<string, unknown>;
|
|
2263
|
+
/** Keys the filing: a repeated create answers the first evaluation, and every step of it is retried on a gateway
|
|
2264
|
+
* 5xx or no answer, since the platform answers a repeated step with the first one. */
|
|
2265
|
+
idempotencyKey?: string;
|
|
2266
|
+
};
|
|
2267
|
+
type FinalizeEvaluationOptions = {
|
|
2268
|
+
status?: "COMPLETED" | "FAILED";
|
|
2269
|
+
metrics?: Record<string, unknown>;
|
|
2270
|
+
};
|
|
2271
|
+
declare class GatewayEvalsClient {
|
|
2272
|
+
private readonly options;
|
|
2273
|
+
private readonly retry;
|
|
2274
|
+
private readonly keyed;
|
|
2275
|
+
constructor(options?: WorldsClientOptions, retry?: RetryPolicy);
|
|
2276
|
+
createEvaluation(versionId: string, opts?: CreateEvaluationOptions): Promise<string>;
|
|
2277
|
+
pushSamples(evaluationId: string, samples: EvalSample[]): Promise<number>;
|
|
2278
|
+
finalizeEvaluation(evaluationId: string, opts?: FinalizeEvaluationOptions): Promise<string>;
|
|
2279
|
+
private retryFor;
|
|
2280
|
+
}
|
|
2281
|
+
|
|
2282
|
+
type RunTaskSummary = {
|
|
2283
|
+
runId: string;
|
|
2284
|
+
taskId: string | null;
|
|
2285
|
+
taskVersion: number | null;
|
|
2286
|
+
name: string | null;
|
|
2287
|
+
instruction: string;
|
|
2288
|
+
model: string;
|
|
2289
|
+
aliases: string[];
|
|
2290
|
+
reward: number | null;
|
|
2291
|
+
rewards: Record<string, number>;
|
|
2292
|
+
ungraded: string[];
|
|
2293
|
+
agentError: string | null;
|
|
2294
|
+
/** Why the run stopped short of a grade (a world that never came up, an interrupt); filed FAILED with it. */
|
|
2295
|
+
runError: string | null;
|
|
2296
|
+
/** The grade's errors on one line (a world or verifier that could not grade, two rewards under one key); filed FAILED with it. */
|
|
2297
|
+
gradeError: string | null;
|
|
2298
|
+
/** Why the evaluation could not be filed; `filed` is then false. */
|
|
2299
|
+
fileError: string | null;
|
|
2300
|
+
/** The status the platform settled the filed evaluation at; null when nothing was filed. */
|
|
2301
|
+
evaluationStatus: string | null;
|
|
2302
|
+
report: string | null;
|
|
2303
|
+
traced: boolean;
|
|
2304
|
+
runDir: string;
|
|
2305
|
+
durationSeconds: number;
|
|
2306
|
+
notes: Record<string, unknown>;
|
|
2307
|
+
filed: boolean;
|
|
2308
|
+
evaluationId?: string;
|
|
2309
|
+
[extra: string]: unknown;
|
|
2310
|
+
};
|
|
2311
|
+
|
|
1955
2312
|
declare class TaskRun {
|
|
1956
2313
|
readonly runId: string;
|
|
1957
2314
|
readonly instruction: string;
|
|
@@ -1977,9 +2334,10 @@ type RunTaskOptions = {
|
|
|
1977
2334
|
/** Directory the run's own `<runId>/` folder is created under. Default `"runs"`. */
|
|
1978
2335
|
outDir?: string;
|
|
1979
2336
|
/**
|
|
1980
|
-
*
|
|
1981
|
-
*
|
|
1982
|
-
*
|
|
2337
|
+
* Trace the agent's own spans with the host and keys the run's requests use (`options`, then
|
|
2338
|
+
* `GATEWAY_*`). Default `true`. A `GATEWAY_OTLP_ENDPOINT` on another host is followed only with the
|
|
2339
|
+
* environment's own keys. When tracing cannot start (the optional `@opentelemetry/*` peers are
|
|
2340
|
+
* missing, or a redirect would carry other keys), the run goes on untraced and the process warns once.
|
|
1983
2341
|
*/
|
|
1984
2342
|
trace?: boolean;
|
|
1985
2343
|
/** File one rollout when the run ends. Default `true`. */
|
|
@@ -1992,33 +2350,22 @@ type RunTaskOptions = {
|
|
|
1992
2350
|
setRunId?: string;
|
|
1993
2351
|
options?: WorldsClientOptions;
|
|
1994
2352
|
};
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
name: string | null;
|
|
2000
|
-
instruction: string;
|
|
2001
|
-
model: string;
|
|
2002
|
-
aliases: string[];
|
|
2003
|
-
reward: number | null;
|
|
2004
|
-
rewards: Record<string, number>;
|
|
2005
|
-
ungraded: string[];
|
|
2006
|
-
agentError: string | null;
|
|
2007
|
-
report: string | null;
|
|
2008
|
-
traced: boolean;
|
|
2009
|
-
runDir: string;
|
|
2010
|
-
durationSeconds: number;
|
|
2011
|
-
notes: Record<string, unknown>;
|
|
2012
|
-
filed: boolean;
|
|
2013
|
-
evaluationId?: string;
|
|
2014
|
-
[extra: string]: unknown;
|
|
2015
|
-
};
|
|
2353
|
+
/** The line a CLI prints before exiting 1 on a task run: the agent raised,
|
|
2354
|
+
* the run stopped short of a grade, the task could not be graded, the run
|
|
2355
|
+
* could not be filed, or the platform settled it failed; null when none. */
|
|
2356
|
+
declare function taskRunFailure(summary: RunTaskSummary): string | null;
|
|
2016
2357
|
type TaskRunResult = string | {
|
|
2017
2358
|
report?: unknown;
|
|
2018
2359
|
[key: string]: unknown;
|
|
2019
2360
|
} | null | undefined;
|
|
2020
|
-
/** Mirrors `gatewaysdk.world_tasks.run_task`.
|
|
2021
|
-
*
|
|
2361
|
+
/** Mirrors `gatewaysdk.world_tasks.run_task`. Every run whose sessions opened
|
|
2362
|
+
* writes `run.json` and, unless `file: false`, files one evaluation: FAILED
|
|
2363
|
+
* with the reason when the agent raised, a world never came up, or the task
|
|
2364
|
+
* could not be graded; a failure that stops filing is `fileError`. Sessions
|
|
2365
|
+
* close unless `keepUp: true`. SIGINT or SIGTERM, from the open on, closes
|
|
2366
|
+
* them first (a signal during the open waits for the platform's answer) and
|
|
2367
|
+
* exits 128 + the signal's number. A world whose tools the platform could not
|
|
2368
|
+
* read throws `WorldToolsUnread` before the agent runs, and nothing is filed. */
|
|
2022
2369
|
declare function runTask(ref: string | WorldTaskIdRef | WorldTaskSpec, agent: (run: TaskRun) => TaskRunResult | Promise<TaskRunResult>, opts: RunTaskOptions): Promise<RunTaskSummary>;
|
|
2023
2370
|
|
|
2024
2371
|
type Checkout = {
|
|
@@ -2047,6 +2394,166 @@ declare class CheckoutProvenance {
|
|
|
2047
2394
|
private git;
|
|
2048
2395
|
}
|
|
2049
2396
|
|
|
2397
|
+
/**
|
|
2398
|
+
* Edit sessions: the version control unit for a world. Every write this
|
|
2399
|
+
* credential makes to a world (push, sandbox commit, data import, MCP, the
|
|
2400
|
+
* console editor) joins ONE open session per world per credential and lands
|
|
2401
|
+
* on that session's private branch; `close` seals the session into a version
|
|
2402
|
+
* on `main`, and a session nobody touches for an hour seals itself. Sessions
|
|
2403
|
+
* replace product-level proposals/PRs: `rollback` undoes a sealed session
|
|
2404
|
+
* (source + data together) as a new, itself-reversible session.
|
|
2405
|
+
*
|
|
2406
|
+
* One client under both `gateway worlds edit …` and `gateway bench edit …`;
|
|
2407
|
+
* the Python twin is `gatewaysdk.benchmark_hub.edit_sessions.WorldEditClient`.
|
|
2408
|
+
*/
|
|
2409
|
+
/** The person behind a credential: named while a member of the organization, otherwise a former member with no id. */
|
|
2410
|
+
type ActingUser = {
|
|
2411
|
+
status: "member";
|
|
2412
|
+
id: string;
|
|
2413
|
+
name: string | null;
|
|
2414
|
+
} | {
|
|
2415
|
+
status: "former";
|
|
2416
|
+
};
|
|
2417
|
+
/** Mirrors `WorldEditSessionSchema` (web/features/public-api/types/world-edits.ts). */
|
|
2418
|
+
type EditSessionSummary = {
|
|
2419
|
+
id: string;
|
|
2420
|
+
containerId: string;
|
|
2421
|
+
/** `apikey:<id>` for CLI/sandbox/MCP, `user:<id>` for the console, `agent:<id>` for the platform agent. */
|
|
2422
|
+
actor: string;
|
|
2423
|
+
/** The person behind `actor`, for a secret key or a member; null for a public key or when unknown. */
|
|
2424
|
+
actingUser: ActingUser | null;
|
|
2425
|
+
door: string;
|
|
2426
|
+
status: "open" | "sealing" | "sealed" | "conflict" | "expired" | "discarded" | string;
|
|
2427
|
+
baseVersionId: string | null;
|
|
2428
|
+
tipVersionId: string | null;
|
|
2429
|
+
sealedVersionId: string | null;
|
|
2430
|
+
editCount: number;
|
|
2431
|
+
startedAt: string;
|
|
2432
|
+
lastEditAt: string;
|
|
2433
|
+
expiresAt: string;
|
|
2434
|
+
closedAt: string | null;
|
|
2435
|
+
closeReason: string | null;
|
|
2436
|
+
conflictPaths: string[] | null;
|
|
2437
|
+
rollbackOfId: string | null;
|
|
2438
|
+
message: string | null;
|
|
2439
|
+
/** Set when `task edit close` sealed this session together with a task's other worlds. */
|
|
2440
|
+
sealGroupId: string | null;
|
|
2441
|
+
};
|
|
2442
|
+
type EditSessionList = {
|
|
2443
|
+
slug: string;
|
|
2444
|
+
containerId: string;
|
|
2445
|
+
/** This credential's open session, or null. */
|
|
2446
|
+
current: EditSessionSummary | null;
|
|
2447
|
+
sessions: EditSessionSummary[];
|
|
2448
|
+
};
|
|
2449
|
+
/** What close/discard/rollback return. */
|
|
2450
|
+
type EditSessionResult = {
|
|
2451
|
+
slug: string;
|
|
2452
|
+
session: EditSessionSummary;
|
|
2453
|
+
};
|
|
2454
|
+
type EditSessionListQuery = {
|
|
2455
|
+
status?: string;
|
|
2456
|
+
limit?: number;
|
|
2457
|
+
};
|
|
2458
|
+
type EditSessionCloseInput = {
|
|
2459
|
+
sessionId?: string;
|
|
2460
|
+
force?: boolean;
|
|
2461
|
+
message?: string;
|
|
2462
|
+
};
|
|
2463
|
+
type EditSessionRollbackInput = {
|
|
2464
|
+
sessionId: string;
|
|
2465
|
+
force?: boolean;
|
|
2466
|
+
message?: string;
|
|
2467
|
+
};
|
|
2468
|
+
declare class WorldEditClient {
|
|
2469
|
+
private readonly options;
|
|
2470
|
+
constructor(options?: WorldsClientOptions);
|
|
2471
|
+
/** The credential's current session and the world's newest-first sessions. */
|
|
2472
|
+
list(slug: string, query?: EditSessionListQuery): Promise<EditSessionList>;
|
|
2473
|
+
/** Seal a session into a version on main (the credential's current one when `sessionId` is omitted). */
|
|
2474
|
+
close(slug: string, input?: EditSessionCloseInput): Promise<EditSessionResult>;
|
|
2475
|
+
/** Drop the session's private branch without making a version. */
|
|
2476
|
+
discard(slug: string, input?: {
|
|
2477
|
+
sessionId?: string;
|
|
2478
|
+
}): Promise<EditSessionResult>;
|
|
2479
|
+
/** Undo a sealed session (source and data) as a new sealed session. */
|
|
2480
|
+
rollback(slug: string, input: EditSessionRollbackInput): Promise<EditSessionResult>;
|
|
2481
|
+
}
|
|
2482
|
+
/** A stored task (`{id, version?}`) or a spec with `worlds`, as `task up` takes it. */
|
|
2483
|
+
type TaskEditTarget = WorldTaskIdRef | WorldTaskSpec;
|
|
2484
|
+
/** The task the platform resolved: stored id and version, or the spec's hash. */
|
|
2485
|
+
type TaskEditTaskRef = {
|
|
2486
|
+
taskId: string | null;
|
|
2487
|
+
taskVersion: number | null;
|
|
2488
|
+
name: string | null;
|
|
2489
|
+
hash: string;
|
|
2490
|
+
};
|
|
2491
|
+
/** Mirrors `TaskEditStatusResponseSchema` (web/features/public-api/types/world-task-edits.ts). */
|
|
2492
|
+
type TaskEditStatus = {
|
|
2493
|
+
task: TaskEditTaskRef;
|
|
2494
|
+
worlds: Record<string, {
|
|
2495
|
+
slug: string;
|
|
2496
|
+
ref: string;
|
|
2497
|
+
problem: string | null;
|
|
2498
|
+
session: EditSessionSummary | null;
|
|
2499
|
+
/** This credential's sessions parked in `conflict` on the world: unsealed too. */
|
|
2500
|
+
parked: EditSessionSummary[];
|
|
2501
|
+
mainVersionId: string | null;
|
|
2502
|
+
sealNow: "fast-forward" | "rebase" | "conflict" | null;
|
|
2503
|
+
conflictPaths: string[];
|
|
2504
|
+
}>;
|
|
2505
|
+
/** Aliases whose world holds edits only this credential sees. */
|
|
2506
|
+
unsealed: string[];
|
|
2507
|
+
hint: string | null;
|
|
2508
|
+
};
|
|
2509
|
+
type TaskEditSealed = {
|
|
2510
|
+
slug: string;
|
|
2511
|
+
session: EditSessionSummary;
|
|
2512
|
+
};
|
|
2513
|
+
type TaskEditCloseResult = {
|
|
2514
|
+
task: TaskEditTaskRef;
|
|
2515
|
+
groupId: string | null;
|
|
2516
|
+
worlds: Record<string, TaskEditSealed>;
|
|
2517
|
+
skipped: Record<string, {
|
|
2518
|
+
slug: string;
|
|
2519
|
+
reason: string;
|
|
2520
|
+
}>;
|
|
2521
|
+
};
|
|
2522
|
+
type TaskEditRollbackResult = {
|
|
2523
|
+
task: TaskEditTaskRef;
|
|
2524
|
+
groupId: string;
|
|
2525
|
+
rollbackOf: string;
|
|
2526
|
+
worlds: Record<string, TaskEditSealed>;
|
|
2527
|
+
/** Members whose seal left `main` where it was: nothing to undo there. */
|
|
2528
|
+
skipped: Record<string, {
|
|
2529
|
+
slug: string;
|
|
2530
|
+
reason: string;
|
|
2531
|
+
}>;
|
|
2532
|
+
};
|
|
2533
|
+
type TaskEditCloseInput = {
|
|
2534
|
+
requireAll?: boolean;
|
|
2535
|
+
force?: boolean;
|
|
2536
|
+
message?: string;
|
|
2537
|
+
};
|
|
2538
|
+
type TaskEditRollbackInput = {
|
|
2539
|
+
groupId: string;
|
|
2540
|
+
force?: boolean;
|
|
2541
|
+
message?: string;
|
|
2542
|
+
};
|
|
2543
|
+
/**
|
|
2544
|
+
* This credential's edit sessions on every world a task names, together:
|
|
2545
|
+
* `close` seals them onto their mains in ONE platform transaction (all or
|
|
2546
|
+
* none), `rollback` undoes the seal group as one. Python twin:
|
|
2547
|
+
* `gatewaysdk.benchmark_hub.edit_sessions.TaskEditClient`.
|
|
2548
|
+
*/
|
|
2549
|
+
declare class TaskEditClient {
|
|
2550
|
+
private readonly options;
|
|
2551
|
+
constructor(options?: WorldsClientOptions);
|
|
2552
|
+
status(task: TaskEditTarget): Promise<TaskEditStatus>;
|
|
2553
|
+
close(task: TaskEditTarget, input?: TaskEditCloseInput): Promise<TaskEditCloseResult>;
|
|
2554
|
+
rollback(task: TaskEditTarget, input: TaskEditRollbackInput): Promise<TaskEditRollbackResult>;
|
|
2555
|
+
}
|
|
2556
|
+
|
|
2050
2557
|
type SetRunDoc = {
|
|
2051
2558
|
id: string;
|
|
2052
2559
|
status: "running" | "completed" | "failed";
|
|
@@ -2056,7 +2563,7 @@ type SetRunDoc = {
|
|
|
2056
2563
|
actor: {
|
|
2057
2564
|
kind: string;
|
|
2058
2565
|
id: string;
|
|
2059
|
-
|
|
2566
|
+
actingUser: ActingUser | null;
|
|
2060
2567
|
} | null;
|
|
2061
2568
|
git: Checkout | null;
|
|
2062
2569
|
progress: {
|
|
@@ -2076,6 +2583,9 @@ type SetRunDoc = {
|
|
|
2076
2583
|
sampleId: string | null;
|
|
2077
2584
|
status: "pending" | "completed" | "failed";
|
|
2078
2585
|
reward: number | null;
|
|
2586
|
+
/** Why a failed task failed: its filing's error, or the reason this run
|
|
2587
|
+
* gave when it closed for a task that filed nothing. */
|
|
2588
|
+
error: string | null;
|
|
2079
2589
|
checks: Array<{
|
|
2080
2590
|
key: string;
|
|
2081
2591
|
outcome: "passed" | "failed" | "ungraded";
|
|
@@ -2096,7 +2606,7 @@ type RunSetOptions = {
|
|
|
2096
2606
|
onTask?: (summary: RunTaskSummary) => void;
|
|
2097
2607
|
options?: WorldsClientOptions;
|
|
2098
2608
|
};
|
|
2099
|
-
/** `failed`: an agent raised, a task could not run, or the platform stored the run as anything but completed. */
|
|
2609
|
+
/** `failed`: an agent raised, a task could not run or be graded, or the platform stored the run as anything but completed. */
|
|
2100
2610
|
type RunSetResult = {
|
|
2101
2611
|
setRun: SetRunDoc;
|
|
2102
2612
|
tasks: RunTaskSummary[];
|
|
@@ -2106,70 +2616,62 @@ type RunSetResult = {
|
|
|
2106
2616
|
/** A low or missing reward is a result, not a failure; every task runs even after one fails. */
|
|
2107
2617
|
declare function runSet(datasetId: string, agent: (run: TaskRun) => TaskRunResult | Promise<TaskRunResult>, opts: RunSetOptions): Promise<RunSetResult>;
|
|
2108
2618
|
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
info?: Record<string, unknown>;
|
|
2120
|
-
};
|
|
2121
|
-
type CreateEvaluationOptions = {
|
|
2122
|
-
model?: string;
|
|
2123
|
-
/** A set run to file under; the platform refuses a run that does not admit this result. */
|
|
2124
|
-
runId?: string;
|
|
2125
|
-
rolloutsPerExample?: number;
|
|
2126
|
-
metadata?: Record<string, unknown>;
|
|
2127
|
-
};
|
|
2128
|
-
type FinalizeEvaluationOptions = {
|
|
2129
|
-
status?: "COMPLETED" | "FAILED";
|
|
2130
|
-
metrics?: Record<string, unknown>;
|
|
2619
|
+
declare const WORLD_REQUEST_VIAS: readonly ["api", "ui", "tool"];
|
|
2620
|
+
/** One request with its exchange: the request's headers (credentials `[redacted]`) and the first 64 KB of each body, `null` for a body that is not text. */
|
|
2621
|
+
type WorldRequestEntry = Omit<WorldRequest, "request" | "response"> & {
|
|
2622
|
+
request: WorldRequest["request"] & {
|
|
2623
|
+
headers: Record<string, string>;
|
|
2624
|
+
body: string | null;
|
|
2625
|
+
};
|
|
2626
|
+
response: WorldRequest["response"] & {
|
|
2627
|
+
body: string | null;
|
|
2628
|
+
};
|
|
2131
2629
|
};
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
createEvaluation(versionId: string, opts?: CreateEvaluationOptions): Promise<string>;
|
|
2136
|
-
pushSamples(evaluationId: string, samples: EvalSample[]): Promise<number>;
|
|
2137
|
-
finalizeEvaluation(evaluationId: string, opts?: FinalizeEvaluationOptions): Promise<string>;
|
|
2138
|
-
}
|
|
2139
|
-
|
|
2140
|
-
/** One vendor-route request the world answered, as its own log keeps it: the
|
|
2141
|
-
* `calls` a grader reads, with the door it came in by (`via`: api, ui, tool). */
|
|
2142
|
-
type WorldRequest = {
|
|
2143
|
-
seq: number;
|
|
2144
|
-
at?: string;
|
|
2145
|
-
operation?: string;
|
|
2146
|
-
method?: string;
|
|
2147
|
-
path?: string;
|
|
2148
|
-
args?: unknown;
|
|
2149
|
-
query?: unknown;
|
|
2150
|
-
body?: unknown;
|
|
2630
|
+
type WorldRequestFilter = {
|
|
2631
|
+
session?: string;
|
|
2632
|
+
version?: string;
|
|
2151
2633
|
via?: string;
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2634
|
+
operation?: string;
|
|
2635
|
+
status?: string;
|
|
2636
|
+
since?: string;
|
|
2637
|
+
until?: string;
|
|
2638
|
+
cursor?: string;
|
|
2639
|
+
limit?: number;
|
|
2155
2640
|
};
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
*
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2641
|
+
declare class WorldRequestFilterError extends Error {
|
|
2642
|
+
}
|
|
2643
|
+
/** The platform's 409 `requests_not_recorded`: the session's engine keeps no request ledger, only World Host
|
|
2644
|
+
* sessions record requests. Its message is the platform's own sentence. */
|
|
2645
|
+
declare class WorldRequestsNotRecorded extends Error {
|
|
2646
|
+
static from(error: unknown): unknown;
|
|
2647
|
+
static mapped<T>(read: Promise<T>): Promise<T>;
|
|
2648
|
+
}
|
|
2649
|
+
/** The filters of a request-ledger read, checked and put in the platform's form: `via` and `status` lower-cased,
|
|
2650
|
+
* `since`/`until` as UTC instants (a date alone is its midnight, a time without a zone is UTC). Twin of
|
|
2651
|
+
* `gatewaysdk.world_requests.WorldRequestQuery`; both run `conformance/world-request-cli.json`. */
|
|
2652
|
+
declare class WorldRequestQuery {
|
|
2653
|
+
private readonly entries;
|
|
2165
2654
|
private constructor();
|
|
2166
|
-
static
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
get
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2655
|
+
static parse(filter?: WorldRequestFilter): WorldRequestQuery;
|
|
2656
|
+
private static via;
|
|
2657
|
+
private static status;
|
|
2658
|
+
get filtered(): boolean;
|
|
2659
|
+
params(): [string, string][];
|
|
2660
|
+
search(): string;
|
|
2661
|
+
}
|
|
2662
|
+
/** A world's request ledger: every request the world received, from every session and version, through every
|
|
2663
|
+
* door (`via`: api, ui, tool), kept for the world's life. Reading it records nothing. Twin of
|
|
2664
|
+
* `gatewaysdk.world_requests.WorldRequestLedger`. */
|
|
2665
|
+
declare class WorldRequestLedger {
|
|
2666
|
+
private readonly options;
|
|
2667
|
+
constructor(options?: WorldsClientOptions);
|
|
2668
|
+
/** A page of the world's requests, newest first; `nextCursor` reads the page after it. Narrowed to a session
|
|
2669
|
+
* whose engine records none: `WorldRequestsNotRecorded`. */
|
|
2670
|
+
list(slug: string, query?: WorldRequestQuery): Promise<WorldRequestPage>;
|
|
2671
|
+
/** One of the world's requests, with its headers and bodies. */
|
|
2672
|
+
get(slug: string, requestId: string): Promise<WorldRequestEntry>;
|
|
2673
|
+
/** A page of one session's requests, newest first; `WorldRequestsNotRecorded` when its engine records none. */
|
|
2674
|
+
forSession(sessionId: string, query?: WorldRequestQuery): Promise<WorldRequestPage>;
|
|
2173
2675
|
}
|
|
2174
2676
|
|
|
2175
2677
|
/** One entry the archive rules dropped: a whole directory (`name/`, `files`
|
|
@@ -2272,8 +2774,6 @@ declare function buildFileManifest(dir: string): {
|
|
|
2272
2774
|
size: number;
|
|
2273
2775
|
sha256: string;
|
|
2274
2776
|
}[];
|
|
2275
|
-
/** The refusal `push` raises from a tag checkout: tags never move, so the
|
|
2276
|
-
* push needs a branch named explicitly. */
|
|
2277
2777
|
declare class DetachedPushError extends Error {
|
|
2278
2778
|
constructor(dir: string, tag: string);
|
|
2279
2779
|
}
|
|
@@ -2611,26 +3111,6 @@ declare function parseTransform(name: string): Transform;
|
|
|
2611
3111
|
*/
|
|
2612
3112
|
declare function applyTransforms(value: string | number, chain: readonly string[]): string;
|
|
2613
3113
|
|
|
2614
|
-
/**
|
|
2615
|
-
* `queryRows(slug[@ref], entity, {where, resolve, limit, offset})` — the rows
|
|
2616
|
-
* of one entity that match a predicate, from
|
|
2617
|
-
* `GET /api/public/worlds/{slug}/data?ref=&entity=&where=&limit=&offset=&resolve=`.
|
|
2618
|
-
* `where` is field → value, or field → list of values (any of); values match
|
|
2619
|
-
* the STORED form as given. With `resolve: true` the values are plaintext and
|
|
2620
|
-
* the runtime maps each to its stored form under the world's `[redact]`
|
|
2621
|
-
* policy first (a hashed `email` becomes its slug-salted digest; a dropped
|
|
2622
|
-
* field resolves to nothing and matches no row — the answer's `resolved`
|
|
2623
|
-
* says so). The CLI twin is `gateway worlds data query <slug> <entity>`.
|
|
2624
|
-
*
|
|
2625
|
-
* `across: true` runs the same plaintext in every world this one links to
|
|
2626
|
-
* whose `[dependencies.<alias>.entities]` mapping covers a `where` field;
|
|
2627
|
-
* each linked world recomputes its own stored form (after the mapping's
|
|
2628
|
-
* transform) at query time — no join on disk, no shared salt. The answer
|
|
2629
|
-
* is then {@link WorldQueryAcrossResult}: one group per world, the root
|
|
2630
|
-
* first, and with `compare: true` a parity report saying, per field and
|
|
2631
|
-
* per world, `matched`, `no match` or `unmapped`.
|
|
2632
|
-
*/
|
|
2633
|
-
|
|
2634
3114
|
type WorldQueryWhere = Record<string, Plaintext | Plaintext[]>;
|
|
2635
3115
|
type WorldQueryOptions = {
|
|
2636
3116
|
where?: WorldQueryWhere;
|
|
@@ -2731,6 +3211,22 @@ declare function queryRowsSearch(entity: string, opts?: WorldQueryOptions, ref?:
|
|
|
2731
3211
|
* the head). With `across: true` the answer is the groups shape. */
|
|
2732
3212
|
declare function queryRows(slug: string, entity: string, opts: WorldQueryAcrossOptions, options?: WorldsClientOptions): Promise<WorldQueryAcrossResult>;
|
|
2733
3213
|
declare function queryRows(slug: string, entity: string, opts?: WorldQueryOptions, options?: WorldsClientOptions): Promise<WorldQueryResult>;
|
|
3214
|
+
type WorldSqlOptions = {
|
|
3215
|
+
limit?: number;
|
|
3216
|
+
scenario?: string;
|
|
3217
|
+
};
|
|
3218
|
+
type WorldSqlResult = {
|
|
3219
|
+
slug: string;
|
|
3220
|
+
versionId: string;
|
|
3221
|
+
kind: string | null;
|
|
3222
|
+
engine: string;
|
|
3223
|
+
columns: string[];
|
|
3224
|
+
rows: unknown[][];
|
|
3225
|
+
count: number;
|
|
3226
|
+
limit: number;
|
|
3227
|
+
truncated: boolean;
|
|
3228
|
+
};
|
|
3229
|
+
declare function sqlRows(slugRef: string, sql: string, opts?: WorldSqlOptions, options?: WorldsClientOptions): Promise<WorldSqlResult>;
|
|
2734
3230
|
|
|
2735
3231
|
/**
|
|
2736
3232
|
* `migrateWorld(slug)` — convert a stored world into a schema world, from
|
|
@@ -3095,6 +3591,7 @@ type SandboxSummary = {
|
|
|
3095
3591
|
pendingSlug: string | null;
|
|
3096
3592
|
status: "open" | "closed";
|
|
3097
3593
|
lastCommitVersionId: string | null;
|
|
3594
|
+
pendingBatchId?: string | null;
|
|
3098
3595
|
createdAt: string;
|
|
3099
3596
|
};
|
|
3100
3597
|
type SandboxOpened = SandboxSummary & {
|
|
@@ -3121,6 +3618,12 @@ type SandboxExecResult = {
|
|
|
3121
3618
|
/** Why `gateway`/`sqlite3` were not on PATH for this command; empty when the runtime is staged. */
|
|
3122
3619
|
warnings: string[];
|
|
3123
3620
|
};
|
|
3621
|
+
/** A command still running after the request's `waitMs` (202); wait on it with `execId`. */
|
|
3622
|
+
type SandboxExecRunning = {
|
|
3623
|
+
state: "running";
|
|
3624
|
+
execId: string;
|
|
3625
|
+
warnings: string[];
|
|
3626
|
+
};
|
|
3124
3627
|
type SandboxChanges = {
|
|
3125
3628
|
added: string[];
|
|
3126
3629
|
modified: string[];
|
|
@@ -3134,9 +3637,18 @@ type SandboxCheckResult = {
|
|
|
3134
3637
|
changes: SandboxChanges;
|
|
3135
3638
|
/** Working-tree paths left out of the version: `.gatewayignore`, default scratch, credential-shaped files, links. */
|
|
3136
3639
|
ignored: string[];
|
|
3137
|
-
/** Why a listed path was held back (credential-shaped, a link,
|
|
3640
|
+
/** Why a listed path was held back (credential-shaped, a link), a data migration the commit will run, or a rehash; paths only. */
|
|
3138
3641
|
warnings: string[];
|
|
3139
3642
|
error: string | null;
|
|
3643
|
+
baseMoved?: {
|
|
3644
|
+
baseVersionId: string;
|
|
3645
|
+
tipVersionId: string;
|
|
3646
|
+
} | null;
|
|
3647
|
+
pendingBatch?: {
|
|
3648
|
+
batchId: string;
|
|
3649
|
+
kind: string;
|
|
3650
|
+
state: string;
|
|
3651
|
+
} | null;
|
|
3140
3652
|
};
|
|
3141
3653
|
type SandboxCommitResult = {
|
|
3142
3654
|
/** The world the commit landed on. */
|
|
@@ -3152,7 +3664,24 @@ type SandboxCommitResult = {
|
|
|
3152
3664
|
warnings: string[];
|
|
3153
3665
|
/** The API key's edit session the commit joined; `gateway worlds edit close <slug>` moves main. */
|
|
3154
3666
|
editSessionId?: string;
|
|
3667
|
+
rebasedOnto?: string | null;
|
|
3668
|
+
batchId?: string;
|
|
3669
|
+
};
|
|
3670
|
+
type SandboxCommitPending = {
|
|
3671
|
+
slug: string;
|
|
3672
|
+
batchId: string;
|
|
3673
|
+
state: string;
|
|
3674
|
+
migration: {
|
|
3675
|
+
fromSnapshotId: string;
|
|
3676
|
+
adds: string[];
|
|
3677
|
+
};
|
|
3678
|
+
changes: SandboxChanges;
|
|
3679
|
+
ignored: string[];
|
|
3680
|
+
warnings: string[];
|
|
3681
|
+
rebasedOnto: string | null;
|
|
3682
|
+
hint: string;
|
|
3155
3683
|
};
|
|
3684
|
+
declare const isSandboxCommitPending: (answer: SandboxCommitResult | SandboxCommitPending) => answer is SandboxCommitPending;
|
|
3156
3685
|
/** Mirrors `PostSandboxImportBody`. */
|
|
3157
3686
|
type SandboxImportInput = {
|
|
3158
3687
|
/** A .json/.jsonl/.ndjson/.csv/.tsv (optionally .gz) relative to the world root. */
|
|
@@ -3185,6 +3714,7 @@ type SandboxImportResult = {
|
|
|
3185
3714
|
chunkCount: number;
|
|
3186
3715
|
/** `sandbox:<id>/<path>`. */
|
|
3187
3716
|
source: string;
|
|
3717
|
+
warnings?: string[];
|
|
3188
3718
|
};
|
|
3189
3719
|
/** Mirrors `PostSandboxImportPendingResponse` (202): poll `worlds data batches`. */
|
|
3190
3720
|
type SandboxImportPending = {
|
|
@@ -3193,6 +3723,7 @@ type SandboxImportPending = {
|
|
|
3193
3723
|
rowCount: number;
|
|
3194
3724
|
chunkCount: number;
|
|
3195
3725
|
source: string;
|
|
3726
|
+
warnings?: string[];
|
|
3196
3727
|
};
|
|
3197
3728
|
declare const isSandboxImportPending: (answer: SandboxImportResult | SandboxImportPending) => answer is SandboxImportPending;
|
|
3198
3729
|
/** Mirrors `PostSandboxOpenBody`: an existing world at a ref, or a new world seeded from a template. */
|
|
@@ -3207,8 +3738,34 @@ type SandboxOpenNew = {
|
|
|
3207
3738
|
type SandboxOpenTarget = SandboxOpenExisting | SandboxOpenNew;
|
|
3208
3739
|
/** `slug` or `slug@ref` → the open body; a bare slug opens the latest READY version. */
|
|
3209
3740
|
declare function parseSlugRef(slugRef: string): SandboxOpenExisting;
|
|
3210
|
-
/**
|
|
3211
|
-
|
|
3741
|
+
/** How long one sandbox request waits for its answer: under the 300 s Node's fetch waits before it cuts a request, so
|
|
3742
|
+
* this budget, not fetch, ends a slow one. The Python twin and both MCP proxies wait the same
|
|
3743
|
+
* (`conformance/world-sandbox-limits.json`). */
|
|
3744
|
+
declare const SANDBOX_REQUEST_TIMEOUT_MS = 290000;
|
|
3745
|
+
/** The most one write request carries (`WORLD_SANDBOX_WRITE_CHUNK_BYTES`); a larger file goes up in parts of this size. */
|
|
3746
|
+
declare const SANDBOX_WRITE_CHUNK_BYTES: number;
|
|
3747
|
+
/** The largest file a sandbox write lands (`WORLD_SANDBOX_FILE_MAX_BYTES`). */
|
|
3748
|
+
declare const SANDBOX_FILE_MAX_BYTES: number;
|
|
3749
|
+
/** What writing a directory never uploads: a checkout's metadata and the scratch the platform never versions
|
|
3750
|
+
* (`conformance/world-ignore-defaults.json`). A name with a trailing slash is a directory at any depth, any
|
|
3751
|
+
* other a file name glob. */
|
|
3752
|
+
declare const SANDBOX_WRITE_SKIPPED: readonly string[];
|
|
3753
|
+
/** Which directory entries writing a directory leaves out, by `SANDBOX_WRITE_SKIPPED`. */
|
|
3754
|
+
declare class WriteTreeFilter {
|
|
3755
|
+
private readonly directories;
|
|
3756
|
+
private readonly files;
|
|
3757
|
+
skipsDirectory(name: string): boolean;
|
|
3758
|
+
skipsFile(name: string): boolean;
|
|
3759
|
+
}
|
|
3760
|
+
/** How long one exec request waits on its command before the platform answers `running`; a longer command is
|
|
3761
|
+
* waited on again by `execId`, so no request outlives the edge in front of the platform. */
|
|
3762
|
+
declare const SANDBOX_EXEC_WAIT_MS = 40000;
|
|
3763
|
+
/** The longest timeout an exec may ask for (`WORLD_SANDBOX_EXEC_TIMEOUT_MAX_MS`); a longer one is refused, never clamped. */
|
|
3764
|
+
declare const SANDBOX_EXEC_TIMEOUT_MAX_S = 600;
|
|
3765
|
+
/** How long past its timeout a command may go without a result before the client stops waiting on it. */
|
|
3766
|
+
declare const SANDBOX_EXEC_REPORT_MARGIN_MS = 35000;
|
|
3767
|
+
/** How many times a start the platform deferred (`sandbox_exec_deferred`: nothing ran) is sent. */
|
|
3768
|
+
declare const SANDBOX_EXEC_START_ATTEMPTS = 3;
|
|
3212
3769
|
/** Mirrors `PostSandboxCommitBody`: `rebase` replays the sandbox's edits onto the branch head when the base moved. */
|
|
3213
3770
|
type SandboxCommitInput = {
|
|
3214
3771
|
message: string;
|
|
@@ -3224,6 +3781,22 @@ type RebaseConflictPath = {
|
|
|
3224
3781
|
declare function rebaseConflicts(error: unknown): RebaseConflictPath[] | null;
|
|
3225
3782
|
/** A 409 `sandbox_uncommitted` from `close`: the paths a commit would keep. Null for any other failure. */
|
|
3226
3783
|
declare function uncommittedPaths(error: unknown): string[] | null;
|
|
3784
|
+
/**
|
|
3785
|
+
* The warnings an exec had collected before it failed (a deferral's, a running answer's) and the failing answer's
|
|
3786
|
+
* own, which its message holds only up to the detail's cut: no later call reports them. Those the message already
|
|
3787
|
+
* shows whole are left out, so each is printed once.
|
|
3788
|
+
*/
|
|
3789
|
+
declare function carriedWarnings(error: unknown): string[];
|
|
3790
|
+
/** A 400 `rows_refused` from `import`: the summary, every refusal counted, the first records and the full report. */
|
|
3791
|
+
type RowsRefusal = {
|
|
3792
|
+
message: string;
|
|
3793
|
+
batchId: string;
|
|
3794
|
+
refusalCount: number;
|
|
3795
|
+
refusals: Record<string, unknown>[];
|
|
3796
|
+
reportUrl: string | null;
|
|
3797
|
+
};
|
|
3798
|
+
/** The refusal a sandbox import answered, or null for any other failure. */
|
|
3799
|
+
declare function rowsRefusal(error: unknown): RowsRefusal | null;
|
|
3227
3800
|
/** `sandbox list` narrows: status, world, count (newest first). */
|
|
3228
3801
|
type SandboxListFilter = {
|
|
3229
3802
|
status?: "open" | "closed";
|
|
@@ -3249,18 +3822,24 @@ declare class WorldSandboxClient {
|
|
|
3249
3822
|
size: number;
|
|
3250
3823
|
bytes: Buffer;
|
|
3251
3824
|
}>;
|
|
3825
|
+
/** A file past one chunk goes up in parts under one upload id; the platform lands it whole once the last part's
|
|
3826
|
+
* size and SHA-256 check out. */
|
|
3252
3827
|
write(sandboxId: string, filePath: string, bytes: Buffer): Promise<{
|
|
3253
3828
|
path: string;
|
|
3254
3829
|
size: number;
|
|
3255
3830
|
}>;
|
|
3831
|
+
private putFile;
|
|
3832
|
+
/** Runs as a job on the platform: a command that outlasts one request is waited on again until its result. */
|
|
3256
3833
|
exec(sandboxId: string, input: {
|
|
3257
3834
|
command: string;
|
|
3258
3835
|
cwd?: string;
|
|
3259
3836
|
timeoutMs?: number;
|
|
3260
3837
|
}): Promise<SandboxExecResult>;
|
|
3838
|
+
private startExec;
|
|
3839
|
+
private execStep;
|
|
3261
3840
|
check(sandboxId: string): Promise<SandboxCheckResult>;
|
|
3262
3841
|
/** With `rebase`, a moved base is replayed onto; a 409 then names the conflicting paths (`rebaseConflicts`). */
|
|
3263
|
-
commit(sandboxId: string, input: SandboxCommitInput): Promise<SandboxCommitResult>;
|
|
3842
|
+
commit(sandboxId: string, input: SandboxCommitInput): Promise<SandboxCommitResult | SandboxCommitPending>;
|
|
3264
3843
|
/**
|
|
3265
3844
|
* A rows file already in the sandbox tree into the PLATFORM world the
|
|
3266
3845
|
* sandbox was opened on (201 with the version, 202 with the batch to poll,
|
|
@@ -3274,156 +3853,6 @@ declare class WorldSandboxClient {
|
|
|
3274
3853
|
}): Promise<SandboxSummary>;
|
|
3275
3854
|
}
|
|
3276
3855
|
|
|
3277
|
-
/**
|
|
3278
|
-
* Edit sessions: the version control unit for a world. Every write this
|
|
3279
|
-
* credential makes to a world (push, sandbox commit, data import, MCP, the
|
|
3280
|
-
* console editor) joins ONE open session per world per credential and lands
|
|
3281
|
-
* on that session's private branch; `close` seals the session into a version
|
|
3282
|
-
* on `main`, and a session nobody touches for an hour seals itself. Sessions
|
|
3283
|
-
* replace product-level proposals/PRs: `rollback` undoes a sealed session
|
|
3284
|
-
* (source + data together) as a new, itself-reversible session.
|
|
3285
|
-
*
|
|
3286
|
-
* One client under both `gateway worlds edit …` and `gateway bench edit …`;
|
|
3287
|
-
* the Python twin is `gatewaysdk.benchmark_hub.edit_sessions.WorldEditClient`.
|
|
3288
|
-
*/
|
|
3289
|
-
/** Mirrors `WorldEditSessionSchema` (web/features/public-api/types/world-edits.ts). */
|
|
3290
|
-
type EditSessionSummary = {
|
|
3291
|
-
id: string;
|
|
3292
|
-
containerId: string;
|
|
3293
|
-
/** `apikey:<id>` for CLI/sandbox/MCP, `user:<id>` for the console, `agent:<id>` for the platform agent. */
|
|
3294
|
-
actor: string;
|
|
3295
|
-
door: string;
|
|
3296
|
-
status: "open" | "sealing" | "sealed" | "conflict" | "expired" | "discarded" | string;
|
|
3297
|
-
baseVersionId: string | null;
|
|
3298
|
-
tipVersionId: string | null;
|
|
3299
|
-
sealedVersionId: string | null;
|
|
3300
|
-
editCount: number;
|
|
3301
|
-
startedAt: string;
|
|
3302
|
-
lastEditAt: string;
|
|
3303
|
-
expiresAt: string;
|
|
3304
|
-
closedAt: string | null;
|
|
3305
|
-
closeReason: string | null;
|
|
3306
|
-
conflictPaths: string[] | null;
|
|
3307
|
-
rollbackOfId: string | null;
|
|
3308
|
-
message: string | null;
|
|
3309
|
-
/** Set when `task edit close` sealed this session together with a task's other worlds. */
|
|
3310
|
-
sealGroupId: string | null;
|
|
3311
|
-
};
|
|
3312
|
-
type EditSessionList = {
|
|
3313
|
-
slug: string;
|
|
3314
|
-
containerId: string;
|
|
3315
|
-
/** This credential's open session, or null. */
|
|
3316
|
-
current: EditSessionSummary | null;
|
|
3317
|
-
sessions: EditSessionSummary[];
|
|
3318
|
-
};
|
|
3319
|
-
/** What close/discard/rollback return. */
|
|
3320
|
-
type EditSessionResult = {
|
|
3321
|
-
slug: string;
|
|
3322
|
-
session: EditSessionSummary;
|
|
3323
|
-
};
|
|
3324
|
-
type EditSessionListQuery = {
|
|
3325
|
-
status?: string;
|
|
3326
|
-
limit?: number;
|
|
3327
|
-
};
|
|
3328
|
-
type EditSessionCloseInput = {
|
|
3329
|
-
sessionId?: string;
|
|
3330
|
-
force?: boolean;
|
|
3331
|
-
message?: string;
|
|
3332
|
-
};
|
|
3333
|
-
type EditSessionRollbackInput = {
|
|
3334
|
-
sessionId: string;
|
|
3335
|
-
force?: boolean;
|
|
3336
|
-
message?: string;
|
|
3337
|
-
};
|
|
3338
|
-
declare class WorldEditClient {
|
|
3339
|
-
private readonly options;
|
|
3340
|
-
constructor(options?: WorldsClientOptions);
|
|
3341
|
-
/** The credential's current session and the world's newest-first sessions. */
|
|
3342
|
-
list(slug: string, query?: EditSessionListQuery): Promise<EditSessionList>;
|
|
3343
|
-
/** Seal a session into a version on main (the credential's current one when `sessionId` is omitted). */
|
|
3344
|
-
close(slug: string, input?: EditSessionCloseInput): Promise<EditSessionResult>;
|
|
3345
|
-
/** Drop the session's private branch without making a version. */
|
|
3346
|
-
discard(slug: string, input?: {
|
|
3347
|
-
sessionId?: string;
|
|
3348
|
-
}): Promise<EditSessionResult>;
|
|
3349
|
-
/** Undo a sealed session (source and data) as a new sealed session. */
|
|
3350
|
-
rollback(slug: string, input: EditSessionRollbackInput): Promise<EditSessionResult>;
|
|
3351
|
-
}
|
|
3352
|
-
/** A stored task (`{id, version?}`) or a spec with `worlds`, as `task up` takes it. */
|
|
3353
|
-
type TaskEditTarget = WorldTaskIdRef | WorldTaskSpec;
|
|
3354
|
-
/** The task the platform resolved: stored id and version, or the spec's hash. */
|
|
3355
|
-
type TaskEditTaskRef = {
|
|
3356
|
-
taskId: string | null;
|
|
3357
|
-
taskVersion: number | null;
|
|
3358
|
-
name: string | null;
|
|
3359
|
-
hash: string;
|
|
3360
|
-
};
|
|
3361
|
-
/** Mirrors `TaskEditStatusResponseSchema` (web/features/public-api/types/world-task-edits.ts). */
|
|
3362
|
-
type TaskEditStatus = {
|
|
3363
|
-
task: TaskEditTaskRef;
|
|
3364
|
-
worlds: Record<string, {
|
|
3365
|
-
slug: string;
|
|
3366
|
-
ref: string;
|
|
3367
|
-
problem: string | null;
|
|
3368
|
-
session: EditSessionSummary | null;
|
|
3369
|
-
/** This credential's sessions parked in `conflict` on the world: unsealed too. */
|
|
3370
|
-
parked: EditSessionSummary[];
|
|
3371
|
-
mainVersionId: string | null;
|
|
3372
|
-
sealNow: "fast-forward" | "rebase" | "conflict" | null;
|
|
3373
|
-
conflictPaths: string[];
|
|
3374
|
-
}>;
|
|
3375
|
-
/** Aliases whose world holds edits only this credential sees. */
|
|
3376
|
-
unsealed: string[];
|
|
3377
|
-
hint: string | null;
|
|
3378
|
-
};
|
|
3379
|
-
type TaskEditSealed = {
|
|
3380
|
-
slug: string;
|
|
3381
|
-
session: EditSessionSummary;
|
|
3382
|
-
};
|
|
3383
|
-
type TaskEditCloseResult = {
|
|
3384
|
-
task: TaskEditTaskRef;
|
|
3385
|
-
groupId: string | null;
|
|
3386
|
-
worlds: Record<string, TaskEditSealed>;
|
|
3387
|
-
skipped: Record<string, {
|
|
3388
|
-
slug: string;
|
|
3389
|
-
reason: string;
|
|
3390
|
-
}>;
|
|
3391
|
-
};
|
|
3392
|
-
type TaskEditRollbackResult = {
|
|
3393
|
-
task: TaskEditTaskRef;
|
|
3394
|
-
groupId: string;
|
|
3395
|
-
rollbackOf: string;
|
|
3396
|
-
worlds: Record<string, TaskEditSealed>;
|
|
3397
|
-
/** Members whose seal left `main` where it was: nothing to undo there. */
|
|
3398
|
-
skipped: Record<string, {
|
|
3399
|
-
slug: string;
|
|
3400
|
-
reason: string;
|
|
3401
|
-
}>;
|
|
3402
|
-
};
|
|
3403
|
-
type TaskEditCloseInput = {
|
|
3404
|
-
requireAll?: boolean;
|
|
3405
|
-
force?: boolean;
|
|
3406
|
-
message?: string;
|
|
3407
|
-
};
|
|
3408
|
-
type TaskEditRollbackInput = {
|
|
3409
|
-
groupId: string;
|
|
3410
|
-
force?: boolean;
|
|
3411
|
-
message?: string;
|
|
3412
|
-
};
|
|
3413
|
-
/**
|
|
3414
|
-
* This credential's edit sessions on every world a task names, together:
|
|
3415
|
-
* `close` seals them onto their mains in ONE platform transaction (all or
|
|
3416
|
-
* none), `rollback` undoes the seal group as one. Python twin:
|
|
3417
|
-
* `gatewaysdk.benchmark_hub.edit_sessions.TaskEditClient`.
|
|
3418
|
-
*/
|
|
3419
|
-
declare class TaskEditClient {
|
|
3420
|
-
private readonly options;
|
|
3421
|
-
constructor(options?: WorldsClientOptions);
|
|
3422
|
-
status(task: TaskEditTarget): Promise<TaskEditStatus>;
|
|
3423
|
-
close(task: TaskEditTarget, input?: TaskEditCloseInput): Promise<TaskEditCloseResult>;
|
|
3424
|
-
rollback(task: TaskEditTarget, input: TaskEditRollbackInput): Promise<TaskEditRollbackResult>;
|
|
3425
|
-
}
|
|
3426
|
-
|
|
3427
3856
|
/**
|
|
3428
3857
|
* The hosted one-task dry run: `POST /api/public/environments/{id}/dry-run`
|
|
3429
3858
|
* and the run-status read that settles it. The runner runs ONE named task of a
|
|
@@ -3527,6 +3956,25 @@ declare class DryRunOutcome {
|
|
|
3527
3956
|
passed(): boolean;
|
|
3528
3957
|
}
|
|
3529
3958
|
|
|
3959
|
+
declare const TOOL_CONTRACT_UNREAD = "tool-contract-unread";
|
|
3960
|
+
/** One notice from a world answer's `deprecations`, as the CLI prints it (`fixtures/tasks/world-notice-vectors.json`). */
|
|
3961
|
+
declare class WorldNotice {
|
|
3962
|
+
readonly notice: WorldDeprecation;
|
|
3963
|
+
private readonly kind;
|
|
3964
|
+
private constructor();
|
|
3965
|
+
static of(notice: WorldDeprecation): WorldNotice;
|
|
3966
|
+
get refusesRun(): boolean;
|
|
3967
|
+
line(): string;
|
|
3968
|
+
}
|
|
3969
|
+
/** A run refused before its agent started: the platform could not read a world's tools. */
|
|
3970
|
+
declare class WorldToolsUnread extends Error {
|
|
3971
|
+
readonly world: string;
|
|
3972
|
+
readonly notice: WorldNotice;
|
|
3973
|
+
readonly code: string;
|
|
3974
|
+
constructor(world: string, notice: WorldNotice);
|
|
3975
|
+
static refuse(world: string, notices: WorldDeprecation[]): void;
|
|
3976
|
+
}
|
|
3977
|
+
|
|
3530
3978
|
type WorldsClientOptions = {
|
|
3531
3979
|
host?: string;
|
|
3532
3980
|
publicKey?: string;
|
|
@@ -3548,27 +3996,26 @@ type DispatchedRun = {
|
|
|
3548
3996
|
ok: boolean;
|
|
3549
3997
|
error?: string;
|
|
3550
3998
|
};
|
|
3551
|
-
/** A platform answer
|
|
3552
|
-
* code (a 409 on a name already taken) instead of parsing the message. A JSON
|
|
3553
|
-
* body renders as `<message> (<code>)` — the stable public `code`, never the
|
|
3554
|
-
* server's error class name. */
|
|
3999
|
+
/** A non-2xx platform answer: act on `status` or the stable public `code` (never the server's error class) rather than parsing the message. */
|
|
3555
4000
|
declare class ApiError extends Error {
|
|
3556
4001
|
readonly status: number;
|
|
3557
4002
|
readonly text: string;
|
|
3558
4003
|
readonly code: string | null;
|
|
3559
4004
|
constructor(status: number, method: string, path: string, text: string);
|
|
3560
4005
|
}
|
|
3561
|
-
/**
|
|
3562
|
-
* Python twin: `gatewaysdk.api_errors.error_detail`. */
|
|
3563
|
-
declare function parseErrorBody(text: string,
|
|
4006
|
+
/** The detail and stable code of a non-2xx body; an HTML page or a bare 5xx is named, never printed.
|
|
4007
|
+
* Python twin: `gatewaysdk.api_errors.error_detail`; both run `conformance/platform-error-bodies.json`. */
|
|
4008
|
+
declare function parseErrorBody(text: string, status?: number): {
|
|
3564
4009
|
detail: string;
|
|
3565
4010
|
code: string | null;
|
|
3566
4011
|
};
|
|
3567
|
-
/**
|
|
3568
|
-
|
|
3569
|
-
|
|
4012
|
+
/** `<path>: <message>` per issue of a validation error; empty when it carries none. Python twin: `gatewaysdk.api_errors.invalid_fields`. */
|
|
4013
|
+
declare function invalidFields(error: unknown): string;
|
|
4014
|
+
/** Authenticated JSON request to the platform API. `init.timeoutMs` replaces the `GATEWAY_TIMEOUT_MS` budget for a request that
|
|
4015
|
+
* legitimately outlasts it; `init.retry` is only for a request whose repeat is harmless. */
|
|
3570
4016
|
declare function apiRequest<T>(options: WorldsClientOptions, method: PlatformMethod, path: string, body?: unknown, init?: {
|
|
3571
4017
|
timeoutMs?: number;
|
|
4018
|
+
retry?: RetryPolicy;
|
|
3572
4019
|
}): Promise<T>;
|
|
3573
4020
|
/** Set (or rotate) one environment secret — write-only: no API returns it. */
|
|
3574
4021
|
declare function setEnvSecret(slug: string, key: string, value: string, options?: WorldsClientOptions): Promise<{
|
|
@@ -3591,13 +4038,10 @@ type RunConfigSummary = {
|
|
|
3591
4038
|
autoRunOnPush: boolean;
|
|
3592
4039
|
agent: string | null;
|
|
3593
4040
|
};
|
|
3594
|
-
/**
|
|
4041
|
+
/** The project's run configs; CI resolves one by name and dispatches it by id. */
|
|
3595
4042
|
declare function listRunConfigs(options?: WorldsClientOptions): Promise<RunConfigSummary[]>;
|
|
3596
|
-
/**
|
|
3597
|
-
*
|
|
3598
|
-
* project's stored tasks (`worldTasks`, api worlds only) — never both. A
|
|
3599
|
-
* stored task ref without `version` runs the task's current version at
|
|
3600
|
-
* dispatch time; with it, that version forever. */
|
|
4043
|
+
/** Either the bundle's own scenarios (`taskNames`, `taskSetDatasetId`) or stored tasks (`worldTasks`, schema worlds only), never both;
|
|
4044
|
+
* a stored task ref without `version` runs the task's current version at dispatch time, with it that version forever. */
|
|
3601
4045
|
type RunConfigInput = {
|
|
3602
4046
|
id?: string;
|
|
3603
4047
|
name: string;
|
|
@@ -3614,8 +4058,7 @@ type RunConfigInput = {
|
|
|
3614
4058
|
};
|
|
3615
4059
|
/** Create a run config, or update the one named by `id`. */
|
|
3616
4060
|
declare function upsertRunConfig(input: RunConfigInput, options?: WorldsClientOptions): Promise<RunConfigSummary>;
|
|
3617
|
-
/** `id[@version]` items
|
|
3618
|
-
* the spelling `bench run-configs create --world-tasks` takes. */
|
|
4061
|
+
/** `id[@version]` items, comma-separated or an array, as `bench run-configs create --world-tasks` takes them. */
|
|
3619
4062
|
declare function parseWorldTaskRefs(spec: string | string[]): WorldTaskIdRef[];
|
|
3620
4063
|
type RunReport = {
|
|
3621
4064
|
id: string;
|
|
@@ -3642,11 +4085,9 @@ type RunReport = {
|
|
|
3642
4085
|
sessionId: string | null;
|
|
3643
4086
|
}[];
|
|
3644
4087
|
};
|
|
3645
|
-
/** The read half of dispatch: status, score, per-shard evaluations
|
|
3646
|
-
* per-task rewards — everything a CI gate needs. */
|
|
4088
|
+
/** The read half of dispatch: status, score, per-shard evaluations and per-task rewards. */
|
|
3647
4089
|
declare function getRun(runId: string, options?: WorldsClientOptions): Promise<RunReport>;
|
|
3648
|
-
/**
|
|
3649
|
-
* the gate's view — no logs, samples or links; `getRun` has those. */
|
|
4090
|
+
/** A run as `bench runs list` prints it: no logs, samples or links (`getRun` has those). */
|
|
3650
4091
|
type RunSummary = {
|
|
3651
4092
|
id: string;
|
|
3652
4093
|
status: string;
|
|
@@ -3672,7 +4113,7 @@ type ListRunsFilter = {
|
|
|
3672
4113
|
};
|
|
3673
4114
|
/** The project's runs, newest first. */
|
|
3674
4115
|
declare function listRuns(filter?: ListRunsFilter, options?: WorldsClientOptions): Promise<RunSummary[]>;
|
|
3675
|
-
/** Poll a run to terminal (default
|
|
4116
|
+
/** Poll a run to terminal every `intervalSeconds` (default 20) for up to `timeoutMinutes` (default 45). */
|
|
3676
4117
|
declare function waitForRun(runId: string, opts?: {
|
|
3677
4118
|
timeoutMinutes?: number;
|
|
3678
4119
|
intervalSeconds?: number;
|
|
@@ -3690,12 +4131,7 @@ type RunProvenance = {
|
|
|
3690
4131
|
kind?: string;
|
|
3691
4132
|
};
|
|
3692
4133
|
};
|
|
3693
|
-
/**
|
|
3694
|
-
* Where a dispatch comes from, DETECTED rather than configured: the CI
|
|
3695
|
-
* checkout's branch/commit/actor under GitHub Actions, else the developer's
|
|
3696
|
-
* own git checkout. A run nobody can trace to a branch is a score with no
|
|
3697
|
-
* code attached, so every dispatch carries this unless overridden.
|
|
3698
|
-
*/
|
|
4134
|
+
/** A dispatch's branch, commit and actor: from GitHub Actions under CI, else the local git checkout; every dispatch carries it unless overridden. */
|
|
3699
4135
|
declare function detectProvenance(): RunProvenance;
|
|
3700
4136
|
/** One scenario of a world, as data. */
|
|
3701
4137
|
declare class WorldTask {
|
|
@@ -3704,13 +4140,7 @@ declare class WorldTask {
|
|
|
3704
4140
|
readonly variant: string | null;
|
|
3705
4141
|
constructor(world: WorldSet, name: string, variant: string | null);
|
|
3706
4142
|
}
|
|
3707
|
-
/**
|
|
3708
|
-
* THE world, from a TS process: pinned identity + its tasks + hosted runs.
|
|
3709
|
-
*
|
|
3710
|
-
* const world = await openWorld("google-drive-sim@main");
|
|
3711
|
-
* console.log(world.version.semanticVersion, world.tasks.length);
|
|
3712
|
-
* const runs = await world.dispatch(runConfigId);
|
|
3713
|
-
*/
|
|
4143
|
+
/** A world pinned to one version, with its tasks and hosted runs, as `openWorld` and `openWorldVersion` return it. */
|
|
3714
4144
|
declare class WorldSet {
|
|
3715
4145
|
readonly slugRef: string;
|
|
3716
4146
|
readonly slug: string;
|
|
@@ -3720,44 +4150,25 @@ declare class WorldSet {
|
|
|
3720
4150
|
private readonly options;
|
|
3721
4151
|
constructor(slugRef: string, slug: string, ref: string | null, version: ResolvedWorldVersion, tasks: WorldTask[], options: WorldsClientOptions);
|
|
3722
4152
|
task(variant: string): WorldTask;
|
|
3723
|
-
/**
|
|
3724
|
-
* Open a LIVE session against one of this world's tasks — a bundled task's
|
|
3725
|
-
* name or an inline `WorldTaskSpec`: the platform boots (or reuses) a warm
|
|
3726
|
-
* container, and your agent calls its tools through the platform. See
|
|
3727
|
-
* worlds/session.ts.
|
|
3728
|
-
*/
|
|
4153
|
+
/** Open a live session on a bundled task's name or an inline `WorldTaskSpec`; the platform boots or reuses a warm container. */
|
|
3729
4154
|
open(task: WorldTaskRef, opts?: {
|
|
3730
4155
|
reuseWarm?: boolean;
|
|
3731
4156
|
surfaces?: WorldSurfaceKind[];
|
|
3732
4157
|
browserTier?: BrowserTier;
|
|
3733
4158
|
}): Promise<WorldSession>;
|
|
3734
|
-
/**
|
|
3735
|
-
* Start a HOSTED run of a run config against this world — the platform
|
|
3736
|
-
* executes the (Python) world in parallel containers per the config's
|
|
3737
|
-
* `parallelism` and files one graded run per model. Returns those runs.
|
|
3738
|
-
*/
|
|
4159
|
+
/** Start a hosted run of a run config on this version (or `opts.versionId`): one graded run per model, provenance detected unless given. */
|
|
3739
4160
|
dispatch(runConfigId: string, opts?: {
|
|
3740
4161
|
containerId?: string;
|
|
3741
4162
|
versionId?: string;
|
|
3742
|
-
/** Override the auto-detected branch/commit/actor. */
|
|
3743
4163
|
provenance?: RunProvenance;
|
|
3744
4164
|
}): Promise<{
|
|
3745
4165
|
versionLabel: string;
|
|
3746
4166
|
runs: DispatchedRun[];
|
|
3747
4167
|
}>;
|
|
3748
4168
|
}
|
|
3749
|
-
/**
|
|
3750
|
-
* Resolve `slug` / `slug@branch|tag|semver|hash` to its pinned version and
|
|
3751
|
-
* task list. The task list comes from the version's file manifest
|
|
3752
|
-
* (`tasks/<name>/task.toml`), so it needs no bundle download.
|
|
3753
|
-
*/
|
|
4169
|
+
/** Resolve `slug` or `slug@branch|tag|semver|hash` to its pinned version and task list, without downloading the bundle. */
|
|
3754
4170
|
declare function openWorld(slugRef: string, options?: WorldsClientOptions): Promise<WorldSet>;
|
|
3755
|
-
/**
|
|
3756
|
-
* Resolve `slug` at one pinned READY `versionId` — the task list is THAT
|
|
3757
|
-
* version's, never the branch tip's. `worlds run|ci --version-id` come
|
|
3758
|
-
* through here; a version of another container, a draft or an unknown id
|
|
3759
|
-
* is a 404 from the platform, not a silent fall-through to head.
|
|
3760
|
-
*/
|
|
4171
|
+
/** Resolve `slug` at one READY `versionId`, with that version's task list; another world's version, a draft or an unknown id is a 404, never the head. */
|
|
3761
4172
|
declare function openWorldVersion(slug: string, versionId: string, options?: WorldsClientOptions): Promise<WorldSet>;
|
|
3762
4173
|
|
|
3763
|
-
export { ACTION_NAMES, type ActionArgs, type ActionResult, ActionTracer, type AiSdkAnthropicOutput, type AiSdkComputerCall, type AiSdkComputerOutput, type AiSdkModelOutput, AnthropicComputer, AnthropicComputer20251124, type AnthropicToolResult, ApiError, BROWSER_GONE_PATTERNS, BROWSER_TIERS, type BrowserActionEvent, BrowserActionRecorder, type BrowserConnection, type BrowserMode, type BrowserPage, BrowserReconnected, BrowserReconnector, type BrowserTier, BrowserUnrecoverable, CALL_BODY_LIMIT_BYTES, CALL_BODY_LIMIT_LABEL, COMPUTER_USE_SPECS, type Checkout, CheckoutProvenance, ComputerAction, type ComputerCallOutput, type CreateEvaluationOptions, DEFAULT_BRANCH, DEFAULT_VIEWPORT, DRY_RUN_AGENT, DRY_RUN_KIND, DetachedPushError, type DispatchedRun, Display, type DryRunImageDecision, DryRunOutcome, type DryRunSettlement, EVENT_BATCH_SIZE, EVENT_FLUSH_INTERVAL_MS, EVENT_MAX_RETRIES, EXPLORATORY_TASK, EXPLORATORY_TASK_SOURCE, type EditSessionCloseInput, type EditSessionList, type EditSessionListQuery, type EditSessionResult, type EditSessionRollbackInput, type EditSessionSummary, type EvalSample, type FinalizeEvaluationOptions, GatewayEvalsClient, type GradeResult, HostedDryRunClient, type HostedDryRunDispatch, type HostedDryRunStatus, type HostedDryRunVerdict, IDLE_WARNING_MINUTES, type IngestExplode, type IngestFieldSpec, type IngestMapping, type IngestMode, type IngestOptions, type IngestRefusal, type IngestReport, type IngestSource, type IngestSourceReport, type IngestToolCallsOptions, type IngestToolCallsReport, KEY_NAMES, KeyChord, type ListRunsFilter, type ListSessionsFilter, type LiveTaskSession, type LocalMeta, type MigrateWorldOptions, NOT_EXECUTED, NO_GRADER_REASON, NativeComputer, type NativeComputerKinds, type NativeComputerOptions, type NativeComputerProvider, type NativePage, type ObservationConversion, type ObservationLike, OpenAIComputer, OpenAIPreviewComputer, type OpenSessionOptions, type OpenTaskOptions, type ParsedToolCall, PendingSafetyChecks, type Plaintext, PlatformMethod, type PlaywrightBrowserLike, type PlaywrightLike, PushSlugConflict, type PushSlugResolution, RECOVER_BUDGET_MS, type RebaseConflictPath, type RecoveryResult, type RedactMode, type RedactPolicy, type Redaction, type RepairAnswer, type ResolvedWorldVersion, type RunConfigInput, type RunConfigSummary, type RunProvenance, type RunReport, type RunSetOptions, type RunSetResult, type RunSummary, type RunTaskOptions, type RunTaskSummary, SANDBOX_REQUEST_TIMEOUT_MS, SECRET_KEY, SESSION_STATES, SPAN_PREFIX, STATUS_WAIT_CAP_SECONDS, STRIP_PREFIX, SURFACE_KINDS, type SafetyCheck, type SandboxChanges, type SandboxCheckResult, type SandboxCommitInput, type SandboxCommitResult, type SandboxExecResult, type SandboxImportInput, type SandboxImportPending, type SandboxImportResult, type SandboxListFilter, type SandboxOpenExisting, type SandboxOpenNew, type SandboxOpenTarget, type SandboxOpened, type SandboxSummary, Screen, type ScreenBrowser, SecretScrubber, type SeedResult, type SessionRunReport, type SessionRunResult, type SessionSurfaces, type SetRunDoc, type SettleOptions, type SlugDeclaration, type SurfaceDescriptor, TRANSFORMS, TaskEditClient, type TaskEditCloseInput, type TaskEditCloseResult, type TaskEditRollbackInput, type TaskEditRollbackResult, type TaskEditSealed, type TaskEditStatus, type TaskEditTarget, type TaskEditTaskRef, type TaskExport, type TaskGrade, type TaskManifest, type TaskManifestSession, TaskRun, type TaskRunResult, TaskSessions, type TaskSessionsResponse, type TaskWorldRef, type TaskWorldSessionState, type ToolCallRecord, type ToolCallSink, type ToolFunctions, type Transform, VERIFIER_REWARD_PREFIX, type ValidateReport, type ValidatedRun, type VerifierGrade, WHITESPACE, WorldBrowser, WorldCallTooLarge, type WorldDependency, type WorldDeprecation, type WorldDescription, WorldEditClient, type WorldEntity, type WorldEntityMapping, type WorldField, type WorldMigrationRefusal, type WorldMigrationReport, type WorldQueryAcrossOptions, type WorldQueryAcrossResult, type WorldQueryCompare, type WorldQueryCompareStatus, type WorldQueryGroup, type WorldQueryOptions, type WorldQueryResult, type WorldQuerySnapshot, type WorldQueryWhere, type WorldRelationship, type WorldRequest, WorldRequestLog, WorldSandboxClient, WorldSession, type WorldSessionCall, WorldSessionCallError, type WorldSessionListItem, type WorldSessionState, type WorldSessionTask, WorldSessionTimeout, WorldSet, type WorldSurfaceKind, WorldSurfaceUnavailable, WorldTask, type WorldTaskCheck, type WorldTaskDetail, type WorldTaskFieldOp, type WorldTaskGrader, type WorldTaskIdRef, type WorldTaskInfo, type WorldTaskPage, type WorldTaskRef, type WorldTaskRubricCriterion, type WorldTaskRubricGrader, type WorldTaskScalar, type WorldTaskSeed, type WorldTaskSpec, type WorldTaskSummary, type WorldTaskValidation, type WorldTaskVerifier, type WorldTaskVerifierRow, type WorldTaskVersionSummary, type WorldTaskWorld, type WorldTaskWorldValidation, type WorldToolSpec, type WorldToolkit, type WorldsClientOptions, aggregateTaskGrade, apiRequest, applyTransforms, archiveMode, assertBrowserTier, assertTaskRef, attachManifest, attachSession, attachTask, buildFileManifest, buildSourceTarball, captureToolCalls, checkoutIdentity, closeConnection, collectArchiveRelPaths, computeContentHash, computerUseToolkit, createRef, createTask, deleteEnvSecret, deleteTask, describeWorld, detectProvenance, extractBundle, getRun, getTask, hashForm, idleWarning, ingest, ingestToolCalls, isBrowserGone, isSandboxImportPending, isTaskIdRef, isTaskManifest, isTaskSpec, listEnvSecretKeys, listRunConfigs, listRuns, listSessions, listTaskSessions, listTasks, localTreeState, migrateProjectWorlds, migrateWorld, modelToolName, openBrowser, openSession, openTask, openWorld, openWorldVersion, parseErrorBody, parseSlugRef, parseToolCallRecord, parseTransform, parseWorldTaskRefs, playwrightKey, preserveForm, propose, pull, push, pushBranch, pushSlug, pyText, queryRows, queryRowsSearch, readField, readLocalMeta, readToolCallRecords, rebaseConflicts, redactActionArgs, redactionOf, releaseConnection, resolveBrowserMode, resolvePushSlug, roundForm, runSessions, runSet, runTask, schemaFromSignature, serializeCallBody, sessionToolObservations, setEnvSecret, shapeText, snapshotTreeHashes, storedForms, surfaceDescriptor, surfaceKinds, taskLabel, toolCallRecordsIn, toolCallsFromObservations, uiEntryUrl, uiUrl, uncommittedPaths, updateTask, upsertRunConfig, validateTask, validateWorld, waitForRun, withoutUiToken, writeLocalMeta };
|
|
4174
|
+
export { ACTION_NAMES, type ActingUser, type ActionArgs, type ActionResult, ActionTracer, type AiSdkAnthropicOutput, type AiSdkComputerCall, type AiSdkComputerOutput, type AiSdkModelOutput, AnthropicComputer, AnthropicComputer20251124, type AnthropicToolResult, ApiError, BROWSER_GONE_PATTERNS, BROWSER_TIERS, type BrowserActionEvent, BrowserActionRecorder, type BrowserConnection, type BrowserMode, type BrowserPage, BrowserReconnected, BrowserReconnector, type BrowserTier, BrowserUnrecoverable, CALL_BODY_LIMIT_BYTES, CALL_BODY_LIMIT_LABEL, COMPUTER_USE_SPECS, type Checkout, CheckoutProvenance, ComputerAction, type ComputerCallOutput, type CreateEvaluationOptions, DEFAULT_BRANCH, DEFAULT_VIEWPORT, DRY_RUN_AGENT, DRY_RUN_KIND, DetachedPushError, type DispatchedRun, Display, type DryRunImageDecision, DryRunOutcome, type DryRunSettlement, EVENT_BATCH_SIZE, EVENT_FLUSH_INTERVAL_MS, EVENT_MAX_RETRIES, EXPLORATORY_TASK, EXPLORATORY_TASK_SOURCE, type EditSessionCloseInput, type EditSessionList, type EditSessionListQuery, type EditSessionResult, type EditSessionRollbackInput, type EditSessionSummary, type EvalSample, type FinalizeEvaluationOptions, GatewayEvalsClient, GradePayload, GradeRefused, type GradeResult, type GradedJournal, HostedDryRunClient, type HostedDryRunDispatch, type HostedDryRunStatus, type HostedDryRunVerdict, IDLE_WARNING_MINUTES, type IngestExplode, type IngestFieldSpec, type IngestMapping, type IngestMode, type IngestOptions, type IngestRefusal, type IngestReport, type IngestSource, type IngestSourceReport, type IngestToolCallsOptions, type IngestToolCallsReport, KEY_NAMES, KeyChord, type ListRunsFilter, type ListSessionsFilter, type LiveTaskSession, type LocalMeta, type MigrateWorldOptions, NOT_EXECUTED, NO_GRADER_REASON, NativeComputer, type NativeComputerKinds, type NativeComputerOptions, type NativeComputerProvider, type NativePage, type ObservationConversion, type ObservationLike, OpenAIComputer, OpenAIPreviewComputer, type OpenSessionOptions, type OpenTaskOptions, PLATFORM_SESSION_HEADER, type ParsedToolCall, PendingSafetyChecks, type Plaintext, PlatformMethod, type PlaywrightBrowserLike, type PlaywrightLike, PushSlugConflict, type PushSlugResolution, RECOVER_BUDGET_MS, REQUESTS_NOT_RECORDED, REQUEST_BODY_CAPTURE_BYTES, REQUEST_LOG_PAGE_MAX, type RebaseConflictPath, type RecoveryResult, type RedactMode, type RedactPolicy, type Redaction, type RegradedRollout, type RepairAnswer, type ResolvedWorldVersion, RetryPolicy, type RowsRefusal, type RunConfigInput, type RunConfigSummary, type RunProvenance, type RunReport, type RunSetOptions, type RunSetResult, type RunSummary, type RunTaskOptions, type RunTaskSummary, SANDBOX_EXEC_REPORT_MARGIN_MS, SANDBOX_EXEC_START_ATTEMPTS, SANDBOX_EXEC_TIMEOUT_MAX_S, SANDBOX_EXEC_WAIT_MS, SANDBOX_FILE_MAX_BYTES, SANDBOX_REQUEST_TIMEOUT_MS, SANDBOX_WRITE_CHUNK_BYTES, SANDBOX_WRITE_SKIPPED, SECRET_KEY, SESSION_AUTH_MODES, SESSION_STATES, SPAN_PREFIX, STATUS_WAIT_CAP_SECONDS, STRIP_PREFIX, SURFACE_KINDS, type SafetyCheck, type SandboxChanges, type SandboxCheckResult, type SandboxCommitInput, type SandboxCommitPending, type SandboxCommitResult, type SandboxExecResult, type SandboxExecRunning, type SandboxImportInput, type SandboxImportPending, type SandboxImportResult, type SandboxListFilter, type SandboxOpenExisting, type SandboxOpenNew, type SandboxOpenTarget, type SandboxOpened, type SandboxSummary, Score, Screen, type ScreenBrowser, SecretScrubber, type SeedResult, type SessionAuthMode, type SessionRunReport, type SessionRunResult, type SessionSurfaces, type SetRunDoc, type SettleOptions, type SlugDeclaration, type SurfaceDescriptor, TOOL_CONTRACT_UNREAD, TRANSFORMS, TaskEditClient, type TaskEditCloseInput, type TaskEditCloseResult, type TaskEditRollbackInput, type TaskEditRollbackResult, type TaskEditSealed, type TaskEditStatus, type TaskEditTarget, type TaskEditTaskRef, type TaskExport, type TaskGrade, TaskGrades, type TaskManifest, type TaskManifestSession, type TaskRegrade, type TaskRegradeScope, TaskRun, type TaskRunResult, TaskSessions, type TaskSessionsResponse, type TaskTrial, type TaskTrialCheck, type TaskTrialRequest, type TaskTrialTarget, type TaskWorldRef, type TaskWorldSessionState, type ToolCallRecord, type ToolCallSink, type ToolFunctions, type Transform, VERIFIER_REWARD_PREFIX, type ValidateReport, type ValidatedRun, type VerifierGrade, WHITESPACE, WORLD_REQUEST_VIAS, WorldBrowser, WorldCallTooLarge, type WorldDependency, type WorldDeprecation, type WorldDescription, WorldEditClient, type WorldEntity, type WorldEntityMapping, type WorldField, type WorldMigrationRefusal, type WorldMigrationReport, WorldNotice, type WorldQueryAcrossOptions, type WorldQueryAcrossResult, type WorldQueryCompare, type WorldQueryCompareStatus, type WorldQueryGroup, type WorldQueryOptions, type WorldQueryResult, type WorldQuerySnapshot, type WorldQueryWhere, type WorldRelationship, type WorldRequest, type WorldRequestEntry, type WorldRequestFilter, WorldRequestFilterError, WorldRequestLedger, WorldRequestLog, type WorldRequestPage, WorldRequestQuery, WorldRequestsNotRecorded, WorldSandboxClient, WorldSession, type WorldSessionCall, WorldSessionCallError, type WorldSessionListItem, WorldSessionOpenFailed, type WorldSessionRestart, type WorldSessionState, type WorldSessionTask, WorldSessionTimeout, WorldSet, type WorldSqlOptions, type WorldSqlResult, type WorldSurfaceKind, WorldSurfaceUnavailable, WorldTask, type WorldTaskCheck, type WorldTaskDetail, type WorldTaskFieldOp, type WorldTaskGrader, type WorldTaskIdRef, type WorldTaskInfo, type WorldTaskPage, type WorldTaskRef, type WorldTaskRubricCriterion, type WorldTaskRubricGrader, type WorldTaskScalar, type WorldTaskSeed, type WorldTaskSpec, type WorldTaskSummary, type WorldTaskValidation, type WorldTaskVerifier, type WorldTaskVerifierRow, type WorldTaskVersionSummary, type WorldTaskWorld, type WorldTaskWorldValidation, type WorldToolSpec, type WorldToolkit, WorldToolsUnread, type WorldsClientOptions, WriteTreeFilter, aggregateTaskGrade, apiRequest, applyTransforms, archiveMode, assertBrowserTier, assertSessionAuthMode, assertTaskRef, attachManifest, attachSession, attachTask, buildFileManifest, buildSourceTarball, capabilityLabel, captureToolCalls, carriedWarnings, checkoutIdentity, closeConnection, collectArchiveRelPaths, computeContentHash, computerUseToolkit, createRef, createTask, deleteEnvSecret, deleteTask, describeWorld, detectProvenance, extractBundle, getRun, getTask, hashForm, idleWarning, ingest, ingestToolCalls, invalidFields, isBrowserGone, isSandboxCommitPending, isSandboxImportPending, isTaskIdRef, isTaskManifest, isTaskSpec, listEnvSecretKeys, listRunConfigs, listRuns, listSessions, listTaskSessions, listTasks, localTreeState, messageOf, migrateProjectWorlds, migrateWorld, modelToolName, openBrowser, openSession, openTask, openWorld, openWorldVersion, parseErrorBody, parseSlugRef, parseToolCallRecord, parseTransform, parseWorldTaskRefs, playwrightKey, preserveForm, propose, pull, push, pushBranch, pushSlug, pyText, queryRows, queryRowsSearch, readField, readLocalMeta, readToolCallRecords, rebaseConflicts, redactActionArgs, redactionOf, releaseConnection, resolveBrowserMode, resolvePushSlug, roundForm, rowsRefusal, runSessions, runSet, runTask, schemaFromSignature, serializeCallBody, sessionToolObservations, setEnvSecret, shapeText, snapshotTreeHashes, sqlRows, stillStartingHint, storedForms, surfaceDescriptor, surfaceKinds, taskGradeError, taskLabel, taskRunFailure, toolCallRecordsIn, toolCallsFromObservations, uiEntryUrl, uiUrl, uncommittedPaths, updateTask, upsertRunConfig, validateTask, validateWorld, waitForRun, withoutUiToken, worldRequestsUnrecorded, writeLocalMeta };
|