@luckydraw/cumulus 0.27.36 → 0.27.37

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.
@@ -1170,15 +1170,30 @@
1170
1170
  var data;
1171
1171
  try {
1172
1172
  data = JSON.parse(block.json);
1173
- } catch (e) {
1174
- // Show parse error in a fallback
1175
- ph.innerHTML =
1176
- '<pre style="color:#f44;font-size:0.85em;">blex:' +
1177
- escapeHtml(block.type) +
1178
- ' — invalid JSON: ' +
1179
- escapeHtml(e.message) +
1180
- '</pre>';
1181
- return;
1173
+ } catch (_firstErr) {
1174
+ // Claude sometimes outputs real newlines inside JSON string values
1175
+ // instead of \n escape sequences. Fix by escaping newlines within strings.
1176
+ try {
1177
+ var fixed = block.json.replace(
1178
+ /"(?:[^"\\]|\\.)*"/g,
1179
+ function (match) {
1180
+ return match
1181
+ .replace(/\n/g, '\\n')
1182
+ .replace(/\r/g, '\\r')
1183
+ .replace(/\t/g, '\\t');
1184
+ }
1185
+ );
1186
+ data = JSON.parse(fixed);
1187
+ } catch (e) {
1188
+ // Show parse error in a fallback
1189
+ ph.innerHTML =
1190
+ '<pre style="color:#f44;font-size:0.85em;">blex:' +
1191
+ escapeHtml(block.type) +
1192
+ ' — invalid JSON: ' +
1193
+ escapeHtml(e.message) +
1194
+ '</pre>';
1195
+ return;
1196
+ }
1182
1197
  }
1183
1198
 
1184
1199
  var contentBlock = { type: block.type, id: block.id, data: data };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luckydraw/cumulus",
3
- "version": "0.27.36",
3
+ "version": "0.27.37",
4
4
  "description": "RLM-based CLI chat wrapper for Claude with external history context management",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",