@rallycry/conveyor-agent 7.0.12 → 7.1.0
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/{chunk-5CBPSIEV.js → chunk-QLY35BX7.js} +63 -16
- package/dist/chunk-QLY35BX7.js.map +1 -0
- package/dist/cli.js +43 -39
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/package.json +2 -1
- package/dist/chunk-5CBPSIEV.js.map +0 -1
|
@@ -9,12 +9,15 @@ import {
|
|
|
9
9
|
// src/connection/agent-connection.ts
|
|
10
10
|
import { io } from "socket.io-client";
|
|
11
11
|
var EVENT_BATCH_MS = 500;
|
|
12
|
+
var MAX_EVENT_BUFFER = 5e3;
|
|
12
13
|
var AgentConnection = class _AgentConnection {
|
|
13
14
|
socket = null;
|
|
14
15
|
config;
|
|
15
16
|
eventBuffer = [];
|
|
16
17
|
flushTimer = null;
|
|
17
18
|
lastEmittedStatus = null;
|
|
19
|
+
lastReportedStatus = null;
|
|
20
|
+
droppedEventCount = 0;
|
|
18
21
|
// Pending answer resolvers for askUserQuestion room-event fallback
|
|
19
22
|
pendingAnswerResolvers = /* @__PURE__ */ new Map();
|
|
20
23
|
// Dedup: suppress near-identical messages within a short window
|
|
@@ -186,10 +189,13 @@ var AgentConnection = class _AgentConnection {
|
|
|
186
189
|
});
|
|
187
190
|
this.drainPendingMessages(pendingMessages);
|
|
188
191
|
process.stderr.write("[conveyor-agent] Reconnected to session successfully\n");
|
|
189
|
-
if (this.lastEmittedStatus) {
|
|
192
|
+
if (this.lastEmittedStatus && this.lastEmittedStatus !== this.lastReportedStatus) {
|
|
193
|
+
const status = this.lastEmittedStatus;
|
|
190
194
|
void this.call("reportAgentStatus", {
|
|
191
195
|
sessionId: this.config.sessionId,
|
|
192
|
-
status
|
|
196
|
+
status
|
|
197
|
+
}).then(() => {
|
|
198
|
+
this.lastReportedStatus = status;
|
|
193
199
|
}).catch(() => {
|
|
194
200
|
});
|
|
195
201
|
}
|
|
@@ -260,6 +266,8 @@ var AgentConnection = class _AgentConnection {
|
|
|
260
266
|
void this.call("reportAgentStatus", {
|
|
261
267
|
sessionId: this.config.sessionId,
|
|
262
268
|
status
|
|
269
|
+
}).then(() => {
|
|
270
|
+
this.lastReportedStatus = status;
|
|
263
271
|
}).catch(() => {
|
|
264
272
|
});
|
|
265
273
|
}
|
|
@@ -401,12 +409,13 @@ ${q.question}${q.options.length ? "\n" + q.options.map((o) => `- ${o.label}: ${o
|
|
|
401
409
|
triggerIdentification() {
|
|
402
410
|
return this.call("triggerIdentification", { sessionId: this.config.sessionId });
|
|
403
411
|
}
|
|
404
|
-
requestScaleUp(tier, reason) {
|
|
405
|
-
|
|
412
|
+
async requestScaleUp(tier, reason) {
|
|
413
|
+
const r = await this.call("scaleUpResources", {
|
|
406
414
|
sessionId: this.config.sessionId,
|
|
407
415
|
tier,
|
|
408
416
|
reason
|
|
409
|
-
})
|
|
417
|
+
});
|
|
418
|
+
return { scaled: r.success };
|
|
410
419
|
}
|
|
411
420
|
async refreshAuthToken() {
|
|
412
421
|
const codespaceName = process.env.CODESPACE_NAME || process.env.CLAUDESPACE_NAME;
|
|
@@ -428,6 +437,16 @@ ${q.question}${q.options.length ? "\n" + q.options.map((o) => `- ${o.label}: ${o
|
|
|
428
437
|
// ── Event buffering ────────────────────────────────────────────────
|
|
429
438
|
sendEvent(event) {
|
|
430
439
|
if (!this.socket) return;
|
|
440
|
+
if (this.eventBuffer.length >= MAX_EVENT_BUFFER) {
|
|
441
|
+
this.eventBuffer.shift();
|
|
442
|
+
this.droppedEventCount++;
|
|
443
|
+
if (this.droppedEventCount === 1 || this.droppedEventCount % 500 === 0) {
|
|
444
|
+
process.stderr.write(
|
|
445
|
+
`[conveyor-agent] eventBuffer overflow \u2014 dropped ${this.droppedEventCount} event(s) (cap: ${MAX_EVENT_BUFFER})
|
|
446
|
+
`
|
|
447
|
+
);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
431
450
|
this.eventBuffer.push({ event });
|
|
432
451
|
if (!this.flushTimer) {
|
|
433
452
|
this.flushTimer = setTimeout(() => void this.flushEvents(), EVENT_BATCH_MS);
|
|
@@ -993,6 +1012,10 @@ var ReportAgentStatusRequestSchema = z.object({
|
|
|
993
1012
|
sessionId: z.string(),
|
|
994
1013
|
status: z.string()
|
|
995
1014
|
});
|
|
1015
|
+
var NotifyAgentVersionRequestSchema = z.object({
|
|
1016
|
+
sessionId: z.string(),
|
|
1017
|
+
agentVersion: z.string()
|
|
1018
|
+
});
|
|
996
1019
|
var CreateSubtaskRequestSchema = z.object({
|
|
997
1020
|
sessionId: z.string(),
|
|
998
1021
|
title: z.string().min(1),
|
|
@@ -3199,9 +3222,9 @@ function buildVoteSuggestionTool(connection) {
|
|
|
3199
3222
|
function buildScaleUpResourcesTool(connection) {
|
|
3200
3223
|
return defineTool(
|
|
3201
3224
|
"scale_up_resources",
|
|
3202
|
-
"Scale up the pod's CPU and memory resources. Use before running
|
|
3225
|
+
"Scale up the pod's CPU and memory resources to the 'build' tier. Use before running heavy operations like full test suites, integration tests, typechecks, or production builds. Pods start at the 'setup' tier by default \u2014 only call this when you actually need more. Scaling is one-way (up only).",
|
|
3203
3226
|
{
|
|
3204
|
-
tier: z2.
|
|
3227
|
+
tier: z2.literal("build").describe("The resource phase to scale up to"),
|
|
3205
3228
|
reason: z2.string().optional().describe("Brief reason for scaling (e.g., 'running test suite')")
|
|
3206
3229
|
},
|
|
3207
3230
|
async ({ tier, reason }) => {
|
|
@@ -6052,7 +6075,10 @@ var QueryBridge = class {
|
|
|
6052
6075
|
}
|
|
6053
6076
|
};
|
|
6054
6077
|
|
|
6055
|
-
// src/runner/session-runner.ts
|
|
6078
|
+
// src/runner/session-runner-helpers.ts
|
|
6079
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
6080
|
+
import { dirname, join as join2 } from "path";
|
|
6081
|
+
import { fileURLToPath } from "url";
|
|
6056
6082
|
function mapChatHistory(messages) {
|
|
6057
6083
|
if (!messages) return [];
|
|
6058
6084
|
return messages.map((m) => ({
|
|
@@ -6074,6 +6100,22 @@ function mapChatHistory(messages) {
|
|
|
6074
6100
|
} : {}
|
|
6075
6101
|
}));
|
|
6076
6102
|
}
|
|
6103
|
+
function readAgentVersion() {
|
|
6104
|
+
try {
|
|
6105
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
6106
|
+
for (const rel of ["../package.json", "../../package.json"]) {
|
|
6107
|
+
try {
|
|
6108
|
+
const pkg = JSON.parse(readFileSync2(join2(here, rel), "utf-8"));
|
|
6109
|
+
if (pkg.version) return pkg.version;
|
|
6110
|
+
} catch {
|
|
6111
|
+
}
|
|
6112
|
+
}
|
|
6113
|
+
} catch {
|
|
6114
|
+
}
|
|
6115
|
+
return null;
|
|
6116
|
+
}
|
|
6117
|
+
|
|
6118
|
+
// src/runner/session-runner.ts
|
|
6077
6119
|
var SessionRunner = class _SessionRunner {
|
|
6078
6120
|
connection;
|
|
6079
6121
|
mode;
|
|
@@ -6151,6 +6193,11 @@ var SessionRunner = class _SessionRunner {
|
|
|
6151
6193
|
this.pendingMessages.push({ content: msg.content, userId: msg.userId });
|
|
6152
6194
|
}
|
|
6153
6195
|
}
|
|
6196
|
+
const agentVersion = readAgentVersion();
|
|
6197
|
+
if (agentVersion) {
|
|
6198
|
+
this.connection.call("notifyAgentVersion", { sessionId: this.sessionId, agentVersion }).catch(() => {
|
|
6199
|
+
});
|
|
6200
|
+
}
|
|
6154
6201
|
}
|
|
6155
6202
|
/**
|
|
6156
6203
|
* Run the main agent lifecycle: fetch context, resolve mode, execute, loop.
|
|
@@ -6883,13 +6930,13 @@ var CommitWatcher = class {
|
|
|
6883
6930
|
// src/runner/worktree.ts
|
|
6884
6931
|
import { execSync as execSync4 } from "child_process";
|
|
6885
6932
|
import { existsSync } from "fs";
|
|
6886
|
-
import { join as
|
|
6933
|
+
import { join as join3 } from "path";
|
|
6887
6934
|
var WORKTREE_DIR = ".worktrees";
|
|
6888
6935
|
function ensureWorktree(projectDir, taskId, branch) {
|
|
6889
6936
|
if (projectDir.includes(`/${WORKTREE_DIR}/`)) {
|
|
6890
6937
|
return projectDir;
|
|
6891
6938
|
}
|
|
6892
|
-
const worktreePath =
|
|
6939
|
+
const worktreePath = join3(projectDir, WORKTREE_DIR, taskId);
|
|
6893
6940
|
if (existsSync(worktreePath)) {
|
|
6894
6941
|
if (branch) {
|
|
6895
6942
|
if (hasUncommittedChanges(worktreePath)) {
|
|
@@ -6935,7 +6982,7 @@ function detachWorktreeBranch(projectDir, branch) {
|
|
|
6935
6982
|
}
|
|
6936
6983
|
}
|
|
6937
6984
|
function removeWorktree(projectDir, taskId) {
|
|
6938
|
-
const worktreePath =
|
|
6985
|
+
const worktreePath = join3(projectDir, WORKTREE_DIR, taskId);
|
|
6939
6986
|
if (!existsSync(worktreePath)) return;
|
|
6940
6987
|
try {
|
|
6941
6988
|
execSync4(`git worktree remove "${worktreePath}" --force`, {
|
|
@@ -6950,7 +6997,7 @@ function removeWorktree(projectDir, taskId) {
|
|
|
6950
6997
|
import { fork } from "child_process";
|
|
6951
6998
|
import { execSync as execSync5 } from "child_process";
|
|
6952
6999
|
import * as path from "path";
|
|
6953
|
-
import { fileURLToPath } from "url";
|
|
7000
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
6954
7001
|
|
|
6955
7002
|
// src/tools/project-tools.ts
|
|
6956
7003
|
import { z as z9 } from "zod";
|
|
@@ -7302,7 +7349,7 @@ async function handleProjectChatMessage(message, connection, projectDir, session
|
|
|
7302
7349
|
|
|
7303
7350
|
// src/runner/project-runner.ts
|
|
7304
7351
|
var logger7 = createServiceLogger("ProjectRunner");
|
|
7305
|
-
var __filename =
|
|
7352
|
+
var __filename = fileURLToPath2(import.meta.url);
|
|
7306
7353
|
var __dirname = path.dirname(__filename);
|
|
7307
7354
|
var HEARTBEAT_INTERVAL_MS = 3e4;
|
|
7308
7355
|
var MAX_CONCURRENT = Math.max(1, parseInt(process.env.CONVEYOR_MAX_CONCURRENT ?? "10", 10) || 10);
|
|
@@ -7905,11 +7952,11 @@ var ProjectRunner = class {
|
|
|
7905
7952
|
|
|
7906
7953
|
// src/setup/config.ts
|
|
7907
7954
|
import { readFile as readFile2 } from "fs/promises";
|
|
7908
|
-
import { join as
|
|
7955
|
+
import { join as join4 } from "path";
|
|
7909
7956
|
var DEVCONTAINER_PATH = ".devcontainer/conveyor/devcontainer.json";
|
|
7910
7957
|
async function loadForwardPorts(workspaceDir) {
|
|
7911
7958
|
try {
|
|
7912
|
-
const raw = await readFile2(
|
|
7959
|
+
const raw = await readFile2(join4(workspaceDir, DEVCONTAINER_PATH), "utf-8");
|
|
7913
7960
|
const parsed = JSON.parse(raw);
|
|
7914
7961
|
return parsed.forwardPorts ?? [];
|
|
7915
7962
|
} catch {
|
|
@@ -7956,4 +8003,4 @@ export {
|
|
|
7956
8003
|
loadForwardPorts,
|
|
7957
8004
|
loadConveyorConfig
|
|
7958
8005
|
};
|
|
7959
|
-
//# sourceMappingURL=chunk-
|
|
8006
|
+
//# sourceMappingURL=chunk-QLY35BX7.js.map
|