Merge remote-tracking branch 'origin/main' into codex/whe-31-adapters

# Conflicts:
#	tsconfig.json
This commit is contained in:
2026-03-08 22:17:26 +04:00
25 changed files with 763 additions and 23 deletions

View File

@@ -50,4 +50,13 @@ describe('extractPurchaseTopicCandidate', () => {
expect(record).toBeNull()
})
test('skips slash commands in purchase topic', () => {
const record = extractPurchaseTopicCandidate(
candidate({ rawText: '/statement 2026-03' }),
config
)
expect(record).toBeNull()
})
})

View File

@@ -36,6 +36,10 @@ export function extractPurchaseTopicCandidate(
value: PurchaseTopicCandidate,
config: PurchaseTopicIngestionConfig
): PurchaseTopicRecord | null {
if (value.rawText.trim().startsWith('/')) {
return null
}
if (value.chatId !== config.householdChatId) {
return null
}
@@ -195,14 +199,16 @@ export function registerPurchaseTopicIngestion(
llmFallback?: PurchaseParserLlmFallback
} = {}
): void {
bot.on('message:text', async (ctx) => {
bot.on('message:text', async (ctx, next) => {
const candidate = toCandidateFromContext(ctx)
if (!candidate) {
await next()
return
}
const record = extractPurchaseTopicCandidate(candidate, config)
if (!record) {
await next()
return
}