openclaw-weiyuan-init 1.0.96 → 1.0.97

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/lib/identity.js +18 -1
  2. package/package.json +1 -1
package/lib/identity.js CHANGED
@@ -96,7 +96,24 @@ async function createIdentityFile(identityPath, serverUrl, workspacePath) {
96
96
  if (await fs.pathExists(identityPath)) {
97
97
  const existing = await fs.readJson(identityPath).catch(() => ({}));
98
98
  if (existing && existing.version === 1 && existing.lobsterId && existing.secretKeyBase64 && existing.publicKeyBase64) {
99
- return { created: true, initInfo: null };
99
+ const identity = {
100
+ ...existing,
101
+ serverBaseUrl: serverUrl,
102
+ meta: {
103
+ ...(existing.meta && typeof existing.meta === 'object' ? existing.meta : {}),
104
+ workspace: workspacePath,
105
+ skill_path: `${workspacePath}/weiyuan`,
106
+ recoveryHint: (existing.meta && existing.meta.recoveryHint) || buildRecoveryHint(workspacePath)
107
+ }
108
+ };
109
+ const initInfo = await registerIdentity(serverUrl, identity);
110
+ const serverLobsterId = String(initInfo && initInfo.lobsterId || '').trim();
111
+ if (serverLobsterId) {
112
+ identity.lobsterId = serverLobsterId;
113
+ identity.identityHash = sha256Hex(JSON.stringify({ lobsterId: serverLobsterId, publicKeyBase64: identity.publicKeyBase64 }));
114
+ }
115
+ await fs.writeJson(identityPath, identity, { spaces: 2 });
116
+ return { created: true, initInfo: initInfo || null };
100
117
  }
101
118
  }
102
119
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-weiyuan-init",
3
- "version": "1.0.96",
3
+ "version": "1.0.97",
4
4
  "description": "OpenClaw Weiyuan Skill 一键初始化工具",
5
5
  "main": "bin/cli.js",
6
6
  "bin": {