@rallycry/conveyor-agent 7.1.4 → 7.1.5
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-36TKGT6T.js} +9 -67
- package/dist/chunk-36TKGT6T.js.map +1 -0
- package/dist/cli.js +5 -3
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +5 -17
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-H2GKXPFI.js.map +0 -1
|
@@ -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
|
|
|
@@ -5637,24 +5586,13 @@ var SessionRunner = class _SessionRunner {
|
|
|
5637
5586
|
this.lifecycle = new Lifecycle(lifecycleConfig, {
|
|
5638
5587
|
onHeartbeat: () => this.connection.sendHeartbeat(),
|
|
5639
5588
|
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: () => {
|
|
5589
|
+
process.stderr.write("[conveyor-agent] Idle timeout reached, stopping agent\n");
|
|
5648
5590
|
this.stopped = true;
|
|
5649
5591
|
if (this.inputResolver) {
|
|
5650
5592
|
const resolver = this.inputResolver;
|
|
5651
5593
|
this.inputResolver = null;
|
|
5652
5594
|
resolver(null);
|
|
5653
5595
|
}
|
|
5654
|
-
},
|
|
5655
|
-
onWake: () => {
|
|
5656
|
-
process.stderr.write("[conveyor-agent] Woken from sleep\n");
|
|
5657
|
-
this.lifecycle.cancelSleepShutdown();
|
|
5658
5596
|
}
|
|
5659
5597
|
});
|
|
5660
5598
|
}
|
|
@@ -5822,7 +5760,6 @@ var SessionRunner = class _SessionRunner {
|
|
|
5822
5760
|
}
|
|
5823
5761
|
/** Inject a message (from connection callback or external source) */
|
|
5824
5762
|
injectMessage(msg) {
|
|
5825
|
-
this.lifecycle.cancelSleepShutdown();
|
|
5826
5763
|
if (this.inputResolver) {
|
|
5827
5764
|
const resolve2 = this.inputResolver;
|
|
5828
5765
|
this.inputResolver = null;
|
|
@@ -6043,7 +5980,6 @@ var SessionRunner = class _SessionRunner {
|
|
|
6043
5980
|
this.softStop();
|
|
6044
5981
|
}
|
|
6045
5982
|
});
|
|
6046
|
-
this.connection.onWake(() => this.lifecycle.wake());
|
|
6047
5983
|
this.connection.onApiKeyUpdate((data) => {
|
|
6048
5984
|
if (data.isSubscription) {
|
|
6049
5985
|
process.env.CLAUDE_CODE_OAUTH_TOKEN = data.apiKey;
|
|
@@ -6066,6 +6002,12 @@ var SessionRunner = class _SessionRunner {
|
|
|
6066
6002
|
this.lifecycle.destroy();
|
|
6067
6003
|
await this.setState(finalState);
|
|
6068
6004
|
this.connection.disconnect();
|
|
6005
|
+
this._finalState = finalState;
|
|
6006
|
+
}
|
|
6007
|
+
_finalState = null;
|
|
6008
|
+
/** The final status after run() completes. Use to determine exit code. */
|
|
6009
|
+
get finalState() {
|
|
6010
|
+
return this._finalState;
|
|
6069
6011
|
}
|
|
6070
6012
|
logInitialization() {
|
|
6071
6013
|
const context = {
|
|
@@ -7572,4 +7514,4 @@ export {
|
|
|
7572
7514
|
loadForwardPorts,
|
|
7573
7515
|
loadConveyorConfig
|
|
7574
7516
|
};
|
|
7575
|
-
//# sourceMappingURL=chunk-
|
|
7517
|
+
//# sourceMappingURL=chunk-36TKGT6T.js.map
|