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