@integrity-labs/agt-cli 0.14.8 → 0.14.12
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 +211 -548
- package/dist/bin/agt.js.map +1 -1
- package/dist/{chunk-5SFAHM2Z.js → chunk-NSHSUWZQ.js} +488 -24
- package/dist/chunk-NSHSUWZQ.js.map +1 -0
- package/dist/lib/manager-worker.js +39 -10
- package/dist/lib/manager-worker.js.map +1 -1
- package/mcp/slack-channel.js +66 -3
- package/package.json +1 -1
- package/dist/chunk-5SFAHM2Z.js.map +0 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
+
SUPERVISOR_RESTART_EXIT_CODE,
|
|
2
3
|
api,
|
|
3
4
|
appendDmFooter,
|
|
5
|
+
classifyOutput,
|
|
4
6
|
exchangeApiKey,
|
|
5
7
|
extractFrontmatter,
|
|
6
8
|
getApiKey,
|
|
@@ -9,7 +11,6 @@ import {
|
|
|
9
11
|
getIntegration,
|
|
10
12
|
isParseError,
|
|
11
13
|
isResolveError,
|
|
12
|
-
isSuppressOutput,
|
|
13
14
|
parseDeliveryTarget,
|
|
14
15
|
provision,
|
|
15
16
|
provisionIsolationHook,
|
|
@@ -18,7 +19,7 @@ import {
|
|
|
18
19
|
resolveChannels,
|
|
19
20
|
resolveDmTarget,
|
|
20
21
|
wrapScheduledTaskPrompt
|
|
21
|
-
} from "../chunk-
|
|
22
|
+
} from "../chunk-NSHSUWZQ.js";
|
|
22
23
|
import {
|
|
23
24
|
findTaskByTemplate,
|
|
24
25
|
getProjectDir,
|
|
@@ -1225,6 +1226,8 @@ async function ensureFrameworkBinary(frameworkId) {
|
|
|
1225
1226
|
}
|
|
1226
1227
|
var UPDATE_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
1227
1228
|
var selfUpdateUpToDateLogged = false;
|
|
1229
|
+
var restartAfterUpgrade = false;
|
|
1230
|
+
var pendingUpgradeVersion = null;
|
|
1228
1231
|
async function checkAndUpdateCli() {
|
|
1229
1232
|
const cliPath = process.argv[1] ?? "";
|
|
1230
1233
|
const isHomebrew = cliPath.includes("/Cellar/") || cliPath.includes("/homebrew/");
|
|
@@ -1267,7 +1270,9 @@ async function checkAndUpdateCli() {
|
|
|
1267
1270
|
timeout: 12e4,
|
|
1268
1271
|
stdio: "pipe"
|
|
1269
1272
|
});
|
|
1270
|
-
log(`[self-update] agt CLI upgraded to ${latest}.
|
|
1273
|
+
log(`[self-update] agt CLI upgraded to ${latest}. Scheduling manager restart so the new binary takes effect.`);
|
|
1274
|
+
restartAfterUpgrade = true;
|
|
1275
|
+
pendingUpgradeVersion = latest;
|
|
1271
1276
|
} catch (err) {
|
|
1272
1277
|
log(`[self-update] Upgrade failed: ${err.message}`);
|
|
1273
1278
|
}
|
|
@@ -1722,6 +1727,7 @@ Automatic restart failed: ${err.message}`
|
|
|
1722
1727
|
}
|
|
1723
1728
|
async function pollCycle() {
|
|
1724
1729
|
if (!config) return;
|
|
1730
|
+
if (restartAfterUpgrade) return;
|
|
1725
1731
|
checkAndUpdateCli().catch((err) => log(`[self-update] Check failed: ${err.message}`));
|
|
1726
1732
|
try {
|
|
1727
1733
|
registeredAgentsCache.clear();
|
|
@@ -3254,12 +3260,17 @@ async function executeAndProcessClaudeTask(codeName, agentId, task, prompt) {
|
|
|
3254
3260
|
claudeSchedulerStates.set(codeName, updated);
|
|
3255
3261
|
}
|
|
3256
3262
|
}
|
|
3257
|
-
async function processClaudeTaskResult(codeName, agentId, templateId,
|
|
3263
|
+
async function processClaudeTaskResult(codeName, agentId, templateId, rawOutput, delivery) {
|
|
3258
3264
|
try {
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
const
|
|
3262
|
-
|
|
3265
|
+
const classification = classifyOutput(rawOutput);
|
|
3266
|
+
if (classification.action === "suppress") {
|
|
3267
|
+
const trimmed = (rawOutput ?? "").trim();
|
|
3268
|
+
const outputHash = trimmed.length === 0 ? "empty" : createHash("sha256").update(trimmed).digest("hex").slice(0, 12);
|
|
3269
|
+
log(`[claude-scheduler] Suppressing delivery for '${codeName}' (template=${templateId}, task=${delivery?.taskId ?? "n/a"}) \u2014 output_len=${trimmed.length} output_hash=${outputHash}`);
|
|
3270
|
+
if (classification.suppressedNotes) {
|
|
3271
|
+
const notesHash = createHash("sha256").update(classification.suppressedNotes).digest("hex").slice(0, 12);
|
|
3272
|
+
log(`[claude-scheduler] Suppressed notes for '${codeName}' (task=${delivery?.taskId ?? "n/a"}) \u2014 notes_len=${classification.suppressedNotes.length} notes_hash=${notesHash}`);
|
|
3273
|
+
}
|
|
3263
3274
|
if (delivery?.mode === "announce" && delivery.to) {
|
|
3264
3275
|
await reportDeliveryStatus(agentId, delivery.taskId, {
|
|
3265
3276
|
status: "skipped",
|
|
@@ -3268,6 +3279,10 @@ async function processClaudeTaskResult(codeName, agentId, templateId, output, de
|
|
|
3268
3279
|
}
|
|
3269
3280
|
return;
|
|
3270
3281
|
}
|
|
3282
|
+
const output = classification.deliverable;
|
|
3283
|
+
if (classification.action === "strip") {
|
|
3284
|
+
log(`[claude-scheduler] Stripped '<no-delivery/>' sentinel from '${codeName}' output (template=${templateId}, task=${delivery?.taskId ?? "n/a"}) \u2014 agent mixed it with real content; delivering the rest.`);
|
|
3285
|
+
}
|
|
3271
3286
|
if (STANDUP_TEMPLATES.has(templateId)) {
|
|
3272
3287
|
const standup = parseStandupSummary(output);
|
|
3273
3288
|
await api.post("/host/agent-status", {
|
|
@@ -5021,7 +5036,21 @@ function startPolling() {
|
|
|
5021
5036
|
}
|
|
5022
5037
|
function scheduleNext() {
|
|
5023
5038
|
if (!running || !config) return;
|
|
5039
|
+
const restartNow = () => {
|
|
5040
|
+
log(`[self-update] Restarting manager to load upgraded binary (${pendingUpgradeVersion ?? "unknown version"})`);
|
|
5041
|
+
void stopPolling({ forcedExitCode: SUPERVISOR_RESTART_EXIT_CODE }).then(() => {
|
|
5042
|
+
process.exit(SUPERVISOR_RESTART_EXIT_CODE);
|
|
5043
|
+
});
|
|
5044
|
+
};
|
|
5045
|
+
if (restartAfterUpgrade) {
|
|
5046
|
+
restartNow();
|
|
5047
|
+
return;
|
|
5048
|
+
}
|
|
5024
5049
|
pollTimer = setTimeout(() => {
|
|
5050
|
+
if (restartAfterUpgrade) {
|
|
5051
|
+
restartNow();
|
|
5052
|
+
return;
|
|
5053
|
+
}
|
|
5025
5054
|
void pollCycle().then(scheduleNext);
|
|
5026
5055
|
}, config.intervalMs);
|
|
5027
5056
|
}
|
|
@@ -5049,7 +5078,7 @@ async function killAllAgtTmuxSessions() {
|
|
|
5049
5078
|
} catch {
|
|
5050
5079
|
}
|
|
5051
5080
|
}
|
|
5052
|
-
async function stopPolling() {
|
|
5081
|
+
async function stopPolling(opts = {}) {
|
|
5053
5082
|
running = false;
|
|
5054
5083
|
if (pollTimer) {
|
|
5055
5084
|
clearTimeout(pollTimer);
|
|
@@ -5057,7 +5086,7 @@ async function stopPolling() {
|
|
|
5057
5086
|
}
|
|
5058
5087
|
const shutdownTimer = setTimeout(() => {
|
|
5059
5088
|
log("Shutdown timeout exceeded (15s), forcing exit");
|
|
5060
|
-
process.exit(1);
|
|
5089
|
+
process.exit(opts.forcedExitCode ?? 1);
|
|
5061
5090
|
}, 15e3);
|
|
5062
5091
|
shutdownTimer.unref();
|
|
5063
5092
|
stopCaffeinate();
|