greptile fixes

This commit is contained in:
dal 2025-07-09 08:53:14 -06:00
parent fa53ae1111
commit 0c2e3e2e95
No known key found for this signature in database
GPG Key ID: 16F4B0E1E9F61122
4 changed files with 20 additions and 3 deletions

View File

@ -22,6 +22,7 @@
"@buster/server-shared": "workspace:*",
"@buster/ai": "workspace:*",
"@buster/database": "workspace:*",
"@buster/slack": "workspace:*",
"@buster/test-utils": "workspace:*",
"@buster/typescript-config": "workspace:*",
"@buster/vitest-config": "workspace:*",

View File

@ -9,6 +9,7 @@ import {
slackIntegrations,
slackMessageTracking,
} from '@buster/database';
import { SlackMessageType } from '@buster/slack';
import { logger } from '@trigger.dev/sdk/v3';
export interface SlackNotificationParams {
@ -369,7 +370,10 @@ function formatSlackReplyMessage(params: SlackReplyNotificationParams): SlackMes
};
}
throw new Error('Invalid reply notification parameters');
throw new Error(
'Invalid reply notification parameters: Missing required fields. ' +
'Requires either formattedMessage, summaryTitle with summaryMessage, or toolCalled="flagChat" with message'
);
}
/**
@ -449,7 +453,9 @@ function formatSlackMessage(params: SlackNotificationParams): SlackMessage {
}
// This shouldn't happen if shouldSendSlackNotification is working correctly
throw new Error('Invalid notification parameters');
throw new Error(
`Invalid notification parameters: Missing required fields. Requires either formattedMessage, summaryTitle with summaryMessage, or toolCalled="flagChat" with message. Received: formattedMessage=${!!params.formattedMessage}, summaryTitle=${!!params.summaryTitle}, summaryMessage=${!!params.summaryMessage}, toolCalled="${params.toolCalled}", message=${!!params.message}`
);
}
/**
@ -528,7 +534,7 @@ export async function trackSlackNotification(params: {
slackChannelId: params.channelId,
slackMessageTs: params.messageTs,
slackThreadTs: params.threadTs || null,
messageType: params.threadTs ? 'reply' : 'message',
messageType: params.threadTs ? SlackMessageType.REPLY : SlackMessageType.MESSAGE,
content: params.slackBlocks
? JSON.stringify({ blocks: params.slackBlocks })
: params.summaryTitle && params.summaryMessage

View File

@ -99,3 +99,10 @@ export const SendMessageResultSchema = z.object({
});
export type SendMessageResult = z.infer<typeof SendMessageResultSchema>;
// Message Type enum for tracking
export enum SlackMessageType {
MESSAGE = 'message',
REPLY = 'reply',
UPDATE = 'update',
}

View File

@ -163,6 +163,9 @@ importers:
'@buster/server-shared':
specifier: workspace:*
version: link:../../packages/server-shared
'@buster/slack':
specifier: workspace:*
version: link:../../packages/slack
'@buster/test-utils':
specifier: workspace:*
version: link:../../packages/test-utils