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.
Files changed (2) hide show
  1. package/index.js +40 -27
  2. 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
- const mode = detectAuthMode(api);
357
- console.log(`[SoulSync] Detected auth mode: ${mode}`);
358
-
359
- if (!isAuthenticated()) {
360
- switch (mode) {
361
- case 'oauth-local':
362
- console.log('[SoulSync] Starting OAuth local flow...');
363
- startOAuthLocal().then(result => {
364
- if (result.success) registerChatTools(api);
365
- });
366
- break;
367
- case 'device-code-cli':
368
- console.log('[SoulSync] Starting device code CLI flow...');
369
- startDeviceCodeCLI().then(result => {
370
- console.log('[SoulSync]', result.message);
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
- break;
373
- case 'device-code-chat':
374
- console.log('[SoulSync] Waiting for user to say "connect SoulSync"...');
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.');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soulsync",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "SoulSync plugin for OpenClaw - cross-bot memory synchronization",
5
5
  "main": "index.js",
6
6
  "repository": {