@vm0/cli 9.177.10 → 9.177.12
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/{chunk-AXV23NAE.js → chunk-6E4KIIR5.js} +90 -16
- package/{chunk-AXV23NAE.js.map → chunk-6E4KIIR5.js.map} +1 -1
- package/index.js +14 -11
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/zero.js +37 -6
- package/zero.js.map +1 -1
package/package.json
CHANGED
package/zero.js
CHANGED
|
@@ -48,6 +48,7 @@ import {
|
|
|
48
48
|
downloadWebFile,
|
|
49
49
|
enableZeroSchedule,
|
|
50
50
|
extractSecretNamesFromApis,
|
|
51
|
+
fetchComputerUseScreenshot,
|
|
51
52
|
findMatchingPermissions,
|
|
52
53
|
generateWebImage,
|
|
53
54
|
generateWebVideo,
|
|
@@ -146,7 +147,7 @@ import {
|
|
|
146
147
|
upsertZeroOrgModelProvider,
|
|
147
148
|
withErrorHandler,
|
|
148
149
|
zeroAgentCustomSkillNameSchema
|
|
149
|
-
} from "./chunk-
|
|
150
|
+
} from "./chunk-6E4KIIR5.js";
|
|
150
151
|
import {
|
|
151
152
|
__toESM,
|
|
152
153
|
init_esm_shims
|
|
@@ -6789,6 +6790,24 @@ async function writeScreenshotDataUrl(result, dataUrl) {
|
|
|
6789
6790
|
await writeFile(outputPath, Buffer.from(base64Data, "base64"));
|
|
6790
6791
|
return outputPath;
|
|
6791
6792
|
}
|
|
6793
|
+
function screenshotPointerType(value) {
|
|
6794
|
+
if (typeof value !== "object" || value === null) {
|
|
6795
|
+
return null;
|
|
6796
|
+
}
|
|
6797
|
+
const type = value.type;
|
|
6798
|
+
return type === "s3" || type === "expired" ? type : null;
|
|
6799
|
+
}
|
|
6800
|
+
async function writeScreenshotBytes(result, buffer, mimeType) {
|
|
6801
|
+
const appName = sanitizeFilenamePart(result.app, "app");
|
|
6802
|
+
const snapshotId = sanitizeFilenamePart(result.snapshotId, "snapshot");
|
|
6803
|
+
const outputPath = join6(
|
|
6804
|
+
COMPUTER_USE_OUTPUT_DIR,
|
|
6805
|
+
`${appName}-${snapshotId}.${extensionForMimeType(mimeType)}`
|
|
6806
|
+
);
|
|
6807
|
+
await mkdir(COMPUTER_USE_OUTPUT_DIR, { recursive: true });
|
|
6808
|
+
await writeFile(outputPath, buffer);
|
|
6809
|
+
return outputPath;
|
|
6810
|
+
}
|
|
6792
6811
|
async function writeAppStateText(result, appState) {
|
|
6793
6812
|
const appName = sanitizeFilenamePart(result.app, "app");
|
|
6794
6813
|
const snapshotId = sanitizeFilenamePart(result.snapshotId, "snapshot");
|
|
@@ -6809,7 +6828,7 @@ function compactActionResult(action) {
|
|
|
6809
6828
|
}
|
|
6810
6829
|
return compact;
|
|
6811
6830
|
}
|
|
6812
|
-
async function formatComputerUseResultForConsole(result) {
|
|
6831
|
+
async function formatComputerUseResultForConsole(result, commandId) {
|
|
6813
6832
|
const printable = { status: "succeeded" };
|
|
6814
6833
|
const apps = result.apps;
|
|
6815
6834
|
if (Array.isArray(apps)) {
|
|
@@ -6823,10 +6842,22 @@ async function formatComputerUseResultForConsole(result) {
|
|
|
6823
6842
|
if (appState) {
|
|
6824
6843
|
printable.appState = await writeAppStateText(result, appState);
|
|
6825
6844
|
}
|
|
6826
|
-
const screenshot =
|
|
6827
|
-
if (screenshot) {
|
|
6845
|
+
const screenshot = result.screenshot;
|
|
6846
|
+
if (typeof screenshot === "string") {
|
|
6828
6847
|
const screenshotPath = await writeScreenshotDataUrl(result, screenshot);
|
|
6829
6848
|
printable.screenshot = screenshotPath ?? screenshot;
|
|
6849
|
+
} else {
|
|
6850
|
+
const pointerType = screenshotPointerType(screenshot);
|
|
6851
|
+
if (pointerType === "s3") {
|
|
6852
|
+
const { buffer, mimeType } = await fetchComputerUseScreenshot(commandId);
|
|
6853
|
+
printable.screenshot = await writeScreenshotBytes(
|
|
6854
|
+
result,
|
|
6855
|
+
buffer,
|
|
6856
|
+
mimeType
|
|
6857
|
+
);
|
|
6858
|
+
} else if (pointerType === "expired") {
|
|
6859
|
+
printable.screenshot = "[screenshot expired]";
|
|
6860
|
+
}
|
|
6830
6861
|
}
|
|
6831
6862
|
const action = result.action;
|
|
6832
6863
|
if (isRecord(action)) {
|
|
@@ -6838,7 +6869,7 @@ async function commandOutputText(command) {
|
|
|
6838
6869
|
if (!command.result) {
|
|
6839
6870
|
return "";
|
|
6840
6871
|
}
|
|
6841
|
-
return await formatComputerUseResultForConsole(command.result);
|
|
6872
|
+
return await formatComputerUseResultForConsole(command.result, command.id);
|
|
6842
6873
|
}
|
|
6843
6874
|
async function waitForCommand(commandId, timeoutSeconds) {
|
|
6844
6875
|
const deadline = Date.now() + timeoutSeconds * 1e3;
|
|
@@ -13198,7 +13229,7 @@ function registerZeroCommands(prog, commands) {
|
|
|
13198
13229
|
var program = new Command();
|
|
13199
13230
|
program.name("zero").description(
|
|
13200
13231
|
"Zero CLI \u2014 interact with the zero platform from inside the sandbox"
|
|
13201
|
-
).version("9.177.
|
|
13232
|
+
).version("9.177.12").addHelpText("after", () => {
|
|
13202
13233
|
return buildZeroHelpText();
|
|
13203
13234
|
});
|
|
13204
13235
|
if (process.argv[1]?.endsWith("zero.js") || process.argv[1]?.endsWith("zero.ts") || process.argv[1]?.endsWith("zero")) {
|