@integrity-labs/agt-cli 0.28.27 → 0.28.28
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
CHANGED
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
success,
|
|
34
34
|
table,
|
|
35
35
|
warn
|
|
36
|
-
} from "../chunk-
|
|
36
|
+
} from "../chunk-GW2FVIMZ.js";
|
|
37
37
|
import {
|
|
38
38
|
CHANNEL_REGISTRY,
|
|
39
39
|
DEPLOYMENT_TEMPLATES,
|
|
@@ -4773,7 +4773,7 @@ import { execFileSync, execSync } from "child_process";
|
|
|
4773
4773
|
import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
|
|
4774
4774
|
import chalk18 from "chalk";
|
|
4775
4775
|
import ora16 from "ora";
|
|
4776
|
-
var cliVersion = true ? "0.28.
|
|
4776
|
+
var cliVersion = true ? "0.28.28" : "dev";
|
|
4777
4777
|
async function fetchLatestVersion() {
|
|
4778
4778
|
const host2 = getHost();
|
|
4779
4779
|
if (!host2) return null;
|
|
@@ -5696,7 +5696,7 @@ function handleError(err) {
|
|
|
5696
5696
|
}
|
|
5697
5697
|
|
|
5698
5698
|
// src/bin/agt.ts
|
|
5699
|
-
var cliVersion2 = true ? "0.28.
|
|
5699
|
+
var cliVersion2 = true ? "0.28.28" : "dev";
|
|
5700
5700
|
var program = new Command();
|
|
5701
5701
|
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");
|
|
5702
5702
|
program.hook("preAction", async (thisCommand, actionCommand) => {
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
provisionStopHook,
|
|
23
23
|
requireHost,
|
|
24
24
|
safeWriteJsonAtomic
|
|
25
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-GW2FVIMZ.js";
|
|
26
26
|
import {
|
|
27
27
|
getProjectDir as getProjectDir2,
|
|
28
28
|
getReadyTasks,
|
|
@@ -5763,7 +5763,7 @@ var cachedMaintenanceWindow = null;
|
|
|
5763
5763
|
var lastVersionCheckAt = 0;
|
|
5764
5764
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
5765
5765
|
var lastResponsivenessProbeAt = 0;
|
|
5766
|
-
var agtCliVersion = true ? "0.28.
|
|
5766
|
+
var agtCliVersion = true ? "0.28.28" : "dev";
|
|
5767
5767
|
function resolveBrewPath(execFileSync4) {
|
|
5768
5768
|
try {
|
|
5769
5769
|
const out = execFileSync4("which", ["brew"], { timeout: 5e3 }).toString().trim();
|
|
@@ -14032,6 +14032,26 @@ function readDirectChatSessionState(agentDir, nowMs) {
|
|
|
14032
14032
|
}
|
|
14033
14033
|
}
|
|
14034
14034
|
|
|
14035
|
+
// src/direct-chat-poll-guard.ts
|
|
14036
|
+
function evaluatePollGuard(state, nowMs, stuckMs) {
|
|
14037
|
+
if (!state.inFlight) return { run: true, stuck: false };
|
|
14038
|
+
if (state.inFlightSinceMs != null && nowMs - state.inFlightSinceMs >= stuckMs) {
|
|
14039
|
+
return { run: true, stuck: true };
|
|
14040
|
+
}
|
|
14041
|
+
return { run: false, stuck: false };
|
|
14042
|
+
}
|
|
14043
|
+
async function fetchWithTimeout(input, init, timeoutMs, fetchImpl = fetch) {
|
|
14044
|
+
const controller = new AbortController();
|
|
14045
|
+
const timer = setTimeout(() => {
|
|
14046
|
+
controller.abort(new Error(`request timed out after ${timeoutMs}ms`));
|
|
14047
|
+
}, timeoutMs);
|
|
14048
|
+
try {
|
|
14049
|
+
return await fetchImpl(input, { ...init, signal: controller.signal });
|
|
14050
|
+
} finally {
|
|
14051
|
+
clearTimeout(timer);
|
|
14052
|
+
}
|
|
14053
|
+
}
|
|
14054
|
+
|
|
14035
14055
|
// src/mcp-spawn-lock.ts
|
|
14036
14056
|
import {
|
|
14037
14057
|
existsSync as existsSync2,
|
|
@@ -14163,13 +14183,14 @@ if (!AGT_HOST || !AGT_API_KEY || !AGT_AGENT_ID) {
|
|
|
14163
14183
|
}
|
|
14164
14184
|
var authToken = null;
|
|
14165
14185
|
var authExpiry = 0;
|
|
14186
|
+
var HTTP_TIMEOUT_MS = 2e4;
|
|
14166
14187
|
async function getAuthToken() {
|
|
14167
14188
|
if (authToken && Date.now() < authExpiry) return authToken;
|
|
14168
|
-
const res = await
|
|
14189
|
+
const res = await fetchWithTimeout(`${AGT_HOST}/host/exchange`, {
|
|
14169
14190
|
method: "POST",
|
|
14170
14191
|
headers: { "Content-Type": "application/json" },
|
|
14171
14192
|
body: JSON.stringify({ host_key: AGT_API_KEY })
|
|
14172
|
-
});
|
|
14193
|
+
}, HTTP_TIMEOUT_MS);
|
|
14173
14194
|
if (!res.ok) {
|
|
14174
14195
|
const body = await res.text().catch(() => "");
|
|
14175
14196
|
throw new Error(`Auth exchange failed (${res.status}): ${body.slice(0, 200)}`);
|
|
@@ -14181,26 +14202,26 @@ async function getAuthToken() {
|
|
|
14181
14202
|
}
|
|
14182
14203
|
async function apiPost(path, body) {
|
|
14183
14204
|
const token = await getAuthToken();
|
|
14184
|
-
const res = await
|
|
14205
|
+
const res = await fetchWithTimeout(`${AGT_HOST}${path}`, {
|
|
14185
14206
|
method: "POST",
|
|
14186
14207
|
headers: {
|
|
14187
14208
|
"Content-Type": "application/json",
|
|
14188
14209
|
Authorization: `Bearer ${token}`
|
|
14189
14210
|
},
|
|
14190
14211
|
body: JSON.stringify(body)
|
|
14191
|
-
});
|
|
14212
|
+
}, HTTP_TIMEOUT_MS);
|
|
14192
14213
|
if (res.status === 401) {
|
|
14193
14214
|
authToken = null;
|
|
14194
14215
|
authExpiry = 0;
|
|
14195
14216
|
const freshToken = await getAuthToken();
|
|
14196
|
-
return
|
|
14217
|
+
return fetchWithTimeout(`${AGT_HOST}${path}`, {
|
|
14197
14218
|
method: "POST",
|
|
14198
14219
|
headers: {
|
|
14199
14220
|
"Content-Type": "application/json",
|
|
14200
14221
|
Authorization: `Bearer ${freshToken}`
|
|
14201
14222
|
},
|
|
14202
14223
|
body: JSON.stringify(body)
|
|
14203
|
-
});
|
|
14224
|
+
}, HTTP_TIMEOUT_MS);
|
|
14204
14225
|
}
|
|
14205
14226
|
return res;
|
|
14206
14227
|
}
|
|
@@ -14383,7 +14404,13 @@ async function pollForMessages(sinceMs) {
|
|
|
14383
14404
|
agent_id: AGT_AGENT_ID,
|
|
14384
14405
|
...typeof sinceMs === "number" ? { since_ms: sinceMs } : {}
|
|
14385
14406
|
});
|
|
14386
|
-
if (!res.ok)
|
|
14407
|
+
if (!res.ok) {
|
|
14408
|
+
process.stderr.write(
|
|
14409
|
+
`direct-chat-channel: poll returned HTTP ${res.status} \u2014 pull skipped this tick
|
|
14410
|
+
`
|
|
14411
|
+
);
|
|
14412
|
+
return;
|
|
14413
|
+
}
|
|
14387
14414
|
const data = await res.json();
|
|
14388
14415
|
const markProcessed = (id) => {
|
|
14389
14416
|
processedIds.add(id);
|
|
@@ -14467,14 +14494,24 @@ var DOORBELL_ENABLED = resolveHostBooleanFlag({
|
|
|
14467
14494
|
});
|
|
14468
14495
|
var DOORBELL_FILE = "direct-chat-doorbell";
|
|
14469
14496
|
var SAFETY_NET_POLL_MS = 3e4;
|
|
14470
|
-
var
|
|
14497
|
+
var POLL_STUCK_MS = 9e4;
|
|
14498
|
+
var pollGuard = { inFlight: false, inFlightSinceMs: null };
|
|
14471
14499
|
async function pollOnce(sinceMs) {
|
|
14472
|
-
|
|
14473
|
-
|
|
14500
|
+
const decision = evaluatePollGuard(pollGuard, Date.now(), POLL_STUCK_MS);
|
|
14501
|
+
if (!decision.run) return;
|
|
14502
|
+
if (decision.stuck) {
|
|
14503
|
+
process.stderr.write(
|
|
14504
|
+
`direct-chat-channel: previous poll wedged >${POLL_STUCK_MS}ms \u2014 superseding so the pull loop self-heals
|
|
14505
|
+
`
|
|
14506
|
+
);
|
|
14507
|
+
}
|
|
14508
|
+
pollGuard.inFlight = true;
|
|
14509
|
+
pollGuard.inFlightSinceMs = Date.now();
|
|
14474
14510
|
try {
|
|
14475
14511
|
await pollForMessages(sinceMs);
|
|
14476
14512
|
} finally {
|
|
14477
|
-
|
|
14513
|
+
pollGuard.inFlight = false;
|
|
14514
|
+
pollGuard.inFlightSinceMs = null;
|
|
14478
14515
|
}
|
|
14479
14516
|
}
|
|
14480
14517
|
var doorbellWatcher = null;
|
package/package.json
CHANGED
|
File without changes
|