@mobcode/openclaw-plugin 0.1.12 → 0.1.14

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.12",
3
+ "version": "0.1.14",
4
4
  "description": "MobCode integration plugin for OpenClaw",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -183,6 +183,7 @@ export function registerMobcodeTools({ api, store }) {
183
183
  if (!sessionKey) {
184
184
  throw new Error("sessionKey is required for present_artifact.");
185
185
  }
186
+ await store.init();
186
187
  const document = normalizeArtifactDocument(args.artifact);
187
188
  const saved = await store.upsertArtifact({
188
189
  sessionKey,
@@ -918,8 +918,10 @@ export class MobcodeStateStore {
918
918
  );
919
919
  const now = new Date().toISOString();
920
920
 
921
- const transaction = this._db().transaction((items) => {
922
- for (const item of items) {
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
- transaction(messages);
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
  );