mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 14:20:44 +00:00
refactor: trim nostr helper exports
This commit is contained in:
@@ -204,5 +204,3 @@ export async function getNostrProfileState(accountId: string = DEFAULT_ACCOUNT_I
|
||||
}
|
||||
return bus.getProfileState();
|
||||
}
|
||||
|
||||
export { getActiveNostrBuses } from "./gateway.js";
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// Metric Types
|
||||
// ============================================================================
|
||||
|
||||
export type EventMetricName =
|
||||
type EventMetricName =
|
||||
| "event.received"
|
||||
| "event.processed"
|
||||
| "event.duplicate"
|
||||
@@ -22,7 +22,7 @@ export type EventMetricName =
|
||||
| "event.rejected.decrypt_failed"
|
||||
| "event.rejected.self_message";
|
||||
|
||||
export type RelayMetricName =
|
||||
type RelayMetricName =
|
||||
| "relay.connect"
|
||||
| "relay.disconnect"
|
||||
| "relay.reconnect"
|
||||
@@ -37,11 +37,11 @@ export type RelayMetricName =
|
||||
| "relay.circuit_breaker.close"
|
||||
| "relay.circuit_breaker.half_open";
|
||||
|
||||
export type RateLimitMetricName = "rate_limit.per_sender" | "rate_limit.global";
|
||||
type RateLimitMetricName = "rate_limit.per_sender" | "rate_limit.global";
|
||||
|
||||
export type DecryptMetricName = "decrypt.success" | "decrypt.failure";
|
||||
type DecryptMetricName = "decrypt.success" | "decrypt.failure";
|
||||
|
||||
export type MemoryMetricName = "memory.seen_tracker_size" | "memory.rate_limiter_entries";
|
||||
type MemoryMetricName = "memory.seen_tracker_size" | "memory.rate_limiter_entries";
|
||||
|
||||
export type MetricName =
|
||||
| EventMetricName
|
||||
@@ -83,7 +83,7 @@ export interface MetricEvent {
|
||||
labels?: Record<string, string | number>;
|
||||
}
|
||||
|
||||
export type OnMetricCallback = (event: MetricEvent) => void;
|
||||
type OnMetricCallback = (event: MetricEvent) => void;
|
||||
|
||||
// ============================================================================
|
||||
// Metrics Snapshot (for getMetrics())
|
||||
|
||||
@@ -44,7 +44,7 @@ const HEALTH_WINDOW_MS = 60000; // 1 minute window for health stats
|
||||
// Types
|
||||
// ============================================================================
|
||||
|
||||
export interface NostrBusOptions {
|
||||
interface NostrBusOptions {
|
||||
/** Private key in hex or nsec format */
|
||||
privateKey: string;
|
||||
/** WebSocket relay URLs (defaults to damus + nos.lol) */
|
||||
|
||||
@@ -115,9 +115,6 @@ async function withPublishLock<T>(accountId: string, fn: () => Promise<T>): Prom
|
||||
}
|
||||
}
|
||||
|
||||
// Export for use in import validation
|
||||
export { validateUrlSafety };
|
||||
|
||||
// ============================================================================
|
||||
// Validation Schemas
|
||||
// ============================================================================
|
||||
|
||||
@@ -14,7 +14,7 @@ import { contentToProfile, type ProfileContent } from "./nostr-profile.js";
|
||||
// Types
|
||||
// ============================================================================
|
||||
|
||||
export interface ProfileImportResult {
|
||||
interface ProfileImportResult {
|
||||
/** Whether the import was successful */
|
||||
ok: boolean;
|
||||
/** The imported profile (if found and valid) */
|
||||
@@ -33,7 +33,7 @@ export interface ProfileImportResult {
|
||||
sourceRelay?: string;
|
||||
}
|
||||
|
||||
export interface ProfileImportOptions {
|
||||
interface ProfileImportOptions {
|
||||
/** The public key to fetch profile for */
|
||||
pubkey: string;
|
||||
/** Relay URLs to query */
|
||||
|
||||
@@ -88,7 +88,7 @@ const RELAY_PUBLISH_TIMEOUT_MS = 5000;
|
||||
* @param event - Signed profile event (kind:0)
|
||||
* @returns Publish results with successes and failures
|
||||
*/
|
||||
export async function publishProfileEvent(
|
||||
async function publishProfileEvent(
|
||||
pool: SimplePool,
|
||||
relays: string[],
|
||||
event: Event,
|
||||
|
||||
@@ -28,7 +28,7 @@ type NostrBusState = {
|
||||
};
|
||||
|
||||
/** Profile publish state (separate from bus state) */
|
||||
export type NostrProfileState = {
|
||||
type NostrProfileState = {
|
||||
version: 1;
|
||||
/** Unix timestamp (seconds) of last successful profile publish */
|
||||
lastPublishedAt: number | null;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Prevents unbounded memory growth under high load or abuse.
|
||||
*/
|
||||
|
||||
export interface SeenTrackerOptions {
|
||||
interface SeenTrackerOptions {
|
||||
/** Maximum number of entries to track (default: 100,000) */
|
||||
maxEntries?: number;
|
||||
/** TTL in milliseconds (default: 1 hour) */
|
||||
|
||||
@@ -14,7 +14,7 @@ import type { NostrProfile } from "./config-schema.js";
|
||||
import { DEFAULT_RELAYS } from "./default-relays.js";
|
||||
import { getPublicKeyFromPrivate } from "./nostr-key-utils.js";
|
||||
|
||||
export interface NostrAccountConfig {
|
||||
interface NostrAccountConfig {
|
||||
enabled?: boolean;
|
||||
name?: string;
|
||||
defaultAccount?: string;
|
||||
|
||||
Reference in New Issue
Block a user