@integrity-labs/agt-cli 0.12.1 → 0.12.3
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 +2 -2
- package/dist/lib/manager-worker.js +28 -1
- package/dist/lib/manager-worker.js.map +1 -1
- package/mcp/slack-channel.js +28 -2
- package/package.json +1 -1
package/mcp/slack-channel.js
CHANGED
|
@@ -13922,7 +13922,9 @@ var mcp = new Server(
|
|
|
13922
13922
|
tools: {}
|
|
13923
13923
|
},
|
|
13924
13924
|
instructions: [
|
|
13925
|
-
'Messages from Slack arrive as <channel source="slack" user="
|
|
13925
|
+
'Messages from Slack arrive as <channel source="slack" user="<slack-id>" user_name="<display-name>" channel="..." thread_ts="...">.',
|
|
13926
|
+
"Address users by their user_name (display name), NEVER by the raw user ID.",
|
|
13927
|
+
"In threads with multiple participants, the CURRENT speaker is always the one in the <channel> tag on the latest message \u2014 do not conflate them with other participants who spoke earlier.",
|
|
13926
13928
|
"Reply using the slack.reply tool, passing channel and thread_ts from the tag.",
|
|
13927
13929
|
"For threaded replies, always include thread_ts so the response appears in the same thread.",
|
|
13928
13930
|
"When someone @mentions you in a channel, respond helpfully in that thread.",
|
|
@@ -14129,7 +14131,10 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
14129
14131
|
}
|
|
14130
14132
|
cursor = data.response_metadata?.next_cursor || void 0;
|
|
14131
14133
|
} while (cursor && allMessages.length < limit);
|
|
14132
|
-
const
|
|
14134
|
+
const uniqueUserIds = [...new Set(allMessages.map((m) => m.user))];
|
|
14135
|
+
const resolved = await Promise.all(uniqueUserIds.map(async (id) => [id, await resolveUserName(id)]));
|
|
14136
|
+
const nameById = new Map(resolved);
|
|
14137
|
+
const formatted = allMessages.map((m) => `[${m.ts}] ${nameById.get(m.user) ?? m.user} (<@${m.user}>): ${m.text}`).join("\n");
|
|
14133
14138
|
return {
|
|
14134
14139
|
content: [{
|
|
14135
14140
|
type: "text",
|
|
@@ -14269,6 +14274,25 @@ async function getBotUserId() {
|
|
|
14269
14274
|
return null;
|
|
14270
14275
|
}
|
|
14271
14276
|
}
|
|
14277
|
+
var userNameCache = /* @__PURE__ */ new Map();
|
|
14278
|
+
async function resolveUserName(userId) {
|
|
14279
|
+
if (!userId || userId === "unknown") return userId ?? "unknown";
|
|
14280
|
+
const cached2 = userNameCache.get(userId);
|
|
14281
|
+
if (cached2 !== void 0) return cached2;
|
|
14282
|
+
try {
|
|
14283
|
+
const res = await fetch(
|
|
14284
|
+
`https://slack.com/api/users.info?user=${encodeURIComponent(userId)}`,
|
|
14285
|
+
{ headers: { Authorization: `Bearer ${BOT_TOKEN}` } }
|
|
14286
|
+
);
|
|
14287
|
+
const data = await res.json();
|
|
14288
|
+
const name = data.user?.profile?.display_name || data.user?.profile?.real_name || userId;
|
|
14289
|
+
userNameCache.set(userId, name);
|
|
14290
|
+
return name;
|
|
14291
|
+
} catch {
|
|
14292
|
+
userNameCache.set(userId, userId);
|
|
14293
|
+
return userId;
|
|
14294
|
+
}
|
|
14295
|
+
}
|
|
14272
14296
|
var currentWs = null;
|
|
14273
14297
|
var isShuttingDown = false;
|
|
14274
14298
|
async function connectSocketMode() {
|
|
@@ -14341,12 +14365,14 @@ async function connectSocketMode() {
|
|
|
14341
14365
|
if (channel && ts) {
|
|
14342
14366
|
trackPendingMessage(channel, threadTs, ts);
|
|
14343
14367
|
}
|
|
14368
|
+
const userName = await resolveUserName(user);
|
|
14344
14369
|
await mcp.notification({
|
|
14345
14370
|
method: "notifications/claude/channel",
|
|
14346
14371
|
params: {
|
|
14347
14372
|
content: text,
|
|
14348
14373
|
meta: {
|
|
14349
14374
|
user,
|
|
14375
|
+
user_name: userName,
|
|
14350
14376
|
channel,
|
|
14351
14377
|
thread_ts: threadTs,
|
|
14352
14378
|
event_type: evt.type,
|