@integrity-labs/agt-cli 0.28.141 → 0.28.143
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-HKKV7NJD.js → chunk-AEU5FDZW.js} +38 -1
- package/dist/chunk-AEU5FDZW.js.map +1 -0
- package/dist/{chunk-UVCPJVEF.js → chunk-DOZH7UNT.js} +2 -2
- package/dist/{chunk-T436PVUP.js → chunk-FY33N3N7.js} +3 -3
- package/dist/{claude-pair-runtime-SBATMO4Y.js → claude-pair-runtime-JUQZBHID.js} +2 -2
- package/dist/lib/manager-worker.js +8 -8
- package/dist/mcp/direct-chat-channel.js +62 -1
- package/dist/mcp/slack-channel.js +66 -10
- package/dist/mcp/teams-channel.js +64 -2
- package/dist/mcp/telegram-channel.js +67 -5
- package/dist/{persistent-session-N4KR5IFC.js → persistent-session-KSVMYKBU.js} +3 -3
- package/dist/{responsiveness-probe-MYFNFOB7.js → responsiveness-probe-ZFKT6C3Z.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-HKKV7NJD.js.map +0 -1
- /package/dist/{chunk-UVCPJVEF.js.map → chunk-DOZH7UNT.js.map} +0 -0
- /package/dist/{chunk-T436PVUP.js.map → chunk-FY33N3N7.js.map} +0 -0
- /package/dist/{claude-pair-runtime-SBATMO4Y.js.map → claude-pair-runtime-JUQZBHID.js.map} +0 -0
- /package/dist/{persistent-session-N4KR5IFC.js.map → persistent-session-KSVMYKBU.js.map} +0 -0
- /package/dist/{responsiveness-probe-MYFNFOB7.js.map → responsiveness-probe-ZFKT6C3Z.js.map} +0 -0
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
formatMissingVar,
|
|
4
4
|
isClaudeFastMode,
|
|
5
5
|
probeMcpEnvSubstitution
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-AEU5FDZW.js";
|
|
7
7
|
import {
|
|
8
8
|
reapOrphanChannelMcps
|
|
9
9
|
} from "./chunk-XWVM4KPK.js";
|
|
@@ -1589,4 +1589,4 @@ export {
|
|
|
1589
1589
|
stopAllSessionsAndWait,
|
|
1590
1590
|
getProjectDir
|
|
1591
1591
|
};
|
|
1592
|
-
//# sourceMappingURL=chunk-
|
|
1592
|
+
//# sourceMappingURL=chunk-DOZH7UNT.js.map
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
resolveConnectivityProbe,
|
|
23
23
|
worseConnectivityOutcome,
|
|
24
24
|
wrapScheduledTaskPrompt
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-AEU5FDZW.js";
|
|
26
26
|
|
|
27
27
|
// ../../packages/core/dist/integrations/registry.js
|
|
28
28
|
var INTEGRATION_REGISTRY = [
|
|
@@ -7746,7 +7746,7 @@ function requireHost() {
|
|
|
7746
7746
|
}
|
|
7747
7747
|
|
|
7748
7748
|
// src/lib/api-client.ts
|
|
7749
|
-
var agtCliVersion = true ? "0.28.
|
|
7749
|
+
var agtCliVersion = true ? "0.28.143" : "dev";
|
|
7750
7750
|
var lastConfigHash = null;
|
|
7751
7751
|
function setConfigHash(hash) {
|
|
7752
7752
|
lastConfigHash = hash && hash.length > 0 ? hash : null;
|
|
@@ -9043,4 +9043,4 @@ export {
|
|
|
9043
9043
|
managerInstallSystemUnitCommand,
|
|
9044
9044
|
managerUninstallSystemUnitCommand
|
|
9045
9045
|
};
|
|
9046
|
-
//# sourceMappingURL=chunk-
|
|
9046
|
+
//# sourceMappingURL=chunk-FY33N3N7.js.map
|
|
@@ -100,7 +100,7 @@ async function spawnPairSession(session) {
|
|
|
100
100
|
return { ok: true };
|
|
101
101
|
} catch {
|
|
102
102
|
}
|
|
103
|
-
const { resolveClaudeBinary } = await import("./persistent-session-
|
|
103
|
+
const { resolveClaudeBinary } = await import("./persistent-session-KSVMYKBU.js");
|
|
104
104
|
const claudeBin = resolveClaudeBinary();
|
|
105
105
|
const pairEnv = {
|
|
106
106
|
...process.env,
|
|
@@ -373,4 +373,4 @@ export {
|
|
|
373
373
|
startClaudePair,
|
|
374
374
|
submitClaudePairCode
|
|
375
375
|
};
|
|
376
|
-
//# sourceMappingURL=claude-pair-runtime-
|
|
376
|
+
//# sourceMappingURL=claude-pair-runtime-JUQZBHID.js.map
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
requireHost,
|
|
29
29
|
safeWriteJsonAtomic,
|
|
30
30
|
setConfigHash
|
|
31
|
-
} from "../chunk-
|
|
31
|
+
} from "../chunk-FY33N3N7.js";
|
|
32
32
|
import {
|
|
33
33
|
getProjectDir as getProjectDir2,
|
|
34
34
|
getReadyTasks,
|
|
@@ -72,7 +72,7 @@ import {
|
|
|
72
72
|
takeZombieDetection,
|
|
73
73
|
transcriptActivityAgeSeconds,
|
|
74
74
|
writeEgressAllowlist
|
|
75
|
-
} from "../chunk-
|
|
75
|
+
} from "../chunk-DOZH7UNT.js";
|
|
76
76
|
import {
|
|
77
77
|
FLAGS_SCHEMA_VERSION,
|
|
78
78
|
FLAG_REGISTRY,
|
|
@@ -110,7 +110,7 @@ import {
|
|
|
110
110
|
resolveDmTarget,
|
|
111
111
|
sumTranscriptUsageInWindow,
|
|
112
112
|
wrapScheduledTaskPrompt
|
|
113
|
-
} from "../chunk-
|
|
113
|
+
} from "../chunk-AEU5FDZW.js";
|
|
114
114
|
import {
|
|
115
115
|
parsePsRows,
|
|
116
116
|
reapOrphanChannelMcps
|
|
@@ -7092,7 +7092,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
|
|
|
7092
7092
|
var lastVersionCheckAt = 0;
|
|
7093
7093
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
7094
7094
|
var lastResponsivenessProbeAt = 0;
|
|
7095
|
-
var agtCliVersion = true ? "0.28.
|
|
7095
|
+
var agtCliVersion = true ? "0.28.143" : "dev";
|
|
7096
7096
|
function resolveBrewPath(execFileSync4) {
|
|
7097
7097
|
try {
|
|
7098
7098
|
const out = execFileSync4("which", ["brew"], { timeout: 5e3 }).toString().trim();
|
|
@@ -8225,7 +8225,7 @@ async function pollCycle() {
|
|
|
8225
8225
|
}
|
|
8226
8226
|
try {
|
|
8227
8227
|
const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
|
|
8228
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
8228
|
+
const { collectDiagnostics } = await import("../persistent-session-KSVMYKBU.js");
|
|
8229
8229
|
const diagCodeNames = [...agentState.persistentSessionAgents];
|
|
8230
8230
|
const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames) : void 0;
|
|
8231
8231
|
let tailscaleHostname;
|
|
@@ -8373,7 +8373,7 @@ async function pollCycle() {
|
|
|
8373
8373
|
const {
|
|
8374
8374
|
collectResponsivenessProbes,
|
|
8375
8375
|
getResponsivenessIntervalMs
|
|
8376
|
-
} = await import("../responsiveness-probe-
|
|
8376
|
+
} = await import("../responsiveness-probe-ZFKT6C3Z.js");
|
|
8377
8377
|
const probeIntervalMs = getResponsivenessIntervalMs();
|
|
8378
8378
|
if (now - lastResponsivenessProbeAt > probeIntervalMs) {
|
|
8379
8379
|
const probeCodeNames = [...agentState.persistentSessionAgents];
|
|
@@ -8405,7 +8405,7 @@ async function pollCycle() {
|
|
|
8405
8405
|
collectResponsivenessProbes,
|
|
8406
8406
|
livePendingInboundOldestAgeSeconds,
|
|
8407
8407
|
parkPendingInbound
|
|
8408
|
-
} = await import("../responsiveness-probe-
|
|
8408
|
+
} = await import("../responsiveness-probe-ZFKT6C3Z.js");
|
|
8409
8409
|
const { getProjectDir: wedgeProjectDir } = await import("../claude-scheduler-FATCLHDM.js");
|
|
8410
8410
|
const wedgeNow = /* @__PURE__ */ new Date();
|
|
8411
8411
|
const liveAgents = agentState.persistentSessionAgents;
|
|
@@ -11993,7 +11993,7 @@ async function processClaudePairSessions(agents) {
|
|
|
11993
11993
|
killPairSession,
|
|
11994
11994
|
pairTmuxSession,
|
|
11995
11995
|
finalizeClaudePairOnboarding
|
|
11996
|
-
} = await import("../claude-pair-runtime-
|
|
11996
|
+
} = await import("../claude-pair-runtime-JUQZBHID.js");
|
|
11997
11997
|
for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
|
|
11998
11998
|
log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
|
|
11999
11999
|
const killed = await killPairSession(pairTmuxSession(pairId));
|
|
@@ -13975,6 +13975,64 @@ var DIRECT_CHAT_EGRESS_TOOLS = /* @__PURE__ */ new Set([
|
|
|
13975
13975
|
"channel_request_input"
|
|
13976
13976
|
]);
|
|
13977
13977
|
|
|
13978
|
+
// src/strip-repost-preamble.ts
|
|
13979
|
+
var PRIOR_ATTEMPT_CUE = /\b(a moment ago|just now|a second ago|earlier|moments ago|previously|last (?:time|attempt)|drafted|dialled|dialed|typed|composed|wrote|sent) (?:this|that|it)?\b|\b(?:drafted|dialled|dialed|typed|composed)\b/i;
|
|
13980
|
+
var FAILURE_CUE = /\b(?:did(?:n['’]t| not)|could(?:n['’]t| not)|would(?:n['’]t| not)|wasn['’]t|fail(?:ed)?|never)\b[^.!?\n]*?\b(?:parse[d]?|send|sent|go through|went through|land|deliver(?:ed)?|post(?:ed)?|come through|came through)\b/i;
|
|
13981
|
+
var REPOST_CUE = /\b(?:re-?post(?:ing)?|re-?send(?:ing)?|re-?sending|post(?:ing)?|send(?:ing)?|trying|sharing)\b[^.!?\n]*?\b(?:it|this|that|again|now|once more)\b|\bhere(?:['’]s| it is| is the)[^.!?\n]*?\bagain\b/i;
|
|
13982
|
+
function isRepostPreamble(fragment) {
|
|
13983
|
+
const hasRepost = REPOST_CUE.test(fragment);
|
|
13984
|
+
if (!hasRepost) return false;
|
|
13985
|
+
return FAILURE_CUE.test(fragment) || PRIOR_ATTEMPT_CUE.test(fragment);
|
|
13986
|
+
}
|
|
13987
|
+
function trimLeadingSeparators(s) {
|
|
13988
|
+
return s.replace(/^[\s]*[—–\-:.,;]+[\s]*/, "").replace(/^\s+/, "");
|
|
13989
|
+
}
|
|
13990
|
+
function stripRepostPreambleWithMeta(text) {
|
|
13991
|
+
if (!text) return { text, stripped: false, shape: null };
|
|
13992
|
+
const leading = text.replace(/^\s+/, "");
|
|
13993
|
+
if (leading.startsWith("(")) {
|
|
13994
|
+
const close = leading.indexOf(")");
|
|
13995
|
+
if (close > 0) {
|
|
13996
|
+
const inner = leading.slice(1, close);
|
|
13997
|
+
if (isRepostPreamble(inner)) {
|
|
13998
|
+
const rest = trimLeadingSeparators(leading.slice(close + 1));
|
|
13999
|
+
if (rest.length > 0) return { text: rest, stripped: true, shape: "parenthetical" };
|
|
14000
|
+
}
|
|
14001
|
+
}
|
|
14002
|
+
}
|
|
14003
|
+
const runOn = leading.match(
|
|
14004
|
+
/^([^.!?\n]*?\b(?:again|now|once more)\b)[\s—–\-:.,;]+/i
|
|
14005
|
+
);
|
|
14006
|
+
if (runOn?.[1] && isRepostPreamble(runOn[1])) {
|
|
14007
|
+
const rest = trimLeadingSeparators(leading.slice(runOn[0].length));
|
|
14008
|
+
if (rest.length > 0) return { text: rest, stripped: true, shape: "sentence" };
|
|
14009
|
+
}
|
|
14010
|
+
const boundary = leading.search(/[.!?\n]/);
|
|
14011
|
+
if (boundary > 0) {
|
|
14012
|
+
const fragment = leading.slice(0, boundary + 1);
|
|
14013
|
+
if (isRepostPreamble(fragment)) {
|
|
14014
|
+
const rest = trimLeadingSeparators(leading.slice(boundary + 1));
|
|
14015
|
+
if (rest.length > 0) return { text: rest, stripped: true, shape: "sentence" };
|
|
14016
|
+
}
|
|
14017
|
+
}
|
|
14018
|
+
return { text, stripped: false, shape: null };
|
|
14019
|
+
}
|
|
14020
|
+
function emitPreambleStripTelemetry(channel, shape) {
|
|
14021
|
+
if (!shape) return;
|
|
14022
|
+
const agentCode = process.env.AGT_AGENT_CODE_NAME ?? "unknown";
|
|
14023
|
+
try {
|
|
14024
|
+
process.stderr.write(
|
|
14025
|
+
`agt.egress.preamble_stripped ${JSON.stringify({
|
|
14026
|
+
channel,
|
|
14027
|
+
agent_code: agentCode,
|
|
14028
|
+
shape
|
|
14029
|
+
})}
|
|
14030
|
+
`
|
|
14031
|
+
);
|
|
14032
|
+
} catch {
|
|
14033
|
+
}
|
|
14034
|
+
}
|
|
14035
|
+
|
|
13978
14036
|
// src/direct-chat-claim-tracker.ts
|
|
13979
14037
|
var DirectChatClaimTracker = class {
|
|
13980
14038
|
bySession = /* @__PURE__ */ new Map();
|
|
@@ -14465,7 +14523,10 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
14465
14523
|
};
|
|
14466
14524
|
}
|
|
14467
14525
|
if (name === "direct_chat.reply") {
|
|
14468
|
-
const { session_id, content } = args;
|
|
14526
|
+
const { session_id, content: rawContent } = args;
|
|
14527
|
+
const sanitizedReply = stripRepostPreambleWithMeta(rawContent);
|
|
14528
|
+
if (sanitizedReply.stripped) emitPreambleStripTelemetry("direct_chat", sanitizedReply.shape);
|
|
14529
|
+
const content = sanitizedReply.text;
|
|
14469
14530
|
const message_ids = claimTracker.peek(session_id);
|
|
14470
14531
|
const streamEnabled = resolveHostBooleanFlag({
|
|
14471
14532
|
key: "direct-chat-stream-reply",
|
|
@@ -15265,6 +15265,64 @@ var SLACK_EGRESS_TOOLS = /* @__PURE__ */ new Set([
|
|
|
15265
15265
|
"slack.upload_file"
|
|
15266
15266
|
]);
|
|
15267
15267
|
|
|
15268
|
+
// src/strip-repost-preamble.ts
|
|
15269
|
+
var PRIOR_ATTEMPT_CUE = /\b(a moment ago|just now|a second ago|earlier|moments ago|previously|last (?:time|attempt)|drafted|dialled|dialed|typed|composed|wrote|sent) (?:this|that|it)?\b|\b(?:drafted|dialled|dialed|typed|composed)\b/i;
|
|
15270
|
+
var FAILURE_CUE = /\b(?:did(?:n['’]t| not)|could(?:n['’]t| not)|would(?:n['’]t| not)|wasn['’]t|fail(?:ed)?|never)\b[^.!?\n]*?\b(?:parse[d]?|send|sent|go through|went through|land|deliver(?:ed)?|post(?:ed)?|come through|came through)\b/i;
|
|
15271
|
+
var REPOST_CUE = /\b(?:re-?post(?:ing)?|re-?send(?:ing)?|re-?sending|post(?:ing)?|send(?:ing)?|trying|sharing)\b[^.!?\n]*?\b(?:it|this|that|again|now|once more)\b|\bhere(?:['’]s| it is| is the)[^.!?\n]*?\bagain\b/i;
|
|
15272
|
+
function isRepostPreamble(fragment) {
|
|
15273
|
+
const hasRepost = REPOST_CUE.test(fragment);
|
|
15274
|
+
if (!hasRepost) return false;
|
|
15275
|
+
return FAILURE_CUE.test(fragment) || PRIOR_ATTEMPT_CUE.test(fragment);
|
|
15276
|
+
}
|
|
15277
|
+
function trimLeadingSeparators(s) {
|
|
15278
|
+
return s.replace(/^[\s]*[—–\-:.,;]+[\s]*/, "").replace(/^\s+/, "");
|
|
15279
|
+
}
|
|
15280
|
+
function stripRepostPreambleWithMeta(text) {
|
|
15281
|
+
if (!text) return { text, stripped: false, shape: null };
|
|
15282
|
+
const leading = text.replace(/^\s+/, "");
|
|
15283
|
+
if (leading.startsWith("(")) {
|
|
15284
|
+
const close = leading.indexOf(")");
|
|
15285
|
+
if (close > 0) {
|
|
15286
|
+
const inner = leading.slice(1, close);
|
|
15287
|
+
if (isRepostPreamble(inner)) {
|
|
15288
|
+
const rest = trimLeadingSeparators(leading.slice(close + 1));
|
|
15289
|
+
if (rest.length > 0) return { text: rest, stripped: true, shape: "parenthetical" };
|
|
15290
|
+
}
|
|
15291
|
+
}
|
|
15292
|
+
}
|
|
15293
|
+
const runOn = leading.match(
|
|
15294
|
+
/^([^.!?\n]*?\b(?:again|now|once more)\b)[\s—–\-:.,;]+/i
|
|
15295
|
+
);
|
|
15296
|
+
if (runOn?.[1] && isRepostPreamble(runOn[1])) {
|
|
15297
|
+
const rest = trimLeadingSeparators(leading.slice(runOn[0].length));
|
|
15298
|
+
if (rest.length > 0) return { text: rest, stripped: true, shape: "sentence" };
|
|
15299
|
+
}
|
|
15300
|
+
const boundary = leading.search(/[.!?\n]/);
|
|
15301
|
+
if (boundary > 0) {
|
|
15302
|
+
const fragment = leading.slice(0, boundary + 1);
|
|
15303
|
+
if (isRepostPreamble(fragment)) {
|
|
15304
|
+
const rest = trimLeadingSeparators(leading.slice(boundary + 1));
|
|
15305
|
+
if (rest.length > 0) return { text: rest, stripped: true, shape: "sentence" };
|
|
15306
|
+
}
|
|
15307
|
+
}
|
|
15308
|
+
return { text, stripped: false, shape: null };
|
|
15309
|
+
}
|
|
15310
|
+
function emitPreambleStripTelemetry(channel, shape) {
|
|
15311
|
+
if (!shape) return;
|
|
15312
|
+
const agentCode = process.env.AGT_AGENT_CODE_NAME ?? "unknown";
|
|
15313
|
+
try {
|
|
15314
|
+
process.stderr.write(
|
|
15315
|
+
`agt.egress.preamble_stripped ${JSON.stringify({
|
|
15316
|
+
channel,
|
|
15317
|
+
agent_code: agentCode,
|
|
15318
|
+
shape
|
|
15319
|
+
})}
|
|
15320
|
+
`
|
|
15321
|
+
);
|
|
15322
|
+
} catch {
|
|
15323
|
+
}
|
|
15324
|
+
}
|
|
15325
|
+
|
|
15268
15326
|
// src/slack-pending-inbound-cleanup.ts
|
|
15269
15327
|
import { existsSync as existsSync3, readdirSync as readdirSync2, statSync, unlinkSync } from "fs";
|
|
15270
15328
|
import { join as join5 } from "path";
|
|
@@ -15473,12 +15531,8 @@ function createKanbanCardActiveClient(args) {
|
|
|
15473
15531
|
}
|
|
15474
15532
|
|
|
15475
15533
|
// src/slack-reply-threading.ts
|
|
15476
|
-
function isSlackDmChannel(channel) {
|
|
15477
|
-
return typeof channel === "string" && channel.startsWith("D");
|
|
15478
|
-
}
|
|
15479
15534
|
function resolveReplyThreadTs(input) {
|
|
15480
15535
|
if (input.threadTs) return input.threadTs;
|
|
15481
|
-
if (isSlackDmChannel(input.channel)) return void 0;
|
|
15482
15536
|
return input.messageTs || void 0;
|
|
15483
15537
|
}
|
|
15484
15538
|
|
|
@@ -17446,9 +17500,9 @@ async function processSlackRecoveryOutboxFile(filename) {
|
|
|
17446
17500
|
}
|
|
17447
17501
|
return;
|
|
17448
17502
|
}
|
|
17449
|
-
const
|
|
17450
|
-
|
|
17451
|
-
|
|
17503
|
+
const recovered = stripRepostPreambleWithMeta(payload.text);
|
|
17504
|
+
if (recovered.stripped) emitPreambleStripTelemetry("slack", recovered.shape);
|
|
17505
|
+
const text = recovered.text;
|
|
17452
17506
|
let sendSucceeded = false;
|
|
17453
17507
|
const controller = new AbortController();
|
|
17454
17508
|
const timeoutId = setTimeout(() => controller.abort(), 15e3);
|
|
@@ -18918,7 +18972,7 @@ var mcp = new Server(
|
|
|
18918
18972
|
`Inbound: <channel ... thread_ts="..." message_ts="..." [thread_context="..."]>. Pass channel + message_ts to slack.reply (and thread_ts on threads). thread_context = thread pre-loaded; ground replies ONLY in it, never another channel's.`,
|
|
18919
18973
|
"Inbound attachments: <channel> `files` is a JSON-serialised array \u2014 JSON.parse it. If an entry has `path`, the image is already downloaded \u2014 Read it directly, do NOT call slack.download_attachment. Use that tool only for entries with `file_id` but NO `path` (PDF, docx, csv): pass file_id + channel verbatim, then Read the returned path. Single-image messages also get a top-level `image_path`. Don't surface internal file-handling errors that don't affect the answer.",
|
|
18920
18974
|
"Address users by user_name, never by raw user ID. In multi-participant threads the CURRENT speaker is the one on the latest <channel> tag.",
|
|
18921
|
-
|
|
18975
|
+
`Always reply in a thread \u2014 pass message_ts and the server threads your reply off it, for channels AND DMs (it creates the thread if one doesn't exist yet). auto_followed="true" \u2192 only reply if useful, OR if your own bot user is @-mentioned (counts even in auto_followed).`,
|
|
18922
18976
|
`Reaction taxonomy (use slack.react sparingly \u2014 prefer a reply): :${SLACK_ACK_REACTION}: = ack (already auto-added on inbound, do not duplicate); \u2705 = success.` + (SKIP_REACTION_ON ? ` "${SLACK_SKIP_REACTION}" = seen but not replying (see below).` : "") + " NEVER react to signal failure of YOUR work \u2014 users can't tell why something failed from an emoji. On failure, slack.reply with one sentence explaining what went wrong (no stack traces, no secrets). (The \u23F3 you may see on an inbound is applied by the system, not you \u2014 it marks a message that arrived while the agent couldn't reply; never add \u23F3 or \u274C yourself.)",
|
|
18923
18977
|
SKIP_REACTION_ON ? `When you read a DM or thread message and decide NOT to reply (different @-mention, side conversation, auto_followed catch-up, or simply nothing useful to add): call slack.react with emoji "${SLACK_SKIP_REACTION}" so the sender knows you saw it \u2014 never post a "this wasn't for me" message. Top-level channel messages (not a DM, not a thread reply) you may still skip silently.` : `When a thread message is NOT addressed to you (different @-mention, side conversation, auto_followed catch-up): SILENTLY SKIP \u2014 no reaction, no reply, no "this wasn't for me" message.`,
|
|
18924
18978
|
"To deliver a file: save under your project dir, call slack.upload_file with path + channel + thread_ts."
|
|
@@ -18940,7 +18994,7 @@ mcp.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
|
18940
18994
|
text: { type: "string", description: "The message to send" },
|
|
18941
18995
|
thread_ts: {
|
|
18942
18996
|
type: "string",
|
|
18943
|
-
description: "Thread timestamp for an existing thread reply (from the thread_ts attribute). Safe to omit:
|
|
18997
|
+
description: "Thread timestamp for an existing thread reply (from the thread_ts attribute). Safe to omit: the server automatically threads your reply off the message you are answering (via message_ts), for channels and DMs alike \u2014 it starts a thread when none exists."
|
|
18944
18998
|
},
|
|
18945
18999
|
// ENG-5861: explicit message_ts so the cleanup gate can match the
|
|
18946
19000
|
// exact pending-inbound marker — necessary because top-level DM
|
|
@@ -19270,6 +19324,8 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
19270
19324
|
clearOldestSlackPendingMarkerInChannel2(channel);
|
|
19271
19325
|
}
|
|
19272
19326
|
};
|
|
19327
|
+
const sanitized = stripRepostPreambleWithMeta(text);
|
|
19328
|
+
if (sanitized.stripped) emitPreambleStripTelemetry("slack", sanitized.shape);
|
|
19273
19329
|
try {
|
|
19274
19330
|
const res = await fetch("https://slack.com/api/chat.postMessage", {
|
|
19275
19331
|
method: "POST",
|
|
@@ -19279,7 +19335,7 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
19279
19335
|
},
|
|
19280
19336
|
body: JSON.stringify({
|
|
19281
19337
|
channel,
|
|
19282
|
-
text,
|
|
19338
|
+
text: sanitized.text,
|
|
19283
19339
|
...effectiveThreadTs ? { thread_ts: effectiveThreadTs } : {},
|
|
19284
19340
|
...buildAugmentedSlackMetadata() ? { metadata: buildAugmentedSlackMetadata() } : {}
|
|
19285
19341
|
// ↑ Labels this message as Augmented-agent-originated so peer agents
|
|
@@ -14034,6 +14034,64 @@ function resolveSandboxedPath(filePath, projectDir) {
|
|
|
14034
14034
|
return { ok: true, resolved };
|
|
14035
14035
|
}
|
|
14036
14036
|
|
|
14037
|
+
// src/strip-repost-preamble.ts
|
|
14038
|
+
var PRIOR_ATTEMPT_CUE = /\b(a moment ago|just now|a second ago|earlier|moments ago|previously|last (?:time|attempt)|drafted|dialled|dialed|typed|composed|wrote|sent) (?:this|that|it)?\b|\b(?:drafted|dialled|dialed|typed|composed)\b/i;
|
|
14039
|
+
var FAILURE_CUE = /\b(?:did(?:n['’]t| not)|could(?:n['’]t| not)|would(?:n['’]t| not)|wasn['’]t|fail(?:ed)?|never)\b[^.!?\n]*?\b(?:parse[d]?|send|sent|go through|went through|land|deliver(?:ed)?|post(?:ed)?|come through|came through)\b/i;
|
|
14040
|
+
var REPOST_CUE = /\b(?:re-?post(?:ing)?|re-?send(?:ing)?|re-?sending|post(?:ing)?|send(?:ing)?|trying|sharing)\b[^.!?\n]*?\b(?:it|this|that|again|now|once more)\b|\bhere(?:['’]s| it is| is the)[^.!?\n]*?\bagain\b/i;
|
|
14041
|
+
function isRepostPreamble(fragment) {
|
|
14042
|
+
const hasRepost = REPOST_CUE.test(fragment);
|
|
14043
|
+
if (!hasRepost) return false;
|
|
14044
|
+
return FAILURE_CUE.test(fragment) || PRIOR_ATTEMPT_CUE.test(fragment);
|
|
14045
|
+
}
|
|
14046
|
+
function trimLeadingSeparators(s) {
|
|
14047
|
+
return s.replace(/^[\s]*[—–\-:.,;]+[\s]*/, "").replace(/^\s+/, "");
|
|
14048
|
+
}
|
|
14049
|
+
function stripRepostPreambleWithMeta(text) {
|
|
14050
|
+
if (!text) return { text, stripped: false, shape: null };
|
|
14051
|
+
const leading = text.replace(/^\s+/, "");
|
|
14052
|
+
if (leading.startsWith("(")) {
|
|
14053
|
+
const close = leading.indexOf(")");
|
|
14054
|
+
if (close > 0) {
|
|
14055
|
+
const inner = leading.slice(1, close);
|
|
14056
|
+
if (isRepostPreamble(inner)) {
|
|
14057
|
+
const rest = trimLeadingSeparators(leading.slice(close + 1));
|
|
14058
|
+
if (rest.length > 0) return { text: rest, stripped: true, shape: "parenthetical" };
|
|
14059
|
+
}
|
|
14060
|
+
}
|
|
14061
|
+
}
|
|
14062
|
+
const runOn = leading.match(
|
|
14063
|
+
/^([^.!?\n]*?\b(?:again|now|once more)\b)[\s—–\-:.,;]+/i
|
|
14064
|
+
);
|
|
14065
|
+
if (runOn?.[1] && isRepostPreamble(runOn[1])) {
|
|
14066
|
+
const rest = trimLeadingSeparators(leading.slice(runOn[0].length));
|
|
14067
|
+
if (rest.length > 0) return { text: rest, stripped: true, shape: "sentence" };
|
|
14068
|
+
}
|
|
14069
|
+
const boundary = leading.search(/[.!?\n]/);
|
|
14070
|
+
if (boundary > 0) {
|
|
14071
|
+
const fragment = leading.slice(0, boundary + 1);
|
|
14072
|
+
if (isRepostPreamble(fragment)) {
|
|
14073
|
+
const rest = trimLeadingSeparators(leading.slice(boundary + 1));
|
|
14074
|
+
if (rest.length > 0) return { text: rest, stripped: true, shape: "sentence" };
|
|
14075
|
+
}
|
|
14076
|
+
}
|
|
14077
|
+
return { text, stripped: false, shape: null };
|
|
14078
|
+
}
|
|
14079
|
+
function emitPreambleStripTelemetry(channel, shape) {
|
|
14080
|
+
if (!shape) return;
|
|
14081
|
+
const agentCode = process.env.AGT_AGENT_CODE_NAME ?? "unknown";
|
|
14082
|
+
try {
|
|
14083
|
+
process.stderr.write(
|
|
14084
|
+
`agt.egress.preamble_stripped ${JSON.stringify({
|
|
14085
|
+
channel,
|
|
14086
|
+
agent_code: agentCode,
|
|
14087
|
+
shape
|
|
14088
|
+
})}
|
|
14089
|
+
`
|
|
14090
|
+
);
|
|
14091
|
+
} catch {
|
|
14092
|
+
}
|
|
14093
|
+
}
|
|
14094
|
+
|
|
14037
14095
|
// src/msteams-inbound-puller.ts
|
|
14038
14096
|
import { existsSync, mkdirSync, readdirSync, utimesSync, writeFileSync } from "fs";
|
|
14039
14097
|
import { join } from "path";
|
|
@@ -15403,10 +15461,12 @@ async function handleReply(args) {
|
|
|
15403
15461
|
)}s (threshold ${throttleCfg.threshold}). Stop attempting to reply until a human posts.`
|
|
15404
15462
|
);
|
|
15405
15463
|
}
|
|
15464
|
+
const sanitized = stripRepostPreambleWithMeta(text);
|
|
15465
|
+
if (sanitized.stripped) emitPreambleStripTelemetry("teams", sanitized.shape);
|
|
15406
15466
|
try {
|
|
15407
15467
|
const result = await sendActivity(serviceUrl, conversationId, {
|
|
15408
15468
|
type: "message",
|
|
15409
|
-
text,
|
|
15469
|
+
text: sanitized.text,
|
|
15410
15470
|
textFormat: "markdown",
|
|
15411
15471
|
...replyToId ? { replyToId } : {}
|
|
15412
15472
|
});
|
|
@@ -15962,10 +16022,12 @@ async function processRecoveryFile(filename) {
|
|
|
15962
16022
|
}
|
|
15963
16023
|
return;
|
|
15964
16024
|
}
|
|
16025
|
+
const recovered = stripRepostPreambleWithMeta(payload.text);
|
|
16026
|
+
if (recovered.stripped) emitPreambleStripTelemetry("teams", recovered.shape);
|
|
15965
16027
|
try {
|
|
15966
16028
|
await sendActivity(payload.service_url, payload.conversation_id, {
|
|
15967
16029
|
type: "message",
|
|
15968
|
-
text:
|
|
16030
|
+
text: recovered.text,
|
|
15969
16031
|
...payload.reply_to_id ? { replyToId: payload.reply_to_id } : {}
|
|
15970
16032
|
});
|
|
15971
16033
|
try {
|
|
@@ -16335,6 +16335,64 @@ var TELEGRAM_EGRESS_TOOLS = /* @__PURE__ */ new Set([
|
|
|
16335
16335
|
"channel_request_input"
|
|
16336
16336
|
]);
|
|
16337
16337
|
|
|
16338
|
+
// src/strip-repost-preamble.ts
|
|
16339
|
+
var PRIOR_ATTEMPT_CUE = /\b(a moment ago|just now|a second ago|earlier|moments ago|previously|last (?:time|attempt)|drafted|dialled|dialed|typed|composed|wrote|sent) (?:this|that|it)?\b|\b(?:drafted|dialled|dialed|typed|composed)\b/i;
|
|
16340
|
+
var FAILURE_CUE = /\b(?:did(?:n['’]t| not)|could(?:n['’]t| not)|would(?:n['’]t| not)|wasn['’]t|fail(?:ed)?|never)\b[^.!?\n]*?\b(?:parse[d]?|send|sent|go through|went through|land|deliver(?:ed)?|post(?:ed)?|come through|came through)\b/i;
|
|
16341
|
+
var REPOST_CUE = /\b(?:re-?post(?:ing)?|re-?send(?:ing)?|re-?sending|post(?:ing)?|send(?:ing)?|trying|sharing)\b[^.!?\n]*?\b(?:it|this|that|again|now|once more)\b|\bhere(?:['’]s| it is| is the)[^.!?\n]*?\bagain\b/i;
|
|
16342
|
+
function isRepostPreamble(fragment) {
|
|
16343
|
+
const hasRepost = REPOST_CUE.test(fragment);
|
|
16344
|
+
if (!hasRepost) return false;
|
|
16345
|
+
return FAILURE_CUE.test(fragment) || PRIOR_ATTEMPT_CUE.test(fragment);
|
|
16346
|
+
}
|
|
16347
|
+
function trimLeadingSeparators(s) {
|
|
16348
|
+
return s.replace(/^[\s]*[—–\-:.,;]+[\s]*/, "").replace(/^\s+/, "");
|
|
16349
|
+
}
|
|
16350
|
+
function stripRepostPreambleWithMeta(text) {
|
|
16351
|
+
if (!text) return { text, stripped: false, shape: null };
|
|
16352
|
+
const leading = text.replace(/^\s+/, "");
|
|
16353
|
+
if (leading.startsWith("(")) {
|
|
16354
|
+
const close = leading.indexOf(")");
|
|
16355
|
+
if (close > 0) {
|
|
16356
|
+
const inner = leading.slice(1, close);
|
|
16357
|
+
if (isRepostPreamble(inner)) {
|
|
16358
|
+
const rest = trimLeadingSeparators(leading.slice(close + 1));
|
|
16359
|
+
if (rest.length > 0) return { text: rest, stripped: true, shape: "parenthetical" };
|
|
16360
|
+
}
|
|
16361
|
+
}
|
|
16362
|
+
}
|
|
16363
|
+
const runOn = leading.match(
|
|
16364
|
+
/^([^.!?\n]*?\b(?:again|now|once more)\b)[\s—–\-:.,;]+/i
|
|
16365
|
+
);
|
|
16366
|
+
if (runOn?.[1] && isRepostPreamble(runOn[1])) {
|
|
16367
|
+
const rest = trimLeadingSeparators(leading.slice(runOn[0].length));
|
|
16368
|
+
if (rest.length > 0) return { text: rest, stripped: true, shape: "sentence" };
|
|
16369
|
+
}
|
|
16370
|
+
const boundary = leading.search(/[.!?\n]/);
|
|
16371
|
+
if (boundary > 0) {
|
|
16372
|
+
const fragment = leading.slice(0, boundary + 1);
|
|
16373
|
+
if (isRepostPreamble(fragment)) {
|
|
16374
|
+
const rest = trimLeadingSeparators(leading.slice(boundary + 1));
|
|
16375
|
+
if (rest.length > 0) return { text: rest, stripped: true, shape: "sentence" };
|
|
16376
|
+
}
|
|
16377
|
+
}
|
|
16378
|
+
return { text, stripped: false, shape: null };
|
|
16379
|
+
}
|
|
16380
|
+
function emitPreambleStripTelemetry(channel, shape) {
|
|
16381
|
+
if (!shape) return;
|
|
16382
|
+
const agentCode = process.env.AGT_AGENT_CODE_NAME ?? "unknown";
|
|
16383
|
+
try {
|
|
16384
|
+
process.stderr.write(
|
|
16385
|
+
`agt.egress.preamble_stripped ${JSON.stringify({
|
|
16386
|
+
channel,
|
|
16387
|
+
agent_code: agentCode,
|
|
16388
|
+
shape
|
|
16389
|
+
})}
|
|
16390
|
+
`
|
|
16391
|
+
);
|
|
16392
|
+
} catch {
|
|
16393
|
+
}
|
|
16394
|
+
}
|
|
16395
|
+
|
|
16338
16396
|
// src/telegram-pending-inbound-cleanup.ts
|
|
16339
16397
|
import { readdirSync, readFileSync as readFileSync7, statSync } from "fs";
|
|
16340
16398
|
import { join as join5 } from "path";
|
|
@@ -18031,9 +18089,9 @@ async function processRecoveryOutboxFile(filename) {
|
|
|
18031
18089
|
}
|
|
18032
18090
|
return;
|
|
18033
18091
|
}
|
|
18034
|
-
const
|
|
18035
|
-
|
|
18036
|
-
|
|
18092
|
+
const recovered = stripRepostPreambleWithMeta(payload.text);
|
|
18093
|
+
if (recovered.stripped) emitPreambleStripTelemetry("telegram", recovered.shape);
|
|
18094
|
+
const text = recovered.text;
|
|
18037
18095
|
const body = {
|
|
18038
18096
|
chat_id: payload.chat_id,
|
|
18039
18097
|
text,
|
|
@@ -18729,6 +18787,8 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
18729
18787
|
isError: true
|
|
18730
18788
|
};
|
|
18731
18789
|
}
|
|
18790
|
+
const tgSanitized = stripRepostPreambleWithMeta(text);
|
|
18791
|
+
if (tgSanitized.stripped) emitPreambleStripTelemetry("telegram", tgSanitized.shape);
|
|
18732
18792
|
const isPrivateChat = !chat_id.startsWith("-");
|
|
18733
18793
|
const tgThrottleCfg = isPrivateChat ? relaxedThrottleConfig(configFromEnv()) : configFromEnv();
|
|
18734
18794
|
const tgThrottleNow = Date.now();
|
|
@@ -18763,7 +18823,9 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
18763
18823
|
const timer = setTimeout(() => {
|
|
18764
18824
|
void deliverQueuedReply({
|
|
18765
18825
|
chatId: chat_id,
|
|
18766
|
-
text
|
|
18826
|
+
// ENG-6794: deliver the pre-sanitized text (preamble already stripped
|
|
18827
|
+
// and counted above, before the throttle decision).
|
|
18828
|
+
text: tgSanitized.text,
|
|
18767
18829
|
replyToMessageId: reply_to_message_id,
|
|
18768
18830
|
isReplyTool: name === "telegram.reply",
|
|
18769
18831
|
throttleCfg: tgThrottleCfg
|
|
@@ -18780,7 +18842,7 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
18780
18842
|
};
|
|
18781
18843
|
}
|
|
18782
18844
|
try {
|
|
18783
|
-
const body = { chat_id, text };
|
|
18845
|
+
const body = { chat_id, text: tgSanitized.text };
|
|
18784
18846
|
if (reply_to_message_id) body.reply_to_message_id = Number(reply_to_message_id);
|
|
18785
18847
|
const drainCutoffMs = Date.now();
|
|
18786
18848
|
const data = await telegramApiCall("sendMessage", body, 15e3);
|
|
@@ -34,8 +34,8 @@ import {
|
|
|
34
34
|
writeDirectChatSessionState,
|
|
35
35
|
writeEgressAllowlist,
|
|
36
36
|
writePersistentClaudeWrapper
|
|
37
|
-
} from "./chunk-
|
|
38
|
-
import "./chunk-
|
|
37
|
+
} from "./chunk-DOZH7UNT.js";
|
|
38
|
+
import "./chunk-AEU5FDZW.js";
|
|
39
39
|
import "./chunk-XWVM4KPK.js";
|
|
40
40
|
export {
|
|
41
41
|
EGRESS_BASELINE_DOMAINS,
|
|
@@ -74,4 +74,4 @@ export {
|
|
|
74
74
|
writeEgressAllowlist,
|
|
75
75
|
writePersistentClaudeWrapper
|
|
76
76
|
};
|
|
77
|
-
//# sourceMappingURL=persistent-session-
|
|
77
|
+
//# sourceMappingURL=persistent-session-KSVMYKBU.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
paneLogPath
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-DOZH7UNT.js";
|
|
4
|
+
import "./chunk-AEU5FDZW.js";
|
|
5
5
|
import "./chunk-XWVM4KPK.js";
|
|
6
6
|
|
|
7
7
|
// src/lib/responsiveness-probe.ts
|
|
@@ -304,4 +304,4 @@ export {
|
|
|
304
304
|
readAndResetChannelDeflections,
|
|
305
305
|
readAndResetChannelLaneClassifications
|
|
306
306
|
};
|
|
307
|
-
//# sourceMappingURL=responsiveness-probe-
|
|
307
|
+
//# sourceMappingURL=responsiveness-probe-ZFKT6C3Z.js.map
|