@integrity-labs/agt-cli 0.28.1125 → 0.28.1126
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
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
success,
|
|
41
41
|
table,
|
|
42
42
|
warn
|
|
43
|
-
} from "../chunk-
|
|
43
|
+
} from "../chunk-DIOP5LSU.js";
|
|
44
44
|
import {
|
|
45
45
|
getProjectDir,
|
|
46
46
|
isSessionResumeDisabled,
|
|
@@ -5474,7 +5474,7 @@ import { execFileSync, execSync } from "child_process";
|
|
|
5474
5474
|
import { existsSync as existsSync11, realpathSync as realpathSync2 } from "fs";
|
|
5475
5475
|
import chalk18 from "chalk";
|
|
5476
5476
|
import ora16 from "ora";
|
|
5477
|
-
var cliVersion = true ? "0.28.
|
|
5477
|
+
var cliVersion = true ? "0.28.1126" : "dev";
|
|
5478
5478
|
async function fetchLatestVersion() {
|
|
5479
5479
|
const host2 = getHost();
|
|
5480
5480
|
if (!host2) return null;
|
|
@@ -6734,7 +6734,7 @@ function handleError(err) {
|
|
|
6734
6734
|
}
|
|
6735
6735
|
|
|
6736
6736
|
// src/bin/agt.ts
|
|
6737
|
-
var cliVersion2 = true ? "0.28.
|
|
6737
|
+
var cliVersion2 = true ? "0.28.1126" : "dev";
|
|
6738
6738
|
var program = new Command();
|
|
6739
6739
|
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");
|
|
6740
6740
|
program.hook("preAction", async (thisCommand, actionCommand) => {
|
|
@@ -7518,7 +7518,7 @@ function exchangeFailureKind(err) {
|
|
|
7518
7518
|
}
|
|
7519
7519
|
|
|
7520
7520
|
// src/lib/api-client.ts
|
|
7521
|
-
var agtCliVersion = true ? "0.28.
|
|
7521
|
+
var agtCliVersion = true ? "0.28.1126" : "dev";
|
|
7522
7522
|
var lastConfigHash = null;
|
|
7523
7523
|
function setConfigHash(hash) {
|
|
7524
7524
|
lastConfigHash = hash && hash.length > 0 ? hash : null;
|
|
@@ -12664,4 +12664,4 @@ export {
|
|
|
12664
12664
|
managerInstallSystemUnitCommand,
|
|
12665
12665
|
managerUninstallSystemUnitCommand
|
|
12666
12666
|
};
|
|
12667
|
-
//# sourceMappingURL=chunk-
|
|
12667
|
+
//# sourceMappingURL=chunk-DIOP5LSU.js.map
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
safeWriteJsonAtomic,
|
|
72
72
|
setConfigHash,
|
|
73
73
|
tripClass
|
|
74
|
-
} from "../chunk-
|
|
74
|
+
} from "../chunk-DIOP5LSU.js";
|
|
75
75
|
import {
|
|
76
76
|
getProjectDir as getProjectDir2,
|
|
77
77
|
getReadyTasks,
|
|
@@ -14950,7 +14950,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
|
|
|
14950
14950
|
var lastVersionCheckAt = 0;
|
|
14951
14951
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
14952
14952
|
var lastResponsivenessProbeAt = 0;
|
|
14953
|
-
var agtCliVersion = true ? "0.28.
|
|
14953
|
+
var agtCliVersion = true ? "0.28.1126" : "dev";
|
|
14954
14954
|
function resolveBrewPath(execFileSync3) {
|
|
14955
14955
|
try {
|
|
14956
14956
|
const out = execFileSync3("which", ["brew"], { timeout: 5e3 }).toString().trim();
|
|
@@ -40797,11 +40797,22 @@ function probeAgentSessionCached(codeName, ttlMs = SESSION_PROBE_TTL_MS, now = D
|
|
|
40797
40797
|
// src/direct-chat-poll-guard.ts
|
|
40798
40798
|
function evaluatePollGuard(state, nowMs, stuckMs) {
|
|
40799
40799
|
if (!state.inFlight) return { run: true, stuck: false };
|
|
40800
|
+
if (state.leaseUntilMs != null && nowMs < state.leaseUntilMs) return { run: false, stuck: false };
|
|
40800
40801
|
if (state.inFlightSinceMs != null && nowMs - state.inFlightSinceMs >= stuckMs) {
|
|
40801
40802
|
return { run: true, stuck: true };
|
|
40802
40803
|
}
|
|
40803
40804
|
return { run: false, stuck: false };
|
|
40804
40805
|
}
|
|
40806
|
+
async function withPollGuardLease(state, leaseUntilMs, work, nowMs = Date.now) {
|
|
40807
|
+
const previous = state.leaseUntilMs ?? null;
|
|
40808
|
+
state.leaseUntilMs = Math.max(previous ?? 0, leaseUntilMs);
|
|
40809
|
+
try {
|
|
40810
|
+
return await work();
|
|
40811
|
+
} finally {
|
|
40812
|
+
state.leaseUntilMs = previous;
|
|
40813
|
+
if (state.inFlight) state.inFlightSinceMs = nowMs();
|
|
40814
|
+
}
|
|
40815
|
+
}
|
|
40805
40816
|
async function fetchWithTimeout(input, init, timeoutMs, fetchImpl = fetch) {
|
|
40806
40817
|
const controller = new AbortController();
|
|
40807
40818
|
const timer = setTimeout(() => {
|
|
@@ -40945,7 +40956,44 @@ import {
|
|
|
40945
40956
|
|
|
40946
40957
|
// src/direct-chat-inbound-attachments.ts
|
|
40947
40958
|
import { join as join14 } from "path";
|
|
40948
|
-
var MAX_INBOUND_ATTACHMENT_BYTES =
|
|
40959
|
+
var MAX_INBOUND_ATTACHMENT_BYTES = DIRECT_CHAT_UPLOAD_MAX_BYTES;
|
|
40960
|
+
var INBOUND_DOWNLOAD_FLOOR_MS = 2e4;
|
|
40961
|
+
var INBOUND_DOWNLOAD_MIN_BYTES_PER_SEC = 512 * 1024;
|
|
40962
|
+
function inboundDownloadTimeoutMs(expectedBytes) {
|
|
40963
|
+
const bytes = typeof expectedBytes === "number" && Number.isFinite(expectedBytes) && expectedBytes > 0 ? Math.min(expectedBytes, MAX_INBOUND_ATTACHMENT_BYTES) : MAX_INBOUND_ATTACHMENT_BYTES;
|
|
40964
|
+
return INBOUND_DOWNLOAD_FLOOR_MS + Math.ceil(bytes / INBOUND_DOWNLOAD_MIN_BYTES_PER_SEC * 1e3);
|
|
40965
|
+
}
|
|
40966
|
+
function attachmentsDownloadBudgetMs(attachments) {
|
|
40967
|
+
return attachments.reduce((sum, a) => sum + inboundDownloadTimeoutMs(a.byte_size), 0);
|
|
40968
|
+
}
|
|
40969
|
+
async function fetchWithTransferDeadline(url, budgetMs, fetchImpl = fetch) {
|
|
40970
|
+
const controller = new AbortController();
|
|
40971
|
+
const timer = setTimeout(() => {
|
|
40972
|
+
controller.abort(new Error(`inbound attachment download timed out after ${budgetMs}ms`));
|
|
40973
|
+
}, budgetMs);
|
|
40974
|
+
timer.unref?.();
|
|
40975
|
+
let res;
|
|
40976
|
+
try {
|
|
40977
|
+
res = await fetchImpl(url, { method: "GET", signal: controller.signal });
|
|
40978
|
+
} catch (err) {
|
|
40979
|
+
clearTimeout(timer);
|
|
40980
|
+
throw err;
|
|
40981
|
+
}
|
|
40982
|
+
const len = res.headers.get("content-length");
|
|
40983
|
+
return {
|
|
40984
|
+
ok: res.ok,
|
|
40985
|
+
status: res.status,
|
|
40986
|
+
contentLength: len != null ? Number(len) : null,
|
|
40987
|
+
bytes: async () => {
|
|
40988
|
+
try {
|
|
40989
|
+
return new Uint8Array(await res.arrayBuffer());
|
|
40990
|
+
} finally {
|
|
40991
|
+
clearTimeout(timer);
|
|
40992
|
+
}
|
|
40993
|
+
}
|
|
40994
|
+
};
|
|
40995
|
+
}
|
|
40996
|
+
var OVER_CAP_ERROR = `exceeds the ${formatUploadSize(MAX_INBOUND_ATTACHMENT_BYTES)} inbound limit`;
|
|
40949
40997
|
var INBOUND_ATTACHMENTS_SUBDIR = "direct-chat-inbound";
|
|
40950
40998
|
function resolveInboundAttachmentsDir(input) {
|
|
40951
40999
|
const alias = resolveAgentDirAlias(input);
|
|
@@ -41017,10 +41065,10 @@ async function downloadInboundAttachment(att, dir, deps) {
|
|
|
41017
41065
|
isImage: isImageContentType(att.content_type)
|
|
41018
41066
|
};
|
|
41019
41067
|
if (att.byte_size > MAX_INBOUND_ATTACHMENT_BYTES) {
|
|
41020
|
-
return { ...base, error:
|
|
41068
|
+
return { ...base, error: OVER_CAP_ERROR };
|
|
41021
41069
|
}
|
|
41022
41070
|
try {
|
|
41023
|
-
const res = await deps.fetchUrl(att.download_url);
|
|
41071
|
+
const res = await deps.fetchUrl(att.download_url, att.byte_size);
|
|
41024
41072
|
if (!res.ok) {
|
|
41025
41073
|
let s3Body = "";
|
|
41026
41074
|
try {
|
|
@@ -41034,11 +41082,11 @@ async function downloadInboundAttachment(att, dir, deps) {
|
|
|
41034
41082
|
return { ...base, error: `download HTTP ${res.status}` };
|
|
41035
41083
|
}
|
|
41036
41084
|
if (res.contentLength != null && res.contentLength > MAX_INBOUND_ATTACHMENT_BYTES) {
|
|
41037
|
-
return { ...base, error:
|
|
41085
|
+
return { ...base, error: OVER_CAP_ERROR };
|
|
41038
41086
|
}
|
|
41039
41087
|
const bytes = await res.bytes();
|
|
41040
41088
|
if (bytes.byteLength > MAX_INBOUND_ATTACHMENT_BYTES) {
|
|
41041
|
-
return { ...base, error:
|
|
41089
|
+
return { ...base, error: OVER_CAP_ERROR };
|
|
41042
41090
|
}
|
|
41043
41091
|
deps.ensureDir(dir);
|
|
41044
41092
|
const path = deps.joinPath(dir, safeInboundFilename(att.upload_id, att.filename));
|
|
@@ -42233,16 +42281,7 @@ async function maybeSendDirectChatAccountWarn(sessionId) {
|
|
|
42233
42281
|
}
|
|
42234
42282
|
}
|
|
42235
42283
|
var inboundAttachmentDeps = {
|
|
42236
|
-
fetchUrl:
|
|
42237
|
-
const res = await fetchWithTimeout(url, { method: "GET" }, HTTP_TIMEOUT_MS);
|
|
42238
|
-
const len = res.headers.get("content-length");
|
|
42239
|
-
return {
|
|
42240
|
-
ok: res.ok,
|
|
42241
|
-
status: res.status,
|
|
42242
|
-
contentLength: len != null ? Number(len) : null,
|
|
42243
|
-
bytes: async () => new Uint8Array(await res.arrayBuffer())
|
|
42244
|
-
};
|
|
42245
|
-
},
|
|
42284
|
+
fetchUrl: (url, expectedBytes) => fetchWithTransferDeadline(url, inboundDownloadTimeoutMs(expectedBytes)),
|
|
42246
42285
|
ensureDir: (dir) => mkdirSync7(dir, { recursive: true }),
|
|
42247
42286
|
writeFile: (path, bytes) => writeFileSync8(path, bytes, { mode: 384 }),
|
|
42248
42287
|
joinPath: (...parts) => join17(...parts),
|
|
@@ -43110,10 +43149,10 @@ async function pollForMessages(sinceMs) {
|
|
|
43110
43149
|
}
|
|
43111
43150
|
const inboundAttachments = msg.attachments ?? [];
|
|
43112
43151
|
if (!isNotice && inboundAttachments.length > 0 && INBOUND_ATTACHMENTS_DIR) {
|
|
43113
|
-
const processed = await
|
|
43114
|
-
|
|
43115
|
-
|
|
43116
|
-
inboundAttachmentDeps
|
|
43152
|
+
const processed = await withPollGuardLease(
|
|
43153
|
+
pollGuard,
|
|
43154
|
+
Date.now() + attachmentsDownloadBudgetMs(inboundAttachments) + POLL_STUCK_MS,
|
|
43155
|
+
() => downloadInboundAttachments(inboundAttachments, INBOUND_ATTACHMENTS_DIR, inboundAttachmentDeps)
|
|
43117
43156
|
);
|
|
43118
43157
|
const annotation = buildAttachmentAnnotation(processed);
|
|
43119
43158
|
if (annotation) injectContent = `${injectContent}${annotation}`;
|
|
@@ -43273,7 +43312,7 @@ var DOORBELL_ENABLED = resolveHostBooleanFlag({
|
|
|
43273
43312
|
var DOORBELL_FILE = "direct-chat-doorbell";
|
|
43274
43313
|
var SAFETY_NET_POLL_MS = 3e4;
|
|
43275
43314
|
var POLL_STUCK_MS = 9e4;
|
|
43276
|
-
var pollGuard = { inFlight: false, inFlightSinceMs: null };
|
|
43315
|
+
var pollGuard = { inFlight: false, inFlightSinceMs: null, leaseUntilMs: null };
|
|
43277
43316
|
async function pollOnce(sinceMs) {
|
|
43278
43317
|
const decision = evaluatePollGuard(pollGuard, Date.now(), POLL_STUCK_MS);
|
|
43279
43318
|
if (!decision.run) return { ran: false, ok: false };
|
|
@@ -43291,6 +43330,7 @@ async function pollOnce(sinceMs) {
|
|
|
43291
43330
|
} finally {
|
|
43292
43331
|
pollGuard.inFlight = false;
|
|
43293
43332
|
pollGuard.inFlightSinceMs = null;
|
|
43333
|
+
pollGuard.leaseUntilMs = null;
|
|
43294
43334
|
}
|
|
43295
43335
|
}
|
|
43296
43336
|
var doorbellWatcher = null;
|
package/package.json
CHANGED
|
File without changes
|