@integrity-labs/agt-cli 0.28.302 → 0.28.304
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-D5BJLFH7.js → chunk-OA5EO3U4.js} +2 -2
- package/dist/lib/manager-worker.js +38 -5
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/mcp/slack-channel.js +111 -0
- package/package.json +1 -1
- /package/dist/{chunk-D5BJLFH7.js.map → chunk-OA5EO3U4.js.map} +0 -0
|
@@ -15585,6 +15585,57 @@ async function fetchThreadTranscript(channel, threadTs, limit, deps) {
|
|
|
15585
15585
|
return { ok: true, count: allMessages.length, formatted: formatThreadMessages(allMessages, nameById) };
|
|
15586
15586
|
}
|
|
15587
15587
|
|
|
15588
|
+
// src/slack-channel-history.ts
|
|
15589
|
+
var SLACK_HISTORY_DEFAULT_LIMIT = 50;
|
|
15590
|
+
var SLACK_HISTORY_MAX_LIMIT = 200;
|
|
15591
|
+
async function fetchChannelHistory(channel, limit, deps, options = {}) {
|
|
15592
|
+
const { botToken, resolveUserName: resolveUserName2, fetchImpl = fetch } = deps;
|
|
15593
|
+
const cappedLimit = Math.min(Math.max(limit, 1), SLACK_HISTORY_MAX_LIMIT);
|
|
15594
|
+
const allMessages = [];
|
|
15595
|
+
let cursor;
|
|
15596
|
+
do {
|
|
15597
|
+
const remaining = cappedLimit - allMessages.length;
|
|
15598
|
+
if (remaining <= 0) break;
|
|
15599
|
+
const params = new URLSearchParams({
|
|
15600
|
+
channel,
|
|
15601
|
+
limit: String(Math.min(remaining, 100)),
|
|
15602
|
+
...options.oldest ? { oldest: options.oldest } : {},
|
|
15603
|
+
...options.latest ? { latest: options.latest } : {},
|
|
15604
|
+
...cursor ? { cursor } : {}
|
|
15605
|
+
});
|
|
15606
|
+
let data;
|
|
15607
|
+
try {
|
|
15608
|
+
const res = await fetchImpl(`https://slack.com/api/conversations.history?${params}`, {
|
|
15609
|
+
headers: { Authorization: `Bearer ${botToken}` }
|
|
15610
|
+
});
|
|
15611
|
+
if (!res.ok) return { ok: false, error: `http_${res.status}` };
|
|
15612
|
+
data = await res.json();
|
|
15613
|
+
} catch (err) {
|
|
15614
|
+
return { ok: false, error: err instanceof Error ? err.message : "fetch_failed" };
|
|
15615
|
+
}
|
|
15616
|
+
if (!data.ok) return { ok: false, error: data.error ?? "unknown" };
|
|
15617
|
+
for (const msg of data.messages ?? []) {
|
|
15618
|
+
allMessages.push({
|
|
15619
|
+
user: msg.user ?? msg.bot_id ?? "unknown",
|
|
15620
|
+
text: msg.text ?? "",
|
|
15621
|
+
ts: msg.ts ?? ""
|
|
15622
|
+
});
|
|
15623
|
+
}
|
|
15624
|
+
cursor = data.response_metadata?.next_cursor || void 0;
|
|
15625
|
+
} while (cursor && allMessages.length < cappedLimit);
|
|
15626
|
+
allMessages.sort((a, b) => Number(a.ts) - Number(b.ts));
|
|
15627
|
+
const uniqueUserIds = [...new Set(allMessages.map((m) => m.user))];
|
|
15628
|
+
const resolved = await Promise.all(
|
|
15629
|
+
uniqueUserIds.map(async (id) => [id, await resolveUserName2(id)])
|
|
15630
|
+
);
|
|
15631
|
+
const nameById = new Map(resolved);
|
|
15632
|
+
return {
|
|
15633
|
+
ok: true,
|
|
15634
|
+
count: allMessages.length,
|
|
15635
|
+
formatted: formatThreadMessages(allMessages, nameById)
|
|
15636
|
+
};
|
|
15637
|
+
}
|
|
15638
|
+
|
|
15588
15639
|
// src/impersonation.ts
|
|
15589
15640
|
var ENV_VAR = "AGT_ACT_AS_AGENT_ID";
|
|
15590
15641
|
var OVERRIDE_ENV_VAR = "ENABLE_IMPERSONATION_CHANNELS";
|
|
@@ -20523,6 +20574,32 @@ mcp.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
|
20523
20574
|
required: ["channel", "thread_ts"]
|
|
20524
20575
|
}
|
|
20525
20576
|
},
|
|
20577
|
+
{
|
|
20578
|
+
name: "slack.read_history",
|
|
20579
|
+
description: `Read recent top-level messages in a Slack channel the bot is a member of (via conversations.history). Use this to catch up on what was said in a channel \u2014 e.g. an auto-followed channel you have not been @-mentioned in, or to gather context before posting. This reads CHANNEL history; for one thread's replies use slack.read_thread instead. Optional oldest/latest bound the time window (Slack ts values). Returns messages oldest\u2192newest. The bot only sees channels it has been invited to \u2014 a "not_in_channel" error means someone must /invite the bot first.`,
|
|
20580
|
+
inputSchema: {
|
|
20581
|
+
type: "object",
|
|
20582
|
+
properties: {
|
|
20583
|
+
channel: {
|
|
20584
|
+
type: "string",
|
|
20585
|
+
description: "Slack channel ID to read history from (the bot must be a member of it)"
|
|
20586
|
+
},
|
|
20587
|
+
limit: {
|
|
20588
|
+
type: "number",
|
|
20589
|
+
description: "Max messages to return (default 50, max 200)"
|
|
20590
|
+
},
|
|
20591
|
+
oldest: {
|
|
20592
|
+
type: "string",
|
|
20593
|
+
description: 'Optional lower time bound \u2014 only messages AFTER this Slack ts (exclusive), e.g. "1783900000.000000".'
|
|
20594
|
+
},
|
|
20595
|
+
latest: {
|
|
20596
|
+
type: "string",
|
|
20597
|
+
description: "Optional upper time bound \u2014 only messages up to and including this Slack ts."
|
|
20598
|
+
}
|
|
20599
|
+
},
|
|
20600
|
+
required: ["channel"]
|
|
20601
|
+
}
|
|
20602
|
+
},
|
|
20526
20603
|
{
|
|
20527
20604
|
name: "slack.download_attachment",
|
|
20528
20605
|
description: "Download an inbound Slack attachment on demand. Use this for non-image files (PDFs, docx, csv, etc.) that arrived via a <channel> tag \u2014 look for `file_id` in the `files` meta. Requires the `channel` attribute from the same <channel> tag so the tool can verify the attachment was shared in the current conversation. Returns the local path where the file was written (inside ~/.augmented/<codeName>/slack-inbound/). Images are auto-downloaded on receipt and don't need this tool.",
|
|
@@ -21026,6 +21103,40 @@ ${result.formatted}` : "Thread is empty or not found."
|
|
|
21026
21103
|
};
|
|
21027
21104
|
}
|
|
21028
21105
|
}
|
|
21106
|
+
if (name === "slack.read_history") {
|
|
21107
|
+
const { channel, limit: rawLimit, oldest, latest } = args;
|
|
21108
|
+
const limit = Math.min(
|
|
21109
|
+
Math.max(rawLimit ?? SLACK_HISTORY_DEFAULT_LIMIT, 1),
|
|
21110
|
+
SLACK_HISTORY_MAX_LIMIT
|
|
21111
|
+
);
|
|
21112
|
+
try {
|
|
21113
|
+
const result = await fetchChannelHistory(
|
|
21114
|
+
channel,
|
|
21115
|
+
limit,
|
|
21116
|
+
{ botToken: BOT_TOKEN, resolveUserName },
|
|
21117
|
+
{ oldest, latest }
|
|
21118
|
+
);
|
|
21119
|
+
if (!result.ok) {
|
|
21120
|
+
return {
|
|
21121
|
+
content: [{ type: "text", text: `Slack error: ${result.error}` }],
|
|
21122
|
+
isError: true
|
|
21123
|
+
};
|
|
21124
|
+
}
|
|
21125
|
+
return {
|
|
21126
|
+
content: [{
|
|
21127
|
+
type: "text",
|
|
21128
|
+
text: result.count > 0 ? `Channel history (${result.count} messages, oldest\u2192newest):
|
|
21129
|
+
|
|
21130
|
+
${result.formatted}` : "No messages in range, or the bot is not a member of this channel."
|
|
21131
|
+
}]
|
|
21132
|
+
};
|
|
21133
|
+
} catch (err) {
|
|
21134
|
+
return {
|
|
21135
|
+
content: [{ type: "text", text: `Failed: ${err.message}` }],
|
|
21136
|
+
isError: true
|
|
21137
|
+
};
|
|
21138
|
+
}
|
|
21139
|
+
}
|
|
21029
21140
|
if (name === "slack.upload_file") {
|
|
21030
21141
|
const {
|
|
21031
21142
|
path,
|
package/package.json
CHANGED
|
File without changes
|