@mobcode/openclaw-plugin 0.1.23 → 0.1.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mobcode/openclaw-plugin",
3
- "version": "0.1.23",
3
+ "version": "0.1.24",
4
4
  "description": "MobCode integration plugin for OpenClaw",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -90,40 +90,56 @@ export function createMobcodePluginDefinition() {
90
90
  );
91
91
  });
92
92
  api.on("tool_result_persist", (event, ctx) => {
93
+ const toolCallId =
94
+ String(event?.message?.toolCallId ?? "").trim() ||
95
+ String(event?.toolCallId ?? "").trim() ||
96
+ String(ctx?.toolCallId ?? "").trim() ||
97
+ undefined;
98
+ const toolName =
99
+ String(event?.message?.toolName ?? "").trim() ||
100
+ String(event?.toolName ?? "").trim() ||
101
+ String(ctx?.toolName ?? "").trim() ||
102
+ undefined;
103
+ const messageId =
104
+ typeof event?.message?.id === "string" && event.message.id.trim()
105
+ ? event.message.id.trim()
106
+ : toolCallId;
107
+ const persistedMessage = {
108
+ ...(event?.message ?? {}),
109
+ role: event?.message?.role ?? "toolResult",
110
+ ...(toolCallId ? { toolCallId } : {}),
111
+ ...(toolName ? { toolName } : {}),
112
+ ...(messageId ? { id: messageId } : {}),
113
+ };
93
114
  console.warn(
94
115
  "[mobcode-direct-debug] tool_result_persist enter",
95
116
  "sessionKey=",
96
117
  String(ctx?.sessionKey ?? "").trim() || "-",
97
118
  "toolCallId=",
98
- String(event?.toolCallId ?? "").trim() || "-",
119
+ toolCallId ?? "-",
99
120
  "toolName=",
100
- String(event?.toolName ?? "").trim() || "-",
121
+ toolName ?? "-",
101
122
  "messageId=",
102
- typeof event?.message?.id === "string" && event.message.id.trim()
103
- ? event.message.id.trim()
104
- : "-",
123
+ messageId ?? "-",
105
124
  "role=",
106
- String(event?.message?.role ?? "").trim() || "-",
125
+ String(persistedMessage.role ?? "").trim() || "-",
107
126
  );
108
127
  log.warn(
109
- `[mobcode-debug] tool_result_persist sessionKey=${String(ctx?.sessionKey ?? "").trim() || "-"} toolCallId=${String(event?.toolCallId ?? "").trim() || "-"} toolName=${String(event?.toolName ?? "").trim() || "-"} messageId=${typeof event?.message?.id === "string" && event.message.id.trim() ? event.message.id.trim() : "-"}`,
128
+ `[mobcode-debug] tool_result_persist sessionKey=${String(ctx?.sessionKey ?? "").trim() || "-"} toolCallId=${toolCallId ?? "-"} toolName=${toolName ?? "-"} messageId=${messageId ?? "-"}`,
110
129
  );
111
130
  console.warn(
112
131
  "[mobcode-direct-debug] before appendMessageSync",
113
132
  "sessionKey=",
114
133
  String(ctx?.sessionKey ?? "").trim() || "-",
115
134
  "toolCallId=",
116
- String(event?.toolCallId ?? "").trim() || "-",
135
+ toolCallId ?? "-",
117
136
  "toolName=",
118
- String(event?.toolName ?? "").trim() || "-",
137
+ toolName ?? "-",
119
138
  );
120
139
  store.appendMessageSync({
121
140
  sessionKey: ctx?.sessionKey,
122
- message: event?.message,
123
- messageId:
124
- typeof event?.message?.id === "string" && event.message.id.trim()
125
- ? event.message.id.trim()
126
- : undefined,
141
+ message: persistedMessage,
142
+ messageId,
127
143
  });
128
144
  console.warn("[mobcode-direct-debug] after appendMessageSync");
129
145
  });