@daytona/sdk 0.195.0 → 0.197.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/cjs/Daytona.d.ts +10 -1
- package/cjs/Daytona.js +31 -3
- package/cjs/Daytona.js.map +1 -1
- package/cjs/Process.js +52 -12
- package/cjs/Process.js.map +1 -1
- package/cjs/PtyHandle.d.ts +14 -0
- package/cjs/PtyHandle.js +100 -34
- package/cjs/PtyHandle.js.map +1 -1
- package/cjs/Sandbox.d.ts +122 -1
- package/cjs/Sandbox.js +209 -2
- package/cjs/Sandbox.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/utils/WebSocket.d.ts +2 -1
- package/cjs/utils/WebSocket.js +10 -3
- package/cjs/utils/WebSocket.js.map +1 -1
- package/esm/Daytona.d.ts +10 -1
- package/esm/Daytona.js +31 -3
- package/esm/Daytona.js.map +1 -1
- package/esm/Process.js +52 -12
- package/esm/Process.js.map +1 -1
- package/esm/PtyHandle.d.ts +14 -0
- package/esm/PtyHandle.js +100 -34
- package/esm/PtyHandle.js.map +1 -1
- package/esm/Sandbox.d.ts +122 -1
- package/esm/Sandbox.js +210 -3
- package/esm/Sandbox.js.map +1 -1
- package/esm/index.d.ts +1 -1
- package/esm/utils/Import.js +1 -1
- package/esm/utils/WebSocket.d.ts +2 -1
- package/esm/utils/WebSocket.js +10 -3
- package/esm/utils/WebSocket.js.map +1 -1
- package/package.json +4 -3
package/esm/PtyHandle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PtyHandle.js","sourceRoot":"","sources":["../../../../sdk-typescript/src/PtyHandle.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,SAAS,MAAM,eAAe,CAAA;AAErC,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAEjG,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAA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,IAAI,IAAI,CAAC,EAAE,IAAI,OAAO,IAAI,CAAC,EAAE,CAAC,EAAE,KAAK,UAAU,EAAE,CAAC;gBAC/D,oBAAoB;gBACpB,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;gBAC9B,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,EAAE,aAAa,CAAC,CAAA;gBACpC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC,CAAA;gBAChC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC,CAAA;YAClC,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,YAAY,CAAC,sCAAsC,CAAC,CAAA;YAChE,CAAC;QACH,CAAC;;;SAtaU,SAAS"}
|
package/esm/Sandbox.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ import { CodeInterpreter } from './CodeInterpreter.js';
|
|
|
37
37
|
* @property {string} [backupCreatedAt] - When the backup was created (not returned by list results;
|
|
38
38
|
* call `refreshData()` on each item to populate)
|
|
39
39
|
* @property {number} [autoStopInterval] - Auto-stop interval in minutes
|
|
40
|
+
* @property {number} [autoPauseInterval] - Auto-pause interval in minutes
|
|
40
41
|
* @property {number} [autoArchiveInterval] - Auto-archive interval in minutes
|
|
41
42
|
* @property {number} [autoDeleteInterval] - Auto-delete interval in minutes
|
|
42
43
|
* @property {Array<SandboxVolume>} [volumes] - Volumes attached to the Sandbox (not returned by
|
|
@@ -61,6 +62,7 @@ export declare class Sandbox {
|
|
|
61
62
|
private readonly clientConfig;
|
|
62
63
|
private readonly axiosInstance;
|
|
63
64
|
private readonly sandboxApi;
|
|
65
|
+
private readonly getAnalyticsApiUrl;
|
|
64
66
|
readonly fs: FileSystem;
|
|
65
67
|
readonly git: Git;
|
|
66
68
|
readonly process: Process;
|
|
@@ -85,6 +87,7 @@ export declare class Sandbox {
|
|
|
85
87
|
backupState?: SandboxBackupStateEnum;
|
|
86
88
|
backupCreatedAt?: string;
|
|
87
89
|
autoStopInterval?: number;
|
|
90
|
+
autoPauseInterval?: number;
|
|
88
91
|
autoArchiveInterval?: number;
|
|
89
92
|
autoDeleteInterval?: number;
|
|
90
93
|
volumes?: Array<SandboxVolume>;
|
|
@@ -98,12 +101,14 @@ export declare class Sandbox {
|
|
|
98
101
|
linkedSandboxId?: string;
|
|
99
102
|
toolboxProxyUrl: string;
|
|
100
103
|
private infoApi;
|
|
104
|
+
private serverApi;
|
|
105
|
+
private systemApi;
|
|
101
106
|
/**
|
|
102
107
|
* Creates a new Sandbox instance
|
|
103
108
|
*
|
|
104
109
|
* @param {SandboxDto} sandboxDto - The API Sandbox instance
|
|
105
110
|
*/
|
|
106
|
-
constructor(sandboxDto: SandboxDto | SandboxListItemDto, clientConfig: Configuration, axiosInstance: AxiosInstance, sandboxApi: SandboxApi);
|
|
111
|
+
constructor(sandboxDto: SandboxDto | SandboxListItemDto, clientConfig: Configuration, axiosInstance: AxiosInstance, sandboxApi: SandboxApi, getAnalyticsApiUrl: () => Promise<string | undefined>);
|
|
107
112
|
/**
|
|
108
113
|
* Gets the user's home directory path for the logged in user inside the Sandbox.
|
|
109
114
|
*
|
|
@@ -114,6 +119,34 @@ export declare class Sandbox {
|
|
|
114
119
|
* console.log(`Sandbox user home: ${userHomeDir}`);
|
|
115
120
|
*/
|
|
116
121
|
getUserHomeDir(): Promise<string | undefined>;
|
|
122
|
+
/**
|
|
123
|
+
* Gets the most recent resource usage sample directly from the sandbox daemon.
|
|
124
|
+
*
|
|
125
|
+
* Unlike {@link getMetrics}, which returns aggregated historical samples, this returns the
|
|
126
|
+
* single current reading without going through the telemetry backend.
|
|
127
|
+
*
|
|
128
|
+
* @returns The current resource usage sample for the sandbox.
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* const m = await sandbox.getMetricsLatest()
|
|
132
|
+
* console.log(`CPU: ${m.cpuUsedPct}%, mem: ${m.memUsed}/${m.memTotal}`)
|
|
133
|
+
*/
|
|
134
|
+
getMetricsLatest(): Promise<SandboxMetrics>;
|
|
135
|
+
/**
|
|
136
|
+
* Gets historical time-series resource usage metrics for the Sandbox.
|
|
137
|
+
*
|
|
138
|
+
* @param {Date} [start] - Start of the time range. Defaults to the Sandbox creation time.
|
|
139
|
+
* @param {Date} [end] - End of the time range. Defaults to the current time.
|
|
140
|
+
* @returns Time-ordered usage samples over the requested range.
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* const samples = await sandbox.getMetrics()
|
|
144
|
+
* for (const s of samples) {
|
|
145
|
+
* console.log(`${s.timestamp.toISOString()} CPU: ${s.cpuUsedPct}% mem: ${s.memUsed}/${s.memTotal}`)
|
|
146
|
+
* }
|
|
147
|
+
*/
|
|
148
|
+
getMetrics(start?: Date, end?: Date): Promise<SandboxMetrics[]>;
|
|
149
|
+
private buildAnalyticsTelemetryApi;
|
|
117
150
|
/**
|
|
118
151
|
* @deprecated Use `getUserHomeDir` instead. This method will be removed in a future version.
|
|
119
152
|
*/
|
|
@@ -342,6 +375,30 @@ export declare class Sandbox {
|
|
|
342
375
|
* await sandbox.setAutostopInterval(0);
|
|
343
376
|
*/
|
|
344
377
|
setAutostopInterval(interval: number): Promise<void>;
|
|
378
|
+
/**
|
|
379
|
+
* Set the auto-pause interval for the Sandbox.
|
|
380
|
+
*
|
|
381
|
+
* The Sandbox will automatically pause after being idle (no new events) for the specified interval.
|
|
382
|
+
* Events include any state changes or interactions with the Sandbox through the sdk.
|
|
383
|
+
* Interactions using Sandbox Previews are not included.
|
|
384
|
+
*
|
|
385
|
+
* Only supported for sandbox classes that support pausing. At most one of the auto-stop
|
|
386
|
+
* and auto-pause intervals may be non-zero, so disable auto-stop first by setting its
|
|
387
|
+
* interval to 0.
|
|
388
|
+
*
|
|
389
|
+
* @param {number} interval - Number of minutes of inactivity before auto-pausing.
|
|
390
|
+
* Set to 0 to disable auto-pause. For pause-supporting sandbox
|
|
391
|
+
* classes, creation defaults to 60 minutes when neither interval is provided.
|
|
392
|
+
* @returns {Promise<void>}
|
|
393
|
+
* @throws {DaytonaError} - `DaytonaError` - If interval is not a non-negative integer
|
|
394
|
+
*
|
|
395
|
+
* @example
|
|
396
|
+
* // Auto-pause after 1 hour
|
|
397
|
+
* await sandbox.setAutoPauseInterval(60);
|
|
398
|
+
* // Or disable auto-pause
|
|
399
|
+
* await sandbox.setAutoPauseInterval(0);
|
|
400
|
+
*/
|
|
401
|
+
setAutoPauseInterval(interval: number): Promise<void>;
|
|
345
402
|
/**
|
|
346
403
|
* Set the auto-archive interval for the Sandbox.
|
|
347
404
|
*
|
|
@@ -398,6 +455,48 @@ export declare class Sandbox {
|
|
|
398
455
|
* await sandbox.updateNetworkSettings({ domainAllowList: 'example.com,*.daytona.io' });
|
|
399
456
|
*/
|
|
400
457
|
updateNetworkSettings(settings: UpdateSandboxNetworkSettings): Promise<void>;
|
|
458
|
+
/**
|
|
459
|
+
* Replaces the set of vault secrets mounted in the Sandbox.
|
|
460
|
+
*
|
|
461
|
+
* Each key is an environment variable name and each value is the name of an existing
|
|
462
|
+
* organization Secret to mount under that name. The provided map replaces the previously
|
|
463
|
+
* mounted set — pass an empty object to detach all secrets.
|
|
464
|
+
*
|
|
465
|
+
* Attached, detached, or rotated secrets take effect for outbound requests within seconds.
|
|
466
|
+
* However, newly attached env vars only become visible to processes spawned after the update;
|
|
467
|
+
* already-running processes keep their environment. A Sandbox created without any secrets
|
|
468
|
+
* must be restarted for newly attached secrets to work.
|
|
469
|
+
*
|
|
470
|
+
* @param {Record<string, string>} secrets - Map of environment variable name to the name of an
|
|
471
|
+
* existing organization Secret. Every referenced Secret name must already exist in the organization.
|
|
472
|
+
* @returns {Promise<void>}
|
|
473
|
+
*
|
|
474
|
+
* @example
|
|
475
|
+
* // Mount two secrets
|
|
476
|
+
* await sandbox.updateSecrets({ API_KEY: 'my-api-key', DB_PASSWORD: 'prod-db-password' });
|
|
477
|
+
* // Detach all secrets
|
|
478
|
+
* await sandbox.updateSecrets({});
|
|
479
|
+
*/
|
|
480
|
+
updateSecrets(secrets: Record<string, string>): Promise<void>;
|
|
481
|
+
/**
|
|
482
|
+
* Updates the Sandbox daemon's process environment.
|
|
483
|
+
*
|
|
484
|
+
* Variables in `env` are set (added or overwritten) and variables listed in `options.unset`
|
|
485
|
+
* are removed. Newly spawned processes, sessions and PTYs inherit the change; already-running
|
|
486
|
+
* processes keep their environment.
|
|
487
|
+
*
|
|
488
|
+
* @param {Record<string, string>} env - Map of environment variable names to values to set.
|
|
489
|
+
* @param {object} [options] - Optional settings.
|
|
490
|
+
* @param {string[]} [options.unset] - Names of environment variables to remove before `env` is applied.
|
|
491
|
+
* @returns {Promise<void>}
|
|
492
|
+
*
|
|
493
|
+
* @example
|
|
494
|
+
* // Set a variable and remove another
|
|
495
|
+
* await sandbox.updateEnv({ NODE_ENV: 'production' }, { unset: ['DEBUG'] });
|
|
496
|
+
*/
|
|
497
|
+
updateEnv(env: Record<string, string>, options?: {
|
|
498
|
+
unset?: string[];
|
|
499
|
+
}): Promise<void>;
|
|
401
500
|
/**
|
|
402
501
|
* Retrieves the preview link for the sandbox at the specified port. If the port is closed,
|
|
403
502
|
* it will be opened automatically. For private sandboxes, a token is included to grant access
|
|
@@ -588,4 +687,26 @@ export interface ListSandboxesQuery {
|
|
|
588
687
|
* */
|
|
589
688
|
lastActivityBefore?: Date;
|
|
590
689
|
}
|
|
690
|
+
/**
|
|
691
|
+
* A single point-in-time sample of historical Sandbox resource usage.
|
|
692
|
+
*
|
|
693
|
+
* @property {number} cpuCount - Number of CPU cores allocated to the Sandbox.
|
|
694
|
+
* @property {number} cpuUsedPct - CPU utilization as a percentage of the allocated limit.
|
|
695
|
+
* @property {number} diskTotal - Total disk space in bytes.
|
|
696
|
+
* @property {number} diskUsed - Used disk space in bytes.
|
|
697
|
+
* @property {number} memTotal - Total memory in bytes.
|
|
698
|
+
* @property {number} memUsed - Used memory in bytes.
|
|
699
|
+
* @property {number} memCache - Memory used by the page cache in bytes.
|
|
700
|
+
* @property {Date} timestamp - Timestamp of this sample.
|
|
701
|
+
*/
|
|
702
|
+
export interface SandboxMetrics {
|
|
703
|
+
cpuCount: number;
|
|
704
|
+
cpuUsedPct: number;
|
|
705
|
+
diskTotal: number;
|
|
706
|
+
diskUsed: number;
|
|
707
|
+
memTotal: number;
|
|
708
|
+
memUsed: number;
|
|
709
|
+
memCache: number;
|
|
710
|
+
timestamp: Date;
|
|
711
|
+
}
|
|
591
712
|
//# sourceMappingURL=Sandbox.d.ts.map
|
package/esm/Sandbox.js
CHANGED
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { __esDecorate, __runInitializers } from "tslib";
|
|
6
6
|
import { SandboxState } from '@daytona/api-client';
|
|
7
|
+
import { TelemetryApi as AnalyticsTelemetryApi, Configuration as AnalyticsConfiguration, } from '@daytona/analytics-api-client';
|
|
7
8
|
import { Daytona } from './Daytona.js';
|
|
8
|
-
import { FileSystemApi, GitApi, ProcessApi, LspApi, InfoApi, ComputerUseApi, InterpreterApi, } from '@daytona/toolbox-api-client';
|
|
9
|
+
import { FileSystemApi, GitApi, ProcessApi, LspApi, InfoApi, SystemApi, ComputerUseApi, InterpreterApi, ServerApi, } from '@daytona/toolbox-api-client';
|
|
9
10
|
import { FileSystem } from './FileSystem.js';
|
|
10
11
|
import { Git } from './Git.js';
|
|
11
12
|
import { Process } from './Process.js';
|
|
@@ -44,6 +45,7 @@ import { WithInstrumentation } from './utils/otel.decorator.js';
|
|
|
44
45
|
* @property {string} [backupCreatedAt] - When the backup was created (not returned by list results;
|
|
45
46
|
* call `refreshData()` on each item to populate)
|
|
46
47
|
* @property {number} [autoStopInterval] - Auto-stop interval in minutes
|
|
48
|
+
* @property {number} [autoPauseInterval] - Auto-pause interval in minutes
|
|
47
49
|
* @property {number} [autoArchiveInterval] - Auto-archive interval in minutes
|
|
48
50
|
* @property {number} [autoDeleteInterval] - Auto-delete interval in minutes
|
|
49
51
|
* @property {Array<SandboxVolume>} [volumes] - Volumes attached to the Sandbox (not returned by
|
|
@@ -67,6 +69,8 @@ import { WithInstrumentation } from './utils/otel.decorator.js';
|
|
|
67
69
|
let Sandbox = (() => {
|
|
68
70
|
let _instanceExtraInitializers = [];
|
|
69
71
|
let _getUserHomeDir_decorators;
|
|
72
|
+
let _getMetricsLatest_decorators;
|
|
73
|
+
let _getMetrics_decorators;
|
|
70
74
|
let _getUserRootDir_decorators;
|
|
71
75
|
let _getWorkDir_decorators;
|
|
72
76
|
let _createLspServer_decorators;
|
|
@@ -81,9 +85,12 @@ let Sandbox = (() => {
|
|
|
81
85
|
let _waitUntilStopped_decorators;
|
|
82
86
|
let _refreshData_decorators;
|
|
83
87
|
let _setAutostopInterval_decorators;
|
|
88
|
+
let _setAutoPauseInterval_decorators;
|
|
84
89
|
let _setAutoArchiveInterval_decorators;
|
|
85
90
|
let _setAutoDeleteInterval_decorators;
|
|
86
91
|
let _updateNetworkSettings_decorators;
|
|
92
|
+
let _updateSecrets_decorators;
|
|
93
|
+
let _updateEnv_decorators;
|
|
87
94
|
let _getPreviewLink_decorators;
|
|
88
95
|
let _archive_decorators;
|
|
89
96
|
let _resize_decorators;
|
|
@@ -95,6 +102,8 @@ let Sandbox = (() => {
|
|
|
95
102
|
static {
|
|
96
103
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
97
104
|
_getUserHomeDir_decorators = [WithInstrumentation()];
|
|
105
|
+
_getMetricsLatest_decorators = [WithInstrumentation()];
|
|
106
|
+
_getMetrics_decorators = [WithInstrumentation()];
|
|
98
107
|
_getUserRootDir_decorators = [WithInstrumentation()];
|
|
99
108
|
_getWorkDir_decorators = [WithInstrumentation()];
|
|
100
109
|
_createLspServer_decorators = [WithInstrumentation()];
|
|
@@ -109,9 +118,12 @@ let Sandbox = (() => {
|
|
|
109
118
|
_waitUntilStopped_decorators = [WithInstrumentation()];
|
|
110
119
|
_refreshData_decorators = [WithInstrumentation()];
|
|
111
120
|
_setAutostopInterval_decorators = [WithInstrumentation()];
|
|
121
|
+
_setAutoPauseInterval_decorators = [WithInstrumentation()];
|
|
112
122
|
_setAutoArchiveInterval_decorators = [WithInstrumentation()];
|
|
113
123
|
_setAutoDeleteInterval_decorators = [WithInstrumentation()];
|
|
114
124
|
_updateNetworkSettings_decorators = [WithInstrumentation()];
|
|
125
|
+
_updateSecrets_decorators = [WithInstrumentation()];
|
|
126
|
+
_updateEnv_decorators = [WithInstrumentation()];
|
|
115
127
|
_getPreviewLink_decorators = [WithInstrumentation()];
|
|
116
128
|
_archive_decorators = [WithInstrumentation()];
|
|
117
129
|
_resize_decorators = [WithInstrumentation()];
|
|
@@ -120,6 +132,8 @@ let Sandbox = (() => {
|
|
|
120
132
|
_revokeSshAccess_decorators = [WithInstrumentation()];
|
|
121
133
|
_validateSshAccess_decorators = [WithInstrumentation()];
|
|
122
134
|
__esDecorate(this, null, _getUserHomeDir_decorators, { kind: "method", name: "getUserHomeDir", static: false, private: false, access: { has: obj => "getUserHomeDir" in obj, get: obj => obj.getUserHomeDir }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
135
|
+
__esDecorate(this, null, _getMetricsLatest_decorators, { kind: "method", name: "getMetricsLatest", static: false, private: false, access: { has: obj => "getMetricsLatest" in obj, get: obj => obj.getMetricsLatest }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
136
|
+
__esDecorate(this, null, _getMetrics_decorators, { kind: "method", name: "getMetrics", static: false, private: false, access: { has: obj => "getMetrics" in obj, get: obj => obj.getMetrics }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
123
137
|
__esDecorate(this, null, _getUserRootDir_decorators, { kind: "method", name: "getUserRootDir", static: false, private: false, access: { has: obj => "getUserRootDir" in obj, get: obj => obj.getUserRootDir }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
124
138
|
__esDecorate(this, null, _getWorkDir_decorators, { kind: "method", name: "getWorkDir", static: false, private: false, access: { has: obj => "getWorkDir" in obj, get: obj => obj.getWorkDir }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
125
139
|
__esDecorate(this, null, _createLspServer_decorators, { kind: "method", name: "createLspServer", static: false, private: false, access: { has: obj => "createLspServer" in obj, get: obj => obj.createLspServer }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
@@ -134,9 +148,12 @@ let Sandbox = (() => {
|
|
|
134
148
|
__esDecorate(this, null, _waitUntilStopped_decorators, { kind: "method", name: "waitUntilStopped", static: false, private: false, access: { has: obj => "waitUntilStopped" in obj, get: obj => obj.waitUntilStopped }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
135
149
|
__esDecorate(this, null, _refreshData_decorators, { kind: "method", name: "refreshData", static: false, private: false, access: { has: obj => "refreshData" in obj, get: obj => obj.refreshData }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
136
150
|
__esDecorate(this, null, _setAutostopInterval_decorators, { kind: "method", name: "setAutostopInterval", static: false, private: false, access: { has: obj => "setAutostopInterval" in obj, get: obj => obj.setAutostopInterval }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
151
|
+
__esDecorate(this, null, _setAutoPauseInterval_decorators, { kind: "method", name: "setAutoPauseInterval", static: false, private: false, access: { has: obj => "setAutoPauseInterval" in obj, get: obj => obj.setAutoPauseInterval }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
137
152
|
__esDecorate(this, null, _setAutoArchiveInterval_decorators, { kind: "method", name: "setAutoArchiveInterval", static: false, private: false, access: { has: obj => "setAutoArchiveInterval" in obj, get: obj => obj.setAutoArchiveInterval }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
138
153
|
__esDecorate(this, null, _setAutoDeleteInterval_decorators, { kind: "method", name: "setAutoDeleteInterval", static: false, private: false, access: { has: obj => "setAutoDeleteInterval" in obj, get: obj => obj.setAutoDeleteInterval }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
139
154
|
__esDecorate(this, null, _updateNetworkSettings_decorators, { kind: "method", name: "updateNetworkSettings", static: false, private: false, access: { has: obj => "updateNetworkSettings" in obj, get: obj => obj.updateNetworkSettings }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
155
|
+
__esDecorate(this, null, _updateSecrets_decorators, { kind: "method", name: "updateSecrets", static: false, private: false, access: { has: obj => "updateSecrets" in obj, get: obj => obj.updateSecrets }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
156
|
+
__esDecorate(this, null, _updateEnv_decorators, { kind: "method", name: "updateEnv", static: false, private: false, access: { has: obj => "updateEnv" in obj, get: obj => obj.updateEnv }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
140
157
|
__esDecorate(this, null, _getPreviewLink_decorators, { kind: "method", name: "getPreviewLink", static: false, private: false, access: { has: obj => "getPreviewLink" in obj, get: obj => obj.getPreviewLink }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
141
158
|
__esDecorate(this, null, _archive_decorators, { kind: "method", name: "archive", static: false, private: false, access: { has: obj => "archive" in obj, get: obj => obj.archive }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
142
159
|
__esDecorate(this, null, _resize_decorators, { kind: "method", name: "resize", static: false, private: false, access: { has: obj => "resize" in obj, get: obj => obj.resize }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
@@ -149,6 +166,7 @@ let Sandbox = (() => {
|
|
|
149
166
|
clientConfig = __runInitializers(this, _instanceExtraInitializers);
|
|
150
167
|
axiosInstance;
|
|
151
168
|
sandboxApi;
|
|
169
|
+
getAnalyticsApiUrl;
|
|
152
170
|
fs;
|
|
153
171
|
git;
|
|
154
172
|
process;
|
|
@@ -173,6 +191,7 @@ let Sandbox = (() => {
|
|
|
173
191
|
backupState;
|
|
174
192
|
backupCreatedAt;
|
|
175
193
|
autoStopInterval;
|
|
194
|
+
autoPauseInterval;
|
|
176
195
|
autoArchiveInterval;
|
|
177
196
|
autoDeleteInterval;
|
|
178
197
|
volumes;
|
|
@@ -186,15 +205,18 @@ let Sandbox = (() => {
|
|
|
186
205
|
linkedSandboxId;
|
|
187
206
|
toolboxProxyUrl;
|
|
188
207
|
infoApi;
|
|
208
|
+
serverApi;
|
|
209
|
+
systemApi;
|
|
189
210
|
/**
|
|
190
211
|
* Creates a new Sandbox instance
|
|
191
212
|
*
|
|
192
213
|
* @param {SandboxDto} sandboxDto - The API Sandbox instance
|
|
193
214
|
*/
|
|
194
|
-
constructor(sandboxDto, clientConfig, axiosInstance, sandboxApi) {
|
|
215
|
+
constructor(sandboxDto, clientConfig, axiosInstance, sandboxApi, getAnalyticsApiUrl) {
|
|
195
216
|
this.clientConfig = clientConfig;
|
|
196
217
|
this.axiosInstance = axiosInstance;
|
|
197
218
|
this.sandboxApi = sandboxApi;
|
|
219
|
+
this.getAnalyticsApiUrl = getAnalyticsApiUrl;
|
|
198
220
|
this.processSandboxDto(sandboxDto);
|
|
199
221
|
// Set the toolbox base URL
|
|
200
222
|
let baseUrl = this.toolboxProxyUrl;
|
|
@@ -212,6 +234,8 @@ let Sandbox = (() => {
|
|
|
212
234
|
this.codeInterpreter = new CodeInterpreter(this.clientConfig, new InterpreterApi(this.clientConfig, '', this.axiosInstance), getPreviewToken);
|
|
213
235
|
this.computerUse = new ComputerUse(new ComputerUseApi(this.clientConfig, '', this.axiosInstance));
|
|
214
236
|
this.infoApi = new InfoApi(this.clientConfig, '', this.axiosInstance);
|
|
237
|
+
this.serverApi = new ServerApi(this.clientConfig, '', this.axiosInstance);
|
|
238
|
+
this.systemApi = new SystemApi(this.clientConfig, '', this.axiosInstance);
|
|
215
239
|
}
|
|
216
240
|
/**
|
|
217
241
|
* Gets the user's home directory path for the logged in user inside the Sandbox.
|
|
@@ -226,6 +250,53 @@ let Sandbox = (() => {
|
|
|
226
250
|
const response = await this.infoApi.getUserHomeDir();
|
|
227
251
|
return response.data.dir;
|
|
228
252
|
}
|
|
253
|
+
/**
|
|
254
|
+
* Gets the most recent resource usage sample directly from the sandbox daemon.
|
|
255
|
+
*
|
|
256
|
+
* Unlike {@link getMetrics}, which returns aggregated historical samples, this returns the
|
|
257
|
+
* single current reading without going through the telemetry backend.
|
|
258
|
+
*
|
|
259
|
+
* @returns The current resource usage sample for the sandbox.
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* const m = await sandbox.getMetricsLatest()
|
|
263
|
+
* console.log(`CPU: ${m.cpuUsedPct}%, mem: ${m.memUsed}/${m.memTotal}`)
|
|
264
|
+
*/
|
|
265
|
+
async getMetricsLatest() {
|
|
266
|
+
const response = await this.systemApi.getSystemMetrics();
|
|
267
|
+
return sandboxMetricsFromSystemMetrics(response.data);
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Gets historical time-series resource usage metrics for the Sandbox.
|
|
271
|
+
*
|
|
272
|
+
* @param {Date} [start] - Start of the time range. Defaults to the Sandbox creation time.
|
|
273
|
+
* @param {Date} [end] - End of the time range. Defaults to the current time.
|
|
274
|
+
* @returns Time-ordered usage samples over the requested range.
|
|
275
|
+
*
|
|
276
|
+
* @example
|
|
277
|
+
* const samples = await sandbox.getMetrics()
|
|
278
|
+
* for (const s of samples) {
|
|
279
|
+
* console.log(`${s.timestamp.toISOString()} CPU: ${s.cpuUsedPct}% mem: ${s.memUsed}/${s.memTotal}`)
|
|
280
|
+
* }
|
|
281
|
+
*/
|
|
282
|
+
async getMetrics(start, end) {
|
|
283
|
+
const to = end ?? new Date();
|
|
284
|
+
const from = start ?? (this.createdAt ? new Date(this.createdAt) : to);
|
|
285
|
+
const analyticsApiUrl = await this.getAnalyticsApiUrl();
|
|
286
|
+
if (analyticsApiUrl) {
|
|
287
|
+
const response = await this.buildAnalyticsTelemetryApi(analyticsApiUrl).organizationOrganizationIdSandboxSandboxIdTelemetryMetricsGet(this.organizationId, this.id, from.toISOString(), to.toISOString(), SANDBOX_METRIC_NAMES.join(','));
|
|
288
|
+
return pivotSandboxMetricPoints(response.data);
|
|
289
|
+
}
|
|
290
|
+
const response = await this.sandboxApi.getSandboxMetrics(this.id, from, to, undefined, SANDBOX_METRIC_NAMES);
|
|
291
|
+
return pivotSandboxMetrics(response.data.series);
|
|
292
|
+
}
|
|
293
|
+
buildAnalyticsTelemetryApi(analyticsApiUrl) {
|
|
294
|
+
const analyticsConfig = new AnalyticsConfiguration({
|
|
295
|
+
basePath: analyticsApiUrl,
|
|
296
|
+
apiKey: this.clientConfig.baseOptions?.headers?.Authorization,
|
|
297
|
+
});
|
|
298
|
+
return new AnalyticsTelemetryApi(analyticsConfig, undefined, Daytona.createAxiosInstance());
|
|
299
|
+
}
|
|
229
300
|
/**
|
|
230
301
|
* @deprecated Use `getUserHomeDir` instead. This method will be removed in a future version.
|
|
231
302
|
*/
|
|
@@ -383,7 +454,7 @@ let Sandbox = (() => {
|
|
|
383
454
|
timeout: timeout * 1000,
|
|
384
455
|
});
|
|
385
456
|
const sandboxDto = response.data;
|
|
386
|
-
const forkedSandbox = new Sandbox(sandboxDto, structuredClone(this.clientConfig), Daytona.createAxiosInstance(), this.sandboxApi);
|
|
457
|
+
const forkedSandbox = new Sandbox(sandboxDto, structuredClone(this.clientConfig), Daytona.createAxiosInstance(), this.sandboxApi, this.getAnalyticsApiUrl);
|
|
387
458
|
const timeElapsed = Date.now() - startTime;
|
|
388
459
|
await forkedSandbox.waitUntilStarted(timeout ? Math.max(0.001, timeout - timeElapsed / 1000) : timeout);
|
|
389
460
|
return forkedSandbox;
|
|
@@ -625,6 +696,36 @@ let Sandbox = (() => {
|
|
|
625
696
|
await this.sandboxApi.setAutostopInterval(this.id, interval);
|
|
626
697
|
this.autoStopInterval = interval;
|
|
627
698
|
}
|
|
699
|
+
/**
|
|
700
|
+
* Set the auto-pause interval for the Sandbox.
|
|
701
|
+
*
|
|
702
|
+
* The Sandbox will automatically pause after being idle (no new events) for the specified interval.
|
|
703
|
+
* Events include any state changes or interactions with the Sandbox through the sdk.
|
|
704
|
+
* Interactions using Sandbox Previews are not included.
|
|
705
|
+
*
|
|
706
|
+
* Only supported for sandbox classes that support pausing. At most one of the auto-stop
|
|
707
|
+
* and auto-pause intervals may be non-zero, so disable auto-stop first by setting its
|
|
708
|
+
* interval to 0.
|
|
709
|
+
*
|
|
710
|
+
* @param {number} interval - Number of minutes of inactivity before auto-pausing.
|
|
711
|
+
* Set to 0 to disable auto-pause. For pause-supporting sandbox
|
|
712
|
+
* classes, creation defaults to 60 minutes when neither interval is provided.
|
|
713
|
+
* @returns {Promise<void>}
|
|
714
|
+
* @throws {DaytonaError} - `DaytonaError` - If interval is not a non-negative integer
|
|
715
|
+
*
|
|
716
|
+
* @example
|
|
717
|
+
* // Auto-pause after 1 hour
|
|
718
|
+
* await sandbox.setAutoPauseInterval(60);
|
|
719
|
+
* // Or disable auto-pause
|
|
720
|
+
* await sandbox.setAutoPauseInterval(0);
|
|
721
|
+
*/
|
|
722
|
+
async setAutoPauseInterval(interval) {
|
|
723
|
+
if (!Number.isInteger(interval) || interval < 0) {
|
|
724
|
+
throw new DaytonaValidationError('autoPauseInterval must be a non-negative integer');
|
|
725
|
+
}
|
|
726
|
+
await this.sandboxApi.setAutoPauseInterval(this.id, interval);
|
|
727
|
+
this.autoPauseInterval = interval;
|
|
728
|
+
}
|
|
628
729
|
/**
|
|
629
730
|
* Set the auto-archive interval for the Sandbox.
|
|
630
731
|
*
|
|
@@ -698,6 +799,56 @@ let Sandbox = (() => {
|
|
|
698
799
|
const response = await this.sandboxApi.updateNetworkSettings(this.id, settings);
|
|
699
800
|
this.processSandboxDto(response.data);
|
|
700
801
|
}
|
|
802
|
+
/**
|
|
803
|
+
* Replaces the set of vault secrets mounted in the Sandbox.
|
|
804
|
+
*
|
|
805
|
+
* Each key is an environment variable name and each value is the name of an existing
|
|
806
|
+
* organization Secret to mount under that name. The provided map replaces the previously
|
|
807
|
+
* mounted set — pass an empty object to detach all secrets.
|
|
808
|
+
*
|
|
809
|
+
* Attached, detached, or rotated secrets take effect for outbound requests within seconds.
|
|
810
|
+
* However, newly attached env vars only become visible to processes spawned after the update;
|
|
811
|
+
* already-running processes keep their environment. A Sandbox created without any secrets
|
|
812
|
+
* must be restarted for newly attached secrets to work.
|
|
813
|
+
*
|
|
814
|
+
* @param {Record<string, string>} secrets - Map of environment variable name to the name of an
|
|
815
|
+
* existing organization Secret. Every referenced Secret name must already exist in the organization.
|
|
816
|
+
* @returns {Promise<void>}
|
|
817
|
+
*
|
|
818
|
+
* @example
|
|
819
|
+
* // Mount two secrets
|
|
820
|
+
* await sandbox.updateSecrets({ API_KEY: 'my-api-key', DB_PASSWORD: 'prod-db-password' });
|
|
821
|
+
* // Detach all secrets
|
|
822
|
+
* await sandbox.updateSecrets({});
|
|
823
|
+
*/
|
|
824
|
+
async updateSecrets(secrets) {
|
|
825
|
+
const response = await this.sandboxApi.updateSandboxSecrets(this.id, {
|
|
826
|
+
secrets: Object.entries(secrets).map(([envVar, secretName]) => ({ [envVar]: secretName })),
|
|
827
|
+
});
|
|
828
|
+
this.processSandboxDto(response.data);
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
831
|
+
* Updates the Sandbox daemon's process environment.
|
|
832
|
+
*
|
|
833
|
+
* Variables in `env` are set (added or overwritten) and variables listed in `options.unset`
|
|
834
|
+
* are removed. Newly spawned processes, sessions and PTYs inherit the change; already-running
|
|
835
|
+
* processes keep their environment.
|
|
836
|
+
*
|
|
837
|
+
* @param {Record<string, string>} env - Map of environment variable names to values to set.
|
|
838
|
+
* @param {object} [options] - Optional settings.
|
|
839
|
+
* @param {string[]} [options.unset] - Names of environment variables to remove before `env` is applied.
|
|
840
|
+
* @returns {Promise<void>}
|
|
841
|
+
*
|
|
842
|
+
* @example
|
|
843
|
+
* // Set a variable and remove another
|
|
844
|
+
* await sandbox.updateEnv({ NODE_ENV: 'production' }, { unset: ['DEBUG'] });
|
|
845
|
+
*/
|
|
846
|
+
async updateEnv(env, options) {
|
|
847
|
+
await this.serverApi.updateEnv({
|
|
848
|
+
set: env,
|
|
849
|
+
unset: options?.unset,
|
|
850
|
+
});
|
|
851
|
+
}
|
|
701
852
|
/**
|
|
702
853
|
* Retrieves the preview link for the sandbox at the specified port. If the port is closed,
|
|
703
854
|
* it will be opened automatically. For private sandboxes, a token is included to grant access
|
|
@@ -868,6 +1019,7 @@ let Sandbox = (() => {
|
|
|
868
1019
|
this.recoverable = sandboxDto.recoverable;
|
|
869
1020
|
this.backupState = sandboxDto.backupState;
|
|
870
1021
|
this.autoStopInterval = sandboxDto.autoStopInterval;
|
|
1022
|
+
this.autoPauseInterval = sandboxDto.autoPauseInterval;
|
|
871
1023
|
this.autoArchiveInterval = sandboxDto.autoArchiveInterval;
|
|
872
1024
|
this.autoDeleteInterval = sandboxDto.autoDeleteInterval;
|
|
873
1025
|
this.createdAt = sandboxDto.createdAt;
|
|
@@ -905,4 +1057,59 @@ let Sandbox = (() => {
|
|
|
905
1057
|
};
|
|
906
1058
|
})();
|
|
907
1059
|
export { Sandbox };
|
|
1060
|
+
const SANDBOX_METRIC_FIELD_BY_NAME = {
|
|
1061
|
+
'daytona.sandbox.cpu.utilization': 'cpuUsedPct',
|
|
1062
|
+
'daytona.sandbox.cpu.limit': 'cpuCount',
|
|
1063
|
+
'daytona.sandbox.memory.usage': 'memUsed',
|
|
1064
|
+
'daytona.sandbox.memory.limit': 'memTotal',
|
|
1065
|
+
'daytona.sandbox.memory.cache': 'memCache',
|
|
1066
|
+
'daytona.sandbox.filesystem.usage': 'diskUsed',
|
|
1067
|
+
'daytona.sandbox.filesystem.total': 'diskTotal',
|
|
1068
|
+
};
|
|
1069
|
+
const SANDBOX_METRIC_NAMES = Object.keys(SANDBOX_METRIC_FIELD_BY_NAME);
|
|
1070
|
+
function sandboxMetricsFromSystemMetrics(m) {
|
|
1071
|
+
return {
|
|
1072
|
+
cpuCount: m.cpuCount ?? 0,
|
|
1073
|
+
cpuUsedPct: m.cpuUsedPct ?? 0,
|
|
1074
|
+
diskTotal: m.diskTotal ?? 0,
|
|
1075
|
+
diskUsed: m.diskUsed ?? 0,
|
|
1076
|
+
memTotal: m.memTotal ?? 0,
|
|
1077
|
+
memUsed: m.memUsed ?? 0,
|
|
1078
|
+
memCache: m.memCache ?? 0,
|
|
1079
|
+
timestamp: m.timestamp ? new Date(m.timestamp) : new Date(),
|
|
1080
|
+
};
|
|
1081
|
+
}
|
|
1082
|
+
function buildSandboxMetrics(buckets) {
|
|
1083
|
+
return [...buckets.keys()].sort().map((ts) => {
|
|
1084
|
+
const v = buckets.get(ts);
|
|
1085
|
+
return {
|
|
1086
|
+
cpuCount: v.cpuCount ?? 0,
|
|
1087
|
+
cpuUsedPct: v.cpuUsedPct ?? 0,
|
|
1088
|
+
diskTotal: v.diskTotal ?? 0,
|
|
1089
|
+
diskUsed: v.diskUsed ?? 0,
|
|
1090
|
+
memTotal: v.memTotal ?? 0,
|
|
1091
|
+
memUsed: v.memUsed ?? 0,
|
|
1092
|
+
memCache: v.memCache ?? 0,
|
|
1093
|
+
timestamp: new Date(ts),
|
|
1094
|
+
};
|
|
1095
|
+
});
|
|
1096
|
+
}
|
|
1097
|
+
function pivotMetricTriples(triples) {
|
|
1098
|
+
const buckets = new Map();
|
|
1099
|
+
for (const [name, timestamp, value] of triples) {
|
|
1100
|
+
const field = name ? SANDBOX_METRIC_FIELD_BY_NAME[name] : undefined;
|
|
1101
|
+
if (!field || timestamp === undefined || value === undefined)
|
|
1102
|
+
continue;
|
|
1103
|
+
const bucket = buckets.get(timestamp) ?? {};
|
|
1104
|
+
bucket[field] = value;
|
|
1105
|
+
buckets.set(timestamp, bucket);
|
|
1106
|
+
}
|
|
1107
|
+
return buildSandboxMetrics(buckets);
|
|
1108
|
+
}
|
|
1109
|
+
function pivotSandboxMetrics(series) {
|
|
1110
|
+
return pivotMetricTriples((series ?? []).flatMap((s) => (s.dataPoints ?? []).map((p) => [s.metricName, p.timestamp, p.value])));
|
|
1111
|
+
}
|
|
1112
|
+
function pivotSandboxMetricPoints(points) {
|
|
1113
|
+
return pivotMetricTriples((points ?? []).map((p) => [p.metricName, p.timestamp, p.value]));
|
|
1114
|
+
}
|
|
908
1115
|
//# sourceMappingURL=Sandbox.js.map
|