withruntime 0.34.0 → 0.37.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 +207 -204
- package/COMPATIBILITY.md +367 -337
- package/DAYTONA.md +180 -173
- package/E2B.md +246 -230
- package/README.md +182 -142
- package/README.src.md +182 -142
- package/VERCEL.md +173 -168
- package/agent-platforms-inventory.json +387 -0
- package/dist/agents-cli.d.ts +7 -1
- package/dist/agents-cli.js +219 -2
- package/dist/ci-cli.d.ts +7 -1
- package/dist/ci-cli.js +25 -1
- package/dist/cli-words.js +1 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +25 -3
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js +4 -1
- package/dist/functions/index.d.ts +10 -0
- package/dist/functions/index.js +11 -0
- package/dist/index.d.ts +3 -3
- package/dist/inngest/index.d.ts +96 -0
- package/dist/inngest/index.js +183 -0
- package/dist/jobs-code/cron.d.ts +12 -0
- package/dist/jobs-code/cron.js +93 -0
- package/dist/jobs-code/registry.d.ts +31 -0
- package/dist/jobs-code/registry.js +30 -0
- package/dist/jobs-code/runner.d.ts +1 -0
- package/dist/jobs-code/runner.js +74 -0
- package/dist/jobs-deploy.d.ts +22 -0
- package/dist/jobs-deploy.js +247 -0
- package/dist/jobs-import.d.ts +15 -0
- package/dist/jobs-import.js +231 -0
- package/dist/products/agents.d.ts +161 -1
- package/dist/products/agents.js +40 -0
- package/dist/products/ci.d.ts +19 -1
- package/dist/products/functions.d.ts +2 -0
- package/dist/products/functions.js +5 -0
- package/dist/products/index.d.ts +2 -0
- package/dist/products/index.js +3 -0
- package/dist/products/jobs.d.ts +77 -0
- package/dist/products/jobs.js +5 -0
- package/dist/transport.d.ts +5 -1
- package/dist/transport.js +7 -1
- package/dist/trigger/index.d.ts +202 -0
- package/dist/trigger/index.js +244 -0
- package/dist/types.d.ts +15 -3
- package/package.json +19 -3
|
@@ -65,6 +65,13 @@ export type AgentDefinition = {
|
|
|
65
65
|
volume: string;
|
|
66
66
|
path: string;
|
|
67
67
|
}[];
|
|
68
|
+
/** Where each session's sandbox may connect, enforced by its network
|
|
69
|
+
* rules from its first packet: with allow, only those hosts. Absent:
|
|
70
|
+
* anywhere. */
|
|
71
|
+
network?: {
|
|
72
|
+
internet: boolean;
|
|
73
|
+
allow?: string[];
|
|
74
|
+
};
|
|
68
75
|
/** How long a session's sandbox runs with nothing happening before it
|
|
69
76
|
* pauses; default 60. */
|
|
70
77
|
idlePauseSeconds?: number;
|
|
@@ -85,6 +92,24 @@ export type AgentDefinition = {
|
|
|
85
92
|
memory?: {
|
|
86
93
|
scope: "key" | "agent";
|
|
87
94
|
};
|
|
95
|
+
/** Which tool calls of the harness run, wait for a person, or are
|
|
96
|
+
* refused. Each call is a `tool_call` event in the session's log; one that
|
|
97
|
+
* waits is an ask of the inbox with the options Allow and Deny
|
|
98
|
+
* (`agents.asks.approve`, `agents.asks.deny`), and only that call waits.
|
|
99
|
+
* Absent: every call runs. */
|
|
100
|
+
permissions?: AgentPermissions;
|
|
101
|
+
};
|
|
102
|
+
/** always_allow: the call runs. always_ask: it waits for a person's Allow or
|
|
103
|
+
* Deny. auto: Runtime reads the call and runs it, refuses it (high_risk) or
|
|
104
|
+
* holds it for a person (indeterminate). */
|
|
105
|
+
export type AgentPermissionPolicy = "always_allow" | "always_ask" | "auto";
|
|
106
|
+
export type AgentPermissions = {
|
|
107
|
+
/** Default always_allow. */
|
|
108
|
+
default?: AgentPermissionPolicy;
|
|
109
|
+
/** By the most particular name that matches: the harness's own tool name
|
|
110
|
+
* (Bash, Edit, apply_patch, run_shell_command, mcp__github__create_issue),
|
|
111
|
+
* an MCP server (mcp:github), or a family (shell, edit, read, web, mcp). */
|
|
112
|
+
tools?: Record<string, AgentPermissionPolicy>;
|
|
88
113
|
};
|
|
89
114
|
export type Agent = {
|
|
90
115
|
id: string;
|
|
@@ -125,7 +150,11 @@ export type AgentSession = {
|
|
|
125
150
|
};
|
|
126
151
|
export type AgentEvent = {
|
|
127
152
|
seq: number;
|
|
128
|
-
|
|
153
|
+
/** turn and tool: a model turn and a tool call of the session's trace,
|
|
154
|
+
* the span in body (`AgentTurn`, `AgentToolCall`). tool_call: one call
|
|
155
|
+
* the harness made under the agent's permissions, body {text, tool,
|
|
156
|
+
* input, toolUseId, evaluatedPermission, evaluation, askId}. */
|
|
157
|
+
kind: "input" | "answer" | "reply" | "ask" | "status" | "result" | "error" | "note" | "child" | "turn" | "tool" | "tool_call";
|
|
129
158
|
/** A key's principal id, slack:<user>, github:<login>, agent (the
|
|
130
159
|
* harness) or runtime. */
|
|
131
160
|
actor: string;
|
|
@@ -135,6 +164,95 @@ export type AgentEvent = {
|
|
|
135
164
|
} & Record<string, unknown>;
|
|
136
165
|
createdAt: string;
|
|
137
166
|
};
|
|
167
|
+
/** Token counts and their cost at the provider's list price, in USD. */
|
|
168
|
+
export type AgentTokens = {
|
|
169
|
+
/** Input tokens not read from or written to the prompt cache. */
|
|
170
|
+
inputTokens: number;
|
|
171
|
+
outputTokens: number;
|
|
172
|
+
cacheReadTokens: number;
|
|
173
|
+
cacheWriteTokens: number;
|
|
174
|
+
costUsd: number;
|
|
175
|
+
};
|
|
176
|
+
/** One model request the session's harness made. */
|
|
177
|
+
export type AgentTurn = Omit<AgentTokens, "costUsd"> & {
|
|
178
|
+
seq: number;
|
|
179
|
+
kind: "turn";
|
|
180
|
+
/** 16 hex digits; a tool call's `turn` names it. */
|
|
181
|
+
id: string;
|
|
182
|
+
provider: "anthropic" | "openai" | "google" | "other";
|
|
183
|
+
model: string;
|
|
184
|
+
startedAt: string;
|
|
185
|
+
durationMs: number;
|
|
186
|
+
/** Until the first bytes of the answer. */
|
|
187
|
+
firstTokenMs: number | null;
|
|
188
|
+
/** null for a model with no list price known. */
|
|
189
|
+
costUsd: number | null;
|
|
190
|
+
stopReason: string | null;
|
|
191
|
+
/** The model API's HTTP status. */
|
|
192
|
+
status: number;
|
|
193
|
+
error: string | null;
|
|
194
|
+
toolCalls: {
|
|
195
|
+
id: string;
|
|
196
|
+
name: string;
|
|
197
|
+
}[];
|
|
198
|
+
};
|
|
199
|
+
/** One tool call: from the turn that asked for it to the request that
|
|
200
|
+
* carried its result back. */
|
|
201
|
+
export type AgentToolCall = {
|
|
202
|
+
seq: number;
|
|
203
|
+
kind: "tool";
|
|
204
|
+
id: string;
|
|
205
|
+
name: string;
|
|
206
|
+
turn: string | null;
|
|
207
|
+
startedAt: string;
|
|
208
|
+
durationMs: number;
|
|
209
|
+
/** The call's input and output, each at most 2,000 characters. */
|
|
210
|
+
input: string;
|
|
211
|
+
output: string;
|
|
212
|
+
error: boolean;
|
|
213
|
+
};
|
|
214
|
+
/** A page of a session's trace: the whole session's totals, by model and
|
|
215
|
+
* by tool, and up to `limit` spans after `after`. Read the next page with
|
|
216
|
+
* `after: nextAfter` until it is null. */
|
|
217
|
+
export type AgentTrace = {
|
|
218
|
+
sessionId: string;
|
|
219
|
+
totals: AgentTokens & {
|
|
220
|
+
turns: number;
|
|
221
|
+
toolCalls: number;
|
|
222
|
+
unpricedTurns: number;
|
|
223
|
+
failedTurns: number;
|
|
224
|
+
failedToolCalls: number;
|
|
225
|
+
modelMs: number;
|
|
226
|
+
toolMs: number;
|
|
227
|
+
};
|
|
228
|
+
models: (AgentTokens & {
|
|
229
|
+
model: string;
|
|
230
|
+
provider: string;
|
|
231
|
+
turns: number;
|
|
232
|
+
unpricedTurns: number;
|
|
233
|
+
})[];
|
|
234
|
+
tools: {
|
|
235
|
+
name: string;
|
|
236
|
+
calls: number;
|
|
237
|
+
failed: number;
|
|
238
|
+
durationMs: number;
|
|
239
|
+
}[];
|
|
240
|
+
spans: (AgentTurn | AgentToolCall)[];
|
|
241
|
+
/** The seq to read the next page after; null when the log held no more. */
|
|
242
|
+
nextAfter: number | null;
|
|
243
|
+
};
|
|
244
|
+
/** OTLP/JSON: an ExportTraceServiceRequest of one page, to POST to a
|
|
245
|
+
* collector's /v1/traces; the first page holds the session's root span. */
|
|
246
|
+
export type AgentTraceOtlp = {
|
|
247
|
+
resourceSpans: Record<string, unknown>[];
|
|
248
|
+
nextAfter: number | null;
|
|
249
|
+
};
|
|
250
|
+
/** Which page of a trace: spans after `after` (0 by default), at most
|
|
251
|
+
* `limit` (200 by default, 500 at most). */
|
|
252
|
+
export type AgentTracePage = {
|
|
253
|
+
after?: number;
|
|
254
|
+
limit?: number;
|
|
255
|
+
};
|
|
138
256
|
export type AgentAskState = "open" | "answered" | "expired" | "withdrawn" | "closed";
|
|
139
257
|
/** One row of the account's inbox: a question a session's harness needs
|
|
140
258
|
* answered to go on. Asks of one agent's sessions sharing a memory, with the same `step` are
|
|
@@ -178,6 +296,20 @@ export type AgentAsk = {
|
|
|
178
296
|
createdAt: string;
|
|
179
297
|
updatedAt: string;
|
|
180
298
|
closedAt: string | null;
|
|
299
|
+
/** The tool call it holds, answered Allow or Deny; null for any other ask. */
|
|
300
|
+
toolCall: AgentAskToolCall | null;
|
|
301
|
+
};
|
|
302
|
+
/** A tool call the agent's permissions hold for a person. */
|
|
303
|
+
export type AgentAskToolCall = {
|
|
304
|
+
/** The harness's name for it: Bash, apply_patch, mcp__github__create_issue. */
|
|
305
|
+
tool: string;
|
|
306
|
+
input: Record<string, unknown>;
|
|
307
|
+
toolUseId?: string;
|
|
308
|
+
/** Its tool_call event in the session's log. */
|
|
309
|
+
seq?: number;
|
|
310
|
+
policy: "always_ask" | "auto";
|
|
311
|
+
/** Why auto held it: indeterminate. */
|
|
312
|
+
reasonCode?: string;
|
|
181
313
|
};
|
|
182
314
|
export type ListAgentAsks = {
|
|
183
315
|
/** Open by default. */
|
|
@@ -404,6 +536,13 @@ export type AgentSessionHandle = {
|
|
|
404
536
|
signal?: AbortSignal;
|
|
405
537
|
}): AsyncGenerator<AgentEvent>;
|
|
406
538
|
stop(options?: RequestOptions): Promise<AgentSession>;
|
|
539
|
+
/** A page of its trace: every model turn and tool call, with timing,
|
|
540
|
+
* tokens and cost, and the session's totals; `{ format: "otlp" }` for
|
|
541
|
+
* OpenTelemetry traces. */
|
|
542
|
+
trace(options?: RequestOptions & AgentTracePage): Promise<AgentTrace>;
|
|
543
|
+
trace(options: RequestOptions & AgentTracePage & {
|
|
544
|
+
format: "otlp";
|
|
545
|
+
}): Promise<AgentTraceOtlp>;
|
|
407
546
|
/** Until it has ended; answers it then. */
|
|
408
547
|
wait(options?: {
|
|
409
548
|
signal?: AbortSignal;
|
|
@@ -411,6 +550,13 @@ export type AgentSessionHandle = {
|
|
|
411
550
|
get(options?: RequestOptions): Promise<AgentSession>;
|
|
412
551
|
};
|
|
413
552
|
export declare function agents(t: Transport): {
|
|
553
|
+
/** Claude Managed Agents' API on Runtime: the options Anthropic's SDK
|
|
554
|
+
* takes, so code written for it runs here unchanged:
|
|
555
|
+
* `new Anthropic(await runtime.agents.anthropic())`. */
|
|
556
|
+
anthropic: () => Promise<{
|
|
557
|
+
baseURL: string;
|
|
558
|
+
apiKey: string;
|
|
559
|
+
}>;
|
|
414
560
|
/** An agent: a name and a definition its sessions start from. */
|
|
415
561
|
create: (input: CreateAgent, options?: RequestOptions) => Promise<Agent>;
|
|
416
562
|
/** By its id or its name. */
|
|
@@ -430,6 +576,15 @@ export declare function agents(t: Transport): {
|
|
|
430
576
|
session(id: string, options?: RequestOptions): Promise<AgentSessionHandle>;
|
|
431
577
|
sessions: {
|
|
432
578
|
get: (id: string, options?: RequestOptions) => Promise<AgentSession>;
|
|
579
|
+
/** A session's trace: every model turn and tool call with its timing,
|
|
580
|
+
* tokens and cost, totals by model and tool; `{ format: "otlp" }` for
|
|
581
|
+
* OpenTelemetry traces in the GenAI semantic conventions. */
|
|
582
|
+
trace: {
|
|
583
|
+
(id: string, options?: RequestOptions & AgentTracePage): Promise<AgentTrace>;
|
|
584
|
+
(id: string, options: RequestOptions & AgentTracePage & {
|
|
585
|
+
format: "otlp";
|
|
586
|
+
}): Promise<AgentTraceOtlp>;
|
|
587
|
+
};
|
|
433
588
|
/** Newest first; of one agent, or in some states. */
|
|
434
589
|
list: (query?: {
|
|
435
590
|
agent?: string;
|
|
@@ -451,6 +606,11 @@ export declare function agents(t: Transport): {
|
|
|
451
606
|
/** Every session asking it reads the answer next, and wakes. An ask no
|
|
452
607
|
* longer open is refused with `ask_closed`. */
|
|
453
608
|
answer: (id: string, answer: AnswerAgentAsk, options?: RequestOptions) => Promise<AgentAsk>;
|
|
609
|
+
/** Lets a tool call the agent's permissions held run (its ask's Allow). */
|
|
610
|
+
approve: (id: string, options?: RequestOptions) => Promise<AgentAsk>;
|
|
611
|
+
/** Keeps a held tool call from running (its ask's Deny); `message` is
|
|
612
|
+
* told to the agent as the reason. */
|
|
613
|
+
deny: (id: string, message?: string, options?: RequestOptions) => Promise<AgentAsk>;
|
|
454
614
|
};
|
|
455
615
|
triggers: {
|
|
456
616
|
create: (agent: string, input: CreateAgentTrigger, options?: RequestOptions) => Promise<AgentTrigger>;
|
package/dist/products/agents.js
CHANGED
|
@@ -133,6 +133,19 @@ const enc = encodeURIComponent;
|
|
|
133
133
|
const ENDED = ["done", "failed", "stopped"];
|
|
134
134
|
export function agents(t) {
|
|
135
135
|
const getSession = (id, options) => t.json({ method: "GET", path: `/v1/agents/sessions/${enc(id)}`, ...options });
|
|
136
|
+
function trace(id, options = {}) {
|
|
137
|
+
const { format = "json", after, limit, ...rest } = options;
|
|
138
|
+
return t.json({
|
|
139
|
+
method: "GET",
|
|
140
|
+
path: `/v1/agents/sessions/${enc(id)}/trace`,
|
|
141
|
+
query: {
|
|
142
|
+
format,
|
|
143
|
+
...(after !== undefined ? { after } : {}),
|
|
144
|
+
...(limit !== undefined ? { limit } : {}),
|
|
145
|
+
},
|
|
146
|
+
...rest,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
136
149
|
async function* events(id, options = {}) {
|
|
137
150
|
let after = options.after ?? 0;
|
|
138
151
|
for (;;) {
|
|
@@ -164,6 +177,7 @@ export function agents(t) {
|
|
|
164
177
|
...options,
|
|
165
178
|
}),
|
|
166
179
|
events: (options) => events(session.id, options),
|
|
180
|
+
trace: ((options) => trace(session.id, options)),
|
|
167
181
|
stop: (options) => t.json({
|
|
168
182
|
method: "POST",
|
|
169
183
|
path: `/v1/agents/sessions/${enc(session.id)}/stop`,
|
|
@@ -235,6 +249,13 @@ export function agents(t) {
|
|
|
235
249
|
query: { scope, path },
|
|
236
250
|
});
|
|
237
251
|
return {
|
|
252
|
+
/** Claude Managed Agents' API on Runtime: the options Anthropic's SDK
|
|
253
|
+
* takes, so code written for it runs here unchanged:
|
|
254
|
+
* `new Anthropic(await runtime.agents.anthropic())`. */
|
|
255
|
+
anthropic: async () => ({
|
|
256
|
+
baseURL: `${t.baseUrl}/anthropic`,
|
|
257
|
+
apiKey: await t.apiKey(),
|
|
258
|
+
}),
|
|
238
259
|
/** An agent: a name and a definition its sessions start from. */
|
|
239
260
|
create: (input, options) => t.json({ method: "POST", path: "/v1/agents", body: input, ...options }),
|
|
240
261
|
/** By its id or its name. */
|
|
@@ -268,6 +289,10 @@ export function agents(t) {
|
|
|
268
289
|
},
|
|
269
290
|
sessions: {
|
|
270
291
|
get: getSession,
|
|
292
|
+
/** A session's trace: every model turn and tool call with its timing,
|
|
293
|
+
* tokens and cost, totals by model and tool; `{ format: "otlp" }` for
|
|
294
|
+
* OpenTelemetry traces in the GenAI semantic conventions. */
|
|
295
|
+
trace,
|
|
271
296
|
/** Newest first; of one agent, or in some states. */
|
|
272
297
|
list: listSessions,
|
|
273
298
|
/** An ended session and its log go. Its history is storage like any
|
|
@@ -295,6 +320,21 @@ export function agents(t) {
|
|
|
295
320
|
body: answer,
|
|
296
321
|
...options,
|
|
297
322
|
}),
|
|
323
|
+
/** Lets a tool call the agent's permissions held run (its ask's Allow). */
|
|
324
|
+
approve: (id, options) => t.json({
|
|
325
|
+
method: "POST",
|
|
326
|
+
path: `/v1/agents/asks/${enc(id)}/answer`,
|
|
327
|
+
body: { option: "Allow" },
|
|
328
|
+
...options,
|
|
329
|
+
}),
|
|
330
|
+
/** Keeps a held tool call from running (its ask's Deny); `message` is
|
|
331
|
+
* told to the agent as the reason. */
|
|
332
|
+
deny: (id, message, options) => t.json({
|
|
333
|
+
method: "POST",
|
|
334
|
+
path: `/v1/agents/asks/${enc(id)}/answer`,
|
|
335
|
+
body: { option: "Deny", ...(message ? { text: message } : {}) },
|
|
336
|
+
...options,
|
|
337
|
+
}),
|
|
298
338
|
},
|
|
299
339
|
triggers: {
|
|
300
340
|
create: (agent, input, options) => t.json({
|
package/dist/products/ci.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export type CiRepository = {
|
|
|
18
18
|
repository: string;
|
|
19
19
|
/** The branch whose pushes are checked as landed. */
|
|
20
20
|
productionBranch: string;
|
|
21
|
-
/** Where in the repository its checks are written. */
|
|
21
|
+
/** Where in the repository its checks are written: a `runtime.yml`, or a `cloudbuild.yaml` or `buildspec.yml`, run as Cloud Build or CodeBuild runs it. */
|
|
22
22
|
configPath: string;
|
|
23
23
|
/** The organization's installation of Runtime's GitHub App it is read through. */
|
|
24
24
|
installation: number;
|
|
@@ -122,7 +122,14 @@ export type CiJob = {
|
|
|
122
122
|
/** The sandboxes it ran in. A failure's may be kept paused: wake it, or
|
|
123
123
|
* exec in it, with runtime.sandboxes. */
|
|
124
124
|
sandboxIds: string[];
|
|
125
|
+
/** The ID of the job's own GitHub check run (`runtime / <name>`), created
|
|
126
|
+
* completed when the job ends; null while it runs, for a reused pass, or
|
|
127
|
+
* when GitHub did not accept the run. */
|
|
125
128
|
githubCheckRun: number | null;
|
|
129
|
+
/** Lines of the repository's files that the job's log reports as failing,
|
|
130
|
+
* or as warnings and notices, as its GitHub check run shows them. At most
|
|
131
|
+
* 50, failures first. */
|
|
132
|
+
annotations: CiAnnotation[];
|
|
126
133
|
/** A review step's verdict on the commit; null for a command's job. */
|
|
127
134
|
review: CiReview | null;
|
|
128
135
|
ms: number | null;
|
|
@@ -131,6 +138,17 @@ export type CiJob = {
|
|
|
131
138
|
startedAt: number | null;
|
|
132
139
|
endedAt: number | null;
|
|
133
140
|
};
|
|
141
|
+
/** A line of a file that a job's log reports. */
|
|
142
|
+
export type CiAnnotation = {
|
|
143
|
+
path: string;
|
|
144
|
+
startLine: number;
|
|
145
|
+
endLine: number;
|
|
146
|
+
/** Present only for a single line. */
|
|
147
|
+
startColumn?: number;
|
|
148
|
+
level: "notice" | "warning" | "failure";
|
|
149
|
+
message: string;
|
|
150
|
+
title?: string;
|
|
151
|
+
};
|
|
134
152
|
/** What one finding of a review is about. */
|
|
135
153
|
export type CiReviewKind = "bug" | "missed-case" | "data-at-risk" | "money-at-risk" | "auth-bypass" | "privilege-escalation" | "secret-exposed" | "made-public" | "command-injection" | "manipulation" | "other";
|
|
136
154
|
/** One thing a review found in the change. */
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/* runtime.functions: Apps whose copies all sleep when idle, on the same
|
|
2
|
+
* calls under /v1/functions (apps.ts holds both kinds). A private beta
|
|
3
|
+
* (PRODUCT_BETAS): an account outside it is refused with product_in_beta
|
|
4
|
+
* until Functions launches. */
|
|
5
|
+
export { functions } from "./apps.js";
|
package/dist/products/index.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ import { containers } from "./containers.js";
|
|
|
30
30
|
import { browsers } from "./browsers.js";
|
|
31
31
|
import { desktops } from "./desktops.js";
|
|
32
32
|
import { apps } from "./apps.js";
|
|
33
|
+
import { functions } from "./functions.js";
|
|
33
34
|
export declare const clientExtensions: {
|
|
34
35
|
images: typeof images;
|
|
35
36
|
volumes: typeof volumes;
|
|
@@ -59,6 +60,7 @@ export declare const clientExtensions: {
|
|
|
59
60
|
browsers: typeof browsers;
|
|
60
61
|
desktops: typeof desktops;
|
|
61
62
|
apps: typeof apps;
|
|
63
|
+
functions: typeof functions;
|
|
62
64
|
};
|
|
63
65
|
export declare const sandboxExtensions: {
|
|
64
66
|
interpreter: typeof sandboxInterpreter;
|
package/dist/products/index.js
CHANGED
|
@@ -32,6 +32,7 @@ import { desktops } from "./desktops.js";
|
|
|
32
32
|
// imports of files the hub loads, so importing them runs nothing in the hub
|
|
33
33
|
// (agents/hub-sdk-products.test.ts parses every product file the hub loads).
|
|
34
34
|
import { apps } from "./apps.js";
|
|
35
|
+
import { functions } from "./functions.js";
|
|
35
36
|
/* HOW A LANE ADDS A PRODUCT TO THE SDK
|
|
36
37
|
*
|
|
37
38
|
* 1. Write src/products/<name>.ts exporting a factory:
|
|
@@ -81,6 +82,8 @@ export const clientExtensions = {
|
|
|
81
82
|
// A private beta (PRODUCT_BETAS): an account outside it is refused with
|
|
82
83
|
// product_in_beta until Apps launches.
|
|
83
84
|
apps,
|
|
85
|
+
// The same until Functions launches.
|
|
86
|
+
functions,
|
|
84
87
|
};
|
|
85
88
|
export const sandboxExtensions = {
|
|
86
89
|
interpreter: sandboxInterpreter,
|
package/dist/products/jobs.d.ts
CHANGED
|
@@ -264,6 +264,78 @@ export declare function jobUpdateBody(input: UpdateJob): Record<string, unknown>
|
|
|
264
264
|
* on this deployment."). This names the product, keeps the code, status and
|
|
265
265
|
* request id, and says no retry will change it. */
|
|
266
266
|
export declare function switchedOff(product: string): (error: unknown) => never;
|
|
267
|
+
/** Another platform's job files, read into Runtime jobs (`jobs.importPlan`). */
|
|
268
|
+
export type JobImportRequest = {
|
|
269
|
+
/** The files, each with its name: a Cloud Run job's YAML and the Cloud
|
|
270
|
+
* Scheduler job that runs it, or an AWS Batch job definition (API JSON,
|
|
271
|
+
* describe-job-definitions output or a CloudFormation template) and the
|
|
272
|
+
* EventBridge schedule or rule that submits it. At most 1 MiB in all. */
|
|
273
|
+
files: {
|
|
274
|
+
path: string;
|
|
275
|
+
text: string;
|
|
276
|
+
}[];
|
|
277
|
+
/** Read them as this platform's; detected from the files when omitted. */
|
|
278
|
+
from?: "cloud-run" | "aws-batch";
|
|
279
|
+
/** A CloudFormation template's parameters and pseudo parameters, such as
|
|
280
|
+
* `{ "AWS::Region": "us-east-1" }`. */
|
|
281
|
+
parameters?: Record<string, string>;
|
|
282
|
+
};
|
|
283
|
+
export type JobImportSchedule = {
|
|
284
|
+
kind: "cron";
|
|
285
|
+
expression: string;
|
|
286
|
+
timezone: string;
|
|
287
|
+
} | {
|
|
288
|
+
kind: "once";
|
|
289
|
+
at: string;
|
|
290
|
+
timezone: string;
|
|
291
|
+
};
|
|
292
|
+
/** One job of a plan. Its image is built from `dockerfile`, and it runs the
|
|
293
|
+
* built image's start command. */
|
|
294
|
+
export type JobImportJob = {
|
|
295
|
+
name: string;
|
|
296
|
+
file: string;
|
|
297
|
+
/** The container image it ran on the other platform. */
|
|
298
|
+
sourceImage: string;
|
|
299
|
+
dockerfile: string;
|
|
300
|
+
/** The whole command when the file names it; null when part of it is the
|
|
301
|
+
* container image's own ENTRYPOINT or CMD. */
|
|
302
|
+
command: string[] | null;
|
|
303
|
+
env: Record<string, string>;
|
|
304
|
+
/** Values it read from a secret store; each is bound from the jobs secret
|
|
305
|
+
* of that name. */
|
|
306
|
+
secrets: {
|
|
307
|
+
name: string;
|
|
308
|
+
from: string;
|
|
309
|
+
}[];
|
|
310
|
+
compute: {
|
|
311
|
+
vcpu: number;
|
|
312
|
+
memoryMib: number;
|
|
313
|
+
diskMib: number | null;
|
|
314
|
+
};
|
|
315
|
+
timeoutSeconds: number;
|
|
316
|
+
retry: {
|
|
317
|
+
maxAttempts: number;
|
|
318
|
+
backoffSeconds: number;
|
|
319
|
+
};
|
|
320
|
+
/** Null: no schedule ran it there; it runs when triggered. */
|
|
321
|
+
schedule: JobImportSchedule | null;
|
|
322
|
+
/** Why it cannot be created as planned; null when it can. */
|
|
323
|
+
blocked: string | null;
|
|
324
|
+
};
|
|
325
|
+
export type JobImportPlan = {
|
|
326
|
+
from: "cloud-run" | "aws-batch";
|
|
327
|
+
read: string[];
|
|
328
|
+
jobs: JobImportJob[];
|
|
329
|
+
/** unmapped: left out. changed: carried over differently. info: how. */
|
|
330
|
+
notes: {
|
|
331
|
+
level: "unmapped" | "changed" | "info";
|
|
332
|
+
file: string;
|
|
333
|
+
key: string;
|
|
334
|
+
job?: string;
|
|
335
|
+
message: string;
|
|
336
|
+
}[];
|
|
337
|
+
importable: boolean;
|
|
338
|
+
};
|
|
267
339
|
/** Scheduled jobs: a command run in a fresh sandbox, once or on a cron
|
|
268
340
|
* schedule. Each run is a sandbox, paid for as one: from the free usage first while the run fits the limits without credit, then from credit
|
|
269
341
|
* at the sandbox rates, through the same holds and spending limits.
|
|
@@ -287,6 +359,11 @@ export declare function jobs(transport: Transport): {
|
|
|
287
359
|
limit?: number;
|
|
288
360
|
cursor?: string;
|
|
289
361
|
}, options?: RequestOptions) => Promise<Page<Job>>;
|
|
362
|
+
/** Read a Cloud Run job or an AWS Batch job definition, with its
|
|
363
|
+
* schedule, into the jobs that run the same container here, and what
|
|
364
|
+
* could not be carried over. Changes nothing; `runtime jobs import`
|
|
365
|
+
* builds and creates the plan. */
|
|
366
|
+
importPlan: (input: JobImportRequest, options?: RequestOptions) => Promise<JobImportPlan>;
|
|
290
367
|
get: (id: string, options?: RequestOptions) => Promise<Job>;
|
|
291
368
|
/** A job's runs, oldest first: each attempt of each occurrence.
|
|
292
369
|
* `{ order: "newest" }`: newest first, so the last run is one call.
|
package/dist/products/jobs.js
CHANGED
|
@@ -198,6 +198,11 @@ export function jobs(transport) {
|
|
|
198
198
|
create: (input, options) => t.json({ method: "POST", path: "/v1/jobs", body: jobBody(input), ...options }),
|
|
199
199
|
/** Your jobs, oldest first. Await for a page, or `for await` for all. */
|
|
200
200
|
list,
|
|
201
|
+
/** Read a Cloud Run job or an AWS Batch job definition, with its
|
|
202
|
+
* schedule, into the jobs that run the same container here, and what
|
|
203
|
+
* could not be carried over. Changes nothing; `runtime jobs import`
|
|
204
|
+
* builds and creates the plan. */
|
|
205
|
+
importPlan: (input, options) => t.json({ method: "POST", path: "/v1/job-imports", body: input, ...options }),
|
|
201
206
|
get: (id, options) => t.json({ method: "GET", path: `/v1/jobs/${enc(id)}`, ...options }),
|
|
202
207
|
/** A job's runs, oldest first: each attempt of each occurrence.
|
|
203
208
|
* `{ order: "newest" }`: newest first, so the last run is one call.
|
package/dist/transport.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RuntimeError } from "./errors.js";
|
|
2
|
-
export declare const VERSION = "0.
|
|
2
|
+
export declare const VERSION = "0.37.0";
|
|
3
3
|
export declare const DEFAULT_BASE_URL = "https://api.withruntime.com";
|
|
4
4
|
/** Runtime's API as code inside a Runtime sandbox reaches it: the sandbox's
|
|
5
5
|
* own host sends each request on to DEFAULT_BASE_URL over HTTPS. The API runs
|
|
@@ -141,6 +141,10 @@ export declare class Transport {
|
|
|
141
141
|
fileStream(call: Call): Promise<ReadableStream<Uint8Array>>;
|
|
142
142
|
/** Newline-delimited JSON events, as they arrive. */
|
|
143
143
|
events<T>(call: Call): AsyncGenerator<T>;
|
|
144
|
+
/** The key calls are made with: the one given, RUNTIME_API_KEY, or the
|
|
145
|
+
* connection `runtime login` saved. For another platform's SDK pointed at
|
|
146
|
+
* Runtime (`runtime.agents.anthropic()`). */
|
|
147
|
+
apiKey(): Promise<string>;
|
|
144
148
|
/** A WebSocket to an API path, authenticated with the same key. */
|
|
145
149
|
websocket(path: string, query?: Query): Promise<WebSocket>;
|
|
146
150
|
}
|
package/dist/transport.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ConnectionError, DELIBERATE, errorFor, NOTHING_RAN, RuntimeError, WAITS_FOR_ROOM, } from "./errors.js";
|
|
2
2
|
import { describeRoute, envFetch, openWebSocket, untrustedCertificate } from "./proxy.js";
|
|
3
3
|
import { warningText } from "./product-renames.js";
|
|
4
|
-
export const VERSION = "0.
|
|
4
|
+
export const VERSION = "0.37.0";
|
|
5
5
|
export const DEFAULT_BASE_URL = "https://api.withruntime.com";
|
|
6
6
|
/** Runtime's API as code inside a Runtime sandbox reaches it: the sandbox's
|
|
7
7
|
* own host sends each request on to DEFAULT_BASE_URL over HTTPS. The API runs
|
|
@@ -723,6 +723,12 @@ export class Transport {
|
|
|
723
723
|
release();
|
|
724
724
|
}
|
|
725
725
|
}
|
|
726
|
+
/** The key calls are made with: the one given, RUNTIME_API_KEY, or the
|
|
727
|
+
* connection `runtime login` saved. For another platform's SDK pointed at
|
|
728
|
+
* Runtime (`runtime.agents.anthropic()`). */
|
|
729
|
+
async apiKey() {
|
|
730
|
+
return this.#key();
|
|
731
|
+
}
|
|
726
732
|
/** A WebSocket to an API path, authenticated with the same key. */
|
|
727
733
|
async websocket(path, query) {
|
|
728
734
|
const apiKey = await this.#key();
|