@integrity-labs/agt-cli 0.28.232 → 0.28.234
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 +4 -4
- package/dist/{chunk-FPWZQRJE.js → chunk-PA2XRXTN.js} +9 -3
- package/dist/chunk-PA2XRXTN.js.map +1 -0
- package/dist/{chunk-X4FOPVGZ.js → chunk-PYVEJMY2.js} +66 -22
- package/dist/chunk-PYVEJMY2.js.map +1 -0
- package/dist/{claude-pair-runtime-CGUFXCYJ.js → claude-pair-runtime-2ZFH6K4I.js} +2 -2
- package/dist/lib/manager-worker.js +15 -10
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/mcp/slack-channel.js +52 -126
- package/dist/mcp/telegram-channel.js +9 -90
- package/dist/{persistent-session-XYM2DWZU.js → persistent-session-LVDRHYX7.js} +2 -2
- package/dist/{responsiveness-probe-MUPAYTJF.js → responsiveness-probe-UW5TXKMS.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-FPWZQRJE.js.map +0 -1
- package/dist/chunk-X4FOPVGZ.js.map +0 -1
- /package/dist/{claude-pair-runtime-CGUFXCYJ.js.map → claude-pair-runtime-2ZFH6K4I.js.map} +0 -0
- /package/dist/{persistent-session-XYM2DWZU.js.map → persistent-session-LVDRHYX7.js.map} +0 -0
- /package/dist/{responsiveness-probe-MUPAYTJF.js.map → responsiveness-probe-UW5TXKMS.js.map} +0 -0
|
@@ -4152,8 +4152,8 @@ var require_core = __commonJS({
|
|
|
4152
4152
|
return this;
|
|
4153
4153
|
}
|
|
4154
4154
|
case "object": {
|
|
4155
|
-
const
|
|
4156
|
-
this._cache.delete(
|
|
4155
|
+
const cacheKey = schemaKeyRef;
|
|
4156
|
+
this._cache.delete(cacheKey);
|
|
4157
4157
|
let id = schemaKeyRef[this.opts.schemaId];
|
|
4158
4158
|
if (id) {
|
|
4159
4159
|
id = (0, resolve_1.normalizeId)(id);
|
|
@@ -15474,51 +15474,6 @@ function configFromEnv(env = process.env) {
|
|
|
15474
15474
|
};
|
|
15475
15475
|
}
|
|
15476
15476
|
|
|
15477
|
-
// src/channel-kill-check.ts
|
|
15478
|
-
var CACHE_TTL_MS = 6e4;
|
|
15479
|
-
var cache = /* @__PURE__ */ new Map();
|
|
15480
|
-
function cacheKey(channelType, channelId, threadTs) {
|
|
15481
|
-
return `${channelType}|${channelId}|${threadTs}`;
|
|
15482
|
-
}
|
|
15483
|
-
async function isThreadKilled(opts) {
|
|
15484
|
-
const threadTs = opts.threadTs ?? "";
|
|
15485
|
-
const key2 = cacheKey(opts.channelType, opts.channelId, threadTs);
|
|
15486
|
-
const now = opts.now ? opts.now() : Date.now();
|
|
15487
|
-
const cached2 = cache.get(key2);
|
|
15488
|
-
if (cached2 && cached2.expiresAt > now) {
|
|
15489
|
-
return cached2.killed;
|
|
15490
|
-
}
|
|
15491
|
-
if (!opts.agtHost || !opts.agtApiKey) {
|
|
15492
|
-
cache.set(key2, { killed: false, expiresAt: now + CACHE_TTL_MS });
|
|
15493
|
-
return false;
|
|
15494
|
-
}
|
|
15495
|
-
const fetchImpl = opts.fetchImpl ?? fetch;
|
|
15496
|
-
try {
|
|
15497
|
-
const url = new URL("/host/channels/kill-check", opts.agtHost);
|
|
15498
|
-
url.searchParams.set("channel_type", opts.channelType);
|
|
15499
|
-
url.searchParams.set("channel_id", opts.channelId);
|
|
15500
|
-
if (threadTs) url.searchParams.set("thread_ts", threadTs);
|
|
15501
|
-
const res = await fetchImpl(url.toString(), {
|
|
15502
|
-
method: "GET",
|
|
15503
|
-
headers: { Authorization: `Bearer ${opts.agtApiKey}` },
|
|
15504
|
-
// 5s ceiling — kill check is hot-path. If the API is slow,
|
|
15505
|
-
// fail-open and try again next cache window.
|
|
15506
|
-
signal: AbortSignal.timeout(5e3)
|
|
15507
|
-
});
|
|
15508
|
-
if (!res.ok) {
|
|
15509
|
-
cache.set(key2, { killed: false, expiresAt: now + CACHE_TTL_MS });
|
|
15510
|
-
return false;
|
|
15511
|
-
}
|
|
15512
|
-
const body = await res.json();
|
|
15513
|
-
const killed = !!body.killed;
|
|
15514
|
-
cache.set(key2, { killed, expiresAt: now + CACHE_TTL_MS });
|
|
15515
|
-
return killed;
|
|
15516
|
-
} catch {
|
|
15517
|
-
cache.set(key2, { killed: false, expiresAt: now + CACHE_TTL_MS });
|
|
15518
|
-
return false;
|
|
15519
|
-
}
|
|
15520
|
-
}
|
|
15521
|
-
|
|
15522
15477
|
// src/slack-thread-context.ts
|
|
15523
15478
|
var SLACK_AUTOLOAD_THREAD_LIMIT = 30;
|
|
15524
15479
|
var SLACK_AUTOLOAD_THREAD_MAX_CHARS = 4e3;
|
|
@@ -16091,7 +16046,7 @@ function createKanbanCardActiveClient(args) {
|
|
|
16091
16046
|
const base = args.agtHost.replace(/\/+$/, "");
|
|
16092
16047
|
const agentId = args.agentId;
|
|
16093
16048
|
const apiKey = args.agtApiKey;
|
|
16094
|
-
const
|
|
16049
|
+
const cache = /* @__PURE__ */ new Map();
|
|
16095
16050
|
let cachedToken = null;
|
|
16096
16051
|
let cachedTokenExpiresAt = 0;
|
|
16097
16052
|
async function getToken() {
|
|
@@ -16139,11 +16094,11 @@ function createKanbanCardActiveClient(args) {
|
|
|
16139
16094
|
async isCardActive(sourceIntegration, sourceExternalId) {
|
|
16140
16095
|
const key2 = `${sourceIntegration}:${sourceExternalId}`;
|
|
16141
16096
|
const t = now();
|
|
16142
|
-
const hit =
|
|
16097
|
+
const hit = cache.get(key2);
|
|
16143
16098
|
if (hit && t < hit.expiresAt) return hit.active;
|
|
16144
16099
|
try {
|
|
16145
16100
|
const active = await query(sourceIntegration, sourceExternalId);
|
|
16146
|
-
|
|
16101
|
+
cache.set(key2, { active, expiresAt: t + (active ? positiveTtlMs : negativeTtlMs) });
|
|
16147
16102
|
return active;
|
|
16148
16103
|
} catch (err) {
|
|
16149
16104
|
log(`kanban-card-active: query threw key=${key2}: ${err.message}`);
|
|
@@ -17046,6 +17001,36 @@ function parsePeerAgentModeEnv(raw) {
|
|
|
17046
17001
|
return "off";
|
|
17047
17002
|
}
|
|
17048
17003
|
|
|
17004
|
+
// src/slack-peer-hint.ts
|
|
17005
|
+
var HINTABLE_REASONS = /* @__PURE__ */ new Set(["mode_off", "chat_not_allowed", "unknown_peer"]);
|
|
17006
|
+
function parseTeamPeerUserIdsEnv(raw) {
|
|
17007
|
+
if (!raw) return /* @__PURE__ */ new Set();
|
|
17008
|
+
return new Set(
|
|
17009
|
+
raw.split(",").map((v) => v.trim()).filter((v) => v.length > 0)
|
|
17010
|
+
);
|
|
17011
|
+
}
|
|
17012
|
+
function reasonGuidance(reason) {
|
|
17013
|
+
switch (reason) {
|
|
17014
|
+
case "mode_off":
|
|
17015
|
+
return "Peer collaboration is off for this agent (peer_agent_mode). Enable it in the Augmented Team console: Agent > Channels > Slack > Advanced > Multi-agent collaboration (set mode to listen/respond and add this channel to the allowed channels), then declare the peer under CHARTER multi_agent.slack_peers.";
|
|
17016
|
+
case "chat_not_allowed":
|
|
17017
|
+
return "Peer collaboration is on but this channel is not in peer_group_ids. Add it in the Augmented Team console: Agent > Channels > Slack > Advanced > Multi-agent collaboration > allowed channels.";
|
|
17018
|
+
case "unknown_peer":
|
|
17019
|
+
return "Peer collaboration is on but this sender is not a declared peer. Declare it under CHARTER multi_agent.slack_peers (Agent > Charter in the Augmented Team console) with the peer agent's code_name and bot_user_id.";
|
|
17020
|
+
default:
|
|
17021
|
+
return "";
|
|
17022
|
+
}
|
|
17023
|
+
}
|
|
17024
|
+
function maybePeerEnablementHint(args) {
|
|
17025
|
+
const { reason, senderUserId, channel, channelHash, teamPeerUserIds, seen, agentCodeName } = args;
|
|
17026
|
+
if (!HINTABLE_REASONS.has(reason)) return null;
|
|
17027
|
+
if (!senderUserId || !teamPeerUserIds.has(senderUserId)) return null;
|
|
17028
|
+
const key2 = `${channel}:${senderUserId}`;
|
|
17029
|
+
if (seen.has(key2)) return null;
|
|
17030
|
+
seen.add(key2);
|
|
17031
|
+
return `slack-channel(${agentCodeName}): [peer-hint] dropped a message from same-team agent ${senderUserId} (reason=${reason}) in channel ${channelHash}. Another Augmented Team managed agent is posting in this channel, but this agent cannot see it. ${reasonGuidance(reason)} This hint is logged once per channel/peer.`;
|
|
17032
|
+
}
|
|
17033
|
+
|
|
17049
17034
|
// src/cross-team-peer-audit-client.ts
|
|
17050
17035
|
var REQUEST_TIMEOUT_MS2 = 1e4;
|
|
17051
17036
|
function createCrossTeamPeerAuditClient(args) {
|
|
@@ -17686,6 +17671,10 @@ var SLACK_PEER_CLASSIFIER_CONFIG = {
|
|
|
17686
17671
|
peers: parsePeersEnv(process.env.SLACK_PEERS, process.env.SLACK_PEERS_GATE),
|
|
17687
17672
|
peer_disabled_mode: SLACK_PEER_DISABLED_MODE
|
|
17688
17673
|
};
|
|
17674
|
+
var SLACK_TEAM_PEER_USER_IDS = parseTeamPeerUserIdsEnv(
|
|
17675
|
+
process.env.SLACK_TEAM_PEER_USER_IDS
|
|
17676
|
+
);
|
|
17677
|
+
var PEER_HINT_SEEN = /* @__PURE__ */ new Set();
|
|
17689
17678
|
var SLACK_AGENT_DIR = AGENT_CODE_NAME ? join9(homedir4(), ".augmented", AGENT_CODE_NAME) : null;
|
|
17690
17679
|
var SLACK_MCP_CONFIG_PATH = SLACK_AGENT_DIR ? join9(SLACK_AGENT_DIR, "project", ".mcp.json") : null;
|
|
17691
17680
|
var liveAllowedUsersCache = null;
|
|
@@ -18936,8 +18925,6 @@ function buildSlackHelpMessage(codeName) {
|
|
|
18936
18925
|
`\u2022 \`${agentSlashCommand("/status")}\` - full health report: model, session, uptime + per-channel and per-integration status (cached snapshot, then this channel's own live check)`,
|
|
18937
18926
|
`\u2022 \`${agentSlashCommand("/ping")}\` - confirm this agent's channel is connected: posts a visible pong (team + manager only)`,
|
|
18938
18927
|
"\u2022 `/watch <google-doc-url> [duration]` (type it in chat) \u2014 watch a Google Doc for comments that mention me (default 2h, max 7d; auto-pauses when the window ends). In a shared channel, address me as `/watch-<my-name>`.",
|
|
18939
|
-
"\u2022 `/kill` \u2014 silence all agents in this thread for 6h (use as a thread reply)",
|
|
18940
|
-
"\u2022 `/unkill` \u2014 clear a kill (use as a thread reply)",
|
|
18941
18928
|
`\u2022 \`${agentSlashCommand("/investigate")}\` \u2014 live tail of this agent's terminal pane (DM only, allowlisted users; works while the channel process is alive \u2014 a wedged host still needs SSM diagnostics)`
|
|
18942
18929
|
].join("\n");
|
|
18943
18930
|
}
|
|
@@ -19476,56 +19463,6 @@ async function handleSlashCommandEnvelope(payload) {
|
|
|
19476
19463
|
await handleDebugSlashCommand(payload, responseUrl);
|
|
19477
19464
|
return;
|
|
19478
19465
|
}
|
|
19479
|
-
if (command === "/kill" || command === "/unkill") {
|
|
19480
|
-
if (!AGT_HOST || !AGT_API_KEY || !AGT_AGENT_ID) {
|
|
19481
|
-
await postEphemeralViaResponseUrl(
|
|
19482
|
-
responseUrl,
|
|
19483
|
-
":warning: This agent has no host API wiring \u2014 `/kill` / `/unkill` need the host runtime to be reachable.",
|
|
19484
|
-
codeName
|
|
19485
|
-
);
|
|
19486
|
-
return;
|
|
19487
|
-
}
|
|
19488
|
-
if (!payload.thread_ts || !payload.channel_id || !payload.user_id) {
|
|
19489
|
-
await postEphemeralViaResponseUrl(
|
|
19490
|
-
responseUrl,
|
|
19491
|
-
`:warning: \`${command}\` only works inside a thread. Invoke it as a thread reply.`,
|
|
19492
|
-
codeName
|
|
19493
|
-
);
|
|
19494
|
-
return;
|
|
19495
|
-
}
|
|
19496
|
-
try {
|
|
19497
|
-
const res = await fetch(`${AGT_HOST}/host/slack/thread-kill`, {
|
|
19498
|
-
method: "POST",
|
|
19499
|
-
headers: {
|
|
19500
|
-
"Content-Type": "application/json; charset=utf-8",
|
|
19501
|
-
Authorization: `Bearer ${AGT_API_KEY}`
|
|
19502
|
-
},
|
|
19503
|
-
body: JSON.stringify({
|
|
19504
|
-
agent_id: AGT_AGENT_ID,
|
|
19505
|
-
op: command === "/kill" ? "kill" : "unkill",
|
|
19506
|
-
channel_id: payload.channel_id,
|
|
19507
|
-
thread_ts: payload.thread_ts,
|
|
19508
|
-
user_id: payload.user_id,
|
|
19509
|
-
user_name: payload.user_name
|
|
19510
|
-
}),
|
|
19511
|
-
signal: AbortSignal.timeout(SLACK_DOWNLOAD_TIMEOUT_MS)
|
|
19512
|
-
});
|
|
19513
|
-
const data = await res.json();
|
|
19514
|
-
const text = data.message ?? (data.ok ? command === "/kill" ? ":lock: Kill engaged for this thread." : ":unlock: Kill cleared for this thread." : `:x: ${command} failed.`);
|
|
19515
|
-
await postEphemeralViaResponseUrl(responseUrl, text, codeName);
|
|
19516
|
-
} catch (err) {
|
|
19517
|
-
process.stderr.write(
|
|
19518
|
-
`slack-channel(${codeName}): ${command} forward failed: ${err.message}
|
|
19519
|
-
`
|
|
19520
|
-
);
|
|
19521
|
-
await postEphemeralViaResponseUrl(
|
|
19522
|
-
responseUrl,
|
|
19523
|
-
`:x: \`${command}\` forwarding failed \u2014 host runtime unreachable. Try again in a moment.`,
|
|
19524
|
-
codeName
|
|
19525
|
-
);
|
|
19526
|
-
}
|
|
19527
|
-
return;
|
|
19528
|
-
}
|
|
19529
19466
|
if (matchesAgentCommand(command, "/ping")) {
|
|
19530
19467
|
if (!payload.channel_id) {
|
|
19531
19468
|
await postEphemeralViaResponseUrl(
|
|
@@ -20129,30 +20066,6 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
20129
20066
|
threadTs: thread_ts,
|
|
20130
20067
|
messageTs: message_ts
|
|
20131
20068
|
});
|
|
20132
|
-
if (channel && effectiveThreadTs) {
|
|
20133
|
-
const killed = await isThreadKilled({
|
|
20134
|
-
channelType: "slack",
|
|
20135
|
-
channelId: channel,
|
|
20136
|
-
threadTs: effectiveThreadTs,
|
|
20137
|
-
agtHost: AGT_HOST,
|
|
20138
|
-
agtApiKey: AGT_API_KEY
|
|
20139
|
-
});
|
|
20140
|
-
if (killed) {
|
|
20141
|
-
process.stderr.write(
|
|
20142
|
-
`slack-channel(${AGENT_CODE_NAME}): reply_killed channel=${redactSlackId(channel)} thread=${redactSlackId(effectiveThreadTs)}
|
|
20143
|
-
`
|
|
20144
|
-
);
|
|
20145
|
-
return {
|
|
20146
|
-
content: [
|
|
20147
|
-
{
|
|
20148
|
-
type: "text",
|
|
20149
|
-
text: "This thread has been silenced by /kill. Stop attempting to reply \u2014 the human will /unkill when they want agents back."
|
|
20150
|
-
}
|
|
20151
|
-
],
|
|
20152
|
-
isError: true
|
|
20153
|
-
};
|
|
20154
|
-
}
|
|
20155
|
-
}
|
|
20156
20069
|
const throttleCfg = configFromEnv();
|
|
20157
20070
|
const throttleKey = effectiveThreadTs ?? channel;
|
|
20158
20071
|
const throttleNow = Date.now();
|
|
@@ -21463,6 +21376,19 @@ async function connectSocketMode() {
|
|
|
21463
21376
|
`slack-channel: inbound drop reason=${access.reason}${subtypeSuffix} channel=${channelHash} ts=${redactSlackId(evt.ts)}
|
|
21464
21377
|
`
|
|
21465
21378
|
);
|
|
21379
|
+
if (access.reason.startsWith("peer:")) {
|
|
21380
|
+
const hint = maybePeerEnablementHint({
|
|
21381
|
+
reason: access.reason.slice("peer:".length),
|
|
21382
|
+
senderUserId: evt.user,
|
|
21383
|
+
channel: evt.channel ?? "",
|
|
21384
|
+
channelHash,
|
|
21385
|
+
teamPeerUserIds: SLACK_TEAM_PEER_USER_IDS,
|
|
21386
|
+
seen: PEER_HINT_SEEN,
|
|
21387
|
+
agentCodeName: AGENT_CODE_NAME ?? "unknown"
|
|
21388
|
+
});
|
|
21389
|
+
if (hint) process.stderr.write(`${hint}
|
|
21390
|
+
`);
|
|
21391
|
+
}
|
|
21466
21392
|
if (access.decline !== void 0 && policyBlockReason) {
|
|
21467
21393
|
await maybeSendSenderPolicyDecline({
|
|
21468
21394
|
channel: evt.channel,
|
|
@@ -4152,8 +4152,8 @@ var require_core = __commonJS({
|
|
|
4152
4152
|
return this;
|
|
4153
4153
|
}
|
|
4154
4154
|
case "object": {
|
|
4155
|
-
const
|
|
4156
|
-
this._cache.delete(
|
|
4155
|
+
const cacheKey = schemaKeyRef;
|
|
4156
|
+
this._cache.delete(cacheKey);
|
|
4157
4157
|
let id = schemaKeyRef[this.opts.schemaId];
|
|
4158
4158
|
if (id) {
|
|
4159
4159
|
id = (0, resolve_1.normalizeId)(id);
|
|
@@ -14801,51 +14801,6 @@ function configFromEnv(env = process.env) {
|
|
|
14801
14801
|
};
|
|
14802
14802
|
}
|
|
14803
14803
|
|
|
14804
|
-
// src/channel-kill-check.ts
|
|
14805
|
-
var CACHE_TTL_MS = 6e4;
|
|
14806
|
-
var cache = /* @__PURE__ */ new Map();
|
|
14807
|
-
function cacheKey(channelType, channelId, threadTs) {
|
|
14808
|
-
return `${channelType}|${channelId}|${threadTs}`;
|
|
14809
|
-
}
|
|
14810
|
-
async function isThreadKilled(opts) {
|
|
14811
|
-
const threadTs = opts.threadTs ?? "";
|
|
14812
|
-
const key2 = cacheKey(opts.channelType, opts.channelId, threadTs);
|
|
14813
|
-
const now = opts.now ? opts.now() : Date.now();
|
|
14814
|
-
const cached2 = cache.get(key2);
|
|
14815
|
-
if (cached2 && cached2.expiresAt > now) {
|
|
14816
|
-
return cached2.killed;
|
|
14817
|
-
}
|
|
14818
|
-
if (!opts.agtHost || !opts.agtApiKey) {
|
|
14819
|
-
cache.set(key2, { killed: false, expiresAt: now + CACHE_TTL_MS });
|
|
14820
|
-
return false;
|
|
14821
|
-
}
|
|
14822
|
-
const fetchImpl = opts.fetchImpl ?? fetch;
|
|
14823
|
-
try {
|
|
14824
|
-
const url = new URL("/host/channels/kill-check", opts.agtHost);
|
|
14825
|
-
url.searchParams.set("channel_type", opts.channelType);
|
|
14826
|
-
url.searchParams.set("channel_id", opts.channelId);
|
|
14827
|
-
if (threadTs) url.searchParams.set("thread_ts", threadTs);
|
|
14828
|
-
const res = await fetchImpl(url.toString(), {
|
|
14829
|
-
method: "GET",
|
|
14830
|
-
headers: { Authorization: `Bearer ${opts.agtApiKey}` },
|
|
14831
|
-
// 5s ceiling — kill check is hot-path. If the API is slow,
|
|
14832
|
-
// fail-open and try again next cache window.
|
|
14833
|
-
signal: AbortSignal.timeout(5e3)
|
|
14834
|
-
});
|
|
14835
|
-
if (!res.ok) {
|
|
14836
|
-
cache.set(key2, { killed: false, expiresAt: now + CACHE_TTL_MS });
|
|
14837
|
-
return false;
|
|
14838
|
-
}
|
|
14839
|
-
const body = await res.json();
|
|
14840
|
-
const killed = !!body.killed;
|
|
14841
|
-
cache.set(key2, { killed, expiresAt: now + CACHE_TTL_MS });
|
|
14842
|
-
return killed;
|
|
14843
|
-
} catch {
|
|
14844
|
-
cache.set(key2, { killed: false, expiresAt: now + CACHE_TTL_MS });
|
|
14845
|
-
return false;
|
|
14846
|
-
}
|
|
14847
|
-
}
|
|
14848
|
-
|
|
14849
14804
|
// src/telegram-peer-classifier.ts
|
|
14850
14805
|
function classifyPeerMessage(msg, cfg, self) {
|
|
14851
14806
|
if (!msg.from?.is_bot) return { kind: "human" };
|
|
@@ -15347,12 +15302,12 @@ function createDbBackedPeerRateLimiter(deps) {
|
|
|
15347
15302
|
pendingWrites.add(write);
|
|
15348
15303
|
void write.finally(() => pendingWrites.delete(write));
|
|
15349
15304
|
}
|
|
15350
|
-
function
|
|
15305
|
+
function cacheKey(layer, chatId, peerBotId) {
|
|
15351
15306
|
return `${layer}|${chatId}|${peerBotId ?? ""}`;
|
|
15352
15307
|
}
|
|
15353
15308
|
const localBumpTimes = /* @__PURE__ */ new Map();
|
|
15354
15309
|
function bumpLocal(layer, chatId, peerBotId, now) {
|
|
15355
|
-
const key2 =
|
|
15310
|
+
const key2 = cacheKey(layer, chatId, peerBotId);
|
|
15356
15311
|
const list = localBumpTimes.get(key2);
|
|
15357
15312
|
if (list) list.push(now);
|
|
15358
15313
|
else localBumpTimes.set(key2, [now]);
|
|
@@ -15377,7 +15332,7 @@ function createDbBackedPeerRateLimiter(deps) {
|
|
|
15377
15332
|
}
|
|
15378
15333
|
}
|
|
15379
15334
|
async function readCount(layer, chatId, peerBotId, windowMs, now) {
|
|
15380
|
-
const key2 =
|
|
15335
|
+
const key2 = cacheKey(layer, chatId, peerBotId);
|
|
15381
15336
|
const cached2 = caches.get(key2);
|
|
15382
15337
|
if (cached2 && now - cached2.fetchedAt < readCacheMs) {
|
|
15383
15338
|
return cached2.count + localBumpsSince(key2, cached2.fetchedAt);
|
|
@@ -15425,7 +15380,7 @@ function createDbBackedPeerRateLimiter(deps) {
|
|
|
15425
15380
|
trackPending(deps.api.recordEvent({ chat_id: chatId, peer_bot_id: null, traffic_class: "chat" }).catch((err) => log(`peer_rate_event write failed: ${err.message}`)));
|
|
15426
15381
|
trackPending(deps.api.recordEvent({ chat_id: chatId, peer_bot_id: null, traffic_class: "agent_daily" }).catch((err) => log(`peer_rate_event write failed: ${err.message}`)));
|
|
15427
15382
|
trackPending(deps.api.recordEvent({ chat_id: chatId, peer_bot_id: null, traffic_class: "daily_budget" }).catch((err) => log(`peer_rate_event write failed: ${err.message}`)));
|
|
15428
|
-
const dbKey =
|
|
15383
|
+
const dbKey = cacheKey("daily_budget", "", null);
|
|
15429
15384
|
const dbCached = caches.get(dbKey);
|
|
15430
15385
|
const dbBudget = (dbCached?.count ?? 0) + localBumpsSince(dbKey, dbCached?.fetchedAt ?? 0);
|
|
15431
15386
|
const warn80 = dbBudget >= Math.ceil(config2.dailyBudgetLimit * 0.8) && dbBudget < config2.dailyBudgetLimit;
|
|
@@ -16937,7 +16892,7 @@ function createKanbanCardActiveClient(args) {
|
|
|
16937
16892
|
const base = args.agtHost.replace(/\/+$/, "");
|
|
16938
16893
|
const agentId = args.agentId;
|
|
16939
16894
|
const apiKey = args.agtApiKey;
|
|
16940
|
-
const
|
|
16895
|
+
const cache = /* @__PURE__ */ new Map();
|
|
16941
16896
|
let cachedToken = null;
|
|
16942
16897
|
let cachedTokenExpiresAt = 0;
|
|
16943
16898
|
async function getToken() {
|
|
@@ -16985,11 +16940,11 @@ function createKanbanCardActiveClient(args) {
|
|
|
16985
16940
|
async isCardActive(sourceIntegration, sourceExternalId) {
|
|
16986
16941
|
const key2 = `${sourceIntegration}:${sourceExternalId}`;
|
|
16987
16942
|
const t = now();
|
|
16988
|
-
const hit =
|
|
16943
|
+
const hit = cache.get(key2);
|
|
16989
16944
|
if (hit && t < hit.expiresAt) return hit.active;
|
|
16990
16945
|
try {
|
|
16991
16946
|
const active = await query(sourceIntegration, sourceExternalId);
|
|
16992
|
-
|
|
16947
|
+
cache.set(key2, { active, expiresAt: t + (active ? positiveTtlMs : negativeTtlMs) });
|
|
16993
16948
|
return active;
|
|
16994
16949
|
} catch (err) {
|
|
16995
16950
|
log(`kanban-card-active: query threw key=${key2}: ${err.message}`);
|
|
@@ -19262,20 +19217,6 @@ async function deliverQueuedReply(p) {
|
|
|
19262
19217
|
if (remaining <= 0) queuedReplyCounts.delete(p.chatId);
|
|
19263
19218
|
else queuedReplyCounts.set(p.chatId, remaining);
|
|
19264
19219
|
try {
|
|
19265
|
-
const killed = await isThreadKilled({
|
|
19266
|
-
channelType: "telegram",
|
|
19267
|
-
channelId: p.chatId,
|
|
19268
|
-
threadTs: "",
|
|
19269
|
-
agtHost: AGT_HOST,
|
|
19270
|
-
agtApiKey: AGT_API_KEY
|
|
19271
|
-
});
|
|
19272
|
-
if (killed) {
|
|
19273
|
-
process.stderr.write(
|
|
19274
|
-
`telegram-channel(${AGENT_CODE_NAME}): reply_queue_dropped reason=killed chat=${redactId(p.chatId)}
|
|
19275
|
-
`
|
|
19276
|
-
);
|
|
19277
|
-
return;
|
|
19278
|
-
}
|
|
19279
19220
|
const body = { chat_id: p.chatId, text: p.text };
|
|
19280
19221
|
if (p.replyToMessageId) body.reply_to_message_id = Number(p.replyToMessageId);
|
|
19281
19222
|
const drainCutoffMs = Date.now();
|
|
@@ -19517,28 +19458,6 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
19517
19458
|
};
|
|
19518
19459
|
}
|
|
19519
19460
|
}
|
|
19520
|
-
const killed = await isThreadKilled({
|
|
19521
|
-
channelType: "telegram",
|
|
19522
|
-
channelId: chat_id,
|
|
19523
|
-
threadTs: "",
|
|
19524
|
-
agtHost: AGT_HOST,
|
|
19525
|
-
agtApiKey: AGT_API_KEY
|
|
19526
|
-
});
|
|
19527
|
-
if (killed) {
|
|
19528
|
-
process.stderr.write(
|
|
19529
|
-
`telegram-channel(${AGENT_CODE_NAME}): reply_killed chat=${redactId(chat_id)}
|
|
19530
|
-
`
|
|
19531
|
-
);
|
|
19532
|
-
return {
|
|
19533
|
-
content: [
|
|
19534
|
-
{
|
|
19535
|
-
type: "text",
|
|
19536
|
-
text: "This chat has been silenced by /kill. Stop attempting to reply \u2014 the human will /unkill when they want agents back."
|
|
19537
|
-
}
|
|
19538
|
-
],
|
|
19539
|
-
isError: true
|
|
19540
|
-
};
|
|
19541
|
-
}
|
|
19542
19461
|
const tgSanitized = stripRepostPreambleWithMeta(text);
|
|
19543
19462
|
if (tgSanitized.stripped) emitPreambleStripTelemetry("telegram", tgSanitized.shape);
|
|
19544
19463
|
const tgSanitizedGuarded = redactToolCallMarkup(tgSanitized.text);
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
writeDirectChatSessionState,
|
|
37
37
|
writeEgressAllowlist,
|
|
38
38
|
writePersistentClaudeWrapper
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-PYVEJMY2.js";
|
|
40
40
|
import "./chunk-XWVM4KPK.js";
|
|
41
41
|
export {
|
|
42
42
|
EGRESS_BASELINE_DOMAINS,
|
|
@@ -77,4 +77,4 @@ export {
|
|
|
77
77
|
writeEgressAllowlist,
|
|
78
78
|
writePersistentClaudeWrapper
|
|
79
79
|
};
|
|
80
|
-
//# sourceMappingURL=persistent-session-
|
|
80
|
+
//# sourceMappingURL=persistent-session-LVDRHYX7.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
paneLogPath
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PYVEJMY2.js";
|
|
4
4
|
import "./chunk-XWVM4KPK.js";
|
|
5
5
|
|
|
6
6
|
// src/lib/responsiveness-probe.ts
|
|
@@ -303,4 +303,4 @@ export {
|
|
|
303
303
|
readAndResetChannelDeflections,
|
|
304
304
|
readAndResetChannelLaneClassifications
|
|
305
305
|
};
|
|
306
|
-
//# sourceMappingURL=responsiveness-probe-
|
|
306
|
+
//# sourceMappingURL=responsiveness-probe-UW5TXKMS.js.map
|