@autohq/cli 0.1.210 → 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 +16 -1
- package/dist/index.js +149 -13
- package/package.json +1 -1
package/dist/agent-bridge.js
CHANGED
|
@@ -23071,10 +23071,20 @@ var SetupOnboardingPullRequestStatusResponseSchema = external_exports.object({
|
|
|
23071
23071
|
ready: external_exports.boolean()
|
|
23072
23072
|
});
|
|
23073
23073
|
|
|
23074
|
+
// ../../packages/schemas/src/e2b-webhook.ts
|
|
23075
|
+
var E2bLifecycleWebhookEventSchema = external_exports.object({
|
|
23076
|
+
type: external_exports.string().min(1),
|
|
23077
|
+
sandbox_id: external_exports.string().min(1),
|
|
23078
|
+
sandbox_execution_id: external_exports.string().optional(),
|
|
23079
|
+
timestamp: external_exports.string().optional()
|
|
23080
|
+
}).passthrough();
|
|
23081
|
+
|
|
23074
23082
|
// ../../packages/schemas/src/runtime-log.ts
|
|
23075
23083
|
var RUNTIME_LOG_LEVELS = ["debug", "info", "warn", "error"];
|
|
23076
23084
|
var RuntimeLogLevelSchema = external_exports.enum(RUNTIME_LOG_LEVELS);
|
|
23077
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`;
|
|
23078
23088
|
var LEVEL_SEVERITY = {
|
|
23079
23089
|
debug: 10,
|
|
23080
23090
|
info: 20,
|
|
@@ -23102,6 +23112,11 @@ var RUNTIME_TAIL_SANDBOX_STATES = [
|
|
|
23102
23112
|
var RuntimeTailSandboxStateSchema = external_exports.enum(
|
|
23103
23113
|
RUNTIME_TAIL_SANDBOX_STATES
|
|
23104
23114
|
);
|
|
23115
|
+
var TAIL_LIFECYCLE_ACTIONS = ["pause", "resume", "stop"];
|
|
23116
|
+
var TailLifecycleActionSchema = external_exports.enum(TAIL_LIFECYCLE_ACTIONS);
|
|
23117
|
+
var TailLifecycleSignalPayloadSchema = external_exports.object({
|
|
23118
|
+
action: TailLifecycleActionSchema
|
|
23119
|
+
}).strict();
|
|
23105
23120
|
var TailRuntimeLogResultSchema = external_exports.object({
|
|
23106
23121
|
state: RuntimeTailSandboxStateSchema,
|
|
23107
23122
|
forwardedLineCount: external_exports.number().int().nonnegative(),
|
|
@@ -26772,7 +26787,7 @@ Object.assign(lookup, {
|
|
|
26772
26787
|
// package.json
|
|
26773
26788
|
var package_default = {
|
|
26774
26789
|
name: "@autohq/cli",
|
|
26775
|
-
version: "0.1.
|
|
26790
|
+
version: "0.1.212",
|
|
26776
26791
|
license: "SEE LICENSE IN README.md",
|
|
26777
26792
|
publishConfig: {
|
|
26778
26793
|
access: "public"
|
package/dist/index.js
CHANGED
|
@@ -18975,6 +18975,21 @@ var init_setup = __esm({
|
|
|
18975
18975
|
}
|
|
18976
18976
|
});
|
|
18977
18977
|
|
|
18978
|
+
// ../../packages/schemas/src/e2b-webhook.ts
|
|
18979
|
+
var E2bLifecycleWebhookEventSchema;
|
|
18980
|
+
var init_e2b_webhook = __esm({
|
|
18981
|
+
"../../packages/schemas/src/e2b-webhook.ts"() {
|
|
18982
|
+
"use strict";
|
|
18983
|
+
init_zod();
|
|
18984
|
+
E2bLifecycleWebhookEventSchema = external_exports.object({
|
|
18985
|
+
type: external_exports.string().min(1),
|
|
18986
|
+
sandbox_id: external_exports.string().min(1),
|
|
18987
|
+
sandbox_execution_id: external_exports.string().optional(),
|
|
18988
|
+
timestamp: external_exports.string().optional()
|
|
18989
|
+
}).passthrough();
|
|
18990
|
+
}
|
|
18991
|
+
});
|
|
18992
|
+
|
|
18978
18993
|
// ../../packages/schemas/src/runtime-log.ts
|
|
18979
18994
|
function parseRuntimeLogLevel(value) {
|
|
18980
18995
|
const parsed = RuntimeLogLevelSchema.safeParse(value?.trim());
|
|
@@ -18983,7 +18998,7 @@ function parseRuntimeLogLevel(value) {
|
|
|
18983
18998
|
function runtimeLogLevelEnabled(configured, lineLevel) {
|
|
18984
18999
|
return LEVEL_SEVERITY[lineLevel] >= LEVEL_SEVERITY[configured];
|
|
18985
19000
|
}
|
|
18986
|
-
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;
|
|
18987
19002
|
var init_runtime_log = __esm({
|
|
18988
19003
|
"../../packages/schemas/src/runtime-log.ts"() {
|
|
18989
19004
|
"use strict";
|
|
@@ -18991,6 +19006,8 @@ var init_runtime_log = __esm({
|
|
|
18991
19006
|
RUNTIME_LOG_LEVELS = ["debug", "info", "warn", "error"];
|
|
18992
19007
|
RuntimeLogLevelSchema = external_exports.enum(RUNTIME_LOG_LEVELS);
|
|
18993
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`;
|
|
18994
19011
|
LEVEL_SEVERITY = {
|
|
18995
19012
|
debug: 10,
|
|
18996
19013
|
info: 20,
|
|
@@ -19001,7 +19018,7 @@ var init_runtime_log = __esm({
|
|
|
19001
19018
|
});
|
|
19002
19019
|
|
|
19003
19020
|
// ../../packages/schemas/src/runtime-log-tailer.ts
|
|
19004
|
-
var RuntimeLogTailerWorkflowInputSchema, RUNTIME_TAIL_SANDBOX_STATES, RuntimeTailSandboxStateSchema, TailRuntimeLogResultSchema;
|
|
19021
|
+
var RuntimeLogTailerWorkflowInputSchema, RUNTIME_TAIL_SANDBOX_STATES, RuntimeTailSandboxStateSchema, TAIL_LIFECYCLE_ACTIONS, TailLifecycleActionSchema, TailLifecycleSignalPayloadSchema, TailRuntimeLogResultSchema;
|
|
19005
19022
|
var init_runtime_log_tailer = __esm({
|
|
19006
19023
|
"../../packages/schemas/src/runtime-log-tailer.ts"() {
|
|
19007
19024
|
"use strict";
|
|
@@ -19019,6 +19036,11 @@ var init_runtime_log_tailer = __esm({
|
|
|
19019
19036
|
RuntimeTailSandboxStateSchema = external_exports.enum(
|
|
19020
19037
|
RUNTIME_TAIL_SANDBOX_STATES
|
|
19021
19038
|
);
|
|
19039
|
+
TAIL_LIFECYCLE_ACTIONS = ["pause", "resume", "stop"];
|
|
19040
|
+
TailLifecycleActionSchema = external_exports.enum(TAIL_LIFECYCLE_ACTIONS);
|
|
19041
|
+
TailLifecycleSignalPayloadSchema = external_exports.object({
|
|
19042
|
+
action: TailLifecycleActionSchema
|
|
19043
|
+
}).strict();
|
|
19022
19044
|
TailRuntimeLogResultSchema = external_exports.object({
|
|
19023
19045
|
state: RuntimeTailSandboxStateSchema,
|
|
19024
19046
|
forwardedLineCount: external_exports.number().int().nonnegative(),
|
|
@@ -19099,6 +19121,7 @@ var init_src = __esm({
|
|
|
19099
19121
|
init_secrets();
|
|
19100
19122
|
init_session_commands();
|
|
19101
19123
|
init_setup();
|
|
19124
|
+
init_e2b_webhook();
|
|
19102
19125
|
init_runtime_log();
|
|
19103
19126
|
init_runtime_log_tailer();
|
|
19104
19127
|
init_runtimes();
|
|
@@ -21791,7 +21814,7 @@ var init_package = __esm({
|
|
|
21791
21814
|
"package.json"() {
|
|
21792
21815
|
package_default = {
|
|
21793
21816
|
name: "@autohq/cli",
|
|
21794
|
-
version: "0.1.
|
|
21817
|
+
version: "0.1.212",
|
|
21795
21818
|
license: "SEE LICENSE IN README.md",
|
|
21796
21819
|
publishConfig: {
|
|
21797
21820
|
access: "public"
|
|
@@ -30074,7 +30097,7 @@ __export(launcher_exports, {
|
|
|
30074
30097
|
launch: () => launch
|
|
30075
30098
|
});
|
|
30076
30099
|
import { spawnSync } from "child_process";
|
|
30077
|
-
import { existsSync as
|
|
30100
|
+
import { existsSync as existsSync5 } from "fs";
|
|
30078
30101
|
import { dirname as dirname6, resolve as resolve3 } from "path";
|
|
30079
30102
|
import { fileURLToPath } from "url";
|
|
30080
30103
|
import {
|
|
@@ -30269,7 +30292,7 @@ function resolveLatestReleaseVersionFromCheckout() {
|
|
|
30269
30292
|
function findRepoRoot(startDirectory) {
|
|
30270
30293
|
let directory = startDirectory;
|
|
30271
30294
|
while (true) {
|
|
30272
|
-
if (
|
|
30295
|
+
if (existsSync5(resolve3(directory, ".git")) && existsSync5(resolve3(directory, "apps/cli/package.json"))) {
|
|
30273
30296
|
return directory;
|
|
30274
30297
|
}
|
|
30275
30298
|
const parent = dirname6(directory);
|
|
@@ -34956,6 +34979,118 @@ function acceptedInvitationLine(response) {
|
|
|
34956
34979
|
].join(" ");
|
|
34957
34980
|
}
|
|
34958
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
|
+
|
|
34959
35094
|
// src/commands/onboard/quickstart-content.ts
|
|
34960
35095
|
var humanQuickstartText = `Get started with auto:
|
|
34961
35096
|
|
|
@@ -35864,10 +35999,10 @@ async function runConsole(input) {
|
|
|
35864
35999
|
input.writeOutput(
|
|
35865
36000
|
`stream interrupted: ${error51 instanceof Error ? error51.message : String(error51)}`
|
|
35866
36001
|
);
|
|
35867
|
-
await
|
|
36002
|
+
await delay2(1e3, abort.signal);
|
|
35868
36003
|
continue;
|
|
35869
36004
|
}
|
|
35870
|
-
await
|
|
36005
|
+
await delay2(250, abort.signal);
|
|
35871
36006
|
}
|
|
35872
36007
|
})();
|
|
35873
36008
|
const consoleInput = createInteractiveInputController({
|
|
@@ -35947,7 +36082,7 @@ function createInteractiveInputController(input) {
|
|
|
35947
36082
|
})();
|
|
35948
36083
|
return { done, close };
|
|
35949
36084
|
}
|
|
35950
|
-
function
|
|
36085
|
+
function delay2(ms, signal) {
|
|
35951
36086
|
if (signal.aborted) {
|
|
35952
36087
|
return Promise.resolve();
|
|
35953
36088
|
}
|
|
@@ -36169,12 +36304,12 @@ async function sendRunMessageAction(context, sessionId, message, commandOptions)
|
|
|
36169
36304
|
// src/commands/sessions/benchmark-startup.ts
|
|
36170
36305
|
import { performance } from "perf_hooks";
|
|
36171
36306
|
var DEFAULT_TIMEOUT_MS = 3e5;
|
|
36172
|
-
var
|
|
36307
|
+
var DEFAULT_POLL_INTERVAL_MS2 = 1e3;
|
|
36173
36308
|
var DEFAULT_DIAGNOSTICS_LIMIT = 200;
|
|
36174
36309
|
var DIAGNOSTICS_SHUTDOWN_WAIT_MS = 250;
|
|
36175
36310
|
async function benchmarkStartupAction(context, commandOptions) {
|
|
36176
36311
|
const timeoutMs = commandOptions.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
36177
|
-
const pollIntervalMs = commandOptions.pollIntervalMs ??
|
|
36312
|
+
const pollIntervalMs = commandOptions.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS2;
|
|
36178
36313
|
const diagnosticsLimit = commandOptions.diagnosticsLimit ?? DEFAULT_DIAGNOSTICS_LIMIT;
|
|
36179
36314
|
validatePositiveInteger(timeoutMs, "timeout-ms");
|
|
36180
36315
|
validatePositiveInteger(pollIntervalMs, "poll-interval-ms");
|
|
@@ -36268,7 +36403,7 @@ async function pollUntilAwaiting(input) {
|
|
|
36268
36403
|
if (firstPoll) {
|
|
36269
36404
|
firstPoll = false;
|
|
36270
36405
|
} else {
|
|
36271
|
-
await
|
|
36406
|
+
await delay3(
|
|
36272
36407
|
Math.min(input.pollIntervalMs, Math.max(deadline - Date.now(), 0))
|
|
36273
36408
|
);
|
|
36274
36409
|
}
|
|
@@ -36282,7 +36417,7 @@ async function pollUntilAwaiting(input) {
|
|
|
36282
36417
|
status = session.status;
|
|
36283
36418
|
}
|
|
36284
36419
|
}
|
|
36285
|
-
function
|
|
36420
|
+
function delay3(ms) {
|
|
36286
36421
|
if (ms <= 0) {
|
|
36287
36422
|
return Promise.resolve();
|
|
36288
36423
|
}
|
|
@@ -36342,7 +36477,7 @@ async function streamDiagnosticsBestEffort(input) {
|
|
|
36342
36477
|
}
|
|
36343
36478
|
}
|
|
36344
36479
|
async function settleDiagnostics(done) {
|
|
36345
|
-
await Promise.race([done,
|
|
36480
|
+
await Promise.race([done, delay3(DIAGNOSTICS_SHUTDOWN_WAIT_MS)]);
|
|
36346
36481
|
}
|
|
36347
36482
|
function writeBenchmarkResult(context, result, json2) {
|
|
36348
36483
|
if (json2) {
|
|
@@ -37731,6 +37866,7 @@ function createProgram(options = {}) {
|
|
|
37731
37866
|
registerSyncCommands(program, context);
|
|
37732
37867
|
registerAgentCommands(program, context);
|
|
37733
37868
|
registerSessionCommands(program, context);
|
|
37869
|
+
registerLogsCommands(program, context);
|
|
37734
37870
|
return program;
|
|
37735
37871
|
}
|
|
37736
37872
|
|