@integrity-labs/agt-cli 0.19.3 → 0.19.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/bin/agt.js +3 -3
- package/dist/{chunk-CZGII2KB.js → chunk-IOTGOCC4.js} +33 -2
- package/dist/chunk-IOTGOCC4.js.map +1 -0
- package/dist/lib/manager-worker.js +52 -16
- package/dist/lib/manager-worker.js.map +1 -1
- package/mcp/index.js +134 -0
- package/package.json +1 -1
- package/dist/chunk-CZGII2KB.js.map +0 -1
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
resolveChannels,
|
|
23
23
|
resolveDmTarget,
|
|
24
24
|
wrapScheduledTaskPrompt
|
|
25
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-IOTGOCC4.js";
|
|
26
26
|
import {
|
|
27
27
|
findTaskByTemplate,
|
|
28
28
|
getProjectDir,
|
|
@@ -871,6 +871,7 @@ function killAgentChannelProcesses(codeName, opts) {
|
|
|
871
871
|
|
|
872
872
|
// src/lib/channel-input-watchdog.ts
|
|
873
873
|
var STUCK_THRESHOLD_MS = 5e3;
|
|
874
|
+
var ATTACHED_STUCK_THRESHOLD_MS = 15e3;
|
|
874
875
|
var INPUT_BOX_DIVIDER = /^[─━]{10,}/;
|
|
875
876
|
var PROMPT_PREFIX = "\u276F ";
|
|
876
877
|
function decide(pane, prev, now, config2 = {}) {
|
|
@@ -942,17 +943,18 @@ function checkChannelInputs(codeNames, io, config2 = {}, states = sharedStates)
|
|
|
942
943
|
}
|
|
943
944
|
}
|
|
944
945
|
function checkOne(codeName, io, config2, states) {
|
|
945
|
-
if (io.isClientAttached(codeName)) {
|
|
946
|
-
states.delete(codeName);
|
|
947
|
-
return;
|
|
948
|
-
}
|
|
949
946
|
const pane = io.capturePane(codeName);
|
|
950
947
|
if (!pane) {
|
|
951
948
|
states.delete(codeName);
|
|
952
949
|
return;
|
|
953
950
|
}
|
|
951
|
+
const attached = io.isClientAttached(codeName);
|
|
952
|
+
const effectiveConfig = attached ? {
|
|
953
|
+
...config2,
|
|
954
|
+
stuckThresholdMs: config2.attachedStuckThresholdMs ?? ATTACHED_STUCK_THRESHOLD_MS
|
|
955
|
+
} : config2;
|
|
954
956
|
const prev = states.get(codeName);
|
|
955
|
-
const { fire, next } = decide(pane, prev, io.now(),
|
|
957
|
+
const { fire, next } = decide(pane, prev, io.now(), effectiveConfig);
|
|
956
958
|
if (next === void 0) {
|
|
957
959
|
states.delete(codeName);
|
|
958
960
|
} else {
|
|
@@ -1457,6 +1459,14 @@ function startRealtimeIntegrationContext(config2) {
|
|
|
1457
1459
|
});
|
|
1458
1460
|
log2(`[realtime] Subscribing to plugin_context for ${agentIds.length} agent(s)`);
|
|
1459
1461
|
}
|
|
1462
|
+
function stopRealtimeIntegrationContext() {
|
|
1463
|
+
if (!integrationContextChannel) return;
|
|
1464
|
+
try {
|
|
1465
|
+
integrationContextChannel.unsubscribe();
|
|
1466
|
+
} catch {
|
|
1467
|
+
}
|
|
1468
|
+
integrationContextChannel = null;
|
|
1469
|
+
}
|
|
1460
1470
|
function isRealtimeConnected() {
|
|
1461
1471
|
return connected;
|
|
1462
1472
|
}
|
|
@@ -1620,7 +1630,7 @@ function clearAgentCaches(agentId, codeName) {
|
|
|
1620
1630
|
var cachedFrameworkVersion = null;
|
|
1621
1631
|
var lastVersionCheckAt = 0;
|
|
1622
1632
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
1623
|
-
var agtCliVersion = true ? "0.19.
|
|
1633
|
+
var agtCliVersion = true ? "0.19.5" : "dev";
|
|
1624
1634
|
function resolveBrewPath(execFileSync2) {
|
|
1625
1635
|
try {
|
|
1626
1636
|
const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
|
|
@@ -4482,7 +4492,7 @@ ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash("sha256").u
|
|
|
4482
4492
|
var realtimeStarted = false;
|
|
4483
4493
|
var realtimeDriftStarted = false;
|
|
4484
4494
|
var realtimeKanbanStarted = false;
|
|
4485
|
-
var
|
|
4495
|
+
var subscribedIntegrationContextAgentIds = /* @__PURE__ */ new Set();
|
|
4486
4496
|
var realtimeAssignStarted = false;
|
|
4487
4497
|
var realtimeConfigStarted = false;
|
|
4488
4498
|
var realtimeSubscribedAgentIds = /* @__PURE__ */ new Set();
|
|
@@ -4501,7 +4511,7 @@ function ensureRealtimeStarted(agentStates) {
|
|
|
4501
4511
|
realtimeAssignStarted = false;
|
|
4502
4512
|
realtimeConfigStarted = false;
|
|
4503
4513
|
realtimeKanbanStarted = false;
|
|
4504
|
-
|
|
4514
|
+
subscribedIntegrationContextAgentIds = /* @__PURE__ */ new Set();
|
|
4505
4515
|
}
|
|
4506
4516
|
const activeAgentIds = agentStates.filter((a) => a.status === "active").map((a) => a.agentId);
|
|
4507
4517
|
if (activeAgentIds.length === 0) return;
|
|
@@ -4541,7 +4551,7 @@ function ensureRealtimeStarted(agentStates) {
|
|
|
4541
4551
|
realtimeAssignStarted = false;
|
|
4542
4552
|
realtimeConfigStarted = false;
|
|
4543
4553
|
realtimeKanbanStarted = false;
|
|
4544
|
-
|
|
4554
|
+
subscribedIntegrationContextAgentIds = /* @__PURE__ */ new Set();
|
|
4545
4555
|
}
|
|
4546
4556
|
},
|
|
4547
4557
|
log
|
|
@@ -4682,19 +4692,41 @@ function ensureRealtimeKanbanStarted(agentStates) {
|
|
|
4682
4692
|
log(`[realtime] Kanban subscription failed: ${err.message}`);
|
|
4683
4693
|
});
|
|
4684
4694
|
}
|
|
4695
|
+
function activeAgentIdSetsEqual(current, previous) {
|
|
4696
|
+
if (current.length !== previous.size) return false;
|
|
4697
|
+
for (const id of current) if (!previous.has(id)) return false;
|
|
4698
|
+
return true;
|
|
4699
|
+
}
|
|
4685
4700
|
function ensureRealtimeIntegrationContextStarted(agentStates) {
|
|
4686
|
-
if (realtimeIntegrationContextStarted) return;
|
|
4687
4701
|
const activeAgentIds = agentStates.filter((a) => a.status === "active").map((a) => a.agentId);
|
|
4688
|
-
if (activeAgentIds.length === 0)
|
|
4702
|
+
if (activeAgentIds.length === 0) {
|
|
4703
|
+
if (subscribedIntegrationContextAgentIds.size > 0) {
|
|
4704
|
+
stopRealtimeIntegrationContext();
|
|
4705
|
+
subscribedIntegrationContextAgentIds = /* @__PURE__ */ new Set();
|
|
4706
|
+
log("[realtime] Integration context subscription torn down (no active agents)");
|
|
4707
|
+
}
|
|
4708
|
+
return;
|
|
4709
|
+
}
|
|
4710
|
+
if (activeAgentIdSetsEqual(activeAgentIds, subscribedIntegrationContextAgentIds)) return;
|
|
4689
4711
|
const apiKey = process.env["AGT_API_KEY"];
|
|
4690
4712
|
if (!apiKey) return;
|
|
4713
|
+
const isResubscribe = subscribedIntegrationContextAgentIds.size > 0;
|
|
4714
|
+
if (isResubscribe) {
|
|
4715
|
+
stopRealtimeIntegrationContext();
|
|
4716
|
+
}
|
|
4717
|
+
const targetSet = new Set(activeAgentIds);
|
|
4718
|
+
subscribedIntegrationContextAgentIds = targetSet;
|
|
4691
4719
|
void exchangeApiKey(apiKey).then((exchange) => {
|
|
4692
|
-
if (
|
|
4720
|
+
if (subscribedIntegrationContextAgentIds !== targetSet) return;
|
|
4721
|
+
if (!exchange.supabaseUrl || !exchange.supabaseAnonKey) {
|
|
4722
|
+
subscribedIntegrationContextAgentIds = /* @__PURE__ */ new Set();
|
|
4723
|
+
return;
|
|
4724
|
+
}
|
|
4693
4725
|
startRealtimeIntegrationContext({
|
|
4694
4726
|
supabaseUrl: exchange.supabaseUrl,
|
|
4695
4727
|
supabaseAnonKey: exchange.supabaseAnonKey,
|
|
4696
4728
|
token: exchange.token,
|
|
4697
|
-
agentIds:
|
|
4729
|
+
agentIds: [...targetSet],
|
|
4698
4730
|
onContextChange: (payload) => {
|
|
4699
4731
|
const agent = agentStates.find((a) => a.agentId === payload.agent_id);
|
|
4700
4732
|
if (agent) {
|
|
@@ -4708,9 +4740,13 @@ function ensureRealtimeIntegrationContextStarted(agentStates) {
|
|
|
4708
4740
|
},
|
|
4709
4741
|
log
|
|
4710
4742
|
});
|
|
4711
|
-
|
|
4712
|
-
|
|
4743
|
+
log(
|
|
4744
|
+
`[realtime] Integration context subscription ${isResubscribe ? "re-bound" : "started"} for ${targetSet.size} agent(s)`
|
|
4745
|
+
);
|
|
4713
4746
|
}).catch((err) => {
|
|
4747
|
+
if (subscribedIntegrationContextAgentIds === targetSet) {
|
|
4748
|
+
subscribedIntegrationContextAgentIds = /* @__PURE__ */ new Set();
|
|
4749
|
+
}
|
|
4714
4750
|
log(`[realtime] Integration context subscription failed: ${err.message}`);
|
|
4715
4751
|
});
|
|
4716
4752
|
}
|