@cccarv82/freya 3.8.4 → 3.8.5

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.
@@ -134,11 +134,12 @@ function extractFirstJsonObject(text) {
134
134
  return null;
135
135
  }
136
136
 
137
- function escapeJsonControlChars(jsonText) {
138
- return jsonText.replace(/[\x00-\x1F\x7F]/g, (ch) => {
139
- if (ch === '\n' || ch === '\r' || ch === '\t') return ch;
140
- return '\\u' + ch.charCodeAt(0).toString(16).padStart(4, '0');
141
- });
137
+ function sanitizeJsonText(jsonText) {
138
+ // Copilot often returns pretty-printed JSON with literal newlines INSIDE
139
+ // string values (e.g. multi-line descriptions). These are invalid JSON.
140
+ // Replace ALL control chars (including \n, \r, \t) with spaces — JSON
141
+ // doesn't use newlines as syntax, they're just whitespace between tokens.
142
+ return jsonText.replace(/[\x00-\x1F\x7F]/g, ' ');
142
143
  }
143
144
 
144
145
  function readProjectSlugMap(wsDir) {
@@ -338,7 +339,7 @@ IMPORTANTE: Extraia APENAS informações explícitas do log. NÃO invente dados.
338
339
  try {
339
340
  plan = JSON.parse(jsonText);
340
341
  } catch {
341
- try { plan = JSON.parse(escapeJsonControlChars(jsonText)); } catch {
342
+ try { plan = JSON.parse(sanitizeJsonText(jsonText)); } catch {
342
343
  totalErrors++;
343
344
  if (totalErrors <= 2) {
344
345
  console.log(`\n ⚠ JSON parse diagnostic for ${date}:`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cccarv82/freya",
3
- "version": "3.8.4",
3
+ "version": "3.8.5",
4
4
  "description": "Personal AI Assistant with local-first persistence",
5
5
  "scripts": {
6
6
  "health": "node scripts/validate-data.js && node scripts/validate-structure.js",