refactor: rename clawdbot to moltbot with legacy compat
This commit is contained in:
@@ -3,22 +3,22 @@
|
||||
## 2026.1.23
|
||||
|
||||
### Changes
|
||||
- Version alignment with core Clawdbot release numbers.
|
||||
- Version alignment with core Moltbot release numbers.
|
||||
|
||||
## 2026.1.22
|
||||
|
||||
### Changes
|
||||
- Version alignment with core Clawdbot release numbers.
|
||||
- Version alignment with core Moltbot release numbers.
|
||||
|
||||
## 2026.1.21
|
||||
|
||||
### Changes
|
||||
- Version alignment with core Clawdbot release numbers.
|
||||
- Version alignment with core Moltbot release numbers.
|
||||
|
||||
## 2026.1.20
|
||||
|
||||
### Changes
|
||||
- Version alignment with core Clawdbot release numbers.
|
||||
- Version alignment with core Moltbot release numbers.
|
||||
|
||||
## 2026.1.19-1
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ClawdbotPluginApi, ClawdbotConfig } from "clawdbot/plugin-sdk";
|
||||
import type { MoltbotPluginApi, MoltbotConfig } from "clawdbot/plugin-sdk";
|
||||
import { emptyPluginConfigSchema } from "clawdbot/plugin-sdk";
|
||||
|
||||
import { nostrPlugin } from "./src/channel.js";
|
||||
@@ -12,7 +12,7 @@ const plugin = {
|
||||
name: "Nostr",
|
||||
description: "Nostr DM channel plugin via NIP-04",
|
||||
configSchema: emptyPluginConfigSchema(),
|
||||
register(api: ClawdbotPluginApi) {
|
||||
register(api: MoltbotPluginApi) {
|
||||
setNostrRuntime(api.runtime);
|
||||
api.registerChannel({ plugin: nostrPlugin });
|
||||
|
||||
@@ -20,13 +20,13 @@ const plugin = {
|
||||
const httpHandler = createNostrProfileHttpHandler({
|
||||
getConfigProfile: (accountId: string) => {
|
||||
const runtime = getNostrRuntime();
|
||||
const cfg = runtime.config.loadConfig() as ClawdbotConfig;
|
||||
const cfg = runtime.config.loadConfig() as MoltbotConfig;
|
||||
const account = resolveNostrAccount({ cfg, accountId });
|
||||
return account.profile;
|
||||
},
|
||||
updateConfigProfile: async (accountId: string, profile: NostrProfile) => {
|
||||
const runtime = getNostrRuntime();
|
||||
const cfg = runtime.config.loadConfig() as ClawdbotConfig;
|
||||
const cfg = runtime.config.loadConfig() as MoltbotConfig;
|
||||
|
||||
// Build the config patch for channels.nostr.profile
|
||||
const channels = (cfg.channels ?? {}) as Record<string, unknown>;
|
||||
@@ -49,7 +49,7 @@ const plugin = {
|
||||
},
|
||||
getAccountInfo: (accountId: string) => {
|
||||
const runtime = getNostrRuntime();
|
||||
const cfg = runtime.config.loadConfig() as ClawdbotConfig;
|
||||
const cfg = runtime.config.loadConfig() as MoltbotConfig;
|
||||
const account = resolveNostrAccount({ cfg, accountId });
|
||||
if (!account.configured || !account.publicKey) {
|
||||
return null;
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
"name": "@moltbot/nostr",
|
||||
"version": "2026.1.26",
|
||||
"type": "module",
|
||||
"description": "Clawdbot Nostr channel plugin for NIP-04 encrypted DMs",
|
||||
"clawdbot": {
|
||||
"description": "Moltbot Nostr channel plugin for NIP-04 encrypted DMs",
|
||||
"moltbot": {
|
||||
"extensions": [
|
||||
"./index.ts"
|
||||
],
|
||||
@@ -24,7 +24,7 @@
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"clawdbot": "workspace:*",
|
||||
"moltbot": "workspace:*",
|
||||
"nostr-tools": "^2.20.0",
|
||||
"zod": "^4.3.6"
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ export const nostrPlugin: ChannelPlugin<ResolvedNostrAccount> = {
|
||||
onMessage: async (senderPubkey, text, reply) => {
|
||||
ctx.log?.debug(`[${account.accountId}] DM from ${senderPubkey}: ${text.slice(0, 50)}...`);
|
||||
|
||||
// Forward to clawdbot's message pipeline
|
||||
// Forward to moltbot's message pipeline
|
||||
await runtime.channel.reply.handleInboundMessage({
|
||||
channel: "nostr",
|
||||
accountId: account.accountId,
|
||||
|
||||
@@ -14,7 +14,7 @@ import { setNostrRuntime } from "./runtime.js";
|
||||
|
||||
async function withTempStateDir<T>(fn: (dir: string) => Promise<T>) {
|
||||
const previous = process.env.CLAWDBOT_STATE_DIR;
|
||||
const dir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-nostr-"));
|
||||
const dir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-nostr-"));
|
||||
process.env.CLAWDBOT_STATE_DIR = dir;
|
||||
setNostrRuntime({
|
||||
state: {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ClawdbotConfig } from "clawdbot/plugin-sdk";
|
||||
import type { MoltbotConfig } from "clawdbot/plugin-sdk";
|
||||
import { getPublicKeyFromPrivate } from "./nostr-bus.js";
|
||||
import { DEFAULT_RELAYS } from "./nostr-bus.js";
|
||||
import type { NostrProfile } from "./config-schema.js";
|
||||
@@ -30,7 +30,7 @@ const DEFAULT_ACCOUNT_ID = "default";
|
||||
/**
|
||||
* List all configured Nostr account IDs
|
||||
*/
|
||||
export function listNostrAccountIds(cfg: ClawdbotConfig): string[] {
|
||||
export function listNostrAccountIds(cfg: MoltbotConfig): string[] {
|
||||
const nostrCfg = (cfg.channels as Record<string, unknown> | undefined)?.nostr as
|
||||
| NostrAccountConfig
|
||||
| undefined;
|
||||
@@ -46,7 +46,7 @@ export function listNostrAccountIds(cfg: ClawdbotConfig): string[] {
|
||||
/**
|
||||
* Get the default account ID
|
||||
*/
|
||||
export function resolveDefaultNostrAccountId(cfg: ClawdbotConfig): string {
|
||||
export function resolveDefaultNostrAccountId(cfg: MoltbotConfig): string {
|
||||
const ids = listNostrAccountIds(cfg);
|
||||
if (ids.includes(DEFAULT_ACCOUNT_ID)) return DEFAULT_ACCOUNT_ID;
|
||||
return ids[0] ?? DEFAULT_ACCOUNT_ID;
|
||||
@@ -56,7 +56,7 @@ export function resolveDefaultNostrAccountId(cfg: ClawdbotConfig): string {
|
||||
* Resolve a Nostr account from config
|
||||
*/
|
||||
export function resolveNostrAccount(opts: {
|
||||
cfg: ClawdbotConfig;
|
||||
cfg: MoltbotConfig;
|
||||
accountId?: string | null;
|
||||
}): ResolvedNostrAccount {
|
||||
const accountId = opts.accountId ?? DEFAULT_ACCOUNT_ID;
|
||||
|
||||
Reference in New Issue
Block a user