@autohq/cli 0.1.211 → 0.1.213
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 +20 -4
- package/dist/index.js +184 -18
- package/package.json +1 -1
package/dist/agent-bridge.js
CHANGED
|
@@ -20843,12 +20843,20 @@ var ConnectionRemoveResponseSchema = external_exports.object({
|
|
|
20843
20843
|
|
|
20844
20844
|
// ../../packages/schemas/src/github-sync.ts
|
|
20845
20845
|
var GITHUB_SYNC_AUTO_PATH = ".auto";
|
|
20846
|
+
var GITHUB_SYNC_CI_WATCHDOG_DEFAULT_DELAY_MS = 15e3;
|
|
20846
20847
|
var GithubSyncRepositoryFullNameSchema = external_exports.string().trim().min(1).regex(/^[^/\s]+\/[^/\s]+$/, {
|
|
20847
20848
|
message: "repository must be in owner/name form"
|
|
20848
20849
|
});
|
|
20849
20850
|
var GithubSyncProductionBranchSchema = external_exports.string().trim().min(1).max(255).refine((branch) => !branch.startsWith("/") && !branch.endsWith("/"), {
|
|
20850
20851
|
message: "branch must not start or end with /"
|
|
20851
20852
|
});
|
|
20853
|
+
var GithubSyncCiWatchdogWorkflowSchema = external_exports.object({
|
|
20854
|
+
workflowId: external_exports.string().trim().min(1).max(255)
|
|
20855
|
+
}).strict();
|
|
20856
|
+
var GithubSyncCiWatchdogSchema = external_exports.object({
|
|
20857
|
+
workflows: external_exports.array(GithubSyncCiWatchdogWorkflowSchema).max(10).default([]),
|
|
20858
|
+
checkDelayMs: external_exports.number().int().nonnegative().default(GITHUB_SYNC_CI_WATCHDOG_DEFAULT_DELAY_MS)
|
|
20859
|
+
}).strict();
|
|
20852
20860
|
var GithubSyncBindingSchema = external_exports.object({
|
|
20853
20861
|
id: external_exports.string().trim().min(1),
|
|
20854
20862
|
organizationId: OrganizationIdSchema,
|
|
@@ -20859,6 +20867,7 @@ var GithubSyncBindingSchema = external_exports.object({
|
|
|
20859
20867
|
repoId: external_exports.string().trim().min(1).nullable(),
|
|
20860
20868
|
productionBranch: GithubSyncProductionBranchSchema,
|
|
20861
20869
|
autoPath: external_exports.literal(GITHUB_SYNC_AUTO_PATH),
|
|
20870
|
+
ciWatchdog: GithubSyncCiWatchdogSchema,
|
|
20862
20871
|
enabled: external_exports.boolean(),
|
|
20863
20872
|
lastPlannedSha: external_exports.string().trim().min(1).nullable(),
|
|
20864
20873
|
lastAppliedSha: external_exports.string().trim().min(1).nullable(),
|
|
@@ -20869,7 +20878,8 @@ var GithubSyncBindingCreateRequestSchema = external_exports.object({
|
|
|
20869
20878
|
connection: external_exports.string().trim().min(1).optional(),
|
|
20870
20879
|
repo: GithubSyncRepositoryFullNameSchema,
|
|
20871
20880
|
repoId: external_exports.string().trim().min(1).optional(),
|
|
20872
|
-
branch: GithubSyncProductionBranchSchema.optional()
|
|
20881
|
+
branch: GithubSyncProductionBranchSchema.optional(),
|
|
20882
|
+
ciWatchdog: GithubSyncCiWatchdogSchema.optional()
|
|
20873
20883
|
});
|
|
20874
20884
|
var GithubSyncBindingCreateResponseSchema = external_exports.object({
|
|
20875
20885
|
binding: GithubSyncBindingSchema,
|
|
@@ -21439,8 +21449,11 @@ var GithubPullRequestMergeabilityWorkflowInputSchema = external_exports.object({
|
|
|
21439
21449
|
repoFullName: external_exports.string().trim().min(1),
|
|
21440
21450
|
pullRequestNumber: external_exports.number().int().positive(),
|
|
21441
21451
|
headSha: external_exports.string().trim().min(1),
|
|
21452
|
+
headRef: external_exports.string().trim().min(1).optional(),
|
|
21442
21453
|
baseSha: external_exports.string().trim().min(1).optional(),
|
|
21443
|
-
|
|
21454
|
+
ciWatchdogWorkflows: external_exports.array(GithubSyncCiWatchdogWorkflowSchema).max(10).default([]),
|
|
21455
|
+
retryDelaysMs: external_exports.array(external_exports.number().int().nonnegative()).default([1e3, 2e3, 5e3, 1e4, 15e3]),
|
|
21456
|
+
ciWorkflowRunCheckDelayMs: external_exports.number().int().nonnegative().default(GITHUB_SYNC_CI_WATCHDOG_DEFAULT_DELAY_MS)
|
|
21444
21457
|
}).strict();
|
|
21445
21458
|
var GithubPullRequestMergeabilityWorkflowResultSchema = external_exports.union([
|
|
21446
21459
|
external_exports.object({
|
|
@@ -21457,7 +21470,8 @@ var GithubPullRequestMergeabilityWorkflowResultSchema = external_exports.union([
|
|
|
21457
21470
|
// Present when the pull request was behind its base with auto-merge
|
|
21458
21471
|
// enabled: "updated" if a branch update was requested, "skipped" if
|
|
21459
21472
|
// GitHub rejected it (e.g. the head moved since lookup).
|
|
21460
|
-
branchUpdate: external_exports.enum(["updated", "skipped"]).optional()
|
|
21473
|
+
branchUpdate: external_exports.enum(["updated", "skipped"]).optional(),
|
|
21474
|
+
ciWorkflowDispatch: external_exports.enum(["dispatched", "present", "skipped"]).optional()
|
|
21461
21475
|
})
|
|
21462
21476
|
]);
|
|
21463
21477
|
var EventRoutingTriggerResultSchema = external_exports.object({
|
|
@@ -23083,6 +23097,8 @@ var E2bLifecycleWebhookEventSchema = external_exports.object({
|
|
|
23083
23097
|
var RUNTIME_LOG_LEVELS = ["debug", "info", "warn", "error"];
|
|
23084
23098
|
var RuntimeLogLevelSchema = external_exports.enum(RUNTIME_LOG_LEVELS);
|
|
23085
23099
|
var DEFAULT_RUNTIME_LOG_LEVEL = "info";
|
|
23100
|
+
var SANDBOX_RUNTIME_LOG_DIR = "/home/user/.auto-runtime";
|
|
23101
|
+
var SANDBOX_RUNTIME_LOG_PATH = `${SANDBOX_RUNTIME_LOG_DIR}/agent-bridge.log`;
|
|
23086
23102
|
var LEVEL_SEVERITY = {
|
|
23087
23103
|
debug: 10,
|
|
23088
23104
|
info: 20,
|
|
@@ -26785,7 +26801,7 @@ Object.assign(lookup, {
|
|
|
26785
26801
|
// package.json
|
|
26786
26802
|
var package_default = {
|
|
26787
26803
|
name: "@autohq/cli",
|
|
26788
|
-
version: "0.1.
|
|
26804
|
+
version: "0.1.213",
|
|
26789
26805
|
license: "SEE LICENSE IN README.md",
|
|
26790
26806
|
publishConfig: {
|
|
26791
26807
|
access: "public"
|
package/dist/index.js
CHANGED
|
@@ -16492,7 +16492,7 @@ var init_connections = __esm({
|
|
|
16492
16492
|
});
|
|
16493
16493
|
|
|
16494
16494
|
// ../../packages/schemas/src/github-sync.ts
|
|
16495
|
-
var GITHUB_SYNC_AUTO_PATH, GithubSyncRepositoryFullNameSchema, GithubSyncProductionBranchSchema, GithubSyncBindingSchema, GithubSyncBindingCreateRequestSchema, GithubSyncBindingCreateResponseSchema, GithubSyncBindingListResponseSchema, GithubSyncTriggerArtifactSchema, GithubSyncWorkflowInputSchema, GithubSyncWorkflowResultSchema;
|
|
16495
|
+
var GITHUB_SYNC_AUTO_PATH, GITHUB_SYNC_CI_WATCHDOG_DEFAULT_DELAY_MS, GithubSyncRepositoryFullNameSchema, GithubSyncProductionBranchSchema, GithubSyncCiWatchdogWorkflowSchema, GithubSyncCiWatchdogSchema, GithubSyncBindingSchema, GithubSyncBindingCreateRequestSchema, GithubSyncBindingCreateResponseSchema, GithubSyncBindingListResponseSchema, GithubSyncTriggerArtifactSchema, GithubSyncWorkflowInputSchema, GithubSyncWorkflowResultSchema;
|
|
16496
16496
|
var init_github_sync = __esm({
|
|
16497
16497
|
"../../packages/schemas/src/github-sync.ts"() {
|
|
16498
16498
|
"use strict";
|
|
@@ -16500,12 +16500,20 @@ var init_github_sync = __esm({
|
|
|
16500
16500
|
init_ids();
|
|
16501
16501
|
init_primitives();
|
|
16502
16502
|
GITHUB_SYNC_AUTO_PATH = ".auto";
|
|
16503
|
+
GITHUB_SYNC_CI_WATCHDOG_DEFAULT_DELAY_MS = 15e3;
|
|
16503
16504
|
GithubSyncRepositoryFullNameSchema = external_exports.string().trim().min(1).regex(/^[^/\s]+\/[^/\s]+$/, {
|
|
16504
16505
|
message: "repository must be in owner/name form"
|
|
16505
16506
|
});
|
|
16506
16507
|
GithubSyncProductionBranchSchema = external_exports.string().trim().min(1).max(255).refine((branch) => !branch.startsWith("/") && !branch.endsWith("/"), {
|
|
16507
16508
|
message: "branch must not start or end with /"
|
|
16508
16509
|
});
|
|
16510
|
+
GithubSyncCiWatchdogWorkflowSchema = external_exports.object({
|
|
16511
|
+
workflowId: external_exports.string().trim().min(1).max(255)
|
|
16512
|
+
}).strict();
|
|
16513
|
+
GithubSyncCiWatchdogSchema = external_exports.object({
|
|
16514
|
+
workflows: external_exports.array(GithubSyncCiWatchdogWorkflowSchema).max(10).default([]),
|
|
16515
|
+
checkDelayMs: external_exports.number().int().nonnegative().default(GITHUB_SYNC_CI_WATCHDOG_DEFAULT_DELAY_MS)
|
|
16516
|
+
}).strict();
|
|
16509
16517
|
GithubSyncBindingSchema = external_exports.object({
|
|
16510
16518
|
id: external_exports.string().trim().min(1),
|
|
16511
16519
|
organizationId: OrganizationIdSchema,
|
|
@@ -16516,6 +16524,7 @@ var init_github_sync = __esm({
|
|
|
16516
16524
|
repoId: external_exports.string().trim().min(1).nullable(),
|
|
16517
16525
|
productionBranch: GithubSyncProductionBranchSchema,
|
|
16518
16526
|
autoPath: external_exports.literal(GITHUB_SYNC_AUTO_PATH),
|
|
16527
|
+
ciWatchdog: GithubSyncCiWatchdogSchema,
|
|
16519
16528
|
enabled: external_exports.boolean(),
|
|
16520
16529
|
lastPlannedSha: external_exports.string().trim().min(1).nullable(),
|
|
16521
16530
|
lastAppliedSha: external_exports.string().trim().min(1).nullable(),
|
|
@@ -16526,7 +16535,8 @@ var init_github_sync = __esm({
|
|
|
16526
16535
|
connection: external_exports.string().trim().min(1).optional(),
|
|
16527
16536
|
repo: GithubSyncRepositoryFullNameSchema,
|
|
16528
16537
|
repoId: external_exports.string().trim().min(1).optional(),
|
|
16529
|
-
branch: GithubSyncProductionBranchSchema.optional()
|
|
16538
|
+
branch: GithubSyncProductionBranchSchema.optional(),
|
|
16539
|
+
ciWatchdog: GithubSyncCiWatchdogSchema.optional()
|
|
16530
16540
|
});
|
|
16531
16541
|
GithubSyncBindingCreateResponseSchema = external_exports.object({
|
|
16532
16542
|
binding: GithubSyncBindingSchema,
|
|
@@ -17052,6 +17062,7 @@ var init_trigger_router = __esm({
|
|
|
17052
17062
|
"../../packages/schemas/src/trigger-router.ts"() {
|
|
17053
17063
|
"use strict";
|
|
17054
17064
|
init_zod();
|
|
17065
|
+
init_github_sync();
|
|
17055
17066
|
init_ids();
|
|
17056
17067
|
init_primitives();
|
|
17057
17068
|
CANONICAL_ROUTE_BY_KINDS = [
|
|
@@ -17157,8 +17168,11 @@ var init_trigger_router = __esm({
|
|
|
17157
17168
|
repoFullName: external_exports.string().trim().min(1),
|
|
17158
17169
|
pullRequestNumber: external_exports.number().int().positive(),
|
|
17159
17170
|
headSha: external_exports.string().trim().min(1),
|
|
17171
|
+
headRef: external_exports.string().trim().min(1).optional(),
|
|
17160
17172
|
baseSha: external_exports.string().trim().min(1).optional(),
|
|
17161
|
-
|
|
17173
|
+
ciWatchdogWorkflows: external_exports.array(GithubSyncCiWatchdogWorkflowSchema).max(10).default([]),
|
|
17174
|
+
retryDelaysMs: external_exports.array(external_exports.number().int().nonnegative()).default([1e3, 2e3, 5e3, 1e4, 15e3]),
|
|
17175
|
+
ciWorkflowRunCheckDelayMs: external_exports.number().int().nonnegative().default(GITHUB_SYNC_CI_WATCHDOG_DEFAULT_DELAY_MS)
|
|
17162
17176
|
}).strict();
|
|
17163
17177
|
GithubPullRequestMergeabilityWorkflowResultSchema = external_exports.union([
|
|
17164
17178
|
external_exports.object({
|
|
@@ -17175,7 +17189,8 @@ var init_trigger_router = __esm({
|
|
|
17175
17189
|
// Present when the pull request was behind its base with auto-merge
|
|
17176
17190
|
// enabled: "updated" if a branch update was requested, "skipped" if
|
|
17177
17191
|
// GitHub rejected it (e.g. the head moved since lookup).
|
|
17178
|
-
branchUpdate: external_exports.enum(["updated", "skipped"]).optional()
|
|
17192
|
+
branchUpdate: external_exports.enum(["updated", "skipped"]).optional(),
|
|
17193
|
+
ciWorkflowDispatch: external_exports.enum(["dispatched", "present", "skipped"]).optional()
|
|
17179
17194
|
})
|
|
17180
17195
|
]);
|
|
17181
17196
|
EventRoutingTriggerResultSchema = external_exports.object({
|
|
@@ -18998,7 +19013,7 @@ function parseRuntimeLogLevel(value) {
|
|
|
18998
19013
|
function runtimeLogLevelEnabled(configured, lineLevel) {
|
|
18999
19014
|
return LEVEL_SEVERITY[lineLevel] >= LEVEL_SEVERITY[configured];
|
|
19000
19015
|
}
|
|
19001
|
-
var RUNTIME_LOG_LEVELS, RuntimeLogLevelSchema, DEFAULT_RUNTIME_LOG_LEVEL, LEVEL_SEVERITY;
|
|
19016
|
+
var RUNTIME_LOG_LEVELS, RuntimeLogLevelSchema, DEFAULT_RUNTIME_LOG_LEVEL, SANDBOX_RUNTIME_LOG_DIR, SANDBOX_RUNTIME_LOG_PATH, LEVEL_SEVERITY;
|
|
19002
19017
|
var init_runtime_log = __esm({
|
|
19003
19018
|
"../../packages/schemas/src/runtime-log.ts"() {
|
|
19004
19019
|
"use strict";
|
|
@@ -19006,6 +19021,8 @@ var init_runtime_log = __esm({
|
|
|
19006
19021
|
RUNTIME_LOG_LEVELS = ["debug", "info", "warn", "error"];
|
|
19007
19022
|
RuntimeLogLevelSchema = external_exports.enum(RUNTIME_LOG_LEVELS);
|
|
19008
19023
|
DEFAULT_RUNTIME_LOG_LEVEL = "info";
|
|
19024
|
+
SANDBOX_RUNTIME_LOG_DIR = "/home/user/.auto-runtime";
|
|
19025
|
+
SANDBOX_RUNTIME_LOG_PATH = `${SANDBOX_RUNTIME_LOG_DIR}/agent-bridge.log`;
|
|
19009
19026
|
LEVEL_SEVERITY = {
|
|
19010
19027
|
debug: 10,
|
|
19011
19028
|
info: 20,
|
|
@@ -21812,7 +21829,7 @@ var init_package = __esm({
|
|
|
21812
21829
|
"package.json"() {
|
|
21813
21830
|
package_default = {
|
|
21814
21831
|
name: "@autohq/cli",
|
|
21815
|
-
version: "0.1.
|
|
21832
|
+
version: "0.1.213",
|
|
21816
21833
|
license: "SEE LICENSE IN README.md",
|
|
21817
21834
|
publishConfig: {
|
|
21818
21835
|
access: "public"
|
|
@@ -30095,7 +30112,7 @@ __export(launcher_exports, {
|
|
|
30095
30112
|
launch: () => launch
|
|
30096
30113
|
});
|
|
30097
30114
|
import { spawnSync } from "child_process";
|
|
30098
|
-
import { existsSync as
|
|
30115
|
+
import { existsSync as existsSync5 } from "fs";
|
|
30099
30116
|
import { dirname as dirname6, resolve as resolve3 } from "path";
|
|
30100
30117
|
import { fileURLToPath } from "url";
|
|
30101
30118
|
import {
|
|
@@ -30290,7 +30307,7 @@ function resolveLatestReleaseVersionFromCheckout() {
|
|
|
30290
30307
|
function findRepoRoot(startDirectory) {
|
|
30291
30308
|
let directory = startDirectory;
|
|
30292
30309
|
while (true) {
|
|
30293
|
-
if (
|
|
30310
|
+
if (existsSync5(resolve3(directory, ".git")) && existsSync5(resolve3(directory, "apps/cli/package.json"))) {
|
|
30294
30311
|
return directory;
|
|
30295
30312
|
}
|
|
30296
30313
|
const parent = dirname6(directory);
|
|
@@ -34977,6 +34994,118 @@ function acceptedInvitationLine(response) {
|
|
|
34977
34994
|
].join(" ");
|
|
34978
34995
|
}
|
|
34979
34996
|
|
|
34997
|
+
// src/commands/logs/commands.ts
|
|
34998
|
+
init_src();
|
|
34999
|
+
|
|
35000
|
+
// src/commands/logs/actions.ts
|
|
35001
|
+
import {
|
|
35002
|
+
closeSync,
|
|
35003
|
+
existsSync as existsSync4,
|
|
35004
|
+
openSync,
|
|
35005
|
+
readFileSync as readFileSync6,
|
|
35006
|
+
readSync,
|
|
35007
|
+
statSync as statSync3
|
|
35008
|
+
} from "fs";
|
|
35009
|
+
var DEFAULT_POLL_INTERVAL_MS = 1e3;
|
|
35010
|
+
async function tailRuntimeLog(input) {
|
|
35011
|
+
if (!existsSync4(input.path)) {
|
|
35012
|
+
input.writeError(`No runtime log at ${input.path}`);
|
|
35013
|
+
return;
|
|
35014
|
+
}
|
|
35015
|
+
const content = readFileSync6(input.path, "utf8");
|
|
35016
|
+
for (const line of selectLastLines(content, input.lines)) {
|
|
35017
|
+
input.writeOutput(line);
|
|
35018
|
+
}
|
|
35019
|
+
if (input.follow) {
|
|
35020
|
+
await followRuntimeLog({
|
|
35021
|
+
path: input.path,
|
|
35022
|
+
fromByte: Buffer.byteLength(content, "utf8"),
|
|
35023
|
+
pollIntervalMs: input.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS,
|
|
35024
|
+
writeOutput: input.writeOutput,
|
|
35025
|
+
signal: input.signal
|
|
35026
|
+
});
|
|
35027
|
+
}
|
|
35028
|
+
}
|
|
35029
|
+
function selectLastLines(content, count) {
|
|
35030
|
+
const lines = content.split("\n").filter((line) => line.length > 0);
|
|
35031
|
+
return count >= lines.length ? lines : lines.slice(lines.length - count);
|
|
35032
|
+
}
|
|
35033
|
+
async function followRuntimeLog(input) {
|
|
35034
|
+
let offset = input.fromByte;
|
|
35035
|
+
while (!input.signal?.aborted) {
|
|
35036
|
+
await delay(input.pollIntervalMs, input.signal);
|
|
35037
|
+
if (input.signal?.aborted) {
|
|
35038
|
+
return;
|
|
35039
|
+
}
|
|
35040
|
+
let size;
|
|
35041
|
+
try {
|
|
35042
|
+
size = statSync3(input.path).size;
|
|
35043
|
+
} catch {
|
|
35044
|
+
continue;
|
|
35045
|
+
}
|
|
35046
|
+
if (size < offset) {
|
|
35047
|
+
offset = 0;
|
|
35048
|
+
}
|
|
35049
|
+
if (size <= offset) {
|
|
35050
|
+
continue;
|
|
35051
|
+
}
|
|
35052
|
+
const chunk = readByteRange(input.path, offset, size - offset);
|
|
35053
|
+
offset = size;
|
|
35054
|
+
for (const line of chunk.split("\n")) {
|
|
35055
|
+
if (line.length > 0) {
|
|
35056
|
+
input.writeOutput(line);
|
|
35057
|
+
}
|
|
35058
|
+
}
|
|
35059
|
+
}
|
|
35060
|
+
}
|
|
35061
|
+
function readByteRange(path2, offset, length) {
|
|
35062
|
+
const buffer = Buffer.alloc(length);
|
|
35063
|
+
const fd = openSync(path2, "r");
|
|
35064
|
+
try {
|
|
35065
|
+
readSync(fd, buffer, 0, length, offset);
|
|
35066
|
+
} finally {
|
|
35067
|
+
closeSync(fd);
|
|
35068
|
+
}
|
|
35069
|
+
return buffer.toString("utf8");
|
|
35070
|
+
}
|
|
35071
|
+
function delay(ms, signal) {
|
|
35072
|
+
return new Promise((resolve4) => {
|
|
35073
|
+
const timer = setTimeout(resolve4, ms);
|
|
35074
|
+
signal?.addEventListener(
|
|
35075
|
+
"abort",
|
|
35076
|
+
() => {
|
|
35077
|
+
clearTimeout(timer);
|
|
35078
|
+
resolve4();
|
|
35079
|
+
},
|
|
35080
|
+
{ once: true }
|
|
35081
|
+
);
|
|
35082
|
+
});
|
|
35083
|
+
}
|
|
35084
|
+
|
|
35085
|
+
// src/commands/logs/commands.ts
|
|
35086
|
+
var DEFAULT_LINES = 200;
|
|
35087
|
+
function registerLogsCommands(program, context) {
|
|
35088
|
+
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(
|
|
35089
|
+
async (options) => {
|
|
35090
|
+
await tailRuntimeLog({
|
|
35091
|
+
path: options.path,
|
|
35092
|
+
lines: parseLines(options.lines),
|
|
35093
|
+
follow: options.follow === true,
|
|
35094
|
+
writeOutput: context.writeOutput,
|
|
35095
|
+
writeError: (line) => process.stderr.write(`${line}
|
|
35096
|
+
`)
|
|
35097
|
+
});
|
|
35098
|
+
}
|
|
35099
|
+
);
|
|
35100
|
+
}
|
|
35101
|
+
function parseLines(value) {
|
|
35102
|
+
if (value === void 0) {
|
|
35103
|
+
return DEFAULT_LINES;
|
|
35104
|
+
}
|
|
35105
|
+
const parsed = Number.parseInt(value, 10);
|
|
35106
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : DEFAULT_LINES;
|
|
35107
|
+
}
|
|
35108
|
+
|
|
34980
35109
|
// src/commands/onboard/quickstart-content.ts
|
|
34981
35110
|
var humanQuickstartText = `Get started with auto:
|
|
34982
35111
|
|
|
@@ -35885,10 +36014,10 @@ async function runConsole(input) {
|
|
|
35885
36014
|
input.writeOutput(
|
|
35886
36015
|
`stream interrupted: ${error51 instanceof Error ? error51.message : String(error51)}`
|
|
35887
36016
|
);
|
|
35888
|
-
await
|
|
36017
|
+
await delay2(1e3, abort.signal);
|
|
35889
36018
|
continue;
|
|
35890
36019
|
}
|
|
35891
|
-
await
|
|
36020
|
+
await delay2(250, abort.signal);
|
|
35892
36021
|
}
|
|
35893
36022
|
})();
|
|
35894
36023
|
const consoleInput = createInteractiveInputController({
|
|
@@ -35968,7 +36097,7 @@ function createInteractiveInputController(input) {
|
|
|
35968
36097
|
})();
|
|
35969
36098
|
return { done, close };
|
|
35970
36099
|
}
|
|
35971
|
-
function
|
|
36100
|
+
function delay2(ms, signal) {
|
|
35972
36101
|
if (signal.aborted) {
|
|
35973
36102
|
return Promise.resolve();
|
|
35974
36103
|
}
|
|
@@ -36190,12 +36319,12 @@ async function sendRunMessageAction(context, sessionId, message, commandOptions)
|
|
|
36190
36319
|
// src/commands/sessions/benchmark-startup.ts
|
|
36191
36320
|
import { performance } from "perf_hooks";
|
|
36192
36321
|
var DEFAULT_TIMEOUT_MS = 3e5;
|
|
36193
|
-
var
|
|
36322
|
+
var DEFAULT_POLL_INTERVAL_MS2 = 1e3;
|
|
36194
36323
|
var DEFAULT_DIAGNOSTICS_LIMIT = 200;
|
|
36195
36324
|
var DIAGNOSTICS_SHUTDOWN_WAIT_MS = 250;
|
|
36196
36325
|
async function benchmarkStartupAction(context, commandOptions) {
|
|
36197
36326
|
const timeoutMs = commandOptions.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
36198
|
-
const pollIntervalMs = commandOptions.pollIntervalMs ??
|
|
36327
|
+
const pollIntervalMs = commandOptions.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS2;
|
|
36199
36328
|
const diagnosticsLimit = commandOptions.diagnosticsLimit ?? DEFAULT_DIAGNOSTICS_LIMIT;
|
|
36200
36329
|
validatePositiveInteger(timeoutMs, "timeout-ms");
|
|
36201
36330
|
validatePositiveInteger(pollIntervalMs, "poll-interval-ms");
|
|
@@ -36289,7 +36418,7 @@ async function pollUntilAwaiting(input) {
|
|
|
36289
36418
|
if (firstPoll) {
|
|
36290
36419
|
firstPoll = false;
|
|
36291
36420
|
} else {
|
|
36292
|
-
await
|
|
36421
|
+
await delay3(
|
|
36293
36422
|
Math.min(input.pollIntervalMs, Math.max(deadline - Date.now(), 0))
|
|
36294
36423
|
);
|
|
36295
36424
|
}
|
|
@@ -36303,7 +36432,7 @@ async function pollUntilAwaiting(input) {
|
|
|
36303
36432
|
status = session.status;
|
|
36304
36433
|
}
|
|
36305
36434
|
}
|
|
36306
|
-
function
|
|
36435
|
+
function delay3(ms) {
|
|
36307
36436
|
if (ms <= 0) {
|
|
36308
36437
|
return Promise.resolve();
|
|
36309
36438
|
}
|
|
@@ -36363,7 +36492,7 @@ async function streamDiagnosticsBestEffort(input) {
|
|
|
36363
36492
|
}
|
|
36364
36493
|
}
|
|
36365
36494
|
async function settleDiagnostics(done) {
|
|
36366
|
-
await Promise.race([done,
|
|
36495
|
+
await Promise.race([done, delay3(DIAGNOSTICS_SHUTDOWN_WAIT_MS)]);
|
|
36367
36496
|
}
|
|
36368
36497
|
function writeBenchmarkResult(context, result, json2) {
|
|
36369
36498
|
if (json2) {
|
|
@@ -37476,6 +37605,9 @@ function registerSetupCommands(program, context) {
|
|
|
37476
37605
|
});
|
|
37477
37606
|
}
|
|
37478
37607
|
|
|
37608
|
+
// src/commands/sync/actions.ts
|
|
37609
|
+
init_src();
|
|
37610
|
+
|
|
37479
37611
|
// src/commands/sync/repo.ts
|
|
37480
37612
|
import { execFile as execFileWithCallback } from "child_process";
|
|
37481
37613
|
import { promisify } from "util";
|
|
@@ -37544,7 +37676,15 @@ async function enableGithubSyncAction(context, repoArgument, options) {
|
|
|
37544
37676
|
{
|
|
37545
37677
|
connection: connection.name,
|
|
37546
37678
|
repo,
|
|
37547
|
-
...options.branch ? { branch: options.branch } : {}
|
|
37679
|
+
...options.branch ? { branch: options.branch } : {},
|
|
37680
|
+
...options.ciWatchdogWorkflow?.length ? {
|
|
37681
|
+
ciWatchdog: {
|
|
37682
|
+
workflows: options.ciWatchdogWorkflow.map((workflowId) => ({
|
|
37683
|
+
workflowId
|
|
37684
|
+
})),
|
|
37685
|
+
checkDelayMs: options.ciWatchdogDelayMs ?? GITHUB_SYNC_CI_WATCHDOG_DEFAULT_DELAY_MS
|
|
37686
|
+
}
|
|
37687
|
+
} : {}
|
|
37548
37688
|
},
|
|
37549
37689
|
{ apiBaseUrl: apiUrlFromOptions(context, options) }
|
|
37550
37690
|
);
|
|
@@ -37561,6 +37701,11 @@ async function enableGithubSyncAction(context, repoArgument, options) {
|
|
|
37561
37701
|
`${style.label("branch")} ${result.binding.productionBranch}`
|
|
37562
37702
|
);
|
|
37563
37703
|
context.writeOutput(`${style.label("path")} ${result.binding.autoPath}`);
|
|
37704
|
+
if (result.binding.ciWatchdog.workflows.length > 0) {
|
|
37705
|
+
context.writeOutput(
|
|
37706
|
+
`${style.label("ci watchdog")} ${result.binding.ciWatchdog.workflows.map((workflow) => workflow.workflowId).join(", ")}`
|
|
37707
|
+
);
|
|
37708
|
+
}
|
|
37564
37709
|
}
|
|
37565
37710
|
async function listSyncBindingsAction(context, options) {
|
|
37566
37711
|
const project = await requireProjectScope({
|
|
@@ -37584,6 +37729,7 @@ async function listSyncBindingsAction(context, options) {
|
|
|
37584
37729
|
binding.repoFullName,
|
|
37585
37730
|
`branch=${binding.productionBranch}`,
|
|
37586
37731
|
`path=${binding.autoPath}`,
|
|
37732
|
+
`ciWatchdog=${binding.ciWatchdog.workflows.map((workflow) => workflow.workflowId).join(",") || "-"}`,
|
|
37587
37733
|
`lastApplied=${binding.lastAppliedSha ?? "-"}`
|
|
37588
37734
|
].join(" ")
|
|
37589
37735
|
);
|
|
@@ -37594,7 +37740,16 @@ async function listSyncBindingsAction(context, options) {
|
|
|
37594
37740
|
function registerSyncCommands(program, context) {
|
|
37595
37741
|
const sync = program.command("sync").description("Manage repository Sync bindings.");
|
|
37596
37742
|
const enable = sync.command("enable").description("Enable Sync.");
|
|
37597
|
-
enable.command("github").description("Enable Sync for a GitHub repository.").argument("[repo]", "GitHub repository in owner/name form").option("--connection <name>", "GitHub connection name or id").option("--branch <branch>", "production branch to apply from").option(
|
|
37743
|
+
enable.command("github").description("Enable Sync for a GitHub repository.").argument("[repo]", "GitHub repository in owner/name form").option("--connection <name>", "GitHub connection name or id").option("--branch <branch>", "production branch to apply from").option(
|
|
37744
|
+
"--ci-watchdog-workflow <workflow>",
|
|
37745
|
+
"GitHub Actions workflow id to re-dispatch when a PR head is missing CI; repeat for multiple workflows",
|
|
37746
|
+
collectValues,
|
|
37747
|
+
[]
|
|
37748
|
+
).option(
|
|
37749
|
+
"--ci-watchdog-delay-ms <ms>",
|
|
37750
|
+
"delay before checking for missing CI workflow runs",
|
|
37751
|
+
parseNonnegativeInteger
|
|
37752
|
+
).option("-y, --yes", "skip confirmation prompt").option("--api-url <url>", "Auto API base URL").option("--api-base-url <url>", "Auto API base URL").action(
|
|
37598
37753
|
async (repo, commandOptions) => {
|
|
37599
37754
|
await enableGithubSyncAction(context, repo, commandOptions);
|
|
37600
37755
|
}
|
|
@@ -37603,6 +37758,16 @@ function registerSyncCommands(program, context) {
|
|
|
37603
37758
|
await listSyncBindingsAction(context, commandOptions);
|
|
37604
37759
|
});
|
|
37605
37760
|
}
|
|
37761
|
+
function collectValues(value, values) {
|
|
37762
|
+
return [...values, value];
|
|
37763
|
+
}
|
|
37764
|
+
function parseNonnegativeInteger(value) {
|
|
37765
|
+
const parsed = Number(value);
|
|
37766
|
+
if (!Number.isInteger(parsed) || parsed < 0) {
|
|
37767
|
+
throw new Error(`Expected a non-negative integer, received ${value}`);
|
|
37768
|
+
}
|
|
37769
|
+
return parsed;
|
|
37770
|
+
}
|
|
37606
37771
|
|
|
37607
37772
|
// src/lib/output/iostreams.ts
|
|
37608
37773
|
init_style();
|
|
@@ -37752,6 +37917,7 @@ function createProgram(options = {}) {
|
|
|
37752
37917
|
registerSyncCommands(program, context);
|
|
37753
37918
|
registerAgentCommands(program, context);
|
|
37754
37919
|
registerSessionCommands(program, context);
|
|
37920
|
+
registerLogsCommands(program, context);
|
|
37755
37921
|
return program;
|
|
37756
37922
|
}
|
|
37757
37923
|
|