refactor: rename clawdbot to moltbot with legacy compat

This commit is contained in:
Peter Steinberger
2026-01-27 12:19:58 +00:00
parent 83460df96f
commit 6d16a658e5
1839 changed files with 11250 additions and 11199 deletions

View File

@@ -1,5 +1,5 @@
import type { ChannelDirectoryEntryKind, ChannelId } from "../../channels/plugins/types.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
type CacheEntry<T> = {
value: T;
@@ -21,11 +21,11 @@ export function buildDirectoryCacheKey(key: DirectoryCacheKey): string {
export class DirectoryCache<T> {
private readonly cache = new Map<string, CacheEntry<T>>();
private lastConfigRef: ClawdbotConfig | null = null;
private lastConfigRef: MoltbotConfig | null = null;
constructor(private readonly ttlMs: number) {}
get(key: string, cfg: ClawdbotConfig): T | undefined {
get(key: string, cfg: MoltbotConfig): T | undefined {
this.resetIfConfigChanged(cfg);
const entry = this.cache.get(key);
if (!entry) return undefined;
@@ -36,7 +36,7 @@ export class DirectoryCache<T> {
return entry.value;
}
set(key: string, value: T, cfg: ClawdbotConfig): void {
set(key: string, value: T, cfg: MoltbotConfig): void {
this.resetIfConfigChanged(cfg);
this.cache.set(key, { value, fetchedAt: Date.now() });
}
@@ -47,12 +47,12 @@ export class DirectoryCache<T> {
}
}
clear(cfg?: ClawdbotConfig): void {
clear(cfg?: MoltbotConfig): void {
this.cache.clear();
if (cfg) this.lastConfigRef = cfg;
}
private resetIfConfigChanged(cfg: ClawdbotConfig): void {
private resetIfConfigChanged(cfg: MoltbotConfig): void {
if (this.lastConfigRef && this.lastConfigRef !== cfg) {
this.cache.clear();
}