@rallycry/conveyor-agent 7.1.4 → 7.1.6
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-H2GKXPFI.js → chunk-6EJDKTIE.js} +41 -71
- package/dist/chunk-6EJDKTIE.js.map +1 -0
- package/dist/{chunk-U6AYNVS7.js → chunk-RRXX6DTB.js} +2 -1
- package/dist/chunk-RRXX6DTB.js.map +1 -0
- package/dist/cli.js +6 -4
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +7 -17
- package/dist/index.js +2 -2
- package/dist/{tag-audit-handler-BM6MMS5T.js → tag-audit-handler-WPGSBNXO.js} +2 -2
- package/dist/{task-audit-handler-URD2BOC4.js → task-audit-handler-AOYSFO5B.js} +2 -2
- package/package.json +2 -2
- package/dist/chunk-H2GKXPFI.js.map +0 -1
- package/dist/chunk-U6AYNVS7.js.map +0 -1
- /package/dist/{tag-audit-handler-BM6MMS5T.js.map → tag-audit-handler-WPGSBNXO.js.map} +0 -0
- /package/dist/{task-audit-handler-URD2BOC4.js.map → task-audit-handler-AOYSFO5B.js.map} +0 -0
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
createHarness,
|
|
8
8
|
createServiceLogger,
|
|
9
9
|
defineTool
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-RRXX6DTB.js";
|
|
11
11
|
|
|
12
12
|
// src/connection/agent-connection.ts
|
|
13
13
|
import { io } from "socket.io-client";
|
|
@@ -37,7 +37,6 @@ var AgentConnection = class _AgentConnection {
|
|
|
37
37
|
stopCallback = null;
|
|
38
38
|
softStopCallback = null;
|
|
39
39
|
modeChangeCallback = null;
|
|
40
|
-
wakeCallback = null;
|
|
41
40
|
apiKeyUpdateCallback = null;
|
|
42
41
|
constructor(config) {
|
|
43
42
|
this.config = config;
|
|
@@ -119,15 +118,6 @@ var AgentConnection = class _AgentConnection {
|
|
|
119
118
|
if (this.modeChangeCallback) this.modeChangeCallback(data);
|
|
120
119
|
else this.earlyModeChanges.push(data);
|
|
121
120
|
});
|
|
122
|
-
this.socket.on("session:wake", () => {
|
|
123
|
-
if (this.wakeCallback) {
|
|
124
|
-
this.wakeCallback();
|
|
125
|
-
} else if (this.messageCallback) {
|
|
126
|
-
this.messageCallback({ content: "", userId: "system" });
|
|
127
|
-
} else {
|
|
128
|
-
this.earlyMessages.push({ content: "", userId: "system" });
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
121
|
this.socket.on(
|
|
132
122
|
"session:answerQuestion",
|
|
133
123
|
(data) => {
|
|
@@ -256,9 +246,6 @@ var AgentConnection = class _AgentConnection {
|
|
|
256
246
|
for (const data of this.earlyModeChanges) callback(data);
|
|
257
247
|
this.earlyModeChanges = [];
|
|
258
248
|
}
|
|
259
|
-
onWake(callback) {
|
|
260
|
-
this.wakeCallback = callback;
|
|
261
|
-
}
|
|
262
249
|
onApiKeyUpdate(callback) {
|
|
263
250
|
this.apiKeyUpdateCallback = callback;
|
|
264
251
|
}
|
|
@@ -319,8 +306,7 @@ var AgentConnection = class _AgentConnection {
|
|
|
319
306
|
fetching_context: "active",
|
|
320
307
|
connected: "active",
|
|
321
308
|
connecting: "active",
|
|
322
|
-
idle: "idle"
|
|
323
|
-
sleeping: "idle"
|
|
309
|
+
idle: "idle"
|
|
324
310
|
};
|
|
325
311
|
const heartbeatStatus = statusMap[this.lastEmittedStatus ?? "idle"] ?? "active";
|
|
326
312
|
void this.call("heartbeat", {
|
|
@@ -603,7 +589,6 @@ var ModeController = class {
|
|
|
603
589
|
// src/runner/lifecycle.ts
|
|
604
590
|
var DEFAULT_LIFECYCLE_CONFIG = {
|
|
605
591
|
idleTimeoutMs: 30 * 60 * 1e3,
|
|
606
|
-
sleepGracePeriodMs: 5e3,
|
|
607
592
|
heartbeatIntervalMs: 3e4
|
|
608
593
|
};
|
|
609
594
|
var Lifecycle = class {
|
|
@@ -612,15 +597,10 @@ var Lifecycle = class {
|
|
|
612
597
|
heartbeatTimer = null;
|
|
613
598
|
idleTimer = null;
|
|
614
599
|
idleCheckInterval = null;
|
|
615
|
-
sleepShutdownTimer = null;
|
|
616
|
-
_isSleeping = false;
|
|
617
600
|
constructor(config, callbacks) {
|
|
618
601
|
this.config = config;
|
|
619
602
|
this.callbacks = callbacks;
|
|
620
603
|
}
|
|
621
|
-
get isSleeping() {
|
|
622
|
-
return this._isSleeping;
|
|
623
|
-
}
|
|
624
604
|
// ── Heartbeat ──────────────────────────────────────────────────────
|
|
625
605
|
startHeartbeat() {
|
|
626
606
|
this.stopHeartbeat();
|
|
@@ -639,37 +619,11 @@ var Lifecycle = class {
|
|
|
639
619
|
this.clearIdleTimers();
|
|
640
620
|
this.idleTimer = setTimeout(() => {
|
|
641
621
|
this.callbacks.onIdleTimeout();
|
|
642
|
-
this.enterSleepMode();
|
|
643
622
|
}, this.config.idleTimeoutMs);
|
|
644
623
|
}
|
|
645
624
|
cancelIdleTimer() {
|
|
646
625
|
this.clearIdleTimers();
|
|
647
626
|
}
|
|
648
|
-
// ── Sleep mode ─────────────────────────────────────────────────────
|
|
649
|
-
enterSleepMode() {
|
|
650
|
-
this._isSleeping = true;
|
|
651
|
-
this.callbacks.onSleep();
|
|
652
|
-
this.sleepShutdownTimer = setTimeout(() => {
|
|
653
|
-
this.callbacks.onSleepGraceExpired();
|
|
654
|
-
}, this.config.sleepGracePeriodMs);
|
|
655
|
-
}
|
|
656
|
-
/** Wake from sleep — cancels shutdown timer, resets idle */
|
|
657
|
-
wake() {
|
|
658
|
-
if (this.sleepShutdownTimer) {
|
|
659
|
-
clearTimeout(this.sleepShutdownTimer);
|
|
660
|
-
this.sleepShutdownTimer = null;
|
|
661
|
-
}
|
|
662
|
-
this._isSleeping = false;
|
|
663
|
-
this.callbacks.onWake();
|
|
664
|
-
}
|
|
665
|
-
/** Cancel the sleep shutdown timer (e.g. when a message arrives) */
|
|
666
|
-
cancelSleepShutdown() {
|
|
667
|
-
if (this.sleepShutdownTimer) {
|
|
668
|
-
clearTimeout(this.sleepShutdownTimer);
|
|
669
|
-
this.sleepShutdownTimer = null;
|
|
670
|
-
}
|
|
671
|
-
this._isSleeping = false;
|
|
672
|
-
}
|
|
673
627
|
// ── Cleanup ────────────────────────────────────────────────────────
|
|
674
628
|
destroy() {
|
|
675
629
|
this.stopHeartbeat();
|
|
@@ -685,11 +639,6 @@ var Lifecycle = class {
|
|
|
685
639
|
clearInterval(this.idleCheckInterval);
|
|
686
640
|
this.idleCheckInterval = null;
|
|
687
641
|
}
|
|
688
|
-
if (this.sleepShutdownTimer) {
|
|
689
|
-
clearTimeout(this.sleepShutdownTimer);
|
|
690
|
-
this.sleepShutdownTimer = null;
|
|
691
|
-
}
|
|
692
|
-
this._isSleeping = false;
|
|
693
642
|
}
|
|
694
643
|
};
|
|
695
644
|
|
|
@@ -974,6 +923,9 @@ var PlanSync = class {
|
|
|
974
923
|
}
|
|
975
924
|
};
|
|
976
925
|
|
|
926
|
+
// src/execution/query-executor.ts
|
|
927
|
+
import { createHash } from "crypto";
|
|
928
|
+
|
|
977
929
|
// src/execution/pack-runner-prompt.ts
|
|
978
930
|
function findLastAgentMessageIndex(history) {
|
|
979
931
|
for (let i = history.length - 1; i >= 0; i--) {
|
|
@@ -5069,6 +5021,10 @@ function buildHooks(host) {
|
|
|
5069
5021
|
]
|
|
5070
5022
|
};
|
|
5071
5023
|
}
|
|
5024
|
+
function taskIdToSessionUuid(taskId) {
|
|
5025
|
+
const hash = createHash("sha256").update(taskId).digest("hex");
|
|
5026
|
+
return `${hash.slice(0, 8)}-${hash.slice(8, 12)}-8${hash.slice(13, 16)}-a${hash.slice(17, 20)}-${hash.slice(20, 32)}`;
|
|
5027
|
+
}
|
|
5072
5028
|
function isReadOnlyMode(mode, hasExitedPlanMode) {
|
|
5073
5029
|
return mode === "discovery" || mode === "help" || mode === "auto" && !hasExitedPlanMode;
|
|
5074
5030
|
}
|
|
@@ -5117,6 +5073,7 @@ function buildQueryOptions(host, context) {
|
|
|
5117
5073
|
abortController: host.abortController ?? void 0,
|
|
5118
5074
|
disallowedTools: buildDisallowedTools(settings, mode, host.hasExitedPlanMode),
|
|
5119
5075
|
enableFileCheckpointing: settings.enableFileCheckpointing,
|
|
5076
|
+
sessionId: taskIdToSessionUuid(context.taskId),
|
|
5120
5077
|
stderr: (data) => {
|
|
5121
5078
|
logger2.warn("Claude Code stderr", { data: data.trimEnd() });
|
|
5122
5079
|
}
|
|
@@ -5190,7 +5147,7 @@ async function runSdkQuery(host, context, followUpContent) {
|
|
|
5190
5147
|
host.snapshotPlanFiles();
|
|
5191
5148
|
}
|
|
5192
5149
|
const options = buildQueryOptions(host, context);
|
|
5193
|
-
const resume = context.
|
|
5150
|
+
const resume = taskIdToSessionUuid(context.taskId);
|
|
5194
5151
|
if (followUpContent) {
|
|
5195
5152
|
const prompt = await buildFollowUpPrompt(host, context, followUpContent);
|
|
5196
5153
|
const agentQuery = host.harness.executeQuery({
|
|
@@ -5637,24 +5594,13 @@ var SessionRunner = class _SessionRunner {
|
|
|
5637
5594
|
this.lifecycle = new Lifecycle(lifecycleConfig, {
|
|
5638
5595
|
onHeartbeat: () => this.connection.sendHeartbeat(),
|
|
5639
5596
|
onIdleTimeout: () => {
|
|
5640
|
-
process.stderr.write("[conveyor-agent] Idle timeout reached,
|
|
5641
|
-
this.connection.emitStatus("sleeping");
|
|
5642
|
-
},
|
|
5643
|
-
onSleep: () => {
|
|
5644
|
-
process.stderr.write("[conveyor-agent] Sleep mode active\n");
|
|
5645
|
-
this.connection.postChatMessage("Agent sleeping \u2014 send a message or click Resume to wake.");
|
|
5646
|
-
},
|
|
5647
|
-
onSleepGraceExpired: () => {
|
|
5597
|
+
process.stderr.write("[conveyor-agent] Idle timeout reached, stopping agent\n");
|
|
5648
5598
|
this.stopped = true;
|
|
5649
5599
|
if (this.inputResolver) {
|
|
5650
5600
|
const resolver = this.inputResolver;
|
|
5651
5601
|
this.inputResolver = null;
|
|
5652
5602
|
resolver(null);
|
|
5653
5603
|
}
|
|
5654
|
-
},
|
|
5655
|
-
onWake: () => {
|
|
5656
|
-
process.stderr.write("[conveyor-agent] Woken from sleep\n");
|
|
5657
|
-
this.lifecycle.cancelSleepShutdown();
|
|
5658
5604
|
}
|
|
5659
5605
|
});
|
|
5660
5606
|
}
|
|
@@ -5822,7 +5768,6 @@ var SessionRunner = class _SessionRunner {
|
|
|
5822
5768
|
}
|
|
5823
5769
|
/** Inject a message (from connection callback or external source) */
|
|
5824
5770
|
injectMessage(msg) {
|
|
5825
|
-
this.lifecycle.cancelSleepShutdown();
|
|
5826
5771
|
if (this.inputResolver) {
|
|
5827
5772
|
const resolve2 = this.inputResolver;
|
|
5828
5773
|
this.inputResolver = null;
|
|
@@ -6039,11 +5984,13 @@ var SessionRunner = class _SessionRunner {
|
|
|
6039
5984
|
if (this.fullContext && action.newMode === "review") {
|
|
6040
5985
|
this.fullContext.claudeSessionId = null;
|
|
6041
5986
|
}
|
|
5987
|
+
if (this.fullContext && action.newMode === "building") {
|
|
5988
|
+
void this.refreshBranchForBuilding();
|
|
5989
|
+
}
|
|
6042
5990
|
this.connection.emitModeChanged(action.newMode);
|
|
6043
5991
|
this.softStop();
|
|
6044
5992
|
}
|
|
6045
5993
|
});
|
|
6046
|
-
this.connection.onWake(() => this.lifecycle.wake());
|
|
6047
5994
|
this.connection.onApiKeyUpdate((data) => {
|
|
6048
5995
|
if (data.isSubscription) {
|
|
6049
5996
|
process.env.CLAUDE_CODE_OAUTH_TOKEN = data.apiKey;
|
|
@@ -6054,6 +6001,23 @@ var SessionRunner = class _SessionRunner {
|
|
|
6054
6001
|
}
|
|
6055
6002
|
});
|
|
6056
6003
|
}
|
|
6004
|
+
/** Re-fetch task context to pick up a newly created branch and check it out. */
|
|
6005
|
+
async refreshBranchForBuilding() {
|
|
6006
|
+
try {
|
|
6007
|
+
const ctx = await this.connection.call("getTaskContext", {
|
|
6008
|
+
sessionId: this.sessionId,
|
|
6009
|
+
includeHistory: false
|
|
6010
|
+
});
|
|
6011
|
+
if (ctx?.githubBranch && this.fullContext) {
|
|
6012
|
+
this.fullContext.githubBranch = ctx.githubBranch;
|
|
6013
|
+
ensureOnTaskBranch(this.config.workspaceDir, ctx.githubBranch);
|
|
6014
|
+
}
|
|
6015
|
+
} catch {
|
|
6016
|
+
process.stderr.write(
|
|
6017
|
+
"[conveyor-agent] Warning: failed to refresh branch for building transition\n"
|
|
6018
|
+
);
|
|
6019
|
+
}
|
|
6020
|
+
}
|
|
6057
6021
|
async setState(status) {
|
|
6058
6022
|
this._state = status;
|
|
6059
6023
|
await this.connection.emitStatus(status);
|
|
@@ -6066,6 +6030,12 @@ var SessionRunner = class _SessionRunner {
|
|
|
6066
6030
|
this.lifecycle.destroy();
|
|
6067
6031
|
await this.setState(finalState);
|
|
6068
6032
|
this.connection.disconnect();
|
|
6033
|
+
this._finalState = finalState;
|
|
6034
|
+
}
|
|
6035
|
+
_finalState = null;
|
|
6036
|
+
/** The final status after run() completes. Use to determine exit code. */
|
|
6037
|
+
get finalState() {
|
|
6038
|
+
return this._finalState;
|
|
6069
6039
|
}
|
|
6070
6040
|
logInitialization() {
|
|
6071
6041
|
const context = {
|
|
@@ -7109,7 +7079,7 @@ var ProjectRunner = class {
|
|
|
7109
7079
|
async handleAuditTags(request) {
|
|
7110
7080
|
this.connection.emitStatus("busy");
|
|
7111
7081
|
try {
|
|
7112
|
-
const { handleTagAudit } = await import("./tag-audit-handler-
|
|
7082
|
+
const { handleTagAudit } = await import("./tag-audit-handler-WPGSBNXO.js");
|
|
7113
7083
|
await handleTagAudit(request, this.connection, this.projectDir);
|
|
7114
7084
|
} catch (error) {
|
|
7115
7085
|
const msg = error instanceof Error ? error.message : String(error);
|
|
@@ -7132,7 +7102,7 @@ var ProjectRunner = class {
|
|
|
7132
7102
|
async handleAuditTasks(request) {
|
|
7133
7103
|
this.connection.emitStatus("busy");
|
|
7134
7104
|
try {
|
|
7135
|
-
const { handleTaskAudit } = await import("./task-audit-handler-
|
|
7105
|
+
const { handleTaskAudit } = await import("./task-audit-handler-AOYSFO5B.js");
|
|
7136
7106
|
await handleTaskAudit(request, this.connection, this.projectDir);
|
|
7137
7107
|
} catch (error) {
|
|
7138
7108
|
const msg = error instanceof Error ? error.message : String(error);
|
|
@@ -7572,4 +7542,4 @@ export {
|
|
|
7572
7542
|
loadForwardPorts,
|
|
7573
7543
|
loadConveyorConfig
|
|
7574
7544
|
};
|
|
7575
|
-
//# sourceMappingURL=chunk-
|
|
7545
|
+
//# sourceMappingURL=chunk-6EJDKTIE.js.map
|