@veris-ai/daytona 0.3.0 → 0.4.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.
@@ -1,100 +0,0 @@
1
- export interface ProvisionOptions {
2
- /** The twin to attach to. Required: a provisioned box is only useful pointed
3
- * at a twin the caller already made. */
4
- sandbox: string;
5
- /** Daytona image or snapshot to create the sandbox from. Unset: Daytona's default. */
6
- image?: string;
7
- snapshot?: string;
8
- /** KEY=VALUE pairs set as sandbox environment variables. */
9
- env: Record<string, string>;
10
- }
11
- /**
12
- * Idle minutes before Daytona stops the sandbox.
13
- *
14
- * Nothing deletes a provisioned box for the caller, so these two intervals are
15
- * the only thing standing between an abandoned box and a bill. Daytona's own
16
- * default is 15 minutes of no API activity; 30 is deliberately more generous,
17
- * because a caller here is installing dependencies and running a suite between
18
- * our calls and a box stopped underneath them is worse than half an hour of
19
- * idle compute.
20
- */
21
- export declare const AUTO_STOP_MINUTES = 30;
22
- /**
23
- * Minutes after the sandbox stops before Daytona deletes it.
24
- *
25
- * Daytona disables auto-delete by default, so a stopped box keeps its disk (and
26
- * its cost) forever. An hour is long enough to come back and look at a box that
27
- * stopped while you were at lunch, short enough that forgetting one is cheap.
28
- */
29
- export declare const AUTO_DELETE_MINUTES = 60;
30
- /**
31
- * Wall-clock life of a provisioned sandbox, in minutes.
32
- *
33
- * The hard backstop under the two intervals above: it destroys the box whatever
34
- * state it is in. Four hours fits a long install and a long suite with room to
35
- * spare, and bounds a box that was never torn down. It does NOT move the twin's
36
- * TTL — provision always attaches, and the twin's life was decided when whoever
37
- * created it said so.
38
- */
39
- export declare const PROVISION_TTL_MINUTES = 240;
40
- /** What `provision` prints on stdout. One object, nothing else there. */
41
- export interface ProvisionResult {
42
- /** The Daytona sandbox id — what `veris-daytona teardown` takes. */
43
- daytonaSandboxId: string;
44
- /** The Veris twin's id. NOT the Daytona one; the receipt is read from this. */
45
- verisSandboxId: string;
46
- /** The Veris environment the twin belongs to. */
47
- verisEnvironmentId: string;
48
- /** Whether deleting the sandbox also deletes the twin. Always false here:
49
- * provision attaches to a twin the caller made, so the caller keeps it. */
50
- ownsTwin: boolean;
51
- /** An empty directory in the sandbox to put code in and run commands from. */
52
- workDir: string;
53
- /** The CA bundle inside the sandbox: the public roots plus the Veris CA. */
54
- caBundlePath: string;
55
- /** The CA trust variables. Export these on EVERY command — Daytona overwrites
56
- * the well-known ones inside the sandbox with its own CA file, which cannot
57
- * verify the gateway's certificates. */
58
- trustEnv: Record<string, string>;
59
- /** The same variables as one line of shell `export`s, to prefix a command
60
- * with when you have no env map to fill. */
61
- trustPrelude: string;
62
- /** Run this INSIDE the sandbox after installing dependencies, to append the
63
- * Veris CA to the CA bundles SDKs ship with them. */
64
- patchBundledCasCommand: string;
65
- /** How to get code into the box. Daytona's own CLI has no upload, copy or
66
- * sync command and its `ssh` takes no remote command, so a caller who does
67
- * not know this verb exists has no route in short of writing an SDK script. */
68
- pushCommand: string;
69
- /** How to run one command in the box with trustEnv already exported and its
70
- * output streaming. `daytona exec` can set no variables at all. */
71
- execCommand: string;
72
- /** The twin's service names — what `--require-service` would name. */
73
- services: string[];
74
- /** When Daytona destroys the sandbox regardless of state. */
75
- expiresAt: string;
76
- /** Idle minutes before Daytona stops the sandbox. */
77
- autoStopMinutes: number;
78
- /** Minutes after stopping before Daytona deletes it. */
79
- autoDeleteMinutes: number;
80
- }
81
- export declare const PROVISION_USAGE = "usage: veris-daytona provision --sandbox <twin-id> [options]\n\nCreates a Daytona sandbox whose vendor API calls are answered by an existing\nVeris twin, and stops there: nothing is uploaded, nothing is run, nothing is\ndeleted. One JSON object is printed on stdout; progress goes to stderr.\n\n --sandbox <twin-id> the Veris twin to attach to (required)\n --image <name> Daytona image to run in (default: Daytona's default snapshot)\n --snapshot <name> Daytona snapshot to run in\n --env KEY=VALUE set as a sandbox environment variable (repeatable)\n\nneeds: DAYTONA_API_KEY, and a Veris key: VERIS_API_KEY, or the profile\n`veris login` saved in ~/.veris/twin.yaml (VERIS_PROFILE picks one; the\nenvironment variable wins when both exist). No VERIS_ENVIRONMENT_ID \u2014 the\nenvironment comes from the twin. A Daytona key without delete:sandboxes still\nprovisions, with a warning that teardown will be refused.\n\nthe JSON on stdout:\n daytonaSandboxId the Daytona sandbox id; `veris-daytona teardown` takes it\n verisSandboxId the Veris twin's id \u2014 NOT the Daytona one\n verisEnvironmentId the environment the twin belongs to\n ownsTwin false: the twin is yours, and teardown leaves it alone\n workDir an empty directory to put code in and run commands from\n caBundlePath the CA bundle inside the sandbox (public roots + the Veris CA)\n trustEnv the CA variables, as a map \u2014 export them on EVERY command\n trustPrelude the same variables as one line of shell `export`s\n patchBundledCasCommand run it inside the sandbox after installing dependencies\n pushCommand how to get code in \u2014 the Daytona CLI cannot upload\n execCommand how to run one command in there, trustEnv already applied\n services the twin's service names\n expiresAt when Daytona destroys the sandbox whatever state it is in\n autoStopMinutes idle minutes before Daytona stops it\n autoDeleteMinutes minutes after stopping before Daytona deletes it\n\nGetting code in: the Daytona CLI has no upload, copy or sync command, its `ssh`\ntakes no remote command, and `--context` is a build context on `create` only \u2014\nso `veris-daytona push <daytonaSandboxId>` is the route. It tars the current\ndirectory into workDir. `veris-daytona exec <daytonaSandboxId> -- <command>`\nthen runs a command in there with trustEnv already exported and its output\nstreaming, neither of which `daytona exec` can do.\n\nData-plane variables (DATABASE_URL and the like) are already set inside the\nsandbox, so a command run in there inherits them.\n\nThe sandbox stops after 30 idle minutes, is deleted 60 minutes after\nit stops, and is destroyed at 240 minutes old whatever state it is in \u2014 nothing\nhere deletes it for you. The twin's own TTL is whatever created it.\n\nexit code: 0 when the sandbox is up and the canary answered; 2 otherwise.";
82
- /** Parse everything after `provision`. Pure; throws UsageError with a human message. */
83
- export declare function parseProvisionArgs(argv: readonly string[]): ProvisionOptions;
84
- /**
85
- * The JSON object, from the handful of facts only a live create() knows.
86
- *
87
- * Everything else in it is derived here rather than in cli.ts, so the shape a
88
- * caller parses is decided in one pure place and tested without an account.
89
- */
90
- export declare function provisionResult(facts: {
91
- daytonaSandboxId: string;
92
- verisSandboxId: string;
93
- verisEnvironmentId: string;
94
- workDir: string;
95
- trustEnv: Record<string, string>;
96
- services: string[];
97
- expiresAt: string;
98
- }): ProvisionResult;
99
- /** The one line of stdout. Indented, because a human reads this too. */
100
- export declare function provisionJson(result: ProvisionResult): string;
package/dist/push.d.ts DELETED
@@ -1,11 +0,0 @@
1
- export interface PushOptions {
2
- /** The Daytona sandbox id — `provision`'s daytonaSandboxId. Not the twin's. */
3
- sandboxId: string;
4
- /** Git URL to clone into the sandbox. Unset: the current directory is uploaded. */
5
- repo?: string;
6
- /** Branch to clone. Only meaningful with --repo. */
7
- ref?: string;
8
- }
9
- export declare const PUSH_USAGE: string;
10
- /** Parse everything after `push`. Pure; throws UsageError with a human message. */
11
- export declare function parsePushArgs(argv: readonly string[]): PushOptions;
package/dist/run.d.ts DELETED
@@ -1,87 +0,0 @@
1
- import type { Receipt } from './receipt';
2
- export interface RunOptions {
3
- /** Git URL to clone into the sandbox. Unset: the current directory is uploaded. */
4
- repo?: string;
5
- /** Branch to clone. */
6
- ref?: string;
7
- /** Veris environment. Unset: VERIS_ENVIRONMENT_ID. */
8
- environment?: string;
9
- /** Attach to an existing twin instead of creating one. It is not deleted afterwards. */
10
- sandbox?: string;
11
- /** Daytona image or snapshot to create the sandbox from. Unset: Daytona's default. */
12
- image?: string;
13
- snapshot?: string;
14
- /** Shell command run once before the main command (dependency install). */
15
- setup?: string;
16
- /** Services the receipt must show traffic for. Empty: any service will do. */
17
- requireService: string[];
18
- /** KEY=VALUE pairs exported to the setup and main commands. */
19
- env: Record<string, string>;
20
- /** Keep the sandbox and twin after the run, and print how to reach them. */
21
- keep: boolean;
22
- /** Seconds the main command may run. */
23
- timeoutSeconds: number;
24
- /** The command itself, everything after `--`. */
25
- command: string;
26
- }
27
- export declare const DEFAULT_TIMEOUT_SECONDS = 1800;
28
- export declare const USAGE = "usage: veris-daytona run [options] -- <command>\n\nRuns <command> in a Daytona sandbox whose vendor API calls are answered by a\nVeris twin, then prints what the twin received.\n\n --repo <url> git URL to clone into the sandbox (default: upload the current directory)\n --ref <branch> branch to clone\n --environment <id> Veris environment (default: $VERIS_ENVIRONMENT_ID)\n --sandbox <twin-id> attach to an existing twin instead of creating one\n --image <name> Daytona image to run in (default: Daytona's default snapshot)\n --snapshot <name> Daytona snapshot to run in\n --setup <cmd> shell command run first, e.g. 'npm ci' or 'pip install -e .'\n --require-service <name> the receipt must show this service (repeatable; default: any)\n --env KEY=VALUE exported to the setup and main commands (repeatable)\n --timeout <seconds> how long <command> may run (default: 1800)\n --keep leave the sandbox and twin running afterwards\n\nneeds: DAYTONA_API_KEY (with delete:sandboxes, or the sandbox outlives the run),\na Veris key \u2014 VERIS_API_KEY, or the profile `veris login` saved in\n~/.veris/twin.yaml (VERIS_PROFILE picks one) \u2014 and VERIS_ENVIRONMENT_ID (or\n--environment). GITHUB_TOKEN or GH_TOKEN is used for a private --repo.\n\nexit code: the command's; 1 if the twin received nothing (a pass without a receipt is not a pass).";
29
- export declare class UsageError extends Error {
30
- }
31
- /** Parse everything after `run`. Pure; throws UsageError with a human message. */
32
- export declare function parseRunArgs(argv: readonly string[]): RunOptions;
33
- /** Quote argv words back into one shell line, leaving plain words alone. */
34
- export declare function shellJoin(words: readonly string[]): string;
35
- export interface Verdict {
36
- /** The process exit code the run should end with. */
37
- exitCode: number;
38
- /** One line per reason, for the human. Empty when everything held. */
39
- problems: string[];
40
- }
41
- /**
42
- * Decide the exit code from the command's own status and the receipt.
43
- *
44
- * A failing command fails the run, receipt or not. A passing command still
45
- * fails the run when the twin saw nothing, or saw nothing for a service the
46
- * caller required — that is the case the receipt exists to catch.
47
- */
48
- export declare function verdict(commandExitCode: number, receipt: Receipt, requireService: readonly string[]): Verdict;
49
- /**
50
- * The receipt as the human sees it.
51
- *
52
- * A count the read could not finish prints as "≥N", per service and in the
53
- * total. The twin's log is read in pages, so a very long run can end at the
54
- * page budget, and printing that floor as if it were the count would be a
55
- * wrong number stated confidently — the one thing a receipt must never be.
56
- */
57
- export declare function formatReceipt(receipt: Receipt, twinId: string): string;
58
- /**
59
- * The directory under the sandbox's own home that every verb puts code in.
60
- *
61
- * One name shared by four verbs on purpose: `provision` prints it as workDir,
62
- * `push` unpacks into it, `exec` runs in it by default, and `run` does all
63
- * three. A caller chaining provision → push → exec never has to carry the path
64
- * between the commands, and cannot get it wrong.
65
- */
66
- export declare const WORK_SUBDIR = "veris-run";
67
- /** Directories never worth shipping: rebuilt inside the sandbox, or not source. */
68
- export declare const UPLOAD_EXCLUDES: readonly string[];
69
- /** Exit status coreutils `timeout` reports when it had to stop the command. */
70
- export declare const TIMED_OUT_EXIT = 124;
71
- /**
72
- * The one shell line a session runs: cd, exports, then the command under
73
- * coreutils `timeout` so a hung suite is stopped inside the sandbox. Images
74
- * without `timeout` run the command bare; the client-side backstop still
75
- * applies.
76
- */
77
- export declare function commandLine(cwd: string, env: Record<string, string>, command: string, timeoutSeconds: number): string;
78
- export declare function shellQuote(s: string): string;
79
- /**
80
- * The environment a command runs with. Daytona overwrites SSL_CERT_FILE,
81
- * REQUESTS_CA_BUNDLE and CURL_CA_BUNDLE inside the sandbox with its own CA
82
- * file, which cannot verify the gateway's leaf and cannot be amended (root
83
- * owned, read-only mount). So the Veris trust variables are exported on every
84
- * command, where they beat the session's inherited values. The caller's --env
85
- * comes last and wins.
86
- */
87
- export declare function commandEnv(trust: Record<string, string>, user: Record<string, string>): Record<string, string>;
@@ -1,52 +0,0 @@
1
- import type { DaytonaKeyInfo } from './daytona-key';
2
- export interface TeardownOptions {
3
- /** The Daytona sandbox id. Not the twin's. */
4
- sandboxId: string;
5
- }
6
- export declare const TEARDOWN_USAGE = "usage: veris-daytona teardown <daytona-sandbox-id>\n\nDeletes the Daytona sandbox. The id is the one `veris-daytona provision`\nprinted as daytonaSandboxId \u2014 not the Veris twin's id.\n\nThe twin follows the rule it was created under: one this package created is\ndeleted with the sandbox, one it attached to (`provision`, or `run --sandbox`)\nis yours and is left running. Which of the two happened is printed.\n\nneeds: DAYTONA_API_KEY with the delete:sandboxes permission \u2014 a key made with\n\"write sandboxes\" alone is refused, and the refusal says when Daytona will stop\nand delete the box on its own. To reach a twin that must be deleted, a Veris\nkey too: VERIS_API_KEY, or the profile `veris login` saved.\n\nexit code: 0 when the sandbox is deleted; 1 when there is no such sandbox, or\nthe key may not delete one.";
7
- /** The facts a refused delete is described from. Intervals are the sandbox's own. */
8
- export interface RefusedTeardown {
9
- /** The Daytona sandbox id. */
10
- sandboxId: string;
11
- twinId?: string;
12
- /** Whether the wrapped delete removed the twin before Daytona refused the
13
- * sandbox — it deletes the twin first, so an owned twin is already gone. */
14
- ownsTwin: boolean;
15
- /** Daytona's `autoStopInterval`: idle minutes before it stops. 0 is off. */
16
- autoStopMinutes?: number;
17
- /** Daytona's `autoDeleteInterval`: minutes after stopping before it is
18
- * deleted. 0 is at once; negative or unset is never. */
19
- autoDeleteMinutes?: number;
20
- /** Daytona's `autoDestroyAt`, when a TTL was set. */
21
- expiresAt?: string;
22
- /** The key's record, when GET /api/api-keys/current answered. */
23
- key?: DaytonaKeyInfo;
24
- }
25
- /**
26
- * Was this Daytona's "you may not" — HTTP 403 — rather than any other failure?
27
- * Read off the status the SDK stamps rather than a class, so the check holds
28
- * across the SDK's own renamings (DaytonaAuthorizationError became
29
- * DaytonaForbiddenError) and for an error that crossed a package boundary.
30
- */
31
- export declare function isPermissionDenied(e: unknown): boolean;
32
- /**
33
- * What Daytona will do to the box on its own, in one clause: "stops after 30
34
- * idle minutes and is deleted 60 minutes after it stops, and is destroyed at
35
- * <time> whatever state it is in". This is the substance of a refusal — the
36
- * reader's real question is whether the box bills forever, and the answer is
37
- * on the sandbox object.
38
- */
39
- export declare function sandboxBrakes(r: Pick<RefusedTeardown, 'autoStopMinutes' | 'autoDeleteMinutes' | 'expiresAt'>): string;
40
- /**
41
- * What `teardown` says when Daytona answered 403.
42
- *
43
- * The bare "FAILED Access denied" this replaces named neither the cause nor the
44
- * consequence. The cause is a key without `delete:sandboxes` — the one
45
- * permission DELETE /api/sandbox/<id> checks, and one a key made with "write
46
- * sandboxes" alone does not have. The consequence is a box that is still there
47
- * and still billing, so the message says exactly when Daytona will stop and
48
- * delete it by itself, what happened to the twin, and how to delete it sooner.
49
- */
50
- export declare function teardownRefusedMessage(r: RefusedTeardown): string;
51
- /** Parse everything after `teardown`. Pure; throws UsageError with a human message. */
52
- export declare function parseTeardownArgs(argv: readonly string[]): TeardownOptions;