@voiceclaw/voiceclaw-plugin 1.1.6 → 1.1.8

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/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  interface PluginApi {
2
2
  config: Record<string, any>;
3
+ runtime: any;
3
4
  logger: {
4
5
  info: (msg: string) => void;
5
6
  error: (msg: string) => void;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { voiceClawPlugin, setLogger } from './src/channel.js';
1
+ import { voiceClawPlugin, setLogger, setRuntime, setConfig } from './src/channel.js';
2
2
  import { voiceClawConfigSchema } from './src/types.js';
3
3
  export default {
4
4
  id: 'voiceclaw-plugin',
@@ -7,6 +7,8 @@ export default {
7
7
  configSchema: voiceClawConfigSchema,
8
8
  register(api) {
9
9
  setLogger(api.logger);
10
+ setRuntime(api.runtime);
11
+ setConfig(api.config);
10
12
  api.registerChannel({ plugin: voiceClawPlugin });
11
13
  api.logger.info('VoiceClaw channel plugin registered');
12
14
  },
@@ -54,5 +54,6 @@ export declare const voiceClawPlugin: {
54
54
  };
55
55
  };
56
56
  export declare function setLogger(logger: Logger): void;
57
- export declare function setInboundHandler(handler: (text: string, accountId: string) => Promise<void>): void;
57
+ export declare function setRuntime(runtime: any): void;
58
+ export declare function setConfig(config: any): void;
58
59
  export {};
@@ -54,8 +54,11 @@ async function resolveToken(accountId, account, logger) {
54
54
  }
55
55
  // ── Channel plugin ─────────────────────────────────────────────
56
56
  const clients = new Map();
57
- let handleInbound = null;
58
57
  let pluginLogger = null;
58
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
59
+ let pluginRuntime = null;
60
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
61
+ let pluginConfig = null;
59
62
  export const voiceClawPlugin = {
60
63
  id: 'voiceclaw',
61
64
  meta: {
@@ -125,10 +128,6 @@ export const voiceClawPlugin = {
125
128
  startAccount: async (ctx) => {
126
129
  const account = ctx.account;
127
130
  const logger = pluginLogger;
128
- // Capture the inbound handler from OpenClaw
129
- if (ctx.processInbound) {
130
- handleInbound = ctx.processInbound;
131
- }
132
131
  logger.info(`VoiceClaw: Starting account "${account.accountId}"...`);
133
132
  try {
134
133
  const sessionToken = await resolveToken(account.accountId, account, logger);
@@ -136,9 +135,37 @@ export const voiceClawPlugin = {
136
135
  const client = new RelayWsClient({
137
136
  token: sessionToken,
138
137
  workerUrl,
139
- onUserMessage: (msg) => {
138
+ onUserMessage: async (msg) => {
140
139
  logger.info(`VoiceClaw: User message (${msg.id}): ${msg.text.slice(0, 50)}...`);
141
- handleInbound?.(msg.text, account.accountId);
140
+ // Dispatch inbound message via OpenClaw runtime (same as LINE plugin)
141
+ try {
142
+ const inboundCtx = pluginRuntime.channel.reply.finalizeInboundContext({
143
+ channelId: 'voiceclaw',
144
+ accountId: account.accountId,
145
+ sender: 'voiceclaw-user',
146
+ chatType: 'dm',
147
+ chatId: `voiceclaw:${account.accountId}`,
148
+ text: msg.text,
149
+ source: 'voiceclaw',
150
+ });
151
+ await pluginRuntime.channel.reply.dispatchReplyWithBufferedBlockDispatcher({
152
+ ctx: inboundCtx,
153
+ cfg: pluginConfig,
154
+ dispatcherOptions: {
155
+ deliver: async (_outPayload) => {
156
+ // Delivery handled by outbound.sendText adapter
157
+ void _outPayload;
158
+ },
159
+ onError: (err) => {
160
+ logger.error(`VoiceClaw: Reply dispatch error: ${String(err)}`);
161
+ },
162
+ },
163
+ });
164
+ logger.info('VoiceClaw: Message dispatched to agent');
165
+ }
166
+ catch (err) {
167
+ logger.error(`VoiceClaw: Failed to dispatch message: ${String(err)}`);
168
+ }
142
169
  },
143
170
  onStateChange: (state) => {
144
171
  logger.info(`VoiceClaw: [${account.accountId}] ${state}`);
@@ -176,6 +203,9 @@ export const voiceClawPlugin = {
176
203
  export function setLogger(logger) {
177
204
  pluginLogger = logger;
178
205
  }
179
- export function setInboundHandler(handler) {
180
- handleInbound = handler;
206
+ export function setRuntime(runtime) {
207
+ pluginRuntime = runtime;
208
+ }
209
+ export function setConfig(config) {
210
+ pluginConfig = config;
181
211
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voiceclaw/voiceclaw-plugin",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "description": "OpenClaw channel plugin for VoiceClaw — relay messages between your AI agent and the VoiceClaw iOS/macOS app via Siri",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -44,9 +44,6 @@
44
44
  "macos",
45
45
  "voice"
46
46
  ],
47
- "peerDependencies": {
48
- "openclaw": ">=2026.1.0"
49
- },
50
47
  "dependencies": {
51
48
  "ws": "^8.18.0",
52
49
  "zod": "^3.24.0"