trimprompt 1.0.31 → 1.0.32

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/proxy-daemon.js CHANGED
@@ -1,382 +1 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.getProxyPort = getProxyPort;
37
- exports.isProxyRunning = isProxyRunning;
38
- exports.startProxyDaemon = startProxyDaemon;
39
- exports.stopProxyDaemon = stopProxyDaemon;
40
- exports.enableAutostart = enableAutostart;
41
- exports.disableAutostart = disableAutostart;
42
- exports.setAnthropicBaseUrl = setAnthropicBaseUrl;
43
- exports.removeAnthropicBaseUrl = removeAnthropicBaseUrl;
44
- const fs = __importStar(require("fs"));
45
- const path = __importStar(require("path"));
46
- const os = __importStar(require("os"));
47
- const child_process_1 = require("child_process");
48
- const baseDir = path.join(os.homedir(), '.trimprompt');
49
- const pidFile = path.join(baseDir, 'proxy.pid');
50
- const portFile = path.join(baseDir, 'proxy.port');
51
- const DEFAULT_PORT = 8080;
52
- function ensureDir() {
53
- if (!fs.existsSync(baseDir))
54
- fs.mkdirSync(baseDir, { recursive: true });
55
- }
56
- function getProxyPort() {
57
- try {
58
- if (fs.existsSync(portFile))
59
- return parseInt(fs.readFileSync(portFile, 'utf8').trim()) || DEFAULT_PORT;
60
- }
61
- catch { }
62
- return DEFAULT_PORT;
63
- }
64
- function isProxyRunning() {
65
- const port = getProxyPort();
66
- try {
67
- if (!fs.existsSync(pidFile))
68
- return { running: false, pid: null, port };
69
- const pid = parseInt(fs.readFileSync(pidFile, 'utf8').trim());
70
- if (!pid)
71
- return { running: false, pid: null, port };
72
- if (process.platform === 'win32') {
73
- const result = (0, child_process_1.execSync)(`tasklist /FI "PID eq ${pid}" /FO CSV /NH`, { encoding: 'utf8', timeout: 5000 });
74
- const pidStr = `"${pid}"`;
75
- if (result.split('\n').some(line => line.includes(pidStr)))
76
- return { running: true, pid, port };
77
- }
78
- else {
79
- process.kill(pid, 0);
80
- return { running: true, pid, port };
81
- }
82
- }
83
- catch { }
84
- try {
85
- fs.unlinkSync(pidFile);
86
- }
87
- catch { }
88
- return { running: false, pid: null, port };
89
- }
90
- function startProxyDaemon(port) {
91
- const status = isProxyRunning();
92
- if (status.running) {
93
- return { success: true, pid: status.pid, port: status.port, message: `Proxy already running (pid ${status.pid}) on port ${status.port}` };
94
- }
95
- ensureDir();
96
- const usePort = port || DEFAULT_PORT;
97
- try {
98
- const cliPath = path.join(__dirname, 'cli.js');
99
- if (!fs.existsSync(cliPath)) {
100
- return { success: false, pid: null, port: usePort, message: `CLI not found at ${cliPath}` };
101
- }
102
- const child = (0, child_process_1.spawn)(process.execPath, [cliPath, 'proxy', '--port', String(usePort)], {
103
- detached: true,
104
- stdio: 'ignore',
105
- env: { ...process.env, TRIMPROMPT_DISABLED: '1' },
106
- });
107
- child.unref();
108
- if (child.pid) {
109
- fs.writeFileSync(pidFile, String(child.pid), 'utf8');
110
- fs.writeFileSync(portFile, String(usePort), 'utf8');
111
- return { success: true, pid: child.pid, port: usePort, message: `Proxy started (pid ${child.pid}) on port ${usePort}` };
112
- }
113
- return { success: false, pid: null, port: usePort, message: 'Spawn returned no PID' };
114
- }
115
- catch (err) {
116
- return { success: false, pid: null, port: usePort, message: `Failed to start proxy: ${err.message}` };
117
- }
118
- }
119
- function stopProxyDaemon() {
120
- const status = isProxyRunning();
121
- if (!status.running || !status.pid) {
122
- return { success: true, message: 'Proxy is not running' };
123
- }
124
- try {
125
- if (process.platform === 'win32') {
126
- (0, child_process_1.execSync)(`taskkill /PID ${status.pid} /F`, { timeout: 5000 });
127
- }
128
- else {
129
- process.kill(status.pid, 'SIGTERM');
130
- }
131
- }
132
- catch { }
133
- try {
134
- fs.unlinkSync(pidFile);
135
- }
136
- catch { }
137
- return { success: true, message: `Proxy stopped (pid ${status.pid})` };
138
- }
139
- function setClaudeCodeSettings(url) {
140
- const claudeDir = path.join(os.homedir(), '.claude');
141
- const settingsPath = path.join(claudeDir, 'settings.json');
142
- try {
143
- if (!fs.existsSync(claudeDir))
144
- fs.mkdirSync(claudeDir, { recursive: true });
145
- let settings = {};
146
- if (fs.existsSync(settingsPath)) {
147
- try {
148
- settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8'));
149
- }
150
- catch { }
151
- }
152
- if (!settings.env)
153
- settings.env = {};
154
- settings.env.ANTHROPIC_BASE_URL = url;
155
- fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2), 'utf8');
156
- }
157
- catch { }
158
- }
159
- function removeClaudeCodeSettings() {
160
- const settingsPath = path.join(os.homedir(), '.claude', 'settings.json');
161
- try {
162
- if (fs.existsSync(settingsPath)) {
163
- const settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8'));
164
- if (settings.env && settings.env.ANTHROPIC_BASE_URL) {
165
- delete settings.env.ANTHROPIC_BASE_URL;
166
- if (Object.keys(settings.env).length === 0)
167
- delete settings.env;
168
- fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2), 'utf8');
169
- }
170
- }
171
- }
172
- catch { }
173
- }
174
- const RUN_KEY = 'HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Run';
175
- const RUN_VALUE_NAME = 'TrimPromptProxy';
176
- const vbsLauncher = path.join(baseDir, 'proxy-autostart.vbs');
177
- function enableAutostart() {
178
- ensureDir();
179
- const cliPath = path.join(__dirname, 'cli.js');
180
- if (process.platform === 'win32') {
181
- try {
182
- const vbs = 'Set WshShell = CreateObject("WScript.Shell")\r\n' +
183
- 'cmd = Chr(34) & "' + process.execPath.replace(/"/g, '""') + '" & Chr(34) & " " & Chr(34) & "' +
184
- cliPath.replace(/"/g, '""') + '" & Chr(34) & " proxy install"\r\n' +
185
- 'WshShell.Run cmd, 0, False\r\n';
186
- fs.writeFileSync(vbsLauncher, vbs, 'utf8');
187
- const runValue = `wscript.exe "${vbsLauncher}"`;
188
- const psSet = `New-Item -Path '${RUN_KEY}' -Force | Out-Null; Set-ItemProperty -Path '${RUN_KEY}' -Name '${RUN_VALUE_NAME}' -Value '${runValue.replace(/'/g, "''")}'`;
189
- (0, child_process_1.execSync)(`powershell.exe -NoProfile -Command "${psSet.replace(/"/g, '\\"')}"`, { stdio: 'ignore', timeout: 8000 });
190
- }
191
- catch { }
192
- return;
193
- }
194
- if (process.platform === 'darwin') {
195
- try {
196
- const agentsDir = path.join(os.homedir(), 'Library', 'LaunchAgents');
197
- if (!fs.existsSync(agentsDir))
198
- fs.mkdirSync(agentsDir, { recursive: true });
199
- const plistPath = path.join(agentsDir, 'ai.trimprompt.proxy.plist');
200
- const plist = '<?xml version="1.0" encoding="UTF-8"?>\n' +
201
- '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n' +
202
- '<plist version="1.0"><dict>\n' +
203
- ' <key>Label</key><string>ai.trimprompt.proxy</string>\n' +
204
- ' <key>ProgramArguments</key><array>' +
205
- `<string>${process.execPath}</string><string>${cliPath}</string><string>proxy</string><string>start</string>` +
206
- '</array>\n' +
207
- ' <key>RunAtLoad</key><true/>\n' +
208
- ' <key>KeepAlive</key><true/>\n' +
209
- '</dict></plist>\n';
210
- fs.writeFileSync(plistPath, plist, 'utf8');
211
- try {
212
- (0, child_process_1.execSync)(`launchctl unload "${plistPath}"`, { stdio: 'ignore', timeout: 5000 });
213
- }
214
- catch { }
215
- (0, child_process_1.execSync)(`launchctl load "${plistPath}"`, { stdio: 'ignore', timeout: 5000 });
216
- }
217
- catch { }
218
- return;
219
- }
220
- try {
221
- const autostartDir = path.join(os.homedir(), '.config', 'autostart');
222
- if (!fs.existsSync(autostartDir))
223
- fs.mkdirSync(autostartDir, { recursive: true });
224
- const desktopPath = path.join(autostartDir, 'trimprompt-proxy.desktop');
225
- const entry = '[Desktop Entry]\n' +
226
- 'Type=Application\n' +
227
- 'Name=TrimPrompt Proxy\n' +
228
- `Exec=${process.execPath} ${cliPath} proxy install\n` +
229
- 'X-GNOME-Autostart-enabled=true\n' +
230
- 'NoDisplay=true\n';
231
- fs.writeFileSync(desktopPath, entry, 'utf8');
232
- }
233
- catch { }
234
- }
235
- function disableAutostart() {
236
- if (process.platform === 'win32') {
237
- try {
238
- const psRemove = `Remove-ItemProperty -Path '${RUN_KEY}' -Name '${RUN_VALUE_NAME}' -ErrorAction SilentlyContinue`;
239
- (0, child_process_1.execSync)(`powershell.exe -NoProfile -Command "${psRemove.replace(/"/g, '\\"')}"`, { stdio: 'ignore', timeout: 8000 });
240
- }
241
- catch { }
242
- try {
243
- if (fs.existsSync(vbsLauncher))
244
- fs.unlinkSync(vbsLauncher);
245
- }
246
- catch { }
247
- return;
248
- }
249
- if (process.platform === 'darwin') {
250
- try {
251
- const plistPath = path.join(os.homedir(), 'Library', 'LaunchAgents', 'ai.trimprompt.proxy.plist');
252
- try {
253
- (0, child_process_1.execSync)(`launchctl unload "${plistPath}"`, { stdio: 'ignore', timeout: 5000 });
254
- }
255
- catch { }
256
- if (fs.existsSync(plistPath))
257
- fs.unlinkSync(plistPath);
258
- }
259
- catch { }
260
- return;
261
- }
262
- try {
263
- const desktopPath = path.join(os.homedir(), '.config', 'autostart', 'trimprompt-proxy.desktop');
264
- if (fs.existsSync(desktopPath))
265
- fs.unlinkSync(desktopPath);
266
- }
267
- catch { }
268
- }
269
- function setAnthropicBaseUrl(port) {
270
- const url = `http://127.0.0.1:${port}`;
271
- const openAiUrl = `http://127.0.0.1:${port}/v1`;
272
- setClaudeCodeSettings(url);
273
- if (process.platform === 'win32') {
274
- try {
275
- (0, child_process_1.execSync)(`setx ANTHROPIC_BASE_URL "${url}"`, { timeout: 5000 });
276
- (0, child_process_1.execSync)(`setx OPENAI_BASE_URL "${openAiUrl}"`, { timeout: 5000 });
277
- (0, child_process_1.execSync)(`setx GEMINI_BASE_URL "${openAiUrl}"`, { timeout: 5000 });
278
- (0, child_process_1.execSync)(`setx GOOGLE_AI_BASE_URL "${openAiUrl}"`, { timeout: 5000 });
279
- }
280
- catch { }
281
- }
282
- const homeDir = os.homedir();
283
- const marker = '# TrimPrompt API Proxy';
284
- const line1 = `export ANTHROPIC_BASE_URL="${url}" ${marker}`;
285
- const line2 = `export OPENAI_BASE_URL="${openAiUrl}" ${marker}`;
286
- const line3 = `export GEMINI_BASE_URL="${openAiUrl}" ${marker}`;
287
- const line4 = `export GOOGLE_AI_BASE_URL="${openAiUrl}" ${marker}`;
288
- const profiles = [
289
- path.join(homeDir, '.bashrc'),
290
- path.join(homeDir, '.zshrc'),
291
- path.join(homeDir, '.bash_profile'),
292
- ];
293
- for (const profile of profiles) {
294
- try {
295
- if (fs.existsSync(profile)) {
296
- let content = fs.readFileSync(profile, 'utf8');
297
- if (content.includes(marker)) {
298
- content = content.replace(new RegExp(`.*${marker.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}.*\\n?`, 'g'), '');
299
- }
300
- content = content.trimEnd() + '\n' + line1 + '\n' + line2 + '\n' + line3 + '\n' + line4 + '\n';
301
- fs.writeFileSync(profile, content, 'utf8');
302
- }
303
- }
304
- catch { }
305
- }
306
- try {
307
- const psProfilePaths = [];
308
- for (const shell of ['powershell', 'pwsh']) {
309
- try {
310
- const p = (0, child_process_1.execSync)(`${shell} -NoProfile -Command "$PROFILE"`, { encoding: 'utf8', timeout: 3000, stdio: ['pipe', 'pipe', 'ignore'] }).trim();
311
- if (p && !psProfilePaths.includes(p))
312
- psProfilePaths.push(p);
313
- }
314
- catch { }
315
- }
316
- const psMarker = '# TrimPrompt API Proxy';
317
- const psLine1 = `$env:ANTHROPIC_BASE_URL = "${url}" ${psMarker}`;
318
- const psLine2 = `$env:OPENAI_BASE_URL = "${openAiUrl}" ${psMarker}`;
319
- const psLine3 = `$env:GEMINI_BASE_URL = "${openAiUrl}" ${psMarker}`;
320
- const psLine4 = `$env:GOOGLE_AI_BASE_URL = "${openAiUrl}" ${psMarker}`;
321
- for (const pp of psProfilePaths) {
322
- try {
323
- const dir = path.dirname(pp);
324
- if (!fs.existsSync(dir))
325
- fs.mkdirSync(dir, { recursive: true });
326
- let content = fs.existsSync(pp) ? fs.readFileSync(pp, 'utf8') : '';
327
- if (content.includes(psMarker)) {
328
- content = content.replace(new RegExp(`.*${psMarker.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}.*\\r?\\n?`, 'g'), '');
329
- }
330
- content = content.trimEnd() + '\n' + psLine1 + '\n' + psLine2 + '\n' + psLine3 + '\n' + psLine4 + '\n';
331
- fs.writeFileSync(pp, content, 'utf8');
332
- }
333
- catch { }
334
- }
335
- }
336
- catch { }
337
- }
338
- function removeAnthropicBaseUrl() {
339
- removeClaudeCodeSettings();
340
- if (process.platform === 'win32') {
341
- try {
342
- (0, child_process_1.execSync)('REG DELETE "HKCU\\Environment" /V ANTHROPIC_BASE_URL /F', { timeout: 5000 });
343
- }
344
- catch { }
345
- }
346
- const homeDir = os.homedir();
347
- const marker = '# TrimPrompt API Proxy';
348
- const profiles = [
349
- path.join(homeDir, '.bashrc'),
350
- path.join(homeDir, '.zshrc'),
351
- path.join(homeDir, '.bash_profile'),
352
- ];
353
- for (const profile of profiles) {
354
- try {
355
- if (fs.existsSync(profile)) {
356
- let content = fs.readFileSync(profile, 'utf8');
357
- if (content.includes(marker)) {
358
- content = content.replace(new RegExp(`.*${marker.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}.*\\r?\\n?`, 'g'), '');
359
- fs.writeFileSync(profile, content, 'utf8');
360
- }
361
- }
362
- }
363
- catch { }
364
- }
365
- try {
366
- for (const shell of ['powershell', 'pwsh']) {
367
- try {
368
- const p = (0, child_process_1.execSync)(`${shell} -NoProfile -Command "$PROFILE"`, { encoding: 'utf8', timeout: 3000, stdio: ['pipe', 'pipe', 'ignore'] }).trim();
369
- if (p && fs.existsSync(p)) {
370
- let content = fs.readFileSync(p, 'utf8');
371
- const psMarker = '# TrimPrompt API Proxy';
372
- if (content.includes(psMarker)) {
373
- content = content.replace(new RegExp(`.*${psMarker.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}.*\\r?\\n?`, 'g'), '');
374
- fs.writeFileSync(p, content, 'utf8');
375
- }
376
- }
377
- }
378
- catch { }
379
- }
380
- }
381
- catch { }
382
- }
1
+ 'use strict';const a0_0x529c8f=a0_0xa31c;(function(_0x467cf5,_0x5c6c63){const _0x139654=a0_0xa31c,_0x1b148a=_0x467cf5();while(!![]){try{const _0x176748=parseInt(_0x139654(0xb3))/0x1+parseInt(_0x139654(0x10d))/0x2*(-parseInt(_0x139654(0xc7))/0x3)+parseInt(_0x139654(0xcf))/0x4*(parseInt(_0x139654(0x8d))/0x5)+parseInt(_0x139654(0x112))/0x6+parseInt(_0x139654(0x115))/0x7+-parseInt(_0x139654(0x10b))/0x8+-parseInt(_0x139654(0xb4))/0x9;if(_0x176748===_0x5c6c63)break;else _0x1b148a['push'](_0x1b148a['shift']());}catch(_0x595225){_0x1b148a['push'](_0x1b148a['shift']());}}}(a0_0x163f,0xc2d12));var __createBinding=this&&this[a0_0x529c8f(0xd8)]||(Object[a0_0x529c8f(0xd5)]?function(_0x2b52ec,_0x1a6283,_0x193fd7,_0x3ef1a3){const _0xa23869=a0_0x529c8f;if(_0x3ef1a3===undefined)_0x3ef1a3=_0x193fd7;var _0x20f5ec=Object[_0xa23869(0xb2)](_0x1a6283,_0x193fd7);(!_0x20f5ec||(_0xa23869(0xd4)in _0x20f5ec?!_0x1a6283[_0xa23869(0x10c)]:_0x20f5ec[_0xa23869(0xbe)]||_0x20f5ec['configurable']))&&(_0x20f5ec={'enumerable':!![],'get':function(){return _0x1a6283[_0x193fd7];}}),Object[_0xa23869(0xda)](_0x2b52ec,_0x3ef1a3,_0x20f5ec);}:function(_0x3abd50,_0x2e261c,_0xe882bc,_0x1a750d){if(_0x1a750d===undefined)_0x1a750d=_0xe882bc;_0x3abd50[_0x1a750d]=_0x2e261c[_0xe882bc];}),__setModuleDefault=this&&this[a0_0x529c8f(0xa3)]||(Object[a0_0x529c8f(0xd5)]?function(_0x33cd45,_0x59a7fd){Object['defineProperty'](_0x33cd45,'default',{'enumerable':!![],'value':_0x59a7fd});}:function(_0x23ac4f,_0x3c80d1){_0x23ac4f['default']=_0x3c80d1;}),__importStar=this&&this[a0_0x529c8f(0x8a)]||(function(){var _0x46ce09=function(_0x3575e3){const _0x13e522=a0_0xa31c;return _0x46ce09=Object[_0x13e522(0x91)]||function(_0x53ba8b){const _0x1d76cd=_0x13e522;var _0x373e8f=[];for(var _0x5acb2a in _0x53ba8b)if(Object[_0x1d76cd(0xbc)][_0x1d76cd(0x106)][_0x1d76cd(0xbd)](_0x53ba8b,_0x5acb2a))_0x373e8f[_0x373e8f[_0x1d76cd(0xe9)]]=_0x5acb2a;return _0x373e8f;},_0x46ce09(_0x3575e3);};return function(_0x3b8708){const _0x349387=a0_0xa31c;if(_0x3b8708&&_0x3b8708['__esModule'])return _0x3b8708;var _0x4dc128={};if(_0x3b8708!=null){for(var _0x31eff4=_0x46ce09(_0x3b8708),_0x49f6d8=0x0;_0x49f6d8<_0x31eff4['length'];_0x49f6d8++)if(_0x31eff4[_0x49f6d8]!==_0x349387(0xbf))__createBinding(_0x4dc128,_0x3b8708,_0x31eff4[_0x49f6d8]);}return __setModuleDefault(_0x4dc128,_0x3b8708),_0x4dc128;};}());Object[a0_0x529c8f(0xda)](exports,'__esModule',{'value':!![]}),exports['getProxyPort']=getProxyPort,exports[a0_0x529c8f(0x10e)]=isProxyRunning,exports[a0_0x529c8f(0x97)]=startProxyDaemon,exports[a0_0x529c8f(0x9a)]=stopProxyDaemon,exports['enableAutostart']=enableAutostart,exports[a0_0x529c8f(0xb9)]=disableAutostart,exports[a0_0x529c8f(0x9c)]=setAnthropicBaseUrl,exports['removeAnthropicBaseUrl']=removeAnthropicBaseUrl;const fs=__importStar(require('fs')),path=__importStar(require(a0_0x529c8f(0xdb))),os=__importStar(require('os')),child_process_1=require(a0_0x529c8f(0xf9)),baseDir=path[a0_0x529c8f(0x98)](os[a0_0x529c8f(0xa8)](),a0_0x529c8f(0x109)),pidFile=path[a0_0x529c8f(0x98)](baseDir,a0_0x529c8f(0xab)),portFile=path['join'](baseDir,'proxy.port'),DEFAULT_PORT=0x1f90;function ensureDir(){const _0x45217a=a0_0x529c8f;if(!fs['existsSync'](baseDir))fs[_0x45217a(0xd0)](baseDir,{'recursive':!![]});}function getProxyPort(){const _0xe354=a0_0x529c8f;try{if(fs[_0xe354(0xaf)](portFile))return parseInt(fs[_0xe354(0xfe)](portFile,_0xe354(0xf7))[_0xe354(0x114)]())||DEFAULT_PORT;}catch{}return DEFAULT_PORT;}function a0_0xa31c(_0x338a2c,_0x1e949b){const _0x163fe2=a0_0x163f();return a0_0xa31c=function(_0xa31c92,_0x5c721b){_0xa31c92=_0xa31c92-0x89;let _0x5f3b53=_0x163fe2[_0xa31c92];return _0x5f3b53;},a0_0xa31c(_0x338a2c,_0x1e949b);}function isProxyRunning(){const _0x185240=a0_0x529c8f,_0x16d7e3=getProxyPort();try{if(!fs[_0x185240(0xaf)](pidFile))return{'running':![],'pid':null,'port':_0x16d7e3};const _0x3e325c=parseInt(fs[_0x185240(0xfe)](pidFile,_0x185240(0xf7))[_0x185240(0x114)]());if(!_0x3e325c)return{'running':![],'pid':null,'port':_0x16d7e3};if(process[_0x185240(0xef)]===_0x185240(0x102)){const _0x85854=(0x0,child_process_1[_0x185240(0xa0)])(_0x185240(0xd1)+_0x3e325c+_0x185240(0xa4),{'encoding':_0x185240(0xf7),'timeout':0x1388}),_0x4afcd8='\x22'+_0x3e325c+'\x22';if(_0x85854[_0x185240(0xc3)]('\x0a')['some'](_0x48850c=>_0x48850c[_0x185240(0xc6)](_0x4afcd8)))return{'running':!![],'pid':_0x3e325c,'port':_0x16d7e3};}else return process[_0x185240(0x9b)](_0x3e325c,0x0),{'running':!![],'pid':_0x3e325c,'port':_0x16d7e3};}catch{}try{fs[_0x185240(0xa1)](pidFile);}catch{}return{'running':![],'pid':null,'port':_0x16d7e3};}function startProxyDaemon(_0x8efe26){const _0x24a329=a0_0x529c8f,_0x29b59d=isProxyRunning();if(_0x29b59d[_0x24a329(0x108)])return{'success':!![],'pid':_0x29b59d['pid'],'port':_0x29b59d[_0x24a329(0x110)],'message':_0x24a329(0xf3)+_0x29b59d[_0x24a329(0xf1)]+_0x24a329(0x94)+_0x29b59d['port']};ensureDir();const _0x32a5db=_0x8efe26||DEFAULT_PORT;try{const _0x6b2b16=path[_0x24a329(0x98)](__dirname,_0x24a329(0xe0));if(!fs['existsSync'](_0x6b2b16))return{'success':![],'pid':null,'port':_0x32a5db,'message':_0x24a329(0xcc)+_0x6b2b16};const _0x3f709f=(0x0,child_process_1[_0x24a329(0xd9)])(process[_0x24a329(0xf4)],[_0x6b2b16,_0x24a329(0xa5),_0x24a329(0xc2),String(_0x32a5db)],{'detached':!![],'stdio':_0x24a329(0xb8),'env':{...process[_0x24a329(0x113)],'TRIMPROMPT_DISABLED':'1'}});_0x3f709f[_0x24a329(0xf0)]();if(_0x3f709f[_0x24a329(0xf1)])return fs[_0x24a329(0xfd)](pidFile,String(_0x3f709f['pid']),_0x24a329(0xf7)),fs[_0x24a329(0xfd)](portFile,String(_0x32a5db),_0x24a329(0xf7)),{'success':!![],'pid':_0x3f709f[_0x24a329(0xf1)],'port':_0x32a5db,'message':_0x24a329(0xbb)+_0x3f709f[_0x24a329(0xf1)]+_0x24a329(0x94)+_0x32a5db};return{'success':![],'pid':null,'port':_0x32a5db,'message':'Spawn\x20returned\x20no\x20PID'};}catch(_0x2d4878){return{'success':![],'pid':null,'port':_0x32a5db,'message':'Failed\x20to\x20start\x20proxy:\x20'+_0x2d4878[_0x24a329(0x8e)]};}}function stopProxyDaemon(){const _0x1b155d=a0_0x529c8f,_0xe54f90=isProxyRunning();if(!_0xe54f90['running']||!_0xe54f90['pid'])return{'success':!![],'message':_0x1b155d(0xfb)};try{process[_0x1b155d(0xef)]===_0x1b155d(0x102)?(0x0,child_process_1['execSync'])(_0x1b155d(0xce)+_0xe54f90[_0x1b155d(0xf1)]+'\x20/F',{'timeout':0x1388}):process[_0x1b155d(0x9b)](_0xe54f90[_0x1b155d(0xf1)],_0x1b155d(0x9d));}catch{}try{fs['unlinkSync'](pidFile);}catch{}return{'success':!![],'message':_0x1b155d(0xf6)+_0xe54f90[_0x1b155d(0xf1)]+')'};}function setClaudeCodeSettings(_0x497432){const _0x4d7668=a0_0x529c8f,_0x376413=path[_0x4d7668(0x98)](os['homedir'](),_0x4d7668(0xd7)),_0x1a45db=path[_0x4d7668(0x98)](_0x376413,_0x4d7668(0xb1));try{if(!fs[_0x4d7668(0xaf)](_0x376413))fs['mkdirSync'](_0x376413,{'recursive':!![]});let _0x5b3959={};if(fs[_0x4d7668(0xaf)](_0x1a45db))try{_0x5b3959=JSON[_0x4d7668(0xe5)](fs[_0x4d7668(0xfe)](_0x1a45db,_0x4d7668(0xf7)));}catch{}if(!_0x5b3959['env'])_0x5b3959['env']={};_0x5b3959[_0x4d7668(0x113)][_0x4d7668(0x8b)]=_0x497432,fs[_0x4d7668(0xfd)](_0x1a45db,JSON[_0x4d7668(0x105)](_0x5b3959,null,0x2),_0x4d7668(0xf7));}catch{}}function removeClaudeCodeSettings(){const _0x14c50c=a0_0x529c8f,_0x1b5ae0=path[_0x14c50c(0x98)](os['homedir'](),_0x14c50c(0xd7),_0x14c50c(0xb1));try{if(fs['existsSync'](_0x1b5ae0)){const _0x3d7abd=JSON[_0x14c50c(0xe5)](fs['readFileSync'](_0x1b5ae0,_0x14c50c(0xf7)));if(_0x3d7abd[_0x14c50c(0x113)]&&_0x3d7abd['env'][_0x14c50c(0x8b)]){delete _0x3d7abd[_0x14c50c(0x113)][_0x14c50c(0x8b)];if(Object[_0x14c50c(0xa7)](_0x3d7abd[_0x14c50c(0x113)])['length']===0x0)delete _0x3d7abd['env'];fs[_0x14c50c(0xfd)](_0x1b5ae0,JSON[_0x14c50c(0x105)](_0x3d7abd,null,0x2),'utf8');}}}catch{}}const RUN_KEY=a0_0x529c8f(0xe2),RUN_VALUE_NAME=a0_0x529c8f(0xca),vbsLauncher=path[a0_0x529c8f(0x98)](baseDir,'proxy-autostart.vbs');function enableAutostart(){const _0x5ad5b9=a0_0x529c8f;ensureDir();const _0x68e717=path[_0x5ad5b9(0x98)](__dirname,_0x5ad5b9(0xe0));if(process[_0x5ad5b9(0xef)]===_0x5ad5b9(0x102)){try{const _0x236748=_0x5ad5b9(0x10a)+_0x5ad5b9(0x111)+process[_0x5ad5b9(0xf4)][_0x5ad5b9(0xa6)](/"/g,'\x22\x22')+_0x5ad5b9(0x8f)+_0x68e717[_0x5ad5b9(0xa6)](/"/g,'\x22\x22')+_0x5ad5b9(0xc9)+_0x5ad5b9(0xf8);fs[_0x5ad5b9(0xfd)](vbsLauncher,_0x236748,_0x5ad5b9(0xf7));const _0xf8ea80=_0x5ad5b9(0xb5)+vbsLauncher+'\x22',_0x21df00=_0x5ad5b9(0xe7)+RUN_KEY+'\x27\x20-Force\x20|\x20Out-Null;\x20Set-ItemProperty\x20-Path\x20\x27'+RUN_KEY+_0x5ad5b9(0x92)+RUN_VALUE_NAME+_0x5ad5b9(0xb0)+_0xf8ea80[_0x5ad5b9(0xa6)](/'/g,'\x27\x27')+'\x27';(0x0,child_process_1[_0x5ad5b9(0xa0)])(_0x5ad5b9(0xc4)+_0x21df00['replace'](/"/g,'\x5c\x22')+'\x22',{'stdio':_0x5ad5b9(0xb8),'timeout':0x1f40});}catch{}return;}if(process[_0x5ad5b9(0xef)]===_0x5ad5b9(0xdd)){try{const _0x2f4e8e=path[_0x5ad5b9(0x98)](os[_0x5ad5b9(0xa8)](),_0x5ad5b9(0xed),_0x5ad5b9(0xc1));if(!fs[_0x5ad5b9(0xaf)](_0x2f4e8e))fs[_0x5ad5b9(0xd0)](_0x2f4e8e,{'recursive':!![]});const _0x23d990=path[_0x5ad5b9(0x98)](_0x2f4e8e,_0x5ad5b9(0x9f)),_0x10bd39='<?xml\x20version=\x221.0\x22\x20encoding=\x22UTF-8\x22?>\x0a'+_0x5ad5b9(0xec)+_0x5ad5b9(0xcd)+'\x20\x20<key>Label</key><string>ai.trimprompt.proxy</string>\x0a'+_0x5ad5b9(0xf2)+(_0x5ad5b9(0x89)+process['execPath']+_0x5ad5b9(0x96)+_0x68e717+'</string><string>proxy</string><string>start</string>')+_0x5ad5b9(0x103)+_0x5ad5b9(0xfa)+_0x5ad5b9(0xfc)+_0x5ad5b9(0xaa);fs[_0x5ad5b9(0xfd)](_0x23d990,_0x10bd39,_0x5ad5b9(0xf7));try{(0x0,child_process_1[_0x5ad5b9(0xa0)])(_0x5ad5b9(0xdf)+_0x23d990+'\x22',{'stdio':_0x5ad5b9(0xb8),'timeout':0x1388});}catch{}(0x0,child_process_1[_0x5ad5b9(0xa0)])(_0x5ad5b9(0xc8)+_0x23d990+'\x22',{'stdio':_0x5ad5b9(0xb8),'timeout':0x1388});}catch{}return;}try{const _0x87dfd9=path[_0x5ad5b9(0x98)](os['homedir'](),_0x5ad5b9(0xb6),'autostart');if(!fs[_0x5ad5b9(0xaf)](_0x87dfd9))fs['mkdirSync'](_0x87dfd9,{'recursive':!![]});const _0x463ae7=path[_0x5ad5b9(0x98)](_0x87dfd9,_0x5ad5b9(0xac)),_0x1941cf=_0x5ad5b9(0x95)+_0x5ad5b9(0x99)+'Name=TrimPrompt\x20Proxy\x0a'+('Exec='+process[_0x5ad5b9(0xf4)]+'\x20'+_0x68e717+_0x5ad5b9(0x8c))+_0x5ad5b9(0xad)+_0x5ad5b9(0xa2);fs[_0x5ad5b9(0xfd)](_0x463ae7,_0x1941cf,'utf8');}catch{}}function disableAutostart(){const _0x5c4815=a0_0x529c8f;if(process[_0x5c4815(0xef)]===_0x5c4815(0x102)){try{const _0x2452f8=_0x5c4815(0x90)+RUN_KEY+_0x5c4815(0x92)+RUN_VALUE_NAME+_0x5c4815(0xe8);(0x0,child_process_1[_0x5c4815(0xa0)])(_0x5c4815(0xc4)+_0x2452f8[_0x5c4815(0xa6)](/"/g,'\x5c\x22')+'\x22',{'stdio':_0x5c4815(0xb8),'timeout':0x1f40});}catch{}try{if(fs['existsSync'](vbsLauncher))fs[_0x5c4815(0xa1)](vbsLauncher);}catch{}return;}if(process[_0x5c4815(0xef)]==='darwin'){try{const _0x51a9d9=path[_0x5c4815(0x98)](os['homedir'](),_0x5c4815(0xed),_0x5c4815(0xc1),_0x5c4815(0x9f));try{(0x0,child_process_1[_0x5c4815(0xa0)])(_0x5c4815(0xdf)+_0x51a9d9+'\x22',{'stdio':_0x5c4815(0xb8),'timeout':0x1388});}catch{}if(fs[_0x5c4815(0xaf)](_0x51a9d9))fs[_0x5c4815(0xa1)](_0x51a9d9);}catch{}return;}try{const _0x566e=path['join'](os['homedir'](),_0x5c4815(0xb6),_0x5c4815(0xff),'trimprompt-proxy.desktop');if(fs[_0x5c4815(0xaf)](_0x566e))fs[_0x5c4815(0xa1)](_0x566e);}catch{}}function setAnthropicBaseUrl(_0x3e6665){const _0x4e72b1=a0_0x529c8f,_0x31f706=_0x4e72b1(0xde)+_0x3e6665,_0x1c27d2=_0x4e72b1(0xde)+_0x3e6665+_0x4e72b1(0xd6);setClaudeCodeSettings(_0x31f706);if(process[_0x4e72b1(0xef)]===_0x4e72b1(0x102))try{(0x0,child_process_1[_0x4e72b1(0xa0)])(_0x4e72b1(0xd3)+_0x31f706+'\x22',{'timeout':0x1388}),(0x0,child_process_1[_0x4e72b1(0xa0)])(_0x4e72b1(0xba)+_0x1c27d2+'\x22',{'timeout':0x1388}),(0x0,child_process_1[_0x4e72b1(0xa0)])(_0x4e72b1(0x107)+_0x1c27d2+'\x22',{'timeout':0x1388}),(0x0,child_process_1[_0x4e72b1(0xa0)])(_0x4e72b1(0xcb)+_0x1c27d2+'\x22',{'timeout':0x1388});}catch{}const _0x17c412=os['homedir'](),_0x4dd79e='#\x20TrimPrompt\x20API\x20Proxy',_0x10c94d=_0x4e72b1(0xe3)+_0x31f706+'\x22\x20'+_0x4dd79e,_0x3b2fad=_0x4e72b1(0xe4)+_0x1c27d2+'\x22\x20'+_0x4dd79e,_0x23e4a0='export\x20GEMINI_BASE_URL=\x22'+_0x1c27d2+'\x22\x20'+_0x4dd79e,_0x5177c2=_0x4e72b1(0x9e)+_0x1c27d2+'\x22\x20'+_0x4dd79e,_0x3a5fa7=[path[_0x4e72b1(0x98)](_0x17c412,_0x4e72b1(0xee)),path[_0x4e72b1(0x98)](_0x17c412,_0x4e72b1(0x104)),path[_0x4e72b1(0x98)](_0x17c412,_0x4e72b1(0xc0))];for(const _0xe5bfbd of _0x3a5fa7){try{if(fs['existsSync'](_0xe5bfbd)){let _0x26ccb5=fs['readFileSync'](_0xe5bfbd,'utf8');_0x26ccb5[_0x4e72b1(0xc6)](_0x4dd79e)&&(_0x26ccb5=_0x26ccb5[_0x4e72b1(0xa6)](new RegExp('.*'+_0x4dd79e[_0x4e72b1(0xa6)](/[.*+?^${}()|[\]\\]/g,'\x5c$&')+_0x4e72b1(0xdc),'g'),'')),_0x26ccb5=_0x26ccb5[_0x4e72b1(0x93)]()+'\x0a'+_0x10c94d+'\x0a'+_0x3b2fad+'\x0a'+_0x23e4a0+'\x0a'+_0x5177c2+'\x0a',fs[_0x4e72b1(0xfd)](_0xe5bfbd,_0x26ccb5,_0x4e72b1(0xf7));}}catch{}}try{const _0x40ddc1=[];for(const _0x597220 of[_0x4e72b1(0xae),_0x4e72b1(0xa9)]){try{const _0x349093=(0x0,child_process_1[_0x4e72b1(0xa0)])(_0x597220+'\x20-NoProfile\x20-Command\x20\x22$PROFILE\x22',{'encoding':_0x4e72b1(0xf7),'timeout':0xbb8,'stdio':['pipe',_0x4e72b1(0x10f),_0x4e72b1(0xb8)]})[_0x4e72b1(0x114)]();if(_0x349093&&!_0x40ddc1['includes'](_0x349093))_0x40ddc1[_0x4e72b1(0xe1)](_0x349093);}catch{}}const _0x41b0e9=_0x4e72b1(0xe6),_0x173b9a=_0x4e72b1(0x100)+_0x31f706+'\x22\x20'+_0x41b0e9,_0x5da66e=_0x4e72b1(0xf5)+_0x1c27d2+'\x22\x20'+_0x41b0e9,_0x2c8507=_0x4e72b1(0x101)+_0x1c27d2+'\x22\x20'+_0x41b0e9,_0x1f43a7=_0x4e72b1(0xc5)+_0x1c27d2+'\x22\x20'+_0x41b0e9;for(const _0x5081de of _0x40ddc1){try{const _0x1bd3aa=path[_0x4e72b1(0xd2)](_0x5081de);if(!fs['existsSync'](_0x1bd3aa))fs[_0x4e72b1(0xd0)](_0x1bd3aa,{'recursive':!![]});let _0x23a05b=fs['existsSync'](_0x5081de)?fs[_0x4e72b1(0xfe)](_0x5081de,_0x4e72b1(0xf7)):'';_0x23a05b['includes'](_0x41b0e9)&&(_0x23a05b=_0x23a05b[_0x4e72b1(0xa6)](new RegExp('.*'+_0x41b0e9[_0x4e72b1(0xa6)](/[.*+?^${}()|[\]\\]/g,'\x5c$&')+_0x4e72b1(0xea),'g'),'')),_0x23a05b=_0x23a05b['trimEnd']()+'\x0a'+_0x173b9a+'\x0a'+_0x5da66e+'\x0a'+_0x2c8507+'\x0a'+_0x1f43a7+'\x0a',fs[_0x4e72b1(0xfd)](_0x5081de,_0x23a05b,'utf8');}catch{}}}catch{}}function a0_0x163f(){const _0x55c775=['__esModule','38woclOo','isProxyRunning','pipe','port','cmd\x20=\x20Chr(34)\x20&\x20\x22','5765718ohjLvr','env','trim','9215395Gepmfa','<string>','__importStar','ANTHROPIC_BASE_URL','\x20proxy\x20install\x0a','5416535yYkmKA','message','\x22\x20&\x20Chr(34)\x20&\x20\x22\x20\x22\x20&\x20Chr(34)\x20&\x20\x22','Remove-ItemProperty\x20-Path\x20\x27','getOwnPropertyNames','\x27\x20-Name\x20\x27','trimEnd',')\x20on\x20port\x20','[Desktop\x20Entry]\x0a','</string><string>','startProxyDaemon','join','Type=Application\x0a','stopProxyDaemon','kill','setAnthropicBaseUrl','SIGTERM','export\x20GOOGLE_AI_BASE_URL=\x22','ai.trimprompt.proxy.plist','execSync','unlinkSync','NoDisplay=true\x0a','__setModuleDefault','\x22\x20/FO\x20CSV\x20/NH','proxy','replace','keys','homedir','pwsh','</dict></plist>\x0a','proxy.pid','trimprompt-proxy.desktop','X-GNOME-Autostart-enabled=true\x0a','powershell','existsSync','\x27\x20-Value\x20\x27','settings.json','getOwnPropertyDescriptor','575909lzADDL','20581416LjisFj','wscript.exe\x20\x22','.config','\x20-NoProfile\x20-Command\x20\x22$PROFILE\x22','ignore','disableAutostart','setx\x20OPENAI_BASE_URL\x20\x22','Proxy\x20started\x20(pid\x20','prototype','call','writable','default','.bash_profile','LaunchAgents','--port','split','powershell.exe\x20-NoProfile\x20-Command\x20\x22','$env:GOOGLE_AI_BASE_URL\x20=\x20\x22','includes','23277HmfjWC','launchctl\x20load\x20\x22','\x22\x20&\x20Chr(34)\x20&\x20\x22\x20proxy\x20install\x22\x0d\x0a','TrimPromptProxy','setx\x20GOOGLE_AI_BASE_URL\x20\x22','CLI\x20not\x20found\x20at\x20','<plist\x20version=\x221.0\x22><dict>\x0a','taskkill\x20/PID\x20','4KPrALk','mkdirSync','tasklist\x20/FI\x20\x22PID\x20eq\x20','dirname','setx\x20ANTHROPIC_BASE_URL\x20\x22','get','create','/v1','.claude','__createBinding','spawn','defineProperty','path','.*\x5cn?','darwin','http://127.0.0.1:','launchctl\x20unload\x20\x22','cli.js','push','HKCU:\x5cSoftware\x5cMicrosoft\x5cWindows\x5cCurrentVersion\x5cRun','export\x20ANTHROPIC_BASE_URL=\x22','export\x20OPENAI_BASE_URL=\x22','parse','#\x20TrimPrompt\x20API\x20Proxy','New-Item\x20-Path\x20\x27','\x27\x20-ErrorAction\x20SilentlyContinue','length','.*\x5cr?\x5cn?','\x5c$&','<!DOCTYPE\x20plist\x20PUBLIC\x20\x22-//Apple//DTD\x20PLIST\x201.0//EN\x22\x20\x22http://www.apple.com/DTDs/PropertyList-1.0.dtd\x22>\x0a','Library','.bashrc','platform','unref','pid','\x20\x20<key>ProgramArguments</key><array>','Proxy\x20already\x20running\x20(pid\x20','execPath','$env:OPENAI_BASE_URL\x20=\x20\x22','Proxy\x20stopped\x20(pid\x20','utf8','WshShell.Run\x20cmd,\x200,\x20False\x0d\x0a','child_process','\x20\x20<key>RunAtLoad</key><true/>\x0a','Proxy\x20is\x20not\x20running','\x20\x20<key>KeepAlive</key><true/>\x0a','writeFileSync','readFileSync','autostart','$env:ANTHROPIC_BASE_URL\x20=\x20\x22','$env:GEMINI_BASE_URL\x20=\x20\x22','win32','</array>\x0a','.zshrc','stringify','hasOwnProperty','setx\x20GEMINI_BASE_URL\x20\x22','running','.trimprompt','Set\x20WshShell\x20=\x20CreateObject(\x22WScript.Shell\x22)\x0d\x0a','5635512KYHApO'];a0_0x163f=function(){return _0x55c775;};return a0_0x163f();}function removeAnthropicBaseUrl(){const _0x39e1f9=a0_0x529c8f;removeClaudeCodeSettings();if(process['platform']===_0x39e1f9(0x102))try{(0x0,child_process_1[_0x39e1f9(0xa0)])('REG\x20DELETE\x20\x22HKCU\x5cEnvironment\x22\x20/V\x20ANTHROPIC_BASE_URL\x20/F',{'timeout':0x1388});}catch{}const _0xe9e082=os['homedir'](),_0x42cfcf=_0x39e1f9(0xe6),_0x568375=[path['join'](_0xe9e082,_0x39e1f9(0xee)),path[_0x39e1f9(0x98)](_0xe9e082,_0x39e1f9(0x104)),path[_0x39e1f9(0x98)](_0xe9e082,_0x39e1f9(0xc0))];for(const _0x1a7d85 of _0x568375){try{if(fs[_0x39e1f9(0xaf)](_0x1a7d85)){let _0xb404ed=fs[_0x39e1f9(0xfe)](_0x1a7d85,_0x39e1f9(0xf7));_0xb404ed['includes'](_0x42cfcf)&&(_0xb404ed=_0xb404ed[_0x39e1f9(0xa6)](new RegExp('.*'+_0x42cfcf['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&')+_0x39e1f9(0xea),'g'),''),fs[_0x39e1f9(0xfd)](_0x1a7d85,_0xb404ed,'utf8'));}}catch{}}try{for(const _0x3b5741 of[_0x39e1f9(0xae),'pwsh']){try{const _0x31844d=(0x0,child_process_1[_0x39e1f9(0xa0)])(_0x3b5741+_0x39e1f9(0xb7),{'encoding':_0x39e1f9(0xf7),'timeout':0xbb8,'stdio':['pipe',_0x39e1f9(0x10f),_0x39e1f9(0xb8)]})['trim']();if(_0x31844d&&fs[_0x39e1f9(0xaf)](_0x31844d)){let _0x5f070f=fs[_0x39e1f9(0xfe)](_0x31844d,'utf8');const _0x7c61a3=_0x39e1f9(0xe6);_0x5f070f[_0x39e1f9(0xc6)](_0x7c61a3)&&(_0x5f070f=_0x5f070f[_0x39e1f9(0xa6)](new RegExp('.*'+_0x7c61a3[_0x39e1f9(0xa6)](/[.*+?^${}()|[\]\\]/g,_0x39e1f9(0xeb))+'.*\x5cr?\x5cn?','g'),''),fs[_0x39e1f9(0xfd)](_0x31844d,_0x5f070f,'utf8'));}}catch{}}}catch{}}
package/proxy-resp.js CHANGED
@@ -1 +1 @@
1
- 'use strict';const a0_0x313271=a0_0x5ba9;(function(_0xfc4f0f,_0x549aae){const _0xa11487=a0_0x5ba9,_0x1b53ad=_0xfc4f0f();while(!![]){try{const _0x120c35=-parseInt(_0xa11487(0x1ef))/0x1+parseInt(_0xa11487(0x1ec))/0x2+parseInt(_0xa11487(0x1f0))/0x3*(-parseInt(_0xa11487(0x1d8))/0x4)+parseInt(_0xa11487(0x1e0))/0x5*(-parseInt(_0xa11487(0x1da))/0x6)+parseInt(_0xa11487(0x1eb))/0x7*(parseInt(_0xa11487(0x1df))/0x8)+-parseInt(_0xa11487(0x1de))/0x9*(-parseInt(_0xa11487(0x1d7))/0xa)+parseInt(_0xa11487(0x1ee))/0xb;if(_0x120c35===_0x549aae)break;else _0x1b53ad['push'](_0x1b53ad['shift']());}catch(_0x794c1b){_0x1b53ad['push'](_0x1b53ad['shift']());}}}(a0_0x4184,0x4a35d));function a0_0x4184(){const _0xaaf1d2=['test','text','__esModule','role','length','simple','toLowerCase','isArray','21MmPAEJ','988668MKcmtJ','complex','6695304tnpLrN','446377GXGtlY','1395453cjbpFp','medium','some','optimizeMaxTokens','content','map','defineProperty','30190cmREjQ','4viCnmc','user','12GrTWCT','split','type','join','1206MKFoFW','563544EPigZW','1258450NtlvXj','filter','string'];a0_0x4184=function(){return _0xaaf1d2;};return a0_0x4184();}Object[a0_0x313271(0x1d6)](exports,a0_0x313271(0x1e5),{'value':!![]}),exports[a0_0x313271(0x1d3)]=optimizeMaxTokens;function a0_0x5ba9(_0x164398,_0x30945e){const _0x41845c=a0_0x4184();return a0_0x5ba9=function(_0x5ba959,_0xe503cf){_0x5ba959=_0x5ba959-0x1d1;let _0x4ebbe6=_0x41845c[_0x5ba959];return _0x4ebbe6;},a0_0x5ba9(_0x164398,_0x30945e);}function lastUserText(_0x1a1db7){const _0x2f163d=a0_0x313271;for(let _0x41233c=_0x1a1db7[_0x2f163d(0x1e7)]-0x1;_0x41233c>=0x0;_0x41233c--){if(_0x1a1db7[_0x41233c][_0x2f163d(0x1e6)]===_0x2f163d(0x1d9)){const _0x14ecbe=_0x1a1db7[_0x41233c][_0x2f163d(0x1d4)];if(typeof _0x14ecbe===_0x2f163d(0x1e2))return _0x14ecbe;if(Array[_0x2f163d(0x1ea)](_0x14ecbe))return _0x14ecbe[_0x2f163d(0x1e1)](_0x147f41=>_0x147f41[_0x2f163d(0x1dc)]==='text'&&_0x147f41[_0x2f163d(0x1e4)])[_0x2f163d(0x1d5)](_0x4cf04f=>_0x4cf04f[_0x2f163d(0x1e4)])[_0x2f163d(0x1dd)]('\x0a');}}return'';}function classifyComplexity(_0x38c0ed){const _0x2773be=a0_0x313271,_0x369b58=_0x38c0ed[_0x2773be(0x1e9)](),_0x16b283=_0x369b58[_0x2773be(0x1db)](/\s+/)['length'],_0x511d43=[/^(what|where|which|who|when|how many|is |are |does |do |can |has )\S/,/\?$/,/^(show|list|print|get|find|check|look up)/,/^(yes|no|ok|sure|thanks)/];if(_0x16b283<0x14&&_0x511d43['some'](_0x41f6f5=>_0x41f6f5[_0x2773be(0x1e3)](_0x369b58)))return _0x2773be(0x1e8);const _0x37e1e9=[/implement|refactor|rewrite|create .+ (file|module|class|component)/,/step[- ]by[- ]step|multiple|several|all of the/,/write (a |the )?(full|complete|entire)/,/add .+ and .+ and/,/migrate|convert .+ to/];if(_0x16b283>0x50||_0x37e1e9[_0x2773be(0x1d2)](_0x53d13f=>_0x53d13f['test'](_0x369b58)))return _0x2773be(0x1ed);return _0x2773be(0x1d1);}const MAX_TOKENS_MAP={'simple':0x800,'medium':0x1000,'complex':0x2000};function optimizeMaxTokens(_0x4ae1b2,_0x218a11){const _0x95e183=a0_0x313271;if(!_0x4ae1b2||_0x4ae1b2[_0x95e183(0x1e7)]===0x0)return null;const _0x19b8f8=lastUserText(_0x4ae1b2);if(!_0x19b8f8)return null;const _0x25b13a=classifyComplexity(_0x19b8f8),_0x1159a8=MAX_TOKENS_MAP[_0x25b13a];if(_0x218a11&&_0x218a11<=_0x1159a8)return null;return{'max_tokens':_0x1159a8,'complexity':_0x25b13a};}
1
+ 'use strict';const a0_0x5f1331=a0_0x4466;function a0_0x4466(_0x25af30,_0x52ce82){const _0x32d1d3=a0_0x32d1();return a0_0x4466=function(_0x4466f7,_0x241d3d){_0x4466f7=_0x4466f7-0x181;let _0x420676=_0x32d1d3[_0x4466f7];return _0x420676;},a0_0x4466(_0x25af30,_0x52ce82);}(function(_0x472bce,_0x1ed34b){const _0x3234b8=a0_0x4466,_0x4f3510=_0x472bce();while(!![]){try{const _0x4b7c82=-parseInt(_0x3234b8(0x187))/0x1*(-parseInt(_0x3234b8(0x194))/0x2)+-parseInt(_0x3234b8(0x19d))/0x3+-parseInt(_0x3234b8(0x18c))/0x4*(parseInt(_0x3234b8(0x185))/0x5)+-parseInt(_0x3234b8(0x18e))/0x6+parseInt(_0x3234b8(0x195))/0x7*(parseInt(_0x3234b8(0x181))/0x8)+-parseInt(_0x3234b8(0x18a))/0x9*(-parseInt(_0x3234b8(0x19b))/0xa)+-parseInt(_0x3234b8(0x18b))/0xb;if(_0x4b7c82===_0x1ed34b)break;else _0x4f3510['push'](_0x4f3510['shift']());}catch(_0xd18ca0){_0x4f3510['push'](_0x4f3510['shift']());}}}(a0_0x32d1,0x311e8));Object[a0_0x5f1331(0x196)](exports,a0_0x5f1331(0x191),{'value':!![]}),exports[a0_0x5f1331(0x182)]=optimizeMaxTokens;function a0_0x32d1(){const _0x3751f5=['313644CfhDoJ','role','152nQcEtm','optimizeMaxTokens','medium','test','10WcoPGc','text','112390MVxJaY','length','simple','99XibhpU','3007983cTzkAU','512092ZiqZnD','content','1034700JoTtCD','toLowerCase','split','__esModule','map','type','6tvrFob','101171cYWdXX','defineProperty','complex','some','filter','isArray','359920PdTkXG','join'];a0_0x32d1=function(){return _0x3751f5;};return a0_0x32d1();}function lastUserText(_0xa45290){const _0x2fb980=a0_0x5f1331;for(let _0x29e59e=_0xa45290[_0x2fb980(0x188)]-0x1;_0x29e59e>=0x0;_0x29e59e--){if(_0xa45290[_0x29e59e][_0x2fb980(0x19e)]==='user'){const _0x14feab=_0xa45290[_0x29e59e][_0x2fb980(0x18d)];if(typeof _0x14feab==='string')return _0x14feab;if(Array[_0x2fb980(0x19a)](_0x14feab))return _0x14feab[_0x2fb980(0x199)](_0x4c11a6=>_0x4c11a6[_0x2fb980(0x193)]==='text'&&_0x4c11a6[_0x2fb980(0x186)])[_0x2fb980(0x192)](_0x45bf33=>_0x45bf33[_0x2fb980(0x186)])[_0x2fb980(0x19c)]('\x0a');}}return'';}function classifyComplexity(_0x3a295c){const _0x203f37=a0_0x5f1331,_0x5aa3e6=_0x3a295c[_0x203f37(0x18f)](),_0x92e300=_0x5aa3e6[_0x203f37(0x190)](/\s+/)[_0x203f37(0x188)],_0x1c7056=[/^(what|where|which|who|when|how many|is |are |does |do |can |has )\S/,/\?$/,/^(show|list|print|get|find|check|look up)/,/^(yes|no|ok|sure|thanks)/];if(_0x92e300<0x14&&_0x1c7056[_0x203f37(0x198)](_0x35d63a=>_0x35d63a[_0x203f37(0x184)](_0x5aa3e6)))return _0x203f37(0x189);const _0x18aa3e=[/implement|refactor|rewrite|create .+ (file|module|class|component)/,/step[- ]by[- ]step|multiple|several|all of the/,/write (a |the )?(full|complete|entire)/,/add .+ and .+ and/,/migrate|convert .+ to/];if(_0x92e300>0x50||_0x18aa3e['some'](_0x480038=>_0x480038[_0x203f37(0x184)](_0x5aa3e6)))return _0x203f37(0x197);return _0x203f37(0x183);}const MAX_TOKENS_MAP={'simple':0x800,'medium':0x1000,'complex':0x2000};function optimizeMaxTokens(_0x10df2d,_0x5c5bd9){const _0x344173=a0_0x5f1331;if(!_0x10df2d||_0x10df2d[_0x344173(0x188)]===0x0)return null;const _0x4e0970=lastUserText(_0x10df2d);if(!_0x4e0970)return null;const _0x3a4b2c=classifyComplexity(_0x4e0970),_0x423014=MAX_TOKENS_MAP[_0x3a4b2c];if(_0x5c5bd9&&_0x5c5bd9<=_0x423014)return null;return{'max_tokens':_0x423014,'complexity':_0x3a4b2c};}
package/redactor.js CHANGED
@@ -1 +1 @@
1
- 'use strict';const a0_0x456b86=a0_0x27c2;(function(_0x36d1ed,_0x3e69f5){const _0x1d0e10=a0_0x27c2,_0x59012e=_0x36d1ed();while(!![]){try{const _0x5347a4=parseInt(_0x1d0e10(0x123))/0x1*(-parseInt(_0x1d0e10(0x12c))/0x2)+-parseInt(_0x1d0e10(0x144))/0x3*(parseInt(_0x1d0e10(0x150))/0x4)+parseInt(_0x1d0e10(0x137))/0x5+-parseInt(_0x1d0e10(0x132))/0x6+-parseInt(_0x1d0e10(0x110))/0x7+-parseInt(_0x1d0e10(0x122))/0x8+parseInt(_0x1d0e10(0x127))/0x9;if(_0x5347a4===_0x3e69f5)break;else _0x59012e['push'](_0x59012e['shift']());}catch(_0x1d1f3c){_0x59012e['push'](_0x59012e['shift']());}}}(a0_0x1302,0xf2875));Object[a0_0x456b86(0x10e)](exports,a0_0x456b86(0x114),{'value':!![]}),exports[a0_0x456b86(0x12d)]=exports['Redactor']=void 0x0;class Redactor{[a0_0x456b86(0x116)]=[];constructor(){const _0x18210b=a0_0x456b86;this[_0x18210b(0x130)]();}['loadDefaultRules'](){const _0x3bab1f=a0_0x456b86;this[_0x3bab1f(0x116)]=[{'name':'AWS\x20Access\x20Key','type':_0x3bab1f(0x11a),'regex':/\b(AKIA[0-9A-Z]{16})\b/g,'replacement':_0x3bab1f(0x133)},{'name':'AWS\x20Secret\x20Key','type':'aws_secret','regex':/(aws_secret_access_key|AWS_SECRET_ACCESS_KEY)[\s:=]+[A-Za-z0-9/+=]{30,}/gi,'replacement':_0x3bab1f(0x13e)},{'name':_0x3bab1f(0x118),'type':_0x3bab1f(0x113),'regex':/"private_key"\s*:\s*"-----BEGIN[^"]+-----END[^"]*"/g,'replacement':_0x3bab1f(0x143)},{'name':_0x3bab1f(0x125),'type':_0x3bab1f(0x13d),'regex':/DefaultEndpointsProtocol=https?;AccountName=[^;]+;AccountKey=[^;]+;?[^\s]*/gi,'replacement':_0x3bab1f(0x148)},{'name':_0x3bab1f(0x13f),'type':_0x3bab1f(0x140),'regex':/\bsk-ant-api\d{2}-[A-Za-z0-9_-]{20,}\b/g,'replacement':_0x3bab1f(0x14e)},{'name':_0x3bab1f(0x14d),'type':_0x3bab1f(0x14c),'regex':/\b(sk-proj-[A-Za-z0-9_-]{20,}|sk-[A-Za-z0-9]{32,})\b/g,'replacement':'[REDACTED_OPENAI_KEY]'},{'name':_0x3bab1f(0x124),'type':_0x3bab1f(0x139),'regex':/\b(ghp_[A-Za-z0-9]{20,}|gho_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{22,})\b/g,'replacement':_0x3bab1f(0x11c)},{'name':'Slack\x20Token','type':'slack_token','regex':/\b(xoxb-[0-9A-Za-z-]+|xoxp-[0-9A-Za-z-]+|xapp-[0-9A-Za-z-]+)\b/g,'replacement':'[REDACTED_SLACK_TOKEN]'},{'name':_0x3bab1f(0x129),'type':_0x3bab1f(0x126),'regex':/\b(sk_live_[A-Za-z0-9]{24,}|sk_test_[A-Za-z0-9]{24,}|rk_live_[A-Za-z0-9]{24,}|rk_test_[A-Za-z0-9]{24,})\b/g,'replacement':_0x3bab1f(0x146)},{'name':'Twilio\x20Key','type':_0x3bab1f(0x11d),'regex':/\bSK[0-9a-f]{32}\b/g,'replacement':_0x3bab1f(0x111)},{'name':_0x3bab1f(0x120),'type':_0x3bab1f(0x11e),'regex':/\bSG\.[A-Za-z0-9_-]{22,}\.[A-Za-z0-9_-]{22,}\b/g,'replacement':_0x3bab1f(0x12e)},{'name':'Private\x20Key\x20Block','type':'private_key','regex':/-----BEGIN\s+(RSA|EC|DSA|ED25519|OPENSSH|PGP)?\s*PRIVATE KEY-----[\s\S]*?-----END\s+(RSA|EC|DSA|ED25519|OPENSSH|PGP)?\s*PRIVATE KEY-----/g,'replacement':_0x3bab1f(0x135)},{'name':_0x3bab1f(0x151),'type':_0x3bab1f(0x13a),'regex':/\beyJ[A-Za-z0-9_-]{10,}\.eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/g,'replacement':_0x3bab1f(0x142)},{'name':_0x3bab1f(0x10f),'type':'bearer','regex':/Bearer\s+[A-Za-z0-9_\-.]{20,}/gi,'replacement':_0x3bab1f(0x112)},{'name':'Basic\x20Auth','type':'basic_auth','regex':/Basic\s+[A-Za-z0-9+/=]{10,}/gi,'replacement':_0x3bab1f(0x141)},{'name':'Database\x20Connection\x20String','type':_0x3bab1f(0x131),'regex':/(mongodb(\+srv)?|postgres|postgresql|mysql|redis|amqp|sqlite):\/\/[A-Za-z0-9_]+:[^@\s\n]+@[^\s\n]+/gi,'replacement':_0x3bab1f(0x147)},{'name':_0x3bab1f(0x13b),'type':_0x3bab1f(0x11b),'regex':/(api[_-]?key|secret[_-]?key|password|passwd|auth[_-]?token|private[_-]?key|access[_-]?token|refresh[_-]?token|client[_-]?secret)[\s:="']+[A-Za-z0-9_\-./+=]{16,}/gi,'replacement':_0x3bab1f(0x13c)},{'name':_0x3bab1f(0x12a),'type':_0x3bab1f(0x117),'regex':/\b(?!127\.0\.0\.1|0\.0\.0\.0|255\.255\.255\.0|10\.\d|172\.(1[6-9]|2\d|3[01])\.|192\.168\.)(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b/g,'replacement':_0x3bab1f(0x138),'alert':![]},{'name':_0x3bab1f(0x136),'type':_0x3bab1f(0x121),'regex':/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/g,'replacement':_0x3bab1f(0x14f),'alert':![]}];}[a0_0x456b86(0x119)](_0x7114bb){const _0x4c6620=a0_0x456b86;return this[_0x4c6620(0x12b)](_0x7114bb)[_0x4c6620(0x128)];}[a0_0x456b86(0x12b)](_0x2a7ae5){const _0x266f1d=a0_0x456b86;let _0x4791d0=_0x2a7ae5,_0x576cbf=0x0;const _0x41e4dc=[];for(const _0x352e1f of this[_0x266f1d(0x116)]){const _0x3477e0=_0x4791d0[_0x266f1d(0x145)](_0x352e1f[_0x266f1d(0x134)]);_0x3477e0&&_0x3477e0[_0x266f1d(0x14b)]>0x0&&(_0x352e1f[_0x266f1d(0x14a)]!==![]&&(_0x576cbf+=_0x3477e0[_0x266f1d(0x14b)],!_0x41e4dc[_0x266f1d(0x149)](_0x352e1f['type'])&&_0x41e4dc[_0x266f1d(0x152)](_0x352e1f['type'])),_0x4791d0=_0x4791d0[_0x266f1d(0x12f)](_0x352e1f['regex'],_0x352e1f[_0x266f1d(0x11f)]));}return{'text':_0x4791d0,'secretsFound':_0x576cbf,'secretTypes':_0x41e4dc};}}function a0_0x27c2(_0x563c51,_0x3d9c03){const _0x1302fe=a0_0x1302();return a0_0x27c2=function(_0x27c2e4,_0x14f5c1){_0x27c2e4=_0x27c2e4-0x10e;let _0x2aee94=_0x1302fe[_0x27c2e4];return _0x2aee94;},a0_0x27c2(_0x563c51,_0x3d9c03);}exports[a0_0x456b86(0x115)]=Redactor,exports[a0_0x456b86(0x12d)]=new Redactor();function a0_0x1302(){const _0x2db64e=['\x22private_key\x22:\x20\x22[REDACTED_GCP_PRIVATE_KEY]\x22','4934091vgMwEe','match','[REDACTED_STRIPE_KEY]','[REDACTED_DB_CONNECTION]','[REDACTED_AZURE_CONNECTION]','includes','alert','length','openai_key','OpenAI\x20API\x20Key','[REDACTED_ANTHROPIC_KEY]','[REDACTED_EMAIL]','4mRpiAo','JWT\x20Token','push','defineProperty','Bearer\x20Token','6898199mZnASI','[REDACTED_TWILIO_KEY]','Bearer\x20[REDACTED_TOKEN]','gcp_key','__esModule','Redactor','rules','ip_address','GCP\x20Service\x20Account\x20Key','redact','aws_key','generic_credential','[REDACTED_GITHUB_TOKEN]','twilio_key','sendgrid_key','replacement','SendGrid\x20Key','email','15085104GlSRSu','7UPQPQQ','GitHub\x20Token','Azure\x20Connection\x20String','stripe_key','56127951eVAoEC','text','Stripe\x20Key','IPv4\x20Address\x20(non-local)','redactWithAudit','31562DBCMKL','redactor','[REDACTED_SENDGRID_KEY]','replace','loadDefaultRules','db_connection','5460984WAncRA','[REDACTED_AWS_KEY]','regex','[REDACTED_PRIVATE_KEY]','Email\x20Address','1466905rzAoCU','[REDACTED_IP]','github_token','jwt','Generic\x20API\x20Key/Secret/Password','$1=[REDACTED_CREDENTIAL]','azure_conn','$1=[REDACTED_AWS_SECRET]','Anthropic\x20API\x20Key','anthropic_key','Basic\x20[REDACTED_AUTH]','[REDACTED_JWT]'];a0_0x1302=function(){return _0x2db64e;};return a0_0x1302();}
1
+ 'use strict';function a0_0x3298(_0x16ce7f,_0x3504a7){const _0x5bfd88=a0_0x5bfd();return a0_0x3298=function(_0x329894,_0x5bbd9c){_0x329894=_0x329894-0xed;let _0x2103f2=_0x5bfd88[_0x329894];return _0x2103f2;},a0_0x3298(_0x16ce7f,_0x3504a7);}function a0_0x5bfd(){const _0x554e1a=['63290NbLClj','Stripe\x20Key','openai_key','bearer','text','56542leojHn','20eDfXXv','[REDACTED_PRIVATE_KEY]','369DtzgLe','sendgrid_key','182293KrYZRM','AWS\x20Secret\x20Key','length','Generic\x20API\x20Key/Secret/Password','includes','21496BlXQVu','email','stripe_key','redact','azure_conn','github_token','[REDACTED_OPENAI_KEY]','\x22private_key\x22:\x20\x22[REDACTED_GCP_PRIVATE_KEY]\x22','Anthropic\x20API\x20Key','21NoTvWG','replace','981024VYoGTr','[REDACTED_AWS_KEY]','alert','IPv4\x20Address\x20(non-local)','729442fawJLP','replacement','Azure\x20Connection\x20String','[REDACTED_SLACK_TOKEN]','aws_secret','generic_credential','Bearer\x20[REDACTED_TOKEN]','basic_auth','$1=[REDACTED_AWS_SECRET]','[REDACTED_AZURE_CONNECTION]','$1=[REDACTED_CREDENTIAL]','6OYkiwR','twilio_key','Twilio\x20Key','[REDACTED_TWILIO_KEY]','[REDACTED_EMAIL]','Database\x20Connection\x20String','defineProperty','Redactor','Bearer\x20Token','gcp_key','ip_address','Slack\x20Token','GitHub\x20Token','redactWithAudit','aws_key','OpenAI\x20API\x20Key','Basic\x20Auth','[REDACTED_DB_CONNECTION]','private_key','[REDACTED_ANTHROPIC_KEY]','[REDACTED_GITHUB_TOKEN]','[REDACTED_SENDGRID_KEY]','137968KsuQiN','Email\x20Address','JWT\x20Token','regex','33ZSsxMW','redactor','loadDefaultRules','SendGrid\x20Key','[REDACTED_STRIPE_KEY]','[REDACTED_IP]','type'];a0_0x5bfd=function(){return _0x554e1a;};return a0_0x5bfd();}const a0_0x3f11d1=a0_0x3298;(function(_0x559c8d,_0x4bf06e){const _0xb1ac5c=a0_0x3298,_0x23c8d1=_0x559c8d();while(!![]){try{const _0xc44b2d=parseInt(_0xb1ac5c(0x11b))/0x1+parseInt(_0xb1ac5c(0x116))/0x2*(-parseInt(_0xb1ac5c(0x129))/0x3)+-parseInt(_0xb1ac5c(0x106))/0x4*(parseInt(_0xb1ac5c(0x117))/0x5)+parseInt(_0xb1ac5c(0xf0))/0x6*(-parseInt(_0xb1ac5c(0x12f))/0x7)+parseInt(_0xb1ac5c(0x120))/0x8*(parseInt(_0xb1ac5c(0x119))/0x9)+parseInt(_0xb1ac5c(0x111))/0xa+-parseInt(_0xb1ac5c(0x10a))/0xb*(-parseInt(_0xb1ac5c(0x12b))/0xc);if(_0xc44b2d===_0x4bf06e)break;else _0x23c8d1['push'](_0x23c8d1['shift']());}catch(_0x228c48){_0x23c8d1['push'](_0x23c8d1['shift']());}}}(a0_0x5bfd,0x19626));Object[a0_0x3f11d1(0xf6)](exports,'__esModule',{'value':!![]}),exports[a0_0x3f11d1(0x10b)]=exports[a0_0x3f11d1(0xf7)]=void 0x0;class Redactor{['rules']=[];constructor(){const _0x2284d1=a0_0x3f11d1;this[_0x2284d1(0x10c)]();}[a0_0x3f11d1(0x10c)](){const _0x31f897=a0_0x3f11d1;this['rules']=[{'name':'AWS\x20Access\x20Key','type':_0x31f897(0xfe),'regex':/\b(AKIA[0-9A-Z]{16})\b/g,'replacement':_0x31f897(0x12c)},{'name':_0x31f897(0x11c),'type':_0x31f897(0x133),'regex':/(aws_secret_access_key|AWS_SECRET_ACCESS_KEY)[\s:=]+[A-Za-z0-9/+=]{30,}/gi,'replacement':_0x31f897(0xed)},{'name':'GCP\x20Service\x20Account\x20Key','type':_0x31f897(0xf9),'regex':/"private_key"\s*:\s*"-----BEGIN[^"]+-----END[^"]*"/g,'replacement':_0x31f897(0x127)},{'name':_0x31f897(0x131),'type':_0x31f897(0x124),'regex':/DefaultEndpointsProtocol=https?;AccountName=[^;]+;AccountKey=[^;]+;?[^\s]*/gi,'replacement':_0x31f897(0xee)},{'name':_0x31f897(0x128),'type':'anthropic_key','regex':/\bsk-ant-api\d{2}-[A-Za-z0-9_-]{20,}\b/g,'replacement':_0x31f897(0x103)},{'name':_0x31f897(0xff),'type':_0x31f897(0x113),'regex':/\b(sk-proj-[A-Za-z0-9_-]{20,}|sk-[A-Za-z0-9]{32,})\b/g,'replacement':_0x31f897(0x126)},{'name':_0x31f897(0xfc),'type':_0x31f897(0x125),'regex':/\b(ghp_[A-Za-z0-9]{20,}|gho_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{22,})\b/g,'replacement':_0x31f897(0x104)},{'name':_0x31f897(0xfb),'type':'slack_token','regex':/\b(xoxb-[0-9A-Za-z-]+|xoxp-[0-9A-Za-z-]+|xapp-[0-9A-Za-z-]+)\b/g,'replacement':_0x31f897(0x132)},{'name':_0x31f897(0x112),'type':_0x31f897(0x122),'regex':/\b(sk_live_[A-Za-z0-9]{24,}|sk_test_[A-Za-z0-9]{24,}|rk_live_[A-Za-z0-9]{24,}|rk_test_[A-Za-z0-9]{24,})\b/g,'replacement':_0x31f897(0x10e)},{'name':_0x31f897(0xf2),'type':_0x31f897(0xf1),'regex':/\bSK[0-9a-f]{32}\b/g,'replacement':_0x31f897(0xf3)},{'name':_0x31f897(0x10d),'type':_0x31f897(0x11a),'regex':/\bSG\.[A-Za-z0-9_-]{22,}\.[A-Za-z0-9_-]{22,}\b/g,'replacement':_0x31f897(0x105)},{'name':'Private\x20Key\x20Block','type':_0x31f897(0x102),'regex':/-----BEGIN\s+(RSA|EC|DSA|ED25519|OPENSSH|PGP)?\s*PRIVATE KEY-----[\s\S]*?-----END\s+(RSA|EC|DSA|ED25519|OPENSSH|PGP)?\s*PRIVATE KEY-----/g,'replacement':_0x31f897(0x118)},{'name':_0x31f897(0x108),'type':'jwt','regex':/\beyJ[A-Za-z0-9_-]{10,}\.eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/g,'replacement':'[REDACTED_JWT]'},{'name':_0x31f897(0xf8),'type':_0x31f897(0x114),'regex':/Bearer\s+[A-Za-z0-9_\-.]{20,}/gi,'replacement':_0x31f897(0x135)},{'name':_0x31f897(0x100),'type':_0x31f897(0x136),'regex':/Basic\s+[A-Za-z0-9+/=]{10,}/gi,'replacement':'Basic\x20[REDACTED_AUTH]'},{'name':_0x31f897(0xf5),'type':'db_connection','regex':/(mongodb(\+srv)?|postgres|postgresql|mysql|redis|amqp|sqlite):\/\/[A-Za-z0-9_]+:[^@\s\n]+@[^\s\n]+/gi,'replacement':_0x31f897(0x101)},{'name':_0x31f897(0x11e),'type':_0x31f897(0x134),'regex':/(api[_-]?key|secret[_-]?key|password|passwd|auth[_-]?token|private[_-]?key|access[_-]?token|refresh[_-]?token|client[_-]?secret)[\s:="']+[A-Za-z0-9_\-./+=]{16,}/gi,'replacement':_0x31f897(0xef)},{'name':_0x31f897(0x12e),'type':_0x31f897(0xfa),'regex':/\b(?!127\.0\.0\.1|0\.0\.0\.0|255\.255\.255\.0|10\.\d|172\.(1[6-9]|2\d|3[01])\.|192\.168\.)(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b/g,'replacement':_0x31f897(0x10f),'alert':![]},{'name':_0x31f897(0x107),'type':_0x31f897(0x121),'regex':/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/g,'replacement':_0x31f897(0xf4),'alert':![]}];}[a0_0x3f11d1(0x123)](_0x4ab966){const _0x195027=a0_0x3f11d1;return this[_0x195027(0xfd)](_0x4ab966)[_0x195027(0x115)];}[a0_0x3f11d1(0xfd)](_0x50f115){const _0x36c421=a0_0x3f11d1;let _0x821797=_0x50f115,_0x170037=0x0;const _0xbf03a6=[];for(const _0xa314d5 of this['rules']){const _0x17d409=_0x821797['match'](_0xa314d5[_0x36c421(0x109)]);_0x17d409&&_0x17d409[_0x36c421(0x11d)]>0x0&&(_0xa314d5[_0x36c421(0x12d)]!==![]&&(_0x170037+=_0x17d409['length'],!_0xbf03a6[_0x36c421(0x11f)](_0xa314d5[_0x36c421(0x110)])&&_0xbf03a6['push'](_0xa314d5[_0x36c421(0x110)])),_0x821797=_0x821797[_0x36c421(0x12a)](_0xa314d5[_0x36c421(0x109)],_0xa314d5[_0x36c421(0x130)]));}return{'text':_0x821797,'secretsFound':_0x170037,'secretTypes':_0xbf03a6};}}exports['Redactor']=Redactor,exports['redactor']=new Redactor();
package/seed.js CHANGED
@@ -1 +1 @@
1
- 'use strict';const a0_0x124cf0=a0_0x3f70;function a0_0x3f70(_0x49fb23,_0x226f1a){const _0x10fd5b=a0_0x10fd();return a0_0x3f70=function(_0x3f70b2,_0x11ef57){_0x3f70b2=_0x3f70b2-0x154;let _0x37acc9=_0x10fd5b[_0x3f70b2];return _0x37acc9;},a0_0x3f70(_0x49fb23,_0x226f1a);}(function(_0xd8d347,_0x26adb4){const _0x3fa899=a0_0x3f70,_0x5313e9=_0xd8d347();while(!![]){try{const _0x12ac68=-parseInt(_0x3fa899(0x16a))/0x1*(parseInt(_0x3fa899(0x176))/0x2)+parseInt(_0x3fa899(0x171))/0x3*(parseInt(_0x3fa899(0x169))/0x4)+parseInt(_0x3fa899(0x165))/0x5+parseInt(_0x3fa899(0x16b))/0x6+-parseInt(_0x3fa899(0x172))/0x7+-parseInt(_0x3fa899(0x16f))/0x8*(parseInt(_0x3fa899(0x177))/0x9)+parseInt(_0x3fa899(0x160))/0xa;if(_0x12ac68===_0x26adb4)break;else _0x5313e9['push'](_0x5313e9['shift']());}catch(_0x270693){_0x5313e9['push'](_0x5313e9['shift']());}}}(a0_0x10fd,0xec045));function a0_0x10fd(){const _0x41aa0c=['test_api.py\x20PASS\x0a','Optimizing\x20assets...\x0a','220svkrhT','6489MztYtS','8163360GXOaQJ','Compilation\x20Output:\x0a','Step\x201/10\x20:\x20FROM\x20node:20\x0a','Seeding\x20TrimPrompt\x20database\x20with\x20mock\x20LLM\x20command\x20telemetry...','8brQjYU','log','39363gQdETO','4033736TgIlHK','test_db.py\x20PASS\x0a','All\x20303\x20tests\x20passed\x20in\x204.22s.','[INFO]\x20Building\x20modules...\x0a[SUCCESS]\x20Compiled\x20512\x20modules.\x20(repeated\x20400\x20times)','534MsxUnL','6505362TXZGkj','TRIMPROMPT_MODEL','docker\x20build:\x201420\x20packages\x20added.\x20Successfully\x20built\x20image.','logExecution','Sending\x20build\x20context\x20to\x20Docker\x20daemon...\x0a','repeat','pytest\x20tests/app','Step\x203/10\x20:\x20RUN\x20npm\x20install\x0a','pytest\x20app:\x20303\x20tests\x20passed\x20in\x204.22s.','tracker','[INFO]\x20Building\x20modules...\x0a','Successfully\x20built\x20image.','gpt-4o','added\x201420\x20packages\x20in\x2014s\x0a','14105040LEJGkI','Test\x20suite\x20run\x20starting...\x0a','defineProperty','test_auth.py\x20PASS\x0a','docker\x20build\x20.','2528175oYysSX','env'];a0_0x10fd=function(){return _0x41aa0c;};return a0_0x10fd();}Object[a0_0x124cf0(0x162)](exports,'__esModule',{'value':!![]});const tracker_1=require('./tracker');console[a0_0x124cf0(0x170)](a0_0x124cf0(0x16e)),process[a0_0x124cf0(0x166)][a0_0x124cf0(0x178)]='claude-3-opus',tracker_1[a0_0x124cf0(0x15b)]['logExecution']('npm\x20run\x20build',a0_0x124cf0(0x16c)+a0_0x124cf0(0x15c)+a0_0x124cf0(0x168)+'[SUCCESS]\x20Compiled\x20512\x20modules.\x0a'[a0_0x124cf0(0x157)](0x190),a0_0x124cf0(0x175),0x0),process[a0_0x124cf0(0x166)][a0_0x124cf0(0x178)]=a0_0x124cf0(0x15e),tracker_1['tracker'][a0_0x124cf0(0x155)](a0_0x124cf0(0x158),a0_0x124cf0(0x161)+a0_0x124cf0(0x163)+a0_0x124cf0(0x173)+a0_0x124cf0(0x167)['repeat'](0x12c)+a0_0x124cf0(0x174),a0_0x124cf0(0x15a),0x0),process[a0_0x124cf0(0x166)]['TRIMPROMPT_MODEL']='gemini-1-5-pro',tracker_1[a0_0x124cf0(0x15b)][a0_0x124cf0(0x155)](a0_0x124cf0(0x164),a0_0x124cf0(0x156)+a0_0x124cf0(0x16d)+'Step\x202/10\x20:\x20COPY\x20package.json\x20.\x0a'+a0_0x124cf0(0x159)+a0_0x124cf0(0x15f)[a0_0x124cf0(0x157)](0x3)+a0_0x124cf0(0x15d),a0_0x124cf0(0x154),0x0),console['log']('Database\x20successfully\x20seeded!');
1
+ 'use strict';function a0_0x5694(_0x59dfa9,_0x5c42ab){const _0xf7ec55=a0_0xf7ec();return a0_0x5694=function(_0x5694c4,_0x509dfe){_0x5694c4=_0x5694c4-0xcd;let _0x5bdf5a=_0xf7ec55[_0x5694c4];return _0x5bdf5a;},a0_0x5694(_0x59dfa9,_0x5c42ab);}const a0_0x5bd78c=a0_0x5694;function a0_0xf7ec(){const _0x3c1990=['npm\x20run\x20build','16992873fAKPEg','31995QSwVns','1552500eedLxd','114550gHHHlf','test_auth.py\x20PASS\x0a','[INFO]\x20Building\x20modules...\x0a','__esModule','env','repeat','Compilation\x20Output:\x0a','10OMLAil','TRIMPROMPT_MODEL','1765940yeqhaU','2064528NjNaaD','claude-3-opus','Successfully\x20built\x20image.','tracker','defineProperty','548569NRcFRf','logExecution','Seeding\x20TrimPrompt\x20database\x20with\x20mock\x20LLM\x20command\x20telemetry...','test_db.py\x20PASS\x0a','added\x201420\x20packages\x20in\x2014s\x0a','Step\x202/10\x20:\x20COPY\x20package.json\x20.\x0a','./tracker','pytest\x20app:\x20303\x20tests\x20passed\x20in\x204.22s.','40EOqvdW','Step\x201/10\x20:\x20FROM\x20node:20\x0a','All\x20303\x20tests\x20passed\x20in\x204.22s.','log','test_api.py\x20PASS\x0a','pytest\x20tests/app','docker\x20build:\x201420\x20packages\x20added.\x20Successfully\x20built\x20image.','gemini-1-5-pro','[INFO]\x20Building\x20modules...\x0a[SUCCESS]\x20Compiled\x20512\x20modules.\x20(repeated\x20400\x20times)','Database\x20successfully\x20seeded!','docker\x20build\x20.'];a0_0xf7ec=function(){return _0x3c1990;};return a0_0xf7ec();}(function(_0x3941f5,_0x1421a4){const _0x22260d=a0_0x5694,_0x5e21df=_0x3941f5();while(!![]){try{const _0x91755b=-parseInt(_0x22260d(0xed))/0x1*(parseInt(_0x22260d(0xe6))/0x2)+-parseInt(_0x22260d(0xe4))/0x3+-parseInt(_0x22260d(0xf0))/0x4+-parseInt(_0x22260d(0xef))/0x5+parseInt(_0x22260d(0xe5))/0x6+-parseInt(_0x22260d(0xcf))/0x7*(parseInt(_0x22260d(0xd7))/0x8)+parseInt(_0x22260d(0xe3))/0x9;if(_0x91755b===_0x1421a4)break;else _0x5e21df['push'](_0x5e21df['shift']());}catch(_0x187e82){_0x5e21df['push'](_0x5e21df['shift']());}}}(a0_0xf7ec,0x49cc5));Object[a0_0x5bd78c(0xce)](exports,a0_0x5bd78c(0xe9),{'value':!![]});const tracker_1=require(a0_0x5bd78c(0xd5));console[a0_0x5bd78c(0xda)](a0_0x5bd78c(0xd1)),process[a0_0x5bd78c(0xea)][a0_0x5bd78c(0xee)]=a0_0x5bd78c(0xf1),tracker_1[a0_0x5bd78c(0xcd)][a0_0x5bd78c(0xd0)](a0_0x5bd78c(0xe2),a0_0x5bd78c(0xec)+a0_0x5bd78c(0xe8)+'Optimizing\x20assets...\x0a'+'[SUCCESS]\x20Compiled\x20512\x20modules.\x0a'[a0_0x5bd78c(0xeb)](0x190),a0_0x5bd78c(0xdf),0x0),process[a0_0x5bd78c(0xea)][a0_0x5bd78c(0xee)]='gpt-4o',tracker_1[a0_0x5bd78c(0xcd)][a0_0x5bd78c(0xd0)](a0_0x5bd78c(0xdc),'Test\x20suite\x20run\x20starting...\x0a'+a0_0x5bd78c(0xe7)+a0_0x5bd78c(0xd2)+a0_0x5bd78c(0xdb)[a0_0x5bd78c(0xeb)](0x12c)+a0_0x5bd78c(0xd9),a0_0x5bd78c(0xd6),0x0),process['env'][a0_0x5bd78c(0xee)]=a0_0x5bd78c(0xde),tracker_1[a0_0x5bd78c(0xcd)][a0_0x5bd78c(0xd0)](a0_0x5bd78c(0xe1),'Sending\x20build\x20context\x20to\x20Docker\x20daemon...\x0a'+a0_0x5bd78c(0xd8)+a0_0x5bd78c(0xd4)+'Step\x203/10\x20:\x20RUN\x20npm\x20install\x0a'+a0_0x5bd78c(0xd3)[a0_0x5bd78c(0xeb)](0x3)+a0_0x5bd78c(0xf2),a0_0x5bd78c(0xdd),0x0),console[a0_0x5bd78c(0xda)](a0_0x5bd78c(0xe0));