@mobcode/openclaw-plugin 0.1.11 → 0.1.13
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
|
@@ -110,7 +110,14 @@ function readTranscriptMessages(filePath) {
|
|
|
110
110
|
|
|
111
111
|
export async function readSessionMessagesFromRuntime({ runtime, config, sessionKey, logger }) {
|
|
112
112
|
const normalizedSessionKey = trim(sessionKey);
|
|
113
|
-
if (!normalizedSessionKey
|
|
113
|
+
if (!normalizedSessionKey) {
|
|
114
|
+
logger?.warn?.("[mobcode-history] runtime reader skipped reason=missing_session_key");
|
|
115
|
+
return [];
|
|
116
|
+
}
|
|
117
|
+
if (!runtime?.agent?.session) {
|
|
118
|
+
logger?.warn?.(
|
|
119
|
+
`[mobcode-history] runtime reader skipped session=${normalizedSessionKey} reason=missing_runtime_agent_session runtimeKeys=${runtime && typeof runtime === "object" ? Object.keys(runtime).join(",") || "-" : "-"}`,
|
|
120
|
+
);
|
|
114
121
|
return [];
|
|
115
122
|
}
|
|
116
123
|
const candidates = resolveStoreCandidates(runtime, config, normalizedSessionKey);
|
package/src/state-store.js
CHANGED
|
@@ -918,8 +918,10 @@ export class MobcodeStateStore {
|
|
|
918
918
|
);
|
|
919
919
|
const now = new Date().toISOString();
|
|
920
920
|
|
|
921
|
-
const
|
|
922
|
-
|
|
921
|
+
const db = this._db();
|
|
922
|
+
db.exec("BEGIN");
|
|
923
|
+
try {
|
|
924
|
+
for (const item of messages) {
|
|
923
925
|
const normalizedMessage = normalizeMessageObject(item, item?.id ?? null);
|
|
924
926
|
const messageId = String(normalizedMessage?.id ?? "").trim() || null;
|
|
925
927
|
const sourceKey = createMessageSourceKey(
|
|
@@ -965,9 +967,15 @@ export class MobcodeStateStore {
|
|
|
965
967
|
}
|
|
966
968
|
}
|
|
967
969
|
touchSession.run(normalizedSessionKey, now);
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
970
|
+
db.exec("COMMIT");
|
|
971
|
+
} catch (error) {
|
|
972
|
+
try {
|
|
973
|
+
db.exec("ROLLBACK");
|
|
974
|
+
} catch {
|
|
975
|
+
// Ignore rollback failures so the original write error is preserved.
|
|
976
|
+
}
|
|
977
|
+
throw error;
|
|
978
|
+
}
|
|
971
979
|
this.logger?.info?.(
|
|
972
980
|
`[mobcode-store] indexed session=${normalizedSessionKey} messages=${messages.length}`,
|
|
973
981
|
);
|