@mobcode/openclaw-plugin 0.1.25 → 0.1.27
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 +1 -1
- package/src/plugin-definition.js +27 -8
package/package.json
CHANGED
package/src/plugin-definition.js
CHANGED
|
@@ -118,6 +118,7 @@ export function createMobcodePluginDefinition() {
|
|
|
118
118
|
rootDir: path.join(stateDir, "plugins", "mobcode"),
|
|
119
119
|
logger: log,
|
|
120
120
|
});
|
|
121
|
+
const storeReady = store.init();
|
|
121
122
|
|
|
122
123
|
log.warn(`[mobcode-debug] register loggerShape ${describeLoggerShape(api)}`);
|
|
123
124
|
|
|
@@ -159,7 +160,7 @@ export function createMobcodePluginDefinition() {
|
|
|
159
160
|
api,
|
|
160
161
|
store,
|
|
161
162
|
});
|
|
162
|
-
api.on("after_tool_call", (event, ctx) => {
|
|
163
|
+
api.on("after_tool_call", async (event, ctx) => {
|
|
163
164
|
const persistedMessage = buildPersistedToolResultFromAfterToolCall(event, ctx);
|
|
164
165
|
const messageId =
|
|
165
166
|
typeof persistedMessage?.id === "string" && persistedMessage.id.trim()
|
|
@@ -172,7 +173,14 @@ export function createMobcodePluginDefinition() {
|
|
|
172
173
|
return;
|
|
173
174
|
}
|
|
174
175
|
console.warn(
|
|
175
|
-
"[mobcode-direct-debug] after_tool_call
|
|
176
|
+
"[mobcode-direct-debug] after_tool_call store target",
|
|
177
|
+
"rootDir=",
|
|
178
|
+
store.rootDir,
|
|
179
|
+
"databasePath=",
|
|
180
|
+
store.databasePath,
|
|
181
|
+
);
|
|
182
|
+
console.warn(
|
|
183
|
+
"[mobcode-direct-debug] after_tool_call before appendMessage",
|
|
176
184
|
"sessionKey=",
|
|
177
185
|
String(ctx?.sessionKey ?? "").trim() || "-",
|
|
178
186
|
"toolCallId=",
|
|
@@ -182,12 +190,23 @@ export function createMobcodePluginDefinition() {
|
|
|
182
190
|
"messageId=",
|
|
183
191
|
messageId ?? "-",
|
|
184
192
|
);
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
193
|
+
try {
|
|
194
|
+
await storeReady;
|
|
195
|
+
const appendResult = await store.appendMessage({
|
|
196
|
+
sessionKey: ctx?.sessionKey,
|
|
197
|
+
message: persistedMessage,
|
|
198
|
+
messageId,
|
|
199
|
+
});
|
|
200
|
+
console.warn(
|
|
201
|
+
"[mobcode-direct-debug] after_tool_call appendMessage result",
|
|
202
|
+
JSON.stringify(appendResult ?? null),
|
|
203
|
+
);
|
|
204
|
+
} catch (error) {
|
|
205
|
+
console.warn(
|
|
206
|
+
"[mobcode-direct-debug] after_tool_call appendMessage failed",
|
|
207
|
+
String(error),
|
|
208
|
+
);
|
|
209
|
+
}
|
|
191
210
|
});
|
|
192
211
|
api.on("tool_result_persist", (event, ctx) => {
|
|
193
212
|
const { toolCallId, toolName } = resolveToolIdentity(event, ctx);
|