mirror of
https://github.com/anthropics/claude-plugins-official.git
synced 2026-04-24 10:32:45 +00:00
Compare commits
1 Commits
add-alloyd
...
daisy/plug
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d01e0fbab2 |
@@ -222,6 +222,8 @@ type GateResult =
|
|||||||
const recentSentIds = new Set<string>()
|
const recentSentIds = new Set<string>()
|
||||||
const RECENT_SENT_CAP = 200
|
const RECENT_SENT_CAP = 200
|
||||||
|
|
||||||
|
const dmChannelUsers = new Map<string, string>()
|
||||||
|
|
||||||
function noteSent(id: string): void {
|
function noteSent(id: string): void {
|
||||||
recentSentIds.add(id)
|
recentSentIds.add(id)
|
||||||
if (recentSentIds.size > RECENT_SENT_CAP) {
|
if (recentSentIds.size > RECENT_SENT_CAP) {
|
||||||
@@ -404,7 +406,8 @@ async function fetchAllowedChannel(id: string) {
|
|||||||
const ch = await fetchTextChannel(id)
|
const ch = await fetchTextChannel(id)
|
||||||
const access = loadAccess()
|
const access = loadAccess()
|
||||||
if (ch.type === ChannelType.DM) {
|
if (ch.type === ChannelType.DM) {
|
||||||
if (access.allowFrom.includes(ch.recipientId)) return ch
|
const userId = ch.recipientId ?? dmChannelUsers.get(id)
|
||||||
|
if (userId && access.allowFrom.includes(userId)) return ch
|
||||||
} else {
|
} else {
|
||||||
const key = ch.isThread() ? ch.parentId ?? ch.id : ch.id
|
const key = ch.isThread() ? ch.parentId ?? ch.id : ch.id
|
||||||
if (key in access.groups) return ch
|
if (key in access.groups) return ch
|
||||||
@@ -823,6 +826,10 @@ async function handleInbound(msg: Message): Promise<void> {
|
|||||||
|
|
||||||
const chat_id = msg.channelId
|
const chat_id = msg.channelId
|
||||||
|
|
||||||
|
if (msg.channel.type === ChannelType.DM) {
|
||||||
|
dmChannelUsers.set(chat_id, msg.author.id)
|
||||||
|
}
|
||||||
|
|
||||||
// Permission-reply intercept: if this looks like "yes xxxxx" for a
|
// Permission-reply intercept: if this looks like "yes xxxxx" for a
|
||||||
// pending permission request, emit the structured event instead of
|
// pending permission request, emit the structured event instead of
|
||||||
// relaying as chat. The sender is already gate()-approved at this point
|
// relaying as chat. The sender is already gate()-approved at this point
|
||||||
|
|||||||
Reference in New Issue
Block a user