mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-02 16:00:21 +00:00
refactor: tighten plugin sdk channel seams
This commit is contained in:
@@ -48,6 +48,7 @@ export type WebhookAnomalyTracker = {
|
||||
clear: () => void;
|
||||
};
|
||||
|
||||
/** Create a simple fixed-window rate limiter for in-memory webhook protection. */
|
||||
export function createFixedWindowRateLimiter(options: {
|
||||
windowMs: number;
|
||||
maxRequests: number;
|
||||
@@ -104,6 +105,7 @@ export function createFixedWindowRateLimiter(options: {
|
||||
};
|
||||
}
|
||||
|
||||
/** Count keyed events in memory with optional TTL pruning and bounded cardinality. */
|
||||
export function createBoundedCounter(options: {
|
||||
maxTrackedKeys: number;
|
||||
ttlMs?: number;
|
||||
@@ -161,6 +163,7 @@ export function createBoundedCounter(options: {
|
||||
};
|
||||
}
|
||||
|
||||
/** Track repeated webhook failures and emit sampled logs for suspicious request patterns. */
|
||||
export function createWebhookAnomalyTracker(options?: {
|
||||
maxTrackedKeys?: number;
|
||||
ttlMs?: number;
|
||||
|
||||
Reference in New Issue
Block a user