@clawchatsai/connector 0.0.6 → 0.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/dist/index.js +26 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -453,7 +453,12 @@ async function handleSetup(token) {
|
|
|
453
453
|
else if (msg.type === 'setup-error') {
|
|
454
454
|
clearTimeout(timeout);
|
|
455
455
|
ws.close();
|
|
456
|
-
|
|
456
|
+
const reasons = {
|
|
457
|
+
'invalid_or_expired_token': 'Setup token is invalid or has expired. Generate a new one at clawchats.ai.',
|
|
458
|
+
'missing_fields': 'Setup failed: malformed token. Try copying the command again.',
|
|
459
|
+
};
|
|
460
|
+
const message = reasons[msg.reason] ?? `Setup failed: ${msg.reason}. Try again or visit clawchats.ai for support.`;
|
|
461
|
+
reject(new Error(message));
|
|
457
462
|
}
|
|
458
463
|
});
|
|
459
464
|
ws.on('error', (err) => {
|
|
@@ -554,6 +559,26 @@ async function handleImport(sourcePath, opts) {
|
|
|
554
559
|
}
|
|
555
560
|
console.log(`Databases: ${imported} imported, ${skipped} skipped.`);
|
|
556
561
|
}
|
|
562
|
+
// Import .json config files (workspaces.json, settings.json, etc.)
|
|
563
|
+
const jsonFiles = fs.readdirSync(resolvedSource).filter(f => f.endsWith('.json'));
|
|
564
|
+
if (jsonFiles.length > 0) {
|
|
565
|
+
let jsonImported = 0;
|
|
566
|
+
let jsonSkipped = 0;
|
|
567
|
+
for (const file of jsonFiles) {
|
|
568
|
+
const src = path.join(resolvedSource, file);
|
|
569
|
+
const dst = path.join(destDataDir, file);
|
|
570
|
+
if (fs.existsSync(dst) && !opts.force) {
|
|
571
|
+
console.log(` Skipping ${file} (already exists — use --force to overwrite)`);
|
|
572
|
+
jsonSkipped++;
|
|
573
|
+
}
|
|
574
|
+
else {
|
|
575
|
+
fs.copyFileSync(src, dst);
|
|
576
|
+
console.log(` ✓ ${file}`);
|
|
577
|
+
jsonImported++;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
console.log(`Config files: ${jsonImported} imported, ${jsonSkipped} skipped.`);
|
|
581
|
+
}
|
|
557
582
|
// Also try to migrate config.json from the parent directory
|
|
558
583
|
// e.g. if source is ~/.openclaw/shellchat/data/, config is at ~/.openclaw/shellchat/config.json
|
|
559
584
|
const parentConfigPath = path.join(path.dirname(resolvedSource), 'config.json');
|