@withgateway/sdk 0.3.3 → 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 +4 -3
- package/dist/cli.js +2221 -962
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +2212 -953
- package/dist/cli.mjs.map +1 -1
- package/dist/files/index.js +81 -19
- package/dist/files/index.js.map +1 -1
- package/dist/files/index.mjs +79 -17
- 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.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +903 -221
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +868 -212
- package/dist/index.mjs.map +1 -1
- package/dist/traces/index.js +78 -16
- package/dist/traces/index.js.map +1 -1
- package/dist/traces/index.mjs +76 -14
- package/dist/traces/index.mjs.map +1 -1
- package/dist/tracing/index.js +7 -1
- package/dist/tracing/index.js.map +1 -1
- package/dist/tracing/index.mjs +7 -1
- package/dist/tracing/index.mjs.map +1 -1
- package/dist/worlds/index.d.mts +692 -410
- package/dist/worlds/index.d.ts +692 -410
- package/dist/worlds/index.js +740 -197
- package/dist/worlds/index.js.map +1 -1
- package/dist/worlds/index.mjs +736 -193
- package/dist/worlds/index.mjs.map +1 -1
- package/package.json +1 -1
- package/runtime/gatewaysdk/environment/_materialize.py +5 -25
- package/runtime/gatewaysdk/environment/_world.py +58 -65
- package/runtime/gatewaysdk/environment/backing.py +20 -24
- package/runtime/gatewaysdk/environment/core.py +1 -16
- package/runtime/gatewaysdk/environment/legacy_sqlite.py +14 -27
- package/runtime/gatewaysdk/environment/schema/admission.py +174 -0
- package/runtime/gatewaysdk/environment/schema/api.py +174 -471
- package/runtime/gatewaysdk/environment/schema/assertions.py +458 -0
- package/runtime/gatewaysdk/environment/schema/batch.py +3 -3
- 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 +230 -18
- package/runtime/gatewaysdk/environment/schema/call_redaction.py +201 -19
- package/runtime/gatewaysdk/environment/schema/cast.py +15 -35
- package/runtime/gatewaysdk/environment/schema/conform.py +6 -27
- package/runtime/gatewaysdk/environment/schema/connector.py +89 -152
- 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 +14 -13
- package/runtime/gatewaysdk/environment/schema/database/base.py +106 -165
- package/runtime/gatewaysdk/environment/schema/database/guard.py +43 -36
- package/runtime/gatewaysdk/environment/schema/database/reads.py +169 -0
- package/runtime/gatewaysdk/environment/schema/database/sqlite.py +57 -31
- package/runtime/gatewaysdk/environment/schema/declared_routes.py +210 -0
- package/runtime/gatewaysdk/environment/schema/door.py +899 -0
- package/runtime/gatewaysdk/environment/schema/envelope.py +86 -28
- package/runtime/gatewaysdk/environment/schema/grading.py +58 -86
- package/runtime/gatewaysdk/environment/schema/handler_errors.py +25 -4
- package/runtime/gatewaysdk/environment/schema/host.py +229 -1695
- 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/ledger_spill.py +828 -0
- package/runtime/gatewaysdk/environment/schema/local.py +31 -116
- package/runtime/gatewaysdk/environment/schema/platform.py +15 -17
- 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 +129 -176
- package/runtime/gatewaysdk/environment/schema/session_files.py +133 -24
- 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 +8 -9
- package/runtime/gatewaysdk/environment/schema/skills/connector-schema-authoring/SKILL.md +31 -6
- package/runtime/gatewaysdk/environment/schema/skills/world-data-ingestion/ROWS.md +12 -8
- package/runtime/gatewaysdk/environment/schema/skills/world-data-ingestion/SKILL.md +13 -13
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/SKILL.md +23 -23
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/cli-mcp-map.md +11 -6
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/gotchas.md +35 -2
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/journal-checks.md +182 -0
- package/runtime/gatewaysdk/environment/schema/snapshot.py +149 -29
- package/runtime/gatewaysdk/environment/schema/spill_files.py +228 -0
- package/runtime/gatewaysdk/environment/schema/tasks.py +229 -323
- package/runtime/gatewaysdk/environment/schema/tools_world.py +84 -203
- package/runtime/gatewaysdk/environment/schema/validation.py +69 -1
- 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 +203 -39
- package/runtime/gatewaysdk/environment/schema/world_host.py +953 -0
- package/runtime/gatewaysdk/environment/schema/world_tests.py +9 -11
- package/runtime/gatewaysdk/environment/world.py +1 -1
- package/runtime/gatewaysdk/environment/world_session_contract.py +14 -0
- package/skills/agents/connector-template-author.md +5 -1
- package/skills/benchmarks-getting-started/SKILL.md +8 -9
- package/skills/connector-schema-authoring/SKILL.md +31 -6
- package/skills/connector-schema-authoring/connector-worlds.md +129 -7
- package/skills/world-data-ingestion/ROWS.md +12 -8
- package/skills/world-data-ingestion/SKILL.md +13 -13
- package/skills/worlds-getting-started/SKILL.md +23 -23
- package/skills/worlds-getting-started/references/cli-mcp-map.md +11 -6
- package/skills/worlds-getting-started/references/gotchas.md +35 -2
- package/skills/worlds-getting-started/references/journal-checks.md +182 -0
package/dist/worlds/index.d.mts
CHANGED
|
@@ -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,6 +690,97 @@ 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;
|
|
694
|
+
/**
|
|
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.
|
|
703
|
+
*/
|
|
704
|
+
declare function schemaFromSignature(spec: WorldToolSpec): {
|
|
705
|
+
type: "function";
|
|
706
|
+
function: {
|
|
707
|
+
name: string;
|
|
708
|
+
description: string;
|
|
709
|
+
parameters: Record<string, unknown>;
|
|
710
|
+
};
|
|
711
|
+
};
|
|
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;
|
|
761
|
+
/**
|
|
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}`.
|
|
768
|
+
*/
|
|
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
|
+
|
|
701
784
|
/**
|
|
702
785
|
* A world's grade as the SDK reads it, by the one score rule every grader
|
|
703
786
|
* answers by: a finite number from 0 to 1, a passed check 1, a failed one 0,
|
|
@@ -762,99 +845,6 @@ declare class GradePayload {
|
|
|
762
845
|
private static failed;
|
|
763
846
|
}
|
|
764
847
|
|
|
765
|
-
/**
|
|
766
|
-
* The three shapes a task reaches `openSession` in — a bundled scenario's
|
|
767
|
-
* name, a stored task's `{ id, version? }`, an inline spec — and how each is
|
|
768
|
-
* told apart, labelled and checked. No task at all (`undefined`) is the
|
|
769
|
-
* fourth case, an exploratory session, and is not a ref.
|
|
770
|
-
*/
|
|
771
|
-
declare const isTaskIdRef: (task: WorldTaskRef) => task is WorldTaskIdRef;
|
|
772
|
-
declare const isTaskSpec: (task: WorldTaskRef) => task is WorldTaskSpec;
|
|
773
|
-
/** The label a task goes by in results: its name, `inline:<hash>` for an
|
|
774
|
-
* unnamed inline task once the platform has hashed it, or the stored task's
|
|
775
|
-
* name (its id until the platform has answered). */
|
|
776
|
-
declare const taskLabel: (task: WorldTaskRef, info?: WorldSessionTask | null) => string;
|
|
777
|
-
/** A task given to `openSession` must be one of the three shapes. */
|
|
778
|
-
declare const assertTaskRef: (task: WorldTaskRef) => void;
|
|
779
|
-
|
|
780
|
-
declare class WorldSessionTimeout extends Error {
|
|
781
|
-
}
|
|
782
|
-
declare class WorldSessionCallError extends Error {
|
|
783
|
-
}
|
|
784
|
-
/** The session ended before it was ready: it FAILED to open, or was STOPPED.
|
|
785
|
-
* `code` is the platform's when it named one; `browser_capacity` and
|
|
786
|
-
* `host_unavailable` are worth opening again. */
|
|
787
|
-
declare class WorldSessionOpenFailed extends WorldSessionCallError {
|
|
788
|
-
readonly sessionId: string;
|
|
789
|
-
readonly state: string;
|
|
790
|
-
readonly code: string | null;
|
|
791
|
-
constructor(sessionId: string, state: string, code: string | null, reason: string | null);
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
/**
|
|
795
|
-
* LIVE WORLD SESSIONS from TypeScript: your agent, the platform's container.
|
|
796
|
-
*
|
|
797
|
-
* The other two ways of running a world each give up something. Pulling the
|
|
798
|
-
* bundle and executing it locally tests your agent against a COPY — your
|
|
799
|
-
* python, your sqlite, your machine's idea of the environment. Dispatching a
|
|
800
|
-
* hosted run gives you the real container but runs the platform's agent
|
|
801
|
-
* inside it, so your agent never touches the world.
|
|
802
|
-
*
|
|
803
|
-
* A session is both: the platform boots the task's container and holds it
|
|
804
|
-
* warm, and every `call()` here executes inside THAT container. Your agent
|
|
805
|
-
* stays where it is — this file is just the wire.
|
|
806
|
-
*
|
|
807
|
-
* const world = await openWorld("revenue-ops-sim@main");
|
|
808
|
-
* const session = await openSession(world.slug, { task: "revops-mara-dedupe-contacts" });
|
|
809
|
-
* await session.ready(); // wait for the container
|
|
810
|
-
* await session.call("crm_search", { entity: "deals" });
|
|
811
|
-
* await session.withTraceContext(() => myAgent(session)); // traced under session.sessionId
|
|
812
|
-
* const { reward, rewards } = await session.grade();
|
|
813
|
-
* await session.close({ keepWarm: true }); // hand it back to the pool
|
|
814
|
-
*
|
|
815
|
-
* The task can also be YOURS rather than the bundle's — an instruction, the
|
|
816
|
-
* rows the session starts with and how it is graded, for one end user:
|
|
817
|
-
*
|
|
818
|
-
* const session = await openSession("acme-billing@main", {
|
|
819
|
-
* task: {
|
|
820
|
-
* instruction: "Mark invoice INV-7 as paid.",
|
|
821
|
-
* seed: { rows: { invoices: [{ id: "INV-7", status: "open" }] } },
|
|
822
|
-
* grader: { kind: "assertions", checks: [
|
|
823
|
-
* { entity: "invoices", where: { id: "INV-7", status: "paid" } },
|
|
824
|
-
* ] },
|
|
825
|
-
* metadata: { externalUserId: "u_42" },
|
|
826
|
-
* },
|
|
827
|
-
* surfaces: ["api"],
|
|
828
|
-
* });
|
|
829
|
-
*
|
|
830
|
-
* Every call is a row on the platform before it is an effect in a container,
|
|
831
|
-
* so the episode is on the record — and the platform traces the session
|
|
832
|
-
* itself, which is why these sessions show up under Sessions without the
|
|
833
|
-
* caller instrumenting anything.
|
|
834
|
-
*/
|
|
835
|
-
type WorldToolSpec = {
|
|
836
|
-
name: string;
|
|
837
|
-
/** The world's own signature, e.g. `crm_search(q=None, entity="deals")`. */
|
|
838
|
-
signature: string;
|
|
839
|
-
doc: string | null;
|
|
840
|
-
inputSchema?: Record<string, unknown>;
|
|
841
|
-
};
|
|
842
|
-
/** What a model needs to call a world: the schemas to advertise, and the
|
|
843
|
-
* implementations that run them in the container. */
|
|
844
|
-
type WorldToolkit = {
|
|
845
|
-
/** OpenAI-shaped tool definitions, derived from the world's signatures. */
|
|
846
|
-
schemas: {
|
|
847
|
-
type: "function";
|
|
848
|
-
function: {
|
|
849
|
-
name: string;
|
|
850
|
-
description: string;
|
|
851
|
-
parameters: Record<string, unknown>;
|
|
852
|
-
};
|
|
853
|
-
}[];
|
|
854
|
-
/** name -> implementation, each one a call into THIS session. */
|
|
855
|
-
impls: Record<string, (args: Record<string, unknown>) => Promise<unknown>>;
|
|
856
|
-
specs: WorldToolSpec[];
|
|
857
|
-
};
|
|
858
848
|
/** A JSON scalar: what `where` filters and field predicates compare against. */
|
|
859
849
|
type WorldTaskScalar = string | number | boolean | null;
|
|
860
850
|
/** The rows a task starts the session with — the `seed()` contract, applied
|
|
@@ -896,6 +886,10 @@ type WorldTaskCheck = {
|
|
|
896
886
|
field?: string;
|
|
897
887
|
op?: WorldTaskFieldOp;
|
|
898
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>;
|
|
899
893
|
};
|
|
900
894
|
/** One thing a rubric judge scores in [0, 1]; `id` names its entry in
|
|
901
895
|
* `rewards`, `weight` (default 1) its share of the task's reward. */
|
|
@@ -928,6 +922,8 @@ type WorldTaskGrader = {
|
|
|
928
922
|
kind: "python";
|
|
929
923
|
source: string;
|
|
930
924
|
timeoutSeconds?: number;
|
|
925
|
+
readsJournal?: boolean;
|
|
926
|
+
acceptsIncompleteJournal?: boolean;
|
|
931
927
|
} | WorldTaskRubricGrader;
|
|
932
928
|
/** A task supplied at open, for one session, instead of a bundled scenario.
|
|
933
929
|
* `instruction` is what the agent is told; without `seed` the session starts
|
|
@@ -995,6 +991,101 @@ type WorldSessionTask = {
|
|
|
995
991
|
version?: number | null;
|
|
996
992
|
metadata: Record<string, unknown>;
|
|
997
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
|
+
|
|
998
1089
|
type SeedResult = {
|
|
999
1090
|
seeded: number;
|
|
1000
1091
|
mode: "append" | "replace";
|
|
@@ -1041,6 +1132,17 @@ type WorldSessionState = {
|
|
|
1041
1132
|
message: string;
|
|
1042
1133
|
} | null;
|
|
1043
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;
|
|
1145
|
+
};
|
|
1044
1146
|
/** One notice a worlds-path answer carries: a deprecated shape or layout
|
|
1045
1147
|
* and the command that replaces it. A retired shape is refused instead,
|
|
1046
1148
|
* with the stable message prefix `world_kind_retired:`. */
|
|
@@ -1050,25 +1152,6 @@ type WorldDeprecation = {
|
|
|
1050
1152
|
replacement: string;
|
|
1051
1153
|
};
|
|
1052
1154
|
|
|
1053
|
-
declare const modelToolName: (name: string) => string;
|
|
1054
|
-
/**
|
|
1055
|
-
* Turn a world's Python signature into a JSON schema the model can call.
|
|
1056
|
-
*
|
|
1057
|
-
* `crm_update_deal(id, stage=None, owner=None, amount=None)` becomes an
|
|
1058
|
-
* object with `id` required and the rest optional. Types are read from the
|
|
1059
|
-
* DEFAULTS the world declares — a numeric default means a number, a boolean
|
|
1060
|
-
* default a boolean — because that is the only type information a signature
|
|
1061
|
-
* actually carries. Everything else is a string, which is what a tool CLI
|
|
1062
|
-
* receives anyway.
|
|
1063
|
-
*/
|
|
1064
|
-
declare function schemaFromSignature(spec: WorldToolSpec): {
|
|
1065
|
-
type: "function";
|
|
1066
|
-
function: {
|
|
1067
|
-
name: string;
|
|
1068
|
-
description: string;
|
|
1069
|
-
parameters: Record<string, unknown>;
|
|
1070
|
-
};
|
|
1071
|
-
};
|
|
1072
1155
|
declare class WorldSession {
|
|
1073
1156
|
readonly sessionId: string;
|
|
1074
1157
|
private current;
|
|
@@ -1102,9 +1185,9 @@ declare class WorldSession {
|
|
|
1102
1185
|
surfaces(): Promise<SessionSurfaces>;
|
|
1103
1186
|
/** Base URL of the world's own HTTP API for this session. */
|
|
1104
1187
|
api(): Promise<string>;
|
|
1105
|
-
/** Headers every request to `api()` needs
|
|
1106
|
-
*
|
|
1107
|
-
* 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. */
|
|
1108
1191
|
apiHeaders(): Promise<Record<string, string>>;
|
|
1109
1192
|
/** URL of the world's UI entry page for this session. */
|
|
1110
1193
|
ui(): Promise<string>;
|
|
@@ -1139,6 +1222,14 @@ declare class WorldSession {
|
|
|
1139
1222
|
nativeComputer<P extends NativeComputerProvider = "anthropic">(browser: WorldBrowser, provider?: P, options?: NativeComputerOptions): NativeComputerKinds[P];
|
|
1140
1223
|
/** The session's latest platform state (one request, no waiting). */
|
|
1141
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;
|
|
1142
1233
|
/**
|
|
1143
1234
|
* Wait until the session answers calls: a World Host holds it, or the
|
|
1144
1235
|
* process inside a pod has asked the platform for work. Throws
|
|
@@ -1220,6 +1311,14 @@ declare class WorldSession {
|
|
|
1220
1311
|
reset(opts?: {
|
|
1221
1312
|
timeoutMs?: number;
|
|
1222
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;
|
|
1223
1322
|
/** The session's call log, oldest first: every tool call, seed, reset,
|
|
1224
1323
|
* grade with its result — the record of the episode. */
|
|
1225
1324
|
export(): Promise<WorldSessionCall[]>;
|
|
@@ -1274,6 +1373,10 @@ type OpenSessionOptions = {
|
|
|
1274
1373
|
/** Capacity for a World Host session's browser: `standard` (spot, may be
|
|
1275
1374
|
* reclaimed) or `premium` (on-demand). Unset, the organization's default. */
|
|
1276
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;
|
|
1277
1380
|
options?: WorldsClientOptions;
|
|
1278
1381
|
};
|
|
1279
1382
|
/**
|
|
@@ -1409,6 +1512,15 @@ declare function runSessions(opts: {
|
|
|
1409
1512
|
*/
|
|
1410
1513
|
declare const SURFACE_KINDS: readonly ["tools", "api", "ui", "browser"];
|
|
1411
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;
|
|
1412
1524
|
/** Capacity behind a World Host session's browser. `standard` runs on spot
|
|
1413
1525
|
* capacity first (about half the price) and may be reclaimed with two
|
|
1414
1526
|
* minutes' notice, ending the browser but never the world; `premium` is
|
|
@@ -1436,11 +1548,14 @@ type SessionSurfaces = {
|
|
|
1436
1548
|
};
|
|
1437
1549
|
api?: {
|
|
1438
1550
|
url: string;
|
|
1439
|
-
/** Per-session credential of a World Host session: send it
|
|
1440
|
-
* `
|
|
1441
|
-
*
|
|
1442
|
-
* 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. */
|
|
1443
1556
|
token?: string;
|
|
1557
|
+
/** `open`: `url` is the session's capability hostname; send no credential. */
|
|
1558
|
+
auth?: "open";
|
|
1444
1559
|
};
|
|
1445
1560
|
ui?: {
|
|
1446
1561
|
url: string;
|
|
@@ -1450,8 +1565,10 @@ type SessionSurfaces = {
|
|
|
1450
1565
|
apiPath?: string | null;
|
|
1451
1566
|
/** Per-session credential of a World Host UI. A browser navigation cannot
|
|
1452
1567
|
* carry a header, so the first page load presents it once as `?token=`
|
|
1453
|
-
* 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. */
|
|
1454
1570
|
token?: string;
|
|
1571
|
+
auth?: "open";
|
|
1455
1572
|
};
|
|
1456
1573
|
browser?: {
|
|
1457
1574
|
wsUrl: string;
|
|
@@ -1529,10 +1646,10 @@ type BrowserActionEvent = {
|
|
|
1529
1646
|
/** base64 JPEG of the screen after the action; null if it could not be taken. */
|
|
1530
1647
|
screenshot: string | null;
|
|
1531
1648
|
};
|
|
1532
|
-
/**
|
|
1533
|
-
*
|
|
1534
|
-
*
|
|
1535
|
-
|
|
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;
|
|
1536
1653
|
declare function redactActionArgs(action: string, args: Record<string, unknown>): Record<string, unknown>;
|
|
1537
1654
|
/**
|
|
1538
1655
|
* Ships browser action events to the platform, off the action's hot path.
|
|
@@ -1775,6 +1892,12 @@ declare const CALL_BODY_LIMIT_BYTES: number;
|
|
|
1775
1892
|
declare const CALL_BODY_LIMIT_LABEL = "4mb";
|
|
1776
1893
|
/** `session status` warns once an unpinned session has less than this left. */
|
|
1777
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";
|
|
1778
1901
|
/** The task an exploratory session runs on when the caller names none, and
|
|
1779
1902
|
* the `task.source` the platform reports for it. */
|
|
1780
1903
|
declare const EXPLORATORY_TASK: Readonly<{
|
|
@@ -1809,6 +1932,101 @@ declare const stillStartingHint: (sessionId: string) => string;
|
|
|
1809
1932
|
* `IDLE_WARNING_MINUTES` left, else null. `now` is for tests. */
|
|
1810
1933
|
declare function idleWarning(idleExpiresAt: string | null | undefined, now?: Date): string | null;
|
|
1811
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
|
+
}
|
|
2029
|
+
|
|
1812
2030
|
/** Where a session answers, in the shape `session open` prints and a
|
|
1813
2031
|
* `task up` manifest keeps per world. */
|
|
1814
2032
|
type SurfaceDescriptor = {
|
|
@@ -1816,6 +2034,7 @@ type SurfaceDescriptor = {
|
|
|
1816
2034
|
api?: {
|
|
1817
2035
|
url: string;
|
|
1818
2036
|
token?: string;
|
|
2037
|
+
auth?: "open";
|
|
1819
2038
|
};
|
|
1820
2039
|
ui?: {
|
|
1821
2040
|
url: string;
|
|
@@ -1838,23 +2057,17 @@ type WorldTaskWorld = {
|
|
|
1838
2057
|
grader?: WorldTaskSpec["grader"];
|
|
1839
2058
|
tools?: string[];
|
|
1840
2059
|
};
|
|
1841
|
-
/** One world's session as the platform answered it at up.
|
|
1842
|
-
* world came up on the caller's own unsealed edits (its edit session's tip
|
|
1843
|
-
* answered `main`). */
|
|
2060
|
+
/** One world's session as the platform answered it at up. */
|
|
1844
2061
|
type TaskWorldSessionState = WorldSessionState & {
|
|
1845
2062
|
alias: string;
|
|
1846
2063
|
slug: string;
|
|
1847
2064
|
ref: string;
|
|
1848
|
-
private: boolean;
|
|
1849
2065
|
reusedWarm: boolean;
|
|
1850
2066
|
};
|
|
1851
|
-
/** Which world an alias is, as recorded at up or attach.
|
|
1852
|
-
* when it is not known (attached by task id, or a manifest written before
|
|
1853
|
-
* the platform reported it). */
|
|
2067
|
+
/** Which world an alias is, as recorded at up or attach. */
|
|
1854
2068
|
type TaskWorldRef = {
|
|
1855
2069
|
slug: string;
|
|
1856
2070
|
ref: string | null;
|
|
1857
|
-
private: boolean | null;
|
|
1858
2071
|
};
|
|
1859
2072
|
/** What `POST /world-task-sessions` answers. */
|
|
1860
2073
|
type TaskSessionsResponse = {
|
|
@@ -1870,7 +2083,6 @@ type TaskSessionsResponse = {
|
|
|
1870
2083
|
type TaskManifestSession = {
|
|
1871
2084
|
slug: string;
|
|
1872
2085
|
ref: string | null;
|
|
1873
|
-
private: boolean | null;
|
|
1874
2086
|
versionId: string;
|
|
1875
2087
|
sessionId: string;
|
|
1876
2088
|
ready: boolean;
|
|
@@ -2079,11 +2291,9 @@ type RunTaskSummary = {
|
|
|
2079
2291
|
rewards: Record<string, number>;
|
|
2080
2292
|
ungraded: string[];
|
|
2081
2293
|
agentError: string | null;
|
|
2082
|
-
/** Why the run stopped short of a grade
|
|
2083
|
-
* interrupt. Filed failed with this as its reason. */
|
|
2294
|
+
/** Why the run stopped short of a grade (a world that never came up, an interrupt); filed FAILED with it. */
|
|
2084
2295
|
runError: string | null;
|
|
2085
|
-
/** The grade's errors on one line
|
|
2086
|
-
* grade, or two rewards under one key. Filed failed with this as its reason. */
|
|
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. */
|
|
2087
2297
|
gradeError: string | null;
|
|
2088
2298
|
/** Why the evaluation could not be filed; `filed` is then false. */
|
|
2089
2299
|
fileError: string | null;
|
|
@@ -2168,20 +2378,180 @@ type Checkout = {
|
|
|
2168
2378
|
title?: string;
|
|
2169
2379
|
};
|
|
2170
2380
|
};
|
|
2171
|
-
type Env = Record<string, string | undefined>;
|
|
2172
|
-
/** Labels for the reader, never used to authorize. The PR comes from `GATEWAY_PR_URL`
|
|
2173
|
-
* (+ `GATEWAY_PR_TITLE`), else GitHub Actions' `GITHUB_REF=refs/pull/<n>/merge`. */
|
|
2174
|
-
declare class CheckoutProvenance {
|
|
2175
|
-
private readonly cwd;
|
|
2176
|
-
private readonly env;
|
|
2177
|
-
constructor(cwd: string, env: Env);
|
|
2178
|
-
static read(cwd?: string, env?: Env): Checkout;
|
|
2179
|
-
checkout(): Checkout;
|
|
2180
|
-
/** Security: credentials are stripped; scp-style `git@host:org/repo` has none and is kept. */
|
|
2181
|
-
static withoutCredentials(url: string): string;
|
|
2182
|
-
private withPr;
|
|
2183
|
-
private pullRequest;
|
|
2184
|
-
private git;
|
|
2381
|
+
type Env = Record<string, string | undefined>;
|
|
2382
|
+
/** Labels for the reader, never used to authorize. The PR comes from `GATEWAY_PR_URL`
|
|
2383
|
+
* (+ `GATEWAY_PR_TITLE`), else GitHub Actions' `GITHUB_REF=refs/pull/<n>/merge`. */
|
|
2384
|
+
declare class CheckoutProvenance {
|
|
2385
|
+
private readonly cwd;
|
|
2386
|
+
private readonly env;
|
|
2387
|
+
constructor(cwd: string, env: Env);
|
|
2388
|
+
static read(cwd?: string, env?: Env): Checkout;
|
|
2389
|
+
checkout(): Checkout;
|
|
2390
|
+
/** Security: credentials are stripped; scp-style `git@host:org/repo` has none and is kept. */
|
|
2391
|
+
static withoutCredentials(url: string): string;
|
|
2392
|
+
private withPr;
|
|
2393
|
+
private pullRequest;
|
|
2394
|
+
private git;
|
|
2395
|
+
}
|
|
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>;
|
|
2185
2555
|
}
|
|
2186
2556
|
|
|
2187
2557
|
type SetRunDoc = {
|
|
@@ -2193,7 +2563,7 @@ type SetRunDoc = {
|
|
|
2193
2563
|
actor: {
|
|
2194
2564
|
kind: string;
|
|
2195
2565
|
id: string;
|
|
2196
|
-
|
|
2566
|
+
actingUser: ActingUser | null;
|
|
2197
2567
|
} | null;
|
|
2198
2568
|
git: Checkout | null;
|
|
2199
2569
|
progress: {
|
|
@@ -2246,42 +2616,62 @@ type RunSetResult = {
|
|
|
2246
2616
|
/** A low or missing reward is a result, not a failure; every task runs even after one fails. */
|
|
2247
2617
|
declare function runSet(datasetId: string, agent: (run: TaskRun) => TaskRunResult | Promise<TaskRunResult>, opts: RunSetOptions): Promise<RunSetResult>;
|
|
2248
2618
|
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
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
|
+
};
|
|
2629
|
+
};
|
|
2630
|
+
type WorldRequestFilter = {
|
|
2631
|
+
session?: string;
|
|
2632
|
+
version?: string;
|
|
2262
2633
|
via?: string;
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2634
|
+
operation?: string;
|
|
2635
|
+
status?: string;
|
|
2636
|
+
since?: string;
|
|
2637
|
+
until?: string;
|
|
2638
|
+
cursor?: string;
|
|
2639
|
+
limit?: number;
|
|
2266
2640
|
};
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
*
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
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;
|
|
2277
2654
|
private constructor();
|
|
2278
|
-
static
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
get
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
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>;
|
|
2285
2675
|
}
|
|
2286
2676
|
|
|
2287
2677
|
/** One entry the archive rules dropped: a whole directory (`name/`, `files`
|
|
@@ -2384,8 +2774,6 @@ declare function buildFileManifest(dir: string): {
|
|
|
2384
2774
|
size: number;
|
|
2385
2775
|
sha256: string;
|
|
2386
2776
|
}[];
|
|
2387
|
-
/** The refusal `push` raises from a tag checkout: tags never move, so the
|
|
2388
|
-
* push needs a branch named explicitly. */
|
|
2389
2777
|
declare class DetachedPushError extends Error {
|
|
2390
2778
|
constructor(dir: string, tag: string);
|
|
2391
2779
|
}
|
|
@@ -3203,6 +3591,7 @@ type SandboxSummary = {
|
|
|
3203
3591
|
pendingSlug: string | null;
|
|
3204
3592
|
status: "open" | "closed";
|
|
3205
3593
|
lastCommitVersionId: string | null;
|
|
3594
|
+
pendingBatchId?: string | null;
|
|
3206
3595
|
createdAt: string;
|
|
3207
3596
|
};
|
|
3208
3597
|
type SandboxOpened = SandboxSummary & {
|
|
@@ -3229,6 +3618,12 @@ type SandboxExecResult = {
|
|
|
3229
3618
|
/** Why `gateway`/`sqlite3` were not on PATH for this command; empty when the runtime is staged. */
|
|
3230
3619
|
warnings: string[];
|
|
3231
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
|
+
};
|
|
3232
3627
|
type SandboxChanges = {
|
|
3233
3628
|
added: string[];
|
|
3234
3629
|
modified: string[];
|
|
@@ -3242,9 +3637,18 @@ type SandboxCheckResult = {
|
|
|
3242
3637
|
changes: SandboxChanges;
|
|
3243
3638
|
/** Working-tree paths left out of the version: `.gatewayignore`, default scratch, credential-shaped files, links. */
|
|
3244
3639
|
ignored: string[];
|
|
3245
|
-
/** 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. */
|
|
3246
3641
|
warnings: string[];
|
|
3247
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;
|
|
3248
3652
|
};
|
|
3249
3653
|
type SandboxCommitResult = {
|
|
3250
3654
|
/** The world the commit landed on. */
|
|
@@ -3260,7 +3664,24 @@ type SandboxCommitResult = {
|
|
|
3260
3664
|
warnings: string[];
|
|
3261
3665
|
/** The API key's edit session the commit joined; `gateway worlds edit close <slug>` moves main. */
|
|
3262
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;
|
|
3263
3683
|
};
|
|
3684
|
+
declare const isSandboxCommitPending: (answer: SandboxCommitResult | SandboxCommitPending) => answer is SandboxCommitPending;
|
|
3264
3685
|
/** Mirrors `PostSandboxImportBody`. */
|
|
3265
3686
|
type SandboxImportInput = {
|
|
3266
3687
|
/** A .json/.jsonl/.ndjson/.csv/.tsv (optionally .gz) relative to the world root. */
|
|
@@ -3293,6 +3714,7 @@ type SandboxImportResult = {
|
|
|
3293
3714
|
chunkCount: number;
|
|
3294
3715
|
/** `sandbox:<id>/<path>`. */
|
|
3295
3716
|
source: string;
|
|
3717
|
+
warnings?: string[];
|
|
3296
3718
|
};
|
|
3297
3719
|
/** Mirrors `PostSandboxImportPendingResponse` (202): poll `worlds data batches`. */
|
|
3298
3720
|
type SandboxImportPending = {
|
|
@@ -3301,6 +3723,7 @@ type SandboxImportPending = {
|
|
|
3301
3723
|
rowCount: number;
|
|
3302
3724
|
chunkCount: number;
|
|
3303
3725
|
source: string;
|
|
3726
|
+
warnings?: string[];
|
|
3304
3727
|
};
|
|
3305
3728
|
declare const isSandboxImportPending: (answer: SandboxImportResult | SandboxImportPending) => answer is SandboxImportPending;
|
|
3306
3729
|
/** Mirrors `PostSandboxOpenBody`: an existing world at a ref, or a new world seeded from a template. */
|
|
@@ -3315,8 +3738,34 @@ type SandboxOpenNew = {
|
|
|
3315
3738
|
type SandboxOpenTarget = SandboxOpenExisting | SandboxOpenNew;
|
|
3316
3739
|
/** `slug` or `slug@ref` → the open body; a bare slug opens the latest READY version. */
|
|
3317
3740
|
declare function parseSlugRef(slugRef: string): SandboxOpenExisting;
|
|
3318
|
-
/**
|
|
3319
|
-
|
|
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;
|
|
3320
3769
|
/** Mirrors `PostSandboxCommitBody`: `rebase` replays the sandbox's edits onto the branch head when the base moved. */
|
|
3321
3770
|
type SandboxCommitInput = {
|
|
3322
3771
|
message: string;
|
|
@@ -3332,6 +3781,22 @@ type RebaseConflictPath = {
|
|
|
3332
3781
|
declare function rebaseConflicts(error: unknown): RebaseConflictPath[] | null;
|
|
3333
3782
|
/** A 409 `sandbox_uncommitted` from `close`: the paths a commit would keep. Null for any other failure. */
|
|
3334
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;
|
|
3335
3800
|
/** `sandbox list` narrows: status, world, count (newest first). */
|
|
3336
3801
|
type SandboxListFilter = {
|
|
3337
3802
|
status?: "open" | "closed";
|
|
@@ -3357,18 +3822,24 @@ declare class WorldSandboxClient {
|
|
|
3357
3822
|
size: number;
|
|
3358
3823
|
bytes: Buffer;
|
|
3359
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. */
|
|
3360
3827
|
write(sandboxId: string, filePath: string, bytes: Buffer): Promise<{
|
|
3361
3828
|
path: string;
|
|
3362
3829
|
size: number;
|
|
3363
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. */
|
|
3364
3833
|
exec(sandboxId: string, input: {
|
|
3365
3834
|
command: string;
|
|
3366
3835
|
cwd?: string;
|
|
3367
3836
|
timeoutMs?: number;
|
|
3368
3837
|
}): Promise<SandboxExecResult>;
|
|
3838
|
+
private startExec;
|
|
3839
|
+
private execStep;
|
|
3369
3840
|
check(sandboxId: string): Promise<SandboxCheckResult>;
|
|
3370
3841
|
/** With `rebase`, a moved base is replayed onto; a 409 then names the conflicting paths (`rebaseConflicts`). */
|
|
3371
|
-
commit(sandboxId: string, input: SandboxCommitInput): Promise<SandboxCommitResult>;
|
|
3842
|
+
commit(sandboxId: string, input: SandboxCommitInput): Promise<SandboxCommitResult | SandboxCommitPending>;
|
|
3372
3843
|
/**
|
|
3373
3844
|
* A rows file already in the sandbox tree into the PLATFORM world the
|
|
3374
3845
|
* sandbox was opened on (201 with the version, 202 with the batch to poll,
|
|
@@ -3382,156 +3853,6 @@ declare class WorldSandboxClient {
|
|
|
3382
3853
|
}): Promise<SandboxSummary>;
|
|
3383
3854
|
}
|
|
3384
3855
|
|
|
3385
|
-
/**
|
|
3386
|
-
* Edit sessions: the version control unit for a world. Every write this
|
|
3387
|
-
* credential makes to a world (push, sandbox commit, data import, MCP, the
|
|
3388
|
-
* console editor) joins ONE open session per world per credential and lands
|
|
3389
|
-
* on that session's private branch; `close` seals the session into a version
|
|
3390
|
-
* on `main`, and a session nobody touches for an hour seals itself. Sessions
|
|
3391
|
-
* replace product-level proposals/PRs: `rollback` undoes a sealed session
|
|
3392
|
-
* (source + data together) as a new, itself-reversible session.
|
|
3393
|
-
*
|
|
3394
|
-
* One client under both `gateway worlds edit …` and `gateway bench edit …`;
|
|
3395
|
-
* the Python twin is `gatewaysdk.benchmark_hub.edit_sessions.WorldEditClient`.
|
|
3396
|
-
*/
|
|
3397
|
-
/** Mirrors `WorldEditSessionSchema` (web/features/public-api/types/world-edits.ts). */
|
|
3398
|
-
type EditSessionSummary = {
|
|
3399
|
-
id: string;
|
|
3400
|
-
containerId: string;
|
|
3401
|
-
/** `apikey:<id>` for CLI/sandbox/MCP, `user:<id>` for the console, `agent:<id>` for the platform agent. */
|
|
3402
|
-
actor: string;
|
|
3403
|
-
door: string;
|
|
3404
|
-
status: "open" | "sealing" | "sealed" | "conflict" | "expired" | "discarded" | string;
|
|
3405
|
-
baseVersionId: string | null;
|
|
3406
|
-
tipVersionId: string | null;
|
|
3407
|
-
sealedVersionId: string | null;
|
|
3408
|
-
editCount: number;
|
|
3409
|
-
startedAt: string;
|
|
3410
|
-
lastEditAt: string;
|
|
3411
|
-
expiresAt: string;
|
|
3412
|
-
closedAt: string | null;
|
|
3413
|
-
closeReason: string | null;
|
|
3414
|
-
conflictPaths: string[] | null;
|
|
3415
|
-
rollbackOfId: string | null;
|
|
3416
|
-
message: string | null;
|
|
3417
|
-
/** Set when `task edit close` sealed this session together with a task's other worlds. */
|
|
3418
|
-
sealGroupId: string | null;
|
|
3419
|
-
};
|
|
3420
|
-
type EditSessionList = {
|
|
3421
|
-
slug: string;
|
|
3422
|
-
containerId: string;
|
|
3423
|
-
/** This credential's open session, or null. */
|
|
3424
|
-
current: EditSessionSummary | null;
|
|
3425
|
-
sessions: EditSessionSummary[];
|
|
3426
|
-
};
|
|
3427
|
-
/** What close/discard/rollback return. */
|
|
3428
|
-
type EditSessionResult = {
|
|
3429
|
-
slug: string;
|
|
3430
|
-
session: EditSessionSummary;
|
|
3431
|
-
};
|
|
3432
|
-
type EditSessionListQuery = {
|
|
3433
|
-
status?: string;
|
|
3434
|
-
limit?: number;
|
|
3435
|
-
};
|
|
3436
|
-
type EditSessionCloseInput = {
|
|
3437
|
-
sessionId?: string;
|
|
3438
|
-
force?: boolean;
|
|
3439
|
-
message?: string;
|
|
3440
|
-
};
|
|
3441
|
-
type EditSessionRollbackInput = {
|
|
3442
|
-
sessionId: string;
|
|
3443
|
-
force?: boolean;
|
|
3444
|
-
message?: string;
|
|
3445
|
-
};
|
|
3446
|
-
declare class WorldEditClient {
|
|
3447
|
-
private readonly options;
|
|
3448
|
-
constructor(options?: WorldsClientOptions);
|
|
3449
|
-
/** The credential's current session and the world's newest-first sessions. */
|
|
3450
|
-
list(slug: string, query?: EditSessionListQuery): Promise<EditSessionList>;
|
|
3451
|
-
/** Seal a session into a version on main (the credential's current one when `sessionId` is omitted). */
|
|
3452
|
-
close(slug: string, input?: EditSessionCloseInput): Promise<EditSessionResult>;
|
|
3453
|
-
/** Drop the session's private branch without making a version. */
|
|
3454
|
-
discard(slug: string, input?: {
|
|
3455
|
-
sessionId?: string;
|
|
3456
|
-
}): Promise<EditSessionResult>;
|
|
3457
|
-
/** Undo a sealed session (source and data) as a new sealed session. */
|
|
3458
|
-
rollback(slug: string, input: EditSessionRollbackInput): Promise<EditSessionResult>;
|
|
3459
|
-
}
|
|
3460
|
-
/** A stored task (`{id, version?}`) or a spec with `worlds`, as `task up` takes it. */
|
|
3461
|
-
type TaskEditTarget = WorldTaskIdRef | WorldTaskSpec;
|
|
3462
|
-
/** The task the platform resolved: stored id and version, or the spec's hash. */
|
|
3463
|
-
type TaskEditTaskRef = {
|
|
3464
|
-
taskId: string | null;
|
|
3465
|
-
taskVersion: number | null;
|
|
3466
|
-
name: string | null;
|
|
3467
|
-
hash: string;
|
|
3468
|
-
};
|
|
3469
|
-
/** Mirrors `TaskEditStatusResponseSchema` (web/features/public-api/types/world-task-edits.ts). */
|
|
3470
|
-
type TaskEditStatus = {
|
|
3471
|
-
task: TaskEditTaskRef;
|
|
3472
|
-
worlds: Record<string, {
|
|
3473
|
-
slug: string;
|
|
3474
|
-
ref: string;
|
|
3475
|
-
problem: string | null;
|
|
3476
|
-
session: EditSessionSummary | null;
|
|
3477
|
-
/** This credential's sessions parked in `conflict` on the world: unsealed too. */
|
|
3478
|
-
parked: EditSessionSummary[];
|
|
3479
|
-
mainVersionId: string | null;
|
|
3480
|
-
sealNow: "fast-forward" | "rebase" | "conflict" | null;
|
|
3481
|
-
conflictPaths: string[];
|
|
3482
|
-
}>;
|
|
3483
|
-
/** Aliases whose world holds edits only this credential sees. */
|
|
3484
|
-
unsealed: string[];
|
|
3485
|
-
hint: string | null;
|
|
3486
|
-
};
|
|
3487
|
-
type TaskEditSealed = {
|
|
3488
|
-
slug: string;
|
|
3489
|
-
session: EditSessionSummary;
|
|
3490
|
-
};
|
|
3491
|
-
type TaskEditCloseResult = {
|
|
3492
|
-
task: TaskEditTaskRef;
|
|
3493
|
-
groupId: string | null;
|
|
3494
|
-
worlds: Record<string, TaskEditSealed>;
|
|
3495
|
-
skipped: Record<string, {
|
|
3496
|
-
slug: string;
|
|
3497
|
-
reason: string;
|
|
3498
|
-
}>;
|
|
3499
|
-
};
|
|
3500
|
-
type TaskEditRollbackResult = {
|
|
3501
|
-
task: TaskEditTaskRef;
|
|
3502
|
-
groupId: string;
|
|
3503
|
-
rollbackOf: string;
|
|
3504
|
-
worlds: Record<string, TaskEditSealed>;
|
|
3505
|
-
/** Members whose seal left `main` where it was: nothing to undo there. */
|
|
3506
|
-
skipped: Record<string, {
|
|
3507
|
-
slug: string;
|
|
3508
|
-
reason: string;
|
|
3509
|
-
}>;
|
|
3510
|
-
};
|
|
3511
|
-
type TaskEditCloseInput = {
|
|
3512
|
-
requireAll?: boolean;
|
|
3513
|
-
force?: boolean;
|
|
3514
|
-
message?: string;
|
|
3515
|
-
};
|
|
3516
|
-
type TaskEditRollbackInput = {
|
|
3517
|
-
groupId: string;
|
|
3518
|
-
force?: boolean;
|
|
3519
|
-
message?: string;
|
|
3520
|
-
};
|
|
3521
|
-
/**
|
|
3522
|
-
* This credential's edit sessions on every world a task names, together:
|
|
3523
|
-
* `close` seals them onto their mains in ONE platform transaction (all or
|
|
3524
|
-
* none), `rollback` undoes the seal group as one. Python twin:
|
|
3525
|
-
* `gatewaysdk.benchmark_hub.edit_sessions.TaskEditClient`.
|
|
3526
|
-
*/
|
|
3527
|
-
declare class TaskEditClient {
|
|
3528
|
-
private readonly options;
|
|
3529
|
-
constructor(options?: WorldsClientOptions);
|
|
3530
|
-
status(task: TaskEditTarget): Promise<TaskEditStatus>;
|
|
3531
|
-
close(task: TaskEditTarget, input?: TaskEditCloseInput): Promise<TaskEditCloseResult>;
|
|
3532
|
-
rollback(task: TaskEditTarget, input: TaskEditRollbackInput): Promise<TaskEditRollbackResult>;
|
|
3533
|
-
}
|
|
3534
|
-
|
|
3535
3856
|
/**
|
|
3536
3857
|
* The hosted one-task dry run: `POST /api/public/environments/{id}/dry-run`
|
|
3537
3858
|
* and the run-status read that settles it. The runner runs ONE named task of a
|
|
@@ -3675,26 +3996,23 @@ type DispatchedRun = {
|
|
|
3675
3996
|
ok: boolean;
|
|
3676
3997
|
error?: string;
|
|
3677
3998
|
};
|
|
3678
|
-
/** A platform answer
|
|
3679
|
-
* code (a 409 on a name already taken) instead of parsing the message. A JSON
|
|
3680
|
-
* body renders as `<message> (<code>)` — the stable public `code`, never the
|
|
3681
|
-
* 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. */
|
|
3682
4000
|
declare class ApiError extends Error {
|
|
3683
4001
|
readonly status: number;
|
|
3684
4002
|
readonly text: string;
|
|
3685
4003
|
readonly code: string | null;
|
|
3686
4004
|
constructor(status: number, method: string, path: string, text: string);
|
|
3687
4005
|
}
|
|
3688
|
-
/**
|
|
3689
|
-
* Python twin: `gatewaysdk.api_errors.error_detail`. */
|
|
3690
|
-
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): {
|
|
3691
4009
|
detail: string;
|
|
3692
4010
|
code: string | null;
|
|
3693
4011
|
};
|
|
3694
|
-
/**
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
* for a request whose repeat is harmless. */
|
|
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. */
|
|
3698
4016
|
declare function apiRequest<T>(options: WorldsClientOptions, method: PlatformMethod, path: string, body?: unknown, init?: {
|
|
3699
4017
|
timeoutMs?: number;
|
|
3700
4018
|
retry?: RetryPolicy;
|
|
@@ -3720,13 +4038,10 @@ type RunConfigSummary = {
|
|
|
3720
4038
|
autoRunOnPush: boolean;
|
|
3721
4039
|
agent: string | null;
|
|
3722
4040
|
};
|
|
3723
|
-
/**
|
|
4041
|
+
/** The project's run configs; CI resolves one by name and dispatches it by id. */
|
|
3724
4042
|
declare function listRunConfigs(options?: WorldsClientOptions): Promise<RunConfigSummary[]>;
|
|
3725
|
-
/**
|
|
3726
|
-
*
|
|
3727
|
-
* project's stored tasks (`worldTasks`, api worlds only) — never both. A
|
|
3728
|
-
* stored task ref without `version` runs the task's current version at
|
|
3729
|
-
* 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. */
|
|
3730
4045
|
type RunConfigInput = {
|
|
3731
4046
|
id?: string;
|
|
3732
4047
|
name: string;
|
|
@@ -3743,8 +4058,7 @@ type RunConfigInput = {
|
|
|
3743
4058
|
};
|
|
3744
4059
|
/** Create a run config, or update the one named by `id`. */
|
|
3745
4060
|
declare function upsertRunConfig(input: RunConfigInput, options?: WorldsClientOptions): Promise<RunConfigSummary>;
|
|
3746
|
-
/** `id[@version]` items
|
|
3747
|
-
* 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. */
|
|
3748
4062
|
declare function parseWorldTaskRefs(spec: string | string[]): WorldTaskIdRef[];
|
|
3749
4063
|
type RunReport = {
|
|
3750
4064
|
id: string;
|
|
@@ -3771,11 +4085,9 @@ type RunReport = {
|
|
|
3771
4085
|
sessionId: string | null;
|
|
3772
4086
|
}[];
|
|
3773
4087
|
};
|
|
3774
|
-
/** The read half of dispatch: status, score, per-shard evaluations
|
|
3775
|
-
* per-task rewards — everything a CI gate needs. */
|
|
4088
|
+
/** The read half of dispatch: status, score, per-shard evaluations and per-task rewards. */
|
|
3776
4089
|
declare function getRun(runId: string, options?: WorldsClientOptions): Promise<RunReport>;
|
|
3777
|
-
/**
|
|
3778
|
-
* 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). */
|
|
3779
4091
|
type RunSummary = {
|
|
3780
4092
|
id: string;
|
|
3781
4093
|
status: string;
|
|
@@ -3801,7 +4113,7 @@ type ListRunsFilter = {
|
|
|
3801
4113
|
};
|
|
3802
4114
|
/** The project's runs, newest first. */
|
|
3803
4115
|
declare function listRuns(filter?: ListRunsFilter, options?: WorldsClientOptions): Promise<RunSummary[]>;
|
|
3804
|
-
/** Poll a run to terminal (default
|
|
4116
|
+
/** Poll a run to terminal every `intervalSeconds` (default 20) for up to `timeoutMinutes` (default 45). */
|
|
3805
4117
|
declare function waitForRun(runId: string, opts?: {
|
|
3806
4118
|
timeoutMinutes?: number;
|
|
3807
4119
|
intervalSeconds?: number;
|
|
@@ -3819,12 +4131,7 @@ type RunProvenance = {
|
|
|
3819
4131
|
kind?: string;
|
|
3820
4132
|
};
|
|
3821
4133
|
};
|
|
3822
|
-
/**
|
|
3823
|
-
* Where a dispatch comes from, DETECTED rather than configured: the CI
|
|
3824
|
-
* checkout's branch/commit/actor under GitHub Actions, else the developer's
|
|
3825
|
-
* own git checkout. A run nobody can trace to a branch is a score with no
|
|
3826
|
-
* code attached, so every dispatch carries this unless overridden.
|
|
3827
|
-
*/
|
|
4134
|
+
/** A dispatch's branch, commit and actor: from GitHub Actions under CI, else the local git checkout; every dispatch carries it unless overridden. */
|
|
3828
4135
|
declare function detectProvenance(): RunProvenance;
|
|
3829
4136
|
/** One scenario of a world, as data. */
|
|
3830
4137
|
declare class WorldTask {
|
|
@@ -3833,13 +4140,7 @@ declare class WorldTask {
|
|
|
3833
4140
|
readonly variant: string | null;
|
|
3834
4141
|
constructor(world: WorldSet, name: string, variant: string | null);
|
|
3835
4142
|
}
|
|
3836
|
-
/**
|
|
3837
|
-
* THE world, from a TS process: pinned identity + its tasks + hosted runs.
|
|
3838
|
-
*
|
|
3839
|
-
* const world = await openWorld("google-drive-sim@main");
|
|
3840
|
-
* console.log(world.version.semanticVersion, world.tasks.length);
|
|
3841
|
-
* const runs = await world.dispatch(runConfigId);
|
|
3842
|
-
*/
|
|
4143
|
+
/** A world pinned to one version, with its tasks and hosted runs, as `openWorld` and `openWorldVersion` return it. */
|
|
3843
4144
|
declare class WorldSet {
|
|
3844
4145
|
readonly slugRef: string;
|
|
3845
4146
|
readonly slug: string;
|
|
@@ -3849,44 +4150,25 @@ declare class WorldSet {
|
|
|
3849
4150
|
private readonly options;
|
|
3850
4151
|
constructor(slugRef: string, slug: string, ref: string | null, version: ResolvedWorldVersion, tasks: WorldTask[], options: WorldsClientOptions);
|
|
3851
4152
|
task(variant: string): WorldTask;
|
|
3852
|
-
/**
|
|
3853
|
-
* Open a LIVE session against one of this world's tasks — a bundled task's
|
|
3854
|
-
* name or an inline `WorldTaskSpec`: the platform boots (or reuses) a warm
|
|
3855
|
-
* container, and your agent calls its tools through the platform. See
|
|
3856
|
-
* worlds/session.ts.
|
|
3857
|
-
*/
|
|
4153
|
+
/** Open a live session on a bundled task's name or an inline `WorldTaskSpec`; the platform boots or reuses a warm container. */
|
|
3858
4154
|
open(task: WorldTaskRef, opts?: {
|
|
3859
4155
|
reuseWarm?: boolean;
|
|
3860
4156
|
surfaces?: WorldSurfaceKind[];
|
|
3861
4157
|
browserTier?: BrowserTier;
|
|
3862
4158
|
}): Promise<WorldSession>;
|
|
3863
|
-
/**
|
|
3864
|
-
* Start a HOSTED run of a run config against this world — the platform
|
|
3865
|
-
* executes the (Python) world in parallel containers per the config's
|
|
3866
|
-
* `parallelism` and files one graded run per model. Returns those runs.
|
|
3867
|
-
*/
|
|
4159
|
+
/** Start a hosted run of a run config on this version (or `opts.versionId`): one graded run per model, provenance detected unless given. */
|
|
3868
4160
|
dispatch(runConfigId: string, opts?: {
|
|
3869
4161
|
containerId?: string;
|
|
3870
4162
|
versionId?: string;
|
|
3871
|
-
/** Override the auto-detected branch/commit/actor. */
|
|
3872
4163
|
provenance?: RunProvenance;
|
|
3873
4164
|
}): Promise<{
|
|
3874
4165
|
versionLabel: string;
|
|
3875
4166
|
runs: DispatchedRun[];
|
|
3876
4167
|
}>;
|
|
3877
4168
|
}
|
|
3878
|
-
/**
|
|
3879
|
-
* Resolve `slug` / `slug@branch|tag|semver|hash` to its pinned version and
|
|
3880
|
-
* task list. The task list comes from the version's file manifest
|
|
3881
|
-
* (`tasks/<name>/task.toml`), so it needs no bundle download.
|
|
3882
|
-
*/
|
|
4169
|
+
/** Resolve `slug` or `slug@branch|tag|semver|hash` to its pinned version and task list, without downloading the bundle. */
|
|
3883
4170
|
declare function openWorld(slugRef: string, options?: WorldsClientOptions): Promise<WorldSet>;
|
|
3884
|
-
/**
|
|
3885
|
-
* Resolve `slug` at one pinned READY `versionId` — the task list is THAT
|
|
3886
|
-
* version's, never the branch tip's. `worlds run|ci --version-id` come
|
|
3887
|
-
* through here; a version of another container, a draft or an unknown id
|
|
3888
|
-
* is a 404 from the platform, not a silent fall-through to head.
|
|
3889
|
-
*/
|
|
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. */
|
|
3890
4172
|
declare function openWorldVersion(slug: string, versionId: string, options?: WorldsClientOptions): Promise<WorldSet>;
|
|
3891
4173
|
|
|
3892
|
-
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, GradePayload, GradeRefused, 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, RetryPolicy, 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, Score, Screen, type ScreenBrowser, SecretScrubber, type SeedResult, 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, 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, WorldNotice, 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, WorldSessionOpenFailed, 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, 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, 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, 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, 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 };
|