@sjawhar/pi-legion 12.1.1 → 12.2.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/legion.js +14 -3
- package/package.json +1 -1
package/dist/legion.js
CHANGED
|
@@ -7495,7 +7495,7 @@ async function findHandoffCommit(input) {
|
|
|
7495
7495
|
|
|
7496
7496
|
// ../pi-shared/src/interface.ts
|
|
7497
7497
|
import { logger } from "@oh-my-pi/pi-utils";
|
|
7498
|
-
var ENVOY_PLUGIN_INTERFACE_VERSION =
|
|
7498
|
+
var ENVOY_PLUGIN_INTERFACE_VERSION = 5;
|
|
7499
7499
|
var ENVOY_PLUGIN_INTERFACE_KEY = Symbol.for("legion.pi-shared.envoy-plugin-interface");
|
|
7500
7500
|
var LEGION_PLUGIN_LOADED_KEY = Symbol.for("legion.pi-legion.loaded");
|
|
7501
7501
|
var LEGACY_LEGION_LOADED_KEY = Symbol.for("legion.pi-envoy.legion-loaded");
|
|
@@ -7612,6 +7612,9 @@ function onEnvoyRoleRegained(listener) {
|
|
|
7612
7612
|
}
|
|
7613
7613
|
|
|
7614
7614
|
// ../pi-shared/src/startup-turn.ts
|
|
7615
|
+
function markStartupTurnPending(sessionID) {
|
|
7616
|
+
envoyPluginInterface().startupTurn = { session: sessionID, sentAt: undefined };
|
|
7617
|
+
}
|
|
7615
7618
|
function markStartupTurnSent(sessionID) {
|
|
7616
7619
|
envoyPluginInterface().startupTurn = { session: sessionID, sentAt: Date.now() };
|
|
7617
7620
|
}
|
|
@@ -8178,7 +8181,7 @@ async function bootLegionClaim(host) {
|
|
|
8178
8181
|
// package.json
|
|
8179
8182
|
var package_default = {
|
|
8180
8183
|
name: "@sjawhar/pi-legion",
|
|
8181
|
-
version: "12.
|
|
8184
|
+
version: "12.2.0",
|
|
8182
8185
|
license: "Apache-2.0",
|
|
8183
8186
|
type: "module",
|
|
8184
8187
|
omp: {
|
|
@@ -8505,6 +8508,7 @@ function createControllerSession(deps) {
|
|
|
8505
8508
|
const envoyContext = "setInterval" in context ? context : undefined;
|
|
8506
8509
|
if (startMessage !== undefined && !startMessageSent) {
|
|
8507
8510
|
if (context.sessionManager.getSessionId() !== sessionID) {
|
|
8511
|
+
clearStartupTurn(sessionID);
|
|
8508
8512
|
startHandedOver = true;
|
|
8509
8513
|
return;
|
|
8510
8514
|
}
|
|
@@ -8537,8 +8541,12 @@ function createControllerSession(deps) {
|
|
|
8537
8541
|
claimWidget = undefined;
|
|
8538
8542
|
};
|
|
8539
8543
|
const handleSessionStart = async (context) => {
|
|
8540
|
-
if (!daemonLaunchedController(process.env))
|
|
8544
|
+
if (!daemonLaunchedController(process.env)) {
|
|
8545
|
+
if (operatorLaunchedController(process.env) && process.env.LEGION_CONTROLLER_START_MESSAGE && !startMessageSent) {
|
|
8546
|
+
markStartupTurnPending(context.sessionManager.getSessionId());
|
|
8547
|
+
}
|
|
8541
8548
|
return;
|
|
8549
|
+
}
|
|
8542
8550
|
const sessionID = context.sessionManager.getSessionId();
|
|
8543
8551
|
if (controllerSessionID === undefined || controllerSessionID === sessionID) {
|
|
8544
8552
|
await claim(context);
|
|
@@ -8555,11 +8563,14 @@ function createControllerSession(deps) {
|
|
|
8555
8563
|
context.ui.notify("legion: this process already sent the start message, but its controller claim did not finish; run /legion-claim-controller to claim the controller role and its wakes again.", "warning");
|
|
8556
8564
|
return;
|
|
8557
8565
|
}
|
|
8566
|
+
const claimed = context.sessionManager.getSessionId();
|
|
8558
8567
|
try {
|
|
8559
8568
|
await claimOnce(context, { registered: false });
|
|
8560
8569
|
} catch (error) {
|
|
8561
8570
|
const message = messageFor(error);
|
|
8562
8571
|
logger3.error(`[legion] the controller claim failed: ${message}`);
|
|
8572
|
+
if (!startMessageSent)
|
|
8573
|
+
clearStartupTurn(claimed);
|
|
8563
8574
|
context.ui.notify(startMessageSent ? `legion: the controller claim failed after the start message was sent: ${message}. The start turn has the controller's registration; run /legion-claim-controller to claim the controller role and its wakes again.` : `legion: the controller claim failed: ${message}. Run /legion-claim-controller to claim again; it sends the start message once the claim succeeds.`, "warning");
|
|
8564
8575
|
}
|
|
8565
8576
|
});
|