@withgateway/sdk 0.2.9 → 0.3.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/dist/cli.js +2355 -486
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +2335 -466
- package/dist/cli.mjs.map +1 -1
- package/dist/files/index.d.mts +1 -0
- package/dist/files/index.d.ts +1 -0
- package/dist/files/index.js +1324 -21
- package/dist/files/index.js.map +1 -1
- package/dist/files/index.mjs +1322 -13
- package/dist/files/index.mjs.map +1 -1
- package/dist/{index-Cz8Q6Keo.d.mts → index-D6oi1TWE.d.mts} +93 -34
- package/dist/{index-BO2SNSgy.d.ts → index-DAb-FCMg.d.ts} +93 -34
- package/dist/index.d.mts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +1758 -116
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1720 -97
- package/dist/index.mjs.map +1 -1
- package/dist/media-CbcAfQvd.d.mts +83 -0
- package/dist/media-CbcAfQvd.d.ts +83 -0
- package/dist/traces/index.d.mts +1 -0
- package/dist/traces/index.d.ts +1 -0
- package/dist/traces/index.js +1321 -18
- package/dist/traces/index.js.map +1 -1
- package/dist/traces/index.mjs +1319 -10
- package/dist/traces/index.mjs.map +1 -1
- package/dist/tracing/index.d.mts +2 -1
- package/dist/tracing/index.d.ts +2 -1
- package/dist/tracing/index.js +512 -11
- package/dist/tracing/index.js.map +1 -1
- package/dist/tracing/index.mjs +501 -10
- package/dist/tracing/index.mjs.map +1 -1
- package/dist/worlds/index.d.mts +583 -63
- package/dist/worlds/index.d.ts +583 -63
- package/dist/worlds/index.js +1703 -94
- package/dist/worlds/index.js.map +1 -1
- package/dist/worlds/index.mjs +1689 -80
- package/dist/worlds/index.mjs.map +1 -1
- package/package.json +1 -1
- package/runtime/gatewaysdk/environment/schema/api.py +38 -56
- package/runtime/gatewaysdk/environment/schema/grading.py +1 -5
- package/runtime/gatewaysdk/environment/schema/host.py +53 -90
- package/runtime/gatewaysdk/environment/schema/local.py +15 -7
- package/runtime/gatewaysdk/environment/schema/runtime.py +9 -9
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/SKILL.md +7 -7
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/cli-mcp-map.md +1 -0
- package/runtime/gatewaysdk/environment/schema/tasks.py +25 -1
- package/skills/worlds-getting-started/SKILL.md +7 -7
- package/skills/worlds-getting-started/references/cli-mcp-map.md +1 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
declare const PLATFORM_TIMEOUT_ENV = "GATEWAY_TIMEOUT_MS";
|
|
2
|
+
/** How long one platform request may go unanswered before it is abandoned; `GATEWAY_TIMEOUT_MS` overrides it. */
|
|
3
|
+
declare const PLATFORM_TIMEOUT_DEFAULT_MS = 120000;
|
|
4
|
+
type PlatformEndpoint = {
|
|
5
|
+
host: string;
|
|
6
|
+
publicKey: string;
|
|
7
|
+
secretKey: string;
|
|
8
|
+
};
|
|
9
|
+
type PlatformMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
10
|
+
type PlatformReply = {
|
|
11
|
+
status: number;
|
|
12
|
+
ok: boolean;
|
|
13
|
+
text: string;
|
|
14
|
+
};
|
|
15
|
+
/** The request budget in force: `GATEWAY_TIMEOUT_MS` when set, else the default. */
|
|
16
|
+
declare function platformTimeoutMs(env?: NodeJS.ProcessEnv): number;
|
|
17
|
+
/** Why a request got no answer, from the socket-level error undici hides under `fetch failed`. */
|
|
18
|
+
declare class TransportCause {
|
|
19
|
+
readonly reason: string;
|
|
20
|
+
readonly detail: string | null;
|
|
21
|
+
readonly next: string;
|
|
22
|
+
private constructor();
|
|
23
|
+
static timeout(timeoutMs: number): TransportCause;
|
|
24
|
+
static of(error: unknown): TransportCause;
|
|
25
|
+
describe(): string;
|
|
26
|
+
}
|
|
27
|
+
/** A platform request that never got an answer: one line naming the request, the host, the cause and the next step. */
|
|
28
|
+
declare class UnreachableError extends Error {
|
|
29
|
+
readonly host: string;
|
|
30
|
+
readonly method: string;
|
|
31
|
+
readonly route: string;
|
|
32
|
+
readonly failure: TransportCause;
|
|
33
|
+
constructor(host: string, method: string, route: string, failure: TransportCause);
|
|
34
|
+
}
|
|
35
|
+
/** The one door every CLI and SDK request to the platform goes through: Basic auth with the project key, a per-request timeout, and a transport failure turned into an `UnreachableError`. */
|
|
36
|
+
declare class PlatformTransport {
|
|
37
|
+
private readonly endpoint;
|
|
38
|
+
private readonly timeoutMs;
|
|
39
|
+
constructor(endpoint: PlatformEndpoint, timeoutMs?: number);
|
|
40
|
+
/** A request that legitimately takes longer (a sandbox exec, a world create) waits its own budget; every other one waits the default. */
|
|
41
|
+
budget(ownMs?: number): number;
|
|
42
|
+
send(method: PlatformMethod, route: string, body?: unknown, opts?: {
|
|
43
|
+
timeoutMs?: number;
|
|
44
|
+
}): Promise<PlatformReply>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
declare const MAX_MEDIA_BYTES: number;
|
|
48
|
+
type MediaField = "input" | "output" | "metadata";
|
|
49
|
+
declare class MediaUploadError extends Error {
|
|
50
|
+
readonly status?: number | undefined;
|
|
51
|
+
constructor(message: string, status?: number | undefined);
|
|
52
|
+
}
|
|
53
|
+
declare class MediaReference {
|
|
54
|
+
readonly mediaId: string;
|
|
55
|
+
readonly contentType: string;
|
|
56
|
+
constructor(mediaId: string, contentType: string);
|
|
57
|
+
toString(): string;
|
|
58
|
+
}
|
|
59
|
+
type PutBytes = (url: string, data: Buffer, headers: Record<string, string>) => Promise<{
|
|
60
|
+
status: number;
|
|
61
|
+
error: string | null;
|
|
62
|
+
}>;
|
|
63
|
+
/** Uploads media for one project (the key pair's). */
|
|
64
|
+
declare class MediaUploader {
|
|
65
|
+
private readonly transport;
|
|
66
|
+
private readonly put;
|
|
67
|
+
maxBytes: number;
|
|
68
|
+
constructor(transport: PlatformTransport, put?: PutBytes, maxBytes?: number);
|
|
69
|
+
/** The uploader for `GATEWAY_HOST` / `GATEWAY_PUBLIC_KEY` /
|
|
70
|
+
* `GATEWAY_SECRET_KEY` (the keys tracing exports with); null when any is unset. */
|
|
71
|
+
static fromEnv(env?: NodeJS.ProcessEnv): MediaUploader | null;
|
|
72
|
+
/** Store `data` linked to the trace (and observation) and return its reference. */
|
|
73
|
+
upload(data: Buffer, link: {
|
|
74
|
+
contentType: string;
|
|
75
|
+
traceId: string;
|
|
76
|
+
observationId: string | null;
|
|
77
|
+
field: MediaField;
|
|
78
|
+
}): Promise<MediaReference>;
|
|
79
|
+
private store;
|
|
80
|
+
private send;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { MAX_MEDIA_BYTES as M, PLATFORM_TIMEOUT_DEFAULT_MS as P, TransportCause as T, UnreachableError as U, PLATFORM_TIMEOUT_ENV as a, type PlatformEndpoint as b, type PlatformMethod as c, type PlatformReply as d, PlatformTransport as e, type MediaField as f, MediaReference as g, MediaUploadError as h, MediaUploader as i, platformTimeoutMs as p };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
declare const PLATFORM_TIMEOUT_ENV = "GATEWAY_TIMEOUT_MS";
|
|
2
|
+
/** How long one platform request may go unanswered before it is abandoned; `GATEWAY_TIMEOUT_MS` overrides it. */
|
|
3
|
+
declare const PLATFORM_TIMEOUT_DEFAULT_MS = 120000;
|
|
4
|
+
type PlatformEndpoint = {
|
|
5
|
+
host: string;
|
|
6
|
+
publicKey: string;
|
|
7
|
+
secretKey: string;
|
|
8
|
+
};
|
|
9
|
+
type PlatformMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
10
|
+
type PlatformReply = {
|
|
11
|
+
status: number;
|
|
12
|
+
ok: boolean;
|
|
13
|
+
text: string;
|
|
14
|
+
};
|
|
15
|
+
/** The request budget in force: `GATEWAY_TIMEOUT_MS` when set, else the default. */
|
|
16
|
+
declare function platformTimeoutMs(env?: NodeJS.ProcessEnv): number;
|
|
17
|
+
/** Why a request got no answer, from the socket-level error undici hides under `fetch failed`. */
|
|
18
|
+
declare class TransportCause {
|
|
19
|
+
readonly reason: string;
|
|
20
|
+
readonly detail: string | null;
|
|
21
|
+
readonly next: string;
|
|
22
|
+
private constructor();
|
|
23
|
+
static timeout(timeoutMs: number): TransportCause;
|
|
24
|
+
static of(error: unknown): TransportCause;
|
|
25
|
+
describe(): string;
|
|
26
|
+
}
|
|
27
|
+
/** A platform request that never got an answer: one line naming the request, the host, the cause and the next step. */
|
|
28
|
+
declare class UnreachableError extends Error {
|
|
29
|
+
readonly host: string;
|
|
30
|
+
readonly method: string;
|
|
31
|
+
readonly route: string;
|
|
32
|
+
readonly failure: TransportCause;
|
|
33
|
+
constructor(host: string, method: string, route: string, failure: TransportCause);
|
|
34
|
+
}
|
|
35
|
+
/** The one door every CLI and SDK request to the platform goes through: Basic auth with the project key, a per-request timeout, and a transport failure turned into an `UnreachableError`. */
|
|
36
|
+
declare class PlatformTransport {
|
|
37
|
+
private readonly endpoint;
|
|
38
|
+
private readonly timeoutMs;
|
|
39
|
+
constructor(endpoint: PlatformEndpoint, timeoutMs?: number);
|
|
40
|
+
/** A request that legitimately takes longer (a sandbox exec, a world create) waits its own budget; every other one waits the default. */
|
|
41
|
+
budget(ownMs?: number): number;
|
|
42
|
+
send(method: PlatformMethod, route: string, body?: unknown, opts?: {
|
|
43
|
+
timeoutMs?: number;
|
|
44
|
+
}): Promise<PlatformReply>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
declare const MAX_MEDIA_BYTES: number;
|
|
48
|
+
type MediaField = "input" | "output" | "metadata";
|
|
49
|
+
declare class MediaUploadError extends Error {
|
|
50
|
+
readonly status?: number | undefined;
|
|
51
|
+
constructor(message: string, status?: number | undefined);
|
|
52
|
+
}
|
|
53
|
+
declare class MediaReference {
|
|
54
|
+
readonly mediaId: string;
|
|
55
|
+
readonly contentType: string;
|
|
56
|
+
constructor(mediaId: string, contentType: string);
|
|
57
|
+
toString(): string;
|
|
58
|
+
}
|
|
59
|
+
type PutBytes = (url: string, data: Buffer, headers: Record<string, string>) => Promise<{
|
|
60
|
+
status: number;
|
|
61
|
+
error: string | null;
|
|
62
|
+
}>;
|
|
63
|
+
/** Uploads media for one project (the key pair's). */
|
|
64
|
+
declare class MediaUploader {
|
|
65
|
+
private readonly transport;
|
|
66
|
+
private readonly put;
|
|
67
|
+
maxBytes: number;
|
|
68
|
+
constructor(transport: PlatformTransport, put?: PutBytes, maxBytes?: number);
|
|
69
|
+
/** The uploader for `GATEWAY_HOST` / `GATEWAY_PUBLIC_KEY` /
|
|
70
|
+
* `GATEWAY_SECRET_KEY` (the keys tracing exports with); null when any is unset. */
|
|
71
|
+
static fromEnv(env?: NodeJS.ProcessEnv): MediaUploader | null;
|
|
72
|
+
/** Store `data` linked to the trace (and observation) and return its reference. */
|
|
73
|
+
upload(data: Buffer, link: {
|
|
74
|
+
contentType: string;
|
|
75
|
+
traceId: string;
|
|
76
|
+
observationId: string | null;
|
|
77
|
+
field: MediaField;
|
|
78
|
+
}): Promise<MediaReference>;
|
|
79
|
+
private store;
|
|
80
|
+
private send;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { MAX_MEDIA_BYTES as M, PLATFORM_TIMEOUT_DEFAULT_MS as P, TransportCause as T, UnreachableError as U, PLATFORM_TIMEOUT_ENV as a, type PlatformEndpoint as b, type PlatformMethod as c, type PlatformReply as d, PlatformTransport as e, type MediaField as f, MediaReference as g, MediaUploadError as h, MediaUploader as i, platformTimeoutMs as p };
|
package/dist/traces/index.d.mts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import '../worlds/index.mjs';
|
|
2
2
|
export { E as ExportOptions, a as ExportSummary, O as Observation, b as ObservationFilters, P as PAGE_LIMIT, c as Page, d as PageMeta, S as SessionFilters, T as Trace, e as TraceDetail, f as TraceFilters, g as TraceSession, h as TraceSessionDetail, j as exportTraces, k as getSession, l as getTrace, m as iterateObservations, n as iterateSessions, o as iterateTraces, p as listObservations, q as listSessions, r as listTraces } from '../index-CiKWoroJ.mjs';
|
|
3
|
+
import '../media-CbcAfQvd.mjs';
|
package/dist/traces/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import '../worlds/index.js';
|
|
2
2
|
export { E as ExportOptions, a as ExportSummary, O as Observation, b as ObservationFilters, P as PAGE_LIMIT, c as Page, d as PageMeta, S as SessionFilters, T as Trace, e as TraceDetail, f as TraceFilters, g as TraceSession, h as TraceSessionDetail, j as exportTraces, k as getSession, l as getTrace, m as iterateObservations, n as iterateSessions, o as iterateTraces, p as listObservations, q as listSessions, r as listTraces } from '../index-BgvvQ3BC.js';
|
|
3
|
+
import '../media-CbcAfQvd.js';
|