openclaw-nim 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { ClawdbotPluginApi } from "clawdbot/plugin-sdk";
2
- import { emptyPluginConfigSchema } from "clawdbot/plugin-sdk";
1
+ import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
2
+ import { emptyPluginConfigSchema } from "openclaw/plugin-sdk";
3
3
  import { nimPlugin } from "./src/channel.js";
4
4
  import { setNimRuntime } from "./src/runtime.js";
5
5
 
@@ -55,7 +55,7 @@ const plugin = {
55
55
  name: "NIM",
56
56
  description: "NetEase IM (网易云信) channel plugin",
57
57
  configSchema: emptyPluginConfigSchema(),
58
- register(api: ClawdbotPluginApi) {
58
+ register(api: OpenClawPluginApi) {
59
59
  setNimRuntime(api.runtime);
60
60
  api.registerChannel({ plugin: nimPlugin });
61
61
  },
@@ -0,0 +1,9 @@
1
+ {
2
+ "id": "openclaw-nim",
3
+ "channels": ["nim"],
4
+ "configSchema": {
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "properties": {}
8
+ }
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-nim",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "type": "module",
5
5
  "description": "OpenClaw NIM (NetEase IM) channel plugin",
6
6
  "license": "MIT",
package/src/accounts.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ClawdbotConfig } from "clawdbot/plugin-sdk";
1
+ import type { OpenClawConfig } from "openclaw/plugin-sdk";
2
2
  import type { NimConfig, ResolvedNimAccount, NimDmPolicy } from "./types.js";
3
3
 
4
4
  /**
@@ -39,7 +39,7 @@ export function resolveNimCredentials(
39
39
  * Resolve NIM account information from Clawdbot configuration.
40
40
  */
41
41
  export function resolveNimAccount(params: {
42
- cfg: ClawdbotConfig;
42
+ cfg: OpenClawConfig;
43
43
  }): ResolvedNimAccount | null {
44
44
  const { cfg } = params;
45
45
  const nimCfg = cfg.channels?.nim as NimConfig | undefined;
package/src/bot.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ClawdbotConfig, RuntimeEnv } from "clawdbot/plugin-sdk";
1
+ import type { OpenClawConfig, RuntimeEnv } from "openclaw/plugin-sdk";
2
2
  import type { NimConfig, NimMessageContext, NimMessageEvent, NimMessageType, NimSessionType } from "./types.js";
3
3
  import { isNimDmAllowed } from "./accounts.js";
4
4
  import { getNimRuntime } from "./runtime.js";
@@ -105,7 +105,7 @@ export function parseNimMessageEvent(message: NimMessageEvent): NimMessageContex
105
105
  * Handle an incoming NIM message.
106
106
  */
107
107
  export async function handleNimMessage(params: {
108
- cfg: ClawdbotConfig;
108
+ cfg: OpenClawConfig;
109
109
  message: NimMessageEvent;
110
110
  runtime?: RuntimeEnv;
111
111
  }): Promise<void> {
package/src/channel.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ChannelPlugin, ClawdbotConfig } from "clawdbot/plugin-sdk";
1
+ import type { ChannelPlugin, OpenClawConfig } from "openclaw/plugin-sdk";
2
2
  import type { ResolvedNimAccount, NimConfig } from "./types.js";
3
3
  import { resolveNimAccount, resolveNimCredentials, DEFAULT_NIM_ACCOUNT_ID } from "./accounts.js";
4
4
  import { normalizeNimTarget, looksLikeNimId } from "./targets.js";
@@ -89,7 +89,7 @@ export const nimPlugin: ChannelPlugin<ResolvedNimAccount> = {
89
89
  },
90
90
  }),
