@rallycry/conveyor-agent 10.13.15 → 10.13.17
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-NI5L2R2N.js} +73 -90
- package/dist/chunk-NI5L2R2N.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 +29 -10
- 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 +2 -2
- 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() {
|
|
@@ -2305,6 +2313,29 @@ var GetProjectOnboardingStepRequestSchema = z4.object({
|
|
|
2305
2313
|
var GetProjectConnectUrlsRequestSchema = z4.object({
|
|
2306
2314
|
projectId: z4.string()
|
|
2307
2315
|
});
|
|
2316
|
+
var conveyorCapabilitySchema = z4.enum([
|
|
2317
|
+
"read",
|
|
2318
|
+
"create",
|
|
2319
|
+
"update",
|
|
2320
|
+
"chat",
|
|
2321
|
+
"files",
|
|
2322
|
+
"build"
|
|
2323
|
+
]);
|
|
2324
|
+
var GetConnectionContextRequestSchema = z4.object({
|
|
2325
|
+
projectId: z4.string(),
|
|
2326
|
+
// Optional board scope (CONVEYOR_SUBPROJECT_ID). Validated to belong to the
|
|
2327
|
+
// project in the handler; an invalid/foreign id is reported, not silently
|
|
2328
|
+
// dropped, so a mis-scoped connection is never presented as board-specific.
|
|
2329
|
+
subProjectId: z4.string().nullable().optional()
|
|
2330
|
+
});
|
|
2331
|
+
var VerifyConnectionRequestSchema = z4.object({
|
|
2332
|
+
projectId: z4.string(),
|
|
2333
|
+
subProjectId: z4.string().nullable().optional(),
|
|
2334
|
+
intendedActions: z4.array(conveyorCapabilitySchema).optional()
|
|
2335
|
+
});
|
|
2336
|
+
var ListAccessibleSubprojectsRequestSchema = z4.object({
|
|
2337
|
+
projectId: z4.string()
|
|
2338
|
+
});
|
|
2308
2339
|
var CreateProjectTaskRequestSchema = z4.object({
|
|
2309
2340
|
projectId: z4.string(),
|
|
2310
2341
|
title: z4.string().min(1),
|
|
@@ -3005,10 +3036,10 @@ var Lifecycle = class {
|
|
|
3005
3036
|
* deadline regardless of message volume. */
|
|
3006
3037
|
startDormantTimer(overrideMs) {
|
|
3007
3038
|
this.cancelDormantTimer();
|
|
3008
|
-
const
|
|
3039
|
+
const delay2 = Math.max(0, overrideMs ?? this.config.dormantTimeoutMs);
|
|
3009
3040
|
this.dormantTimer = setTimeout(() => {
|
|
3010
3041
|
this.callbacks.onDormantTimeout();
|
|
3011
|
-
},
|
|
3042
|
+
}, delay2);
|
|
3012
3043
|
}
|
|
3013
3044
|
cancelDormantTimer() {
|
|
3014
3045
|
if (this.dormantTimer) {
|
|
@@ -10158,47 +10189,6 @@ var QueryBridge = class {
|
|
|
10158
10189
|
}
|
|
10159
10190
|
};
|
|
10160
10191
|
|
|
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
10192
|
// src/execution/usage-sampler.ts
|
|
10203
10193
|
import { existsSync as existsSync3 } from "fs";
|
|
10204
10194
|
|
|
@@ -10488,72 +10478,62 @@ async function sampleKeyUsage(token, probe = () => runUsageProbe(), hasSubscript
|
|
|
10488
10478
|
}
|
|
10489
10479
|
|
|
10490
10480
|
// src/setup/git-ready.ts
|
|
10491
|
-
|
|
10492
|
-
var
|
|
10493
|
-
var DEFAULT_TIMEOUT_MS = 6e5;
|
|
10481
|
+
var GATE_MARGIN_MS = 5 * 6e4;
|
|
10482
|
+
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
10483
|
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
10484
|
function awaitGitReady(opts = {}) {
|
|
10505
|
-
if (
|
|
10506
|
-
const markerPath = opts.markerPath ?? process.env.CONVEYOR_GIT_READY_MARKER;
|
|
10507
|
-
if (!markerPath) {
|
|
10485
|
+
if (!workbenchEnabled()) {
|
|
10508
10486
|
return Promise.resolve("not-gated");
|
|
10509
10487
|
}
|
|
10510
|
-
const
|
|
10488
|
+
const clientFn = opts.clientFn ?? getWorkbenchClient;
|
|
10511
10489
|
const timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
10512
10490
|
const pollMs = opts.pollMs ?? DEFAULT_POLL_MS;
|
|
10513
|
-
opts.onLog?.(
|
|
10514
|
-
return
|
|
10491
|
+
opts.onLog?.("waiting for workspace git (workbench daemon)");
|
|
10492
|
+
return pollDaemon(clientFn, timeoutMs, pollMs, opts.onLog, opts.signal);
|
|
10515
10493
|
}
|
|
10516
|
-
function
|
|
10517
|
-
const error = new Error("Operation aborted");
|
|
10518
|
-
error.name = "AbortError";
|
|
10519
|
-
return error;
|
|
10520
|
-
}
|
|
10521
|
-
function abortableDelay(ms, signal) {
|
|
10494
|
+
function delay(ms, signal) {
|
|
10522
10495
|
if (!signal) {
|
|
10523
10496
|
return new Promise((resolve) => {
|
|
10524
10497
|
setTimeout(resolve, ms);
|
|
10525
10498
|
});
|
|
10526
10499
|
}
|
|
10527
|
-
if (signal.aborted) return Promise.
|
|
10528
|
-
return new Promise((resolve
|
|
10500
|
+
if (signal.aborted) return Promise.resolve();
|
|
10501
|
+
return new Promise((resolve) => {
|
|
10529
10502
|
const timer = setTimeout(() => {
|
|
10530
10503
|
signal.removeEventListener("abort", onAbort);
|
|
10531
10504
|
resolve();
|
|
10532
10505
|
}, ms);
|
|
10533
10506
|
const onAbort = () => {
|
|
10534
10507
|
clearTimeout(timer);
|
|
10535
|
-
|
|
10508
|
+
resolve();
|
|
10536
10509
|
};
|
|
10537
10510
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
10538
10511
|
});
|
|
10539
10512
|
}
|
|
10540
|
-
async function
|
|
10513
|
+
async function pollDaemon(clientFn, timeoutMs, pollMs, onLog, signal) {
|
|
10541
10514
|
const deadline = Date.now() + timeoutMs;
|
|
10542
10515
|
for (; ; ) {
|
|
10543
|
-
if (signal?.aborted)
|
|
10544
|
-
|
|
10545
|
-
|
|
10546
|
-
return "ready";
|
|
10516
|
+
if (signal?.aborted) {
|
|
10517
|
+
onLog?.("workspace git wait aborted \u2014 giving up");
|
|
10518
|
+
return "timeout";
|
|
10547
10519
|
}
|
|
10548
|
-
|
|
10549
|
-
|
|
10550
|
-
|
|
10520
|
+
try {
|
|
10521
|
+
const frame = await clientFn().gitStatus();
|
|
10522
|
+
if (frame.state === "ready") {
|
|
10523
|
+
onLog?.("workspace git ready");
|
|
10524
|
+
return "ready";
|
|
10525
|
+
}
|
|
10526
|
+
if (frame.state === "failed") {
|
|
10527
|
+
onLog?.(`workspace git preparation failed: ${frame.reason ?? "unknown reason"}`);
|
|
10528
|
+
return "failed";
|
|
10529
|
+
}
|
|
10530
|
+
} catch {
|
|
10551
10531
|
}
|
|
10552
10532
|
if (Date.now() >= deadline) {
|
|
10553
10533
|
onLog?.(`workspace git not ready after ${timeoutMs}ms \u2014 giving up`);
|
|
10554
10534
|
return "timeout";
|
|
10555
10535
|
}
|
|
10556
|
-
await
|
|
10536
|
+
await delay(pollMs, signal);
|
|
10557
10537
|
}
|
|
10558
10538
|
}
|
|
10559
10539
|
|
|
@@ -10838,7 +10818,7 @@ async function handlePullBranch(workDir, branch) {
|
|
|
10838
10818
|
}
|
|
10839
10819
|
|
|
10840
10820
|
// src/runner/heavy-gate.ts
|
|
10841
|
-
import { readFileSync as
|
|
10821
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
10842
10822
|
import path from "path";
|
|
10843
10823
|
var GATE_KEYS = ["heavy", "test", "typecheck", "build"];
|
|
10844
10824
|
function runDir() {
|
|
@@ -10855,7 +10835,7 @@ function pidAlive(pid) {
|
|
|
10855
10835
|
function isHeavyGateActive() {
|
|
10856
10836
|
for (const key of GATE_KEYS) {
|
|
10857
10837
|
try {
|
|
10858
|
-
const raw =
|
|
10838
|
+
const raw = readFileSync2(path.join(runDir(), `${key}.pid`), "utf8").trim();
|
|
10859
10839
|
const pid = Number.parseInt(raw, 10);
|
|
10860
10840
|
if (Number.isInteger(pid) && pid > 0 && pidAlive(pid)) return true;
|
|
10861
10841
|
} catch {
|
|
@@ -11224,6 +11204,7 @@ var SessionRunner = class _SessionRunner {
|
|
|
11224
11204
|
}
|
|
11225
11205
|
if (delivery === "prefill") {
|
|
11226
11206
|
await this.setState("waiting_for_input");
|
|
11207
|
+
this.workspaceCommands?.notifyLoopReady();
|
|
11227
11208
|
await this.callbacks.onEvent({ type: "execute_mode", mode: effectiveMode, delivery });
|
|
11228
11209
|
if (this.pendingMessages.length > 0) {
|
|
11229
11210
|
if (!this.stopped) await this.setState("idle");
|
|
@@ -11314,6 +11295,7 @@ var SessionRunner = class _SessionRunner {
|
|
|
11314
11295
|
*/
|
|
11315
11296
|
async runPrefilledMessage(msg, effectiveMode) {
|
|
11316
11297
|
await this.setState("waiting_for_input");
|
|
11298
|
+
this.workspaceCommands?.notifyLoopReady();
|
|
11317
11299
|
await this.callbacks.onEvent({
|
|
11318
11300
|
type: "execute_mode",
|
|
11319
11301
|
mode: effectiveMode,
|
|
@@ -11598,6 +11580,7 @@ var SessionRunner = class _SessionRunner {
|
|
|
11598
11580
|
return this.callbacks.onStatusChange(status);
|
|
11599
11581
|
},
|
|
11600
11582
|
onEvent: (event) => {
|
|
11583
|
+
this.workspaceCommands?.notifyLoopReady();
|
|
11601
11584
|
if (event.type === "completed") {
|
|
11602
11585
|
this.completedThisTurn = true;
|
|
11603
11586
|
void this.connection.sendHeartbeat();
|
|
@@ -11754,12 +11737,12 @@ var SessionRunner = class _SessionRunner {
|
|
|
11754
11737
|
};
|
|
11755
11738
|
|
|
11756
11739
|
// src/setup/config.ts
|
|
11757
|
-
import { join as
|
|
11740
|
+
import { join as join8 } from "path";
|
|
11758
11741
|
var DEVCONTAINER_PATH = ".devcontainer/conveyor/devcontainer.json";
|
|
11759
11742
|
var DEVCONTAINER_PORT_DENY_LIST = /* @__PURE__ */ new Set([5432, 6379, 9200]);
|
|
11760
11743
|
async function loadForwardPorts(workspaceDir) {
|
|
11761
11744
|
try {
|
|
11762
|
-
const raw = await readWorkspaceFile(
|
|
11745
|
+
const raw = await readWorkspaceFile(join8(workspaceDir, DEVCONTAINER_PATH));
|
|
11763
11746
|
const parsed = JSON.parse(raw);
|
|
11764
11747
|
const ports = (parsed.forwardPorts ?? []).filter(
|
|
11765
11748
|
(p) => typeof p === "number" && !DEVCONTAINER_PORT_DENY_LIST.has(p)
|
|
@@ -11853,4 +11836,4 @@ export {
|
|
|
11853
11836
|
loadConveyorConfig,
|
|
11854
11837
|
unshallowRepo
|
|
11855
11838
|
};
|
|
11856
|
-
//# sourceMappingURL=chunk-
|
|
11839
|
+
//# sourceMappingURL=chunk-NI5L2R2N.js.map
|