@integrity-labs/agt-cli 0.14.7 → 0.14.10
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-JL4XSENX.js → chunk-4CZUEGNQ.js} +11 -17
- package/dist/chunk-4CZUEGNQ.js.map +1 -0
- package/dist/{chunk-5SFAHM2Z.js → chunk-RMTMETCK.js} +479 -24
- package/dist/chunk-RMTMETCK.js.map +1 -0
- package/dist/lib/manager-worker.js +44 -16
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/{persistent-session-SRUW7AWU.js → persistent-session-GBQ3VQK3.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-5SFAHM2Z.js.map +0 -1
- package/dist/chunk-JL4XSENX.js.map +0 -1
- /package/dist/{persistent-session-SRUW7AWU.js.map → persistent-session-GBQ3VQK3.js.map} +0 -0
|
@@ -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-RMTMETCK.js";
|
|
22
23
|
import {
|
|
23
24
|
findTaskByTemplate,
|
|
24
25
|
getProjectDir,
|
|
@@ -28,6 +29,7 @@ import {
|
|
|
28
29
|
syncTasksToScheduler
|
|
29
30
|
} from "../chunk-M6FSTVGG.js";
|
|
30
31
|
import {
|
|
32
|
+
buildAllowedTools,
|
|
31
33
|
getProjectDir as getProjectDir2,
|
|
32
34
|
injectMessage,
|
|
33
35
|
isSessionHealthy,
|
|
@@ -37,7 +39,7 @@ import {
|
|
|
37
39
|
startPersistentSession,
|
|
38
40
|
stopAllSessionsAndWait,
|
|
39
41
|
stopPersistentSession
|
|
40
|
-
} from "../chunk-
|
|
42
|
+
} from "../chunk-4CZUEGNQ.js";
|
|
41
43
|
|
|
42
44
|
// src/lib/manager-worker.ts
|
|
43
45
|
import { createHash } from "crypto";
|
|
@@ -1224,6 +1226,8 @@ async function ensureFrameworkBinary(frameworkId) {
|
|
|
1224
1226
|
}
|
|
1225
1227
|
var UPDATE_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
1226
1228
|
var selfUpdateUpToDateLogged = false;
|
|
1229
|
+
var restartAfterUpgrade = false;
|
|
1230
|
+
var pendingUpgradeVersion = null;
|
|
1227
1231
|
async function checkAndUpdateCli() {
|
|
1228
1232
|
const cliPath = process.argv[1] ?? "";
|
|
1229
1233
|
const isHomebrew = cliPath.includes("/Cellar/") || cliPath.includes("/homebrew/");
|
|
@@ -1266,7 +1270,9 @@ async function checkAndUpdateCli() {
|
|
|
1266
1270
|
timeout: 12e4,
|
|
1267
1271
|
stdio: "pipe"
|
|
1268
1272
|
});
|
|
1269
|
-
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;
|
|
1270
1276
|
} catch (err) {
|
|
1271
1277
|
log(`[self-update] Upgrade failed: ${err.message}`);
|
|
1272
1278
|
}
|
|
@@ -1721,6 +1727,7 @@ Automatic restart failed: ${err.message}`
|
|
|
1721
1727
|
}
|
|
1722
1728
|
async function pollCycle() {
|
|
1723
1729
|
if (!config) return;
|
|
1730
|
+
if (restartAfterUpgrade) return;
|
|
1724
1731
|
checkAndUpdateCli().catch((err) => log(`[self-update] Check failed: ${err.message}`));
|
|
1725
1732
|
try {
|
|
1726
1733
|
registeredAgentsCache.clear();
|
|
@@ -1744,7 +1751,7 @@ async function pollCycle() {
|
|
|
1744
1751
|
}
|
|
1745
1752
|
try {
|
|
1746
1753
|
const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
|
|
1747
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
1754
|
+
const { collectDiagnostics } = await import("../persistent-session-GBQ3VQK3.js");
|
|
1748
1755
|
const diagCodeNames = [...persistentSessionAgents];
|
|
1749
1756
|
const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames) : void 0;
|
|
1750
1757
|
let tailscaleHostname;
|
|
@@ -3179,8 +3186,7 @@ async function executeAndProcessClaudeTask(codeName, agentId, task, prompt) {
|
|
|
3179
3186
|
} catch {
|
|
3180
3187
|
}
|
|
3181
3188
|
}
|
|
3182
|
-
const
|
|
3183
|
-
const allowedTools = [...mcpPatterns, "Bash", "Read", "Write", "Edit", "Grep", "Glob"].join(",");
|
|
3189
|
+
const allowedTools = buildAllowedTools(serverNames);
|
|
3184
3190
|
const claudeArgs = [
|
|
3185
3191
|
"-p",
|
|
3186
3192
|
prompt,
|
|
@@ -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", {
|
|
@@ -3789,8 +3804,7 @@ async function processDirectChatMessage(agent, msg) {
|
|
|
3789
3804
|
} catch {
|
|
3790
3805
|
}
|
|
3791
3806
|
}
|
|
3792
|
-
const
|
|
3793
|
-
const allowedTools = [...mcpPatterns, "Bash", "Read", "Write", "Edit", "Grep", "Glob"].join(",");
|
|
3807
|
+
const allowedTools = buildAllowedTools(serverNames);
|
|
3794
3808
|
const chatArgs = [
|
|
3795
3809
|
"-p",
|
|
3796
3810
|
msg.content,
|
|
@@ -5022,7 +5036,21 @@ function startPolling() {
|
|
|
5022
5036
|
}
|
|
5023
5037
|
function scheduleNext() {
|
|
5024
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
|
+
}
|
|
5025
5049
|
pollTimer = setTimeout(() => {
|
|
5050
|
+
if (restartAfterUpgrade) {
|
|
5051
|
+
restartNow();
|
|
5052
|
+
return;
|
|
5053
|
+
}
|
|
5026
5054
|
void pollCycle().then(scheduleNext);
|
|
5027
5055
|
}, config.intervalMs);
|
|
5028
5056
|
}
|
|
@@ -5050,7 +5078,7 @@ async function killAllAgtTmuxSessions() {
|
|
|
5050
5078
|
} catch {
|
|
5051
5079
|
}
|
|
5052
5080
|
}
|
|
5053
|
-
async function stopPolling() {
|
|
5081
|
+
async function stopPolling(opts = {}) {
|
|
5054
5082
|
running = false;
|
|
5055
5083
|
if (pollTimer) {
|
|
5056
5084
|
clearTimeout(pollTimer);
|
|
@@ -5058,7 +5086,7 @@ async function stopPolling() {
|
|
|
5058
5086
|
}
|
|
5059
5087
|
const shutdownTimer = setTimeout(() => {
|
|
5060
5088
|
log("Shutdown timeout exceeded (15s), forcing exit");
|
|
5061
|
-
process.exit(1);
|
|
5089
|
+
process.exit(opts.forcedExitCode ?? 1);
|
|
5062
5090
|
}, 15e3);
|
|
5063
5091
|
shutdownTimer.unref();
|
|
5064
5092
|
stopCaffeinate();
|