@integrity-labs/agt-cli 0.28.1160 → 0.28.1162
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-Y5W6WEJL.js → chunk-JMA2UNUS.js} +2 -2
- package/dist/lib/manager-worker.js +2 -2
- package/dist/mcp/direct-chat-channel.js +1 -0
- package/dist/mcp/index.js +1 -0
- package/dist/mcp/slack-channel.js +88 -60
- package/dist/mcp/telegram-channel.js +1 -0
- package/package.json +1 -1
- /package/dist/{chunk-Y5W6WEJL.js.map → chunk-JMA2UNUS.js.map} +0 -0
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-JMA2UNUS.js";
|
|
44
44
|
import {
|
|
45
45
|
getProjectDir,
|
|
46
46
|
isSessionResumeDisabled,
|
|
@@ -5513,7 +5513,7 @@ import { execFileSync, execSync } from "child_process";
|
|
|
5513
5513
|
import { existsSync as existsSync11, realpathSync as realpathSync2 } from "fs";
|
|
5514
5514
|
import chalk18 from "chalk";
|
|
5515
5515
|
import ora16 from "ora";
|
|
5516
|
-
var cliVersion = true ? "0.28.
|
|
5516
|
+
var cliVersion = true ? "0.28.1162" : "dev";
|
|
5517
5517
|
async function fetchLatestVersion() {
|
|
5518
5518
|
const host2 = getHost();
|
|
5519
5519
|
if (!host2) return null;
|
|
@@ -6773,7 +6773,7 @@ function handleError(err) {
|
|
|
6773
6773
|
}
|
|
6774
6774
|
|
|
6775
6775
|
// src/bin/agt.ts
|
|
6776
|
-
var cliVersion2 = true ? "0.28.
|
|
6776
|
+
var cliVersion2 = true ? "0.28.1162" : "dev";
|
|
6777
6777
|
var program = new Command();
|
|
6778
6778
|
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");
|
|
6779
6779
|
program.hook("preAction", async (thisCommand, actionCommand) => {
|
|
@@ -8078,7 +8078,7 @@ function exchangeFailureKind(err) {
|
|
|
8078
8078
|
}
|
|
8079
8079
|
|
|
8080
8080
|
// src/lib/api-client.ts
|
|
8081
|
-
var agtCliVersion = true ? "0.28.
|
|
8081
|
+
var agtCliVersion = true ? "0.28.1162" : "dev";
|
|
8082
8082
|
var lastConfigHash = null;
|
|
8083
8083
|
function setConfigHash(hash) {
|
|
8084
8084
|
lastConfigHash = hash && hash.length > 0 ? hash : null;
|
|
@@ -13235,4 +13235,4 @@ export {
|
|
|
13235
13235
|
managerInstallSystemUnitCommand,
|
|
13236
13236
|
managerUninstallSystemUnitCommand
|
|
13237
13237
|
};
|
|
13238
|
-
//# sourceMappingURL=chunk-
|
|
13238
|
+
//# sourceMappingURL=chunk-JMA2UNUS.js.map
|
|
@@ -77,7 +77,7 @@ import {
|
|
|
77
77
|
setConfigHash,
|
|
78
78
|
shellGuard,
|
|
79
79
|
tripClass
|
|
80
|
-
} from "../chunk-
|
|
80
|
+
} from "../chunk-JMA2UNUS.js";
|
|
81
81
|
import {
|
|
82
82
|
CLAUDE_CODE_SECURITY_FLOOR,
|
|
83
83
|
SELF_UPDATE_TIMEOUTS,
|
|
@@ -15874,7 +15874,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
|
|
|
15874
15874
|
var lastVersionCheckAt = 0;
|
|
15875
15875
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
15876
15876
|
var lastResponsivenessProbeAt = 0;
|
|
15877
|
-
var agtCliVersion = true ? "0.28.
|
|
15877
|
+
var agtCliVersion = true ? "0.28.1162" : "dev";
|
|
15878
15878
|
function resolveBrewPath(execFileSync3) {
|
|
15879
15879
|
try {
|
|
15880
15880
|
const out = execFileSync3("which", ["brew"], { timeout: 5e3 }).toString().trim();
|
|
@@ -53538,6 +53538,7 @@ var MAINTENANCE_GATED_TOOLS = /* @__PURE__ */ new Set([
|
|
|
53538
53538
|
"skill_create",
|
|
53539
53539
|
"skill_delete",
|
|
53540
53540
|
"skill_improve",
|
|
53541
|
+
"skill_install",
|
|
53541
53542
|
"skill_propose_revision",
|
|
53542
53543
|
"skill_publish_to_marketplace",
|
|
53543
53544
|
"skill_update",
|
package/dist/mcp/index.js
CHANGED
|
@@ -46819,6 +46819,7 @@ var MAINTENANCE_GATED_TOOLS = /* @__PURE__ */ new Set([
|
|
|
46819
46819
|
"skill_create",
|
|
46820
46820
|
"skill_delete",
|
|
46821
46821
|
"skill_improve",
|
|
46822
|
+
"skill_install",
|
|
46822
46823
|
"skill_propose_revision",
|
|
46823
46824
|
"skill_publish_to_marketplace",
|
|
46824
46825
|
"skill_update",
|
|
@@ -30997,6 +30997,7 @@ var MAINTENANCE_GATED_TOOLS = /* @__PURE__ */ new Set([
|
|
|
30997
30997
|
"skill_create",
|
|
30998
30998
|
"skill_delete",
|
|
30999
30999
|
"skill_improve",
|
|
31000
|
+
"skill_install",
|
|
31000
31001
|
"skill_propose_revision",
|
|
31001
31002
|
"skill_publish_to_marketplace",
|
|
31002
31003
|
"skill_update",
|
|
@@ -43095,7 +43096,7 @@ function emitHtmlEntityDecodeTelemetry(channel, count = 0) {
|
|
|
43095
43096
|
}
|
|
43096
43097
|
|
|
43097
43098
|
// src/slack-pending-inbound-cleanup.ts
|
|
43098
|
-
import { existsSync as existsSync4, readdirSync as readdirSync4, statSync as statSync3, unlinkSync } from "fs";
|
|
43099
|
+
import { existsSync as existsSync4, readFileSync as readFileSync5, readdirSync as readdirSync4, statSync as statSync3, unlinkSync } from "fs";
|
|
43099
43100
|
import { join as join9 } from "path";
|
|
43100
43101
|
function sanitizeMarkerSegment(value) {
|
|
43101
43102
|
return value.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
@@ -43123,6 +43124,20 @@ function clearAllSlackPendingMarkersForThread(dir, channel, threadTs, clear = de
|
|
|
43123
43124
|
const prefix = `${sanitizeMarkerSegment(channel)}__${sanitizeMarkerSegment(threadTs)}__`;
|
|
43124
43125
|
return applyToMatchingMarkers(dir, prefix, ".json", clear);
|
|
43125
43126
|
}
|
|
43127
|
+
function countOwedSlackRepliesForThread(dir, channel, threadTs) {
|
|
43128
|
+
const prefix = `${sanitizeMarkerSegment(channel)}__${sanitizeMarkerSegment(threadTs)}__`;
|
|
43129
|
+
let owed = 0;
|
|
43130
|
+
applyToMatchingMarkers(dir, prefix, ".json", (fullPath) => {
|
|
43131
|
+
try {
|
|
43132
|
+
const m = JSON.parse(readFileSync5(fullPath, "utf-8"));
|
|
43133
|
+
if (!m || typeof m !== "object") return;
|
|
43134
|
+
if (m.discretionary === true || m.undeliverable === true) return;
|
|
43135
|
+
owed += 1;
|
|
43136
|
+
} catch {
|
|
43137
|
+
}
|
|
43138
|
+
});
|
|
43139
|
+
return owed;
|
|
43140
|
+
}
|
|
43126
43141
|
function markSeenAllSlackPendingMarkersForThread(dir, channel, threadTs, markSeen) {
|
|
43127
43142
|
const prefix = `${sanitizeMarkerSegment(channel)}__${sanitizeMarkerSegment(threadTs)}__`;
|
|
43128
43143
|
return applyToMatchingMarkers(dir, prefix, ".json", markSeen);
|
|
@@ -43498,7 +43513,7 @@ function applyHotThreadGuard(input) {
|
|
|
43498
43513
|
}
|
|
43499
43514
|
|
|
43500
43515
|
// src/slack-hot-thread-telemetry.ts
|
|
43501
|
-
import { readFileSync as
|
|
43516
|
+
import { readFileSync as readFileSync6, writeFileSync as writeFileSync3 } from "fs";
|
|
43502
43517
|
import { join as join11 } from "path";
|
|
43503
43518
|
var HOT_THREAD_CLASSIFICATION_COUNTER_SUFFIX = "-hot-thread-classifications.json";
|
|
43504
43519
|
function hotThreadKey(mode, outcome, proactive) {
|
|
@@ -43509,7 +43524,7 @@ function recordHotThreadClassification(agentDir, channel, classification) {
|
|
|
43509
43524
|
const path = join11(agentDir, `${channel}${HOT_THREAD_CLASSIFICATION_COUNTER_SUFFIX}`);
|
|
43510
43525
|
let counts = {};
|
|
43511
43526
|
try {
|
|
43512
|
-
const parsed = JSON.parse(
|
|
43527
|
+
const parsed = JSON.parse(readFileSync6(path, "utf-8"));
|
|
43513
43528
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
43514
43529
|
for (const [k, v] of Object.entries(parsed)) {
|
|
43515
43530
|
if (typeof v === "number" && Number.isInteger(v) && v >= 0) counts[k] = v;
|
|
@@ -43526,7 +43541,7 @@ function recordHotThreadClassification(agentDir, channel, classification) {
|
|
|
43526
43541
|
}
|
|
43527
43542
|
|
|
43528
43543
|
// src/restart-confirm.ts
|
|
43529
|
-
import { existsSync as existsSync6, mkdirSync as mkdirSync2, readFileSync as
|
|
43544
|
+
import { existsSync as existsSync6, mkdirSync as mkdirSync2, readFileSync as readFileSync7, renameSync, unlinkSync as unlinkSync3, writeFileSync as writeFileSync4 } from "fs";
|
|
43530
43545
|
import { dirname } from "path";
|
|
43531
43546
|
import { randomUUID } from "crypto";
|
|
43532
43547
|
var RESTART_CONFIRM_MAX_AGE_MS = 10 * 60 * 1e3;
|
|
@@ -43552,7 +43567,7 @@ function writeRestartConfirmMarker(filePath, marker) {
|
|
|
43552
43567
|
function readRestartConfirmMarker(filePath) {
|
|
43553
43568
|
try {
|
|
43554
43569
|
if (!existsSync6(filePath)) return null;
|
|
43555
|
-
const parsed = JSON.parse(
|
|
43570
|
+
const parsed = JSON.parse(readFileSync7(filePath, "utf8"));
|
|
43556
43571
|
if (!parsed || typeof parsed !== "object") return null;
|
|
43557
43572
|
return parsed;
|
|
43558
43573
|
} catch {
|
|
@@ -43712,7 +43727,7 @@ import {
|
|
|
43712
43727
|
ftruncateSync,
|
|
43713
43728
|
mkdirSync as mkdirSync10,
|
|
43714
43729
|
openSync as openSync2,
|
|
43715
|
-
readFileSync as
|
|
43730
|
+
readFileSync as readFileSync20,
|
|
43716
43731
|
readdirSync as readdirSync7,
|
|
43717
43732
|
renameSync as renameSync5,
|
|
43718
43733
|
statSync as statSync5,
|
|
@@ -43726,7 +43741,7 @@ import { homedir as homedir7 } from "os";
|
|
|
43726
43741
|
import { createHash as createHash3, randomUUID as randomUUID2 } from "crypto";
|
|
43727
43742
|
|
|
43728
43743
|
// src/slack-thread-store.ts
|
|
43729
|
-
import { mkdirSync as mkdirSync3, readFileSync as
|
|
43744
|
+
import { mkdirSync as mkdirSync3, readFileSync as readFileSync8, writeFileSync as writeFileSync5 } from "fs";
|
|
43730
43745
|
import { dirname as dirname2 } from "path";
|
|
43731
43746
|
function isParticipatingThread(entry) {
|
|
43732
43747
|
if (!entry) return false;
|
|
@@ -43741,7 +43756,7 @@ function loadThreadStore(filePath, opts = {}) {
|
|
|
43741
43756
|
const ttlMs = ttlDays * 24 * 60 * 60 * 1e3;
|
|
43742
43757
|
let raw;
|
|
43743
43758
|
try {
|
|
43744
|
-
raw =
|
|
43759
|
+
raw = readFileSync8(filePath, "utf-8");
|
|
43745
43760
|
} catch {
|
|
43746
43761
|
return { threads: /* @__PURE__ */ new Map(), pruned: 0 };
|
|
43747
43762
|
}
|
|
@@ -43842,7 +43857,7 @@ function isThreadEntry(value) {
|
|
|
43842
43857
|
}
|
|
43843
43858
|
|
|
43844
43859
|
// src/dm-restart-notice.ts
|
|
43845
|
-
import { mkdirSync as mkdirSync4, readFileSync as
|
|
43860
|
+
import { mkdirSync as mkdirSync4, readFileSync as readFileSync9, unlinkSync as unlinkSync4, writeFileSync as writeFileSync6 } from "fs";
|
|
43846
43861
|
import { dirname as dirname3 } from "path";
|
|
43847
43862
|
var RECENT_DM_VERSION = 1;
|
|
43848
43863
|
var DEFAULT_RECENT_DM_TTL_MS = 30 * 60 * 1e3;
|
|
@@ -43866,7 +43881,7 @@ function loadRecentDms(filePath, opts = {}) {
|
|
|
43866
43881
|
const ttlMs = opts.ttlMs ?? DEFAULT_RECENT_DM_TTL_MS;
|
|
43867
43882
|
let raw;
|
|
43868
43883
|
try {
|
|
43869
|
-
raw =
|
|
43884
|
+
raw = readFileSync9(filePath, "utf-8");
|
|
43870
43885
|
} catch (err) {
|
|
43871
43886
|
const code = err.code;
|
|
43872
43887
|
if (code !== "ENOENT") {
|
|
@@ -43951,7 +43966,7 @@ var CHANNEL_ADD_RESTART_MAX_AGE_MS = 15 * 60 * 1e3;
|
|
|
43951
43966
|
function readChannelAddRestartMarker(filePath) {
|
|
43952
43967
|
let raw;
|
|
43953
43968
|
try {
|
|
43954
|
-
raw =
|
|
43969
|
+
raw = readFileSync9(filePath, "utf-8");
|
|
43955
43970
|
} catch {
|
|
43956
43971
|
return null;
|
|
43957
43972
|
}
|
|
@@ -44094,7 +44109,7 @@ function createReconnectScheduler(deps) {
|
|
|
44094
44109
|
}
|
|
44095
44110
|
|
|
44096
44111
|
// src/turn-initiator-marker.ts
|
|
44097
|
-
import { writeFileSync as writeFileSync7, readFileSync as
|
|
44112
|
+
import { writeFileSync as writeFileSync7, readFileSync as readFileSync10, mkdirSync as mkdirSync5, renameSync as renameSync2 } from "fs";
|
|
44098
44113
|
import { dirname as dirname4, join as join12 } from "path";
|
|
44099
44114
|
var TURN_INITIATOR_MAX_AGE_MS = 5 * 60 * 1e3;
|
|
44100
44115
|
var TURN_INITIATOR_LEDGER_MAX_ENTRIES = 20;
|
|
@@ -44128,7 +44143,7 @@ function updateTurnInitiatorLedger(singleSlotFile, marker) {
|
|
|
44128
44143
|
const ledgerFile = turnInitiatorLedgerPath(singleSlotFile);
|
|
44129
44144
|
let existing = null;
|
|
44130
44145
|
try {
|
|
44131
|
-
const parsed = JSON.parse(
|
|
44146
|
+
const parsed = JSON.parse(readFileSync10(ledgerFile, "utf8"));
|
|
44132
44147
|
if (parsed && parsed.v === 1 && Array.isArray(parsed.entries)) existing = parsed;
|
|
44133
44148
|
} catch {
|
|
44134
44149
|
}
|
|
@@ -44155,7 +44170,7 @@ function writeTurnInitiatorMarker(input) {
|
|
|
44155
44170
|
}
|
|
44156
44171
|
|
|
44157
44172
|
// src/turn-context.ts
|
|
44158
|
-
import { mkdirSync as mkdirSync6, readFileSync as
|
|
44173
|
+
import { mkdirSync as mkdirSync6, readFileSync as readFileSync12 } from "fs";
|
|
44159
44174
|
import { homedir as homedir6 } from "os";
|
|
44160
44175
|
import { dirname as dirname5, join as join15 } from "path";
|
|
44161
44176
|
|
|
@@ -44199,7 +44214,7 @@ function resolveAgentDirAlias(input) {
|
|
|
44199
44214
|
}
|
|
44200
44215
|
|
|
44201
44216
|
// src/scheduled-turn-marker.ts
|
|
44202
|
-
import { readFileSync as
|
|
44217
|
+
import { readFileSync as readFileSync11, unlinkSync as unlinkSync5 } from "fs";
|
|
44203
44218
|
import { join as join14 } from "path";
|
|
44204
44219
|
var SCHEDULED_TURN_MARKER_FILENAME2 = ".current-scheduled-turn.json";
|
|
44205
44220
|
var SCHEDULED_TURN_MAX_AGE_MS = 15 * 60 * 1e3;
|
|
@@ -44238,7 +44253,7 @@ function readScheduledTurnMarker(agentDir, now = Date.now()) {
|
|
|
44238
44253
|
if (!agentDir) return null;
|
|
44239
44254
|
try {
|
|
44240
44255
|
const raw = JSON.parse(
|
|
44241
|
-
|
|
44256
|
+
readFileSync11(join14(agentDir, SCHEDULED_TURN_MARKER_FILENAME2), "utf8")
|
|
44242
44257
|
);
|
|
44243
44258
|
return validateScheduledTurnMarker(raw, now);
|
|
44244
44259
|
} catch {
|
|
@@ -44283,7 +44298,7 @@ function resolveTurnInitiatorFile(env2 = process.env, home = homedir6()) {
|
|
|
44283
44298
|
}
|
|
44284
44299
|
|
|
44285
44300
|
// src/slack-bot-photo.ts
|
|
44286
|
-
import { existsSync as existsSync7, mkdirSync as mkdirSync7, readFileSync as
|
|
44301
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync7, readFileSync as readFileSync13, writeFileSync as writeFileSync8 } from "fs";
|
|
44287
44302
|
import { dirname as dirname6 } from "path";
|
|
44288
44303
|
async function applyBotPhoto(opts) {
|
|
44289
44304
|
const fetchImpl = opts.fetchImpl ?? fetch;
|
|
@@ -44293,7 +44308,7 @@ async function applyBotPhoto(opts) {
|
|
|
44293
44308
|
const { token, avatarUrl, markerPath } = opts;
|
|
44294
44309
|
if (markerPath && existsSync7(markerPath)) {
|
|
44295
44310
|
try {
|
|
44296
|
-
if (
|
|
44311
|
+
if (readFileSync13(markerPath, "utf-8").trim() === avatarUrl) {
|
|
44297
44312
|
return { status: "skipped-unchanged" };
|
|
44298
44313
|
}
|
|
44299
44314
|
} catch {
|
|
@@ -44418,7 +44433,7 @@ function conversationalLaneMeta(expectsReply = true) {
|
|
|
44418
44433
|
}
|
|
44419
44434
|
|
|
44420
44435
|
// src/inbound-lane-telemetry.ts
|
|
44421
|
-
import { readFileSync as
|
|
44436
|
+
import { readFileSync as readFileSync14, writeFileSync as writeFileSync9 } from "fs";
|
|
44422
44437
|
import { join as join16 } from "path";
|
|
44423
44438
|
var LANE_CLASSIFICATION_COUNTER_SUFFIX = "-lane-classifications.json";
|
|
44424
44439
|
var SUSPECTED_MISCLASSIFICATION_KEY = "suspected_misclassification";
|
|
@@ -44439,7 +44454,7 @@ function recordLaneClassification(agentDir, channel, classification) {
|
|
|
44439
44454
|
const path = join16(agentDir, `${channel}${LANE_CLASSIFICATION_COUNTER_SUFFIX}`);
|
|
44440
44455
|
let counts = {};
|
|
44441
44456
|
try {
|
|
44442
|
-
const parsed = JSON.parse(
|
|
44457
|
+
const parsed = JSON.parse(readFileSync14(path, "utf-8"));
|
|
44443
44458
|
if (parsed && typeof parsed === "object") counts = parsed;
|
|
44444
44459
|
} catch {
|
|
44445
44460
|
}
|
|
@@ -44455,7 +44470,7 @@ function recordLaneClassification(agentDir, channel, classification) {
|
|
|
44455
44470
|
}
|
|
44456
44471
|
|
|
44457
44472
|
// src/slack-inbound-registry.ts
|
|
44458
|
-
import { readdirSync as readdirSync5, readFileSync as
|
|
44473
|
+
import { readdirSync as readdirSync5, readFileSync as readFileSync15 } from "fs";
|
|
44459
44474
|
import { join as join17 } from "path";
|
|
44460
44475
|
var DEFAULT_MAX_ENTRIES = 500;
|
|
44461
44476
|
var DEFAULT_CLEARED_TTL_MS = 6 * 60 * 60 * 1e3;
|
|
@@ -44577,7 +44592,7 @@ function createInboundRegistry(opts = {}) {
|
|
|
44577
44592
|
if (name.includes(".retry-") || name.includes(".poison")) continue;
|
|
44578
44593
|
let marker;
|
|
44579
44594
|
try {
|
|
44580
|
-
marker = JSON.parse(
|
|
44595
|
+
marker = JSON.parse(readFileSync15(join17(dir, name), "utf-8"));
|
|
44581
44596
|
} catch {
|
|
44582
44597
|
continue;
|
|
44583
44598
|
}
|
|
@@ -44622,7 +44637,7 @@ function slackInboundId(channel, threadTs, messageTs) {
|
|
|
44622
44637
|
}
|
|
44623
44638
|
|
|
44624
44639
|
// src/inbound-delivery-ledger.ts
|
|
44625
|
-
import { existsSync as existsSync8, mkdirSync as mkdirSync8, readdirSync as readdirSync6, readFileSync as
|
|
44640
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync8, readdirSync as readdirSync6, readFileSync as readFileSync16, renameSync as renameSync3, writeFileSync as writeFileSync10 } from "fs";
|
|
44626
44641
|
import { join as join18 } from "path";
|
|
44627
44642
|
function safeInboundId(inboundId) {
|
|
44628
44643
|
return inboundId.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
@@ -44632,7 +44647,7 @@ var defaultDeps = {
|
|
|
44632
44647
|
writeFile: (path, data) => writeFileSync10(path, data, "utf8"),
|
|
44633
44648
|
rename: (from, to) => renameSync3(from, to),
|
|
44634
44649
|
readdir: (dir) => readdirSync6(dir),
|
|
44635
|
-
readFile: (path) =>
|
|
44650
|
+
readFile: (path) => readFileSync16(path, "utf8"),
|
|
44636
44651
|
exists: (path) => existsSync8(path)
|
|
44637
44652
|
};
|
|
44638
44653
|
function writeInboundDeliveryLedgerEntry(dir, record2, deps = defaultDeps) {
|
|
@@ -44826,7 +44841,7 @@ function describeSendOutcome(dest) {
|
|
|
44826
44841
|
}
|
|
44827
44842
|
|
|
44828
44843
|
// src/slack-reply-binding-telemetry.ts
|
|
44829
|
-
import { readFileSync as
|
|
44844
|
+
import { readFileSync as readFileSync17, writeFileSync as writeFileSync11 } from "fs";
|
|
44830
44845
|
import { join as join19 } from "path";
|
|
44831
44846
|
var REPLY_BINDING_CLASSIFICATION_COUNTER_SUFFIX = "-reply-binding-classifications.json";
|
|
44832
44847
|
var UNKNOWN_INBOUND_ID_KEY = "unknown_inbound_id";
|
|
@@ -44845,7 +44860,7 @@ function recordReplyBindingClassification(agentDir, channel, input) {
|
|
|
44845
44860
|
const path = join19(agentDir, `${channel}${REPLY_BINDING_CLASSIFICATION_COUNTER_SUFFIX}`);
|
|
44846
44861
|
let counts = {};
|
|
44847
44862
|
try {
|
|
44848
|
-
const parsed = JSON.parse(
|
|
44863
|
+
const parsed = JSON.parse(readFileSync17(path, "utf-8"));
|
|
44849
44864
|
if (parsed && typeof parsed === "object") counts = parsed;
|
|
44850
44865
|
} catch {
|
|
44851
44866
|
}
|
|
@@ -44863,7 +44878,7 @@ function recordScheduledChannelOverride(agentDir, channel, input) {
|
|
|
44863
44878
|
const path = join19(agentDir, `${channel}${REPLY_BINDING_CLASSIFICATION_COUNTER_SUFFIX}`);
|
|
44864
44879
|
let counts = {};
|
|
44865
44880
|
try {
|
|
44866
|
-
const parsed = JSON.parse(
|
|
44881
|
+
const parsed = JSON.parse(readFileSync17(path, "utf-8"));
|
|
44867
44882
|
if (parsed && typeof parsed === "object") counts = parsed;
|
|
44868
44883
|
} catch {
|
|
44869
44884
|
}
|
|
@@ -44879,7 +44894,7 @@ function recordChannelMistarget(agentDir, channel, input) {
|
|
|
44879
44894
|
const path = join19(agentDir, `${channel}${REPLY_BINDING_CLASSIFICATION_COUNTER_SUFFIX}`);
|
|
44880
44895
|
let counts = {};
|
|
44881
44896
|
try {
|
|
44882
|
-
const parsed = JSON.parse(
|
|
44897
|
+
const parsed = JSON.parse(readFileSync17(path, "utf-8"));
|
|
44883
44898
|
if (parsed && typeof parsed === "object") counts = parsed;
|
|
44884
44899
|
} catch {
|
|
44885
44900
|
}
|
|
@@ -44894,7 +44909,7 @@ function recordChannelMistarget(agentDir, channel, input) {
|
|
|
44894
44909
|
}
|
|
44895
44910
|
|
|
44896
44911
|
// src/slack-reply-target-telemetry.ts
|
|
44897
|
-
import { readFileSync as
|
|
44912
|
+
import { readFileSync as readFileSync18, writeFileSync as writeFileSync12 } from "fs";
|
|
44898
44913
|
import { join as join20 } from "path";
|
|
44899
44914
|
var REPLY_TARGET_CLASSIFICATION_COUNTER_SUFFIX = "-reply-target-classifications.json";
|
|
44900
44915
|
function pendingThreadsBucket(n) {
|
|
@@ -44931,7 +44946,7 @@ function recordReplyTargetClassification(agentDir, channel, classification) {
|
|
|
44931
44946
|
const path = join20(agentDir, `${channel}${REPLY_TARGET_CLASSIFICATION_COUNTER_SUFFIX}`);
|
|
44932
44947
|
let counts = {};
|
|
44933
44948
|
try {
|
|
44934
|
-
const parsed = JSON.parse(
|
|
44949
|
+
const parsed = JSON.parse(readFileSync18(path, "utf-8"));
|
|
44935
44950
|
if (parsed && typeof parsed === "object") counts = parsed;
|
|
44936
44951
|
} catch {
|
|
44937
44952
|
}
|
|
@@ -44954,13 +44969,18 @@ function scheduledDestOverridesNamedChannel(opts) {
|
|
|
44954
44969
|
if (!opts.namedChannel) return false;
|
|
44955
44970
|
return opts.scheduledTargetChannel !== opts.namedChannel;
|
|
44956
44971
|
}
|
|
44972
|
+
function explicitThreadForScheduledPriority(threadTs, owedReplies) {
|
|
44973
|
+
if (typeof threadTs !== "string" || !threadTs) return void 0;
|
|
44974
|
+
return owedReplies(threadTs) > 0 ? threadTs : void 0;
|
|
44975
|
+
}
|
|
44957
44976
|
function resolveSlackScheduledPriority(opts) {
|
|
44958
44977
|
const inboundUnresolved = !!opts.inboundId && opts.inboundResolved === false;
|
|
44959
44978
|
const inboundWins = !!(opts.inboundId && !inboundUnresolved || opts.enforceBound);
|
|
44960
44979
|
const effectiveChannel = inboundWins ? opts.bindingChannel ?? opts.fallbackChannel : opts.scheduledDest && !inboundUnresolved ? opts.scheduledDest.channel : opts.fallbackChannel;
|
|
44961
|
-
const
|
|
44980
|
+
const keepExplicitThread = !inboundWins && !inboundUnresolved && !!opts.scheduledDest && !opts.scheduledDest.thread_ts && !!opts.explicitThreadTs && opts.fallbackChannel === opts.scheduledDest.channel;
|
|
44981
|
+
const effectiveThreadTs = opts.forcedRoot ? void 0 : inboundWins ? opts.bindingThreadTs ?? void 0 : keepExplicitThread ? opts.explicitThreadTs ?? void 0 : opts.scheduledDest && !inboundUnresolved ? opts.scheduledDest.thread_ts : opts.fallbackThreadTs ?? void 0;
|
|
44962
44982
|
const settleThreadTs = inboundWins ? opts.bindingThreadTs ?? void 0 : opts.fallbackSettleThreadTs ?? void 0;
|
|
44963
|
-
const scheduledRetarget = !inboundWins && !inboundUnresolved && !!opts.scheduledDest;
|
|
44983
|
+
const scheduledRetarget = !inboundWins && !inboundUnresolved && !!opts.scheduledDest && !keepExplicitThread;
|
|
44964
44984
|
const fellBack = inboundUnresolved || scheduledRetarget;
|
|
44965
44985
|
const reason = inboundUnresolved ? "unresolved_inbound" : scheduledRetarget ? "scheduled" : opts.forcedRoot ? "forced_root" : inboundWins ? "bound" : "fallback";
|
|
44966
44986
|
return { effectiveChannel, effectiveThreadTs, settleThreadTs, reason, fellBack };
|
|
@@ -45879,7 +45899,7 @@ function textMentionsBot(text, botId) {
|
|
|
45879
45899
|
import {
|
|
45880
45900
|
existsSync as existsSync9,
|
|
45881
45901
|
mkdirSync as mkdirSync9,
|
|
45882
|
-
readFileSync as
|
|
45902
|
+
readFileSync as readFileSync19,
|
|
45883
45903
|
renameSync as renameSync4,
|
|
45884
45904
|
statSync as statSync4,
|
|
45885
45905
|
unlinkSync as unlinkSync6,
|
|
@@ -45976,7 +45996,7 @@ function defaultLockMtimeMs(path) {
|
|
|
45976
45996
|
function readLockHolder(path) {
|
|
45977
45997
|
if (!existsSync9(path)) return null;
|
|
45978
45998
|
try {
|
|
45979
|
-
const raw =
|
|
45999
|
+
const raw = readFileSync19(path, "utf8");
|
|
45980
46000
|
const parsed = JSON.parse(raw);
|
|
45981
46001
|
const pid = typeof parsed.pid === "number" ? parsed.pid : Number(parsed.pid);
|
|
45982
46002
|
if (!Number.isFinite(pid) || pid <= 0) return null;
|
|
@@ -46490,7 +46510,7 @@ function readLiveAllowedUsers() {
|
|
|
46490
46510
|
return liveAllowedUsersCache.value;
|
|
46491
46511
|
}
|
|
46492
46512
|
const value = extractAllowedUsersFromMcpJson(
|
|
46493
|
-
|
|
46513
|
+
readFileSync20(SLACK_MCP_CONFIG_PATH, "utf-8")
|
|
46494
46514
|
);
|
|
46495
46515
|
if (value === null) return null;
|
|
46496
46516
|
liveAllowedUsersCache = { mtimeMs, value };
|
|
@@ -46511,7 +46531,7 @@ function readLivePingAllowedUsers() {
|
|
|
46511
46531
|
return livePingAllowedUsersCache.value;
|
|
46512
46532
|
}
|
|
46513
46533
|
const value = extractPingAllowedUsersFromMcpJson(
|
|
46514
|
-
|
|
46534
|
+
readFileSync20(SLACK_MCP_CONFIG_PATH, "utf-8")
|
|
46515
46535
|
);
|
|
46516
46536
|
if (value === null) return null;
|
|
46517
46537
|
livePingAllowedUsersCache = { mtimeMs, value };
|
|
@@ -46603,7 +46623,7 @@ function markSlackMarkerPromisedInPlace(fullPath) {
|
|
|
46603
46623
|
function markSlackMarkerEngagedInPlace(fullPath, opts) {
|
|
46604
46624
|
let marker;
|
|
46605
46625
|
try {
|
|
46606
|
-
marker = JSON.parse(
|
|
46626
|
+
marker = JSON.parse(readFileSync20(fullPath, "utf-8"));
|
|
46607
46627
|
} catch {
|
|
46608
46628
|
return false;
|
|
46609
46629
|
}
|
|
@@ -46618,7 +46638,7 @@ function markSlackMarkerEngagedInPlace(fullPath, opts) {
|
|
|
46618
46638
|
rewriteSlackMarkerInPlace(fullPath, marker);
|
|
46619
46639
|
if (!opts.promise) return false;
|
|
46620
46640
|
try {
|
|
46621
|
-
const readBack = JSON.parse(
|
|
46641
|
+
const readBack = JSON.parse(readFileSync20(fullPath, "utf-8"));
|
|
46622
46642
|
return typeof readBack.promised_at === "string" && readBack.promised_at.length > 0;
|
|
46623
46643
|
} catch {
|
|
46624
46644
|
return false;
|
|
@@ -46629,7 +46649,7 @@ function attachSlackReplayPayload(channel, threadTs, messageTs, payload) {
|
|
|
46629
46649
|
if (!path) return;
|
|
46630
46650
|
let marker;
|
|
46631
46651
|
try {
|
|
46632
|
-
marker = JSON.parse(
|
|
46652
|
+
marker = JSON.parse(readFileSync20(path, "utf-8"));
|
|
46633
46653
|
} catch {
|
|
46634
46654
|
return;
|
|
46635
46655
|
}
|
|
@@ -46640,7 +46660,7 @@ function readSlackPendingInboundMarker(channel, threadTs, messageTs) {
|
|
|
46640
46660
|
const path = slackPendingInboundPath(channel, threadTs, messageTs);
|
|
46641
46661
|
if (!path || !existsSync10(path)) return null;
|
|
46642
46662
|
try {
|
|
46643
|
-
return JSON.parse(
|
|
46663
|
+
return JSON.parse(readFileSync20(path, "utf-8"));
|
|
46644
46664
|
} catch {
|
|
46645
46665
|
return null;
|
|
46646
46666
|
}
|
|
@@ -46690,7 +46710,7 @@ function slackConversationReplayFacts(channel, threadTs) {
|
|
|
46690
46710
|
threadTs,
|
|
46691
46711
|
(fullPath) => {
|
|
46692
46712
|
try {
|
|
46693
|
-
const marker = JSON.parse(
|
|
46713
|
+
const marker = JSON.parse(readFileSync20(fullPath, "utf-8"));
|
|
46694
46714
|
found.push({ hasPayload: Boolean(marker.payload), discretionary: marker.discretionary });
|
|
46695
46715
|
} catch {
|
|
46696
46716
|
found.push({ hasPayload: false });
|
|
@@ -46859,7 +46879,7 @@ function __resetSlackBusyAckNoticeThrottle() {
|
|
|
46859
46879
|
function clearSlackMarkerFileWithHeal(fullPath) {
|
|
46860
46880
|
let marker = null;
|
|
46861
46881
|
try {
|
|
46862
|
-
marker = JSON.parse(
|
|
46882
|
+
marker = JSON.parse(readFileSync20(fullPath, "utf-8"));
|
|
46863
46883
|
} catch {
|
|
46864
46884
|
}
|
|
46865
46885
|
if (marker?.channel) {
|
|
@@ -46891,7 +46911,7 @@ var slackPromiseStampOutcome = { attempted: 0, stamped: 0 };
|
|
|
46891
46911
|
function healThenEngageSlackMarker(fullPath, opts) {
|
|
46892
46912
|
let marker = null;
|
|
46893
46913
|
try {
|
|
46894
|
-
marker = JSON.parse(
|
|
46914
|
+
marker = JSON.parse(readFileSync20(fullPath, "utf-8"));
|
|
46895
46915
|
} catch {
|
|
46896
46916
|
return false;
|
|
46897
46917
|
}
|
|
@@ -46989,7 +47009,7 @@ function readSlackThreadMarkerState(channel, threadTs) {
|
|
|
46989
47009
|
threadTs,
|
|
46990
47010
|
(fullPath) => {
|
|
46991
47011
|
try {
|
|
46992
|
-
const m = JSON.parse(
|
|
47012
|
+
const m = JSON.parse(readFileSync20(fullPath, "utf-8"));
|
|
46993
47013
|
markers.push({ ingress_only: m.ingress_only });
|
|
46994
47014
|
} catch {
|
|
46995
47015
|
markers.push({});
|
|
@@ -47010,7 +47030,7 @@ async function processSlackRecoveryOutboxFile(filename) {
|
|
|
47010
47030
|
const fullPath = join22(SLACK_RECOVERY_OUTBOX_DIR, filename);
|
|
47011
47031
|
let payload;
|
|
47012
47032
|
try {
|
|
47013
|
-
payload = JSON.parse(
|
|
47033
|
+
payload = JSON.parse(readFileSync20(fullPath, "utf-8"));
|
|
47014
47034
|
} catch (err) {
|
|
47015
47035
|
process.stderr.write(
|
|
47016
47036
|
`slack-channel(${AGENT_CODE_NAME}): recovery outbox parse failed (${filename}): ${err.message}
|
|
@@ -47250,7 +47270,7 @@ async function processSlackNoticeOutboxFile(filename) {
|
|
|
47250
47270
|
}
|
|
47251
47271
|
let payload;
|
|
47252
47272
|
try {
|
|
47253
|
-
const parsed = JSON.parse(
|
|
47273
|
+
const parsed = JSON.parse(readFileSync20(fullPath, "utf-8"));
|
|
47254
47274
|
if (!parsed || typeof parsed !== "object") throw new Error("not an object");
|
|
47255
47275
|
payload = parsed;
|
|
47256
47276
|
} catch {
|
|
@@ -47409,7 +47429,7 @@ function sweepSlackStaleMarkers(thresholdMs) {
|
|
|
47409
47429
|
const fullPath = join22(SLACK_PENDING_INBOUND_DIR, filename);
|
|
47410
47430
|
let marker;
|
|
47411
47431
|
try {
|
|
47412
|
-
marker = JSON.parse(
|
|
47432
|
+
marker = JSON.parse(readFileSync20(fullPath, "utf-8"));
|
|
47413
47433
|
} catch (err) {
|
|
47414
47434
|
process.stderr.write(
|
|
47415
47435
|
`slack-channel(${AGENT_CODE_NAME}): stale-marker parse failed for ${redactSlackId(filename)}: ${err.message}
|
|
@@ -47489,7 +47509,7 @@ var slackProgressTickRunning = false;
|
|
|
47489
47509
|
function readSlackProgressHeartbeat() {
|
|
47490
47510
|
if (!SLACK_PROGRESS_HEARTBEAT_PATH || !existsSync10(SLACK_PROGRESS_HEARTBEAT_PATH)) return null;
|
|
47491
47511
|
try {
|
|
47492
|
-
return parseProgressHeartbeat(
|
|
47512
|
+
return parseProgressHeartbeat(readFileSync20(SLACK_PROGRESS_HEARTBEAT_PATH, "utf-8"));
|
|
47493
47513
|
} catch {
|
|
47494
47514
|
return null;
|
|
47495
47515
|
}
|
|
@@ -47516,7 +47536,7 @@ function findSlackProgressTarget() {
|
|
|
47516
47536
|
if (!name.endsWith(".json")) continue;
|
|
47517
47537
|
let m;
|
|
47518
47538
|
try {
|
|
47519
|
-
m = JSON.parse(
|
|
47539
|
+
m = JSON.parse(readFileSync20(join22(SLACK_PENDING_INBOUND_DIR, name), "utf-8"));
|
|
47520
47540
|
} catch {
|
|
47521
47541
|
continue;
|
|
47522
47542
|
}
|
|
@@ -47667,7 +47687,7 @@ function listPendingSlackConversations() {
|
|
|
47667
47687
|
if (!name.endsWith(".json")) continue;
|
|
47668
47688
|
try {
|
|
47669
47689
|
const marker = JSON.parse(
|
|
47670
|
-
|
|
47690
|
+
readFileSync20(join22(SLACK_PENDING_INBOUND_DIR, name), "utf8")
|
|
47671
47691
|
);
|
|
47672
47692
|
if (typeof marker.channel !== "string" || !marker.channel) continue;
|
|
47673
47693
|
if (typeof marker.thread_ts !== "string" || !marker.thread_ts) continue;
|
|
@@ -47838,7 +47858,7 @@ function readRestartTopicForMarker(filename, channel, threadTs) {
|
|
|
47838
47858
|
if (!SLACK_RESTART_CONTEXT_DIR) return null;
|
|
47839
47859
|
let raw;
|
|
47840
47860
|
try {
|
|
47841
|
-
raw =
|
|
47861
|
+
raw = readFileSync20(join22(SLACK_RESTART_CONTEXT_DIR, filename), "utf-8");
|
|
47842
47862
|
} catch {
|
|
47843
47863
|
return null;
|
|
47844
47864
|
}
|
|
@@ -47892,7 +47912,7 @@ async function notifyStrandedInboundsOnFirstConnect() {
|
|
|
47892
47912
|
const fullPath = join22(SLACK_PENDING_INBOUND_DIR, filename);
|
|
47893
47913
|
let marker;
|
|
47894
47914
|
try {
|
|
47895
|
-
marker = JSON.parse(
|
|
47915
|
+
marker = JSON.parse(readFileSync20(fullPath, "utf-8"));
|
|
47896
47916
|
} catch {
|
|
47897
47917
|
continue;
|
|
47898
47918
|
}
|
|
@@ -49514,12 +49534,6 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
49514
49534
|
};
|
|
49515
49535
|
}
|
|
49516
49536
|
}
|
|
49517
|
-
if (scheduledDest?.retargeted) {
|
|
49518
|
-
process.stderr.write(
|
|
49519
|
-
`slack-channel(${AGENT_CODE_NAME}): scheduled_turn_retargeted task=${scheduledMarker?.task_id ?? "?"} requested=${redactSlackId(channel)}/${redactSlackId(thread_ts)} routed=${redactSlackId(scheduledDest.channel)}/${redactSlackId(scheduledDest.thread_ts)}
|
|
49520
|
-
`
|
|
49521
|
-
);
|
|
49522
|
-
}
|
|
49523
49537
|
const effectiveMessageTs = channelGuard.corrected ? channelGuard.messageTs : message_ts;
|
|
49524
49538
|
if (bindingMode === "enforce" && binding.reject && !channelGuard.corrected && !scheduledDest) {
|
|
49525
49539
|
process.stderr.write(
|
|
@@ -49600,12 +49614,26 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
49600
49614
|
forcedRoot,
|
|
49601
49615
|
enforceBound,
|
|
49602
49616
|
scheduledDest: scheduledDest ?? null,
|
|
49617
|
+
// ENG-11715: the caller's own thread_ts, ONLY when a human in that thread
|
|
49618
|
+
// is still owed a reply (a non-discretionary pending-inbound marker). That
|
|
49619
|
+
// distinguishes a reply to a person from a scheduled task's output reusing
|
|
49620
|
+
// a stale thread (ENG-7712). Read before the send settles markers.
|
|
49621
|
+
explicitThreadTs: explicitThreadForScheduledPriority(
|
|
49622
|
+
thread_ts,
|
|
49623
|
+
(ts) => countOwedSlackRepliesForThread(SLACK_PENDING_INBOUND_DIR, resolvedFallbackChannel, ts)
|
|
49624
|
+
),
|
|
49603
49625
|
bindingChannel: binding.channel,
|
|
49604
49626
|
bindingThreadTs: binding.threadTs,
|
|
49605
49627
|
fallbackChannel: resolvedFallbackChannel,
|
|
49606
49628
|
fallbackThreadTs: channelGuard.corrected ? channelGuard.threadTs : hotThreadMode === "enforce" && hotGuard ? hotGuard.threadTs : baseThreadTs,
|
|
49607
49629
|
fallbackSettleThreadTs: channelGuard.corrected ? channelGuard.threadTs : thread_ts
|
|
49608
49630
|
});
|
|
49631
|
+
if (scheduledDest?.retargeted && routingReason === "scheduled") {
|
|
49632
|
+
process.stderr.write(
|
|
49633
|
+
`slack-channel(${AGENT_CODE_NAME}): scheduled_turn_retargeted task=${scheduledMarker?.task_id ?? "?"} requested=${redactSlackId(channel)}/${redactSlackId(thread_ts)} routed=${redactSlackId(effectiveChannel)}/${redactSlackId(effectiveThreadTs)}
|
|
49634
|
+
`
|
|
49635
|
+
);
|
|
49636
|
+
}
|
|
49609
49637
|
if (isResolvedTargetIngressOnly({
|
|
49610
49638
|
channel: effectiveChannel,
|
|
49611
49639
|
threadTs: effectiveThreadTs,
|
|
@@ -49991,7 +50019,7 @@ ${result.formatted}` : "No messages in range, or the bot is not a member of this
|
|
|
49991
50019
|
};
|
|
49992
50020
|
}
|
|
49993
50021
|
size = stat2.size;
|
|
49994
|
-
bytes =
|
|
50022
|
+
bytes = readFileSync20(resolvedPath);
|
|
49995
50023
|
} catch (err) {
|
|
49996
50024
|
return {
|
|
49997
50025
|
content: [{ type: "text", text: `Failed to read file: ${err.message}` }],
|
|
@@ -50801,7 +50829,7 @@ async function replayPendingSlackMarkers() {
|
|
|
50801
50829
|
const fullPath = join22(SLACK_PENDING_INBOUND_DIR, name);
|
|
50802
50830
|
let marker;
|
|
50803
50831
|
try {
|
|
50804
|
-
marker = JSON.parse(
|
|
50832
|
+
marker = JSON.parse(readFileSync20(fullPath, "utf-8"));
|
|
50805
50833
|
} catch {
|
|
50806
50834
|
continue;
|
|
50807
50835
|
}
|
|
@@ -31214,6 +31214,7 @@ var MAINTENANCE_GATED_TOOLS = /* @__PURE__ */ new Set([
|
|
|
31214
31214
|
"skill_create",
|
|
31215
31215
|
"skill_delete",
|
|
31216
31216
|
"skill_improve",
|
|
31217
|
+
"skill_install",
|
|
31217
31218
|
"skill_propose_revision",
|
|
31218
31219
|
"skill_publish_to_marketplace",
|
|
31219
31220
|
"skill_update",
|
package/package.json
CHANGED
|
File without changes
|