soulsync 1.0.16 → 1.0.17
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 +40 -27
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -352,33 +352,47 @@ async function startDeviceCodeFlow() {
|
|
|
352
352
|
|
|
353
353
|
module.exports = function register(api) {
|
|
354
354
|
console.log('[SoulSync] Registering plugin...');
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
if (
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
355
|
+
|
|
356
|
+
registerChatTools(api);
|
|
357
|
+
|
|
358
|
+
api.registerCli(
|
|
359
|
+
({ program }) => {
|
|
360
|
+
program
|
|
361
|
+
.command('soulsync:start')
|
|
362
|
+
.description('启动 SoulSync 同步服务')
|
|
363
|
+
.action(async () => {
|
|
364
|
+
if (!isAuthenticated()) {
|
|
365
|
+
console.log('[SoulSync] Not configured. Starting device authorization flow...');
|
|
366
|
+
|
|
367
|
+
const authMode = detectAuthMode(null);
|
|
368
|
+
let result;
|
|
369
|
+
|
|
370
|
+
if (authMode === 'oauth-local') {
|
|
371
|
+
result = await startOAuthLocal();
|
|
372
|
+
} else if (authMode === 'device-code-cli') {
|
|
373
|
+
result = await startDeviceCodeCLI();
|
|
374
|
+
} else {
|
|
375
|
+
result = await startDeviceCodeFlow();
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
if (result.success) {
|
|
379
|
+
console.log(result.message);
|
|
380
|
+
} else {
|
|
381
|
+
console.error(`[SoulSync] ${result.message}`);
|
|
382
|
+
}
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
if (pythonProcess) {
|
|
387
|
+
console.log('[SoulSync] Service already running');
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
startPythonService('--start');
|
|
371
392
|
});
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
break;
|
|
376
|
-
}
|
|
377
|
-
} else {
|
|
378
|
-
console.log('[SoulSync] Already authenticated, starting sync...');
|
|
379
|
-
startPythonService('--start');
|
|
380
|
-
registerChatTools(api);
|
|
381
|
-
}
|
|
393
|
+
},
|
|
394
|
+
{ commands: ['soulsync:start'] }
|
|
395
|
+
);
|
|
382
396
|
|
|
383
397
|
function registerChatTools(api) {
|
|
384
398
|
api.registerTool({
|
|
@@ -578,7 +592,6 @@ module.exports = function register(api) {
|
|
|
578
592
|
if (isAuthenticated()) {
|
|
579
593
|
console.log('[SoulSync] Auto-starting sync service...');
|
|
580
594
|
startPythonService('--start');
|
|
581
|
-
registerChatTools(api);
|
|
582
595
|
}
|
|
583
596
|
|
|
584
597
|
console.log('[SoulSync] Plugin loaded. Run "openclaw soulsync:start" to begin.');
|