sandcovery 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -4
- package/dist/cli/index.mjs +80 -44
- package/dist/cli/sandcovery-docker.mjs +43 -43
- package/dist/cli/sandcovery-kubectl.mjs +3 -3
- package/dist/cli/sandcovery-t3.mjs +71 -14
- package/dist/index.d.mts +382 -23
- package/dist/index.mjs +1 -1
- package/dist/{kubectl-Ck04daor.mjs → kubectl-BFu8MVmy.mjs} +2 -2
- package/dist/{saved-sandboxes-BMjkAVGx.mjs → saved-sandboxes-aG7Z7wiX.mjs} +1 -1
- package/dist/{src-DjOLw-ft.mjs → src-Cba__VPt.mjs} +3174 -2849
- package/dist/{sync-rEFjHNC4.mjs → sync-CZQCyiFK.mjs} +2 -2
- package/dist/{types-DotsDqXt.d.mts → types-DLH1pZHc.d.mts} +14 -2
- package/dist/types.d.mts +2 -2
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import { l as startTool, o as DESTROY_TIMEOUT_MS, s as createdSandbox, w as noop } from "../saved-sandboxes-
|
|
4
|
-
import { r as onPath, t as answers } from "../kubectl-
|
|
2
|
+
import { $t as makeFilter, Co as toArray, Kt as decodeUnknownOption, Pt as Struct, Yt as fromJsonString, bo as none, do as getOrNull, lo as fromUndefinedOr, mo as isNone, no as exists, vo as map, xt as NonEmptyString, yo as match } from "../src-Cba__VPt.mjs";
|
|
3
|
+
import { l as startTool, o as DESTROY_TIMEOUT_MS, s as createdSandbox, w as noop } from "../saved-sandboxes-aG7Z7wiX.mjs";
|
|
4
|
+
import { r as onPath, t as answers } from "../kubectl-BFu8MVmy.mjs";
|
|
5
5
|
import { spawn } from "node:child_process";
|
|
6
6
|
import { once } from "node:events";
|
|
7
7
|
import { parseArgs } from "node:util";
|
|
@@ -21,11 +21,19 @@ Creates a sandbox, installs the same version of T3 Code there as your local t3,
|
|
|
21
21
|
|
|
22
22
|
It reads your key from SANDCOVERY_API_KEY, or from sandcovery login, and the API origin from SANDCOVERY_BASE_URL.
|
|
23
23
|
`;
|
|
24
|
-
const
|
|
24
|
+
const STEP_SECONDS = 20;
|
|
25
|
+
const POLL_SECONDS = 12;
|
|
26
|
+
const INSTALL_WAIT_MS = 6e5;
|
|
27
|
+
const SERVE_WAIT_MS = 12e4;
|
|
25
28
|
const ANSWER_WAIT_MS = 12e4;
|
|
29
|
+
const STDERR_CHARACTERS = 2e3;
|
|
26
30
|
const T3_HOME = "\"$HOME/.t3\"";
|
|
27
31
|
const ON_PATH = "export PATH=\"$HOME/.local/bin:$PATH\"";
|
|
28
|
-
const
|
|
32
|
+
const INSTALL_STATUS = `${T3_HOME}/install.status`;
|
|
33
|
+
const INSTALL_LOG = `${T3_HOME}/install.log`;
|
|
34
|
+
const INSTALL_PID = `${T3_HOME}/install.pid`;
|
|
35
|
+
const INSTALL_RUNNING = `{ p=$(cat ${INSTALL_PID}) s=; kill -0 "$p" 2>/dev/null && { read -r _ _ s _ 2>/dev/null </proc/"$p"/stat; test "$s" != Z; }; }`;
|
|
36
|
+
const INSTALL_SCRIPT = [
|
|
29
37
|
"set -e",
|
|
30
38
|
ON_PATH,
|
|
31
39
|
"curl -fsSL https://t3.codes/install.sh -o /tmp/t3-install.sh",
|
|
@@ -37,12 +45,27 @@ const INSTALL_COMMAND = [
|
|
|
37
45
|
`mkdir -p ${T3_HOME}/userdata`,
|
|
38
46
|
`printf '%s\\n' '{"linkedEnvironmentsEnabled":true}' >${T3_HOME}/userdata/settings.json`
|
|
39
47
|
].join("\n");
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
`
|
|
44
|
-
|
|
48
|
+
const INSTALL_COMMAND = [
|
|
49
|
+
`mkdir -p ${T3_HOME}`,
|
|
50
|
+
`rm -f ${INSTALL_STATUS}`,
|
|
51
|
+
`cat >${T3_HOME}/install.sh <<'T3_INSTALL'`,
|
|
52
|
+
INSTALL_SCRIPT,
|
|
53
|
+
"T3_INSTALL",
|
|
54
|
+
`$(command -v setsid) nohup sh -c 'sh ${T3_HOME}/install.sh >${INSTALL_LOG} 2>&1; echo $? >${T3_HOME}/install.code; mv ${T3_HOME}/install.code ${INSTALL_STATUS}' </dev/null >/dev/null 2>&1 &`,
|
|
55
|
+
`echo $! >${INSTALL_PID}`
|
|
45
56
|
].join("\n");
|
|
57
|
+
const INSTALL_POLL_COMMAND = [
|
|
58
|
+
`for _ in $(seq ${String(POLL_SECONDS)}); do test -s ${INSTALL_STATUS} && break; ${INSTALL_RUNNING} || break; sleep 1; done`,
|
|
59
|
+
`tail -c ${String(STDERR_CHARACTERS)} ${INSTALL_LOG} >&2`,
|
|
60
|
+
`if test -s ${INSTALL_STATUS}; then cat ${INSTALL_STATUS}; elif ${INSTALL_RUNNING}; then :; elif test -s ${INSTALL_STATUS}; then cat ${INSTALL_STATUS}; else echo stopped; fi`
|
|
61
|
+
].join("\n");
|
|
62
|
+
const SERVE_COMMAND = [ON_PATH, `$(command -v setsid) nohup t3 serve --host 0.0.0.0 --port ${String(T3_PORT)} --base-dir ${T3_HOME} --no-browser </dev/null >>${T3_HOME}/serve.log 2>&1 &`].join("\n");
|
|
63
|
+
const SERVED_POLL_COMMAND = [
|
|
64
|
+
`end=$(($(date +%s) + ${String(POLL_SECONDS)}))`,
|
|
65
|
+
`until curl -fsS -m 2 -o /dev/null http://127.0.0.1:${String(T3_PORT)}/.well-known/t3/environment; do test "$(date +%s)" -lt "$end" || { tail -c ${String(STDERR_CHARACTERS)} ${T3_HOME}/serve.log >&2; exit 0; }; sleep 1; done`,
|
|
66
|
+
"echo served"
|
|
67
|
+
].join("\n");
|
|
68
|
+
const PAIR_COMMAND = [ON_PATH, `t3 auth pairing create --base-dir ${T3_HOME} --json --ttl 10m --label sandcovery`].join("\n");
|
|
46
69
|
const decodePairing = decodeUnknownOption(fromJsonString(Struct({ credential: NonEmptyString.check(makeFilter((credential) => !credential.includes("\n"))) })));
|
|
47
70
|
const providerOf = (sandbox) => sandbox.provider ?? "its provider";
|
|
48
71
|
const ranT3 = async ({ args, input, signal, t3 }) => {
|
|
@@ -72,10 +95,27 @@ const ranInSandbox = async ({ command, env, sandbox, step, tool }) => {
|
|
|
72
95
|
command,
|
|
73
96
|
env,
|
|
74
97
|
cwd: null,
|
|
75
|
-
timeout_seconds:
|
|
98
|
+
timeout_seconds: STEP_SECONDS
|
|
76
99
|
}, { signal: tool.signal });
|
|
77
100
|
if (result.exit_code !== 0) throw new Error(`Can't ${VERB}. Couldn't ${step} in sandbox ${sandbox.id} on ${providerOf(sandbox)}, so Sandcovery destroyed it.`, { cause: result.stderr.slice(-2e3) });
|
|
78
|
-
return result
|
|
101
|
+
return result;
|
|
102
|
+
};
|
|
103
|
+
const awaited = async ({ command, deadline, sandbox, step, tool }) => {
|
|
104
|
+
const result = await ranInSandbox({
|
|
105
|
+
env: null,
|
|
106
|
+
command,
|
|
107
|
+
sandbox,
|
|
108
|
+
step,
|
|
109
|
+
tool
|
|
110
|
+
});
|
|
111
|
+
if (result.stdout.trim() !== "" || Date.now() > deadline) return result;
|
|
112
|
+
return await awaited({
|
|
113
|
+
command,
|
|
114
|
+
deadline,
|
|
115
|
+
sandbox,
|
|
116
|
+
step,
|
|
117
|
+
tool
|
|
118
|
+
});
|
|
79
119
|
};
|
|
80
120
|
const linked = async ({ access, env, sandbox, t3, tool, version }) => {
|
|
81
121
|
const preview = await tool.client.sandboxes.portPreview(sandbox.id, T3_PORT, { signal: tool.signal });
|
|
@@ -86,10 +126,19 @@ const linked = async ({ access, env, sandbox, t3, tool, version }) => {
|
|
|
86
126
|
await ranInSandbox({
|
|
87
127
|
command: INSTALL_COMMAND,
|
|
88
128
|
env: { T3CODE_VERSION: version },
|
|
89
|
-
step: `
|
|
129
|
+
step: `start installing T3 Code ${version}`,
|
|
130
|
+
sandbox,
|
|
131
|
+
tool
|
|
132
|
+
});
|
|
133
|
+
const installed = await awaited({
|
|
134
|
+
command: INSTALL_POLL_COMMAND,
|
|
135
|
+
deadline: Date.now() + INSTALL_WAIT_MS,
|
|
136
|
+
step: `check on the T3 Code ${version} install`,
|
|
90
137
|
sandbox,
|
|
91
138
|
tool
|
|
92
139
|
});
|
|
140
|
+
if (installed.stdout.trim() === "") throw new Error(`Can't ${VERB}. T3 Code ${version} didn't finish installing in sandbox ${sandbox.id} on ${providerOf(sandbox)} within 10 minutes, so Sandcovery destroyed it.`, { cause: installed.stderr });
|
|
141
|
+
if (installed.stdout.trim() !== "0") throw new Error(`Can't ${VERB}. Couldn't install T3 Code ${version} in sandbox ${sandbox.id} on ${providerOf(sandbox)}, so Sandcovery destroyed it.`, { cause: installed.stderr });
|
|
93
142
|
await ranInSandbox({
|
|
94
143
|
command: SERVE_COMMAND,
|
|
95
144
|
step: "start T3 Code",
|
|
@@ -97,6 +146,14 @@ const linked = async ({ access, env, sandbox, t3, tool, version }) => {
|
|
|
97
146
|
sandbox,
|
|
98
147
|
tool
|
|
99
148
|
});
|
|
149
|
+
const served = await awaited({
|
|
150
|
+
command: SERVED_POLL_COMMAND,
|
|
151
|
+
deadline: Date.now() + SERVE_WAIT_MS,
|
|
152
|
+
step: "check that T3 Code serves",
|
|
153
|
+
sandbox,
|
|
154
|
+
tool
|
|
155
|
+
});
|
|
156
|
+
if (served.stdout.trim() === "") throw new Error(`Can't ${VERB}. T3 Code ${version} didn't start serving in sandbox ${sandbox.id} on ${providerOf(sandbox)} within 2 minutes, so Sandcovery destroyed it.`, { cause: served.stderr });
|
|
100
157
|
const paired = await ranInSandbox({
|
|
101
158
|
command: PAIR_COMMAND,
|
|
102
159
|
env: null,
|
|
@@ -104,7 +161,7 @@ const linked = async ({ access, env, sandbox, t3, tool, version }) => {
|
|
|
104
161
|
sandbox,
|
|
105
162
|
tool
|
|
106
163
|
});
|
|
107
|
-
const pairing = decodePairing(paired.trim());
|
|
164
|
+
const pairing = decodePairing(paired.stdout.trim());
|
|
108
165
|
if (isNone(pairing)) throw new Error(`Can't ${VERB}. T3 Code in sandbox ${sandbox.id} on ${providerOf(sandbox)} gave no pairing code, so Sandcovery destroyed it.`);
|
|
109
166
|
if (!await answers({
|
|
110
167
|
deadline: Date.now() + ANSWER_WAIT_MS,
|
package/dist/index.d.mts
CHANGED
|
@@ -1,26 +1,4 @@
|
|
|
1
|
-
import { $ as CreateKeyRequest,
|
|
2
|
-
declare const attach: ({ check, credential, options, url }: {
|
|
3
|
-
readonly check: () => Promise<{
|
|
4
|
-
readonly status: string;
|
|
5
|
-
}>;
|
|
6
|
-
readonly credential: string | null;
|
|
7
|
-
readonly options: {
|
|
8
|
-
readonly signal: AbortSignal | null;
|
|
9
|
-
readonly stderr: ((data: Uint8Array) => void) | null;
|
|
10
|
-
readonly stdout: ((data: Uint8Array) => void) | null;
|
|
11
|
-
};
|
|
12
|
-
readonly url: URL;
|
|
13
|
-
}) => {
|
|
14
|
-
endStdin: () => void;
|
|
15
|
-
exit: Promise<{
|
|
16
|
-
readonly code: number;
|
|
17
|
-
readonly signal: string | null;
|
|
18
|
-
}>;
|
|
19
|
-
resize: (cols: number, rows: number) => void;
|
|
20
|
-
sendSignal: (name: string) => void;
|
|
21
|
-
write: (data: Uint8Array) => Promise<void>;
|
|
22
|
-
};
|
|
23
|
-
type AttachOptions = Parameters<typeof attach>[0]['options'];
|
|
1
|
+
import { $ as CreateKeyRequest, Jt as OperatingSystemPick, Wn as SandboxStatus, X as CreateAgentRequest, bt as ExecEvent, cr as SubscriptionCheckoutRequest, et as CreateSandboxRequest, in as ProblemReportRequest, ln as Provider, m as AgentSshRequest, on as ProcessRequest, p as AgentSessionRequest, pr as UpdateKeyRequest, pt as DetachedExecRequest, st as CredentialFields, tt as CreateUsageShareRequest, ut as CreditPurchaseRequest, x as AutoTopUpRequest, xt as ExecRequest, yt as EstimateRequest } from "./types-DLH1pZHc.mjs";
|
|
24
2
|
/**
|
|
25
3
|
* Describes the concurrency level for Effect operations that run multiple
|
|
26
4
|
* effects.
|
|
@@ -4238,6 +4216,85 @@ interface Union<Members extends ReadonlyArray<Constraint>> extends BottomLazy<Un
|
|
|
4238
4216
|
* @since 3.10.0
|
|
4239
4217
|
*/
|
|
4240
4218
|
declare function Union<const Members extends ReadonlyArray<Constraint>>(members: Members, options?: UnionOptions): Union<Members>;
|
|
4219
|
+
/**
|
|
4220
|
+
* Type-level representation returned by {@link decodeTo}.
|
|
4221
|
+
*
|
|
4222
|
+
* @stability stable
|
|
4223
|
+
* @category transforming
|
|
4224
|
+
* @since 4.0.0
|
|
4225
|
+
*/
|
|
4226
|
+
interface decodeTo<To extends Constraint, From extends Constraint, RD = never, RE = never> extends BottomLazy<To["ast"], decodeTo<To, From, RD, RE>, To["~type.parameters"], To["~type.mutability"], To["~type.optionality"], To["~type.constructor.default"], From["~encoded.mutability"], From["~encoded.optionality"]> {
|
|
4227
|
+
readonly "Type": To["Type"];
|
|
4228
|
+
readonly "Encoded": From["Encoded"];
|
|
4229
|
+
readonly "DecodingServices": To["DecodingServices"] | From["DecodingServices"] | RD;
|
|
4230
|
+
readonly "EncodingServices": To["EncodingServices"] | From["EncodingServices"] | RE;
|
|
4231
|
+
readonly "~type.make.in": To["~type.make.in"];
|
|
4232
|
+
readonly "~type.make": To["~type.make"];
|
|
4233
|
+
readonly "Iso": To["Iso"];
|
|
4234
|
+
readonly from: From;
|
|
4235
|
+
readonly to: To;
|
|
4236
|
+
}
|
|
4237
|
+
/**
|
|
4238
|
+
* Type-level representation returned by {@link decodeTo} without a custom transformation.
|
|
4239
|
+
*
|
|
4240
|
+
* @stability stable
|
|
4241
|
+
* @category transforming
|
|
4242
|
+
* @since 3.10.0
|
|
4243
|
+
*/
|
|
4244
|
+
interface compose<To extends Constraint, From extends Constraint> extends decodeTo<To, From> {}
|
|
4245
|
+
/**
|
|
4246
|
+
* Creates a schema that transforms from a source schema to a target schema.
|
|
4247
|
+
*
|
|
4248
|
+
* **When to use**
|
|
4249
|
+
*
|
|
4250
|
+
* Use when decoding should change the schema's decoded type or encoded shape,
|
|
4251
|
+
* with an optional custom bidirectional transformation.
|
|
4252
|
+
*
|
|
4253
|
+
* **Details**
|
|
4254
|
+
*
|
|
4255
|
+
* Call it with the target schema `to` and then pipe the source schema `from`
|
|
4256
|
+
* into the returned function. The resulting schema decodes from
|
|
4257
|
+
* `From["Encoded"]` to `To["Type"]` and encodes from `To["Type"]` back to
|
|
4258
|
+
* `From["Encoded"]`.
|
|
4259
|
+
*
|
|
4260
|
+
* When no transformation is provided, `SchemaTransformation.passthrough()` is
|
|
4261
|
+
* used, so `From["Type"]` must already be compatible with `To["Encoded"]`.
|
|
4262
|
+
* The resulting schema combines decoding and encoding services from both
|
|
4263
|
+
* schemas and any custom transformation.
|
|
4264
|
+
*
|
|
4265
|
+
* **Gotchas**
|
|
4266
|
+
*
|
|
4267
|
+
* In a custom transformation, `decode` maps `From["Type"]` to `To["Encoded"]`
|
|
4268
|
+
* and is used on the decoding path, while `encode` maps `To["Encoded"]` to
|
|
4269
|
+
* `From["Type"]` and is used on the encoding path.
|
|
4270
|
+
*
|
|
4271
|
+
* **Example** (Transforming strings to numbers with a schema transformation)
|
|
4272
|
+
*
|
|
4273
|
+
* ```ts import.meta.vitest
|
|
4274
|
+
* import { Schema, SchemaGetter } from "effect"
|
|
4275
|
+
*
|
|
4276
|
+
* const NumberFromString = Schema.String.pipe(
|
|
4277
|
+
* Schema.decodeTo(
|
|
4278
|
+
* Schema.Number,
|
|
4279
|
+
* {
|
|
4280
|
+
* decode: SchemaGetter.transform((s) => Number(s)),
|
|
4281
|
+
* encode: SchemaGetter.transform((n) => String(n))
|
|
4282
|
+
* }
|
|
4283
|
+
* )
|
|
4284
|
+
* )
|
|
4285
|
+
*
|
|
4286
|
+
* Schema.decodeUnknownSync(NumberFromString)("123") // => 123
|
|
4287
|
+
* ```
|
|
4288
|
+
*
|
|
4289
|
+
* @stability stable
|
|
4290
|
+
* @category transforming
|
|
4291
|
+
* @since 4.0.0
|
|
4292
|
+
*/
|
|
4293
|
+
declare function decodeTo<To extends Constraint>(to: To): <From extends Constraint>(from: From) => compose<To, From>;
|
|
4294
|
+
declare function decodeTo<To extends Constraint, From extends Constraint, RD = never, RE = never>(to: To, transformation: {
|
|
4295
|
+
readonly decode: Getter<NoInfer<To["Encoded"]>, NoInfer<From["Type"]>, RD>;
|
|
4296
|
+
readonly encode: Getter<NoInfer<From["Type"]>, NoInfer<To["Encoded"]>, RE>;
|
|
4297
|
+
}): (from: From) => decodeTo<To, From, RD, RE>;
|
|
4241
4298
|
/**
|
|
4242
4299
|
* Type-level representation returned by {@link instanceOf}.
|
|
4243
4300
|
*
|
|
@@ -4286,6 +4343,51 @@ interface Finite extends Number {
|
|
|
4286
4343
|
* @since 3.10.0
|
|
4287
4344
|
*/
|
|
4288
4345
|
declare const Finite: Finite;
|
|
4346
|
+
/**
|
|
4347
|
+
* Type-level representation of {@link Int}.
|
|
4348
|
+
*
|
|
4349
|
+
* @stability stable
|
|
4350
|
+
* @category models
|
|
4351
|
+
* @since 3.10.0
|
|
4352
|
+
*/
|
|
4353
|
+
interface Int extends Number {
|
|
4354
|
+
readonly "Rebuild": Int;
|
|
4355
|
+
}
|
|
4356
|
+
/**
|
|
4357
|
+
* Schema for integers, rejecting `NaN`, `Infinity`, and `-Infinity`.
|
|
4358
|
+
*
|
|
4359
|
+
* @stability stable
|
|
4360
|
+
* @category schemas
|
|
4361
|
+
* @since 3.10.0
|
|
4362
|
+
*/
|
|
4363
|
+
declare const Int: Int;
|
|
4364
|
+
/**
|
|
4365
|
+
* Type-level representation of {@link FiniteFromString}.
|
|
4366
|
+
*
|
|
4367
|
+
* @stability stable
|
|
4368
|
+
* @category models
|
|
4369
|
+
* @since 4.0.0
|
|
4370
|
+
*/
|
|
4371
|
+
interface FiniteFromString extends decodeTo<Finite, String> {
|
|
4372
|
+
readonly "Rebuild": FiniteFromString;
|
|
4373
|
+
}
|
|
4374
|
+
/**
|
|
4375
|
+
* Schema that parses a string into a finite number.
|
|
4376
|
+
*
|
|
4377
|
+
* **Details**
|
|
4378
|
+
*
|
|
4379
|
+
* Decoding:
|
|
4380
|
+
* - A `string` is decoded as a finite number, rejecting `NaN`, `Infinity`, and
|
|
4381
|
+
* `-Infinity` values.
|
|
4382
|
+
*
|
|
4383
|
+
* Encoding:
|
|
4384
|
+
* - A finite number is encoded as a `string`, preserving negative zero as `"-0"`.
|
|
4385
|
+
*
|
|
4386
|
+
* @stability stable
|
|
4387
|
+
* @category schemas
|
|
4388
|
+
* @since 4.0.0
|
|
4389
|
+
*/
|
|
4390
|
+
declare const FiniteFromString: FiniteFromString;
|
|
4289
4391
|
/**
|
|
4290
4392
|
* Schema for property keys accepted by Effect schemas: finite `number`,
|
|
4291
4393
|
* `symbol`, or `string`.
|
|
@@ -5284,6 +5386,31 @@ type errorReported = "~effect/Runtime/errorReported";
|
|
|
5284
5386
|
* @since 4.0.0
|
|
5285
5387
|
*/
|
|
5286
5388
|
declare const errorReported: errorReported;
|
|
5389
|
+
declare const AgentLogQuery: Struct<{
|
|
5390
|
+
readonly lines: optionalKey<decodeTo<Int, FiniteFromString, never, never>>;
|
|
5391
|
+
}>;
|
|
5392
|
+
declare const attach: ({ check, credential, options, url }: {
|
|
5393
|
+
readonly check: () => Promise<{
|
|
5394
|
+
readonly status: string;
|
|
5395
|
+
}>;
|
|
5396
|
+
readonly credential: string | null;
|
|
5397
|
+
readonly options: {
|
|
5398
|
+
readonly signal: AbortSignal | null;
|
|
5399
|
+
readonly stderr: ((data: Uint8Array) => void) | null;
|
|
5400
|
+
readonly stdout: ((data: Uint8Array) => void) | null;
|
|
5401
|
+
};
|
|
5402
|
+
readonly url: URL;
|
|
5403
|
+
}) => {
|
|
5404
|
+
endStdin: () => void;
|
|
5405
|
+
exit: Promise<{
|
|
5406
|
+
readonly code: number;
|
|
5407
|
+
readonly signal: string | null;
|
|
5408
|
+
}>;
|
|
5409
|
+
resize: (cols: number, rows: number) => void;
|
|
5410
|
+
sendSignal: (name: string) => void;
|
|
5411
|
+
write: (data: Uint8Array) => Promise<void>;
|
|
5412
|
+
};
|
|
5413
|
+
type AttachOptions = Parameters<typeof attach>[0]['options'];
|
|
5287
5414
|
declare const SandcoveryOptionsSchema: Struct<{
|
|
5288
5415
|
readonly apiKey: optionalKey<String>;
|
|
5289
5416
|
readonly baseUrl: optionalKey<Union<readonly [String, instanceOf<URL>]>>;
|
|
@@ -5336,6 +5463,7 @@ type MonthlyCostQuery = typeof MonthlyCostQuerySchema.Type;
|
|
|
5336
5463
|
type UsageKeyQueryOptions = typeof UsageKeyQuerySchema.Type;
|
|
5337
5464
|
type UsageQueryOptions = typeof UsageQuerySchema.Type;
|
|
5338
5465
|
type OperatingSystemQuery = typeof OperatingSystemQuerySchema.Type;
|
|
5466
|
+
type AgentLogQueryOptions = typeof AgentLogQuery.Type;
|
|
5339
5467
|
export declare class Sandcovery {
|
|
5340
5468
|
#private;
|
|
5341
5469
|
readonly activity: {
|
|
@@ -5362,6 +5490,218 @@ export declare class Sandcovery {
|
|
|
5362
5490
|
readonly next_cursor: string | null;
|
|
5363
5491
|
}>;
|
|
5364
5492
|
};
|
|
5493
|
+
readonly agents: {
|
|
5494
|
+
create: (request: CreateAgentRequest, options?: RequestOptions) => Promise<{
|
|
5495
|
+
readonly created_at: string;
|
|
5496
|
+
readonly id: `agent_${string}`;
|
|
5497
|
+
readonly last_error: string | null;
|
|
5498
|
+
readonly preset: string;
|
|
5499
|
+
readonly renewed_at: string | null;
|
|
5500
|
+
readonly routing: {
|
|
5501
|
+
readonly disk_mib: number | null;
|
|
5502
|
+
readonly provider: {
|
|
5503
|
+
readonly allow_fallbacks: boolean | null;
|
|
5504
|
+
readonly ignore: readonly string[] | null;
|
|
5505
|
+
readonly only: readonly string[] | null;
|
|
5506
|
+
readonly order: readonly string[] | null;
|
|
5507
|
+
readonly sort: "latency" | "price" | "uptime" | null;
|
|
5508
|
+
} | null;
|
|
5509
|
+
readonly region: string | null;
|
|
5510
|
+
readonly slug: string | null;
|
|
5511
|
+
readonly slugs: readonly string[] | null;
|
|
5512
|
+
};
|
|
5513
|
+
readonly sandbox_expires_at: string | null;
|
|
5514
|
+
readonly sandbox_id: `sbx_${string}` | null;
|
|
5515
|
+
readonly status: "failed" | "renewing" | "running" | "setup" | "starting" | "stopped";
|
|
5516
|
+
readonly updated_at: string;
|
|
5517
|
+
}>;
|
|
5518
|
+
delete: (agentId: string, options?: RequestOptions) => Promise<void>;
|
|
5519
|
+
get: (agentId: string, options?: RequestOptions) => Promise<{
|
|
5520
|
+
readonly created_at: string;
|
|
5521
|
+
readonly id: `agent_${string}`;
|
|
5522
|
+
readonly last_error: string | null;
|
|
5523
|
+
readonly preset: string;
|
|
5524
|
+
readonly renewed_at: string | null;
|
|
5525
|
+
readonly routing: {
|
|
5526
|
+
readonly disk_mib: number | null;
|
|
5527
|
+
readonly provider: {
|
|
5528
|
+
readonly allow_fallbacks: boolean | null;
|
|
5529
|
+
readonly ignore: readonly string[] | null;
|
|
5530
|
+
readonly only: readonly string[] | null;
|
|
5531
|
+
readonly order: readonly string[] | null;
|
|
5532
|
+
readonly sort: "latency" | "price" | "uptime" | null;
|
|
5533
|
+
} | null;
|
|
5534
|
+
readonly region: string | null;
|
|
5535
|
+
readonly slug: string | null;
|
|
5536
|
+
readonly slugs: readonly string[] | null;
|
|
5537
|
+
};
|
|
5538
|
+
readonly sandbox_expires_at: string | null;
|
|
5539
|
+
readonly sandbox_id: `sbx_${string}` | null;
|
|
5540
|
+
readonly status: "failed" | "renewing" | "running" | "setup" | "starting" | "stopped";
|
|
5541
|
+
readonly updated_at: string;
|
|
5542
|
+
}>;
|
|
5543
|
+
list: (options?: RequestOptions) => Promise<{
|
|
5544
|
+
readonly data: readonly {
|
|
5545
|
+
readonly created_at: string;
|
|
5546
|
+
readonly id: `agent_${string}`;
|
|
5547
|
+
readonly last_error: string | null;
|
|
5548
|
+
readonly preset: string;
|
|
5549
|
+
readonly renewed_at: string | null;
|
|
5550
|
+
readonly routing: {
|
|
5551
|
+
readonly disk_mib: number | null;
|
|
5552
|
+
readonly provider: {
|
|
5553
|
+
readonly allow_fallbacks: boolean | null;
|
|
5554
|
+
readonly ignore: readonly string[] | null;
|
|
5555
|
+
readonly only: readonly string[] | null;
|
|
5556
|
+
readonly order: readonly string[] | null;
|
|
5557
|
+
readonly sort: "latency" | "price" | "uptime" | null;
|
|
5558
|
+
} | null;
|
|
5559
|
+
readonly region: string | null;
|
|
5560
|
+
readonly slug: string | null;
|
|
5561
|
+
readonly slugs: readonly string[] | null;
|
|
5562
|
+
};
|
|
5563
|
+
readonly sandbox_expires_at: string | null;
|
|
5564
|
+
readonly sandbox_id: `sbx_${string}` | null;
|
|
5565
|
+
readonly status: "failed" | "renewing" | "running" | "setup" | "starting" | "stopped";
|
|
5566
|
+
readonly updated_at: string;
|
|
5567
|
+
}[];
|
|
5568
|
+
}>;
|
|
5569
|
+
logs: (agentId: string, query?: AgentLogQueryOptions, options?: RequestOptions) => Promise<{
|
|
5570
|
+
readonly log: string;
|
|
5571
|
+
readonly sandbox_id: `sbx_${string}`;
|
|
5572
|
+
}>;
|
|
5573
|
+
presets: (options?: RequestOptions) => Promise<{
|
|
5574
|
+
readonly data: readonly {
|
|
5575
|
+
readonly icon: string;
|
|
5576
|
+
readonly id: string;
|
|
5577
|
+
readonly license: string;
|
|
5578
|
+
readonly memory_mib: number;
|
|
5579
|
+
readonly name: string;
|
|
5580
|
+
readonly repository: string;
|
|
5581
|
+
readonly setup: {
|
|
5582
|
+
readonly guide: string;
|
|
5583
|
+
readonly terminal: string | null;
|
|
5584
|
+
};
|
|
5585
|
+
readonly subtitle: string;
|
|
5586
|
+
readonly summary: string;
|
|
5587
|
+
readonly version: string;
|
|
5588
|
+
readonly web: {
|
|
5589
|
+
readonly path: string;
|
|
5590
|
+
readonly port: number;
|
|
5591
|
+
readonly setup: boolean;
|
|
5592
|
+
} | null;
|
|
5593
|
+
}[];
|
|
5594
|
+
}>;
|
|
5595
|
+
restart: (agentId: string, options?: RequestOptions) => Promise<{
|
|
5596
|
+
readonly created_at: string;
|
|
5597
|
+
readonly id: `agent_${string}`;
|
|
5598
|
+
readonly last_error: string | null;
|
|
5599
|
+
readonly preset: string;
|
|
5600
|
+
readonly renewed_at: string | null;
|
|
5601
|
+
readonly routing: {
|
|
5602
|
+
readonly disk_mib: number | null;
|
|
5603
|
+
readonly provider: {
|
|
5604
|
+
readonly allow_fallbacks: boolean | null;
|
|
5605
|
+
readonly ignore: readonly string[] | null;
|
|
5606
|
+
readonly only: readonly string[] | null;
|
|
5607
|
+
readonly order: readonly string[] | null;
|
|
5608
|
+
readonly sort: "latency" | "price" | "uptime" | null;
|
|
5609
|
+
} | null;
|
|
5610
|
+
readonly region: string | null;
|
|
5611
|
+
readonly slug: string | null;
|
|
5612
|
+
readonly slugs: readonly string[] | null;
|
|
5613
|
+
};
|
|
5614
|
+
readonly sandbox_expires_at: string | null;
|
|
5615
|
+
readonly sandbox_id: `sbx_${string}` | null;
|
|
5616
|
+
readonly status: "failed" | "renewing" | "running" | "setup" | "starting" | "stopped";
|
|
5617
|
+
readonly updated_at: string;
|
|
5618
|
+
}>;
|
|
5619
|
+
session: (agentId: string, request: AgentSessionRequest, options?: RequestOptions) => Promise<{
|
|
5620
|
+
readonly command: string;
|
|
5621
|
+
readonly created_at: string;
|
|
5622
|
+
readonly exit_code: number | null;
|
|
5623
|
+
readonly exited_at: string | null;
|
|
5624
|
+
readonly id: `proc_${string}`;
|
|
5625
|
+
readonly sandbox_id: `sbx_${string}`;
|
|
5626
|
+
readonly signal: string | null;
|
|
5627
|
+
readonly status: "exited" | "lost" | "running";
|
|
5628
|
+
readonly terminal: {
|
|
5629
|
+
readonly cols: number;
|
|
5630
|
+
readonly rows: number;
|
|
5631
|
+
readonly stderr: boolean;
|
|
5632
|
+
readonly stdin: boolean;
|
|
5633
|
+
readonly stdout: boolean;
|
|
5634
|
+
} | null;
|
|
5635
|
+
}>;
|
|
5636
|
+
ssh: (agentId: string, request: AgentSshRequest, options?: RequestOptions) => Promise<{
|
|
5637
|
+
readonly command: string;
|
|
5638
|
+
readonly created_at: string;
|
|
5639
|
+
readonly exit_code: number | null;
|
|
5640
|
+
readonly exited_at: string | null;
|
|
5641
|
+
readonly id: `proc_${string}`;
|
|
5642
|
+
readonly sandbox_id: `sbx_${string}`;
|
|
5643
|
+
readonly signal: string | null;
|
|
5644
|
+
readonly status: "exited" | "lost" | "running";
|
|
5645
|
+
readonly terminal: {
|
|
5646
|
+
readonly cols: number;
|
|
5647
|
+
readonly rows: number;
|
|
5648
|
+
readonly stderr: boolean;
|
|
5649
|
+
readonly stdin: boolean;
|
|
5650
|
+
readonly stdout: boolean;
|
|
5651
|
+
} | null;
|
|
5652
|
+
}>;
|
|
5653
|
+
start: (agentId: string, options?: RequestOptions) => Promise<{
|
|
5654
|
+
readonly created_at: string;
|
|
5655
|
+
readonly id: `agent_${string}`;
|
|
5656
|
+
readonly last_error: string | null;
|
|
5657
|
+
readonly preset: string;
|
|
5658
|
+
readonly renewed_at: string | null;
|
|
5659
|
+
readonly routing: {
|
|
5660
|
+
readonly disk_mib: number | null;
|
|
5661
|
+
readonly provider: {
|
|
5662
|
+
readonly allow_fallbacks: boolean | null;
|
|
5663
|
+
readonly ignore: readonly string[] | null;
|
|
5664
|
+
readonly only: readonly string[] | null;
|
|
5665
|
+
readonly order: readonly string[] | null;
|
|
5666
|
+
readonly sort: "latency" | "price" | "uptime" | null;
|
|
5667
|
+
} | null;
|
|
5668
|
+
readonly region: string | null;
|
|
5669
|
+
readonly slug: string | null;
|
|
5670
|
+
readonly slugs: readonly string[] | null;
|
|
5671
|
+
};
|
|
5672
|
+
readonly sandbox_expires_at: string | null;
|
|
5673
|
+
readonly sandbox_id: `sbx_${string}` | null;
|
|
5674
|
+
readonly status: "failed" | "renewing" | "running" | "setup" | "starting" | "stopped";
|
|
5675
|
+
readonly updated_at: string;
|
|
5676
|
+
}>;
|
|
5677
|
+
stop: (agentId: string, options?: RequestOptions) => Promise<{
|
|
5678
|
+
readonly created_at: string;
|
|
5679
|
+
readonly id: `agent_${string}`;
|
|
5680
|
+
readonly last_error: string | null;
|
|
5681
|
+
readonly preset: string;
|
|
5682
|
+
readonly renewed_at: string | null;
|
|
5683
|
+
readonly routing: {
|
|
5684
|
+
readonly disk_mib: number | null;
|
|
5685
|
+
readonly provider: {
|
|
5686
|
+
readonly allow_fallbacks: boolean | null;
|
|
5687
|
+
readonly ignore: readonly string[] | null;
|
|
5688
|
+
readonly only: readonly string[] | null;
|
|
5689
|
+
readonly order: readonly string[] | null;
|
|
5690
|
+
readonly sort: "latency" | "price" | "uptime" | null;
|
|
5691
|
+
} | null;
|
|
5692
|
+
readonly region: string | null;
|
|
5693
|
+
readonly slug: string | null;
|
|
5694
|
+
readonly slugs: readonly string[] | null;
|
|
5695
|
+
};
|
|
5696
|
+
readonly sandbox_expires_at: string | null;
|
|
5697
|
+
readonly sandbox_id: `sbx_${string}` | null;
|
|
5698
|
+
readonly status: "failed" | "renewing" | "running" | "setup" | "starting" | "stopped";
|
|
5699
|
+
readonly updated_at: string;
|
|
5700
|
+
}>;
|
|
5701
|
+
web: (agentId: string, options?: RequestOptions) => Promise<{
|
|
5702
|
+
readonly url: string;
|
|
5703
|
+
}>;
|
|
5704
|
+
};
|
|
5365
5705
|
readonly billing: {
|
|
5366
5706
|
buyCredits: (request: CreditPurchaseRequest, options?: RequestOptions) => Promise<{
|
|
5367
5707
|
readonly url: string;
|
|
@@ -6556,6 +6896,7 @@ export declare class Sandcovery {
|
|
|
6556
6896
|
readonly custom_image: boolean;
|
|
6557
6897
|
readonly detached_exec: boolean;
|
|
6558
6898
|
readonly egress_modes: readonly string[];
|
|
6899
|
+
readonly files: boolean;
|
|
6559
6900
|
readonly gpu_types: readonly string[];
|
|
6560
6901
|
readonly idle_timeout: boolean;
|
|
6561
6902
|
readonly max_disk_mib: number | null;
|
|
@@ -6573,6 +6914,7 @@ export declare class Sandcovery {
|
|
|
6573
6914
|
readonly hourly_micro_usd: number;
|
|
6574
6915
|
readonly type: string;
|
|
6575
6916
|
}[];
|
|
6917
|
+
readonly home_directory: string;
|
|
6576
6918
|
readonly home_url: string;
|
|
6577
6919
|
readonly incidents: {
|
|
6578
6920
|
readonly data: readonly {
|
|
@@ -6696,6 +7038,7 @@ export declare class Sandcovery {
|
|
|
6696
7038
|
readonly custom_image: boolean;
|
|
6697
7039
|
readonly detached_exec: boolean;
|
|
6698
7040
|
readonly egress_modes: readonly string[];
|
|
7041
|
+
readonly files: boolean;
|
|
6699
7042
|
readonly gpu_types: readonly string[];
|
|
6700
7043
|
readonly idle_timeout: boolean;
|
|
6701
7044
|
readonly max_disk_mib: number | null;
|
|
@@ -6713,6 +7056,7 @@ export declare class Sandcovery {
|
|
|
6713
7056
|
readonly hourly_micro_usd: number;
|
|
6714
7057
|
readonly type: string;
|
|
6715
7058
|
}[];
|
|
7059
|
+
readonly home_directory: string;
|
|
6716
7060
|
readonly home_url: string;
|
|
6717
7061
|
readonly incidents: {
|
|
6718
7062
|
readonly data: readonly {
|
|
@@ -7949,6 +8293,21 @@ export declare class Sandcovery {
|
|
|
7949
8293
|
readonly sandbox_id: `sbx_${string}`;
|
|
7950
8294
|
}[];
|
|
7951
8295
|
}>;
|
|
8296
|
+
listUsableKeys: (options?: RequestOptions) => Promise<{
|
|
8297
|
+
readonly create_without_key: boolean;
|
|
8298
|
+
readonly data: readonly {
|
|
8299
|
+
readonly allowed_providers: readonly string[] | null;
|
|
8300
|
+
readonly max_concurrent_sandboxes: number | null;
|
|
8301
|
+
readonly max_ttl_seconds: number | null;
|
|
8302
|
+
readonly spend_limit: {
|
|
8303
|
+
readonly limit_micro_usd: number;
|
|
8304
|
+
readonly period: "day" | "month" | "total" | "week";
|
|
8305
|
+
} | null;
|
|
8306
|
+
readonly expires_at: string | null;
|
|
8307
|
+
readonly id: string;
|
|
8308
|
+
readonly name: string;
|
|
8309
|
+
}[];
|
|
8310
|
+
}>;
|
|
7952
8311
|
pause: (sandboxId: string, options?: RequestOptions) => Promise<{
|
|
7953
8312
|
readonly api_key_id: string | null;
|
|
7954
8313
|
readonly attempts: readonly {
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as Sandcovery } from "./src-
|
|
1
|
+
export { t as Sandcovery } from "./src-Cba__VPt.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as SandboxId,
|
|
2
|
-
import { C as clamp, _ as servedOrSpawned, b as KUBERNETES_GATEWAY_COMMAND, f as writePrivateFile, g as servedAt, h as isTerminal, i as launchedRelay, m as READY, n as savedSandboxes, o as DESTROY_TIMEOUT_MS, s as createdSandbox, t as runningSandbox, u as stopSignalOf, v as socketOf, w as noop, x as KUBERNETES_PORT, y as KUBERNETES_COMMAND } from "./saved-sandboxes-
|
|
1
|
+
import { C as SandboxId, Co as toArray, Ct as Number$1, Kt as decodeUnknownOption, Nt as String, Pt as Struct, So as some, Va as isSuccess, Wa as try_, Yt as fromJsonString, at as increment, bo as none, ct as update, do as getOrNull, ho as isSome, lo as fromUndefinedOr, mo as isNone, no as exists, nt as get, ot as make, qt as decodeUnknownSync, ro as filter, so as fromNullOr, st as set, t as Sandcovery, tt as decrement, uo as getOrElse, vo as map, yo as match } from "./src-Cba__VPt.mjs";
|
|
2
|
+
import { C as clamp, _ as servedOrSpawned, b as KUBERNETES_GATEWAY_COMMAND, f as writePrivateFile, g as servedAt, h as isTerminal, i as launchedRelay, m as READY, n as savedSandboxes, o as DESTROY_TIMEOUT_MS, s as createdSandbox, t as runningSandbox, u as stopSignalOf, v as socketOf, w as noop, x as KUBERNETES_PORT, y as KUBERNETES_COMMAND } from "./saved-sandboxes-aG7Z7wiX.mjs";
|
|
3
3
|
import os from "node:os";
|
|
4
4
|
import { spawn } from "node:child_process";
|
|
5
5
|
import net from "node:net";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { At as Record, Bt as Union, Kt as decodeUnknownOption, Nt as String$1, Pt as Struct, S as KeySecret, So as some, Xt as is, Yt as fromJsonString, _o as liftThrowable, ao as flatMap, bo as none, bt as Literals, ct as update, d as Conflict, ho as isSome, l as NotFound, lo as fromUndefinedOr, m as Forbidden, mo as isNone, nt as get, ot as make, p as Unauthorized, po as getOrUndefined, ro as filter, s as Unsupported, t as Sandcovery, uo as getOrElse, vo as map, xo as orElse, yo as match, yt as Literal } from "./src-Cba__VPt.mjs";
|
|
2
2
|
import http from "node:http";
|
|
3
3
|
import os from "node:os";
|
|
4
4
|
import { spawn } from "node:child_process";
|