@vm0/cli 9.132.9 → 9.132.11
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-MPUU27KS.js → chunk-S72CJD3V.js} +34 -25
- package/{chunk-MPUU27KS.js.map → chunk-S72CJD3V.js.map} +1 -1
- package/index.js +9 -9
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/zero.js +121 -39
- package/zero.js.map +1 -1
package/package.json
CHANGED
package/zero.js
CHANGED
|
@@ -112,7 +112,7 @@ import {
|
|
|
112
112
|
upsertZeroOrgModelProvider,
|
|
113
113
|
withErrorHandler,
|
|
114
114
|
zeroAgentCustomSkillNameSchema
|
|
115
|
-
} from "./chunk-
|
|
115
|
+
} from "./chunk-S72CJD3V.js";
|
|
116
116
|
import {
|
|
117
117
|
__toESM,
|
|
118
118
|
init_esm_shims
|
|
@@ -13875,6 +13875,11 @@ var FEATURE_SWITCHES = {
|
|
|
13875
13875
|
description: "Enable the PostHog analytics connector",
|
|
13876
13876
|
enabled: false
|
|
13877
13877
|
},
|
|
13878
|
+
["pwaOfflineCache" /* PwaOfflineCache */]: {
|
|
13879
|
+
maintainer: "ethan@vm0.ai",
|
|
13880
|
+
description: "Enable PWA offline caching (static asset cache-first, offline fallback page, and service worker updateViaCache: none)",
|
|
13881
|
+
enabled: false
|
|
13882
|
+
},
|
|
13878
13883
|
["mailchimpConnector" /* MailchimpConnector */]: {
|
|
13879
13884
|
maintainer: "ethan@vm0.ai",
|
|
13880
13885
|
description: "Enable the Mailchimp email marketing connector",
|
|
@@ -13992,6 +13997,12 @@ var FEATURE_SWITCHES = {
|
|
|
13992
13997
|
enabled: false,
|
|
13993
13998
|
enabledOrgIdHashes: STAFF_ORG_ID_HASHES
|
|
13994
13999
|
},
|
|
14000
|
+
["telegramIntegration" /* TelegramIntegration */]: {
|
|
14001
|
+
maintainer: "ethan@vm0.ai",
|
|
14002
|
+
description: "Show the Telegram integration settings UI. The backend Telegram routes do not consult this frontend rollout flag.",
|
|
14003
|
+
enabled: false,
|
|
14004
|
+
enabledOrgIdHashes: STAFF_ORG_ID_HASHES
|
|
14005
|
+
},
|
|
13995
14006
|
["trinity" /* Trinity */]: {
|
|
13996
14007
|
maintainer: "ethan@vm0.ai",
|
|
13997
14008
|
description: "Embed the voice-chat mic toggle + voice-mode layout into the agent chat page. Gates the mic launcher, composer swap, and status/subtitle/task-card UI.",
|
|
@@ -15271,6 +15282,12 @@ init_esm_shims();
|
|
|
15271
15282
|
|
|
15272
15283
|
// src/commands/zero/run/shared.ts
|
|
15273
15284
|
init_esm_shims();
|
|
15285
|
+
var TERMINAL_RUN_STATUSES = [
|
|
15286
|
+
"completed",
|
|
15287
|
+
"failed",
|
|
15288
|
+
"timeout",
|
|
15289
|
+
"cancelled"
|
|
15290
|
+
];
|
|
15274
15291
|
function toRunResult(result) {
|
|
15275
15292
|
const { checkpointId, agentSessionId, conversationId } = result;
|
|
15276
15293
|
if (!checkpointId || !agentSessionId || !conversationId) {
|
|
@@ -15278,62 +15295,127 @@ function toRunResult(result) {
|
|
|
15278
15295
|
}
|
|
15279
15296
|
return { checkpointId, agentSessionId, conversationId };
|
|
15280
15297
|
}
|
|
15298
|
+
function filterContiguousEvents(events, lastSequence) {
|
|
15299
|
+
const contiguousEvents = [];
|
|
15300
|
+
let expectedSequence = lastSequence + 1;
|
|
15301
|
+
for (const event of events) {
|
|
15302
|
+
if (event.sequenceNumber < expectedSequence) {
|
|
15303
|
+
continue;
|
|
15304
|
+
}
|
|
15305
|
+
if (event.sequenceNumber !== expectedSequence) {
|
|
15306
|
+
break;
|
|
15307
|
+
}
|
|
15308
|
+
contiguousEvents.push(event);
|
|
15309
|
+
expectedSequence++;
|
|
15310
|
+
}
|
|
15311
|
+
return contiguousEvents;
|
|
15312
|
+
}
|
|
15313
|
+
var POLL_INTERVAL_MS = 1e3;
|
|
15314
|
+
var TERMINAL_DRAIN_POLL_INTERVAL_MS = 500;
|
|
15315
|
+
var TERMINAL_DRAIN_IDLE_MS = 1e3;
|
|
15316
|
+
var TERMINAL_DRAIN_MAX_MS = 3e3;
|
|
15317
|
+
function isTerminalRunResponse(runResponse) {
|
|
15318
|
+
return TERMINAL_RUN_STATUSES.includes(
|
|
15319
|
+
runResponse.status
|
|
15320
|
+
);
|
|
15321
|
+
}
|
|
15322
|
+
function shouldDrainNextEventPage(eventsResponse, contiguousEvents) {
|
|
15323
|
+
return eventsResponse.hasMore && contiguousEvents.length > 0 && contiguousEvents.length === eventsResponse.events.length;
|
|
15324
|
+
}
|
|
15325
|
+
function hasSequenceGap(eventsResponse, contiguousEvents) {
|
|
15326
|
+
return eventsResponse.events.length > 0 && contiguousEvents.length < eventsResponse.events.length;
|
|
15327
|
+
}
|
|
15328
|
+
function shouldCompleteTerminalDrain(terminalSeenAt, lastTerminalProgressAt, blockedByGap) {
|
|
15329
|
+
const now = Date.now();
|
|
15330
|
+
const terminalElapsedMs = now - terminalSeenAt;
|
|
15331
|
+
const terminalIdleMs = now - lastTerminalProgressAt;
|
|
15332
|
+
return terminalElapsedMs >= TERMINAL_DRAIN_MAX_MS || !blockedByGap && terminalIdleMs >= TERMINAL_DRAIN_IDLE_MS;
|
|
15333
|
+
}
|
|
15334
|
+
function renderTerminalRunResult(runId, runResponse) {
|
|
15335
|
+
if (runResponse.status === "completed") {
|
|
15336
|
+
EventRenderer.renderRunCompleted(
|
|
15337
|
+
runResponse.result ? toRunResult(runResponse.result) : void 0
|
|
15338
|
+
);
|
|
15339
|
+
return {
|
|
15340
|
+
succeeded: true,
|
|
15341
|
+
runId,
|
|
15342
|
+
sessionId: runResponse.result?.agentSessionId,
|
|
15343
|
+
checkpointId: runResponse.result?.checkpointId
|
|
15344
|
+
};
|
|
15345
|
+
}
|
|
15346
|
+
if (runResponse.status === "failed") {
|
|
15347
|
+
EventRenderer.renderRunFailed(runResponse.error, runId);
|
|
15348
|
+
return { succeeded: false, runId };
|
|
15349
|
+
}
|
|
15350
|
+
if (runResponse.status === "timeout") {
|
|
15351
|
+
console.error(source_default.red("\n\u2717 Run timed out"));
|
|
15352
|
+
return { succeeded: false, runId };
|
|
15353
|
+
}
|
|
15354
|
+
console.error(source_default.yellow("\n\u2717 Run cancelled"));
|
|
15355
|
+
return { succeeded: false, runId };
|
|
15356
|
+
}
|
|
15357
|
+
function sleep(ms) {
|
|
15358
|
+
return new Promise((resolve) => {
|
|
15359
|
+
return setTimeout(resolve, ms);
|
|
15360
|
+
});
|
|
15361
|
+
}
|
|
15281
15362
|
async function pollZeroEvents(runId, options) {
|
|
15282
15363
|
const renderer = new EventRenderer({ verbose: options?.verbose });
|
|
15283
15364
|
let lastSequence = -1;
|
|
15284
15365
|
let complete = false;
|
|
15285
15366
|
let result = { succeeded: true, runId };
|
|
15286
|
-
|
|
15367
|
+
let terminalRunResponse;
|
|
15368
|
+
let terminalSeenAt = 0;
|
|
15369
|
+
let lastTerminalProgressAt = 0;
|
|
15287
15370
|
while (!complete) {
|
|
15288
15371
|
const eventsResponse = await getZeroRunAgentEvents(runId, {
|
|
15289
15372
|
since: lastSequence,
|
|
15290
15373
|
limit: 100,
|
|
15291
15374
|
order: "asc"
|
|
15292
15375
|
});
|
|
15293
|
-
|
|
15376
|
+
const contiguousEvents = filterContiguousEvents(
|
|
15377
|
+
eventsResponse.events,
|
|
15378
|
+
lastSequence
|
|
15379
|
+
);
|
|
15380
|
+
for (const event of contiguousEvents) {
|
|
15294
15381
|
const eventData = event.eventData;
|
|
15295
15382
|
const parsed = parseEvent(eventData);
|
|
15296
15383
|
if (parsed) {
|
|
15297
15384
|
renderer.render(parsed);
|
|
15298
15385
|
}
|
|
15299
15386
|
}
|
|
15300
|
-
if (
|
|
15301
|
-
lastSequence =
|
|
15302
|
-
|
|
15303
|
-
|
|
15304
|
-
|
|
15305
|
-
|
|
15387
|
+
if (contiguousEvents.length > 0) {
|
|
15388
|
+
lastSequence = contiguousEvents[contiguousEvents.length - 1].sequenceNumber;
|
|
15389
|
+
if (terminalRunResponse) {
|
|
15390
|
+
lastTerminalProgressAt = Date.now();
|
|
15391
|
+
}
|
|
15392
|
+
}
|
|
15393
|
+
const blockedByGap = hasSequenceGap(eventsResponse, contiguousEvents);
|
|
15394
|
+
if (shouldDrainNextEventPage(eventsResponse, contiguousEvents)) {
|
|
15395
|
+
continue;
|
|
15306
15396
|
}
|
|
15307
15397
|
const runResponse = await getZeroRun(runId);
|
|
15308
|
-
|
|
15309
|
-
|
|
15310
|
-
|
|
15311
|
-
|
|
15312
|
-
|
|
15313
|
-
|
|
15314
|
-
|
|
15315
|
-
|
|
15316
|
-
|
|
15317
|
-
|
|
15318
|
-
|
|
15319
|
-
|
|
15320
|
-
|
|
15321
|
-
|
|
15322
|
-
|
|
15323
|
-
|
|
15324
|
-
} else if (runStatus === "timeout") {
|
|
15325
|
-
complete = true;
|
|
15326
|
-
console.error(source_default.red("\n\u2717 Run timed out"));
|
|
15327
|
-
result = { succeeded: false, runId };
|
|
15328
|
-
} else if (runStatus === "cancelled") {
|
|
15329
|
-
complete = true;
|
|
15330
|
-
console.error(source_default.yellow("\n\u2717 Run cancelled"));
|
|
15331
|
-
result = { succeeded: false, runId };
|
|
15398
|
+
if (isTerminalRunResponse(runResponse)) {
|
|
15399
|
+
if (!terminalRunResponse) {
|
|
15400
|
+
terminalSeenAt = Date.now();
|
|
15401
|
+
lastTerminalProgressAt = terminalSeenAt;
|
|
15402
|
+
}
|
|
15403
|
+
terminalRunResponse = runResponse;
|
|
15404
|
+
}
|
|
15405
|
+
if (terminalRunResponse) {
|
|
15406
|
+
if (shouldCompleteTerminalDrain(
|
|
15407
|
+
terminalSeenAt,
|
|
15408
|
+
lastTerminalProgressAt,
|
|
15409
|
+
blockedByGap
|
|
15410
|
+
)) {
|
|
15411
|
+
result = renderTerminalRunResult(runId, terminalRunResponse);
|
|
15412
|
+
complete = true;
|
|
15413
|
+
}
|
|
15332
15414
|
}
|
|
15333
15415
|
if (!complete) {
|
|
15334
|
-
await
|
|
15335
|
-
|
|
15336
|
-
|
|
15416
|
+
await sleep(
|
|
15417
|
+
terminalRunResponse ? TERMINAL_DRAIN_POLL_INTERVAL_MS : POLL_INTERVAL_MS
|
|
15418
|
+
);
|
|
15337
15419
|
}
|
|
15338
15420
|
}
|
|
15339
15421
|
return result;
|
|
@@ -17788,7 +17870,7 @@ async function getScreenInfo() {
|
|
|
17788
17870
|
init_esm_shims();
|
|
17789
17871
|
import { execFile as execFile2 } from "child_process";
|
|
17790
17872
|
import { promisify as promisify2 } from "util";
|
|
17791
|
-
import { setTimeout as
|
|
17873
|
+
import { setTimeout as sleep2 } from "timers/promises";
|
|
17792
17874
|
var execFileAsync2 = promisify2(execFile2);
|
|
17793
17875
|
async function leftClickDrag(startX, startY, endX, endY) {
|
|
17794
17876
|
await execFileAsync2("cliclick", [
|
|
@@ -17921,7 +18003,7 @@ async function holdKey(keys, durationMs) {
|
|
|
17921
18003
|
return `ku:${k}`;
|
|
17922
18004
|
});
|
|
17923
18005
|
await execFileAsync2("cliclick", downArgs);
|
|
17924
|
-
await
|
|
18006
|
+
await sleep2(durationMs);
|
|
17925
18007
|
await execFileAsync2("cliclick", upArgs);
|
|
17926
18008
|
}
|
|
17927
18009
|
async function typeText(text) {
|
|
@@ -18820,7 +18902,7 @@ function registerZeroCommands(prog, commands) {
|
|
|
18820
18902
|
var program = new Command();
|
|
18821
18903
|
program.name("zero").description(
|
|
18822
18904
|
"Zero CLI \u2014 interact with the zero platform from inside the sandbox"
|
|
18823
|
-
).version("9.132.
|
|
18905
|
+
).version("9.132.11").addHelpText(
|
|
18824
18906
|
"after",
|
|
18825
18907
|
`
|
|
18826
18908
|
Examples:
|