@voiceclaw/voiceclaw-plugin 1.0.1 → 1.0.4

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.
Files changed (3) hide show
  1. package/README.md +22 -1
  2. package/dist/index.js +32 -4
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -14,7 +14,28 @@ openclaw plugins install @voiceclaw/voiceclaw-plugin
14
14
 
15
15
  ## Configuration
16
16
 
17
- Add the VoiceClaw channel to your `openclaw.config.json`:
17
+ There are two ways to configure the plugin in your `openclaw.config.json` depending on how you use it.
18
+
19
+ ### Option A: Standard (Single Account)
20
+ Add the configuration directly to the plugin entry. This is the simplest way.
21
+
22
+ ```json
23
+ {
24
+ "plugins": {
25
+ "entries": {
26
+ "voiceclaw-plugin": {
27
+ "enabled": true,
28
+ "config": {
29
+ "pairingCode": "<6-digit code>"
30
+ }
31
+ }
32
+ }
33
+ }
34
+ }
35
+ ```
36
+
37
+ ### Option B: Advanced (Multi-Account)
38
+ If you want to manage multiple VoiceClaw clients, you can use the channel configuration block:
18
39
 
19
40
  ```json
20
41
  {
package/dist/index.js CHANGED
@@ -77,10 +77,30 @@ export default function register(api) {
77
77
  },
78
78
  capabilities: { chatTypes: ['direct'] },
79
79
  config: {
80
- listAccountIds: (cfg) => Object.keys(cfg.channels?.voiceclaw?.accounts ?? {}),
80
+ listAccountIds: (cfg) => {
81
+ const accounts = cfg.channels?.voiceclaw?.accounts ?? {};
82
+ const ids = Object.keys(accounts);
83
+ const topLevelConfig = cfg.plugins?.entries?.['voiceclaw-plugin']?.config;
84
+ console.log(`[VoiceClaw Plugin] listAccountIds called. topLevelConfig exists: ${!!topLevelConfig}, explicit channels: ${ids.join(',')}`);
85
+ // If top-level config exists, ensure 'default' is in the list
86
+ if (topLevelConfig && !ids.includes('default')) {
87
+ ids.push('default');
88
+ }
89
+ console.log(`[VoiceClaw Plugin] listAccountIds returning: ${ids.join(',')}`);
90
+ return ids;
91
+ },
81
92
  resolveAccount: (cfg, accountId) => {
82
93
  const accounts = cfg.channels?.voiceclaw?.accounts ?? {};
83
- return accounts[accountId ?? 'default'] ?? {};
94
+ const id = accountId ?? 'default';
95
+ const account = accounts[id] ?? {};
96
+ let finalAccount = account;
97
+ // Merge with top-level plugin config if this is the default account
98
+ if (id === 'default') {
99
+ const topLevelConfig = cfg.plugins?.entries?.['voiceclaw-plugin']?.config ?? {};
100
+ finalAccount = { ...topLevelConfig, ...account };
101
+ }
102
+ console.log(`[VoiceClaw Plugin] resolveAccount for ${id} returning:`, finalAccount);
103
+ return finalAccount;
84
104
  },
85
105
  },
86
106
  outbound: {
@@ -104,9 +124,17 @@ export default function register(api) {
104
124
  },
105
125
  gateway: {
106
126
  start: async (ctx) => {
127
+ api.logger.info('VoiceClaw: gateway.start() called');
107
128
  handleInbound = ctx.processInbound;
108
- const accounts = ctx.config.channels?.voiceclaw?.accounts ?? {};
109
- for (const [accountId, account] of Object.entries(accounts)) {
129
+ let accounts = ctx.config.channels?.voiceclaw?.accounts ?? {};
130
+ // Auto-inject default account if top-level config exists and default isn't explicitly defined
131
+ const topLevelConfig = ctx.config.plugins?.entries?.['voiceclaw-plugin']?.config;
132
+ if (topLevelConfig && !accounts['default']) {
133
+ accounts = { ...accounts, default: {} };
134
+ }
135
+ for (const [accountId, baseAccount] of Object.entries(accounts)) {
136
+ // Resolve full account config (merges top-level for 'default')
137
+ const account = voiceClawChannel.config.resolveAccount(ctx.config, accountId);
110
138
  if (account.enabled === false)
111
139
  continue;
112
140
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voiceclaw/voiceclaw-plugin",
3
- "version": "1.0.1",
3
+ "version": "1.0.4",
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",