-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatch_sessionMachine3.js
More file actions
16 lines (12 loc) · 1.57 KB
/
patch_sessionMachine3.js
File metadata and controls
16 lines (12 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
const fs = require('fs');
const filepath = 'vessel/src/lib/raven/sessionMachine.ts';
let content = fs.readFileSync(filepath, 'utf8');
// I put it in buildCalibrationRails accidentally. Need to also put it in buildSessionContext
content = content.replace(
"if (state.activeVoids && state.activeVoids.length > 0) {\n parts.push('[ACTIVE VOIDS]\\nThe following structural signals or interpretations were explicitly rejected by the user in this session. You MUST NOT present these mappings again:\\n' + state.activeVoids.map(v => `- \"${v}\"`).join('\\n'));\n }\n\n if (state.activeVoids && state.activeVoids.length > 0) {\n parts.push('[ACTIVE VOIDS]\\nThe following structural signals or interpretations were explicitly rejected by the user in this session. You MUST NOT present these mappings again:\\n' + state.activeVoids.map(v => `- \"${v}\"`).join('\\n'));\n }\n\n return parts.join('\\n');",
"return parts.join('\\n');"
);
// We want to replace the last return parts.join('\n') which should be in buildSessionContext
const partsList = content.split("return parts.join('\\n');");
content = partsList[0] + "return parts.join('\\n');" + partsList[1] + "if (state.activeVoids && state.activeVoids.length > 0) {\n parts.push('[ACTIVE VOIDS]\\nThe following structural signals or interpretations were explicitly rejected by the user in this session. You MUST NOT present these mappings again:\\n' + state.activeVoids.map(v => `- \"${v}\"`).join('\\n'));\n }\n\n return parts.join('\\n');" + (partsList.slice(2).join("return parts.join('\\n');"));
fs.writeFileSync(filepath, content);