soulsync 1.0.5 → 1.0.7

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "cloud_url": "https://soulsync.work",
3
- "email": "your-email@example.com",
4
- "password": "your-password",
3
+ "email": "",
4
+ "password": "",
5
5
  "workspace": "./workspace",
6
6
  "memory_file": "MEMORY.md",
7
7
  "watch_files": [
@@ -13,5 +13,6 @@
13
13
  "skills.json",
14
14
  "memory/",
15
15
  "MEMORY.md"
16
- ]
16
+ ],
17
+ "_comment": "Register at https://soulsync.work or use curl to call /api/auth/register endpoint"
17
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soulsync",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "SoulSync plugin for OpenClaw - cross-bot memory synchronization",
5
5
  "main": "index.js",
6
6
  "repository": {
package/src/client.py CHANGED
@@ -124,8 +124,12 @@ class OpenClawClient:
124
124
  print(f"Logged in: {email}")
125
125
  return result
126
126
  elif response.status_code == 401:
127
- # Login failed, try register (not supported in this flow)
127
+ # Login failed
128
128
  raise Exception(f"Invalid email or password / 邮箱或密码错误")
129
+ elif response.status_code == 429:
130
+ # Rate limited
131
+ error = response.json().get('error', 'Too many attempts')
132
+ raise Exception(f"429: {error}")
129
133
  else:
130
134
  error = response.json().get('error', 'Unknown error')
131
135
  raise Exception(f"Authentication failed: {error}")
package/src/main.py CHANGED
@@ -21,8 +21,6 @@ from watcher import OpenClawMultiWatcher
21
21
  from version_manager import VersionManager
22
22
  from profiles import ProfilesClient
23
23
  from sync import ProfileSync
24
- from register import Register, Login
25
- from interactive_auth import prompt_for_missing_config, interactive_setup, check_existing_config
26
24
 
27
25
 
28
26
  class SoulSyncPlugin:
@@ -42,14 +40,14 @@ class SoulSyncPlugin:
42
40
  config_path = os.path.normpath(os.path.join(PLUGIN_DIR, 'config.json'))
43
41
  config_example_path = os.path.normpath(os.path.join(PLUGIN_DIR, 'config.json.example'))
44
42
 
45
- print(f"Looking for config at: {config_path}")
43
+ print(f"[SoulSync] Looking for config at: {config_path}")
46
44
 
47
45
  if not os.path.exists(config_path):
48
46
  if os.path.exists(config_example_path):
49
- print("Config file not found, copying from config.json.example...")
47
+ print("[SoulSync] Config file not found, copying from config.json.example...")
50
48
  import shutil
51
49
  shutil.copy(config_example_path, config_path)
52
- print(f"Created config.json from template")
50
+ print("[SoulSync] Created config.json from template")
53
51
  else:
54
52
  raise FileNotFoundError(f"Config file not found: {config_path}")
55
53
 
@@ -59,25 +57,24 @@ class SoulSyncPlugin:
59
57
  except json.JSONDecodeError as e:
60
58
  raise ValueError(f"Invalid JSON in config.json: {e}")
61
59
 
62
- # 检查必要配置
63
60
  cloud_url = self.config.get('cloud_url', '').strip()
64
61
  email = self.config.get('email', '').strip()
65
62
  password = self.config.get('password', '').strip()
66
63
 
67
- # 如果 cloud_url 为空,设置为默认值
68
64
  if not cloud_url:
69
65
  self.config['cloud_url'] = 'https://soulsync.work'
70
- print("Cloud URL not set, using default: https://soulsync.work")
66
+ print("[SoulSync] Cloud URL not set, using default: https://soulsync.work")
71
67
 
72
- # 如果 email password 为空,需要交互式认证
73
- if not email or not password:
74
- print("\nEmail or password not configured, initiating interactive setup...")
75
- self._interactive_setup()
76
- # 重新加载配置
77
- with open(config_path, 'r', encoding='utf-8') as f:
78
- self.config = json.load(f)
68
+ if not email or not password or email == 'your-email@example.com' or password == 'your-password':
69
+ print("\n[SoulSync] ========================================")
70
+ print("[SoulSync] Please configure your account first / 请先配置账号")
71
+ print("[SoulSync] ========================================")
72
+ print("[SoulSync] Edit config file / 编辑配置文件:")
73
+ print(f" {config_path}")
74
+ print("[SoulSync] Set your email and password, then restart / 填写邮箱和密码后重启")
75
+ print("[SoulSync] ========================================\n")
76
+ sys.exit(0)
79
77
 
80
- # 处理 workspace 路径
81
78
  workspace = self.config.get('workspace', './workspace')
82
79
  if workspace.startswith('./'):
83
80
  workspace = workspace[2:]
@@ -88,39 +85,10 @@ class SoulSyncPlugin:
88
85
  self.config['workspace'] = workspace
89
86
  self.config['watch_files'] = watch_files
90
87
 
91
- print(f"Config loaded:")
92
- print(f" Cloud URL: {self.config.get('cloud_url')}")
93
- print(f" Workspace: {workspace}")
94
- print(f" Watch files: {watch_files}")
95
-
96
- def _interactive_setup(self):
97
- """交互式设置:引导用户登录或注册"""
98
- from register import Register, Login
99
- from interactive_auth import interactive_setup
100
-
101
- print("\n=== First run - Please login or register / 首次运行,请先登录或注册 ===\n")
102
- print("1. Login / 登录(已有账号)")
103
- print("2. Register / 注册(新用户)")
104
-
105
- choice = input("Choose (1/2): ").strip()
106
-
107
- if choice == '1':
108
- # 先创建临时 client 用于登录
109
- temp_client = OpenClawClient(self.config)
110
- login = Login(temp_client)
111
- result = login.run()
112
- if result:
113
- # 保存认证信息到 config
114
- self._save_auth_to_config(result)
115
- elif choice == '2':
116
- temp_client = OpenClawClient(self.config)
117
- register = Register(temp_client)
118
- result = register.run()
119
- if result:
120
- self._save_auth_to_config(result)
121
- else:
122
- print("Invalid choice / 无效选择")
123
- sys.exit(1)
88
+ print(f"[SoulSync] Config loaded:")
89
+ print(f" Cloud URL: {self.config.get('cloud_url')}")
90
+ print(f" Workspace: {workspace}")
91
+ print(f" Watch files: {watch_files}")
124
92
 
125
93
  def _save_auth_to_config(self, auth_result):
126
94
  """保存认证结果到 config.json"""
@@ -147,7 +115,9 @@ class SoulSyncPlugin:
147
115
 
148
116
  def initialize(self):
149
117
  """初始化组件"""
150
- print("\n=== Initializing SoulSync Plugin ===\n")
118
+ print("\n[SoulSync] ========================================")
119
+ print("[SoulSync] Initializing SoulSync Plugin")
120
+ print("[SoulSync] ========================================\n")
151
121
 
152
122
  self.client = OpenClawClient(self.config)
153
123
 
@@ -155,38 +125,49 @@ class SoulSyncPlugin:
155
125
  if token:
156
126
  try:
157
127
  profile = self.client.get_profile()
158
- print(f"Using existing token, user: {profile.get('email', 'unknown')}")
128
+ print(f"[SoulSync] Using existing token, user: {profile.get('email', 'unknown')}")
159
129
  except Exception as e:
160
- print(f"Token invalid / 令牌无效, re-authenticating: {e}")
130
+ print(f"[SoulSync] Token invalid, re-authenticating: {e}")
161
131
  token = None
162
132
 
163
133
  if not token:
164
- print("\n=== Token invalid - Please login or register / 令牌无效,请先登录或注册 ===\n")
165
- print("1. Login / 登录(已有账号)")
166
- print("2. Register / 注册(新用户)")
167
-
168
- choice = input("Choose (1/2): ").strip()
169
-
170
- if choice == '1':
171
- login = Login(self.client)
172
- result = login.run()
173
- elif choice == '2':
174
- register = Register(self.client)
175
- result = register.run()
176
- else:
177
- print("Invalid choice / 无效选择")
178
- sys.exit(1)
134
+ email = self.config.get('email', '').strip()
135
+ password = self.config.get('password', '').strip()
136
+
137
+ print("[SoulSync] No valid token, attempting auto-login...")
138
+ try:
139
+ result = self.client.authenticate(email, password)
140
+ if result:
141
+ print("[SoulSync] Login successful! / 登录成功!")
142
+ self._save_auth_to_config(result)
143
+ token = self.client.token
144
+ except Exception as e:
145
+ error_msg = str(e)
146
+ print(f"[SoulSync] Login failed: {e}")
147
+
148
+ if "429" in error_msg or "too many" in error_msg.lower():
149
+ print("\n[SoulSync] ========================================")
150
+ print("[SoulSync] Too many failed attempts. Please try again later / 登录失败次数过多,请稍后再试")
151
+ print("[SoulSync] ========================================\n")
152
+ else:
153
+ print("\n[SoulSync] ========================================")
154
+ print("[SoulSync] Login failed: invalid email or password / 登录失败:邮箱或密码错误")
155
+ print("[SoulSync] Please check your config file / 请检查配置文件:")
156
+ print(f" {os.path.normpath(os.path.join(PLUGIN_DIR, 'config.json'))}")
157
+ print("[SoulSync] ========================================\n")
158
+
159
+ sys.exit(0)
179
160
 
180
161
  email = self.config.get('email')
181
162
  password = self.config.get('password')
182
163
 
183
164
  try:
184
165
  profile = self.client.get_profile()
185
- print(f"\nLogged in as: {profile.get('email')}")
166
+ print(f"\n[SoulSync] Logged in as: {profile.get('email')}")
186
167
  subscription = profile.get('subscription', {})
187
- print(f"Subscription: {subscription.get('status')} (days remaining: {subscription.get('daysRemaining', 0)})\n")
168
+ print(f"[SoulSync] Subscription: {subscription.get('status')} (days remaining: {subscription.get('daysRemaining', 0)})\n")
188
169
  except Exception as e:
189
- print(f"Warning: Could not get profile: {e}")
170
+ print(f"[SoulSync] Warning: Could not get profile: {e}")
190
171
 
191
172
  # 版本管理器
192
173
  versions_file = os.path.normpath(os.path.join(PLUGIN_DIR, 'versions.json'))
package/src/main_fixed.py CHANGED
@@ -86,7 +86,7 @@ class SoulSyncPlugin:
86
86
 
87
87
  # 设置默认服务器
88
88
  if not self.config.get('cloud_url'):
89
- self.config['cloud_url'] = 'http://47.96.170.74:3000'
89
+ self.config['cloud_url'] = 'https://soulsync.work'
90
90
  print(f"使用默认服务器: {self.config['cloud_url']}")
91
91
  print()
92
92