withruntime 1.0.0 → 1.1.1
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/CHANGELOG.md +76 -0
- package/README.md +145 -0
- package/dist/generated/agentSessions.d.ts +218 -0
- package/dist/generated/agentSessions.js +154 -0
- package/dist/generated/agents.d.ts +193 -0
- package/dist/generated/agents.js +166 -0
- package/dist/generated/apps.d.ts +87 -28
- package/dist/generated/apps.js +153 -41
- package/dist/generated/audit.d.ts +2 -2
- package/dist/generated/audit.js +3 -3
- package/dist/generated/browsers.d.ts +87 -28
- package/dist/generated/browsers.js +153 -41
- package/dist/generated/builds.d.ts +87 -28
- package/dist/generated/builds.js +153 -41
- package/dist/generated/ci.d.ts +87 -28
- package/dist/generated/ci.js +153 -41
- package/dist/generated/containers.d.ts +87 -28
- package/dist/generated/containers.js +153 -41
- package/dist/generated/desktops.d.ts +89 -30
- package/dist/generated/desktops.js +155 -43
- package/dist/generated/domains.d.ts +52 -15
- package/dist/generated/domains.js +74 -14
- package/dist/generated/egressIps.d.ts +6 -6
- package/dist/generated/egressIps.js +4 -4
- package/dist/generated/events.d.ts +4 -2
- package/dist/generated/events.js +3 -3
- package/dist/generated/feedback.d.ts +1 -1
- package/dist/generated/feedback.js +3 -3
- package/dist/generated/functions.d.ts +87 -28
- package/dist/generated/functions.js +153 -41
- package/dist/generated/identities.d.ts +2 -2
- package/dist/generated/identities.js +5 -5
- package/dist/generated/images.d.ts +68 -14
- package/dist/generated/images.js +96 -15
- package/dist/generated/index.d.ts +9 -0
- package/dist/generated/index.js +12 -0
- package/dist/generated/jobRuns.d.ts +11 -4
- package/dist/generated/jobRuns.js +6 -6
- package/dist/generated/jobs.d.ts +58 -9
- package/dist/generated/jobs.js +98 -14
- package/dist/generated/keys.d.ts +8 -6
- package/dist/generated/keys.js +6 -6
- package/dist/generated/me.d.ts +2 -2
- package/dist/generated/me.js +3 -3
- package/dist/generated/messages.d.ts +67 -0
- package/dist/generated/messages.js +17 -0
- package/dist/generated/networks.d.ts +4 -4
- package/dist/generated/networks.js +4 -4
- package/dist/generated/notebooks.d.ts +87 -28
- package/dist/generated/notebooks.js +153 -41
- package/dist/generated/otel.d.ts +2 -2
- package/dist/generated/otel.js +5 -5
- package/dist/generated/ports.d.ts +11 -11
- package/dist/generated/ports.js +8 -8
- package/dist/generated/previews.d.ts +50 -15
- package/dist/generated/previews.js +70 -18
- package/dist/generated/projects.d.ts +30 -6
- package/dist/generated/projects.js +13 -9
- package/dist/generated/roles.d.ts +11 -2
- package/dist/generated/roles.js +9 -5
- package/dist/generated/routes.js +1 -1
- package/dist/generated/runtime.d.ts +15 -3
- package/dist/generated/runtime.js +31 -18
- package/dist/generated/sandboxes.d.ts +213 -66
- package/dist/generated/sandboxes.js +171 -43
- package/dist/generated/secrets.d.ts +45 -6
- package/dist/generated/secrets.js +69 -9
- package/dist/generated/sessions.d.ts +1 -1
- package/dist/generated/sessions.js +4 -4
- package/dist/generated/signing.js +3 -1
- package/dist/generated/sites.d.ts +87 -28
- package/dist/generated/sites.js +153 -41
- package/dist/generated/snapshots.d.ts +70 -5
- package/dist/generated/snapshots.js +107 -7
- package/dist/generated/tunnels.d.ts +8 -8
- package/dist/generated/tunnels.js +4 -4
- package/dist/generated/usage.d.ts +57 -6
- package/dist/generated/usage.js +4 -4
- package/dist/generated/volumes.d.ts +72 -7
- package/dist/generated/volumes.js +114 -10
- package/dist/generated/webhooks.d.ts +2 -2
- package/dist/generated/webhooks.js +5 -5
- package/dist/generated/workspaces.d.ts +87 -28
- package/dist/generated/workspaces.js +153 -41
- package/dist/v2/bin.d.ts +2 -0
- package/dist/v2/bin.js +15 -0
- package/dist/v2/cli.d.ts +15 -2
- package/dist/v2/cli.js +158 -53
- package/dist/v2/json.d.ts +9 -0
- package/dist/v2/json.js +5 -0
- package/dist/v2/mcp.js +14 -1
- package/dist/v2/openapi.json +7695 -4382
- package/dist/v2/shims/fly.js +49 -13
- package/dist/v2/shims/morph.js +1 -1
- package/dist/v2/table.d.ts +7 -4
- package/dist/v2/table.js +97 -34
- package/package.json +7 -5
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import type { RequestOptions, ClientOptions } from "./runtime.js";
|
|
2
|
+
import { Paginated, Transport } from "./runtime.js";
|
|
3
|
+
import type { NetworkRules } from "./sandboxes.js";
|
|
4
|
+
import type { VolumeMount } from "./sandboxes.js";
|
|
5
|
+
import type { SandboxInfo } from "./sandboxes.js";
|
|
6
|
+
/** A tool's policy in an agent's sessions. */
|
|
7
|
+
export interface AgentTool {
|
|
8
|
+
/** The tool's name, as its harness names it (`Bash`, `WebFetch`), or `mcp:<server>` for every tool of one of its MCP servers. */
|
|
9
|
+
name: string;
|
|
10
|
+
/** `allow` (it runs), `ask` (it waits for an answer to its ask), or `deny` (it never runs); `allow` when omitted. Default: "allow". */
|
|
11
|
+
policy?: "allow" | "ask" | "deny" | (string & {});
|
|
12
|
+
}
|
|
13
|
+
/** An MCP server an agent's sessions connect to. Its credentials are a secret whose hosts name its URL's host. */
|
|
14
|
+
export interface McpServer {
|
|
15
|
+
/** Its name, unique in the agent: its tools are `mcp:<name>`. */
|
|
16
|
+
name: string;
|
|
17
|
+
/** Its URL (Streamable HTTP). */
|
|
18
|
+
url: string;
|
|
19
|
+
}
|
|
20
|
+
/** An agent's settings: what each of its sessions is made with. */
|
|
21
|
+
export interface AgentSettings {
|
|
22
|
+
/** The harness each session runs: `claude-code`, `codex`, or `custom` (the `start` of `image`); `claude-code` when omitted. Default: "claude-code". */
|
|
23
|
+
harness?: "claude-code" | "codex" | "custom" | (string & {});
|
|
24
|
+
/** The image each session boots, by name (its newest version), `name:version` or ID; the harness's image when omitted. Required for `custom`. */
|
|
25
|
+
image?: string;
|
|
26
|
+
/** The model, as its provider names it (`claude-opus-5-5`); the harness's default when omitted. */
|
|
27
|
+
model?: string;
|
|
28
|
+
/** The model accounts each session may use, by secret name, 1 to 16: an API key or a subscription's token. A session takes the one with the most room left and moves to the next when a provider refuses it for its limit. At least 1 item. At most 16 items. */
|
|
29
|
+
accounts?: string[];
|
|
30
|
+
/** The instructions each session starts with: its system prompt. */
|
|
31
|
+
instructions?: string;
|
|
32
|
+
/** Each tool's policy, by name; a tool none names is allowed. At most 128 items. */
|
|
33
|
+
tools?: AgentTool[];
|
|
34
|
+
/** The MCP servers each session connects to. At most 32 items. */
|
|
35
|
+
mcpServers?: McpServer[];
|
|
36
|
+
/** The other secrets each session may get, by name, at most 64: only those of them whose scope admits it; [] none. At most 64 items. */
|
|
37
|
+
secrets?: string[];
|
|
38
|
+
/** Each session's vCPUs. At least 1. Default: 2. */
|
|
39
|
+
vcpu?: number;
|
|
40
|
+
/** Each session's memory in GB (1 GB is 1,024 MiB); a fraction is taken to the MiB (`1.5`). At least 1. Default: 4. */
|
|
41
|
+
memoryGB?: number;
|
|
42
|
+
/** Each session's disk in GB, to the MiB. At least 1. Default: 20. */
|
|
43
|
+
diskGB?: number;
|
|
44
|
+
/** Where each session may connect out; the open internet behind every machine's walls when omitted. */
|
|
45
|
+
network?: NetworkRules;
|
|
46
|
+
/** Seconds with nothing happening before a session pauses, 60 to 86400; 0 never; 300 when omitted. A paused session costs no CPU and wakes when a message is sent to it. At least 0. At most 86400. Default: 300. */
|
|
47
|
+
idlePauseSeconds?: number;
|
|
48
|
+
/** The most one session may cost in machine time, in US dollars (`"1.00"`): a session pauses once it has cost that. Model use is billed by the account's provider. */
|
|
49
|
+
maxCost?: string;
|
|
50
|
+
/** The most sessions open at once; a start past it is refused 429. At least 1. At most 10000. */
|
|
51
|
+
maxConcurrent?: number;
|
|
52
|
+
}
|
|
53
|
+
/** An agent to create. */
|
|
54
|
+
export interface AgentCreate extends AgentSettings {
|
|
55
|
+
/** Its name, unique in its project. */
|
|
56
|
+
name: string;
|
|
57
|
+
/** Labels to find it by; each session carries them. */
|
|
58
|
+
labels?: Record<string, string>;
|
|
59
|
+
}
|
|
60
|
+
/** An agent: a stored, versioned definition its sessions are made from. */
|
|
61
|
+
export interface AgentInfo extends AgentSettings {
|
|
62
|
+
/** Its ID. */
|
|
63
|
+
id: string;
|
|
64
|
+
/** Always `agent`. */
|
|
65
|
+
object: "agent" | (string & {});
|
|
66
|
+
/** Its name, unique in its project. */
|
|
67
|
+
name: string;
|
|
68
|
+
/** Its version, from 1: each update makes the next. A session keeps the version it was started on. */
|
|
69
|
+
version: number;
|
|
70
|
+
/** `active`, or `deleted` in a delete's answer. */
|
|
71
|
+
state: "active" | "deleted" | (string & {});
|
|
72
|
+
/** Its labels. */
|
|
73
|
+
labels: Record<string, string>;
|
|
74
|
+
/** When it was created. */
|
|
75
|
+
createdAt?: string;
|
|
76
|
+
/** When its current version was made. */
|
|
77
|
+
updatedAt?: string;
|
|
78
|
+
/** When it was deleted: a delete's answer, its state `deleted`. */
|
|
79
|
+
deletedAt?: string;
|
|
80
|
+
}
|
|
81
|
+
/** A session to start from an agent. */
|
|
82
|
+
export interface AgentStart {
|
|
83
|
+
/** The first message: what the session is asked. */
|
|
84
|
+
message?: string;
|
|
85
|
+
/** A key the caller names the conversation by (`ticket-4812`): a start with the key of a session that is open sends its message to that session instead of making one. At least 1 character. At most 256 characters. */
|
|
86
|
+
key?: string;
|
|
87
|
+
/** The agent's version to start on; its current one when omitted. At least 1. */
|
|
88
|
+
version?: number;
|
|
89
|
+
/** The session's name, unique in its project. */
|
|
90
|
+
name?: string;
|
|
91
|
+
/** Labels to find the session by, beside the agent's. */
|
|
92
|
+
labels?: Record<string, string>;
|
|
93
|
+
/** Volumes the session attaches and mounts, at most one: a volume is one machine's at a time, so it is each session's own, never its agent's. Its work kept there outlives the session, for the next to attach. */
|
|
94
|
+
volumes?: VolumeMount[];
|
|
95
|
+
}
|
|
96
|
+
/** What get takes in its query. */
|
|
97
|
+
export type AgentGetQuery = {
|
|
98
|
+
/** Seconds to wait, at most 60, for its state to differ from `ifState`; it answers once it does, or as it is when the wait ends. At least 0. At most 60. */
|
|
99
|
+
wait?: number;
|
|
100
|
+
/** The state the caller last read, which `wait` waits for it to leave. */
|
|
101
|
+
ifState?: string;
|
|
102
|
+
};
|
|
103
|
+
/** What list takes in its query. */
|
|
104
|
+
export type AgentListQuery = {
|
|
105
|
+
/** Only those with every label given (repeat it for several): key:value, or a key for any value. */
|
|
106
|
+
label?: string[];
|
|
107
|
+
/** The most items the page holds. At least 1. At most 200. Default: 50. */
|
|
108
|
+
limit?: number;
|
|
109
|
+
};
|
|
110
|
+
/** One of agents: A stored, versioned definition of an agent: its harness (Claude Code, Codex or an image of your own), model, model accounts, instructions, tools and machine. Each start makes a session, a machine of its own that runs the harness, billed as any machine is; model use is billed by the account's provider. An update makes a new version; a session keeps the version it started on. */
|
|
111
|
+
export declare class Agent {
|
|
112
|
+
#private;
|
|
113
|
+
/** What it was when last read. */
|
|
114
|
+
info: AgentInfo;
|
|
115
|
+
constructor(client: Agents, info: AgentInfo);
|
|
116
|
+
/** Its id. */
|
|
117
|
+
get id(): string;
|
|
118
|
+
/** The harness each session runs: `claude-code`, `codex`, or `custom` (the `start` of `image`); `claude-code` when omitted. Default: "claude-code". */
|
|
119
|
+
get harness(): "claude-code" | "codex" | "custom" | (string & {}) | undefined;
|
|
120
|
+
/** The image each session boots, by name (its newest version), `name:version` or ID; the harness's image when omitted. Required for `custom`. */
|
|
121
|
+
get image(): string | undefined;
|
|
122
|
+
/** The model, as its provider names it (`claude-opus-5-5`); the harness's default when omitted. */
|
|
123
|
+
get model(): string | undefined;
|
|
124
|
+
/** The model accounts each session may use, by secret name, 1 to 16: an API key or a subscription's token. A session takes the one with the most room left and moves to the next when a provider refuses it for its limit. At least 1 item. At most 16 items. */
|
|
125
|
+
get accounts(): string[] | undefined;
|
|
126
|
+
/** The instructions each session starts with: its system prompt. */
|
|
127
|
+
get instructions(): string | undefined;
|
|
128
|
+
/** Each tool's policy, by name; a tool none names is allowed. At most 128 items. */
|
|
129
|
+
get tools(): AgentTool[] | undefined;
|
|
130
|
+
/** The MCP servers each session connects to. At most 32 items. */
|
|
131
|
+
get mcpServers(): McpServer[] | undefined;
|
|
132
|
+
/** The other secrets each session may get, by name, at most 64: only those of them whose scope admits it; [] none. At most 64 items. */
|
|
133
|
+
get secrets(): string[] | undefined;
|
|
134
|
+
/** Each session's vCPUs. At least 1. Default: 2. */
|
|
135
|
+
get vcpu(): number | undefined;
|
|
136
|
+
/** Each session's memory in GB (1 GB is 1,024 MiB); a fraction is taken to the MiB (`1.5`). At least 1. Default: 4. */
|
|
137
|
+
get memoryGB(): number | undefined;
|
|
138
|
+
/** Each session's disk in GB, to the MiB. At least 1. Default: 20. */
|
|
139
|
+
get diskGB(): number | undefined;
|
|
140
|
+
/** Where each session may connect out; the open internet behind every machine's walls when omitted. */
|
|
141
|
+
get network(): NetworkRules | undefined;
|
|
142
|
+
/** Seconds with nothing happening before a session pauses, 60 to 86400; 0 never; 300 when omitted. A paused session costs no CPU and wakes when a message is sent to it. At least 0. At most 86400. Default: 300. */
|
|
143
|
+
get idlePauseSeconds(): number | undefined;
|
|
144
|
+
/** The most one session may cost in machine time, in US dollars (`"1.00"`): a session pauses once it has cost that. Model use is billed by the account's provider. */
|
|
145
|
+
get maxCost(): string | undefined;
|
|
146
|
+
/** The most sessions open at once; a start past it is refused 429. At least 1. At most 10000. */
|
|
147
|
+
get maxConcurrent(): number | undefined;
|
|
148
|
+
/** Always `agent`. */
|
|
149
|
+
get object(): "agent" | (string & {});
|
|
150
|
+
/** Its name, unique in its project. */
|
|
151
|
+
get name(): string;
|
|
152
|
+
/** Its version, from 1: each update makes the next. A session keeps the version it was started on. */
|
|
153
|
+
get version(): number;
|
|
154
|
+
/** `active`, or `deleted` in a delete's answer. */
|
|
155
|
+
get state(): "active" | "deleted" | (string & {});
|
|
156
|
+
/** Its labels. */
|
|
157
|
+
get labels(): Record<string, string>;
|
|
158
|
+
/** When it was created. */
|
|
159
|
+
get createdAt(): string | undefined;
|
|
160
|
+
/** When its current version was made. */
|
|
161
|
+
get updatedAt(): string | undefined;
|
|
162
|
+
/** When it was deleted: a delete's answer, its state `deleted`. */
|
|
163
|
+
get deletedAt(): string | undefined;
|
|
164
|
+
/** Makes one and returns it, as `new Runtime().agents.create()` does, with a client of its own: `RUNTIME_API_KEY`, or the key `options` names. */
|
|
165
|
+
static create(input: AgentCreate, options?: ClientOptions & RequestOptions): Promise<Agent>;
|
|
166
|
+
/** Returns an agent at its current version. */
|
|
167
|
+
refresh(query?: AgentGetQuery & RequestOptions, options?: RequestOptions): Promise<this>;
|
|
168
|
+
/** Changes an agent's settings and makes its next version: each setting named replaces its own, the rest are kept. Sessions started from then on use it; an open session keeps its version. */
|
|
169
|
+
update(input?: AgentSettings, options?: RequestOptions): Promise<this>;
|
|
170
|
+
/** Deletes an agent: no session is started from it from then on. Its open sessions run on until they are deleted. */
|
|
171
|
+
delete(options?: RequestOptions): Promise<AgentInfo>;
|
|
172
|
+
/** Starts a session: a machine that runs the agent's harness on its model account with the most room left, sent `message` as its first. With the `key` of an open session, sends `message` to that session and returns it. Refused 429 at the agent's maxConcurrent. Asked again with the same Idempotency-Key, it starts nothing more. */
|
|
173
|
+
start(input?: AgentStart, options?: RequestOptions): Promise<SandboxInfo>;
|
|
174
|
+
/** Deletes it when the `await using` block that holds it ends. */
|
|
175
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
176
|
+
}
|
|
177
|
+
/** A stored, versioned definition of an agent: its harness (Claude Code, Codex or an image of your own), model, model accounts, instructions, tools and machine. Each start makes a session, a machine of its own that runs the harness, billed as any machine is; model use is billed by the account's provider. An update makes a new version; a session keeps the version it started on. */
|
|
178
|
+
export declare class Agents {
|
|
179
|
+
readonly transport: Transport;
|
|
180
|
+
constructor(transport: Transport);
|
|
181
|
+
/** Creates an agent at version 1. Asked again with the same Idempotency-Key, it returns the same agent. */
|
|
182
|
+
create(input: AgentCreate, options?: RequestOptions): Promise<Agent>;
|
|
183
|
+
/** Returns an agent at its current version. */
|
|
184
|
+
get(id: string, query?: AgentGetQuery & RequestOptions, options?: RequestOptions): Promise<Agent>;
|
|
185
|
+
/** Lists the project's agents, newest first. */
|
|
186
|
+
list(query?: AgentListQuery & RequestOptions, options?: RequestOptions): Paginated<AgentInfo>;
|
|
187
|
+
/** Changes an agent's settings and makes its next version: each setting named replaces its own, the rest are kept. Sessions started from then on use it; an open session keeps its version. */
|
|
188
|
+
update(id: string, input?: AgentSettings, options?: RequestOptions): Promise<AgentInfo>;
|
|
189
|
+
/** Deletes an agent: no session is started from it from then on. Its open sessions run on until they are deleted. */
|
|
190
|
+
delete(id: string, options?: RequestOptions): Promise<AgentInfo>;
|
|
191
|
+
/** Starts a session: a machine that runs the agent's harness on its model account with the most room left, sent `message` as its first. With the `key` of an open session, sends `message` to that session and returns it. Refused 429 at the agent's maxConcurrent. Asked again with the same Idempotency-Key, it starts nothing more. */
|
|
192
|
+
start(id: string, input?: AgentStart, options?: RequestOptions): Promise<SandboxInfo>;
|
|
193
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
// Generated by spec-gen from engines/front/crates/spec. Do not edit:
|
|
2
|
+
// change the spec and run `cargo run -p runtime-front-spec-gen -- write`.
|
|
3
|
+
import { Paginated, Transport } from "./runtime.js";
|
|
4
|
+
/** One of agents: A stored, versioned definition of an agent: its harness (Claude Code, Codex or an image of your own), model, model accounts, instructions, tools and machine. Each start makes a session, a machine of its own that runs the harness, billed as any machine is; model use is billed by the account's provider. An update makes a new version; a session keeps the version it started on. */
|
|
5
|
+
export class Agent {
|
|
6
|
+
#c;
|
|
7
|
+
/** What it was when last read. */
|
|
8
|
+
info;
|
|
9
|
+
constructor(client, info) {
|
|
10
|
+
this.#c = client;
|
|
11
|
+
this.info = info;
|
|
12
|
+
}
|
|
13
|
+
/** Its id. */
|
|
14
|
+
get id() {
|
|
15
|
+
return this.info.id;
|
|
16
|
+
}
|
|
17
|
+
/** The harness each session runs: `claude-code`, `codex`, or `custom` (the `start` of `image`); `claude-code` when omitted. Default: "claude-code". */
|
|
18
|
+
get harness() {
|
|
19
|
+
return this.info.harness;
|
|
20
|
+
}
|
|
21
|
+
/** The image each session boots, by name (its newest version), `name:version` or ID; the harness's image when omitted. Required for `custom`. */
|
|
22
|
+
get image() {
|
|
23
|
+
return this.info.image;
|
|
24
|
+
}
|
|
25
|
+
/** The model, as its provider names it (`claude-opus-5-5`); the harness's default when omitted. */
|
|
26
|
+
get model() {
|
|
27
|
+
return this.info.model;
|
|
28
|
+
}
|
|
29
|
+
/** The model accounts each session may use, by secret name, 1 to 16: an API key or a subscription's token. A session takes the one with the most room left and moves to the next when a provider refuses it for its limit. At least 1 item. At most 16 items. */
|
|
30
|
+
get accounts() {
|
|
31
|
+
return this.info.accounts;
|
|
32
|
+
}
|
|
33
|
+
/** The instructions each session starts with: its system prompt. */
|
|
34
|
+
get instructions() {
|
|
35
|
+
return this.info.instructions;
|
|
36
|
+
}
|
|
37
|
+
/** Each tool's policy, by name; a tool none names is allowed. At most 128 items. */
|
|
38
|
+
get tools() {
|
|
39
|
+
return this.info.tools;
|
|
40
|
+
}
|
|
41
|
+
/** The MCP servers each session connects to. At most 32 items. */
|
|
42
|
+
get mcpServers() {
|
|
43
|
+
return this.info.mcpServers;
|
|
44
|
+
}
|
|
45
|
+
/** The other secrets each session may get, by name, at most 64: only those of them whose scope admits it; [] none. At most 64 items. */
|
|
46
|
+
get secrets() {
|
|
47
|
+
return this.info.secrets;
|
|
48
|
+
}
|
|
49
|
+
/** Each session's vCPUs. At least 1. Default: 2. */
|
|
50
|
+
get vcpu() {
|
|
51
|
+
return this.info.vcpu;
|
|
52
|
+
}
|
|
53
|
+
/** Each session's memory in GB (1 GB is 1,024 MiB); a fraction is taken to the MiB (`1.5`). At least 1. Default: 4. */
|
|
54
|
+
get memoryGB() {
|
|
55
|
+
return this.info.memoryGB;
|
|
56
|
+
}
|
|
57
|
+
/** Each session's disk in GB, to the MiB. At least 1. Default: 20. */
|
|
58
|
+
get diskGB() {
|
|
59
|
+
return this.info.diskGB;
|
|
60
|
+
}
|
|
61
|
+
/** Where each session may connect out; the open internet behind every machine's walls when omitted. */
|
|
62
|
+
get network() {
|
|
63
|
+
return this.info.network;
|
|
64
|
+
}
|
|
65
|
+
/** Seconds with nothing happening before a session pauses, 60 to 86400; 0 never; 300 when omitted. A paused session costs no CPU and wakes when a message is sent to it. At least 0. At most 86400. Default: 300. */
|
|
66
|
+
get idlePauseSeconds() {
|
|
67
|
+
return this.info.idlePauseSeconds;
|
|
68
|
+
}
|
|
69
|
+
/** The most one session may cost in machine time, in US dollars (`"1.00"`): a session pauses once it has cost that. Model use is billed by the account's provider. */
|
|
70
|
+
get maxCost() {
|
|
71
|
+
return this.info.maxCost;
|
|
72
|
+
}
|
|
73
|
+
/** The most sessions open at once; a start past it is refused 429. At least 1. At most 10000. */
|
|
74
|
+
get maxConcurrent() {
|
|
75
|
+
return this.info.maxConcurrent;
|
|
76
|
+
}
|
|
77
|
+
/** Always `agent`. */
|
|
78
|
+
get object() {
|
|
79
|
+
return this.info.object;
|
|
80
|
+
}
|
|
81
|
+
/** Its name, unique in its project. */
|
|
82
|
+
get name() {
|
|
83
|
+
return this.info.name;
|
|
84
|
+
}
|
|
85
|
+
/** Its version, from 1: each update makes the next. A session keeps the version it was started on. */
|
|
86
|
+
get version() {
|
|
87
|
+
return this.info.version;
|
|
88
|
+
}
|
|
89
|
+
/** `active`, or `deleted` in a delete's answer. */
|
|
90
|
+
get state() {
|
|
91
|
+
return this.info.state;
|
|
92
|
+
}
|
|
93
|
+
/** Its labels. */
|
|
94
|
+
get labels() {
|
|
95
|
+
return this.info.labels;
|
|
96
|
+
}
|
|
97
|
+
/** When it was created. */
|
|
98
|
+
get createdAt() {
|
|
99
|
+
return this.info.createdAt;
|
|
100
|
+
}
|
|
101
|
+
/** When its current version was made. */
|
|
102
|
+
get updatedAt() {
|
|
103
|
+
return this.info.updatedAt;
|
|
104
|
+
}
|
|
105
|
+
/** When it was deleted: a delete's answer, its state `deleted`. */
|
|
106
|
+
get deletedAt() {
|
|
107
|
+
return this.info.deletedAt;
|
|
108
|
+
}
|
|
109
|
+
/** Makes one and returns it, as `new Runtime().agents.create()` does, with a client of its own: `RUNTIME_API_KEY`, or the key `options` names. */
|
|
110
|
+
static async create(input, options = {}) {
|
|
111
|
+
return new Agents(new Transport(options)).create(input, options);
|
|
112
|
+
}
|
|
113
|
+
/** Returns an agent at its current version. */
|
|
114
|
+
async refresh(query = {}, options) {
|
|
115
|
+
this.info = (await this.#c.get(this.id, query, options)).info;
|
|
116
|
+
return this;
|
|
117
|
+
}
|
|
118
|
+
/** Changes an agent's settings and makes its next version: each setting named replaces its own, the rest are kept. Sessions started from then on use it; an open session keeps its version. */
|
|
119
|
+
async update(input = {}, options) {
|
|
120
|
+
this.info = await this.#c.update(this.id, input, options);
|
|
121
|
+
return this;
|
|
122
|
+
}
|
|
123
|
+
/** Deletes an agent: no session is started from it from then on. Its open sessions run on until they are deleted. */
|
|
124
|
+
delete(options) {
|
|
125
|
+
return this.#c.delete(this.id, options);
|
|
126
|
+
}
|
|
127
|
+
/** Starts a session: a machine that runs the agent's harness on its model account with the most room left, sent `message` as its first. With the `key` of an open session, sends `message` to that session and returns it. Refused 429 at the agent's maxConcurrent. Asked again with the same Idempotency-Key, it starts nothing more. */
|
|
128
|
+
start(input = {}, options) {
|
|
129
|
+
return this.#c.start(this.id, input, options);
|
|
130
|
+
}
|
|
131
|
+
/** Deletes it when the `await using` block that holds it ends. */
|
|
132
|
+
async [Symbol.asyncDispose]() {
|
|
133
|
+
await this.delete();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/** A stored, versioned definition of an agent: its harness (Claude Code, Codex or an image of your own), model, model accounts, instructions, tools and machine. Each start makes a session, a machine of its own that runs the harness, billed as any machine is; model use is billed by the account's provider. An update makes a new version; a session keeps the version it started on. */
|
|
137
|
+
export class Agents {
|
|
138
|
+
transport;
|
|
139
|
+
constructor(transport) {
|
|
140
|
+
this.transport = transport;
|
|
141
|
+
}
|
|
142
|
+
/** Creates an agent at version 1. Asked again with the same Idempotency-Key, it returns the same agent. */
|
|
143
|
+
async create(input, options) {
|
|
144
|
+
return new Agent(this, await this.transport.request("POST", `/v2/agents`, { body: input, options, idempotent: true }));
|
|
145
|
+
}
|
|
146
|
+
/** Returns an agent at its current version. */
|
|
147
|
+
async get(id, query = {}, options) {
|
|
148
|
+
return new Agent(this, await this.transport.request("GET", `/v2/agents/${encodeURIComponent(id)}`, { query: { ...query }, options, idempotent: true }));
|
|
149
|
+
}
|
|
150
|
+
/** Lists the project's agents, newest first. */
|
|
151
|
+
list(query = {}, options) {
|
|
152
|
+
return new Paginated((cursor) => this.transport.request("GET", `/v2/agents`, { query: { ...query, cursor }, options, idempotent: true }));
|
|
153
|
+
}
|
|
154
|
+
/** Changes an agent's settings and makes its next version: each setting named replaces its own, the rest are kept. Sessions started from then on use it; an open session keeps its version. */
|
|
155
|
+
update(id, input = {}, options) {
|
|
156
|
+
return this.transport.request("POST", `/v2/agents/${encodeURIComponent(id)}:update`, { body: input, options, idempotent: true });
|
|
157
|
+
}
|
|
158
|
+
/** Deletes an agent: no session is started from it from then on. Its open sessions run on until they are deleted. */
|
|
159
|
+
delete(id, options) {
|
|
160
|
+
return this.transport.request("DELETE", `/v2/agents/${encodeURIComponent(id)}`, { options, idempotent: true });
|
|
161
|
+
}
|
|
162
|
+
/** Starts a session: a machine that runs the agent's harness on its model account with the most room left, sent `message` as its first. With the `key` of an open session, sends `message` to that session and returns it. Refused 429 at the agent's maxConcurrent. Asked again with the same Idempotency-Key, it starts nothing more. */
|
|
163
|
+
start(id, input = {}, options) {
|
|
164
|
+
return this.transport.request("POST", `/v2/agents/${encodeURIComponent(id)}:start`, { body: input, options, idempotent: true });
|
|
165
|
+
}
|
|
166
|
+
}
|
package/dist/generated/apps.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import type { RequestOptions,
|
|
2
|
-
import { Paginated } from "./runtime.js";
|
|
1
|
+
import type { RequestOptions, ClientOptions } from "./runtime.js";
|
|
2
|
+
import { Paginated, Transport } from "./runtime.js";
|
|
3
|
+
import type { MachineStart } from "./sandboxes.js";
|
|
3
4
|
import type { NetworkRules } from "./sandboxes.js";
|
|
4
5
|
import type { SandboxCreate } from "./sandboxes.js";
|
|
6
|
+
import type { MachineReady } from "./sandboxes.js";
|
|
5
7
|
import type { SandboxInfo } from "./sandboxes.js";
|
|
8
|
+
import type { Terminal } from "./sandboxes.js";
|
|
6
9
|
import type { ExecRequest } from "./sandboxes.js";
|
|
7
10
|
import type { Process } from "./sandboxes.js";
|
|
8
11
|
import type { FileWritten } from "./sandboxes.js";
|
|
@@ -144,23 +147,23 @@ export declare class AppFiles {
|
|
|
144
147
|
#private;
|
|
145
148
|
constructor(client: Apps, id: string);
|
|
146
149
|
/** Returns a file's bytes. */
|
|
147
|
-
read(path: string, query?: Omit<AppReadQuery, "path"
|
|
150
|
+
read(path: string, query?: Omit<AppReadQuery, "path"> & RequestOptions, options?: RequestOptions): Promise<Uint8Array>;
|
|
148
151
|
/** Writes the request's bytes to a file as they come, of any size (Content-Length required), its folders made: the file whole when they all came, or as it was. With offset, they are written into it in place. */
|
|
149
|
-
write(path: string, data: Uint8Array | string, query?: Omit<AppWriteQuery, "path"
|
|
152
|
+
write(path: string, data: Uint8Array | string, query?: Omit<AppWriteQuery, "path"> & RequestOptions, options?: RequestOptions): Promise<FileWritten>;
|
|
150
153
|
/** Removes a file, a link or a directory (recursive for one with contents). One missing is success, removed false. */
|
|
151
154
|
remove(path: string, input?: Omit<FileRemove, "path">, options?: RequestOptions): Promise<FileRemoved>;
|
|
152
155
|
/** Returns what is at a path: a file, a directory or a link, or nothing (exists false). With sha256=true, a file's SHA-256 too. */
|
|
153
|
-
stat(path: string, query?: Omit<AppStatQuery, "path"
|
|
156
|
+
stat(path: string, query?: Omit<AppStatQuery, "path"> & RequestOptions, options?: RequestOptions): Promise<FileInfo>;
|
|
154
157
|
/** Lists a directory's entries in path order, to a depth. */
|
|
155
|
-
list(query?: AppListFilesQuery, options?: RequestOptions): Promise<FileList>;
|
|
158
|
+
list(query?: AppListFilesQuery & RequestOptions, options?: RequestOptions): Promise<FileList>;
|
|
156
159
|
/** Returns a folder as a tar archive (`application/x-tar`, or `application/gzip` with gzip), packed by tar in the app as it streams, of any size; its entries are relative to the folder (`./a.txt`). A folder that fails part way (a file it may not read, or one that changes as it is read) ends as an archive every tar reader refuses, never as a short one that reads whole. At most 4 at once in an app. A paused app is woken first. */
|
|
157
|
-
downloadFolder(path: string, query?: Omit<AppDownloadFolderQuery, "path"
|
|
160
|
+
downloadFolder(path: string, query?: Omit<AppDownloadFolderQuery, "path"> & RequestOptions, options?: RequestOptions): Promise<Uint8Array>;
|
|
158
161
|
/** Unpacks the request's tar archive (gzip-compressed or not, told by its first bytes) into a folder, made with its parents, by tar in the app as the bytes arrive, of any size, nothing of it kept on disk but what tar writes; returns once tar has ended, or 400 `invalid_archive` with what tar said. A paused app is woken first. */
|
|
159
|
-
uploadFolder(path: string, data: Uint8Array | string, query?: Omit<AppUploadFolderQuery, "path"
|
|
162
|
+
uploadFolder(path: string, data: Uint8Array | string, query?: Omit<AppUploadFolderQuery, "path"> & RequestOptions, options?: RequestOptions): Promise<FolderUnpacked>;
|
|
160
163
|
/** Begins a folder's upload in parts: tar starts in the app, unpacking into the folder each part as it arrives. Send the parts in order by offset (writeFolderUpload), then commitFolderUpload; an upload no call names for 10 minutes is ended. A paused app is woken first. */
|
|
161
164
|
beginFolderUpload(path: string, input?: Omit<FolderUploadBegin, "path">, options?: RequestOptions): Promise<FolderUpload>;
|
|
162
165
|
/** Sends the request's bytes, a part of the archive at its offset, into tar's input as they arrive, of any size, and returns the bytes received in all once tar took them. A part past them is refused 409 `upload_incomplete`, naming them: send the parts in order. */
|
|
163
|
-
writeFolderUpload(upload: string, data: Uint8Array | string, query?: AppWriteFolderUploadQuery, options?: RequestOptions): Promise<FolderUploadReceived>;
|
|
166
|
+
writeFolderUpload(upload: string, data: Uint8Array | string, query?: AppWriteFolderUploadQuery & RequestOptions, options?: RequestOptions): Promise<FolderUploadReceived>;
|
|
164
167
|
/** Ends a folder upload's input and returns once tar has ended, as an exec returns once its command has: the folder, or 400 `invalid_archive` with what tar said. A front that restarts meanwhile returns 503 `run_goes_on`; sent again, it returns how tar ended. An upload no call has named for 10 minutes since its last part or commit is ended. */
|
|
165
168
|
commitFolderUpload(upload: string, options?: RequestOptions): Promise<FolderUnpacked>;
|
|
166
169
|
/** Stops a folder upload's tar; what it unpacked so far stays. */
|
|
@@ -179,11 +182,13 @@ export declare class AppProcesses {
|
|
|
179
182
|
#private;
|
|
180
183
|
constructor(client: Apps, id: string);
|
|
181
184
|
/** Returns a process's output after a cursor, and the cursor to read on from. The latest 1 MiB is kept; truncated says when the cursor fell behind. */
|
|
182
|
-
output(process: string, query?: AppProcessOutputQuery, options?: RequestOptions): Promise<ProcessOutput>;
|
|
185
|
+
output(process: string, query?: AppProcessOutputQuery & RequestOptions, options?: RequestOptions): Promise<ProcessOutput>;
|
|
183
186
|
/** Sends input to a process started with stdinOpen or a pty, and returns how much of its input it has taken. */
|
|
184
187
|
write(process: string, input?: ProcessInput, options?: RequestOptions): Promise<ProcessWritten>;
|
|
185
188
|
/** Sends a signal to a process and its group; a process that ended is not signalled, so a retry is safe. */
|
|
186
189
|
signal(process: string, input?: ProcessSignal, options?: RequestOptions): Promise<Process>;
|
|
190
|
+
/** Resizes the terminal of a process started with a pty (its window's columns and rows, which the process is told by SIGWINCH), and returns the process; refused 409 for a process without one. A process that ended is left as it is, so a retry is safe. */
|
|
191
|
+
resize(process: string, input: Terminal, options?: RequestOptions): Promise<Process>;
|
|
187
192
|
/** Lists an app's processes, newest first: those running and those that ended lately. */
|
|
188
193
|
list(options?: RequestOptions): Promise<ProcessList>;
|
|
189
194
|
}
|
|
@@ -207,8 +212,56 @@ export declare class App {
|
|
|
207
212
|
constructor(client: Apps, info: SandboxInfo);
|
|
208
213
|
/** Its id. */
|
|
209
214
|
get id(): string;
|
|
215
|
+
/** Its vCPUs; its product's default when omitted. At least 1. */
|
|
216
|
+
get vcpu(): number | undefined;
|
|
217
|
+
/** Its memory in GB (1 GB is 1,024 MiB); a fraction is taken to the MiB (`1.5`). Its product's default when omitted. At least 1. */
|
|
218
|
+
get memoryGB(): number | undefined;
|
|
219
|
+
/** Its disk in GB (1 GB is 1,024 MiB), to the MiB. When omitted, its product's default or its image's size, whichever is larger. At least 1. */
|
|
220
|
+
get diskGB(): number | undefined;
|
|
221
|
+
/** The image it boots, by name (its newest version), `name:version` or ID; Runtime's default image when omitted. */
|
|
222
|
+
get image(): string | undefined;
|
|
223
|
+
/** The secrets it may get, by name, at most 64: only those of them whose scope admits it; [] none; every one whose scope admits it when omitted. A name with no secret yet takes effect once that secret is created. Fixed for its life: a fork or a copy of a snapshot keeps it. At most 64 items. */
|
|
224
|
+
get secrets(): string[] | undefined;
|
|
225
|
+
/** The command it starts at every fresh boot and keeps running, as a service: a web server, a runner, a desktop. A wake with its memory kept does not start it again. Its image's when omitted. */
|
|
226
|
+
get start(): MachineStart | undefined;
|
|
227
|
+
/** Who every command, process, terminal and code run in it runs as when the call names no `user`: `runtime` (uid 1000, with passwordless sudo) or `root`. Its image's when omitted, else `runtime`. */
|
|
228
|
+
get user(): "runtime" | "root" | (string & {}) | undefined;
|
|
229
|
+
/** Its product's kind: `sandbox` for a sandbox, `app` for an app, and so on. */
|
|
230
|
+
get object(): "sandbox" | "function" | "app" | "site" | "ci" | "browser" | "desktop" | "notebook" | "workspace" | "container" | "build" | "agent.session" | (string & {});
|
|
231
|
+
/** Its name, unique in its project. */
|
|
232
|
+
get name(): string | undefined;
|
|
233
|
+
/** Where it is. */
|
|
234
|
+
get state(): "starting" | "running" | "paused" | "deleted" | "error" | (string & {});
|
|
235
|
+
/** Its labels. */
|
|
236
|
+
get labels(): Record<string, string>;
|
|
237
|
+
/** When it was created. */
|
|
238
|
+
get createdAt(): string | undefined;
|
|
239
|
+
/** When it was deleted: a delete's answer alone. */
|
|
240
|
+
get deletedAt(): string | undefined;
|
|
241
|
+
/** Its revision, changed by every change to it: what an update's If-Match names. */
|
|
242
|
+
get revision(): number | undefined;
|
|
243
|
+
/** Seconds with nothing happening before it pauses; 0 never. Default: 300. */
|
|
244
|
+
get idlePauseSeconds(): number | undefined;
|
|
245
|
+
/** The most it may cost in all, in US dollars; none when it has no such cap. */
|
|
246
|
+
get maxCost(): string | undefined;
|
|
247
|
+
/** Whether a call that reaches it paused resumes it; false: only its own resume does, and such a call answers 409 sandbox_paused. Default: true. */
|
|
248
|
+
get autoWake(): boolean | undefined;
|
|
249
|
+
/** Its run's exit code, once its run ended; none for one a signal or its timeout ended. */
|
|
250
|
+
get exitCode(): number | undefined;
|
|
251
|
+
/** When its run ended. */
|
|
252
|
+
get endedAt(): string | undefined;
|
|
253
|
+
/** When its pause began (or its run ended), while it is paused. */
|
|
254
|
+
get pausedAt(): string | undefined;
|
|
255
|
+
/** A create's answer alone, for a start with a ready check: how its wait went. */
|
|
256
|
+
get ready(): MachineReady | undefined;
|
|
257
|
+
/** When Runtime deletes it (`deleteAfterSeconds`), finally: it can't be undone, as its delete can't; none: kept until deleted. */
|
|
258
|
+
get deleteAt(): string | undefined;
|
|
259
|
+
/** Whether its delete is refused (409 `delete_protected`) until an update turns this off. */
|
|
260
|
+
get deleteProtection(): boolean | undefined;
|
|
261
|
+
/** Makes one and returns it, as `new Runtime().apps.create()` does, with a client of its own: `RUNTIME_API_KEY`, or the key `options` names. */
|
|
262
|
+
static create(input?: SandboxCreate, options?: ClientOptions & RequestOptions): Promise<App>;
|
|
210
263
|
/** Returns an app. */
|
|
211
|
-
refresh(query?: AppGetQuery, options?: RequestOptions): Promise<this>;
|
|
264
|
+
refresh(query?: AppGetQuery & RequestOptions, options?: RequestOptions): Promise<this>;
|
|
212
265
|
/** Deletes an app, its memory and its disk. */
|
|
213
266
|
delete(options?: RequestOptions): Promise<SandboxInfo>;
|
|
214
267
|
/** Pauses an app with its memory and disk kept. A call to it resumes it. */
|
|
@@ -218,30 +271,34 @@ export declare class App {
|
|
|
218
271
|
/** Runs a command as a process and returns it once it ended, with its output; with wait false, at once, while it runs. A paused app is resumed first. Asked again with the same Idempotency-Key, it runs nothing more: it returns the first run's process, waiting for its end while it runs. */
|
|
219
272
|
exec(cmd: string | string[], input?: Omit<ExecRequest, "cmd">, options?: RequestOptions): Promise<Process>;
|
|
220
273
|
/** Returns an app's CPU, memory, disks and pressure, as its host reads them from the app's own cgroup over a fifth of a second: never a call into the app, so it does not wake a paused one nor keep one from its idle pause. One that is not running has no reading. */
|
|
221
|
-
metrics(query?: AppMetricsQuery, options?: RequestOptions): Promise<SandboxMetrics>;
|
|
274
|
+
metrics(query?: AppMetricsQuery & RequestOptions, options?: RequestOptions): Promise<SandboxMetrics>;
|
|
222
275
|
/** Copies an app as it is now, memory and disk, into `count` copies of its own, each running on its host. Asked again with the same Idempotency-Key, it returns the same copies. */
|
|
223
276
|
fork(input?: ForkRequest, options?: RequestOptions): Promise<Forked>;
|
|
224
277
|
/** Keeps an app's memory and disk as they are now, a snapshot to start apps from; with `image`, its disk alone as that image's next version. The app runs on. Asked again with the same Idempotency-Key, it returns the same snapshot. */
|
|
225
278
|
snapshot(input?: SnapshotRequest, options?: RequestOptions): Promise<Stored>;
|
|
226
|
-
/** Changes its name, labels, idle pause, maxCost, environment or sizes; each field left out stays as it is. A running one holds a changed environment before this answers (a paused one's at its wake): each process it starts after the answer has it, and its running processes keep the one they started with. Its vCPUs, memory and disk grow while it runs, its commands running on
|
|
279
|
+
/** Changes its name, labels, idle pause, maxCost, autoWake, lifetime, delete protection, environment or sizes; each field left out stays as it is. A lifetime (`deleteAfterSeconds`) sent again before its end moves the end to that many seconds from now; 0 takes it off. A lifetime is refused (409 `delete_protected`) while `deleteProtection` is true. A running one holds a changed environment before this answers (a paused one's at its wake): each process it starts after the answer has it, and its running processes keep the one they started with. Its vCPUs, memory and disk grow while it runs, its commands running on. One paused or stopped is not woken for it: judged at once as a live resize is (past the vCPUs it was made with 409, over its organization's limits `quota_exceeded`), its new sizes are returned at once, and its next wake grows it to them before the call that woke it runs. A smaller size, or a machine starting or failed, is refused 409 naming why, and nothing is changed. With If-Match, made only while its revision is that one, else 412. Sent again with the same Idempotency-Key and body while it is the latest change, it returns the current state and changes nothing; the same key with a different body returns 409 idempotency_key_reused. */
|
|
227
280
|
update(input?: MachineUpdate, options?: RequestOptions): Promise<this>;
|
|
228
281
|
/** Returns what an app's screen shows now, as `image/png` (or `image/jpeg`): its X display `:1`, whole. Refused 409 `display_not_running` when no display runs. A paused app is resumed first. */
|
|
229
|
-
screenshot(query?: AppScreenshotQuery, options?: RequestOptions): Promise<Uint8Array>;
|
|
282
|
+
screenshot(query?: AppScreenshotQuery & RequestOptions, options?: RequestOptions): Promise<Uint8Array>;
|
|
230
283
|
/** Moves, clicks, drags and scrolls the mouse and types on the keyboard of an app's screen (its X display `:1`), each step in turn as one command, and returns where the mouse is then. It stops at the first step that fails, refused 409 `act_failed` naming it; refused 409 `display_not_running` when no display runs. A paused app is resumed first. */
|
|
231
284
|
act(actions: Action[], input?: Omit<ActRequest, "actions">, options?: RequestOptions): Promise<Acted>;
|
|
232
285
|
/** Runs a cell of Python in an app as a notebook does, in a Jupyter kernel it keeps running for the cell's `context`: variables, imports and functions stay for the next cell. Returns what it printed, its values and displays (text, HTML, images such as charts), and its exception with its traceback. The context's kernel starts on its first cell. A cell past `timeoutSeconds` is interrupted and its context kept. Refused 409 `kernel_not_installed` when the image has no ipykernel. A paused app is resumed first. */
|
|
233
286
|
runCode(code: string, input?: Omit<RunCode, "code">, options?: RequestOptions): Promise<CodeRun>;
|
|
287
|
+
/** Starts a command and returns its process at once, while the command runs on. Its output is read with `processes.output` and it is stopped with `processes.signal`. */
|
|
288
|
+
spawn(cmd: string | string[], input?: Omit<ExecRequest, "cmd" | "wait">, options?: RequestOptions): Promise<Process>;
|
|
289
|
+
/** Deletes it when the `await using` block that holds it ends. */
|
|
290
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
234
291
|
}
|
|
235
292
|
/** A machine that keeps a web app in /app running on port 8080 (its Procfile's `web:`, else `npm start`, else `python3 app.py`, as Render and Heroku start one), reached at its preview. It never pauses for being idle. */
|
|
236
293
|
export declare class Apps {
|
|
237
|
-
|
|
294
|
+
readonly transport: Transport;
|
|
238
295
|
constructor(transport: Transport);
|
|
239
296
|
/** Creates an app. Asked again with the same Idempotency-Key, it returns the same app. */
|
|
240
297
|
create(input?: SandboxCreate, options?: RequestOptions): Promise<App>;
|
|
241
298
|
/** Returns an app. */
|
|
242
|
-
get(id: string, query?: AppGetQuery, options?: RequestOptions): Promise<App>;
|
|
299
|
+
get(id: string, query?: AppGetQuery & RequestOptions, options?: RequestOptions): Promise<App>;
|
|
243
300
|
/** Lists the project's apps, newest first. */
|
|
244
|
-
list(query?: AppListQuery, options?: RequestOptions): Paginated<SandboxInfo>;
|
|
301
|
+
list(query?: AppListQuery & RequestOptions, options?: RequestOptions): Paginated<SandboxInfo>;
|
|
245
302
|
/** Deletes an app, its memory and its disk. */
|
|
246
303
|
delete(id: string, options?: RequestOptions): Promise<SandboxInfo>;
|
|
247
304
|
/** Pauses an app with its memory and disk kept. A call to it resumes it. */
|
|
@@ -251,31 +308,33 @@ export declare class Apps {
|
|
|
251
308
|
/** Runs a command as a process and returns it once it ended, with its output; with wait false, at once, while it runs. A paused app is resumed first. Asked again with the same Idempotency-Key, it runs nothing more: it returns the first run's process, waiting for its end while it runs. */
|
|
252
309
|
exec(id: string, input: ExecRequest, options?: RequestOptions): Promise<Process>;
|
|
253
310
|
/** Returns a file's bytes. */
|
|
254
|
-
read(id: string, query: AppReadQuery, options?: RequestOptions): Promise<Uint8Array>;
|
|
311
|
+
read(id: string, query: AppReadQuery & RequestOptions, options?: RequestOptions): Promise<Uint8Array>;
|
|
255
312
|
/** Writes the request's bytes to a file as they come, of any size (Content-Length required), its folders made: the file whole when they all came, or as it was. With offset, they are written into it in place. */
|
|
256
|
-
write(id: string, data: Uint8Array | string, query: AppWriteQuery, options?: RequestOptions): Promise<FileWritten>;
|
|
313
|
+
write(id: string, data: Uint8Array | string, query: AppWriteQuery & RequestOptions, options?: RequestOptions): Promise<FileWritten>;
|
|
257
314
|
/** Returns a process's output after a cursor, and the cursor to read on from. The latest 1 MiB is kept; truncated says when the cursor fell behind. */
|
|
258
|
-
processOutput(id: string, process: string, query?: AppProcessOutputQuery, options?: RequestOptions): Promise<ProcessOutput>;
|
|
315
|
+
processOutput(id: string, process: string, query?: AppProcessOutputQuery & RequestOptions, options?: RequestOptions): Promise<ProcessOutput>;
|
|
259
316
|
/** Sends input to a process started with stdinOpen or a pty, and returns how much of its input it has taken. */
|
|
260
317
|
writeProcess(id: string, process: string, input?: ProcessInput, options?: RequestOptions): Promise<ProcessWritten>;
|
|
261
318
|
/** Sends a signal to a process and its group; a process that ended is not signalled, so a retry is safe. */
|
|
262
319
|
signalProcess(id: string, process: string, input?: ProcessSignal, options?: RequestOptions): Promise<Process>;
|
|
320
|
+
/** Resizes the terminal of a process started with a pty (its window's columns and rows, which the process is told by SIGWINCH), and returns the process; refused 409 for a process without one. A process that ended is left as it is, so a retry is safe. */
|
|
321
|
+
resizeProcess(id: string, process: string, input: Terminal, options?: RequestOptions): Promise<Process>;
|
|
263
322
|
/** Lists an app's processes, newest first: those running and those that ended lately. */
|
|
264
323
|
listProcesses(id: string, options?: RequestOptions): Promise<ProcessList>;
|
|
265
324
|
/** Removes a file, a link or a directory (recursive for one with contents). One missing is success, removed false. */
|
|
266
325
|
remove(id: string, input: FileRemove, options?: RequestOptions): Promise<FileRemoved>;
|
|
267
326
|
/** Returns what is at a path: a file, a directory or a link, or nothing (exists false). With sha256=true, a file's SHA-256 too. */
|
|
268
|
-
stat(id: string, query: AppStatQuery, options?: RequestOptions): Promise<FileInfo>;
|
|
327
|
+
stat(id: string, query: AppStatQuery & RequestOptions, options?: RequestOptions): Promise<FileInfo>;
|
|
269
328
|
/** Lists a directory's entries in path order, to a depth. */
|
|
270
|
-
listFiles(id: string, query?: AppListFilesQuery, options?: RequestOptions): Promise<FileList>;
|
|
329
|
+
listFiles(id: string, query?: AppListFilesQuery & RequestOptions, options?: RequestOptions): Promise<FileList>;
|
|
271
330
|
/** Returns a folder as a tar archive (`application/x-tar`, or `application/gzip` with gzip), packed by tar in the app as it streams, of any size; its entries are relative to the folder (`./a.txt`). A folder that fails part way (a file it may not read, or one that changes as it is read) ends as an archive every tar reader refuses, never as a short one that reads whole. At most 4 at once in an app. A paused app is woken first. */
|
|
272
|
-
downloadFolder(id: string, query: AppDownloadFolderQuery, options?: RequestOptions): Promise<Uint8Array>;
|
|
331
|
+
downloadFolder(id: string, query: AppDownloadFolderQuery & RequestOptions, options?: RequestOptions): Promise<Uint8Array>;
|
|
273
332
|
/** Unpacks the request's tar archive (gzip-compressed or not, told by its first bytes) into a folder, made with its parents, by tar in the app as the bytes arrive, of any size, nothing of it kept on disk but what tar writes; returns once tar has ended, or 400 `invalid_archive` with what tar said. A paused app is woken first. */
|
|
274
|
-
uploadFolder(id: string, data: Uint8Array | string, query: AppUploadFolderQuery, options?: RequestOptions): Promise<FolderUnpacked>;
|
|
333
|
+
uploadFolder(id: string, data: Uint8Array | string, query: AppUploadFolderQuery & RequestOptions, options?: RequestOptions): Promise<FolderUnpacked>;
|
|
275
334
|
/** Begins a folder's upload in parts: tar starts in the app, unpacking into the folder each part as it arrives. Send the parts in order by offset (writeFolderUpload), then commitFolderUpload; an upload no call names for 10 minutes is ended. A paused app is woken first. */
|
|
276
335
|
beginFolderUpload(id: string, input: FolderUploadBegin, options?: RequestOptions): Promise<FolderUpload>;
|
|
277
336
|
/** Sends the request's bytes, a part of the archive at its offset, into tar's input as they arrive, of any size, and returns the bytes received in all once tar took them. A part past them is refused 409 `upload_incomplete`, naming them: send the parts in order. */
|
|
278
|
-
writeFolderUpload(id: string, upload: string, data: Uint8Array | string, query?: AppWriteFolderUploadQuery, options?: RequestOptions): Promise<FolderUploadReceived>;
|
|
337
|
+
writeFolderUpload(id: string, upload: string, data: Uint8Array | string, query?: AppWriteFolderUploadQuery & RequestOptions, options?: RequestOptions): Promise<FolderUploadReceived>;
|
|
279
338
|
/** Ends a folder upload's input and returns once tar has ended, as an exec returns once its command has: the folder, or 400 `invalid_archive` with what tar said. A front that restarts meanwhile returns 503 `run_goes_on`; sent again, it returns how tar ended. An upload no call has named for 10 minutes since its last part or commit is ended. */
|
|
280
339
|
commitFolderUpload(id: string, upload: string, options?: RequestOptions): Promise<FolderUnpacked>;
|
|
281
340
|
/** Stops a folder upload's tar; what it unpacked so far stays. */
|
|
@@ -291,17 +350,17 @@ export declare class Apps {
|
|
|
291
350
|
/** Returns where an app may connect out. */
|
|
292
351
|
getNetwork(id: string, options?: RequestOptions): Promise<SandboxNetwork>;
|
|
293
352
|
/** Returns an app's CPU, memory, disks and pressure, as its host reads them from the app's own cgroup over a fifth of a second: never a call into the app, so it does not wake a paused one nor keep one from its idle pause. One that is not running has no reading. */
|
|
294
|
-
metrics(id: string, query?: AppMetricsQuery, options?: RequestOptions): Promise<SandboxMetrics>;
|
|
353
|
+
metrics(id: string, query?: AppMetricsQuery & RequestOptions, options?: RequestOptions): Promise<SandboxMetrics>;
|
|
295
354
|
/** Replaces where an app may connect out, for its next connection and within a second for its open ones: those the new rules refuse are cut. */
|
|
296
355
|
setNetwork(id: string, input?: NetworkRules, options?: RequestOptions): Promise<SandboxNetwork>;
|
|
297
356
|
/** Copies an app as it is now, memory and disk, into `count` copies of its own, each running on its host. Asked again with the same Idempotency-Key, it returns the same copies. */
|
|
298
357
|
fork(id: string, input?: ForkRequest, options?: RequestOptions): Promise<Forked>;
|
|
299
358
|
/** Keeps an app's memory and disk as they are now, a snapshot to start apps from; with `image`, its disk alone as that image's next version. The app runs on. Asked again with the same Idempotency-Key, it returns the same snapshot. */
|
|
300
359
|
snapshot(id: string, input?: SnapshotRequest, options?: RequestOptions): Promise<Stored>;
|
|
301
|
-
/** Changes its name, labels, idle pause, maxCost, environment or sizes; each field left out stays as it is. A running one holds a changed environment before this answers (a paused one's at its wake): each process it starts after the answer has it, and its running processes keep the one they started with. Its vCPUs, memory and disk grow while it runs, its commands running on
|
|
360
|
+
/** Changes its name, labels, idle pause, maxCost, autoWake, lifetime, delete protection, environment or sizes; each field left out stays as it is. A lifetime (`deleteAfterSeconds`) sent again before its end moves the end to that many seconds from now; 0 takes it off. A lifetime is refused (409 `delete_protected`) while `deleteProtection` is true. A running one holds a changed environment before this answers (a paused one's at its wake): each process it starts after the answer has it, and its running processes keep the one they started with. Its vCPUs, memory and disk grow while it runs, its commands running on. One paused or stopped is not woken for it: judged at once as a live resize is (past the vCPUs it was made with 409, over its organization's limits `quota_exceeded`), its new sizes are returned at once, and its next wake grows it to them before the call that woke it runs. A smaller size, or a machine starting or failed, is refused 409 naming why, and nothing is changed. With If-Match, made only while its revision is that one, else 412. Sent again with the same Idempotency-Key and body while it is the latest change, it returns the current state and changes nothing; the same key with a different body returns 409 idempotency_key_reused. */
|
|
302
361
|
update(id: string, input?: MachineUpdate, options?: RequestOptions): Promise<SandboxInfo>;
|
|
303
362
|
/** Returns what an app's screen shows now, as `image/png` (or `image/jpeg`): its X display `:1`, whole. Refused 409 `display_not_running` when no display runs. A paused app is resumed first. */
|
|
304
|
-
screenshot(id: string, query?: AppScreenshotQuery, options?: RequestOptions): Promise<Uint8Array>;
|
|
363
|
+
screenshot(id: string, query?: AppScreenshotQuery & RequestOptions, options?: RequestOptions): Promise<Uint8Array>;
|
|
305
364
|
/** Moves, clicks, drags and scrolls the mouse and types on the keyboard of an app's screen (its X display `:1`), each step in turn as one command, and returns where the mouse is then. It stops at the first step that fails, refused 409 `act_failed` naming it; refused 409 `display_not_running` when no display runs. A paused app is resumed first. */
|
|
306
365
|
act(id: string, input: ActRequest, options?: RequestOptions): Promise<Acted>;
|
|
307
366
|
/** Runs a cell of Python in an app as a notebook does, in a Jupyter kernel it keeps running for the cell's `context`: variables, imports and functions stay for the next cell. Returns what it printed, its values and displays (text, HTML, images such as charts), and its exception with its traceback. The context's kernel starts on its first cell. A cell past `timeoutSeconds` is interrupted and its context kept. Refused 409 `kernel_not_installed` when the image has no ipykernel. A paused app is resumed first. */
|