@mobcode/openclaw-plugin 0.1.10 → 0.1.12

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.10",
3
+ "version": "0.1.12",
4
4
  "description": "MobCode integration plugin for OpenClaw",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -110,10 +110,18 @@ function readTranscriptMessages(filePath) {
110
110
 
111
111
  export async function readSessionMessagesFromRuntime({ runtime, config, sessionKey, logger }) {
112
112
  const normalizedSessionKey = trim(sessionKey);
113
- if (!normalizedSessionKey || !runtime?.agent?.session) {
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);
124
+ const outcomes = [];
117
125
  logger?.info?.(
118
126
  `[mobcode-history] runtime reader start session=${normalizedSessionKey} storeCandidates=${candidates.map((candidate) => `${candidate.agentId}:${candidate.storePath}`).join(",") || "-"}`,
119
127
  );
@@ -124,6 +132,7 @@ export async function readSessionMessagesFromRuntime({ runtime, config, sessionK
124
132
  });
125
133
  const entry = store?.[normalizedSessionKey];
126
134
  if (!entry) {
135
+ outcomes.push(`missing_entry:${candidate.agentId}`);
127
136
  logger?.info?.(
128
137
  `[mobcode-history] runtime reader miss session=${normalizedSessionKey} agentId=${candidate.agentId} storePath=${candidate.storePath}`,
129
138
  );
@@ -131,6 +140,7 @@ export async function readSessionMessagesFromRuntime({ runtime, config, sessionK
131
140
  }
132
141
  const sessionId = trim(entry?.sessionId);
133
142
  if (!sessionId) {
143
+ outcomes.push(`missing_session_id:${candidate.agentId}`);
134
144
  logger?.warn?.(
135
145
  `[mobcode-history] runtime reader invalid_entry session=${normalizedSessionKey} agentId=${candidate.agentId} storePath=${candidate.storePath} reason=missing_session_id`,
136
146
  );
@@ -142,19 +152,30 @@ export async function readSessionMessagesFromRuntime({ runtime, config, sessionK
142
152
  sessionsDir: path.dirname(candidate.storePath),
143
153
  agentId: candidate.agentId,
144
154
  });
155
+ if (!trim(transcriptFile) || !fs.existsSync(transcriptFile)) {
156
+ outcomes.push(`missing_transcript_file:${candidate.agentId}`);
157
+ logger?.warn?.(
158
+ `[mobcode-history] runtime reader missing_transcript session=${normalizedSessionKey} agentId=${candidate.agentId} storePath=${candidate.storePath} transcriptFile=${transcriptFile || "-"}`,
159
+ );
160
+ continue;
161
+ }
145
162
  const messages = readTranscriptMessages(transcriptFile);
163
+ if (messages.length <= 0) {
164
+ outcomes.push(`empty_transcript:${candidate.agentId}`);
165
+ }
146
166
  logger?.info?.(
147
167
  `[mobcode-history] runtime reader hit session=${normalizedSessionKey} agentId=${candidate.agentId} storePath=${candidate.storePath} transcriptFile=${transcriptFile} messages=${messages.length}`,
148
168
  );
149
169
  return messages;
150
170
  } catch (error) {
171
+ outcomes.push(`error:${candidate.agentId}`);
151
172
  logger?.warn?.(
152
173
  `[mobcode-history] runtime reader error session=${normalizedSessionKey} agentId=${candidate.agentId} storePath=${candidate.storePath}: ${error instanceof Error ? error.message : String(error)}`,
153
174
  );
154
175
  }
155
176
  }
156
177
  logger?.warn?.(
157
- `[mobcode-history] runtime reader unresolved session=${normalizedSessionKey}`,
178
+ `[mobcode-history] runtime reader unresolved session=${normalizedSessionKey} outcomes=${outcomes.join(",") || "-"}`,
158
179
  );
159
180
  return [];
160
181
  }