import { createChannelPairingController } from "openclaw/plugin-sdk/channel-pairing"; import { attachChannelToResult } from "openclaw/plugin-sdk/channel-send-result"; import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; import {
createPreCryptoDirectDmAuthorizer,
DEFAULT_ACCOUNT_ID,
type ChannelOutboundAdapter,
resolveInboundDirectDmAccessWithRuntime,
type ChannelPlugin,
} from "./channel-api.js"; import type { MetricEvent, MetricsSnapshot } from "./metrics.js"; import { startNostrBus, type NostrBusHandle } from "./nostr-bus.js"; import { normalizePubkey } from "./nostr-key-utils.js"; import { getNostrRuntime } from "./runtime.js"; import { resolveDefaultNostrAccountId, type ResolvedNostrAccount } from "./types.js";
export const nostrOutboundAdapter: NostrOutboundAdapter = {
deliveryMode: "direct",
textChunkLimit: 4000,
sendText: async ({ cfg, to, text, accountId }) => { const core = getNostrRuntime(); const aid = accountId ?? resolveDefaultNostrAccountId(cfg); const bus = activeBuses.get(aid); if (!bus) { thrownew Error(`Nostr bus not running for account ${aid}`);
} const tableMode = core.channel.text.resolveMarkdownTableMode({
cfg,
channel: "nostr",
accountId: aid,
}); const message = core.channel.text.convertMarkdownTables(text ?? "", tableMode); const normalizedTo = normalizePubkey(to);
await bus.sendDm(normalizedTo, message); return attachChannelToResult("nostr", {
to: normalizedTo,
messageId: `nostr-${Date.now()}`,
});
},
};
export function getNostrMetrics(
accountId: string = DEFAULT_ACCOUNT_ID,
): MetricsSnapshot | undefined { const bus = activeBuses.get(accountId); if (bus) { return bus.getMetrics();
} return metricsSnapshots.get(accountId);
}
export function getActiveNostrBuses(): Map<string, NostrBusHandle> { returnnew Map(activeBuses);
}
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.12Bemerkung:
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-06-08)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.