@openclaw/plugin-inspector 0.3.9 → 0.3.10
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/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/src/inspector.js +24 -0
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/inspector.js
CHANGED
|
@@ -234,10 +234,34 @@ export async function captureEntrypointWithMockSdk(entrypoint, options = {}) {
|
|
|
234
234
|
);
|
|
235
235
|
return JSON.parse(stdout);
|
|
236
236
|
} catch (error) {
|
|
237
|
+
const captured = parseCaptureResultFromStdout(error?.stdout);
|
|
238
|
+
if (captured) {
|
|
239
|
+
return captured;
|
|
240
|
+
}
|
|
237
241
|
throw classifyMockSdkCaptureError(error);
|
|
238
242
|
}
|
|
239
243
|
}
|
|
240
244
|
|
|
245
|
+
function parseCaptureResultFromStdout(stdout) {
|
|
246
|
+
if (!stdout) {
|
|
247
|
+
return null;
|
|
248
|
+
}
|
|
249
|
+
try {
|
|
250
|
+
const parsed = JSON.parse(stdout);
|
|
251
|
+
if (
|
|
252
|
+
parsed &&
|
|
253
|
+
typeof parsed === "object" &&
|
|
254
|
+
typeof parsed.status === "string" &&
|
|
255
|
+
Array.isArray(parsed.captured)
|
|
256
|
+
) {
|
|
257
|
+
return parsed;
|
|
258
|
+
}
|
|
259
|
+
} catch {
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
return null;
|
|
263
|
+
}
|
|
264
|
+
|
|
241
265
|
export function classifyMockSdkCaptureError(error) {
|
|
242
266
|
const rawMessage = [error?.stderr, error?.stdout, error?.message].filter(Boolean).join("\n");
|
|
243
267
|
const missingExport = rawMessage.match(/does not provide an export named ['"]([^'"]+)['"]/)?.[1];
|