@integrity-labs/agt-cli 0.28.325 → 0.28.326
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 +3 -3
- package/dist/{chunk-BATSDQD7.js → chunk-3PT6JAFU.js} +2 -2
- package/dist/lib/manager-worker.js +2 -2
- package/dist/mcp/direct-chat-channel.js +35 -0
- package/dist/mcp/slack-channel.js +44 -3
- package/dist/mcp/telegram-channel.js +35 -0
- package/package.json +1 -1
- /package/dist/{chunk-BATSDQD7.js.map → chunk-3PT6JAFU.js.map} +0 -0
package/dist/bin/agt.js
CHANGED
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
success,
|
|
39
39
|
table,
|
|
40
40
|
warn
|
|
41
|
-
} from "../chunk-
|
|
41
|
+
} from "../chunk-3PT6JAFU.js";
|
|
42
42
|
import {
|
|
43
43
|
AnchorSessionClient,
|
|
44
44
|
CHANNEL_REGISTRY,
|
|
@@ -4827,7 +4827,7 @@ import { execFileSync, execSync } from "child_process";
|
|
|
4827
4827
|
import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
|
|
4828
4828
|
import chalk18 from "chalk";
|
|
4829
4829
|
import ora16 from "ora";
|
|
4830
|
-
var cliVersion = true ? "0.28.
|
|
4830
|
+
var cliVersion = true ? "0.28.326" : "dev";
|
|
4831
4831
|
async function fetchLatestVersion() {
|
|
4832
4832
|
const host2 = getHost();
|
|
4833
4833
|
if (!host2) return null;
|
|
@@ -5931,7 +5931,7 @@ function handleError(err) {
|
|
|
5931
5931
|
}
|
|
5932
5932
|
|
|
5933
5933
|
// src/bin/agt.ts
|
|
5934
|
-
var cliVersion2 = true ? "0.28.
|
|
5934
|
+
var cliVersion2 = true ? "0.28.326" : "dev";
|
|
5935
5935
|
var program = new Command();
|
|
5936
5936
|
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");
|
|
5937
5937
|
program.hook("preAction", async (thisCommand, actionCommand) => {
|
|
@@ -6705,7 +6705,7 @@ function requireHost() {
|
|
|
6705
6705
|
}
|
|
6706
6706
|
|
|
6707
6707
|
// src/lib/api-client.ts
|
|
6708
|
-
var agtCliVersion = true ? "0.28.
|
|
6708
|
+
var agtCliVersion = true ? "0.28.326" : "dev";
|
|
6709
6709
|
var lastConfigHash = null;
|
|
6710
6710
|
function setConfigHash(hash) {
|
|
6711
6711
|
lastConfigHash = hash && hash.length > 0 ? hash : null;
|
|
@@ -9102,4 +9102,4 @@ export {
|
|
|
9102
9102
|
managerInstallSystemUnitCommand,
|
|
9103
9103
|
managerUninstallSystemUnitCommand
|
|
9104
9104
|
};
|
|
9105
|
-
//# sourceMappingURL=chunk-
|
|
9105
|
+
//# sourceMappingURL=chunk-3PT6JAFU.js.map
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
requireHost,
|
|
44
44
|
safeWriteJsonAtomic,
|
|
45
45
|
setConfigHash
|
|
46
|
-
} from "../chunk-
|
|
46
|
+
} from "../chunk-3PT6JAFU.js";
|
|
47
47
|
import {
|
|
48
48
|
getProjectDir as getProjectDir2,
|
|
49
49
|
getReadyTasks,
|
|
@@ -8374,7 +8374,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
|
|
|
8374
8374
|
var lastVersionCheckAt = 0;
|
|
8375
8375
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
8376
8376
|
var lastResponsivenessProbeAt = 0;
|
|
8377
|
-
var agtCliVersion = true ? "0.28.
|
|
8377
|
+
var agtCliVersion = true ? "0.28.326" : "dev";
|
|
8378
8378
|
function resolveBrewPath(execFileSync2) {
|
|
8379
8379
|
try {
|
|
8380
8380
|
const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
|
|
@@ -14693,6 +14693,7 @@ function createKanbanCardActiveClient(args) {
|
|
|
14693
14693
|
const agentId = args.agentId;
|
|
14694
14694
|
const apiKey = args.agtApiKey;
|
|
14695
14695
|
const cache = /* @__PURE__ */ new Map();
|
|
14696
|
+
const threadCache = /* @__PURE__ */ new Map();
|
|
14696
14697
|
let cachedToken = null;
|
|
14697
14698
|
let cachedTokenExpiresAt = 0;
|
|
14698
14699
|
async function getToken() {
|
|
@@ -14737,6 +14738,26 @@ function createKanbanCardActiveClient(args) {
|
|
|
14737
14738
|
const data = await resp.json();
|
|
14738
14739
|
return data.active === true;
|
|
14739
14740
|
}
|
|
14741
|
+
async function queryThreadOnce(sourceIntegration, channel) {
|
|
14742
|
+
const token = await getToken();
|
|
14743
|
+
const qs = new URLSearchParams({ agent_id: agentId, source_integration: sourceIntegration, channel });
|
|
14744
|
+
return fetchImpl(`${base}/host/kanban/active-source-thread?${qs.toString()}`, {
|
|
14745
|
+
method: "GET",
|
|
14746
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
14747
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS2)
|
|
14748
|
+
});
|
|
14749
|
+
}
|
|
14750
|
+
async function queryThread(sourceIntegration, channel) {
|
|
14751
|
+
let resp = await queryThreadOnce(sourceIntegration, channel);
|
|
14752
|
+
if (resp.status === 401) {
|
|
14753
|
+
cachedToken = null;
|
|
14754
|
+
cachedTokenExpiresAt = 0;
|
|
14755
|
+
resp = await queryThreadOnce(sourceIntegration, channel);
|
|
14756
|
+
}
|
|
14757
|
+
if (!resp.ok) return void 0;
|
|
14758
|
+
const data = await resp.json();
|
|
14759
|
+
return data.thread_ts ?? void 0;
|
|
14760
|
+
}
|
|
14740
14761
|
return {
|
|
14741
14762
|
async isCardActive(sourceIntegration, sourceExternalId) {
|
|
14742
14763
|
const key = `${sourceIntegration}:${sourceExternalId}`;
|
|
@@ -14751,6 +14772,20 @@ function createKanbanCardActiveClient(args) {
|
|
|
14751
14772
|
log(`kanban-card-active: query threw key=${key}: ${err.message}`);
|
|
14752
14773
|
return false;
|
|
14753
14774
|
}
|
|
14775
|
+
},
|
|
14776
|
+
async getActiveCardSourceThread(sourceIntegration, channel) {
|
|
14777
|
+
const key = `thread:${sourceIntegration}:${channel}`;
|
|
14778
|
+
const t = now();
|
|
14779
|
+
const hit = threadCache.get(key);
|
|
14780
|
+
if (hit && t < hit.expiresAt) return hit.threadTs;
|
|
14781
|
+
try {
|
|
14782
|
+
const threadTs = await queryThread(sourceIntegration, channel);
|
|
14783
|
+
threadCache.set(key, { threadTs, expiresAt: t + (threadTs ? positiveTtlMs : negativeTtlMs) });
|
|
14784
|
+
return threadTs;
|
|
14785
|
+
} catch (err) {
|
|
14786
|
+
log(`kanban-card-active: thread query threw key=${key}: ${err.message}`);
|
|
14787
|
+
return void 0;
|
|
14788
|
+
}
|
|
14754
14789
|
}
|
|
14755
14790
|
};
|
|
14756
14791
|
}
|
|
@@ -16284,6 +16284,7 @@ function createKanbanCardActiveClient(args) {
|
|
|
16284
16284
|
const agentId = args.agentId;
|
|
16285
16285
|
const apiKey = args.agtApiKey;
|
|
16286
16286
|
const cache = /* @__PURE__ */ new Map();
|
|
16287
|
+
const threadCache = /* @__PURE__ */ new Map();
|
|
16287
16288
|
let cachedToken = null;
|
|
16288
16289
|
let cachedTokenExpiresAt = 0;
|
|
16289
16290
|
async function getToken() {
|
|
@@ -16328,6 +16329,26 @@ function createKanbanCardActiveClient(args) {
|
|
|
16328
16329
|
const data = await resp.json();
|
|
16329
16330
|
return data.active === true;
|
|
16330
16331
|
}
|
|
16332
|
+
async function queryThreadOnce(sourceIntegration, channel) {
|
|
16333
|
+
const token = await getToken();
|
|
16334
|
+
const qs = new URLSearchParams({ agent_id: agentId, source_integration: sourceIntegration, channel });
|
|
16335
|
+
return fetchImpl(`${base}/host/kanban/active-source-thread?${qs.toString()}`, {
|
|
16336
|
+
method: "GET",
|
|
16337
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
16338
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
|
|
16339
|
+
});
|
|
16340
|
+
}
|
|
16341
|
+
async function queryThread(sourceIntegration, channel) {
|
|
16342
|
+
let resp = await queryThreadOnce(sourceIntegration, channel);
|
|
16343
|
+
if (resp.status === 401) {
|
|
16344
|
+
cachedToken = null;
|
|
16345
|
+
cachedTokenExpiresAt = 0;
|
|
16346
|
+
resp = await queryThreadOnce(sourceIntegration, channel);
|
|
16347
|
+
}
|
|
16348
|
+
if (!resp.ok) return void 0;
|
|
16349
|
+
const data = await resp.json();
|
|
16350
|
+
return data.thread_ts ?? void 0;
|
|
16351
|
+
}
|
|
16331
16352
|
return {
|
|
16332
16353
|
async isCardActive(sourceIntegration, sourceExternalId) {
|
|
16333
16354
|
const key2 = `${sourceIntegration}:${sourceExternalId}`;
|
|
@@ -16342,6 +16363,20 @@ function createKanbanCardActiveClient(args) {
|
|
|
16342
16363
|
log(`kanban-card-active: query threw key=${key2}: ${err.message}`);
|
|
16343
16364
|
return false;
|
|
16344
16365
|
}
|
|
16366
|
+
},
|
|
16367
|
+
async getActiveCardSourceThread(sourceIntegration, channel) {
|
|
16368
|
+
const key2 = `thread:${sourceIntegration}:${channel}`;
|
|
16369
|
+
const t = now();
|
|
16370
|
+
const hit = threadCache.get(key2);
|
|
16371
|
+
if (hit && t < hit.expiresAt) return hit.threadTs;
|
|
16372
|
+
try {
|
|
16373
|
+
const threadTs = await queryThread(sourceIntegration, channel);
|
|
16374
|
+
threadCache.set(key2, { threadTs, expiresAt: t + (threadTs ? positiveTtlMs : negativeTtlMs) });
|
|
16375
|
+
return threadTs;
|
|
16376
|
+
} catch (err) {
|
|
16377
|
+
log(`kanban-card-active: thread query threw key=${key2}: ${err.message}`);
|
|
16378
|
+
return void 0;
|
|
16379
|
+
}
|
|
16345
16380
|
}
|
|
16346
16381
|
};
|
|
16347
16382
|
}
|
|
@@ -16349,7 +16384,9 @@ function createKanbanCardActiveClient(args) {
|
|
|
16349
16384
|
// src/slack-reply-threading.ts
|
|
16350
16385
|
function resolveReplyThreadTs(input) {
|
|
16351
16386
|
if (input.threadTs) return input.threadTs;
|
|
16352
|
-
|
|
16387
|
+
if (input.messageTs) return input.messageTs;
|
|
16388
|
+
if (input.threadTs === null) return void 0;
|
|
16389
|
+
return input.activeCardThreadTs || void 0;
|
|
16353
16390
|
}
|
|
16354
16391
|
|
|
16355
16392
|
// src/restart-confirm.ts
|
|
@@ -21162,10 +21199,12 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
21162
21199
|
};
|
|
21163
21200
|
}
|
|
21164
21201
|
const bindingFeedback = bindingMode === "warn" ? binding.agentFeedback : void 0;
|
|
21202
|
+
const activeCardThreadTs = !scheduledDest && !enforceBound && !channelGuard.corrected && !thread_ts && !message_ts && kanbanCardActiveClient && typeof channel === "string" && channel ? await kanbanCardActiveClient.getActiveCardSourceThread("slack", channel) : void 0;
|
|
21165
21203
|
const effectiveThreadTs = scheduledDest ? scheduledDest.thread_ts : enforceBound ? binding.threadTs : channelGuard.corrected ? channelGuard.threadTs : resolveReplyThreadTs({
|
|
21166
21204
|
channel,
|
|
21167
21205
|
threadTs: thread_ts,
|
|
21168
|
-
messageTs: message_ts
|
|
21206
|
+
messageTs: message_ts,
|
|
21207
|
+
activeCardThreadTs
|
|
21169
21208
|
});
|
|
21170
21209
|
if (effectiveChannel) {
|
|
21171
21210
|
recordReplyTargetClassification(
|
|
@@ -21843,10 +21882,12 @@ async function handleSendStructured(args) {
|
|
|
21843
21882
|
if (typeof text !== "string" || !text) {
|
|
21844
21883
|
return errResult("text is required (used as fallback for push notifications and unfurls)");
|
|
21845
21884
|
}
|
|
21885
|
+
const activeCardThreadTs = !thread_ts && !message_ts && kanbanCardActiveClient ? await kanbanCardActiveClient.getActiveCardSourceThread("slack", channel) : void 0;
|
|
21846
21886
|
const effectiveThreadTs = resolveReplyThreadTs({
|
|
21847
21887
|
channel,
|
|
21848
21888
|
threadTs: thread_ts,
|
|
21849
|
-
messageTs: message_ts
|
|
21889
|
+
messageTs: message_ts,
|
|
21890
|
+
activeCardThreadTs
|
|
21850
21891
|
});
|
|
21851
21892
|
recordReplyTargetClassification(
|
|
21852
21893
|
SLACK_AGENT_DIR,
|
|
@@ -17109,6 +17109,7 @@ function createKanbanCardActiveClient(args) {
|
|
|
17109
17109
|
const agentId = args.agentId;
|
|
17110
17110
|
const apiKey = args.agtApiKey;
|
|
17111
17111
|
const cache = /* @__PURE__ */ new Map();
|
|
17112
|
+
const threadCache = /* @__PURE__ */ new Map();
|
|
17112
17113
|
let cachedToken = null;
|
|
17113
17114
|
let cachedTokenExpiresAt = 0;
|
|
17114
17115
|
async function getToken() {
|
|
@@ -17153,6 +17154,26 @@ function createKanbanCardActiveClient(args) {
|
|
|
17153
17154
|
const data = await resp.json();
|
|
17154
17155
|
return data.active === true;
|
|
17155
17156
|
}
|
|
17157
|
+
async function queryThreadOnce(sourceIntegration, channel) {
|
|
17158
|
+
const token = await getToken();
|
|
17159
|
+
const qs = new URLSearchParams({ agent_id: agentId, source_integration: sourceIntegration, channel });
|
|
17160
|
+
return fetchImpl(`${base}/host/kanban/active-source-thread?${qs.toString()}`, {
|
|
17161
|
+
method: "GET",
|
|
17162
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
17163
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS6)
|
|
17164
|
+
});
|
|
17165
|
+
}
|
|
17166
|
+
async function queryThread(sourceIntegration, channel) {
|
|
17167
|
+
let resp = await queryThreadOnce(sourceIntegration, channel);
|
|
17168
|
+
if (resp.status === 401) {
|
|
17169
|
+
cachedToken = null;
|
|
17170
|
+
cachedTokenExpiresAt = 0;
|
|
17171
|
+
resp = await queryThreadOnce(sourceIntegration, channel);
|
|
17172
|
+
}
|
|
17173
|
+
if (!resp.ok) return void 0;
|
|
17174
|
+
const data = await resp.json();
|
|
17175
|
+
return data.thread_ts ?? void 0;
|
|
17176
|
+
}
|
|
17156
17177
|
return {
|
|
17157
17178
|
async isCardActive(sourceIntegration, sourceExternalId) {
|
|
17158
17179
|
const key2 = `${sourceIntegration}:${sourceExternalId}`;
|
|
@@ -17167,6 +17188,20 @@ function createKanbanCardActiveClient(args) {
|
|
|
17167
17188
|
log(`kanban-card-active: query threw key=${key2}: ${err.message}`);
|
|
17168
17189
|
return false;
|
|
17169
17190
|
}
|
|
17191
|
+
},
|
|
17192
|
+
async getActiveCardSourceThread(sourceIntegration, channel) {
|
|
17193
|
+
const key2 = `thread:${sourceIntegration}:${channel}`;
|
|
17194
|
+
const t = now();
|
|
17195
|
+
const hit = threadCache.get(key2);
|
|
17196
|
+
if (hit && t < hit.expiresAt) return hit.threadTs;
|
|
17197
|
+
try {
|
|
17198
|
+
const threadTs = await queryThread(sourceIntegration, channel);
|
|
17199
|
+
threadCache.set(key2, { threadTs, expiresAt: t + (threadTs ? positiveTtlMs : negativeTtlMs) });
|
|
17200
|
+
return threadTs;
|
|
17201
|
+
} catch (err) {
|
|
17202
|
+
log(`kanban-card-active: thread query threw key=${key2}: ${err.message}`);
|
|
17203
|
+
return void 0;
|
|
17204
|
+
}
|
|
17170
17205
|
}
|
|
17171
17206
|
};
|
|
17172
17207
|
}
|
package/package.json
CHANGED
|
File without changes
|