@integrity-labs/agt-cli 0.7.6 → 0.7.7
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.
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
provision,
|
|
9
9
|
requireHost,
|
|
10
10
|
resolveChannels
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-QS2GCIWQ.js";
|
|
12
12
|
import {
|
|
13
13
|
findTaskByTemplate,
|
|
14
14
|
getProjectDir,
|
|
@@ -1308,10 +1308,13 @@ async function pollCycle() {
|
|
|
1308
1308
|
const currentIds = new Set(agents.map((a) => a.agent_id));
|
|
1309
1309
|
for (const prev of state.agents) {
|
|
1310
1310
|
if (!currentIds.has(prev.agentId)) {
|
|
1311
|
-
log(`Agent '${prev.codeName}'
|
|
1311
|
+
log(`Agent '${prev.codeName}' removed from host (deleted or unassigned)`);
|
|
1312
1312
|
const adapter = resolveAgentFramework(prev.codeName);
|
|
1313
|
-
clearAgentCaches(prev.agentId, prev.codeName);
|
|
1314
1313
|
await stopGatewayIfRunning(prev.codeName, adapter);
|
|
1314
|
+
freePort(prev.codeName);
|
|
1315
|
+
const agentDir = join2(config.configDir, prev.codeName, "provision");
|
|
1316
|
+
await cleanupAgentFiles(prev.codeName, agentDir);
|
|
1317
|
+
clearAgentCaches(prev.agentId, prev.codeName);
|
|
1315
1318
|
}
|
|
1316
1319
|
}
|
|
1317
1320
|
await healthCheckGateways(agentStates);
|
|
@@ -2545,8 +2548,23 @@ var realtimeDriftStarted = false;
|
|
|
2545
2548
|
var realtimeKanbanStarted = false;
|
|
2546
2549
|
var realtimeAssignStarted = false;
|
|
2547
2550
|
var realtimeConfigStarted = false;
|
|
2551
|
+
var realtimeSubscribedAgentIds = /* @__PURE__ */ new Set();
|
|
2548
2552
|
function ensureRealtimeStarted(agentStates) {
|
|
2549
|
-
|
|
2553
|
+
const currentActiveIds = new Set(
|
|
2554
|
+
agentStates.filter((a) => a.status === "active").map((a) => a.agentId)
|
|
2555
|
+
);
|
|
2556
|
+
if (realtimeStarted) {
|
|
2557
|
+
const sameSize = currentActiveIds.size === realtimeSubscribedAgentIds.size;
|
|
2558
|
+
const sameMembers = sameSize && [...currentActiveIds].every((id) => realtimeSubscribedAgentIds.has(id));
|
|
2559
|
+
if (sameMembers) return;
|
|
2560
|
+
log("[realtime] Agent set changed \u2014 reconnecting subscriptions");
|
|
2561
|
+
stopRealtimeChat();
|
|
2562
|
+
realtimeStarted = false;
|
|
2563
|
+
realtimeDriftStarted = false;
|
|
2564
|
+
realtimeAssignStarted = false;
|
|
2565
|
+
realtimeConfigStarted = false;
|
|
2566
|
+
realtimeKanbanStarted = false;
|
|
2567
|
+
}
|
|
2550
2568
|
const activeAgentIds = agentStates.filter((a) => a.status === "active").map((a) => a.agentId);
|
|
2551
2569
|
if (activeAgentIds.length === 0) return;
|
|
2552
2570
|
const apiKey = process.env["AGT_API_KEY"];
|
|
@@ -2590,6 +2608,7 @@ function ensureRealtimeStarted(agentStates) {
|
|
|
2590
2608
|
log
|
|
2591
2609
|
});
|
|
2592
2610
|
realtimeStarted = true;
|
|
2611
|
+
realtimeSubscribedAgentIds = new Set(activeAgentIds);
|
|
2593
2612
|
log(`[realtime-chat] Started for ${activeAgentIds.length} agent(s)`);
|
|
2594
2613
|
}).catch((err) => {
|
|
2595
2614
|
log(`[realtime-chat] Failed to start: ${err.message}`);
|