@daytonaio/sdk 0.128.0-alpha.1 → 0.128.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/package.json +8 -20
- package/{cjs → src}/CodeInterpreter.d.ts +0 -1
- package/src/CodeInterpreter.js.map +1 -0
- package/{esm → src}/ComputerUse.d.ts +0 -1
- package/src/ComputerUse.js.map +1 -0
- package/{cjs → src}/Daytona.d.ts +1 -2
- package/{cjs → src}/Daytona.js +8 -6
- package/{cjs → src}/Daytona.js.map +1 -1
- package/{esm → src}/FileSystem.d.ts +0 -1
- package/src/FileSystem.js.map +1 -0
- package/{esm → src}/Git.d.ts +0 -1
- package/src/Git.js.map +1 -0
- package/{cjs → src}/Image.d.ts +0 -21
- package/{cjs → src}/Image.js +91 -123
- package/src/Image.js.map +1 -0
- package/{cjs → src}/LspServer.d.ts +0 -1
- package/src/LspServer.js.map +1 -0
- package/{esm → src}/ObjectStorage.d.ts +0 -1
- package/src/ObjectStorage.js.map +1 -0
- package/{cjs → src}/Process.d.ts +0 -1
- package/src/Process.js.map +1 -0
- package/{cjs → src}/PtyHandle.d.ts +0 -1
- package/src/PtyHandle.js.map +1 -0
- package/{cjs → src}/Sandbox.d.ts +17 -2
- package/{cjs → src}/Sandbox.js +27 -1
- package/src/Sandbox.js.map +1 -0
- package/{cjs → src}/Snapshot.d.ts +0 -2
- package/{cjs → src}/Snapshot.js +1 -9
- package/src/Snapshot.js.map +1 -0
- package/{esm → src}/Volume.d.ts +0 -1
- package/src/Volume.js.map +1 -0
- package/{cjs → src}/code-toolbox/SandboxJsCodeToolbox.d.ts +0 -1
- package/src/code-toolbox/SandboxJsCodeToolbox.js.map +1 -0
- package/{cjs → src}/code-toolbox/SandboxPythonCodeToolbox.d.ts +0 -1
- package/src/code-toolbox/SandboxPythonCodeToolbox.js.map +1 -0
- package/{cjs → src}/code-toolbox/SandboxTsCodeToolbox.d.ts +0 -1
- package/src/code-toolbox/SandboxTsCodeToolbox.js.map +1 -0
- package/{esm → src}/errors/DaytonaError.d.ts +0 -1
- package/src/errors/DaytonaError.js.map +1 -0
- package/{cjs → src}/index.d.ts +0 -1
- package/src/index.js.map +1 -0
- package/{esm → src}/types/Charts.d.ts +0 -1
- package/src/types/Charts.js.map +1 -0
- package/{esm → src}/types/CodeInterpreter.d.ts +0 -1
- package/src/types/CodeInterpreter.js.map +1 -0
- package/{cjs → src}/types/ExecuteResponse.d.ts +0 -1
- package/src/types/ExecuteResponse.js.map +1 -0
- package/{cjs → src}/types/Pty.d.ts +0 -1
- package/src/types/Pty.js.map +1 -0
- package/{cjs → src}/utils/ArtifactParser.d.ts +0 -1
- package/src/utils/ArtifactParser.js.map +1 -0
- package/{esm → src}/utils/Binary.d.ts +0 -1
- package/src/utils/Binary.js.map +1 -0
- package/{cjs → src}/utils/FileTransfer.d.ts +0 -1
- package/src/utils/FileTransfer.js.map +1 -0
- package/{cjs → src}/utils/Import.d.ts +15 -2
- package/src/utils/Import.js +77 -0
- package/src/utils/Import.js.map +1 -0
- package/{esm → src}/utils/Multipart.d.ts +0 -1
- package/src/utils/Multipart.js.map +1 -0
- package/{cjs → src}/utils/Runtime.d.ts +0 -1
- package/src/utils/Runtime.js.map +1 -0
- package/{cjs → src}/utils/Stream.d.ts +0 -1
- package/src/utils/Stream.js.map +1 -0
- package/{esm → src}/utils/WebSocket.d.ts +0 -1
- package/src/utils/WebSocket.js.map +1 -0
- package/LICENSE +0 -190
- package/cjs/CodeInterpreter.d.ts.map +0 -1
- package/cjs/CodeInterpreter.js.map +0 -1
- package/cjs/ComputerUse.d.ts +0 -443
- package/cjs/ComputerUse.d.ts.map +0 -1
- package/cjs/ComputerUse.js.map +0 -1
- package/cjs/Daytona.d.ts.map +0 -1
- package/cjs/FileSystem.d.ts +0 -328
- package/cjs/FileSystem.d.ts.map +0 -1
- package/cjs/FileSystem.js.map +0 -1
- package/cjs/Git.d.ts +0 -203
- package/cjs/Git.d.ts.map +0 -1
- package/cjs/Git.js.map +0 -1
- package/cjs/Image.d.ts.map +0 -1
- package/cjs/Image.js.map +0 -1
- package/cjs/LspServer.d.ts.map +0 -1
- package/cjs/LspServer.js.map +0 -1
- package/cjs/ObjectStorage.d.ts +0 -79
- package/cjs/ObjectStorage.d.ts.map +0 -1
- package/cjs/ObjectStorage.js.map +0 -1
- package/cjs/Process.d.ts.map +0 -1
- package/cjs/Process.js.map +0 -1
- package/cjs/PtyHandle.d.ts.map +0 -1
- package/cjs/PtyHandle.js.map +0 -1
- package/cjs/README.md +0 -147
- package/cjs/Sandbox.d.ts.map +0 -1
- package/cjs/Sandbox.js.map +0 -1
- package/cjs/Snapshot.d.ts.map +0 -1
- package/cjs/Snapshot.js.map +0 -1
- package/cjs/Volume.d.ts +0 -84
- package/cjs/Volume.d.ts.map +0 -1
- package/cjs/Volume.js.map +0 -1
- package/cjs/code-toolbox/SandboxJsCodeToolbox.d.ts.map +0 -1
- package/cjs/code-toolbox/SandboxJsCodeToolbox.js.map +0 -1
- package/cjs/code-toolbox/SandboxPythonCodeToolbox.d.ts.map +0 -1
- package/cjs/code-toolbox/SandboxPythonCodeToolbox.js.map +0 -1
- package/cjs/code-toolbox/SandboxTsCodeToolbox.d.ts.map +0 -1
- package/cjs/code-toolbox/SandboxTsCodeToolbox.js.map +0 -1
- package/cjs/errors/DaytonaError.d.ts +0 -32
- package/cjs/errors/DaytonaError.d.ts.map +0 -1
- package/cjs/errors/DaytonaError.js.map +0 -1
- package/cjs/index.d.ts.map +0 -1
- package/cjs/index.js.map +0 -1
- package/cjs/package.json +0 -3
- package/cjs/types/Charts.d.ts +0 -152
- package/cjs/types/Charts.d.ts.map +0 -1
- package/cjs/types/Charts.js.map +0 -1
- package/cjs/types/CodeInterpreter.d.ts +0 -77
- package/cjs/types/CodeInterpreter.d.ts.map +0 -1
- package/cjs/types/CodeInterpreter.js.map +0 -1
- package/cjs/types/ExecuteResponse.d.ts.map +0 -1
- package/cjs/types/ExecuteResponse.js.map +0 -1
- package/cjs/types/Pty.d.ts.map +0 -1
- package/cjs/types/Pty.js.map +0 -1
- package/cjs/utils/ArtifactParser.d.ts.map +0 -1
- package/cjs/utils/ArtifactParser.js.map +0 -1
- package/cjs/utils/Binary.d.ts +0 -39
- package/cjs/utils/Binary.d.ts.map +0 -1
- package/cjs/utils/Binary.js.map +0 -1
- package/cjs/utils/FileTransfer.d.ts.map +0 -1
- package/cjs/utils/FileTransfer.js.map +0 -1
- package/cjs/utils/Import.d.ts.map +0 -1
- package/cjs/utils/Import.js +0 -81
- package/cjs/utils/Import.js.map +0 -1
- package/cjs/utils/Multipart.d.ts +0 -27
- package/cjs/utils/Multipart.d.ts.map +0 -1
- package/cjs/utils/Multipart.js.map +0 -1
- package/cjs/utils/Runtime.d.ts.map +0 -1
- package/cjs/utils/Runtime.js.map +0 -1
- package/cjs/utils/Stream.d.ts.map +0 -1
- package/cjs/utils/Stream.js.map +0 -1
- package/cjs/utils/WebSocket.d.ts +0 -10
- package/cjs/utils/WebSocket.d.ts.map +0 -1
- package/cjs/utils/WebSocket.js.map +0 -1
- package/esm/CodeInterpreter.d.ts +0 -96
- package/esm/CodeInterpreter.d.ts.map +0 -1
- package/esm/CodeInterpreter.js +0 -295
- package/esm/CodeInterpreter.js.map +0 -1
- package/esm/ComputerUse.d.ts.map +0 -1
- package/esm/ComputerUse.js +0 -509
- package/esm/ComputerUse.js.map +0 -1
- package/esm/Daytona.d.ts +0 -354
- package/esm/Daytona.d.ts.map +0 -1
- package/esm/Daytona.js +0 -410
- package/esm/Daytona.js.map +0 -1
- package/esm/FileSystem.d.ts.map +0 -1
- package/esm/FileSystem.js +0 -331
- package/esm/FileSystem.js.map +0 -1
- package/esm/Git.d.ts.map +0 -1
- package/esm/Git.js +0 -260
- package/esm/Git.js.map +0 -1
- package/esm/Image.d.ts +0 -285
- package/esm/Image.d.ts.map +0 -1
- package/esm/Image.js +0 -569
- package/esm/Image.js.map +0 -1
- package/esm/LspServer.d.ts +0 -172
- package/esm/LspServer.d.ts.map +0 -1
- package/esm/LspServer.js +0 -204
- package/esm/LspServer.js.map +0 -1
- package/esm/ObjectStorage.d.ts.map +0 -1
- package/esm/ObjectStorage.js +0 -187
- package/esm/ObjectStorage.js.map +0 -1
- package/esm/Process.d.ts +0 -442
- package/esm/Process.d.ts.map +0 -1
- package/esm/Process.js +0 -644
- package/esm/Process.js.map +0 -1
- package/esm/PtyHandle.d.ts +0 -155
- package/esm/PtyHandle.d.ts.map +0 -1
- package/esm/PtyHandle.js +0 -374
- package/esm/PtyHandle.js.map +0 -1
- package/esm/README.md +0 -147
- package/esm/Sandbox.d.ts +0 -359
- package/esm/Sandbox.d.ts.map +0 -1
- package/esm/Sandbox.js +0 -532
- package/esm/Sandbox.js.map +0 -1
- package/esm/Snapshot.d.ts +0 -138
- package/esm/Snapshot.d.ts.map +0 -1
- package/esm/Snapshot.js +0 -207
- package/esm/Snapshot.js.map +0 -1
- package/esm/Volume.d.ts.map +0 -1
- package/esm/Volume.js +0 -95
- package/esm/Volume.js.map +0 -1
- package/esm/code-toolbox/SandboxJsCodeToolbox.d.ts +0 -6
- package/esm/code-toolbox/SandboxJsCodeToolbox.d.ts.map +0 -1
- package/esm/code-toolbox/SandboxJsCodeToolbox.js +0 -13
- package/esm/code-toolbox/SandboxJsCodeToolbox.js.map +0 -1
- package/esm/code-toolbox/SandboxPythonCodeToolbox.d.ts +0 -12
- package/esm/code-toolbox/SandboxPythonCodeToolbox.d.ts.map +0 -1
- package/esm/code-toolbox/SandboxPythonCodeToolbox.js +0 -355
- package/esm/code-toolbox/SandboxPythonCodeToolbox.js.map +0 -1
- package/esm/code-toolbox/SandboxTsCodeToolbox.d.ts +0 -6
- package/esm/code-toolbox/SandboxTsCodeToolbox.d.ts.map +0 -1
- package/esm/code-toolbox/SandboxTsCodeToolbox.js +0 -14
- package/esm/code-toolbox/SandboxTsCodeToolbox.js.map +0 -1
- package/esm/errors/DaytonaError.d.ts.map +0 -1
- package/esm/errors/DaytonaError.js +0 -44
- package/esm/errors/DaytonaError.js.map +0 -1
- package/esm/index.d.ts +0 -22
- package/esm/index.d.ts.map +0 -1
- package/esm/index.js +0 -22
- package/esm/index.js.map +0 -1
- package/esm/package.json +0 -3
- package/esm/types/Charts.d.ts.map +0 -1
- package/esm/types/Charts.js +0 -42
- package/esm/types/Charts.js.map +0 -1
- package/esm/types/CodeInterpreter.d.ts.map +0 -1
- package/esm/types/CodeInterpreter.js +0 -6
- package/esm/types/CodeInterpreter.js.map +0 -1
- package/esm/types/ExecuteResponse.d.ts +0 -26
- package/esm/types/ExecuteResponse.d.ts.map +0 -1
- package/esm/types/ExecuteResponse.js +0 -6
- package/esm/types/ExecuteResponse.js.map +0 -1
- package/esm/types/Pty.d.ts +0 -48
- package/esm/types/Pty.d.ts.map +0 -1
- package/esm/types/Pty.js +0 -6
- package/esm/types/Pty.js.map +0 -1
- package/esm/utils/ArtifactParser.d.ts +0 -14
- package/esm/utils/ArtifactParser.d.ts.map +0 -1
- package/esm/utils/ArtifactParser.js +0 -51
- package/esm/utils/ArtifactParser.js.map +0 -1
- package/esm/utils/Binary.d.ts.map +0 -1
- package/esm/utils/Binary.js +0 -157
- package/esm/utils/Binary.js.map +0 -1
- package/esm/utils/FileTransfer.d.ts +0 -15
- package/esm/utils/FileTransfer.d.ts.map +0 -1
- package/esm/utils/FileTransfer.js +0 -209
- package/esm/utils/FileTransfer.js.map +0 -1
- package/esm/utils/Import.d.ts +0 -211
- package/esm/utils/Import.d.ts.map +0 -1
- package/esm/utils/Import.js +0 -45
- package/esm/utils/Import.js.map +0 -1
- package/esm/utils/Multipart.d.ts.map +0 -1
- package/esm/utils/Multipart.js +0 -107
- package/esm/utils/Multipart.js.map +0 -1
- package/esm/utils/Runtime.d.ts +0 -37
- package/esm/utils/Runtime.d.ts.map +0 -1
- package/esm/utils/Runtime.js +0 -57
- package/esm/utils/Runtime.js.map +0 -1
- package/esm/utils/Stream.d.ts +0 -20
- package/esm/utils/Stream.d.ts.map +0 -1
- package/esm/utils/Stream.js +0 -360
- package/esm/utils/Stream.js.map +0 -1
- package/esm/utils/WebSocket.d.ts.map +0 -1
- package/esm/utils/WebSocket.js +0 -22
- package/esm/utils/WebSocket.js.map +0 -1
- /package/{cjs → src}/CodeInterpreter.js +0 -0
- /package/{cjs → src}/ComputerUse.js +0 -0
- /package/{cjs → src}/FileSystem.js +0 -0
- /package/{cjs → src}/Git.js +0 -0
- /package/{cjs → src}/LspServer.js +0 -0
- /package/{cjs → src}/ObjectStorage.js +0 -0
- /package/{cjs → src}/Process.js +0 -0
- /package/{cjs → src}/PtyHandle.js +0 -0
- /package/{cjs → src}/Volume.js +0 -0
- /package/{cjs → src}/code-toolbox/SandboxJsCodeToolbox.js +0 -0
- /package/{cjs → src}/code-toolbox/SandboxPythonCodeToolbox.js +0 -0
- /package/{cjs → src}/code-toolbox/SandboxTsCodeToolbox.js +0 -0
- /package/{cjs → src}/errors/DaytonaError.js +0 -0
- /package/{cjs → src}/index.js +0 -0
- /package/{cjs → src}/types/Charts.js +0 -0
- /package/{cjs → src}/types/CodeInterpreter.js +0 -0
- /package/{cjs → src}/types/ExecuteResponse.js +0 -0
- /package/{cjs → src}/types/Pty.js +0 -0
- /package/{cjs → src}/utils/ArtifactParser.js +0 -0
- /package/{cjs → src}/utils/Binary.js +0 -0
- /package/{cjs → src}/utils/FileTransfer.js +0 -0
- /package/{cjs → src}/utils/Multipart.js +0 -0
- /package/{cjs → src}/utils/Runtime.js +0 -0
- /package/{cjs → src}/utils/Stream.js +0 -0
- /package/{cjs → src}/utils/WebSocket.js +0 -0
package/esm/Process.js
DELETED
|
@@ -1,644 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2025 Daytona Platforms Inc.
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
import { ArtifactParser } from './utils/ArtifactParser.js';
|
|
6
|
-
import { stdDemuxStream } from './utils/Stream.js';
|
|
7
|
-
import { Buffer } from 'buffer';
|
|
8
|
-
import { PtyHandle } from './PtyHandle.js';
|
|
9
|
-
import { createSandboxWebSocket } from './utils/WebSocket.js';
|
|
10
|
-
// 3-byte multiplexing markers inserted by the shell labelers
|
|
11
|
-
export const STDOUT_PREFIX_BYTES = new Uint8Array([0x01, 0x01, 0x01]);
|
|
12
|
-
export const STDERR_PREFIX_BYTES = new Uint8Array([0x02, 0x02, 0x02]);
|
|
13
|
-
export const MAX_PREFIX_LEN = Math.max(STDOUT_PREFIX_BYTES.length, STDERR_PREFIX_BYTES.length);
|
|
14
|
-
/**
|
|
15
|
-
* Parameters for code execution.
|
|
16
|
-
*/
|
|
17
|
-
export class CodeRunParams {
|
|
18
|
-
/**
|
|
19
|
-
* Command line arguments
|
|
20
|
-
*/
|
|
21
|
-
argv;
|
|
22
|
-
/**
|
|
23
|
-
* Environment variables
|
|
24
|
-
*/
|
|
25
|
-
env;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Handles process and code execution within a Sandbox.
|
|
29
|
-
*
|
|
30
|
-
* @class
|
|
31
|
-
*/
|
|
32
|
-
export class Process {
|
|
33
|
-
clientConfig;
|
|
34
|
-
codeToolbox;
|
|
35
|
-
apiClient;
|
|
36
|
-
getPreviewToken;
|
|
37
|
-
ensureToolboxUrl;
|
|
38
|
-
constructor(clientConfig, codeToolbox, apiClient, getPreviewToken, ensureToolboxUrl) {
|
|
39
|
-
this.clientConfig = clientConfig;
|
|
40
|
-
this.codeToolbox = codeToolbox;
|
|
41
|
-
this.apiClient = apiClient;
|
|
42
|
-
this.getPreviewToken = getPreviewToken;
|
|
43
|
-
this.ensureToolboxUrl = ensureToolboxUrl;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Executes a shell command in the Sandbox.
|
|
47
|
-
*
|
|
48
|
-
* @param {string} command - Shell command to execute
|
|
49
|
-
* @param {string} [cwd] - Working directory for command execution. If not specified, uses the sandbox working directory.
|
|
50
|
-
* @param {Record<string, string>} [env] - Environment variables to set for the command
|
|
51
|
-
* @param {number} [timeout] - Maximum time in seconds to wait for the command to complete. 0 means wait indefinitely.
|
|
52
|
-
* @returns {Promise<ExecuteResponse>} Command execution results containing:
|
|
53
|
-
* - exitCode: The command's exit status
|
|
54
|
-
* - result: Standard output from the command
|
|
55
|
-
* - artifacts: ExecutionArtifacts object containing `stdout` (same as result) and `charts` (matplotlib charts metadata)
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* // Simple command
|
|
59
|
-
* const response = await process.executeCommand('echo "Hello"');
|
|
60
|
-
* console.log(response.artifacts.stdout); // Prints: Hello
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* // Command with working directory
|
|
64
|
-
* const result = await process.executeCommand('ls', 'workspace/src');
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* // Command with timeout
|
|
68
|
-
* const result = await process.executeCommand('sleep 10', undefined, 5);
|
|
69
|
-
*/
|
|
70
|
-
async executeCommand(command, cwd, env, timeout) {
|
|
71
|
-
const base64UserCmd = Buffer.from(command).toString('base64');
|
|
72
|
-
command = `echo '${base64UserCmd}' | base64 -d | sh`;
|
|
73
|
-
if (env && Object.keys(env).length > 0) {
|
|
74
|
-
const safeEnvExports = Object.entries(env)
|
|
75
|
-
.map(([key, value]) => {
|
|
76
|
-
const encodedValue = Buffer.from(value).toString('base64');
|
|
77
|
-
return `export ${key}=$(echo '${encodedValue}' | base64 -d)`;
|
|
78
|
-
})
|
|
79
|
-
.join(';') + ';';
|
|
80
|
-
command = `${safeEnvExports} ${command}`;
|
|
81
|
-
}
|
|
82
|
-
command = `sh -c "${command}"`;
|
|
83
|
-
const response = await this.apiClient.executeCommand({
|
|
84
|
-
command,
|
|
85
|
-
timeout,
|
|
86
|
-
cwd: cwd,
|
|
87
|
-
});
|
|
88
|
-
// Parse artifacts from the output
|
|
89
|
-
const artifacts = ArtifactParser.parseArtifacts(response.data.result);
|
|
90
|
-
// Return enhanced response with parsed artifacts
|
|
91
|
-
return {
|
|
92
|
-
exitCode: response.data.exitCode ?? response.data.code,
|
|
93
|
-
result: artifacts.stdout,
|
|
94
|
-
artifacts,
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Executes code in the Sandbox using the appropriate language runtime.
|
|
99
|
-
*
|
|
100
|
-
* @param {string} code - Code to execute
|
|
101
|
-
* @param {CodeRunParams} params - Parameters for code execution
|
|
102
|
-
* @param {number} [timeout] - Maximum time in seconds to wait for execution to complete
|
|
103
|
-
* @returns {Promise<ExecuteResponse>} Code execution results containing:
|
|
104
|
-
* - exitCode: The execution's exit status
|
|
105
|
-
* - result: Standard output from the code
|
|
106
|
-
* - artifacts: ExecutionArtifacts object containing `stdout` (same as result) and `charts` (matplotlib charts metadata)
|
|
107
|
-
*
|
|
108
|
-
* @example
|
|
109
|
-
* // Run TypeScript code
|
|
110
|
-
* const response = await process.codeRun(`
|
|
111
|
-
* const x = 10;
|
|
112
|
-
* const y = 20;
|
|
113
|
-
* console.log(\`Sum: \${x + y}\`);
|
|
114
|
-
* `);
|
|
115
|
-
* console.log(response.artifacts.stdout); // Prints: Sum: 30
|
|
116
|
-
*
|
|
117
|
-
* @example
|
|
118
|
-
* // Run Python code with matplotlib
|
|
119
|
-
* const response = await process.codeRun(`
|
|
120
|
-
* import matplotlib.pyplot as plt
|
|
121
|
-
* import numpy as np
|
|
122
|
-
*
|
|
123
|
-
* x = np.linspace(0, 10, 30)
|
|
124
|
-
* y = np.sin(x)
|
|
125
|
-
*
|
|
126
|
-
* plt.figure(figsize=(8, 5))
|
|
127
|
-
* plt.plot(x, y, 'b-', linewidth=2)
|
|
128
|
-
* plt.title('Line Chart')
|
|
129
|
-
* plt.xlabel('X-axis (seconds)')
|
|
130
|
-
* plt.ylabel('Y-axis (amplitude)')
|
|
131
|
-
* plt.grid(True)
|
|
132
|
-
* plt.show()
|
|
133
|
-
* `);
|
|
134
|
-
*
|
|
135
|
-
* if (response.artifacts?.charts) {
|
|
136
|
-
* const chart = response.artifacts.charts[0];
|
|
137
|
-
*
|
|
138
|
-
* console.log(`Type: ${chart.type}`);
|
|
139
|
-
* console.log(`Title: ${chart.title}`);
|
|
140
|
-
* if (chart.type === ChartType.LINE) {
|
|
141
|
-
* const lineChart = chart as LineChart
|
|
142
|
-
* console.log('X Label:', lineChart.x_label)
|
|
143
|
-
* console.log('Y Label:', lineChart.y_label)
|
|
144
|
-
* console.log('X Ticks:', lineChart.x_ticks)
|
|
145
|
-
* console.log('Y Ticks:', lineChart.y_ticks)
|
|
146
|
-
* console.log('X Tick Labels:', lineChart.x_tick_labels)
|
|
147
|
-
* console.log('Y Tick Labels:', lineChart.y_tick_labels)
|
|
148
|
-
* console.log('X Scale:', lineChart.x_scale)
|
|
149
|
-
* console.log('Y Scale:', lineChart.y_scale)
|
|
150
|
-
* console.log('Elements:')
|
|
151
|
-
* console.dir(lineChart.elements, { depth: null })
|
|
152
|
-
* }
|
|
153
|
-
* }
|
|
154
|
-
*/
|
|
155
|
-
async codeRun(code, params, timeout) {
|
|
156
|
-
const runCommand = this.codeToolbox.getRunCommand(code, params);
|
|
157
|
-
return this.executeCommand(runCommand, undefined, params?.env, timeout);
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Creates a new long-running background session in the Sandbox.
|
|
161
|
-
*
|
|
162
|
-
* Sessions are background processes that maintain state between commands, making them ideal for
|
|
163
|
-
* scenarios requiring multiple related commands or persistent environment setup. You can run
|
|
164
|
-
* long-running commands and monitor process status.
|
|
165
|
-
*
|
|
166
|
-
* @param {string} sessionId - Unique identifier for the new session
|
|
167
|
-
* @returns {Promise<void>}
|
|
168
|
-
*
|
|
169
|
-
* @example
|
|
170
|
-
* // Create a new session
|
|
171
|
-
* const sessionId = 'my-session';
|
|
172
|
-
* await process.createSession(sessionId);
|
|
173
|
-
* const session = await process.getSession(sessionId);
|
|
174
|
-
* // Do work...
|
|
175
|
-
* await process.deleteSession(sessionId);
|
|
176
|
-
*/
|
|
177
|
-
async createSession(sessionId) {
|
|
178
|
-
await this.apiClient.createSession({
|
|
179
|
-
sessionId,
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Get a session in the sandbox.
|
|
184
|
-
*
|
|
185
|
-
* @param {string} sessionId - Unique identifier of the session to retrieve
|
|
186
|
-
* @returns {Promise<Session>} Session information including:
|
|
187
|
-
* - sessionId: The session's unique identifier
|
|
188
|
-
* - commands: List of commands executed in the session
|
|
189
|
-
*
|
|
190
|
-
* @example
|
|
191
|
-
* const session = await process.getSession('my-session');
|
|
192
|
-
* session.commands.forEach(cmd => {
|
|
193
|
-
* console.log(`Command: ${cmd.command}`);
|
|
194
|
-
* });
|
|
195
|
-
*/
|
|
196
|
-
async getSession(sessionId) {
|
|
197
|
-
const response = await this.apiClient.getSession(sessionId);
|
|
198
|
-
return response.data;
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Gets information about a specific command executed in a session.
|
|
202
|
-
*
|
|
203
|
-
* @param {string} sessionId - Unique identifier of the session
|
|
204
|
-
* @param {string} commandId - Unique identifier of the command
|
|
205
|
-
* @returns {Promise<Command>} Command information including:
|
|
206
|
-
* - id: The command's unique identifier
|
|
207
|
-
* - command: The executed command string
|
|
208
|
-
* - exitCode: Command's exit status (if completed)
|
|
209
|
-
*
|
|
210
|
-
* @example
|
|
211
|
-
* const cmd = await process.getSessionCommand('my-session', 'cmd-123');
|
|
212
|
-
* if (cmd.exitCode === 0) {
|
|
213
|
-
* console.log(`Command ${cmd.command} completed successfully`);
|
|
214
|
-
* }
|
|
215
|
-
*/
|
|
216
|
-
async getSessionCommand(sessionId, commandId) {
|
|
217
|
-
const response = await this.apiClient.getSessionCommand(sessionId, commandId);
|
|
218
|
-
return response.data;
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Executes a command in an existing session.
|
|
222
|
-
*
|
|
223
|
-
* @param {string} sessionId - Unique identifier of the session to use
|
|
224
|
-
* @param {SessionExecuteRequest} req - Command execution request containing:
|
|
225
|
-
* - command: The command to execute
|
|
226
|
-
* - runAsync: Whether to execute asynchronously
|
|
227
|
-
* @param {number} timeout - Timeout in seconds
|
|
228
|
-
* @returns {Promise<SessionExecuteResponse>} Command execution results containing:
|
|
229
|
-
* - cmdId: Unique identifier for the executed command
|
|
230
|
-
* - output: Combined command output (stdout and stderr) (if synchronous execution)
|
|
231
|
-
* - stdout: Standard output from the command
|
|
232
|
-
* - stderr: Standard error from the command
|
|
233
|
-
* - exitCode: Command exit status (if synchronous execution)
|
|
234
|
-
*
|
|
235
|
-
* @example
|
|
236
|
-
* // Execute commands in sequence, maintaining state
|
|
237
|
-
* const sessionId = 'my-session';
|
|
238
|
-
*
|
|
239
|
-
* // Change directory
|
|
240
|
-
* await process.executeSessionCommand(sessionId, {
|
|
241
|
-
* command: 'cd /home/daytona'
|
|
242
|
-
* });
|
|
243
|
-
*
|
|
244
|
-
* // Run command in new directory
|
|
245
|
-
* const result = await process.executeSessionCommand(sessionId, {
|
|
246
|
-
* command: 'pwd'
|
|
247
|
-
* });
|
|
248
|
-
* console.log('[STDOUT]:', result.stdout);
|
|
249
|
-
* console.log('[STDERR]:', result.stderr);
|
|
250
|
-
*/
|
|
251
|
-
async executeSessionCommand(sessionId, req, timeout) {
|
|
252
|
-
const response = await this.apiClient.sessionExecuteCommand(sessionId, req, timeout ? { timeout: timeout * 1000 } : {});
|
|
253
|
-
// Demux the output if it exists
|
|
254
|
-
if (response.data.output) {
|
|
255
|
-
// Convert string to bytes for demuxing
|
|
256
|
-
const outputBytes = new TextEncoder().encode(response.data.output);
|
|
257
|
-
const demuxedCommandLogs = parseSessionCommandLogs(outputBytes);
|
|
258
|
-
return {
|
|
259
|
-
...response.data,
|
|
260
|
-
stdout: demuxedCommandLogs.stdout,
|
|
261
|
-
stderr: demuxedCommandLogs.stderr,
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
return response.data;
|
|
265
|
-
}
|
|
266
|
-
async getSessionCommandLogs(sessionId, commandId, onStdout, onStderr) {
|
|
267
|
-
if (!onStdout && !onStderr) {
|
|
268
|
-
const response = await this.apiClient.getSessionCommandLogs(sessionId, commandId);
|
|
269
|
-
// Parse the response data if it's available
|
|
270
|
-
if (response.data) {
|
|
271
|
-
// Convert string to bytes for demuxing
|
|
272
|
-
const outputBytes = new TextEncoder().encode(response.data || '');
|
|
273
|
-
const demuxedCommandLogs = parseSessionCommandLogs(outputBytes);
|
|
274
|
-
return {
|
|
275
|
-
output: response.data,
|
|
276
|
-
stdout: demuxedCommandLogs.stdout,
|
|
277
|
-
stderr: demuxedCommandLogs.stderr,
|
|
278
|
-
};
|
|
279
|
-
}
|
|
280
|
-
return {
|
|
281
|
-
output: response.data,
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
await this.ensureToolboxUrl();
|
|
285
|
-
const url = `${this.clientConfig.basePath.replace(/^http/, 'ws')}/process/session/${sessionId}/command/${commandId}/logs?follow=true`;
|
|
286
|
-
const ws = await createSandboxWebSocket(url, this.clientConfig.baseOptions?.headers || {}, this.getPreviewToken);
|
|
287
|
-
await stdDemuxStream(ws, onStdout, onStderr);
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Lists all active sessions in the Sandbox.
|
|
291
|
-
*
|
|
292
|
-
* @returns {Promise<Session[]>} Array of active sessions
|
|
293
|
-
*
|
|
294
|
-
* @example
|
|
295
|
-
* const sessions = await process.listSessions();
|
|
296
|
-
* sessions.forEach(session => {
|
|
297
|
-
* console.log(`Session ${session.sessionId}:`);
|
|
298
|
-
* session.commands.forEach(cmd => {
|
|
299
|
-
* console.log(`- ${cmd.command} (${cmd.exitCode})`);
|
|
300
|
-
* });
|
|
301
|
-
* });
|
|
302
|
-
*/
|
|
303
|
-
async listSessions() {
|
|
304
|
-
const response = await this.apiClient.listSessions();
|
|
305
|
-
return response.data;
|
|
306
|
-
}
|
|
307
|
-
/**
|
|
308
|
-
* Delete a session from the Sandbox.
|
|
309
|
-
*
|
|
310
|
-
* @param {string} sessionId - Unique identifier of the session to delete
|
|
311
|
-
* @returns {Promise<void>}
|
|
312
|
-
*
|
|
313
|
-
* @example
|
|
314
|
-
* // Clean up a completed session
|
|
315
|
-
* await process.deleteSession('my-session');
|
|
316
|
-
*/
|
|
317
|
-
async deleteSession(sessionId) {
|
|
318
|
-
await this.apiClient.deleteSession(sessionId);
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* Create a new PTY (pseudo-terminal) session in the sandbox.
|
|
322
|
-
*
|
|
323
|
-
* Creates an interactive terminal session that can execute commands and handle user input.
|
|
324
|
-
* The PTY session behaves like a real terminal, supporting features like command history.
|
|
325
|
-
*
|
|
326
|
-
* @param {PtyCreateOptions & PtyConnectOptions} options - PTY session configuration including creation and connection options
|
|
327
|
-
* @returns {Promise<PtyHandle>} PTY handle for managing the session
|
|
328
|
-
*
|
|
329
|
-
* @example
|
|
330
|
-
* // Create a PTY session with custom configuration
|
|
331
|
-
* const ptyHandle = await process.createPty({
|
|
332
|
-
* id: 'my-interactive-session',
|
|
333
|
-
* cwd: '/workspace',
|
|
334
|
-
* envs: { TERM: 'xterm-256color', LANG: 'en_US.UTF-8' },
|
|
335
|
-
* cols: 120,
|
|
336
|
-
* rows: 30,
|
|
337
|
-
* onData: (data) => {
|
|
338
|
-
* // Handle terminal output
|
|
339
|
-
* const text = new TextDecoder().decode(data);
|
|
340
|
-
* process.stdout.write(text);
|
|
341
|
-
* },
|
|
342
|
-
* });
|
|
343
|
-
*
|
|
344
|
-
* // Wait for connection to be established
|
|
345
|
-
* await ptyHandle.waitForConnection();
|
|
346
|
-
*
|
|
347
|
-
* // Send commands to the terminal
|
|
348
|
-
* await ptyHandle.sendInput('ls -la\n');
|
|
349
|
-
* await ptyHandle.sendInput('echo "Hello, PTY!"\n');
|
|
350
|
-
* await ptyHandle.sendInput('exit\n');
|
|
351
|
-
*
|
|
352
|
-
* // Wait for completion and get result
|
|
353
|
-
* const result = await ptyHandle.wait();
|
|
354
|
-
* console.log(`PTY session completed with exit code: ${result.exitCode}`);
|
|
355
|
-
*
|
|
356
|
-
* // Clean up
|
|
357
|
-
* await ptyHandle.disconnect();
|
|
358
|
-
*/
|
|
359
|
-
async createPty(options) {
|
|
360
|
-
const request = {
|
|
361
|
-
id: options.id,
|
|
362
|
-
cwd: options.cwd,
|
|
363
|
-
envs: options.envs,
|
|
364
|
-
cols: options.cols,
|
|
365
|
-
rows: options.rows,
|
|
366
|
-
lazyStart: true,
|
|
367
|
-
};
|
|
368
|
-
const response = await this.apiClient.createPtySession(request);
|
|
369
|
-
return await this.connectPty(response.data.sessionId, options);
|
|
370
|
-
}
|
|
371
|
-
/**
|
|
372
|
-
* Connect to an existing PTY session in the sandbox.
|
|
373
|
-
*
|
|
374
|
-
* Establishes a WebSocket connection to an existing PTY session, allowing you to
|
|
375
|
-
* interact with a previously created terminal session.
|
|
376
|
-
*
|
|
377
|
-
* @param {string} sessionId - ID of the PTY session to connect to
|
|
378
|
-
* @param {PtyConnectOptions} options - Options for the connection including data handler
|
|
379
|
-
* @returns {Promise<PtyHandle>} PTY handle for managing the session
|
|
380
|
-
*
|
|
381
|
-
* @example
|
|
382
|
-
* // Connect to an existing PTY session
|
|
383
|
-
* const handle = await process.connectPty('my-session', {
|
|
384
|
-
* onData: (data) => {
|
|
385
|
-
* // Handle terminal output
|
|
386
|
-
* const text = new TextDecoder().decode(data);
|
|
387
|
-
* process.stdout.write(text);
|
|
388
|
-
* },
|
|
389
|
-
* });
|
|
390
|
-
*
|
|
391
|
-
* // Wait for connection to be established
|
|
392
|
-
* await handle.waitForConnection();
|
|
393
|
-
*
|
|
394
|
-
* // Send commands to the existing session
|
|
395
|
-
* await handle.sendInput('pwd\n');
|
|
396
|
-
* await handle.sendInput('ls -la\n');
|
|
397
|
-
* await handle.sendInput('exit\n');
|
|
398
|
-
*
|
|
399
|
-
* // Wait for completion
|
|
400
|
-
* const result = await handle.wait();
|
|
401
|
-
* console.log(`Session exited with code: ${result.exitCode}`);
|
|
402
|
-
*
|
|
403
|
-
* // Clean up
|
|
404
|
-
* await handle.disconnect();
|
|
405
|
-
*/
|
|
406
|
-
async connectPty(sessionId, options) {
|
|
407
|
-
// Get preview link for WebSocket connection
|
|
408
|
-
await this.ensureToolboxUrl();
|
|
409
|
-
const url = `${this.clientConfig.basePath.replace(/^http/, 'ws')}/process/pty/${sessionId}/connect`;
|
|
410
|
-
const ws = await createSandboxWebSocket(url, this.clientConfig.baseOptions?.headers || {}, this.getPreviewToken);
|
|
411
|
-
const handle = new PtyHandle(ws, (cols, rows) => this.resizePtySession(sessionId, cols, rows), () => this.killPtySession(sessionId), options.onData, sessionId);
|
|
412
|
-
await handle.waitForConnection();
|
|
413
|
-
return handle;
|
|
414
|
-
}
|
|
415
|
-
/**
|
|
416
|
-
* List all PTY sessions in the sandbox.
|
|
417
|
-
*
|
|
418
|
-
* Retrieves information about all PTY sessions, both active and inactive,
|
|
419
|
-
* that have been created in this sandbox.
|
|
420
|
-
*
|
|
421
|
-
* @returns {Promise<PtySessionInfo[]>} Array of PTY session information
|
|
422
|
-
*
|
|
423
|
-
* @example
|
|
424
|
-
* // List all PTY sessions
|
|
425
|
-
* const sessions = await process.listPtySessions();
|
|
426
|
-
*
|
|
427
|
-
* for (const session of sessions) {
|
|
428
|
-
* console.log(`Session ID: ${session.id}`);
|
|
429
|
-
* console.log(`Active: ${session.active}`);
|
|
430
|
-
* console.log(`Created: ${session.createdAt}`);
|
|
431
|
-
* }
|
|
432
|
-
* console.log('---');
|
|
433
|
-
* }
|
|
434
|
-
*/
|
|
435
|
-
async listPtySessions() {
|
|
436
|
-
return (await this.apiClient.listPtySessions()).data.sessions;
|
|
437
|
-
}
|
|
438
|
-
/**
|
|
439
|
-
* Get detailed information about a specific PTY session.
|
|
440
|
-
*
|
|
441
|
-
* Retrieves comprehensive information about a PTY session including its current state,
|
|
442
|
-
* configuration, and metadata.
|
|
443
|
-
*
|
|
444
|
-
* @param {string} sessionId - ID of the PTY session to retrieve information for
|
|
445
|
-
* @returns {Promise<PtySessionInfo>} PTY session information
|
|
446
|
-
*
|
|
447
|
-
* @throws {Error} If the PTY session doesn't exist
|
|
448
|
-
*
|
|
449
|
-
* @example
|
|
450
|
-
* // Get details about a specific PTY session
|
|
451
|
-
* const session = await process.getPtySessionInfo('my-session');
|
|
452
|
-
*
|
|
453
|
-
* console.log(`Session ID: ${session.id}`);
|
|
454
|
-
* console.log(`Active: ${session.active}`);
|
|
455
|
-
* console.log(`Working Directory: ${session.cwd}`);
|
|
456
|
-
* console.log(`Terminal Size: ${session.cols}x${session.rows}`);
|
|
457
|
-
*
|
|
458
|
-
* if (session.processId) {
|
|
459
|
-
* console.log(`Process ID: ${session.processId}`);
|
|
460
|
-
* }
|
|
461
|
-
*/
|
|
462
|
-
async getPtySessionInfo(sessionId) {
|
|
463
|
-
return (await this.apiClient.getPtySession(sessionId)).data;
|
|
464
|
-
}
|
|
465
|
-
/**
|
|
466
|
-
* Kill a PTY session and terminate its associated process.
|
|
467
|
-
*
|
|
468
|
-
* Forcefully terminates the PTY session and cleans up all associated resources.
|
|
469
|
-
* This will close any active connections and kill the underlying shell process.
|
|
470
|
-
*
|
|
471
|
-
* @param {string} sessionId - ID of the PTY session to kill
|
|
472
|
-
* @returns {Promise<void>}
|
|
473
|
-
*
|
|
474
|
-
* @throws {Error} If the PTY session doesn't exist or cannot be killed
|
|
475
|
-
*
|
|
476
|
-
* @note This operation is irreversible. Any unsaved work in the terminal session will be lost.
|
|
477
|
-
*
|
|
478
|
-
* @example
|
|
479
|
-
* // Kill a specific PTY session
|
|
480
|
-
* await process.killPtySession('my-session');
|
|
481
|
-
*
|
|
482
|
-
* // Verify the session is no longer active
|
|
483
|
-
* try {
|
|
484
|
-
* const info = await process.getPtySessionInfo('my-session');
|
|
485
|
-
* console.log(`Session still exists but active: ${info.active}`);
|
|
486
|
-
* } catch (error) {
|
|
487
|
-
* console.log('Session has been completely removed');
|
|
488
|
-
* }
|
|
489
|
-
*/
|
|
490
|
-
async killPtySession(sessionId) {
|
|
491
|
-
await this.apiClient.deletePtySession(sessionId);
|
|
492
|
-
}
|
|
493
|
-
/**
|
|
494
|
-
* Resize a PTY session's terminal dimensions.
|
|
495
|
-
*
|
|
496
|
-
* Changes the terminal size of an active PTY session. This is useful when the
|
|
497
|
-
* client terminal is resized or when you need to adjust the display for different
|
|
498
|
-
* output requirements.
|
|
499
|
-
*
|
|
500
|
-
* @param {string} sessionId - ID of the PTY session to resize
|
|
501
|
-
* @param {number} cols - New number of terminal columns
|
|
502
|
-
* @param {number} rows - New number of terminal rows
|
|
503
|
-
* @returns {Promise<PtySessionInfo>} Updated session information reflecting the new terminal size
|
|
504
|
-
*
|
|
505
|
-
* @throws {Error} If the PTY session doesn't exist or resize operation fails
|
|
506
|
-
*
|
|
507
|
-
* @note The resize operation will send a SIGWINCH signal to the shell process,
|
|
508
|
-
* allowing terminal applications to adapt to the new size.
|
|
509
|
-
*
|
|
510
|
-
* @example
|
|
511
|
-
* // Resize a PTY session to a larger terminal
|
|
512
|
-
* const updatedInfo = await process.resizePtySession('my-session', 150, 40);
|
|
513
|
-
* console.log(`Terminal resized to ${updatedInfo.cols}x${updatedInfo.rows}`);
|
|
514
|
-
*
|
|
515
|
-
* // You can also use the PtyHandle's resize method
|
|
516
|
-
* await ptyHandle.resize(150, 40); // cols, rows
|
|
517
|
-
*/
|
|
518
|
-
async resizePtySession(sessionId, cols, rows) {
|
|
519
|
-
return (await this.apiClient.resizePtySession(sessionId, { cols, rows })).data;
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
/**
|
|
523
|
-
* Parse combined stdout/stderr output into separate streams.
|
|
524
|
-
*
|
|
525
|
-
* @param data - Combined log bytes with STDOUT_PREFIX_BYTES and STDERR_PREFIX_BYTES markers
|
|
526
|
-
* @returns Object with separated stdout and stderr strings
|
|
527
|
-
*/
|
|
528
|
-
function parseSessionCommandLogs(data) {
|
|
529
|
-
const [stdoutBytes, stderrBytes] = demuxLog(data);
|
|
530
|
-
// Convert bytes to strings, ignoring potential encoding issues
|
|
531
|
-
const stdoutStr = new TextDecoder('utf-8', { fatal: false }).decode(stdoutBytes);
|
|
532
|
-
const stderrStr = new TextDecoder('utf-8', { fatal: false }).decode(stderrBytes);
|
|
533
|
-
// For backwards compatibility, output field contains the original combined data
|
|
534
|
-
const outputStr = new TextDecoder('utf-8', { fatal: false }).decode(data);
|
|
535
|
-
return {
|
|
536
|
-
output: outputStr,
|
|
537
|
-
stdout: stdoutStr,
|
|
538
|
-
stderr: stderrStr,
|
|
539
|
-
};
|
|
540
|
-
}
|
|
541
|
-
/**
|
|
542
|
-
* Demultiplex combined stdout/stderr log data.
|
|
543
|
-
*
|
|
544
|
-
* @param data - Combined log bytes with STDOUT_PREFIX_BYTES and STDERR_PREFIX_BYTES markers
|
|
545
|
-
* @returns Tuple of [stdout_bytes, stderr_bytes]
|
|
546
|
-
*/
|
|
547
|
-
function demuxLog(data) {
|
|
548
|
-
const outChunks = [];
|
|
549
|
-
const errChunks = [];
|
|
550
|
-
let state = 'none';
|
|
551
|
-
// Forward index (no per-loop re-slicing)
|
|
552
|
-
let i = 0;
|
|
553
|
-
while (i < data.length) {
|
|
554
|
-
// Find the nearest forward marker (stdout or stderr) from current index
|
|
555
|
-
const stdoutIndex = findSubarray(data, STDOUT_PREFIX_BYTES, i);
|
|
556
|
-
const stderrIndex = findSubarray(data, STDERR_PREFIX_BYTES, i);
|
|
557
|
-
// Pick the closest marker index and type
|
|
558
|
-
let nextIdx = -1;
|
|
559
|
-
let nextMarker = null;
|
|
560
|
-
let nextLen = 0;
|
|
561
|
-
if (stdoutIndex !== -1 && (stderrIndex === -1 || stdoutIndex < stderrIndex)) {
|
|
562
|
-
nextIdx = stdoutIndex;
|
|
563
|
-
nextMarker = 'stdout';
|
|
564
|
-
nextLen = STDOUT_PREFIX_BYTES.length;
|
|
565
|
-
}
|
|
566
|
-
else if (stderrIndex !== -1) {
|
|
567
|
-
nextIdx = stderrIndex;
|
|
568
|
-
nextMarker = 'stderr';
|
|
569
|
-
nextLen = STDERR_PREFIX_BYTES.length;
|
|
570
|
-
}
|
|
571
|
-
if (nextIdx === -1) {
|
|
572
|
-
// No more markers → dump remainder into current state
|
|
573
|
-
if (state === 'stdout') {
|
|
574
|
-
outChunks.push(data.subarray(i));
|
|
575
|
-
}
|
|
576
|
-
else if (state === 'stderr') {
|
|
577
|
-
errChunks.push(data.subarray(i));
|
|
578
|
-
}
|
|
579
|
-
break;
|
|
580
|
-
}
|
|
581
|
-
// Write everything before the marker into current state
|
|
582
|
-
if (state === 'stdout' && nextIdx > i) {
|
|
583
|
-
outChunks.push(data.subarray(i, nextIdx));
|
|
584
|
-
}
|
|
585
|
-
else if (state === 'stderr' && nextIdx > i) {
|
|
586
|
-
errChunks.push(data.subarray(i, nextIdx));
|
|
587
|
-
}
|
|
588
|
-
// Advance past marker and switch state
|
|
589
|
-
i = nextIdx + nextLen;
|
|
590
|
-
if (nextMarker) {
|
|
591
|
-
state = nextMarker;
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
// Concatenate all chunks
|
|
595
|
-
return [concatenateUint8Arrays(outChunks), concatenateUint8Arrays(errChunks)];
|
|
596
|
-
}
|
|
597
|
-
/**
|
|
598
|
-
* Efficiently concatenate multiple Uint8Array chunks into a single Uint8Array.
|
|
599
|
-
*
|
|
600
|
-
* @param chunks - Array of Uint8Array chunks to concatenate
|
|
601
|
-
* @returns A single Uint8Array containing all chunks
|
|
602
|
-
*/
|
|
603
|
-
function concatenateUint8Arrays(chunks) {
|
|
604
|
-
if (chunks.length === 0) {
|
|
605
|
-
return new Uint8Array(0);
|
|
606
|
-
}
|
|
607
|
-
if (chunks.length === 1) {
|
|
608
|
-
return chunks[0];
|
|
609
|
-
}
|
|
610
|
-
const totalLength = chunks.reduce((sum, chunk) => sum + chunk.length, 0);
|
|
611
|
-
const result = new Uint8Array(totalLength);
|
|
612
|
-
let offset = 0;
|
|
613
|
-
for (const chunk of chunks) {
|
|
614
|
-
result.set(chunk, offset);
|
|
615
|
-
offset += chunk.length;
|
|
616
|
-
}
|
|
617
|
-
return result;
|
|
618
|
-
}
|
|
619
|
-
/**
|
|
620
|
-
* Helper function to find a subarray within a larger array.
|
|
621
|
-
*
|
|
622
|
-
* @param haystack - The array to search in
|
|
623
|
-
* @param needle - The subarray to find
|
|
624
|
-
* @param fromIndex - starting index
|
|
625
|
-
* @returns The index of the first occurrence, or -1 if not found
|
|
626
|
-
*/
|
|
627
|
-
function findSubarray(haystack, needle, fromIndex = 0) {
|
|
628
|
-
if (needle.length === 0)
|
|
629
|
-
return 0;
|
|
630
|
-
if (haystack.length < needle.length || fromIndex < 0 || fromIndex > haystack.length - needle.length)
|
|
631
|
-
return -1;
|
|
632
|
-
const limit = haystack.length - needle.length;
|
|
633
|
-
for (let i = fromIndex; i <= limit; i++) {
|
|
634
|
-
let j = 0;
|
|
635
|
-
for (; j < needle.length; j++) {
|
|
636
|
-
if (haystack[i + j] !== needle[j])
|
|
637
|
-
break;
|
|
638
|
-
}
|
|
639
|
-
if (j === needle.length)
|
|
640
|
-
return i;
|
|
641
|
-
}
|
|
642
|
-
return -1;
|
|
643
|
-
}
|
|
644
|
-
//# sourceMappingURL=Process.js.map
|
package/esm/Process.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Process.js","sourceRoot":"","sources":["../../../../../libs/sdk-typescript/src/Process.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAE1D,6DAA6D;AAC7D,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,UAAU,CAAC,CAAC,IAAI,EAAE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