@rallycry/conveyor-agent 10.13.15 → 10.13.16
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/boot-NMXFM4GK.js +1268 -0
- package/dist/boot-NMXFM4GK.js.map +1 -0
- package/dist/{server-TVIXWCAI.js → chunk-5UYMDSAE.js} +8 -3
- package/dist/chunk-5UYMDSAE.js.map +1 -0
- package/dist/chunk-6GS5ADIY.js +11 -0
- package/dist/chunk-6GS5ADIY.js.map +1 -0
- package/dist/{chunk-RSIW2UCR.js → chunk-JG54UJ6V.js} +2 -2
- package/dist/{chunk-VKZ5W2VO.js → chunk-JIGG755T.js} +1 -1
- package/dist/chunk-JIGG755T.js.map +1 -0
- package/dist/{chunk-SAHOFQBQ.js → chunk-OW2TIDWZ.js} +47 -90
- package/dist/chunk-OW2TIDWZ.js.map +1 -0
- package/dist/{chunk-LZM5OKAC.js → chunk-UDSRAHKP.js} +19 -2
- package/dist/chunk-UDSRAHKP.js.map +1 -0
- package/dist/chunk-UZTJJD7Y.js +254 -0
- package/dist/chunk-UZTJJD7Y.js.map +1 -0
- package/dist/cli.js +22 -6
- package/dist/cli.js.map +1 -1
- package/dist/{client-VQIBGPE6.js → client-BU4XA7CV.js} +3 -3
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/{protocol-IHRTO5C4.js → protocol-QLVS5W6O.js} +2 -2
- package/dist/server-CO5O7G4U.js +9 -0
- package/dist/server-CO5O7G4U.js.map +1 -0
- package/package.json +1 -1
- package/runtime/entrypoint.sh +8 -985
- package/dist/chunk-LZM5OKAC.js.map +0 -1
- package/dist/chunk-SAHOFQBQ.js.map +0 -1
- package/dist/chunk-VKZ5W2VO.js.map +0 -1
- package/dist/server-TVIXWCAI.js.map +0 -1
- /package/dist/{chunk-RSIW2UCR.js.map → chunk-JG54UJ6V.js.map} +0 -0
- /package/dist/{client-VQIBGPE6.js.map → client-BU4XA7CV.js.map} +0 -0
- /package/dist/{protocol-IHRTO5C4.js.map → protocol-QLVS5W6O.js.map} +0 -0
|
@@ -3,7 +3,15 @@ import {
|
|
|
3
3
|
} from "./chunk-7TQO4ZF4.js";
|
|
4
4
|
import {
|
|
5
5
|
getWorkbenchClient
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UDSRAHKP.js";
|
|
7
|
+
import {
|
|
8
|
+
CLONE_TIMEOUT_MS,
|
|
9
|
+
DEFAULT_RETRY_DELAY_MS,
|
|
10
|
+
FETCH_TIMEOUT_MS,
|
|
11
|
+
GIT_PREP_MAX_RETRIES,
|
|
12
|
+
mapChatHistory,
|
|
13
|
+
readAgentVersion
|
|
14
|
+
} from "./chunk-UZTJJD7Y.js";
|
|
7
15
|
import {
|
|
8
16
|
workbenchEnabled
|
|
9
17
|
} from "./chunk-4VUQ2NPF.js";
|
|
@@ -23,7 +31,7 @@ import {
|
|
|
23
31
|
sleep,
|
|
24
32
|
transcriptSize,
|
|
25
33
|
turnOptionsFrom
|
|
26
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-JG54UJ6V.js";
|
|
27
35
|
|
|
28
36
|
// src/setup/bootstrap.ts
|
|
29
37
|
var BOOTSTRAP_TIMEOUT_MS = 3e4;
|
|
@@ -271,8 +279,8 @@ var AgentConnection = class _AgentConnection {
|
|
|
271
279
|
/** (Re)arm the recycle timer — called on every successful (re)connect. */
|
|
272
280
|
scheduleSocketRecycle() {
|
|
273
281
|
this.clearSocketRecycle();
|
|
274
|
-
const
|
|
275
|
-
this.armRecycleTimer(
|
|
282
|
+
const delay2 = _AgentConnection.SOCKET_RECYCLE_BASE_MS + Math.random() * _AgentConnection.SOCKET_RECYCLE_JITTER_MS;
|
|
283
|
+
this.armRecycleTimer(delay2);
|
|
276
284
|
}
|
|
277
285
|
clearSocketRecycle() {
|
|
278
286
|
if (this.recycleTimer) {
|
|
@@ -280,11 +288,11 @@ var AgentConnection = class _AgentConnection {
|
|
|
280
288
|
this.recycleTimer = null;
|
|
281
289
|
}
|
|
282
290
|
}
|
|
283
|
-
armRecycleTimer(
|
|
291
|
+
armRecycleTimer(delay2) {
|
|
284
292
|
this.recycleTimer = setTimeout(() => {
|
|
285
293
|
this.recycleTimer = null;
|
|
286
294
|
this.attemptSocketRecycle();
|
|
287
|
-
},
|
|
295
|
+
}, delay2);
|
|
288
296
|
this.recycleTimer.unref?.();
|
|
289
297
|
}
|
|
290
298
|
attemptSocketRecycle() {
|
|
@@ -3005,10 +3013,10 @@ var Lifecycle = class {
|
|
|
3005
3013
|
* deadline regardless of message volume. */
|
|
3006
3014
|
startDormantTimer(overrideMs) {
|
|
3007
3015
|
this.cancelDormantTimer();
|
|
3008
|
-
const
|
|
3016
|
+
const delay2 = Math.max(0, overrideMs ?? this.config.dormantTimeoutMs);
|
|
3009
3017
|
this.dormantTimer = setTimeout(() => {
|
|
3010
3018
|
this.callbacks.onDormantTimeout();
|
|
3011
|
-
},
|
|
3019
|
+
}, delay2);
|
|
3012
3020
|
}
|
|
3013
3021
|
cancelDormantTimer() {
|
|
3014
3022
|
if (this.dormantTimer) {
|
|
@@ -10158,47 +10166,6 @@ var QueryBridge = class {
|
|
|
10158
10166
|
}
|
|
10159
10167
|
};
|
|
10160
10168
|
|
|
10161
|
-
// src/runner/session-runner-helpers.ts
|
|
10162
|
-
import { readFileSync as readFileSync2 } from "fs";
|
|
10163
|
-
import { dirname as dirname2, join as join8 } from "path";
|
|
10164
|
-
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
10165
|
-
function mapChatHistory(messages) {
|
|
10166
|
-
if (!messages) return [];
|
|
10167
|
-
return messages.map((m) => ({
|
|
10168
|
-
id: m.id,
|
|
10169
|
-
role: m.role ?? "user",
|
|
10170
|
-
content: m.content ?? "",
|
|
10171
|
-
userId: m.userId,
|
|
10172
|
-
userName: m.user?.name ?? void 0,
|
|
10173
|
-
createdAt: m.createdAt,
|
|
10174
|
-
...m.files && m.files.length > 0 ? {
|
|
10175
|
-
files: m.files.map((f) => ({
|
|
10176
|
-
fileId: f.id,
|
|
10177
|
-
fileName: f.fileName,
|
|
10178
|
-
mimeType: f.mimeType,
|
|
10179
|
-
fileSize: f.fileSize,
|
|
10180
|
-
downloadUrl: f.downloadUrl ?? "",
|
|
10181
|
-
content: f.content,
|
|
10182
|
-
contentEncoding: f.contentEncoding
|
|
10183
|
-
}))
|
|
10184
|
-
} : {}
|
|
10185
|
-
}));
|
|
10186
|
-
}
|
|
10187
|
-
function readAgentVersion() {
|
|
10188
|
-
try {
|
|
10189
|
-
const here = dirname2(fileURLToPath2(import.meta.url));
|
|
10190
|
-
for (const rel of ["../package.json", "../../package.json"]) {
|
|
10191
|
-
try {
|
|
10192
|
-
const pkg = JSON.parse(readFileSync2(join8(here, rel), "utf-8"));
|
|
10193
|
-
if (pkg.version) return pkg.version;
|
|
10194
|
-
} catch {
|
|
10195
|
-
}
|
|
10196
|
-
}
|
|
10197
|
-
} catch {
|
|
10198
|
-
}
|
|
10199
|
-
return null;
|
|
10200
|
-
}
|
|
10201
|
-
|
|
10202
10169
|
// src/execution/usage-sampler.ts
|
|
10203
10170
|
import { existsSync as existsSync3 } from "fs";
|
|
10204
10171
|
|
|
@@ -10488,72 +10455,62 @@ async function sampleKeyUsage(token, probe = () => runUsageProbe(), hasSubscript
|
|
|
10488
10455
|
}
|
|
10489
10456
|
|
|
10490
10457
|
// src/setup/git-ready.ts
|
|
10491
|
-
|
|
10492
|
-
var
|
|
10493
|
-
var DEFAULT_TIMEOUT_MS = 6e5;
|
|
10458
|
+
var GATE_MARGIN_MS = 5 * 6e4;
|
|
10459
|
+
var DEFAULT_TIMEOUT_MS = GIT_PREP_MAX_RETRIES * (CLONE_TIMEOUT_MS + FETCH_TIMEOUT_MS) + (GIT_PREP_MAX_RETRIES - 1) * DEFAULT_RETRY_DELAY_MS + GATE_MARGIN_MS;
|
|
10494
10460
|
var DEFAULT_POLL_MS = 200;
|
|
10495
|
-
async function fileExists(path2) {
|
|
10496
|
-
try {
|
|
10497
|
-
await access(path2);
|
|
10498
|
-
const s = await stat2(path2);
|
|
10499
|
-
return s.isFile();
|
|
10500
|
-
} catch {
|
|
10501
|
-
return false;
|
|
10502
|
-
}
|
|
10503
|
-
}
|
|
10504
10461
|
function awaitGitReady(opts = {}) {
|
|
10505
|
-
if (
|
|
10506
|
-
const markerPath = opts.markerPath ?? process.env.CONVEYOR_GIT_READY_MARKER;
|
|
10507
|
-
if (!markerPath) {
|
|
10462
|
+
if (!workbenchEnabled()) {
|
|
10508
10463
|
return Promise.resolve("not-gated");
|
|
10509
10464
|
}
|
|
10510
|
-
const
|
|
10465
|
+
const clientFn = opts.clientFn ?? getWorkbenchClient;
|
|
10511
10466
|
const timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
10512
10467
|
const pollMs = opts.pollMs ?? DEFAULT_POLL_MS;
|
|
10513
|
-
opts.onLog?.(
|
|
10514
|
-
return
|
|
10515
|
-
}
|
|
10516
|
-
function abortError() {
|
|
10517
|
-
const error = new Error("Operation aborted");
|
|
10518
|
-
error.name = "AbortError";
|
|
10519
|
-
return error;
|
|
10468
|
+
opts.onLog?.("waiting for workspace git (workbench daemon)");
|
|
10469
|
+
return pollDaemon(clientFn, timeoutMs, pollMs, opts.onLog, opts.signal);
|
|
10520
10470
|
}
|
|
10521
|
-
function
|
|
10471
|
+
function delay(ms, signal) {
|
|
10522
10472
|
if (!signal) {
|
|
10523
10473
|
return new Promise((resolve) => {
|
|
10524
10474
|
setTimeout(resolve, ms);
|
|
10525
10475
|
});
|
|
10526
10476
|
}
|
|
10527
|
-
if (signal.aborted) return Promise.
|
|
10528
|
-
return new Promise((resolve
|
|
10477
|
+
if (signal.aborted) return Promise.resolve();
|
|
10478
|
+
return new Promise((resolve) => {
|
|
10529
10479
|
const timer = setTimeout(() => {
|
|
10530
10480
|
signal.removeEventListener("abort", onAbort);
|
|
10531
10481
|
resolve();
|
|
10532
10482
|
}, ms);
|
|
10533
10483
|
const onAbort = () => {
|
|
10534
10484
|
clearTimeout(timer);
|
|
10535
|
-
|
|
10485
|
+
resolve();
|
|
10536
10486
|
};
|
|
10537
10487
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
10538
10488
|
});
|
|
10539
10489
|
}
|
|
10540
|
-
async function
|
|
10490
|
+
async function pollDaemon(clientFn, timeoutMs, pollMs, onLog, signal) {
|
|
10541
10491
|
const deadline = Date.now() + timeoutMs;
|
|
10542
10492
|
for (; ; ) {
|
|
10543
|
-
if (signal?.aborted)
|
|
10544
|
-
|
|
10545
|
-
|
|
10546
|
-
return "ready";
|
|
10493
|
+
if (signal?.aborted) {
|
|
10494
|
+
onLog?.("workspace git wait aborted \u2014 giving up");
|
|
10495
|
+
return "timeout";
|
|
10547
10496
|
}
|
|
10548
|
-
|
|
10549
|
-
|
|
10550
|
-
|
|
10497
|
+
try {
|
|
10498
|
+
const frame = await clientFn().gitStatus();
|
|
10499
|
+
if (frame.state === "ready") {
|
|
10500
|
+
onLog?.("workspace git ready");
|
|
10501
|
+
return "ready";
|
|
10502
|
+
}
|
|
10503
|
+
if (frame.state === "failed") {
|
|
10504
|
+
onLog?.(`workspace git preparation failed: ${frame.reason ?? "unknown reason"}`);
|
|
10505
|
+
return "failed";
|
|
10506
|
+
}
|
|
10507
|
+
} catch {
|
|
10551
10508
|
}
|
|
10552
10509
|
if (Date.now() >= deadline) {
|
|
10553
10510
|
onLog?.(`workspace git not ready after ${timeoutMs}ms \u2014 giving up`);
|
|
10554
10511
|
return "timeout";
|
|
10555
10512
|
}
|
|
10556
|
-
await
|
|
10513
|
+
await delay(pollMs, signal);
|
|
10557
10514
|
}
|
|
10558
10515
|
}
|
|
10559
10516
|
|
|
@@ -10838,7 +10795,7 @@ async function handlePullBranch(workDir, branch) {
|
|
|
10838
10795
|
}
|
|
10839
10796
|
|
|
10840
10797
|
// src/runner/heavy-gate.ts
|
|
10841
|
-
import { readFileSync as
|
|
10798
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
10842
10799
|
import path from "path";
|
|
10843
10800
|
var GATE_KEYS = ["heavy", "test", "typecheck", "build"];
|
|
10844
10801
|
function runDir() {
|
|
@@ -10855,7 +10812,7 @@ function pidAlive(pid) {
|
|
|
10855
10812
|
function isHeavyGateActive() {
|
|
10856
10813
|
for (const key of GATE_KEYS) {
|
|
10857
10814
|
try {
|
|
10858
|
-
const raw =
|
|
10815
|
+
const raw = readFileSync2(path.join(runDir(), `${key}.pid`), "utf8").trim();
|
|
10859
10816
|
const pid = Number.parseInt(raw, 10);
|
|
10860
10817
|
if (Number.isInteger(pid) && pid > 0 && pidAlive(pid)) return true;
|
|
10861
10818
|
} catch {
|
|
@@ -11754,12 +11711,12 @@ var SessionRunner = class _SessionRunner {
|
|
|
11754
11711
|
};
|
|
11755
11712
|
|
|
11756
11713
|
// src/setup/config.ts
|
|
11757
|
-
import { join as
|
|
11714
|
+
import { join as join8 } from "path";
|
|
11758
11715
|
var DEVCONTAINER_PATH = ".devcontainer/conveyor/devcontainer.json";
|
|
11759
11716
|
var DEVCONTAINER_PORT_DENY_LIST = /* @__PURE__ */ new Set([5432, 6379, 9200]);
|
|
11760
11717
|
async function loadForwardPorts(workspaceDir) {
|
|
11761
11718
|
try {
|
|
11762
|
-
const raw = await readWorkspaceFile(
|
|
11719
|
+
const raw = await readWorkspaceFile(join8(workspaceDir, DEVCONTAINER_PATH));
|
|
11763
11720
|
const parsed = JSON.parse(raw);
|
|
11764
11721
|
const ports = (parsed.forwardPorts ?? []).filter(
|
|
11765
11722
|
(p) => typeof p === "number" && !DEVCONTAINER_PORT_DENY_LIST.has(p)
|
|
@@ -11853,4 +11810,4 @@ export {
|
|
|
11853
11810
|
loadConveyorConfig,
|
|
11854
11811
|
unshallowRepo
|
|
11855
11812
|
};
|
|
11856
|
-
//# sourceMappingURL=chunk-
|
|
11813
|
+
//# sourceMappingURL=chunk-OW2TIDWZ.js.map
|