mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-28 23:02:02 +03:00
chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts.
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
|
||||
import { emptyPluginConfigSchema } from "openclaw/plugin-sdk";
|
||||
|
||||
import { nostrPlugin } from "./src/channel.js";
|
||||
import { setNostrRuntime, getNostrRuntime } from "./src/runtime.js";
|
||||
import { createNostrProfileHttpHandler } from "./src/nostr-profile-http.js";
|
||||
import { resolveNostrAccount } from "./src/types.js";
|
||||
import type { NostrProfile } from "./src/config-schema.js";
|
||||
import { nostrPlugin } from "./src/channel.js";
|
||||
import { createNostrProfileHttpHandler } from "./src/nostr-profile-http.js";
|
||||
import { setNostrRuntime, getNostrRuntime } from "./src/runtime.js";
|
||||
import { resolveNostrAccount } from "./src/types.js";
|
||||
|
||||
const plugin = {
|
||||
id: "nostr",
|
||||
|
||||
@@ -4,8 +4,11 @@ import {
|
||||
formatPairingApproveHint,
|
||||
type ChannelPlugin,
|
||||
} from "openclaw/plugin-sdk";
|
||||
|
||||
import type { NostrProfile } from "./config-schema.js";
|
||||
import type { MetricEvent, MetricsSnapshot } from "./metrics.js";
|
||||
import type { ProfilePublishResult } from "./nostr-profile.js";
|
||||
import { NostrConfigSchema } from "./config-schema.js";
|
||||
import { normalizePubkey, startNostrBus, type NostrBusHandle } from "./nostr-bus.js";
|
||||
import { getNostrRuntime } from "./runtime.js";
|
||||
import {
|
||||
listNostrAccountIds,
|
||||
@@ -13,10 +16,6 @@ import {
|
||||
resolveNostrAccount,
|
||||
type ResolvedNostrAccount,
|
||||
} from "./types.js";
|
||||
import { normalizePubkey, startNostrBus, type NostrBusHandle } from "./nostr-bus.js";
|
||||
import type { MetricEvent, MetricsSnapshot } from "./metrics.js";
|
||||
import type { NostrProfile } from "./config-schema.js";
|
||||
import type { ProfilePublishResult } from "./nostr-profile.js";
|
||||
|
||||
// Store active bus handles per account
|
||||
const activeBuses = new Map<string, NostrBusHandle>();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { createMetrics, type MetricName } from "./metrics.js";
|
||||
import { validatePrivateKey, isValidPubkey, normalizePubkey } from "./nostr-bus.js";
|
||||
import { createSeenTracker } from "./seen-tracker.js";
|
||||
import { createMetrics, type MetricName } from "./metrics.js";
|
||||
|
||||
// ============================================================================
|
||||
// Fuzz Tests for validatePrivateKey
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { createSeenTracker } from "./seen-tracker.js";
|
||||
import { createMetrics, createNoopMetrics, type MetricEvent } from "./metrics.js";
|
||||
import { createSeenTracker } from "./seen-tracker.js";
|
||||
|
||||
// ============================================================================
|
||||
// Seen Tracker Integration Tests
|
||||
|
||||
@@ -7,17 +7,7 @@ import {
|
||||
type Event,
|
||||
} from "nostr-tools";
|
||||
import { decrypt, encrypt } from "nostr-tools/nip04";
|
||||
|
||||
import {
|
||||
readNostrBusState,
|
||||
writeNostrBusState,
|
||||
computeSinceTimestamp,
|
||||
readNostrProfileState,
|
||||
writeNostrProfileState,
|
||||
} from "./nostr-state-store.js";
|
||||
import { publishProfile as publishProfileFn, type ProfilePublishResult } from "./nostr-profile.js";
|
||||
import type { NostrProfile } from "./config-schema.js";
|
||||
import { createSeenTracker, type SeenTracker } from "./seen-tracker.js";
|
||||
import {
|
||||
createMetrics,
|
||||
createNoopMetrics,
|
||||
@@ -25,6 +15,15 @@ import {
|
||||
type MetricsSnapshot,
|
||||
type MetricEvent,
|
||||
} from "./metrics.js";
|
||||
import { publishProfile as publishProfileFn, type ProfilePublishResult } from "./nostr-profile.js";
|
||||
import {
|
||||
readNostrBusState,
|
||||
writeNostrBusState,
|
||||
computeSinceTimestamp,
|
||||
readNostrProfileState,
|
||||
writeNostrProfileState,
|
||||
} from "./nostr-state-store.js";
|
||||
import { createSeenTracker, type SeenTracker } from "./seen-tracker.js";
|
||||
|
||||
export const DEFAULT_RELAYS = ["wss://relay.damus.io", "wss://nos.lol"];
|
||||
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
* Tests for Nostr Profile HTTP Handler
|
||||
*/
|
||||
|
||||
import { describe, it, expect, vi, beforeEach } from "vitest";
|
||||
import { IncomingMessage, ServerResponse } from "node:http";
|
||||
import { Socket } from "node:net";
|
||||
|
||||
import { describe, it, expect, vi, beforeEach } from "vitest";
|
||||
import {
|
||||
createNostrProfileHttpHandler,
|
||||
type NostrProfileHttpContext,
|
||||
|
||||
@@ -9,9 +9,8 @@
|
||||
|
||||
import type { IncomingMessage, ServerResponse } from "node:http";
|
||||
import { z } from "zod";
|
||||
|
||||
import { NostrProfileSchema, type NostrProfile } from "./config-schema.js";
|
||||
import { publishNostrProfile, getNostrProfileState } from "./channel.js";
|
||||
import { NostrProfileSchema, type NostrProfile } from "./config-schema.js";
|
||||
import { importProfileFromRelays, mergeProfiles } from "./nostr-profile-import.js";
|
||||
|
||||
// ============================================================================
|
||||
|
||||
@@ -3,9 +3,8 @@
|
||||
*/
|
||||
|
||||
import { describe, it, expect } from "vitest";
|
||||
|
||||
import { mergeProfiles } from "./nostr-profile-import.js";
|
||||
import type { NostrProfile } from "./config-schema.js";
|
||||
import { mergeProfiles } from "./nostr-profile-import.js";
|
||||
|
||||
// Note: importProfileFromRelays requires real network calls or complex mocking
|
||||
// of nostr-tools SimplePool, so we focus on unit testing mergeProfiles
|
||||
|
||||
@@ -6,10 +6,9 @@
|
||||
*/
|
||||
|
||||
import { SimplePool, verifyEvent, type Event } from "nostr-tools";
|
||||
|
||||
import { contentToProfile, type ProfileContent } from "./nostr-profile.js";
|
||||
import type { NostrProfile } from "./config-schema.js";
|
||||
import { validateUrlSafety } from "./nostr-profile-http.js";
|
||||
import { contentToProfile, type ProfileContent } from "./nostr-profile.js";
|
||||
|
||||
// ============================================================================
|
||||
// Types
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { NostrProfile } from "./config-schema.js";
|
||||
import {
|
||||
createProfileEvent,
|
||||
profileToContent,
|
||||
validateProfile,
|
||||
sanitizeProfileForDisplay,
|
||||
} from "./nostr-profile.js";
|
||||
import type { NostrProfile } from "./config-schema.js";
|
||||
|
||||
// Test private key
|
||||
const TEST_HEX_KEY = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef";
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, it, vi, beforeEach } from "vitest";
|
||||
import { verifyEvent, getPublicKey } from "nostr-tools";
|
||||
import { describe, expect, it, vi, beforeEach } from "vitest";
|
||||
import type { NostrProfile } from "./config-schema.js";
|
||||
import {
|
||||
createProfileEvent,
|
||||
profileToContent,
|
||||
@@ -8,7 +9,6 @@ import {
|
||||
sanitizeProfileForDisplay,
|
||||
type ProfileContent,
|
||||
} from "./nostr-profile.js";
|
||||
import type { NostrProfile } from "./config-schema.js";
|
||||
|
||||
// Test private key (DO NOT use in production - this is a known test key)
|
||||
const TEST_HEX_KEY = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef";
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import type { PluginRuntime } from "openclaw/plugin-sdk";
|
||||
import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { PluginRuntime } from "openclaw/plugin-sdk";
|
||||
|
||||
import {
|
||||
readNostrBusState,
|
||||
writeNostrBusState,
|
||||
|
||||
@@ -2,7 +2,6 @@ import crypto from "node:crypto";
|
||||
import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
import { getNostrRuntime } from "./runtime.js";
|
||||
|
||||
const STORE_VERSION = 2;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { OpenClawConfig } from "openclaw/plugin-sdk";
|
||||
import type { NostrProfile } from "./config-schema.js";
|
||||
import { getPublicKeyFromPrivate } from "./nostr-bus.js";
|
||||
import { DEFAULT_RELAYS } from "./nostr-bus.js";
|
||||
import type { NostrProfile } from "./config-schema.js";
|
||||
|
||||
export interface NostrAccountConfig {
|
||||
enabled?: boolean;
|
||||
|
||||
Reference in New Issue
Block a user