Complete snapshot of /opt/microdao-daarion/ from NODE1 (144.76.224.179).
This represents the actual running production code that has diverged
significantly from the previous main branch.
Key changes from old main:
- Gateway (http_api.py): expanded from ~40KB to 164KB with full agent support
- Router: new /v1/agents/{id}/infer endpoint with vision + DeepSeek routing
- Behavior Policy: SOWA v2.2 (3-level: FULL/ACK/SILENT)
- Agent Registry: config/agent_registry.yml as single source of truth
- 13 agents configured (was 3)
- Memory service integration
- CrewAI teams and roles
Excluded from snapshot: venv/, .env, data/, backups, .tgz archives
Co-authored-by: Cursor <cursoragent@cursor.com>
15 lines
523 B
TypeScript
15 lines
523 B
TypeScript
const limit = Number(process.env.AGX_RATE_LIMIT_PER_MIN || 120);
|
|
const windowMs = 60 * 1000;
|
|
const buckets = new Map<string, { count: number; reset: number }>();
|
|
|
|
export function rateLimit(key: string) {
|
|
const now = Date.now();
|
|
const bucket = buckets.get(key);
|
|
if (!bucket || bucket.reset < now) {
|
|
buckets.set(key, { count: 1, reset: now + windowMs });
|
|
return { ok: true, remaining: limit - 1 };
|
|
}
|
|
bucket.count += 1;
|
|
return { ok: bucket.count <= limit, remaining: Math.max(0, limit - bucket.count) };
|
|
}
|