91
91
  deleteAccount: ({ cfg }) => {
92
- const next = { ...cfg } as ClawdbotConfig;
92
+ const next = { ...cfg } as OpenClawConfig;
93
93
  const nextChannels = { ...cfg.channels };
94
94
  delete (nextChannels as Record<string, unknown>).nim;
95
95
  if (Object.keys(nextChannels).length > 0) {
package/src/media.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * NIM Media - 媒体消息处理模块 (node-nim 版本)
3
3
  */
4
4
 
5
- import type { ClawdbotConfig } from "clawdbot/plugin-sdk";
5
+ import type { OpenClawConfig } from "openclaw/plugin-sdk";
6
6
  import type { NimConfig, NimSendResult, NimMediaInfo, NimMessageEvent, NimSessionType } from "./types.js";
7
7
  import { createNimClient, getCachedNimClient } from "./client.js";
8
8
  import { normalizeNimTarget } from "./targets.js";
@@ -17,7 +17,7 @@ import * as http from "http";
17
17
  * 发送图片消息
18
18
  */
19
19
  export async function sendImageNim(params: {
20
- cfg: ClawdbotConfig;
20
+ cfg: OpenClawConfig;
21
21
  to: string;
22
22
  imagePath: string;
23
23
  sessionType?: NimSessionType;
@@ -51,7 +51,7 @@ export async function sendImageNim(params: {
51
51
  * 发送文件消息
52
52
  */
53
53
  export async function sendFileNim(params: {
54
- cfg: ClawdbotConfig;
54
+ cfg: OpenClawConfig;
55
55
  to: string;
56
56
  filePath: string;
57
57
  sessionType?: NimSessionType;
@@ -85,7 +85,7 @@ export async function sendFileNim(params: {
85
85
  * 发送音频消息
86
86
  */
87
87
  export async function sendAudioNim(params: {
88
- cfg: ClawdbotConfig;
88
+ cfg: OpenClawConfig;
89
89
  to: string;
90
90
  audioPath: string;
91
91
  duration: number;
@@ -120,7 +120,7 @@ export async function sendAudioNim(params: {
120
120
  * 发送视频消息
121
121
  */
122
122
  export async function sendVideoNim(params: {
123
- cfg: ClawdbotConfig;
123
+ cfg: OpenClawConfig;
124
124
  to: string;
125
125
  videoPath: string;
126
126
  duration: number;
@@ -157,7 +157,7 @@ export async function sendVideoNim(params: {
157
157
  * 下载媒体文件
158
158
  */
159
159
  export async function downloadNimMedia(params: {
160
- cfg: ClawdbotConfig;
160
+ cfg: OpenClawConfig;
161
161
  url: string;
162
162
  filename?: string;
163
163
  maxBytes?: number;
package/src/monitor.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * NIM Monitor - 消息监听模块 (node-nim 版本)
3
3
  */
4
4
 
5
- import type { ClawdbotConfig, RuntimeEnv } from "clawdbot/plugin-sdk";
5
+ import type { OpenClawConfig, RuntimeEnv } from "openclaw/plugin-sdk";
6
6
  import type { NimConfig, NimClientInstance, NimMessageEvent } from "./types.js";
7
7
  import { createNimClient, clearNimClientCache } from "./client.js";
8
8
  import { resolveNimCredentials } from "./accounts.js";
@@ -22,7 +22,7 @@ const monitorStates = new Map<string, MonitorState>();
22
22
  * 启动 NIM 消息监听
23
23
  */
24
24
  export async function monitorNimProvider(params: {
25
- cfg: ClawdbotConfig;
25
+ cfg: OpenClawConfig;
26
26
  runtime: RuntimeEnv;
27
27
  abortSignal?: AbortSignal;
28
28
  }): Promise<void> {
package/src/outbound.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ClawdbotConfig } from "clawdbot/plugin-sdk";
1
+ import type { OpenClawConfig } from "openclaw/plugin-sdk";
2
2
  import type { NimConfig } from "./types.js";
3
3
  import { sendMessageNim, splitMessageIntoChunks } from "./send.js";
4
4
  import { sendImageNim, sendFileNim, inferMessageType } from "./media.js";
@@ -22,7 +22,7 @@ export type NimOutboundResult = {
22
22
  * Outbound message options (legacy, for backward compatibility)
23
23
  */
24
24
  export type NimOutboundOptions = {
25
- cfg: ClawdbotConfig;
25
+ cfg: OpenClawConfig;
26
26
  to: string;
27
27
  text?: string;
28
28
  mediaPath?: string;
@@ -104,7 +104,7 @@ export function resolveNimOutboundTarget(params: {
104
104
  export async function sendNimOutboundText(params: {
105
105
  to: string;
106
106
  text: string;
107
- cfg: ClawdbotConfig;
107
+ cfg: OpenClawConfig;
108
108
  accountId?: string;
109
109
  }): Promise<NimOutboundResult> {
110
110
  const { to, text, cfg } = params;
@@ -150,7 +150,7 @@ export async function sendNimOutboundMedia(params: {
150
150
  text?: string;
151
151
  mediaUrl?: string;
152
152
  mediaPath?: string;
153
- cfg: ClawdbotConfig;
153
+ cfg: OpenClawConfig;
154
154
  accountId?: string;
155
155
  }): Promise<NimOutboundResult> {
156
156
  const { to, text, mediaUrl, mediaPath, cfg } = params;
@@ -244,7 +244,7 @@ export const nimOutboundConfig = {
244
244
  sendText: async (params: {
245
245
  to: string;
246
246
  text: string;
247
- cfg: ClawdbotConfig;
247
+ cfg: OpenClawConfig;
248
248
  accountId?: string;
249
249
  deps?: unknown;
250
250
  }): Promise<NimOutboundResult> => {
@@ -258,7 +258,7 @@ export const nimOutboundConfig = {
258
258
  to: string;
259
259
  text?: string;
260
260
  mediaUrl?: string;
261
- cfg: ClawdbotConfig;
261
+ cfg: OpenClawConfig;
262
262
  accountId?: string;
263
263
  deps?: unknown;
264
264
  }): Promise<NimOutboundResult> => {
@@ -315,7 +315,7 @@ export async function nimOutbound(params: NimOutboundOptions): Promise<void> {
315
315
  * Create an outbound handler function for the NIM channel.
316
316
  * @deprecated Use nimOutboundConfig instead
317
317
  */
318
- export function createNimOutboundHandler(cfg: ClawdbotConfig) {
318
+ export function createNimOutboundHandler(cfg: OpenClawConfig) {
319
319
  return async (params: { to: string; text?: string; mediaPath?: string }) => {
320
320
  await nimOutbound({ cfg, ...params });
321
321
  };
@@ -1,4 +1,4 @@
1
- import type { ClawdbotConfig, RuntimeEnv } from "clawdbot/plugin-sdk";
1
+ import type { OpenClawConfig, RuntimeEnv } from "openclaw/plugin-sdk";
2
2
  import type { NimConfig } from "./types.js";
3
3
  import { sendMessageNim, splitMessageIntoChunks } from "./send.js";
4
4
  import { sendImageNim, sendFileNim, inferMessageType } from "./media.js";
@@ -19,7 +19,7 @@ type ReplyPayload = {
19
19
  * Uses the Clawdbot SDK's createReplyDispatcherWithTyping for proper integration.
20
20
  */
21
21
  export function createNimReplyDispatcher(params: {
22
- cfg: ClawdbotConfig;
22
+ cfg: OpenClawConfig;
23
23
  agentId: string;
24
24
  runtime: RuntimeEnv;
25
25
  senderId: string;
package/src/runtime.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { RuntimeEnv } from "clawdbot/plugin-sdk";
1
+ import type { RuntimeEnv } from "openclaw/plugin-sdk";
2
2
 
3
3
  /**
4
4
  * Global runtime environment reference.
package/src/send.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * NIM Send - 消息发送模块 (node-nim 版本)
3
3
  */
4
4
 
5
- import type { ClawdbotConfig } from "clawdbot/plugin-sdk";
5
+ import type { OpenClawConfig } from "openclaw/plugin-sdk";
6
6
  import type { NimConfig, NimSendResult, NimSessionType } from "./types.js";
7
7
  import { createNimClient, getCachedNimClient } from "./client.js";
8
8
  import { normalizeNimTarget } from "./targets.js";
@@ -14,7 +14,7 @@ const MAX_MESSAGE_LENGTH = 5000;
14
14
  * 发送文本消息
15
15
  */
16
16
  export async function sendMessageNim(params: {
17
- cfg: ClawdbotConfig;
17
+ cfg: OpenClawConfig;
18
18
  to: string;
19
19
  text: string;
20
20
  sessionType?: NimSessionType;
@@ -48,7 +48,7 @@ export async function sendMessageNim(params: {
48
48
  * 发送长消息(自动分割)
49
49
  */
50
50
  export async function sendLongMessageNim(params: {
51
- cfg: ClawdbotConfig;
51
+ cfg: OpenClawConfig;
52
52
  to: string;
53
53
  text: string;
54
54
  sessionType?: NimSessionType;
@@ -85,7 +85,7 @@ export async function sendLongMessageNim(params: {
85
85
  * 注意:这个功能可能需要根据实际 SDK 能力调整
86
86
  */
87
87
  export async function editMessageNim(params: {
88
- cfg: ClawdbotConfig;
88
+ cfg: OpenClawConfig;
89
89
  msgId: string;
90
90
  to: string;
91
91
  newText: string;
@@ -101,7 +101,7 @@ export async function editMessageNim(params: {
101
101
  * 注意:需要根据实际 node-nim SDK 能力实现
102
102
  */
103
103
  export async function getMessageNim(params: {
104
- cfg: ClawdbotConfig;
104
+ cfg: OpenClawConfig;
105
105
  msgId: string;
106
106
  }): Promise<{ success: boolean; message?: unknown; error?: string }> {
107
107
  // 暂时返回不支持