callme-openclaw-plugin 1.0.6 → 1.0.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.
@@ -25,7 +25,6 @@
25
25
  "description": "Language code"
26
26
  }
27
27
  },
28
- "required": ["apiKey"],
29
28
  "additionalProperties": false
30
29
  },
31
30
  "uiHints": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "callme-openclaw-plugin",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "OpenClaw plugin for callme.ai - hands-free voice calls with your AI assistant",
5
5
  "main": "index.js",
6
6
  "bin": {
package/setup.js CHANGED
@@ -13,7 +13,6 @@ const readline = require('readline');
13
13
  const execAsync = promisify(exec);
14
14
 
15
15
  const OPENCLAW_DIR = path.join(process.env.HOME, '.openclaw');
16
- const PLUGIN_DIR = path.join(OPENCLAW_DIR, 'plugins', 'callme');
17
16
  const CONFIG_FILE = path.join(OPENCLAW_DIR, 'config.yaml');
18
17
 
19
18
  const rl = readline.createInterface({
@@ -47,51 +46,68 @@ async function main() {
47
46
  process.exit(1);
48
47
  }
49
48
 
50
- // Step 3: Install plugin via OpenClaw CLI
49
+ // Step 3: Install plugin FIRST (apiKey is optional in schema, so install won't fail)
51
50
  console.log('\nšŸ“¦ Installing plugin...');
52
51
 
53
52
  try {
54
- // Use OpenClaw's plugin installer (official method)
55
- await execAsync('openclaw plugins install callme-openclaw-plugin');
53
+ await execAsync('openclaw plugins install callme-openclaw-plugin 2>&1');
56
54
  console.log('āœ… Plugin installed');
57
55
  } catch (error) {
58
- console.error('āŒ Failed to install plugin:', error.message);
59
- console.log('\nšŸ“‹ Manual fallback:');
60
- console.log(' 1. Run: openclaw plugins install callme-openclaw-plugin');
61
- console.log(' 2. Then re-run this setup');
56
+ // Check if it's already installed
57
+ if (error.message.includes('already installed')) {
58
+ console.log('āœ… Plugin already installed');
59
+ } else {
60
+ console.error('āŒ Failed to install plugin:', error.message);
61
+ console.log('\nšŸ“‹ Manual fallback:');
62
+ console.log(' 1. Run: openclaw plugins install callme-openclaw-plugin');
63
+ console.log(' 2. Edit ~/.openclaw/config.yaml manually');
64
+ process.exit(1);
65
+ }
66
+ }
67
+
68
+ // Step 4: Write config AFTER plugin install
69
+ console.log('\nāš™ļø Writing plugin config...');
70
+
71
+ if (!fs.existsSync(CONFIG_FILE)) {
72
+ console.error('āŒ Config file not found at:', CONFIG_FILE);
73
+ console.log('Run: openclaw config');
62
74
  process.exit(1);
63
75
  }
64
76
 
65
- // Step 4: Update config
66
- console.log('\nāš™ļø Updating OpenClaw config...');
67
-
68
- const configContent = `
69
- # callme.ai Voice Plugin
70
- plugins:
71
- callme:
72
- enabled: true
73
- apiKey: "${apiKey}"
74
- defaultVoice: "nova"
75
- language: "en"
76
- `;
77
-
78
- if (fs.existsSync(CONFIG_FILE)) {
79
- const existing = fs.readFileSync(CONFIG_FILE, 'utf8');
80
- if (existing.includes('callme:')) {
81
- // Replace existing
82
- const updated = existing.replace(
83
- /plugins:\s*\n\s*callme:[\s\S]*?(?=\n\S|$)/,
84
- configContent.trim()
85
- );
86
- fs.writeFileSync(CONFIG_FILE, updated);
87
- } else {
88
- // Append
89
- fs.appendFileSync(CONFIG_FILE, configContent);
90
- }
77
+ let config = fs.readFileSync(CONFIG_FILE, 'utf8');
78
+
79
+ // Strategy: Find and replace or append
80
+ const callmeConfig = ` callme:
81
+ enabled: true
82
+ config:
83
+ apiKey: "${apiKey}"
84
+ defaultVoice: "nova"
85
+ language: "en"`;
86
+
87
+ if (config.match(/plugins:\s*\n.*entries:\s*\n.*callme:/s)) {
88
+ // Replace existing callme section
89
+ config = config.replace(
90
+ /(\s+)callme:\s*\n(?:\s+.*\n)*/,
91
+ callmeConfig + '\n'
92
+ );
93
+ } else if (config.match(/plugins:\s*\n.*entries:/s)) {
94
+ // Add callme under existing entries
95
+ config = config.replace(
96
+ /(plugins:\s*\n.*entries:\s*\n)/s,
97
+ `$1${callmeConfig}\n`
98
+ );
99
+ } else if (config.match(/plugins:/)) {
100
+ // Add entries section with callme
101
+ config = config.replace(
102
+ /(plugins:\s*\n)/,
103
+ `$1 entries:\n${callmeConfig}\n`
104
+ );
91
105
  } else {
92
- fs.mkdirSync(path.dirname(CONFIG_FILE), { recursive: true });
93
- fs.writeFileSync(CONFIG_FILE, configContent);
106
+ // Append full plugins section
107
+ config += `\nplugins:\n entries:\n${callmeConfig}\n`;
94
108
  }
109
+
110
+ fs.writeFileSync(CONFIG_FILE, config);
95
111
  console.log('āœ… Config updated');
96
112
 
97
113
  // Done!