openclaw-sync-assistant 0.0.4 → 0.0.6

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 CHANGED
@@ -14,7 +14,6 @@ module.exports = {
14
14
  * @param {object} context - OpenClaw 提供的上下文对象,包含 api 等
15
15
  */
16
16
  async activate(context) {
17
- // 仅在明确启用 DEBUG 的情况下输出激活日志
18
17
  if (process.env.DEBUG === "openclaw:sync") {
19
18
  console.log("✅ openclaw-sync-assistant 插件已激活!");
20
19
  }
@@ -25,10 +24,13 @@ module.exports = {
25
24
  },
26
25
 
27
26
  /**
28
- * 注册命令处理函数
27
+ * 插件命令执行函数 (通过 openclaw.plugin.json 中的 commands 声明触发)
28
+ * @param {string} commandId - 触发的命令 ID
29
+ * @param {object} args - 命令参数
30
+ * @param {object} context - OpenClaw 插件上下文
29
31
  */
30
- async executeCommand(command, context) {
31
- if (command === "sync.setup") {
32
+ async executeCommand(commandId, args, context) {
33
+ if (commandId === "sync.setup") {
32
34
  console.log("\n");
33
35
  intro(pc.bgCyan(pc.black(" OpenClaw Sync Assistant Setup ")));
34
36
 
@@ -94,8 +96,13 @@ module.exports = {
94
96
  `正在初始化 [${syncMethod.toUpperCase()} - ${syncMode}] 同步服务...`,
95
97
  );
96
98
 
97
- // 模拟保存配置 (实际应使用 context.api.config.update 等方法)
98
- if (context.api && context.api.config && context.api.config.update) {
99
+ // 如果通过 executeCommand 传入的 context 带有 api,则更新配置
100
+ if (
101
+ context &&
102
+ context.api &&
103
+ context.api.config &&
104
+ context.api.config.update
105
+ ) {
99
106
  await context.api.config.update(
100
107
  "openclaw-sync-assistant.syncMethod",
101
108
  syncMethod,
@@ -118,9 +125,14 @@ module.exports = {
118
125
  "openclaw-sync-assistant.syncItems",
119
126
  syncItems,
120
127
  );
128
+ } else {
129
+ if (process.env.DEBUG === "openclaw:sync") {
130
+ console.log(
131
+ "提示: 未找到 context.api.config.update,配置未持久化保存。",
132
+ );
133
+ }
121
134
  }
122
135
 
123
- // 模拟启动相关服务等耗时操作
124
136
  await new Promise((resolve) => setTimeout(resolve, 1500));
125
137
 
126
138
  s.stop("配置已保存!");
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "openclaw-sync-assistant",
3
3
  "name": "openclaw-sync-assistant",
4
- "version": "0.0.4",
4
+ "version": "0.0.6",
5
5
  "description": "OpenClaw Sync Assistant Plugin",
6
6
  "commands": [
7
7
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-sync-assistant",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "An OpenClaw plugin for P2P file and data synchronization using Hyperswarm and Hyperdrive ecosystem.",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",