Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions apis/sources/telegram.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export async function getChat(chatId) {
// Compact a Bot API message for briefing output
function compactBotMessage(msg) {
return {
text: (msg.text || msg.caption || '').slice(0, 300),
text: msg.text || msg.caption || '',
date: msg.date ? new Date(msg.date * 1000).toISOString() : null,
chat: msg.chat?.title || msg.chat?.username || 'unknown',
views: msg.views || 0,
Expand Down Expand Up @@ -171,8 +171,7 @@ function parseWebPreview(html, channelId) {
.replace(/"/g, '"')
.replace(/'/g, "'")
.replace(/ /g, ' ')
.trim()
.slice(0, 300);
.trim();
}

// Extract view count
Expand Down
9 changes: 6 additions & 3 deletions lib/alerts/telegram.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ export class TelegramAlerter {
headline: `OSINT Surge: ${osintNew.length} New Urgent Posts`,
reason: `${osintNew.length} new urgent OSINT signals detected. Elevated conflict reporting tempo.`,
actionable: 'Review OSINT stream for pattern. Cross-check with satellite and ACLED data.',
signals: osintNew.map(s => (s.text || '').substring(0, 40)).slice(0, 3),
signals: osintNew.map(s => s.text || s.label || s.key).slice(0, 5),
crossCorrelation: 'telegram OSINT',
};
}
Expand Down Expand Up @@ -681,7 +681,7 @@ Respond with ONLY valid JSON:
if (osintSignals.length > 0) {
sections.push('📡 OSINT SIGNALS:\n' + osintSignals.map(s => {
const post = s.item || s;
return ` [${post.channel || 'UNKNOWN'}] ${(post.text || s.reason || '').substring(0, 150)}`;
return ` [${post.channel || 'UNKNOWN'}] ${post.text || s.reason || ''}`;
}).join('\n'));
}

Expand Down Expand Up @@ -728,7 +728,10 @@ Respond with ONLY valid JSON:
}

if (evaluation.signals?.length) {
lines.push('', `Signals: ${evaluation.signals.join(' · ')}`);
lines.push('', `*Signals:*`);
for (const sig of evaluation.signals) {
lines.push(`• ${sig}`);
}
}

lines.push('', `_${new Date().toISOString().replace('T', ' ').substring(0, 19)} UTC_`);
Expand Down
2 changes: 1 addition & 1 deletion lib/delta/engine.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export function computeDelta(current, previous, thresholdOverrides = {}) {
if (hash && !prevHashes.has(hash)) {
signals.new.push({
key: `tg_urgent:${hash}`,
text: post.text?.substring(0, 120),
text: post.text,
item: post,
reason: 'New urgent OSINT post',
});
Expand Down
2 changes: 1 addition & 1 deletion lib/delta/memory.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export class MemoryManager {
bls: data.bls,
treasury: data.treasury,
gscpi: data.gscpi,
tg: { posts: data.tg?.posts, urgent: (data.tg?.urgent || []).map(p => ({ text: p.text?.substring(0, 80), date: p.date })) },
tg: { posts: data.tg?.posts, urgent: (data.tg?.urgent || []).map(p => ({ text: p.text, date: p.date })) },
thermal: (data.thermal || []).map(t => ({ region: t.region, det: t.det, night: t.night, hc: t.hc })),
air: (data.air || []).map(a => ({ region: a.region, total: a.total })),
nuke: (data.nuke || []).map(n => ({ site: n.site, anom: n.anom, cpm: n.cpm })),
Expand Down
2 changes: 1 addition & 1 deletion lib/llm/ideas.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function compactSweepForLLM(data, delta, previousIdeas) {
// Geopolitical signals
const urgentPosts = (data.tg?.urgent || []).slice(0, 5);
if (urgentPosts.length) {
sections.push(`URGENT_OSINT:\n${urgentPosts.map(p => `- ${(p.text || '').substring(0, 120)}`).join('\n')}`);
sections.push(`URGENT_OSINT:\n${urgentPosts.map(p => `- ${p.text || ''}`).join('\n')}`);
}

// Thermal / fire detections
Expand Down
Loading