@integrity-labs/agt-cli 0.27.100 → 0.27.101
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 +4 -4
- package/dist/{chunk-T2UTQH6W.js → chunk-KZVMMXDB.js} +1 -1
- package/dist/{chunk-3TAVWBOA.js → chunk-Q5K5YADO.js} +2 -2
- package/dist/{chunk-DV3OH45P.js → chunk-UBW4SAJF.js} +2 -2
- package/dist/{claude-pair-runtime-M2WYVEV2.js → claude-pair-runtime-PJSO3JKN.js} +2 -2
- package/dist/lib/manager-worker.js +7 -7
- package/dist/{persistent-session-HAPAZHOA.js → persistent-session-KAZNNGUD.js} +3 -3
- package/dist/{responsiveness-probe-ZFYY5XOU.js → responsiveness-probe-MWVDZLO6.js} +6 -5
- package/dist/responsiveness-probe-MWVDZLO6.js.map +1 -0
- package/package.json +1 -1
- package/dist/responsiveness-probe-ZFYY5XOU.js.map +0 -1
- /package/dist/{chunk-T2UTQH6W.js.map → chunk-KZVMMXDB.js.map} +0 -0
- /package/dist/{chunk-3TAVWBOA.js.map → chunk-Q5K5YADO.js.map} +0 -0
- /package/dist/{chunk-DV3OH45P.js.map → chunk-UBW4SAJF.js.map} +0 -0
- /package/dist/{claude-pair-runtime-M2WYVEV2.js.map → claude-pair-runtime-PJSO3JKN.js.map} +0 -0
- /package/dist/{persistent-session-HAPAZHOA.js.map → persistent-session-KAZNNGUD.js.map} +0 -0
package/dist/bin/agt.js
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
success,
|
|
29
29
|
table,
|
|
30
30
|
warn
|
|
31
|
-
} from "../chunk-
|
|
31
|
+
} from "../chunk-UBW4SAJF.js";
|
|
32
32
|
import {
|
|
33
33
|
CHANNEL_REGISTRY,
|
|
34
34
|
DEPLOYMENT_TEMPLATES,
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
renderTemplate,
|
|
55
55
|
resolveChannels,
|
|
56
56
|
serializeManifestForSlackCli
|
|
57
|
-
} from "../chunk-
|
|
57
|
+
} from "../chunk-KZVMMXDB.js";
|
|
58
58
|
|
|
59
59
|
// src/bin/agt.ts
|
|
60
60
|
import { join as join20 } from "path";
|
|
@@ -4934,7 +4934,7 @@ import { execFileSync, execSync } from "child_process";
|
|
|
4934
4934
|
import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
|
|
4935
4935
|
import chalk18 from "chalk";
|
|
4936
4936
|
import ora16 from "ora";
|
|
4937
|
-
var cliVersion = true ? "0.27.
|
|
4937
|
+
var cliVersion = true ? "0.27.101" : "dev";
|
|
4938
4938
|
async function fetchLatestVersion() {
|
|
4939
4939
|
const host2 = getHost();
|
|
4940
4940
|
if (!host2) return null;
|
|
@@ -5857,7 +5857,7 @@ function handleError(err) {
|
|
|
5857
5857
|
}
|
|
5858
5858
|
|
|
5859
5859
|
// src/bin/agt.ts
|
|
5860
|
-
var cliVersion2 = true ? "0.27.
|
|
5860
|
+
var cliVersion2 = true ? "0.27.101" : "dev";
|
|
5861
5861
|
var program = new Command();
|
|
5862
5862
|
program.name("agt").description("Augmented CLI \u2014 agent provisioning and management").version(cliVersion2).option("--json", "Emit machine-readable JSON output (suppress spinners and colors)").option("--skip-update-check", "Skip the automatic update check on startup");
|
|
5863
5863
|
program.hook("preAction", async (thisCommand, actionCommand) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
claudeModelAlias,
|
|
3
3
|
isClaudeFastMode
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KZVMMXDB.js";
|
|
5
5
|
import {
|
|
6
6
|
reapOrphanChannelMcps
|
|
7
7
|
} from "./chunk-XWVM4KPK.js";
|
|
@@ -1557,4 +1557,4 @@ export {
|
|
|
1557
1557
|
stopAllSessionsAndWait,
|
|
1558
1558
|
getProjectDir
|
|
1559
1559
|
};
|
|
1560
|
-
//# sourceMappingURL=chunk-
|
|
1560
|
+
//# sourceMappingURL=chunk-Q5K5YADO.js.map
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
parseDeliveryTarget,
|
|
10
10
|
registerFramework,
|
|
11
11
|
wrapScheduledTaskPrompt
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-KZVMMXDB.js";
|
|
13
13
|
|
|
14
14
|
// ../../packages/core/dist/integrations/registry.js
|
|
15
15
|
var INTEGRATION_REGISTRY = [
|
|
@@ -7586,4 +7586,4 @@ export {
|
|
|
7586
7586
|
managerInstallSystemUnitCommand,
|
|
7587
7587
|
managerUninstallSystemUnitCommand
|
|
7588
7588
|
};
|
|
7589
|
-
//# sourceMappingURL=chunk-
|
|
7589
|
+
//# sourceMappingURL=chunk-UBW4SAJF.js.map
|
|
@@ -100,7 +100,7 @@ async function spawnPairSession(session) {
|
|
|
100
100
|
return { ok: true };
|
|
101
101
|
} catch {
|
|
102
102
|
}
|
|
103
|
-
const { resolveClaudeBinary } = await import("./persistent-session-
|
|
103
|
+
const { resolveClaudeBinary } = await import("./persistent-session-KAZNNGUD.js");
|
|
104
104
|
const claudeBin = resolveClaudeBinary();
|
|
105
105
|
const pairEnv = {
|
|
106
106
|
...process.env,
|
|
@@ -373,4 +373,4 @@ export {
|
|
|
373
373
|
startClaudePair,
|
|
374
374
|
submitClaudePairCode
|
|
375
375
|
};
|
|
376
|
-
//# sourceMappingURL=claude-pair-runtime-
|
|
376
|
+
//# sourceMappingURL=claude-pair-runtime-PJSO3JKN.js.map
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
provisionStopHook,
|
|
18
18
|
requireHost,
|
|
19
19
|
safeWriteJsonAtomic
|
|
20
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-UBW4SAJF.js";
|
|
21
21
|
import {
|
|
22
22
|
getProjectDir as getProjectDir2,
|
|
23
23
|
getReadyTasks,
|
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
stopPersistentSession,
|
|
56
56
|
takeWatchdogGiveUpCount,
|
|
57
57
|
takeZombieDetection
|
|
58
|
-
} from "../chunk-
|
|
58
|
+
} from "../chunk-Q5K5YADO.js";
|
|
59
59
|
import {
|
|
60
60
|
KANBAN_CHECK_COMMAND,
|
|
61
61
|
appendDmFooter,
|
|
@@ -78,7 +78,7 @@ import {
|
|
|
78
78
|
resolveConnectivityProbe,
|
|
79
79
|
resolveDmTarget,
|
|
80
80
|
wrapScheduledTaskPrompt
|
|
81
|
-
} from "../chunk-
|
|
81
|
+
} from "../chunk-KZVMMXDB.js";
|
|
82
82
|
import {
|
|
83
83
|
parsePsRows,
|
|
84
84
|
reapOrphanChannelMcps
|
|
@@ -4034,7 +4034,7 @@ var cachedMaintenanceWindow = null;
|
|
|
4034
4034
|
var lastVersionCheckAt = 0;
|
|
4035
4035
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
4036
4036
|
var lastResponsivenessProbeAt = 0;
|
|
4037
|
-
var agtCliVersion = true ? "0.27.
|
|
4037
|
+
var agtCliVersion = true ? "0.27.101" : "dev";
|
|
4038
4038
|
function resolveBrewPath(execFileSync4) {
|
|
4039
4039
|
try {
|
|
4040
4040
|
const out = execFileSync4("which", ["brew"], { timeout: 5e3 }).toString().trim();
|
|
@@ -5225,7 +5225,7 @@ async function pollCycle() {
|
|
|
5225
5225
|
}
|
|
5226
5226
|
try {
|
|
5227
5227
|
const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
|
|
5228
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
5228
|
+
const { collectDiagnostics } = await import("../persistent-session-KAZNNGUD.js");
|
|
5229
5229
|
const diagCodeNames = [...agentState.persistentSessionAgents];
|
|
5230
5230
|
const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames) : void 0;
|
|
5231
5231
|
let tailscaleHostname;
|
|
@@ -5298,7 +5298,7 @@ async function pollCycle() {
|
|
|
5298
5298
|
const {
|
|
5299
5299
|
collectResponsivenessProbes,
|
|
5300
5300
|
getResponsivenessIntervalMs
|
|
5301
|
-
} = await import("../responsiveness-probe-
|
|
5301
|
+
} = await import("../responsiveness-probe-MWVDZLO6.js");
|
|
5302
5302
|
const probeIntervalMs = getResponsivenessIntervalMs();
|
|
5303
5303
|
if (now - lastResponsivenessProbeAt > probeIntervalMs) {
|
|
5304
5304
|
const probeCodeNames = [...agentState.persistentSessionAgents];
|
|
@@ -9633,7 +9633,7 @@ async function processClaudePairSessions(agents) {
|
|
|
9633
9633
|
killPairSession,
|
|
9634
9634
|
pairTmuxSession,
|
|
9635
9635
|
finalizeClaudePairOnboarding
|
|
9636
|
-
} = await import("../claude-pair-runtime-
|
|
9636
|
+
} = await import("../claude-pair-runtime-PJSO3JKN.js");
|
|
9637
9637
|
for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
|
|
9638
9638
|
log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
|
|
9639
9639
|
const killed = await killPairSession(pairTmuxSession(pairId));
|
|
@@ -22,8 +22,8 @@ import {
|
|
|
22
22
|
stopPersistentSession,
|
|
23
23
|
takeZombieDetection,
|
|
24
24
|
writePersistentClaudeWrapper
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-Q5K5YADO.js";
|
|
26
|
+
import "./chunk-KZVMMXDB.js";
|
|
27
27
|
import "./chunk-XWVM4KPK.js";
|
|
28
28
|
export {
|
|
29
29
|
SEND_KEYS_ENTER_DELAY_MS,
|
|
@@ -50,4 +50,4 @@ export {
|
|
|
50
50
|
takeZombieDetection,
|
|
51
51
|
writePersistentClaudeWrapper
|
|
52
52
|
};
|
|
53
|
-
//# sourceMappingURL=persistent-session-
|
|
53
|
+
//# sourceMappingURL=persistent-session-KAZNNGUD.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
paneLogPath
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-Q5K5YADO.js";
|
|
4
|
+
import "./chunk-KZVMMXDB.js";
|
|
5
5
|
import "./chunk-XWVM4KPK.js";
|
|
6
6
|
|
|
7
7
|
// src/lib/responsiveness-probe.ts
|
|
@@ -27,13 +27,14 @@ function oldestPendingInboundMtimeMs(agentHomeDir) {
|
|
|
27
27
|
const dir = join(agentHomeDir, entry.name);
|
|
28
28
|
let files;
|
|
29
29
|
try {
|
|
30
|
-
files = readdirSync(dir);
|
|
30
|
+
files = readdirSync(dir, { withFileTypes: true });
|
|
31
31
|
} catch {
|
|
32
32
|
continue;
|
|
33
33
|
}
|
|
34
34
|
for (const file of files) {
|
|
35
|
+
if (!file.isFile() || file.name.startsWith(".")) continue;
|
|
35
36
|
try {
|
|
36
|
-
const mtimeMs = statSync(join(dir, file)).mtimeMs;
|
|
37
|
+
const mtimeMs = statSync(join(dir, file.name)).mtimeMs;
|
|
37
38
|
if (oldest === null || mtimeMs < oldest) oldest = mtimeMs;
|
|
38
39
|
} catch {
|
|
39
40
|
}
|
|
@@ -70,4 +71,4 @@ export {
|
|
|
70
71
|
collectResponsivenessProbes,
|
|
71
72
|
getResponsivenessIntervalMs
|
|
72
73
|
};
|
|
73
|
-
//# sourceMappingURL=responsiveness-probe-
|
|
74
|
+
//# sourceMappingURL=responsiveness-probe-MWVDZLO6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/responsiveness-probe.ts"],"sourcesContent":["/**\n * ENG-5399 — Tier 1 responsiveness probe (manager-side).\n *\n * Cheap, fast-cadence canary that catches \"agent went silent\" inside\n * minutes, well before the existing synthetic-probe cron's ~35 min\n * staleness window (`SyntheticReplyAgeSeconds`, ENG-5122).\n *\n * Mechanism: for each managed agent, read the mtime of the agent's\n * `pane.log` and report `now - mtime` as `PaneActivityAgeSeconds` via\n * a new `/host/responsiveness-probe` endpoint. `pane.log` is the\n * tmux pipe-pane sink set up by `setupPaneLog()` — any visible\n * activity (assistant turns, tool calls, in-place progress\n * heartbeats) bumps its mtime. A silent agent has a steadily\n * climbing age that lands in CloudWatch and trips a per-agent alarm.\n *\n * ENG-6017 adds a second per-agent signal on the same cadence:\n * `pending_inbound_oldest_age_seconds` — the age of the oldest marker\n * file across the agent's `*-pending-inbound/` directories (written by\n * the channel MCP servers for inbounds awaiting delivery). This is the\n * one artifact of the \"message typed but never submitted\" failure mode\n * that every other canary is blind to: in the koda incident\n * (2026-06-04) an operator Slack DM sat undelivered for 40+ minutes\n * while pane-activity stayed fresh (health checks), synthetic probes\n * were answered by the one-shot fallback, and heartbeat/session-alive\n * only reflect manager health. The field is OMITTED (not zero) when the\n * agent has no pending-inbound markers — the API treats absent as\n * \"no signal\", never as \"healthy\" (absent-vs-zero matters for\n * mixed-version fleets where old CLIs don't report it at all).\n *\n * Run from `pollCycle()` in `manager-worker.ts` on a configurable\n * interval (default 5 min via `AUGMENTED_RESPONSIVENESS_INTERVAL_MS`).\n */\n\nimport { readdirSync, statSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { paneLogPath } from './persistent-session.js';\n\nexport interface ResponsivenessProbeResult {\n code_name: string;\n pane_activity_age_seconds: number;\n /**\n * ENG-6017: age (s) of the oldest marker file across the agent's\n * `*-pending-inbound/` directories. Omitted when no markers exist —\n * absent means \"no signal\", NOT \"zero / healthy\".\n */\n pending_inbound_oldest_age_seconds?: number;\n}\n\nconst DEFAULT_INTERVAL_MS = 5 * 60 * 1000;\n\nexport function getResponsivenessIntervalMs(): number {\n const raw = process.env.AUGMENTED_RESPONSIVENESS_INTERVAL_MS;\n if (!raw) return DEFAULT_INTERVAL_MS;\n const parsed = Number.parseInt(raw, 10);\n return Number.isFinite(parsed) && parsed > 0 ? parsed : DEFAULT_INTERVAL_MS;\n}\n\n/**\n * ENG-6017: oldest pending-inbound marker mtime (ms epoch) for an agent,\n * or null when the agent has no markers / no pending-inbound dirs.\n *\n * The channel MCP servers (slack-channel, telegram-channel, …) write one\n * marker file per inbound into `~/.augmented/<codeName>/<channel>-pending-\n * inbound/` and clear it when the agent acknowledges the message. The\n * directory layout is the contract here — read-only, no IPC with the MCP\n * (the MCP and CLI release independently; file mtimes need no protocol).\n *\n * ENG-6072: only plain, non-hidden files count as markers. The msteams MCP\n * keeps `.markers/` and `.processed/` housekeeping SUBDIRECTORIES inside its\n * pending-inbound dir; their mtimes never advance, so statting every dirent\n * made the gauge climb forever and fired pending-inbound-stale on agents with\n * zero stranded messages (kylie ~3.4d / scout ~34h false ALARMs the moment\n * ENG-6023 activated the alarm). Dot-entries are skipped wholesale — the\n * hidden namespace is reserved for MCP bookkeeping, never for markers.\n */\nfunction oldestPendingInboundMtimeMs(agentHomeDir: string): number | null {\n let oldest: number | null = null;\n let entries;\n try {\n entries = readdirSync(agentHomeDir, { withFileTypes: true });\n } catch {\n return null; // agent home missing — nothing to report\n }\n for (const entry of entries) {\n if (!entry.isDirectory() || !entry.name.endsWith('-pending-inbound')) continue;\n const dir = join(agentHomeDir, entry.name);\n let files;\n try {\n files = readdirSync(dir, { withFileTypes: true });\n } catch {\n continue;\n }\n for (const file of files) {\n if (!file.isFile() || file.name.startsWith('.')) continue;\n try {\n const mtimeMs = statSync(join(dir, file.name)).mtimeMs;\n if (oldest === null || mtimeMs < oldest) oldest = mtimeMs;\n } catch {\n // Marker drained between readdir and stat — that's the happy path.\n }\n }\n }\n return oldest;\n}\n\n/**\n * Compute the pane.log age for each agent. Missing or unreadable\n * pane.log returns null — the caller should drop those entries\n * rather than fabricate a \"fresh\" or \"ancient\" value. A missing\n * file means the agent has never spawned in this manager generation,\n * which is a separate problem covered by SessionAliveAgeSeconds.\n */\nexport function collectResponsivenessProbes(\n codeNames: string[],\n now: Date = new Date(),\n): ResponsivenessProbeResult[] {\n const nowMs = now.getTime();\n const results: ResponsivenessProbeResult[] = [];\n for (const codeName of codeNames) {\n try {\n const panePath = paneLogPath(codeName);\n const mtimeMs = statSync(panePath).mtimeMs;\n const ageSeconds = Math.max(0, Math.floor((nowMs - mtimeMs) / 1000));\n const result: ResponsivenessProbeResult = {\n code_name: codeName,\n pane_activity_age_seconds: ageSeconds,\n };\n // ENG-6017: piggyback the pending-inbound drain-age scan on the same\n // cadence. Field omitted (not 0) when there are no markers.\n const oldestMarkerMs = oldestPendingInboundMtimeMs(dirname(panePath));\n if (oldestMarkerMs !== null) {\n result.pending_inbound_oldest_age_seconds = Math.max(\n 0,\n Math.floor((nowMs - oldestMarkerMs) / 1000),\n );\n }\n results.push(result);\n } catch {\n // No pane.log yet (fresh agent, never spawned) — skip. The\n // session-alive monitor already covers the \"should be running\n // but isn't\" case.\n }\n }\n return results;\n}\n"],"mappings":";;;;;;;AAiCA,SAAS,aAAa,gBAAgB;AACtC,SAAS,SAAS,YAAY;AAc9B,IAAM,sBAAsB,IAAI,KAAK;AAE9B,SAAS,8BAAsC;AACpD,QAAM,MAAM,QAAQ,IAAI;AACxB,MAAI,CAAC,IAAK,QAAO;AACjB,QAAM,SAAS,OAAO,SAAS,KAAK,EAAE;AACtC,SAAO,OAAO,SAAS,MAAM,KAAK,SAAS,IAAI,SAAS;AAC1D;AAoBA,SAAS,4BAA4B,cAAqC;AACxE,MAAI,SAAwB;AAC5B,MAAI;AACJ,MAAI;AACF,cAAU,YAAY,cAAc,EAAE,eAAe,KAAK,CAAC;AAAA,EAC7D,QAAQ;AACN,WAAO;AAAA,EACT;AACA,aAAW,SAAS,SAAS;AAC3B,QAAI,CAAC,MAAM,YAAY,KAAK,CAAC,MAAM,KAAK,SAAS,kBAAkB,EAAG;AACtE,UAAM,MAAM,KAAK,cAAc,MAAM,IAAI;AACzC,QAAI;AACJ,QAAI;AACF,cAAQ,YAAY,KAAK,EAAE,eAAe,KAAK,CAAC;AAAA,IAClD,QAAQ;AACN;AAAA,IACF;AACA,eAAW,QAAQ,OAAO;AACxB,UAAI,CAAC,KAAK,OAAO,KAAK,KAAK,KAAK,WAAW,GAAG,EAAG;AACjD,UAAI;AACF,cAAM,UAAU,SAAS,KAAK,KAAK,KAAK,IAAI,CAAC,EAAE;AAC/C,YAAI,WAAW,QAAQ,UAAU,OAAQ,UAAS;AAAA,MACpD,QAAQ;AAAA,MAER;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AASO,SAAS,4BACd,WACA,MAAY,oBAAI,KAAK,GACQ;AAC7B,QAAM,QAAQ,IAAI,QAAQ;AAC1B,QAAM,UAAuC,CAAC;AAC9C,aAAW,YAAY,WAAW;AAChC,QAAI;AACF,YAAM,WAAW,YAAY,QAAQ;AACrC,YAAM,UAAU,SAAS,QAAQ,EAAE;AACnC,YAAM,aAAa,KAAK,IAAI,GAAG,KAAK,OAAO,QAAQ,WAAW,GAAI,CAAC;AACnE,YAAM,SAAoC;AAAA,QACxC,WAAW;AAAA,QACX,2BAA2B;AAAA,MAC7B;AAGA,YAAM,iBAAiB,4BAA4B,QAAQ,QAAQ,CAAC;AACpE,UAAI,mBAAmB,MAAM;AAC3B,eAAO,qCAAqC,KAAK;AAAA,UAC/C;AAAA,UACA,KAAK,OAAO,QAAQ,kBAAkB,GAAI;AAAA,QAC5C;AAAA,MACF;AACA,cAAQ,KAAK,MAAM;AAAA,IACrB,QAAQ;AAAA,IAIR;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/responsiveness-probe.ts"],"sourcesContent":["/**\n * ENG-5399 — Tier 1 responsiveness probe (manager-side).\n *\n * Cheap, fast-cadence canary that catches \"agent went silent\" inside\n * minutes, well before the existing synthetic-probe cron's ~35 min\n * staleness window (`SyntheticReplyAgeSeconds`, ENG-5122).\n *\n * Mechanism: for each managed agent, read the mtime of the agent's\n * `pane.log` and report `now - mtime` as `PaneActivityAgeSeconds` via\n * a new `/host/responsiveness-probe` endpoint. `pane.log` is the\n * tmux pipe-pane sink set up by `setupPaneLog()` — any visible\n * activity (assistant turns, tool calls, in-place progress\n * heartbeats) bumps its mtime. A silent agent has a steadily\n * climbing age that lands in CloudWatch and trips a per-agent alarm.\n *\n * ENG-6017 adds a second per-agent signal on the same cadence:\n * `pending_inbound_oldest_age_seconds` — the age of the oldest marker\n * file across the agent's `*-pending-inbound/` directories (written by\n * the channel MCP servers for inbounds awaiting delivery). This is the\n * one artifact of the \"message typed but never submitted\" failure mode\n * that every other canary is blind to: in the koda incident\n * (2026-06-04) an operator Slack DM sat undelivered for 40+ minutes\n * while pane-activity stayed fresh (health checks), synthetic probes\n * were answered by the one-shot fallback, and heartbeat/session-alive\n * only reflect manager health. The field is OMITTED (not zero) when the\n * agent has no pending-inbound markers — the API treats absent as\n * \"no signal\", never as \"healthy\" (absent-vs-zero matters for\n * mixed-version fleets where old CLIs don't report it at all).\n *\n * Run from `pollCycle()` in `manager-worker.ts` on a configurable\n * interval (default 5 min via `AUGMENTED_RESPONSIVENESS_INTERVAL_MS`).\n */\n\nimport { readdirSync, statSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { paneLogPath } from './persistent-session.js';\n\nexport interface ResponsivenessProbeResult {\n code_name: string;\n pane_activity_age_seconds: number;\n /**\n * ENG-6017: age (s) of the oldest marker file across the agent's\n * `*-pending-inbound/` directories. Omitted when no markers exist —\n * absent means \"no signal\", NOT \"zero / healthy\".\n */\n pending_inbound_oldest_age_seconds?: number;\n}\n\nconst DEFAULT_INTERVAL_MS = 5 * 60 * 1000;\n\nexport function getResponsivenessIntervalMs(): number {\n const raw = process.env.AUGMENTED_RESPONSIVENESS_INTERVAL_MS;\n if (!raw) return DEFAULT_INTERVAL_MS;\n const parsed = Number.parseInt(raw, 10);\n return Number.isFinite(parsed) && parsed > 0 ? parsed : DEFAULT_INTERVAL_MS;\n}\n\n/**\n * ENG-6017: oldest pending-inbound marker mtime (ms epoch) for an agent,\n * or null when the agent has no markers / no pending-inbound dirs.\n *\n * The channel MCP servers (slack-channel, telegram-channel, …) write one\n * marker file per inbound into `~/.augmented/<codeName>/<channel>-pending-\n * inbound/` and clear it when the agent acknowledges the message. The\n * directory layout is the contract here — read-only, no IPC with the MCP\n * (the MCP and CLI release independently; file mtimes need no protocol).\n */\nfunction oldestPendingInboundMtimeMs(agentHomeDir: string): number | null {\n let oldest: number | null = null;\n let entries;\n try {\n entries = readdirSync(agentHomeDir, { withFileTypes: true });\n } catch {\n return null; // agent home missing — nothing to report\n }\n for (const entry of entries) {\n if (!entry.isDirectory() || !entry.name.endsWith('-pending-inbound')) continue;\n const dir = join(agentHomeDir, entry.name);\n let files;\n try {\n files = readdirSync(dir);\n } catch {\n continue;\n }\n for (const file of files) {\n try {\n const mtimeMs = statSync(join(dir, file)).mtimeMs;\n if (oldest === null || mtimeMs < oldest) oldest = mtimeMs;\n } catch {\n // Marker drained between readdir and stat — that's the happy path.\n }\n }\n }\n return oldest;\n}\n\n/**\n * Compute the pane.log age for each agent. Missing or unreadable\n * pane.log returns null — the caller should drop those entries\n * rather than fabricate a \"fresh\" or \"ancient\" value. A missing\n * file means the agent has never spawned in this manager generation,\n * which is a separate problem covered by SessionAliveAgeSeconds.\n */\nexport function collectResponsivenessProbes(\n codeNames: string[],\n now: Date = new Date(),\n): ResponsivenessProbeResult[] {\n const nowMs = now.getTime();\n const results: ResponsivenessProbeResult[] = [];\n for (const codeName of codeNames) {\n try {\n const panePath = paneLogPath(codeName);\n const mtimeMs = statSync(panePath).mtimeMs;\n const ageSeconds = Math.max(0, Math.floor((nowMs - mtimeMs) / 1000));\n const result: ResponsivenessProbeResult = {\n code_name: codeName,\n pane_activity_age_seconds: ageSeconds,\n };\n // ENG-6017: piggyback the pending-inbound drain-age scan on the same\n // cadence. Field omitted (not 0) when there are no markers.\n const oldestMarkerMs = oldestPendingInboundMtimeMs(dirname(panePath));\n if (oldestMarkerMs !== null) {\n result.pending_inbound_oldest_age_seconds = Math.max(\n 0,\n Math.floor((nowMs - oldestMarkerMs) / 1000),\n );\n }\n results.push(result);\n } catch {\n // No pane.log yet (fresh agent, never spawned) — skip. The\n // session-alive monitor already covers the \"should be running\n // but isn't\" case.\n }\n }\n return results;\n}\n"],"mappings":";;;;;;;AAiCA,SAAS,aAAa,gBAAgB;AACtC,SAAS,SAAS,YAAY;AAc9B,IAAM,sBAAsB,IAAI,KAAK;AAE9B,SAAS,8BAAsC;AACpD,QAAM,MAAM,QAAQ,IAAI;AACxB,MAAI,CAAC,IAAK,QAAO;AACjB,QAAM,SAAS,OAAO,SAAS,KAAK,EAAE;AACtC,SAAO,OAAO,SAAS,MAAM,KAAK,SAAS,IAAI,SAAS;AAC1D;AAYA,SAAS,4BAA4B,cAAqC;AACxE,MAAI,SAAwB;AAC5B,MAAI;AACJ,MAAI;AACF,cAAU,YAAY,cAAc,EAAE,eAAe,KAAK,CAAC;AAAA,EAC7D,QAAQ;AACN,WAAO;AAAA,EACT;AACA,aAAW,SAAS,SAAS;AAC3B,QAAI,CAAC,MAAM,YAAY,KAAK,CAAC,MAAM,KAAK,SAAS,kBAAkB,EAAG;AACtE,UAAM,MAAM,KAAK,cAAc,MAAM,IAAI;AACzC,QAAI;AACJ,QAAI;AACF,cAAQ,YAAY,GAAG;AAAA,IACzB,QAAQ;AACN;AAAA,IACF;AACA,eAAW,QAAQ,OAAO;AACxB,UAAI;AACF,cAAM,UAAU,SAAS,KAAK,KAAK,IAAI,CAAC,EAAE;AAC1C,YAAI,WAAW,QAAQ,UAAU,OAAQ,UAAS;AAAA,MACpD,QAAQ;AAAA,MAER;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AASO,SAAS,4BACd,WACA,MAAY,oBAAI,KAAK,GACQ;AAC7B,QAAM,QAAQ,IAAI,QAAQ;AAC1B,QAAM,UAAuC,CAAC;AAC9C,aAAW,YAAY,WAAW;AAChC,QAAI;AACF,YAAM,WAAW,YAAY,QAAQ;AACrC,YAAM,UAAU,SAAS,QAAQ,EAAE;AACnC,YAAM,aAAa,KAAK,IAAI,GAAG,KAAK,OAAO,QAAQ,WAAW,GAAI,CAAC;AACnE,YAAM,SAAoC;AAAA,QACxC,WAAW;AAAA,QACX,2BAA2B;AAAA,MAC7B;AAGA,YAAM,iBAAiB,4BAA4B,QAAQ,QAAQ,CAAC;AACpE,UAAI,mBAAmB,MAAM;AAC3B,eAAO,qCAAqC,KAAK;AAAA,UAC/C;AAAA,UACA,KAAK,OAAO,QAAQ,kBAAkB,GAAI;AAAA,QAC5C;AAAA,MACF;AACA,cAAQ,KAAK,MAAM;AAAA,IACrB,QAAQ;AAAA,IAIR;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|