Slack: remove ids from prompts + thread-safe tool suppression
This commit is contained in:
parent
f55bf604e4
commit
246216b1f8
@ -16,7 +16,7 @@ Use `slack` to react, manage pins, send/edit/delete messages, and fetch member i
|
|||||||
- For reactions, an `emoji` (Unicode or `:name:`).
|
- For reactions, an `emoji` (Unicode or `:name:`).
|
||||||
- For message sends, a `to` target (`channel:<id>` or `user:<id>`) and `content`.
|
- For message sends, a `to` target (`channel:<id>` or `user:<id>`) and `content`.
|
||||||
|
|
||||||
Message context lines include `slack message id` and `channel` fields you can reuse directly.
|
Message text no longer includes `slack message id`. Use metadata fields like `MessageSid` or `ReplyToId`.
|
||||||
|
|
||||||
## Actions
|
## Actions
|
||||||
|
|
||||||
|
|||||||
@ -241,6 +241,7 @@ export function createFollowupRunner(params: {
|
|||||||
messageProvider: queued.run.messageProvider,
|
messageProvider: queued.run.messageProvider,
|
||||||
messagingToolSentTargets: runResult.messagingToolSentTargets,
|
messagingToolSentTargets: runResult.messagingToolSentTargets,
|
||||||
originatingTo: queued.originatingTo,
|
originatingTo: queued.originatingTo,
|
||||||
|
originatingThreadId: queued.originatingThreadId,
|
||||||
accountId: queued.run.agentAccountId,
|
accountId: queued.run.agentAccountId,
|
||||||
});
|
});
|
||||||
const finalPayloads = suppressMessagingToolReplies ? [] : dedupedPayloads;
|
const finalPayloads = suppressMessagingToolReplies ? [] : dedupedPayloads;
|
||||||
|
|||||||
@ -398,7 +398,6 @@ export async function prepareSlackMessage(params: {
|
|||||||
GroupSubject: isRoomish ? roomLabel : undefined,
|
GroupSubject: isRoomish ? roomLabel : undefined,
|
||||||
From: slackFrom,
|
From: slackFrom,
|
||||||
}) ?? (isDirectMessage ? senderName : roomLabel);
|
}) ?? (isDirectMessage ? senderName : roomLabel);
|
||||||
const textWithId = `${rawBody}\n[slack message id: ${message.ts} channel: ${message.channel}]`;
|
|
||||||
const storePath = resolveStorePath(ctx.cfg.session?.store, {
|
const storePath = resolveStorePath(ctx.cfg.session?.store, {
|
||||||
agentId: route.agentId,
|
agentId: route.agentId,
|
||||||
});
|
});
|
||||||
@ -411,7 +410,7 @@ export async function prepareSlackMessage(params: {
|
|||||||
channel: "Slack",
|
channel: "Slack",
|
||||||
from: envelopeFrom,
|
from: envelopeFrom,
|
||||||
timestamp: message.ts ? Math.round(Number(message.ts) * 1000) : undefined,
|
timestamp: message.ts ? Math.round(Number(message.ts) * 1000) : undefined,
|
||||||
body: textWithId,
|
body: rawBody,
|
||||||
chatType: isDirectMessage ? "direct" : "channel",
|
chatType: isDirectMessage ? "direct" : "channel",
|
||||||
sender: { name: senderName, id: senderId },
|
sender: { name: senderName, id: senderId },
|
||||||
previousTimestamp,
|
previousTimestamp,
|
||||||
@ -430,9 +429,7 @@ export async function prepareSlackMessage(params: {
|
|||||||
channel: "Slack",
|
channel: "Slack",
|
||||||
from: roomLabel,
|
from: roomLabel,
|
||||||
timestamp: entry.timestamp,
|
timestamp: entry.timestamp,
|
||||||
body: `${entry.body}${
|
body: entry.body,
|
||||||
entry.messageId ? ` [id:${entry.messageId} channel:${message.channel}]` : ""
|
|
||||||
}`,
|
|
||||||
chatType: "channel",
|
chatType: "channel",
|
||||||
senderLabel: entry.sender,
|
senderLabel: entry.sender,
|
||||||
envelope: envelopeOptions,
|
envelope: envelopeOptions,
|
||||||
@ -466,12 +463,11 @@ export async function prepareSlackMessage(params: {
|
|||||||
if (starter?.text) {
|
if (starter?.text) {
|
||||||
const starterUser = starter.userId ? await ctx.resolveUserName(starter.userId) : null;
|
const starterUser = starter.userId ? await ctx.resolveUserName(starter.userId) : null;
|
||||||
const starterName = starterUser?.name ?? starter.userId ?? "Unknown";
|
const starterName = starterUser?.name ?? starter.userId ?? "Unknown";
|
||||||
const starterWithId = `${starter.text}\n[slack message id: ${starter.ts ?? threadTs} channel: ${message.channel}]`;
|
|
||||||
threadStarterBody = formatThreadStarterEnvelope({
|
threadStarterBody = formatThreadStarterEnvelope({
|
||||||
channel: "Slack",
|
channel: "Slack",
|
||||||
author: starterName,
|
author: starterName,
|
||||||
timestamp: starter.ts ? Math.round(Number(starter.ts) * 1000) : undefined,
|
timestamp: starter.ts ? Math.round(Number(starter.ts) * 1000) : undefined,
|
||||||
body: starterWithId,
|
body: starter.text,
|
||||||
envelope: envelopeOptions,
|
envelope: envelopeOptions,
|
||||||
});
|
});
|
||||||
const snippet = starter.text.replace(/\s+/g, " ").slice(0, 80);
|
const snippet = starter.text.replace(/\s+/g, " ").slice(0, 80);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user