soulsync 1.0.14 → 1.0.15
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/index.js +23 -9
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -402,13 +402,13 @@ module.exports = function register(api) {
|
|
|
402
402
|
|
|
403
403
|
api.registerTool({
|
|
404
404
|
name: 'soulsync_connect',
|
|
405
|
-
description: '
|
|
405
|
+
description: '连接 SoulSync 灵魂同步服务。当用户说"安装soulsync"、"配置soulsync"、"连接soulsync"、"设置同步"、"开启灵魂同步"时调用。无需账号密码,会提供浏览器授权链接。',
|
|
406
406
|
input_schema: { type: 'object', properties: {}, required: [] }
|
|
407
407
|
}, async () => {
|
|
408
408
|
if (isAuthenticated()) {
|
|
409
|
-
return 'SoulSync
|
|
409
|
+
return 'SoulSync 已连接。使用 soulsync_status 查看状态。';
|
|
410
410
|
}
|
|
411
|
-
|
|
411
|
+
|
|
412
412
|
const result = await startDeviceCodeFlow();
|
|
413
413
|
return result.message;
|
|
414
414
|
});
|
|
@@ -527,20 +527,34 @@ module.exports = function register(api) {
|
|
|
527
527
|
program
|
|
528
528
|
.command('soulsync:start')
|
|
529
529
|
.description('启动 SoulSync 同步服务')
|
|
530
|
-
.action(() => {
|
|
530
|
+
.action(async () => {
|
|
531
531
|
if (!isAuthenticated()) {
|
|
532
532
|
console.log('[SoulSync] Not configured. Starting device authorization flow...');
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
533
|
+
|
|
534
|
+
const authMode = detectAuthMode(null);
|
|
535
|
+
let result;
|
|
536
|
+
|
|
537
|
+
if (authMode === 'oauth-local') {
|
|
538
|
+
result = await startOAuthLocal();
|
|
539
|
+
} else if (authMode === 'device-code-cli') {
|
|
540
|
+
result = await startDeviceCodeCLI();
|
|
541
|
+
} else {
|
|
542
|
+
result = await startDeviceCodeFlow();
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
if (result.success) {
|
|
546
|
+
console.log(result.message);
|
|
547
|
+
} else {
|
|
548
|
+
console.error(`[SoulSync] ${result.message}`);
|
|
549
|
+
}
|
|
536
550
|
return;
|
|
537
551
|
}
|
|
538
|
-
|
|
552
|
+
|
|
539
553
|
if (pythonProcess) {
|
|
540
554
|
console.log('[SoulSync] Service already running');
|
|
541
555
|
return;
|
|
542
556
|
}
|
|
543
|
-
|
|
557
|
+
|
|
544
558
|
startPythonService('--start');
|
|
545
559
|
});
|
|
546
560
|
},
|