@mnemom/agent-integrity-protocol 0.1.5 → 0.1.6

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/dist/index.js CHANGED
@@ -1144,9 +1144,14 @@ function validateConscienceContext(value) {
1144
1144
  };
1145
1145
  }
1146
1146
  function checkIntegrity(input) {
1147
+ let jsonText = input.analysisResponse;
1148
+ const jsonMatch = jsonText.match(/\{[\s\S]*\}/);
1149
+ if (jsonMatch) {
1150
+ jsonText = jsonMatch[0];
1151
+ }
1147
1152
  let parsed;
1148
1153
  try {
1149
- parsed = JSON.parse(input.analysisResponse);
1154
+ parsed = JSON.parse(jsonText);
1150
1155
  } catch {
1151
1156
  throw new Error(
1152
1157
  `Failed to parse analysis response as JSON: ${input.analysisResponse.slice(0, 100)}`