@autohq/cli 0.1.211 → 0.1.212
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/dist/agent-bridge.js +3 -1
- package/dist/index.js +127 -12
- package/package.json +1 -1
package/dist/agent-bridge.js
CHANGED
|
@@ -23083,6 +23083,8 @@ var E2bLifecycleWebhookEventSchema = external_exports.object({
|
|
|
23083
23083
|
var RUNTIME_LOG_LEVELS = ["debug", "info", "warn", "error"];
|
|
23084
23084
|
var RuntimeLogLevelSchema = external_exports.enum(RUNTIME_LOG_LEVELS);
|
|
23085
23085
|
var DEFAULT_RUNTIME_LOG_LEVEL = "info";
|
|
23086
|
+
var SANDBOX_RUNTIME_LOG_DIR = "/home/user/.auto-runtime";
|
|
23087
|
+
var SANDBOX_RUNTIME_LOG_PATH = `${SANDBOX_RUNTIME_LOG_DIR}/agent-bridge.log`;
|
|
23086
23088
|
var LEVEL_SEVERITY = {
|
|
23087
23089
|
debug: 10,
|
|
23088
23090
|
info: 20,
|
|
@@ -26785,7 +26787,7 @@ Object.assign(lookup, {
|
|
|
26785
26787
|
// package.json
|
|
26786
26788
|
var package_default = {
|
|
26787
26789
|
name: "@autohq/cli",
|
|
26788
|
-
version: "0.1.
|
|
26790
|
+
version: "0.1.212",
|
|
26789
26791
|
license: "SEE LICENSE IN README.md",
|
|
26790
26792
|
publishConfig: {
|
|
26791
26793
|
access: "public"
|
package/dist/index.js
CHANGED
|
@@ -18998,7 +18998,7 @@ function parseRuntimeLogLevel(value) {
|
|
|
18998
18998
|
function runtimeLogLevelEnabled(configured, lineLevel) {
|
|
18999
18999
|
return LEVEL_SEVERITY[lineLevel] >= LEVEL_SEVERITY[configured];
|
|
19000
19000
|
}
|
|
19001
|
-
var RUNTIME_LOG_LEVELS, RuntimeLogLevelSchema, DEFAULT_RUNTIME_LOG_LEVEL, LEVEL_SEVERITY;
|
|
19001
|
+
var RUNTIME_LOG_LEVELS, RuntimeLogLevelSchema, DEFAULT_RUNTIME_LOG_LEVEL, SANDBOX_RUNTIME_LOG_DIR, SANDBOX_RUNTIME_LOG_PATH, LEVEL_SEVERITY;
|
|
19002
19002
|
var init_runtime_log = __esm({
|
|
19003
19003
|
"../../packages/schemas/src/runtime-log.ts"() {
|
|
19004
19004
|
"use strict";
|
|
@@ -19006,6 +19006,8 @@ var init_runtime_log = __esm({
|
|
|
19006
19006
|
RUNTIME_LOG_LEVELS = ["debug", "info", "warn", "error"];
|
|
19007
19007
|
RuntimeLogLevelSchema = external_exports.enum(RUNTIME_LOG_LEVELS);
|
|
19008
19008
|
DEFAULT_RUNTIME_LOG_LEVEL = "info";
|
|
19009
|
+
SANDBOX_RUNTIME_LOG_DIR = "/home/user/.auto-runtime";
|
|
19010
|
+
SANDBOX_RUNTIME_LOG_PATH = `${SANDBOX_RUNTIME_LOG_DIR}/agent-bridge.log`;
|
|
19009
19011
|
LEVEL_SEVERITY = {
|
|
19010
19012
|
debug: 10,
|
|
19011
19013
|
info: 20,
|
|
@@ -21812,7 +21814,7 @@ var init_package = __esm({
|
|
|
21812
21814
|
"package.json"() {
|
|
21813
21815
|
package_default = {
|
|
21814
21816
|
name: "@autohq/cli",
|
|
21815
|
-
version: "0.1.
|
|
21817
|
+
version: "0.1.212",
|
|
21816
21818
|
license: "SEE LICENSE IN README.md",
|
|
21817
21819
|
publishConfig: {
|
|
21818
21820
|
access: "public"
|
|
@@ -30095,7 +30097,7 @@ __export(launcher_exports, {
|
|
|
30095
30097
|
launch: () => launch
|
|
30096
30098
|
});
|
|
30097
30099
|
import { spawnSync } from "child_process";
|
|
30098
|
-
import { existsSync as
|
|
30100
|
+
import { existsSync as existsSync5 } from "fs";
|
|
30099
30101
|
import { dirname as dirname6, resolve as resolve3 } from "path";
|
|
30100
30102
|
import { fileURLToPath } from "url";
|
|
30101
30103
|
import {
|
|
@@ -30290,7 +30292,7 @@ function resolveLatestReleaseVersionFromCheckout() {
|
|
|
30290
30292
|
function findRepoRoot(startDirectory) {
|
|
30291
30293
|
let directory = startDirectory;
|
|
30292
30294
|
while (true) {
|
|
30293
|
-
if (
|
|
30295
|
+
if (existsSync5(resolve3(directory, ".git")) && existsSync5(resolve3(directory, "apps/cli/package.json"))) {
|
|
30294
30296
|
return directory;
|
|
30295
30297
|
}
|
|
30296
30298
|
const parent = dirname6(directory);
|
|
@@ -34977,6 +34979,118 @@ function acceptedInvitationLine(response) {
|
|
|
34977
34979
|
].join(" ");
|
|
34978
34980
|
}
|
|
34979
34981
|
|
|
34982
|
+
// src/commands/logs/commands.ts
|
|
34983
|
+
init_src();
|
|
34984
|
+
|
|
34985
|
+
// src/commands/logs/actions.ts
|
|
34986
|
+
import {
|
|
34987
|
+
closeSync,
|
|
34988
|
+
existsSync as existsSync4,
|
|
34989
|
+
openSync,
|
|
34990
|
+
readFileSync as readFileSync6,
|
|
34991
|
+
readSync,
|
|
34992
|
+
statSync as statSync3
|
|
34993
|
+
} from "fs";
|
|
34994
|
+
var DEFAULT_POLL_INTERVAL_MS = 1e3;
|
|
34995
|
+
async function tailRuntimeLog(input) {
|
|
34996
|
+
if (!existsSync4(input.path)) {
|
|
34997
|
+
input.writeError(`No runtime log at ${input.path}`);
|
|
34998
|
+
return;
|
|
34999
|
+
}
|
|
35000
|
+
const content = readFileSync6(input.path, "utf8");
|
|
35001
|
+
for (const line of selectLastLines(content, input.lines)) {
|
|
35002
|
+
input.writeOutput(line);
|
|
35003
|
+
}
|
|
35004
|
+
if (input.follow) {
|
|
35005
|
+
await followRuntimeLog({
|
|
35006
|
+
path: input.path,
|
|
35007
|
+
fromByte: Buffer.byteLength(content, "utf8"),
|
|
35008
|
+
pollIntervalMs: input.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS,
|
|
35009
|
+
writeOutput: input.writeOutput,
|
|
35010
|
+
signal: input.signal
|
|
35011
|
+
});
|
|
35012
|
+
}
|
|
35013
|
+
}
|
|
35014
|
+
function selectLastLines(content, count) {
|
|
35015
|
+
const lines = content.split("\n").filter((line) => line.length > 0);
|
|
35016
|
+
return count >= lines.length ? lines : lines.slice(lines.length - count);
|
|
35017
|
+
}
|
|
35018
|
+
async function followRuntimeLog(input) {
|
|
35019
|
+
let offset = input.fromByte;
|
|
35020
|
+
while (!input.signal?.aborted) {
|
|
35021
|
+
await delay(input.pollIntervalMs, input.signal);
|
|
35022
|
+
if (input.signal?.aborted) {
|
|
35023
|
+
return;
|
|
35024
|
+
}
|
|
35025
|
+
let size;
|
|
35026
|
+
try {
|
|
35027
|
+
size = statSync3(input.path).size;
|
|
35028
|
+
} catch {
|
|
35029
|
+
continue;
|
|
35030
|
+
}
|
|
35031
|
+
if (size < offset) {
|
|
35032
|
+
offset = 0;
|
|
35033
|
+
}
|
|
35034
|
+
if (size <= offset) {
|
|
35035
|
+
continue;
|
|
35036
|
+
}
|
|
35037
|
+
const chunk = readByteRange(input.path, offset, size - offset);
|
|
35038
|
+
offset = size;
|
|
35039
|
+
for (const line of chunk.split("\n")) {
|
|
35040
|
+
if (line.length > 0) {
|
|
35041
|
+
input.writeOutput(line);
|
|
35042
|
+
}
|
|
35043
|
+
}
|
|
35044
|
+
}
|
|
35045
|
+
}
|
|
35046
|
+
function readByteRange(path2, offset, length) {
|
|
35047
|
+
const buffer = Buffer.alloc(length);
|
|
35048
|
+
const fd = openSync(path2, "r");
|
|
35049
|
+
try {
|
|
35050
|
+
readSync(fd, buffer, 0, length, offset);
|
|
35051
|
+
} finally {
|
|
35052
|
+
closeSync(fd);
|
|
35053
|
+
}
|
|
35054
|
+
return buffer.toString("utf8");
|
|
35055
|
+
}
|
|
35056
|
+
function delay(ms, signal) {
|
|
35057
|
+
return new Promise((resolve4) => {
|
|
35058
|
+
const timer = setTimeout(resolve4, ms);
|
|
35059
|
+
signal?.addEventListener(
|
|
35060
|
+
"abort",
|
|
35061
|
+
() => {
|
|
35062
|
+
clearTimeout(timer);
|
|
35063
|
+
resolve4();
|
|
35064
|
+
},
|
|
35065
|
+
{ once: true }
|
|
35066
|
+
);
|
|
35067
|
+
});
|
|
35068
|
+
}
|
|
35069
|
+
|
|
35070
|
+
// src/commands/logs/commands.ts
|
|
35071
|
+
var DEFAULT_LINES = 200;
|
|
35072
|
+
function registerLogsCommands(program, context) {
|
|
35073
|
+
program.command("logs").description("Print or follow the in-sandbox runtime log.").option("-n, --lines <count>", "number of recent lines to print").option("-f, --follow", "follow the log and print new lines", false).option("--path <path>", "runtime log file path", SANDBOX_RUNTIME_LOG_PATH).action(
|
|
35074
|
+
async (options) => {
|
|
35075
|
+
await tailRuntimeLog({
|
|
35076
|
+
path: options.path,
|
|
35077
|
+
lines: parseLines(options.lines),
|
|
35078
|
+
follow: options.follow === true,
|
|
35079
|
+
writeOutput: context.writeOutput,
|
|
35080
|
+
writeError: (line) => process.stderr.write(`${line}
|
|
35081
|
+
`)
|
|
35082
|
+
});
|
|
35083
|
+
}
|
|
35084
|
+
);
|
|
35085
|
+
}
|
|
35086
|
+
function parseLines(value) {
|
|
35087
|
+
if (value === void 0) {
|
|
35088
|
+
return DEFAULT_LINES;
|
|
35089
|
+
}
|
|
35090
|
+
const parsed = Number.parseInt(value, 10);
|
|
35091
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : DEFAULT_LINES;
|
|
35092
|
+
}
|
|
35093
|
+
|
|
34980
35094
|
// src/commands/onboard/quickstart-content.ts
|
|
34981
35095
|
var humanQuickstartText = `Get started with auto:
|
|
34982
35096
|
|
|
@@ -35885,10 +35999,10 @@ async function runConsole(input) {
|
|
|
35885
35999
|
input.writeOutput(
|
|
35886
36000
|
`stream interrupted: ${error51 instanceof Error ? error51.message : String(error51)}`
|
|
35887
36001
|
);
|
|
35888
|
-
await
|
|
36002
|
+
await delay2(1e3, abort.signal);
|
|
35889
36003
|
continue;
|
|
35890
36004
|
}
|
|
35891
|
-
await
|
|
36005
|
+
await delay2(250, abort.signal);
|
|
35892
36006
|
}
|
|
35893
36007
|
})();
|
|
35894
36008
|
const consoleInput = createInteractiveInputController({
|
|
@@ -35968,7 +36082,7 @@ function createInteractiveInputController(input) {
|
|
|
35968
36082
|
})();
|
|
35969
36083
|
return { done, close };
|
|
35970
36084
|
}
|
|
35971
|
-
function
|
|
36085
|
+
function delay2(ms, signal) {
|
|
35972
36086
|
if (signal.aborted) {
|
|
35973
36087
|
return Promise.resolve();
|
|
35974
36088
|
}
|
|
@@ -36190,12 +36304,12 @@ async function sendRunMessageAction(context, sessionId, message, commandOptions)
|
|
|
36190
36304
|
// src/commands/sessions/benchmark-startup.ts
|
|
36191
36305
|
import { performance } from "perf_hooks";
|
|
36192
36306
|
var DEFAULT_TIMEOUT_MS = 3e5;
|
|
36193
|
-
var
|
|
36307
|
+
var DEFAULT_POLL_INTERVAL_MS2 = 1e3;
|
|
36194
36308
|
var DEFAULT_DIAGNOSTICS_LIMIT = 200;
|
|
36195
36309
|
var DIAGNOSTICS_SHUTDOWN_WAIT_MS = 250;
|
|
36196
36310
|
async function benchmarkStartupAction(context, commandOptions) {
|
|
36197
36311
|
const timeoutMs = commandOptions.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
36198
|
-
const pollIntervalMs = commandOptions.pollIntervalMs ??
|
|
36312
|
+
const pollIntervalMs = commandOptions.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS2;
|
|
36199
36313
|
const diagnosticsLimit = commandOptions.diagnosticsLimit ?? DEFAULT_DIAGNOSTICS_LIMIT;
|
|
36200
36314
|
validatePositiveInteger(timeoutMs, "timeout-ms");
|
|
36201
36315
|
validatePositiveInteger(pollIntervalMs, "poll-interval-ms");
|
|
@@ -36289,7 +36403,7 @@ async function pollUntilAwaiting(input) {
|
|
|
36289
36403
|
if (firstPoll) {
|
|
36290
36404
|
firstPoll = false;
|
|
36291
36405
|
} else {
|
|
36292
|
-
await
|
|
36406
|
+
await delay3(
|
|
36293
36407
|
Math.min(input.pollIntervalMs, Math.max(deadline - Date.now(), 0))
|
|
36294
36408
|
);
|
|
36295
36409
|
}
|
|
@@ -36303,7 +36417,7 @@ async function pollUntilAwaiting(input) {
|
|
|
36303
36417
|
status = session.status;
|
|
36304
36418
|
}
|
|
36305
36419
|
}
|
|
36306
|
-
function
|
|
36420
|
+
function delay3(ms) {
|
|
36307
36421
|
if (ms <= 0) {
|
|
36308
36422
|
return Promise.resolve();
|
|
36309
36423
|
}
|
|
@@ -36363,7 +36477,7 @@ async function streamDiagnosticsBestEffort(input) {
|
|
|
36363
36477
|
}
|
|
36364
36478
|
}
|
|
36365
36479
|
async function settleDiagnostics(done) {
|
|
36366
|
-
await Promise.race([done,
|
|
36480
|
+
await Promise.race([done, delay3(DIAGNOSTICS_SHUTDOWN_WAIT_MS)]);
|
|
36367
36481
|
}
|
|
36368
36482
|
function writeBenchmarkResult(context, result, json2) {
|
|
36369
36483
|
if (json2) {
|
|
@@ -37752,6 +37866,7 @@ function createProgram(options = {}) {
|
|
|
37752
37866
|
registerSyncCommands(program, context);
|
|
37753
37867
|
registerAgentCommands(program, context);
|
|
37754
37868
|
registerSessionCommands(program, context);
|
|
37869
|
+
registerLogsCommands(program, context);
|
|
37755
37870
|
return program;
|
|
37756
37871
|
}
|
|
37757
37872
|
|