feat: full service exposure with grammy bot + claudegram patterns

- Rewrote bot/index.js using grammy (@grammyjs/auto-retry + runner)
- Added deduplication.js (adapted from claudegram)
- Added request-queue.js (per-chat sequential processing)
- Added message-sender.js (chunking + Markdown fallback)
- Wired all JS-shim services: tools, skills, agents, config, RTK
- Added function calling support to ZAIProvider.chat()
- Added dynamic command routing (tools, skills, agents, model, stats)
- Added per-agent delegation commands (/agent_coder, /agent_architect, etc.)
- Added dedup + queue patterns from claudegram's battle-tested codebase
- Updated zcode.js to pass agents to initBot()
- Updated README feature comparison table to reflect real capabilities
This commit is contained in:
admin
2026-05-05 12:41:15 +00:00
Unverified
parent 4db82f78a6
commit cbe816a421
9 changed files with 964 additions and 174 deletions

27
src/bot/deduplication.js Normal file
View File

@@ -0,0 +1,27 @@
// Copied from claudegram — proven deduplication pattern
const processedMessages = new Map();
const MESSAGE_TTL = 60000;
let cleanupInterval = null;
export function isDuplicate(messageId) {
return processedMessages.has(messageId);
}
export function markProcessed(messageId) {
processedMessages.set(messageId, Date.now());
ensureCleanupRunning();
}
function ensureCleanupRunning() {
if (cleanupInterval) return;
cleanupInterval = setInterval(() => {
const now = Date.now();
for (const [id, timestamp] of processedMessages) {
if (now - timestamp > MESSAGE_TTL) processedMessages.delete(id);
}
if (processedMessages.size === 0 && cleanupInterval) {
clearInterval(cleanupInterval);
cleanupInterval = null;
}
}, 30000);
}