@voiceclaw/voiceclaw-plugin 1.0.1 → 1.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.
Files changed (3) hide show
  1. package/README.md +22 -1
  2. package/dist/index.js +26 -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,25 @@ 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
+ // If top-level config exists, ensure 'default' is in the list
84
+ if (cfg.plugins?.entries?.['voiceclaw-plugin']?.config && !ids.includes('default')) {
85
+ ids.push('default');
86
+ }
87
+ return ids;
88
+ },
81
89
  resolveAccount: (cfg, accountId) => {
82
90
  const accounts = cfg.channels?.voiceclaw?.accounts ?? {};
83
- return accounts[accountId ?? 'default'] ?? {};
91
+ const id = accountId ?? 'default';
92
+ const account = accounts[id] ?? {};
93
+ // Merge with top-level plugin config if this is the default account
94
+ if (id === 'default') {
95
+ const topLevelConfig = cfg.plugins?.entries?.['voiceclaw-plugin']?.config ?? {};
96
+ return { ...topLevelConfig, ...account };
97
+ }
98
+ return account;
84
99
  },
85
100
  },
86
101
  outbound: {
@@ -105,8 +120,15 @@ export default function register(api) {
105
120
  gateway: {
106
121
  start: async (ctx) => {
107
122
  handleInbound = ctx.processInbound;
108
- const accounts = ctx.config.channels?.voiceclaw?.accounts ?? {};
109
- for (const [accountId, account] of Object.entries(accounts)) {
123
+ let accounts = ctx.config.channels?.voiceclaw?.accounts ?? {};
124
+ // Auto-inject default account if top-level config exists and default isn't explicitly defined
125
+ const topLevelConfig = ctx.config.plugins?.entries?.['voiceclaw-plugin']?.config;
126
+ if (topLevelConfig && !accounts['default']) {
127
+ accounts = { ...accounts, default: {} };
128
+ }
129
+ for (const [accountId, baseAccount] of Object.entries(accounts)) {
130
+ // Resolve full account config (merges top-level for 'default')
131
+ const account = voiceClawChannel.config.resolveAccount(ctx.config, accountId);
110
132
  if (account.enabled === false)
111
133
  continue;
112
134
  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.3",
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",