callme-openclaw-plugin 1.0.7 โ 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.
- package/openclaw.plugin.json +0 -1
- package/package.json +1 -1
- package/setup.js +52 -70
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
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,91 +46,74 @@ async function main() {
|
|
|
47
46
|
process.exit(1);
|
|
48
47
|
}
|
|
49
48
|
|
|
50
|
-
// Step 3:
|
|
51
|
-
console.log('\n
|
|
49
|
+
// Step 3: Install plugin FIRST (apiKey is optional in schema, so install won't fail)
|
|
50
|
+
console.log('\n๐ฆ Installing plugin...');
|
|
52
51
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
''
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
''
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
config = config.replace(
|
|
68
|
-
/(\s+callme:\s*\n(?:\s+\w+:.*\n)*?)(?=\n\s{0,4}\w|$)/g,
|
|
69
|
-
''
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
fs.writeFileSync(CONFIG_FILE, config);
|
|
73
|
-
console.log('โ
Stale config removed');
|
|
52
|
+
try {
|
|
53
|
+
await execAsync('openclaw plugins install callme-openclaw-plugin 2>&1');
|
|
54
|
+
console.log('โ
Plugin installed');
|
|
55
|
+
} catch (error) {
|
|
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
|
+
}
|
|
74
66
|
}
|
|
75
67
|
|
|
76
|
-
// Step 4:
|
|
68
|
+
// Step 4: Write config AFTER plugin install
|
|
77
69
|
console.log('\nโ๏ธ Writing plugin config...');
|
|
78
70
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
71
|
+
if (!fs.existsSync(CONFIG_FILE)) {
|
|
72
|
+
console.error('โ Config file not found at:', CONFIG_FILE);
|
|
73
|
+
console.log('Run: openclaw config');
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
let config = fs.readFileSync(CONFIG_FILE, 'utf8');
|
|
78
|
+
|
|
79
|
+
// Strategy: Find and replace or append
|
|
80
|
+
const callmeConfig = ` callme:
|
|
82
81
|
enabled: true
|
|
83
82
|
config:
|
|
84
83
|
apiKey: "${apiKey}"
|
|
85
84
|
defaultVoice: "nova"
|
|
86
|
-
language: "en"
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
)
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
config += configAddition;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
fs.writeFileSync(CONFIG_FILE, config);
|
|
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
|
+
);
|
|
110
105
|
} else {
|
|
111
|
-
|
|
112
|
-
|
|
106
|
+
// Append full plugins section
|
|
107
|
+
config += `\nplugins:\n entries:\n${callmeConfig}\n`;
|
|
113
108
|
}
|
|
114
|
-
console.log('โ
Config written');
|
|
115
|
-
|
|
116
|
-
// Step 5: Install plugin via OpenClaw CLI
|
|
117
|
-
console.log('\n๐ฆ Installing plugin...');
|
|
118
109
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
await execAsync('openclaw plugins install callme-openclaw-plugin');
|
|
122
|
-
console.log('โ
Plugin installed');
|
|
123
|
-
} catch (error) {
|
|
124
|
-
console.error('โ Failed to install plugin:', error.message);
|
|
125
|
-
console.log('\n๐ Manual fallback:');
|
|
126
|
-
console.log(' 1. Run: openclaw plugins install callme-openclaw-plugin');
|
|
127
|
-
console.log(' 2. Restart gateway: openclaw gateway restart');
|
|
128
|
-
process.exit(1);
|
|
129
|
-
}
|
|
110
|
+
fs.writeFileSync(CONFIG_FILE, config);
|
|
111
|
+
console.log('โ
Config updated');
|
|
130
112
|
|
|
131
113
|
// Done!
|
|
132
114
|
console.log('\nโจ \x1b[1;32mSetup complete!\x1b[0m\n');
|
|
133
115
|
|
|
134
|
-
// Step
|
|
116
|
+
// Step 5: Offer to restart gateway
|
|
135
117
|
const shouldRestart = await question('๐ Restart OpenClaw Gateway now? (y/n): ');
|
|
136
118
|
|
|
137
119
|
if (shouldRestart.toLowerCase() === 'y' || shouldRestart.toLowerCase() === 'yes') {
|