mirror of
https://github.com/7836246/cursor2api.git
synced 2026-09-06 08:58:21 +08:00
- 修复流式 thinking block 类型冲突(缓冲后处理保证 thinking→text 顺序) - 多 thinking block 合并为单个 content block(符合 Anthropic API 规范) - 反拒绝策略重构:移除 Testing Assistant 身份声明,改用中性 workspace action 格式 - 敏感字符串从 Base64 迁移至 XOR 混淆(16字节轮转密钥,模型无法心算解码) - 子 Agent 清洗增强:新增 claude_background_info/env 标签剥离 - Unicode 撇号兼容 + 全局 Claude/Anthropic 引用清洗兜底
23 lines
780 B
JavaScript
23 lines
780 B
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Encode plaintext → XOR hex string for use with _x() in obfuscate.ts
|
|
* Usage: node scripts/encode.mjs "plaintext string"
|
|
*/
|
|
const _K = [0x5A, 0x3F, 0x17, 0x6B, 0x2E, 0x41, 0x58, 0x0D, 0x73, 0x1C, 0x44, 0x29, 0x66, 0x35, 0x7A, 0x02];
|
|
|
|
const text = process.argv[2];
|
|
if (!text) {
|
|
console.error('Usage: node scripts/encode.mjs "text to encode"');
|
|
process.exit(1);
|
|
}
|
|
|
|
const hex = [...text].map((c, i) => (c.charCodeAt(0) ^ _K[i % _K.length]).toString(16).padStart(2, '0')).join('');
|
|
console.log(`_x('${hex}')`);
|
|
|
|
// Verify decode
|
|
const decoded = [];
|
|
for (let i = 0; i < hex.length; i += 2) {
|
|
decoded.push(String.fromCharCode(parseInt(hex.substring(i, i + 2), 16) ^ _K[i / 2 % _K.length]));
|
|
}
|
|
console.log(`// Decodes to: ${decoded.join('')}`);
|