withruntime 0.11.1 → 0.12.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/BLAXEL.md +3 -3
- package/COMPATIBILITY.md +74 -9
- package/DAYTONA.md +33 -5
- package/E2B.md +137 -48
- package/README.md +11 -9
- package/README.src.md +11 -9
- package/VERCEL.md +43 -5
- package/compatibility-lock.json +58 -49
- package/dist/billing-cli.d.ts +1 -1
- package/dist/billing-cli.js +77 -1
- package/dist/blaxel/errors.d.ts +14 -0
- package/dist/blaxel/errors.js +33 -4
- package/dist/blaxel/index.d.ts +2 -2
- package/dist/blaxel/index.js +4 -4
- package/dist/blaxel/interpreter.d.ts +2 -5
- package/dist/blaxel/sandbox.d.ts +15 -7
- package/dist/blaxel/sandbox.js +64 -9
- package/dist/blaxel/snapshot.d.ts +4 -0
- package/dist/blaxel/snapshot.js +4 -0
- package/dist/cli/logs.d.ts +21 -0
- package/dist/cli/logs.js +188 -0
- package/dist/cli/logs.test.d.ts +1 -0
- package/dist/cli/logs.test.js +272 -0
- package/dist/cli-extras.d.ts +3 -3
- package/dist/cli-extras.js +17 -12
- package/dist/cli-words.d.ts +10 -1
- package/dist/cli-words.js +18 -0
- package/dist/cli.d.ts +6 -2
- package/dist/cli.js +468 -219
- package/dist/client.d.ts +13 -63
- package/dist/client.js +35 -124
- package/dist/cloudflare/errors.d.ts +143 -0
- package/dist/cloudflare/errors.js +167 -0
- package/dist/cloudflare/index.d.ts +175 -6
- package/dist/cloudflare/index.js +416 -26
- package/dist/cloudflare/interpreter.d.ts +119 -0
- package/dist/cloudflare/interpreter.js +223 -0
- package/dist/cloudflare/streams.d.ts +38 -0
- package/dist/cloudflare/streams.js +145 -0
- package/dist/cloudflare/watch.d.ts +9 -0
- package/dist/cloudflare/watch.js +24 -0
- package/dist/codesandbox/index.d.ts +216 -28
- package/dist/codesandbox/index.js +478 -78
- package/dist/compat/core.d.ts +18 -0
- package/dist/compat/core.js +29 -0
- package/dist/compat/files.d.ts +1 -0
- package/dist/compat/files.js +25 -5
- package/dist/daytona/computer-use.d.ts +13 -4
- package/dist/daytona/computer-use.js +66 -8
- package/dist/daytona/daytona.d.ts +7 -2
- package/dist/daytona/daytona.js +31 -5
- package/dist/daytona/errors.d.ts +11 -0
- package/dist/daytona/errors.js +18 -0
- package/dist/daytona/filesystem.js +2 -1
- package/dist/daytona/image.d.ts +13 -9
- package/dist/daytona/image.js +18 -12
- package/dist/daytona/index.d.ts +1 -1
- package/dist/daytona/sandbox.d.ts +9 -3
- package/dist/daytona/sandbox.js +17 -3
- package/dist/domains/index.d.ts +9 -0
- package/dist/domains/index.js +10 -0
- package/dist/e2b/client.d.ts +15 -2
- package/dist/e2b/client.js +61 -7
- package/dist/e2b/commands.d.ts +4 -1
- package/dist/e2b/commands.js +17 -7
- package/dist/e2b/errors.d.ts +43 -2
- package/dist/e2b/errors.js +78 -6
- package/dist/e2b/filesystem.d.ts +1 -1
- package/dist/e2b/filesystem.js +82 -16
- package/dist/e2b/index.d.ts +3 -3
- package/dist/e2b/index.js +2 -2
- package/dist/e2b/sandbox.d.ts +50 -35
- package/dist/e2b/sandbox.js +228 -185
- package/dist/e2b/unsupported.d.ts +19 -0
- package/dist/e2b/unsupported.js +22 -1
- package/dist/e2b/users.d.ts +9 -0
- package/dist/e2b/users.js +22 -0
- package/dist/errors.d.ts +14 -5
- package/dist/errors.js +28 -14
- package/dist/freestyle/index.d.ts +285 -37
- package/dist/freestyle/index.js +656 -144
- package/dist/identity.d.ts +3 -0
- package/dist/identity.js +27 -0
- package/dist/images/index.d.ts +9 -0
- package/dist/images/index.js +10 -0
- package/dist/index.d.ts +1 -0
- package/dist/ips/index.d.ts +9 -0
- package/dist/ips/index.js +10 -0
- package/dist/jobs/index.d.ts +9 -0
- package/dist/jobs/index.js +10 -0
- package/dist/keys.js +2 -0
- package/dist/login.js +2 -0
- package/dist/machine.d.ts +189 -0
- package/dist/machine.js +521 -0
- package/dist/mcp.js +1 -1
- package/dist/modal/index.d.ts +339 -61
- package/dist/modal/index.js +781 -121
- package/dist/network-cli.d.ts +3 -1
- package/dist/network-cli.js +78 -36
- package/dist/networks/index.d.ts +11 -0
- package/dist/networks/index.js +10 -0
- package/dist/openai-agents/index.d.ts +1 -1
- package/dist/openai-agents/index.js +1 -1
- package/dist/ports/index.d.ts +9 -0
- package/dist/ports/index.js +10 -0
- package/dist/product-names.d.ts +52 -0
- package/dist/product-names.js +164 -0
- package/dist/product-renames.d.ts +103 -0
- package/dist/product-renames.js +189 -0
- package/dist/products/apps.d.ts +176 -0
- package/dist/products/apps.js +165 -0
- package/dist/products/billing.d.ts +41 -0
- package/dist/products/billing.js +13 -0
- package/dist/products/browser.d.ts +10 -0
- package/dist/products/browsers.d.ts +71 -0
- package/dist/products/browsers.js +102 -0
- package/dist/products/builds.d.ts +126 -0
- package/dist/products/builds.js +221 -0
- package/dist/products/index.d.ts +3 -16
- package/dist/products/index.js +3 -14
- package/dist/products/jobs.d.ts +19 -3
- package/dist/products/jobs.js +28 -12
- package/dist/products/limits.d.ts +4 -10
- package/dist/products/logs.d.ts +245 -0
- package/dist/products/logs.js +274 -0
- package/dist/products/logs.test.d.ts +1 -0
- package/dist/products/logs.test.js +343 -0
- package/dist/products/network-products.d.ts +38 -7
- package/dist/products/network-products.js +31 -18
- package/dist/products/network.d.ts +1 -1
- package/dist/products/observability.d.ts +3 -2
- package/dist/products/private-network.js +1 -1
- package/dist/products/queues.d.ts +149 -0
- package/dist/products/queues.js +213 -0
- package/dist/products/referrals.d.ts +21 -7
- package/dist/products/referrals.js +3 -3
- package/dist/products/secrets.d.ts +8 -4
- package/dist/products/secrets.js +39 -18
- package/dist/products/signed-requests.d.ts +21 -0
- package/dist/products/signed-requests.js +11 -0
- package/dist/products/streams.d.ts +73 -0
- package/dist/products/streams.js +17 -0
- package/dist/products/switching.d.ts +37 -10
- package/dist/products/switching.js +4 -3
- package/dist/products/volumes.d.ts +3 -0
- package/dist/record-cli.d.ts +23 -0
- package/dist/record-cli.js +308 -0
- package/dist/renamed-products.d.ts +38 -0
- package/dist/renamed-products.js +34 -0
- package/dist/runloop/index.d.ts +9 -2
- package/dist/runloop/index.js +29 -8
- package/dist/runloop/sdk.d.ts +131 -0
- package/dist/runloop/sdk.js +167 -0
- package/dist/sandbox.d.ts +10 -94
- package/dist/sandbox.js +22 -371
- package/dist/sandboxes/index.d.ts +11 -0
- package/dist/sandboxes/index.js +12 -0
- package/dist/snapshots/index.d.ts +9 -0
- package/dist/snapshots/index.js +11 -0
- package/dist/snapshots.d.ts +7 -4
- package/dist/sprites/index.d.ts +343 -31
- package/dist/sprites/index.js +866 -84
- package/dist/ssh.d.ts +1 -1
- package/dist/ssh.js +11 -11
- package/dist/terminal.d.ts +24 -0
- package/dist/terminal.js +32 -0
- package/dist/transport.d.ts +18 -2
- package/dist/transport.js +61 -6
- package/dist/tunnel.js +1 -1
- package/dist/types.d.ts +116 -8
- package/dist/vercel/sandbox.d.ts +1 -2
- package/dist/vercel/sandbox.js +6 -5
- package/dist/vercel/snapshot.js +10 -2
- package/dist/volumes/index.d.ts +9 -0
- package/dist/volumes/index.js +10 -0
- package/package.json +48 -2
package/dist/products/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { sandboxDesktop } from "./desktop.js";
|
|
|
3
3
|
import { sandboxBrowser } from "./browser.js";
|
|
4
4
|
import { sandboxInterpreter } from "./interpreter.js";
|
|
5
5
|
import { sandboxNetwork } from "./network.js";
|
|
6
|
-
import {
|
|
6
|
+
import { domains, ips, networks, ports } from "./network-products.js";
|
|
7
7
|
import { sandboxPreviews } from "./previews.js";
|
|
8
8
|
import { referrals } from "./referrals.js";
|
|
9
9
|
import { billing } from "./billing.js";
|
|
@@ -50,19 +50,8 @@ export const clientExtensions = {
|
|
|
50
50
|
sso,
|
|
51
51
|
domains,
|
|
52
52
|
ports,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
network,
|
|
56
|
-
};
|
|
57
|
-
/** Canonical CLI product names share the existing factory instance. Account
|
|
58
|
-
* commands such as secrets, events and billing retain their current names. */
|
|
59
|
-
export const clientProductAliases = {
|
|
60
|
-
image: "images",
|
|
61
|
-
volume: "volumes",
|
|
62
|
-
job: "jobs",
|
|
63
|
-
domain: "domains",
|
|
64
|
-
port: "ports",
|
|
65
|
-
address: "addresses",
|
|
53
|
+
ips,
|
|
54
|
+
networks,
|
|
66
55
|
};
|
|
67
56
|
export const sandboxExtensions = {
|
|
68
57
|
interpreter: sandboxInterpreter,
|
package/dist/products/jobs.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Page } from "../page.js";
|
|
2
2
|
import type { RequestOptions, Transport } from "../transport.js";
|
|
3
3
|
/** A run's sandbox. Every field has a default; a run is a sandbox of this
|
|
4
|
-
* size, on the
|
|
4
|
+
* size, on the included usage first and then on credit at the sandbox rates. */
|
|
5
5
|
export type JobCompute = {
|
|
6
6
|
region: string;
|
|
7
7
|
vcpu: number;
|
|
@@ -53,6 +53,9 @@ export type Job = {
|
|
|
53
53
|
version: number;
|
|
54
54
|
/** Unix milliseconds, or null when nothing more is scheduled. */
|
|
55
55
|
nextRunAt: number | null;
|
|
56
|
+
/** When `trigger` asked for a run that has not started yet, in Unix
|
|
57
|
+
* milliseconds; null otherwise. */
|
|
58
|
+
runRequestedAt: number | null;
|
|
56
59
|
/** Why the last due run could not start, retried every 30 seconds:
|
|
57
60
|
* `credits` (add credit), `capacity`, `cost_cap` (maxTotalCostMicros or a
|
|
58
61
|
* key's daily limit) or `permission` (the key that made the job lost it). */
|
|
@@ -68,6 +71,8 @@ export type JobRun = {
|
|
|
68
71
|
occurrenceId: string;
|
|
69
72
|
attempt: number;
|
|
70
73
|
scheduledFor: number;
|
|
74
|
+
/** `manual`: a run `trigger` asked for, and its retries. */
|
|
75
|
+
trigger: "schedule" | "manual";
|
|
71
76
|
resourceId: string;
|
|
72
77
|
/** `unknown`: the outcome could not be observed (the sandbox stopped under
|
|
73
78
|
* it). It is never retried by itself. */
|
|
@@ -159,6 +164,9 @@ export declare const JOB_LIMITS: {
|
|
|
159
164
|
};
|
|
160
165
|
/** Unix milliseconds from a Date, an ISO time or a number. */
|
|
161
166
|
export declare function jobTime(at: Date | string | number): number;
|
|
167
|
+
/** The API's schedule from what `create` and `reschedule` take: `{ at }`,
|
|
168
|
+
* `{ cron, timezone? }` or the raw `{ kind: ... }`. */
|
|
169
|
+
export declare function jobSchedule(input: CreateJob["schedule"]): JobSchedule;
|
|
162
170
|
/** The API's job body from `CreateJob`, with every default filled in and the
|
|
163
171
|
* sandbox's size checked before anything is sent. */
|
|
164
172
|
export declare function jobBody(input: CreateJob): Record<string, unknown>;
|
|
@@ -168,8 +176,7 @@ export declare function jobBody(input: CreateJob): Record<string, unknown>;
|
|
|
168
176
|
* request id, and says no retry will change it. */
|
|
169
177
|
export declare function switchedOff(product: string): (error: unknown) => never;
|
|
170
178
|
/** Scheduled jobs: a command run in a fresh sandbox, once or on a cron
|
|
171
|
-
* schedule. Each run is a sandbox, paid for as one: from the
|
|
172
|
-
* hours first while the run fits the trial's size and count, then from credit
|
|
179
|
+
* schedule. Each run is a sandbox, paid for as one: from the included usage first while the run fits the limits without credit, then from credit
|
|
173
180
|
* at the sandbox rates, through the same holds and spending limits.
|
|
174
181
|
*
|
|
175
182
|
* const job = await runtime.jobs.create({
|
|
@@ -212,4 +219,13 @@ export declare function jobs(transport: Transport): {
|
|
|
212
219
|
/** End the job for good and stop any run in progress. A run that already
|
|
213
220
|
* finished keeps its result. Cancelling again answers the same job. */
|
|
214
221
|
cancel: (id: string, options?: RequestOptions) => Promise<Job>;
|
|
222
|
+
/** Run it now, once, beside its schedule, which does not move. A paused
|
|
223
|
+
* job runs once and stays paused. While a run is starting or going it is
|
|
224
|
+
* refused with `run_in_progress`; a cancelled or finished job with
|
|
225
|
+
* `invalid_state`. The run is in `runs` with `trigger: "manual"`. */
|
|
226
|
+
trigger: (id: string, options?: RequestOptions) => Promise<Job>;
|
|
227
|
+
/** A new schedule, in any form `create` takes: `{ cron, timezone? }` or
|
|
228
|
+
* `{ at }`. The next run is the new schedule's next time; a run going
|
|
229
|
+
* finishes as it began, and a paused job stays paused. */
|
|
230
|
+
reschedule: (id: string, schedule: CreateJob["schedule"], options?: RequestOptions) => Promise<Job>;
|
|
215
231
|
};
|
package/dist/products/jobs.js
CHANGED
|
@@ -47,25 +47,28 @@ export function jobTime(at) {
|
|
|
47
47
|
throw invalid(`schedule.at must be a time: a Date, an ISO time such as 2026-10-01T03:00:00Z, or Unix milliseconds; got ${String(at)}.`, "schedule.at");
|
|
48
48
|
return ms;
|
|
49
49
|
}
|
|
50
|
-
/** The API's
|
|
51
|
-
*
|
|
52
|
-
export function
|
|
53
|
-
const s = input
|
|
54
|
-
let schedule;
|
|
50
|
+
/** The API's schedule from what `create` and `reschedule` take: `{ at }`,
|
|
51
|
+
* `{ cron, timezone? }` or the raw `{ kind: ... }`. */
|
|
52
|
+
export function jobSchedule(input) {
|
|
53
|
+
const s = (input ?? {});
|
|
55
54
|
if (s.kind === "once" || (s.kind === undefined && s.at !== undefined))
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
return { kind: "once", at: jobTime(s.at) };
|
|
56
|
+
if (s.kind === "cron" || (s.kind === undefined && s.cron !== undefined)) {
|
|
58
57
|
const expression = String(s.expression ?? s.cron).trim();
|
|
59
58
|
if (expression.split(/\s+/).length !== 5)
|
|
60
59
|
throw invalid(`A cron schedule has five fields, minute hour day-of-month month day-of-week, such as "0 3 * * *"; got "${expression}".`, "schedule.cron");
|
|
61
|
-
|
|
60
|
+
return {
|
|
62
61
|
kind: "cron",
|
|
63
62
|
expression,
|
|
64
63
|
...(s.timezone === undefined ? {} : { timezone: s.timezone }),
|
|
65
64
|
};
|
|
66
65
|
}
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
throw invalid("schedule takes { at } or { cron }.", "schedule");
|
|
67
|
+
}
|
|
68
|
+
/** The API's job body from `CreateJob`, with every default filled in and the
|
|
69
|
+
* sandbox's size checked before anything is sent. */
|
|
70
|
+
export function jobBody(input) {
|
|
71
|
+
const schedule = jobSchedule(input.schedule);
|
|
69
72
|
const command = Array.isArray(input.command) ? { argv: input.command } : input.command;
|
|
70
73
|
if (!command?.argv?.length)
|
|
71
74
|
throw invalid('command is an argv array such as ["python3", "job.py"].', "command");
|
|
@@ -128,8 +131,7 @@ export function switchedOff(product) {
|
|
|
128
131
|
};
|
|
129
132
|
}
|
|
130
133
|
/** Scheduled jobs: a command run in a fresh sandbox, once or on a cron
|
|
131
|
-
* schedule. Each run is a sandbox, paid for as one: from the
|
|
132
|
-
* hours first while the run fits the trial's size and count, then from credit
|
|
134
|
+
* schedule. Each run is a sandbox, paid for as one: from the included usage first while the run fits the limits without credit, then from credit
|
|
133
135
|
* at the sandbox rates, through the same holds and spending limits.
|
|
134
136
|
*
|
|
135
137
|
* const job = await runtime.jobs.create({
|
|
@@ -187,5 +189,19 @@ export function jobs(transport) {
|
|
|
187
189
|
/** End the job for good and stop any run in progress. A run that already
|
|
188
190
|
* finished keeps its result. Cancelling again answers the same job. */
|
|
189
191
|
cancel: (id, options) => verb(id, "cancel", options),
|
|
192
|
+
/** Run it now, once, beside its schedule, which does not move. A paused
|
|
193
|
+
* job runs once and stays paused. While a run is starting or going it is
|
|
194
|
+
* refused with `run_in_progress`; a cancelled or finished job with
|
|
195
|
+
* `invalid_state`. The run is in `runs` with `trigger: "manual"`. */
|
|
196
|
+
trigger: (id, options) => verb(id, "trigger", options),
|
|
197
|
+
/** A new schedule, in any form `create` takes: `{ cron, timezone? }` or
|
|
198
|
+
* `{ at }`. The next run is the new schedule's next time; a run going
|
|
199
|
+
* finishes as it began, and a paused job stays paused. */
|
|
200
|
+
reschedule: (id, schedule, options) => t.json({
|
|
201
|
+
method: "POST",
|
|
202
|
+
path: `/v1/jobs/${enc(id)}:reschedule`,
|
|
203
|
+
body: { schedule: jobSchedule(schedule) },
|
|
204
|
+
...options,
|
|
205
|
+
}),
|
|
190
206
|
};
|
|
191
207
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Usage } from "../types.js";
|
|
1
2
|
import type { RequestOptions, Transport } from "../transport.js";
|
|
2
3
|
/** What this key may do, and the daily spending limit on its agent. Money is
|
|
3
4
|
* integer microdollars in strings (1,000,000 = $1). */
|
|
@@ -14,16 +15,9 @@ export type KeyLimits = {
|
|
|
14
15
|
remainingMicros: string | null;
|
|
15
16
|
window: "24h";
|
|
16
17
|
};
|
|
17
|
-
/**
|
|
18
|
-
* `usage.get()`, or null when
|
|
19
|
-
|
|
20
|
-
* `availableMs = totalMs - usedMs - reservedMs`. */
|
|
21
|
-
trial: {
|
|
22
|
-
totalMs: number;
|
|
23
|
-
usedMs: number;
|
|
24
|
-
reservedMs: number;
|
|
25
|
-
availableMs: number;
|
|
26
|
-
} | null;
|
|
18
|
+
/** Machine time the account can still run without credit, the same
|
|
19
|
+
* figures as `usage.get()`'s `trial`, or null when it has none. */
|
|
20
|
+
trial: Usage["trial"];
|
|
27
21
|
};
|
|
28
22
|
/** `runtime.limits.get()`: whether this key is read-only, and what its agent
|
|
29
23
|
* may still spend today. An owner sets the limit at
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { Page } from "../page.js";
|
|
2
|
+
import type { RequestOptions, Transport } from "../transport.js";
|
|
3
|
+
/** Native logsd hit_json. Nanoseconds stay strings so no precision is lost. */
|
|
4
|
+
export type LogLine = {
|
|
5
|
+
time: string;
|
|
6
|
+
timeUnixNano: string;
|
|
7
|
+
severity: number;
|
|
8
|
+
severityText: string;
|
|
9
|
+
body: unknown;
|
|
10
|
+
labels: Record<string, string>;
|
|
11
|
+
attributes: Record<string, unknown>;
|
|
12
|
+
traceId: string | null;
|
|
13
|
+
spanId: string | null;
|
|
14
|
+
};
|
|
15
|
+
export type LogSearch = {
|
|
16
|
+
query: string;
|
|
17
|
+
start?: string;
|
|
18
|
+
end?: string;
|
|
19
|
+
limit?: number;
|
|
20
|
+
direction?: "forward" | "backward";
|
|
21
|
+
cursor?: string;
|
|
22
|
+
};
|
|
23
|
+
export type LogSearchResult = {
|
|
24
|
+
lines: LogLine[];
|
|
25
|
+
next?: string | null;
|
|
26
|
+
stats: {
|
|
27
|
+
ms: number;
|
|
28
|
+
blocks: number;
|
|
29
|
+
skippedByTime: number;
|
|
30
|
+
skippedByLabels: number;
|
|
31
|
+
skippedByWords: number;
|
|
32
|
+
scanned: number;
|
|
33
|
+
bytesRead: number;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export type TailGap = {
|
|
37
|
+
gap: true;
|
|
38
|
+
from: string;
|
|
39
|
+
to: string;
|
|
40
|
+
};
|
|
41
|
+
export type TailLine = LogLine & {
|
|
42
|
+
cursor: string;
|
|
43
|
+
gap?: false;
|
|
44
|
+
};
|
|
45
|
+
export type TailEvent = TailLine | TailGap;
|
|
46
|
+
export type LogQuery = {
|
|
47
|
+
query: string;
|
|
48
|
+
time?: string;
|
|
49
|
+
limit?: number;
|
|
50
|
+
direction?: "forward" | "backward";
|
|
51
|
+
};
|
|
52
|
+
export type LogRange = Omit<LogQuery, "time"> & {
|
|
53
|
+
start?: string;
|
|
54
|
+
end?: string;
|
|
55
|
+
step?: string;
|
|
56
|
+
interval?: string;
|
|
57
|
+
};
|
|
58
|
+
export type LokiResult = {
|
|
59
|
+
status: "success";
|
|
60
|
+
data: ({
|
|
61
|
+
resultType: "streams";
|
|
62
|
+
result: {
|
|
63
|
+
stream: Record<string, string>;
|
|
64
|
+
values: [string, string, Record<string, string>?][];
|
|
65
|
+
}[];
|
|
66
|
+
} | {
|
|
67
|
+
resultType: "matrix";
|
|
68
|
+
result: {
|
|
69
|
+
metric: Record<string, string>;
|
|
70
|
+
values: [number, string][];
|
|
71
|
+
}[];
|
|
72
|
+
} | {
|
|
73
|
+
resultType: "vector";
|
|
74
|
+
result: {
|
|
75
|
+
metric: Record<string, string>;
|
|
76
|
+
value: [number, string];
|
|
77
|
+
}[];
|
|
78
|
+
} | {
|
|
79
|
+
resultType: "scalar";
|
|
80
|
+
result: [number, string];
|
|
81
|
+
}) & {
|
|
82
|
+
stats?: Record<string, unknown>;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
export type LabelResult = {
|
|
86
|
+
status: "success";
|
|
87
|
+
data: string[];
|
|
88
|
+
};
|
|
89
|
+
export type ViewInput = {
|
|
90
|
+
name: string;
|
|
91
|
+
labels: Record<string, string>;
|
|
92
|
+
query: string;
|
|
93
|
+
defaultRange?: string;
|
|
94
|
+
};
|
|
95
|
+
export type SavedView = ViewInput & {
|
|
96
|
+
id: string;
|
|
97
|
+
state: string;
|
|
98
|
+
createdAt: string;
|
|
99
|
+
};
|
|
100
|
+
export type AlertInput = {
|
|
101
|
+
name: string;
|
|
102
|
+
labels: Record<string, string>;
|
|
103
|
+
query: string;
|
|
104
|
+
condition: string;
|
|
105
|
+
for: string;
|
|
106
|
+
actions: Record<string, unknown>[];
|
|
107
|
+
};
|
|
108
|
+
export type Alert = AlertInput & {
|
|
109
|
+
id: string;
|
|
110
|
+
state: string;
|
|
111
|
+
createdAt: string;
|
|
112
|
+
};
|
|
113
|
+
/** OTLP/HTTP JSON; the server validates the signal's complete OTLP schema. */
|
|
114
|
+
export type OtlpLogs = {
|
|
115
|
+
resourceLogs: Record<string, unknown>[];
|
|
116
|
+
};
|
|
117
|
+
export type OtlpTraces = {
|
|
118
|
+
resourceSpans: Record<string, unknown>[];
|
|
119
|
+
};
|
|
120
|
+
export type TraceSpan = {
|
|
121
|
+
traceId: string;
|
|
122
|
+
spanId: string;
|
|
123
|
+
parentSpanId?: string;
|
|
124
|
+
name: string;
|
|
125
|
+
startTimeUnixNano: string;
|
|
126
|
+
endTimeUnixNano: string;
|
|
127
|
+
attributes?: {
|
|
128
|
+
key: string;
|
|
129
|
+
value: Record<string, unknown>;
|
|
130
|
+
}[];
|
|
131
|
+
status?: {
|
|
132
|
+
code?: number;
|
|
133
|
+
message?: string;
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
export type Trace = {
|
|
137
|
+
resourceSpans: {
|
|
138
|
+
resource?: {
|
|
139
|
+
attributes?: {
|
|
140
|
+
key: string;
|
|
141
|
+
value: Record<string, unknown>;
|
|
142
|
+
}[];
|
|
143
|
+
};
|
|
144
|
+
scopeSpans: {
|
|
145
|
+
spans: TraceSpan[];
|
|
146
|
+
}[];
|
|
147
|
+
}[];
|
|
148
|
+
};
|
|
149
|
+
export type TraceSearchResult = {
|
|
150
|
+
traces: {
|
|
151
|
+
traceID: string;
|
|
152
|
+
rootServiceName: string;
|
|
153
|
+
rootTraceName: string;
|
|
154
|
+
startTimeUnixNano: string;
|
|
155
|
+
durationMs: number;
|
|
156
|
+
}[];
|
|
157
|
+
metrics?: Record<string, unknown>;
|
|
158
|
+
};
|
|
159
|
+
/** Hidden until Logs launches. */
|
|
160
|
+
export declare function logs(t: Transport): {
|
|
161
|
+
search: (body: LogSearch, options?: RequestOptions) => Promise<LogSearchResult>;
|
|
162
|
+
pages(input: LogSearch, options?: RequestOptions): AsyncGenerator<LogSearchResult>;
|
|
163
|
+
/** The record's cursor, not timestamp or text, identifies a line. The
|
|
164
|
+
* server replays strictly after it. An echoed boundary is ignored; two
|
|
165
|
+
* identical lines at different record positions are both delivered. */
|
|
166
|
+
tail(query: string, options?: RequestOptions & {
|
|
167
|
+
cursor?: string;
|
|
168
|
+
start?: string;
|
|
169
|
+
reconnectMs?: number;
|
|
170
|
+
}): AsyncGenerator<TailEvent>;
|
|
171
|
+
query: (query: LogQuery, options?: RequestOptions) => Promise<LokiResult>;
|
|
172
|
+
queryRange: (query: LogRange, options?: RequestOptions) => Promise<LokiResult>;
|
|
173
|
+
labels: (query?: {
|
|
174
|
+
start?: string;
|
|
175
|
+
end?: string;
|
|
176
|
+
}, options?: RequestOptions) => Promise<LabelResult>;
|
|
177
|
+
labelValues: (name: string, query?: {
|
|
178
|
+
start?: string;
|
|
179
|
+
end?: string;
|
|
180
|
+
}, options?: RequestOptions) => Promise<LabelResult>;
|
|
181
|
+
views: {
|
|
182
|
+
create: (body: ViewInput, options?: RequestOptions) => Promise<SavedView>;
|
|
183
|
+
get: (id: string, options?: RequestOptions) => Promise<SavedView>;
|
|
184
|
+
list: (query?: {
|
|
185
|
+
limit?: number;
|
|
186
|
+
cursor?: string;
|
|
187
|
+
}, options?: RequestOptions) => Promise<Page<SavedView>>;
|
|
188
|
+
update: (id: string, body: Partial<ViewInput>, options?: RequestOptions) => Promise<SavedView>;
|
|
189
|
+
delete: (id: string, options?: RequestOptions) => Promise<void>;
|
|
190
|
+
};
|
|
191
|
+
ingest: (body: OtlpLogs, options?: RequestOptions) => Promise<{
|
|
192
|
+
partialSuccess?: {
|
|
193
|
+
rejectedLogRecords?: string;
|
|
194
|
+
rejectedSpans?: string;
|
|
195
|
+
errorMessage?: string;
|
|
196
|
+
};
|
|
197
|
+
}>;
|
|
198
|
+
};
|
|
199
|
+
export declare function traces(t: Transport): {
|
|
200
|
+
get: (id: string, options?: RequestOptions) => Promise<Trace>;
|
|
201
|
+
search: (q: string, options?: RequestOptions) => Promise<TraceSearchResult>;
|
|
202
|
+
tags: (options?: RequestOptions) => Promise<{
|
|
203
|
+
tagNames: string[];
|
|
204
|
+
}>;
|
|
205
|
+
views: {
|
|
206
|
+
create: (body: ViewInput, options?: RequestOptions) => Promise<SavedView>;
|
|
207
|
+
get: (id: string, options?: RequestOptions) => Promise<SavedView>;
|
|
208
|
+
list: (query?: {
|
|
209
|
+
limit?: number;
|
|
210
|
+
cursor?: string;
|
|
211
|
+
}, options?: RequestOptions) => Promise<Page<SavedView>>;
|
|
212
|
+
update: (id: string, body: Partial<ViewInput>, options?: RequestOptions) => Promise<SavedView>;
|
|
213
|
+
delete: (id: string, options?: RequestOptions) => Promise<void>;
|
|
214
|
+
};
|
|
215
|
+
ingest: (body: OtlpTraces, options?: RequestOptions) => Promise<{
|
|
216
|
+
partialSuccess?: {
|
|
217
|
+
rejectedLogRecords?: string;
|
|
218
|
+
rejectedSpans?: string;
|
|
219
|
+
errorMessage?: string;
|
|
220
|
+
};
|
|
221
|
+
}>;
|
|
222
|
+
};
|
|
223
|
+
export declare function alerts(t: Transport): {
|
|
224
|
+
test: (id: string, options?: RequestOptions) => Promise<{
|
|
225
|
+
firing: boolean;
|
|
226
|
+
matches: number;
|
|
227
|
+
}>;
|
|
228
|
+
silence: (id: string, input: {
|
|
229
|
+
until: string;
|
|
230
|
+
reason?: string;
|
|
231
|
+
}, options?: RequestOptions) => Promise<Alert>;
|
|
232
|
+
create: (body: AlertInput, options?: RequestOptions) => Promise<Alert>;
|
|
233
|
+
get: (id: string, options?: RequestOptions) => Promise<Alert>;
|
|
234
|
+
list: (query?: {
|
|
235
|
+
limit?: number;
|
|
236
|
+
cursor?: string;
|
|
237
|
+
}, options?: RequestOptions) => Promise<Page<Alert>>;
|
|
238
|
+
update: (id: string, body: Partial<AlertInput>, options?: RequestOptions) => Promise<Alert>;
|
|
239
|
+
delete: (id: string, options?: RequestOptions) => Promise<void>;
|
|
240
|
+
};
|
|
241
|
+
export type ObservabilityClient = {
|
|
242
|
+
logs: ReturnType<typeof logs>;
|
|
243
|
+
traces: ReturnType<typeof traces>;
|
|
244
|
+
alerts: ReturnType<typeof alerts>;
|
|
245
|
+
};
|