@ranger-testing/ranger-cli 2.0.5 → 2.0.6
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/build/cli.js +1 -914
- package/build/commands/addEnv.js +1 -1
- package/build/commands/authEncrypt.js +1 -36
- package/build/commands/clean.js +1 -1
- package/build/commands/config.js +1 -93
- package/build/commands/env.js +1 -98
- package/build/commands/feature.js +1 -653
- package/build/commands/hook.js +1 -33
- package/build/commands/hooks/autoPrompt.js +1 -32
- package/build/commands/hooks/disable.js +1 -33
- package/build/commands/hooks/enable.js +1 -58
- package/build/commands/hooks/exitPlanMode.js +1 -35
- package/build/commands/hooks/index.js +1 -12
- package/build/commands/hooks/output.js +1 -71
- package/build/commands/hooks/planReminder.js +1 -46
- package/build/commands/hooks/planStart.js +1 -30
- package/build/commands/hooks/postEdit.js +1 -43
- package/build/commands/hooks/preCompact.js +1 -30
- package/build/commands/hooks/sessionEnd.js +1 -25
- package/build/commands/hooks/sessionStart.js +1 -93
- package/build/commands/hooks/stopHook.js +1 -155
- package/build/commands/index.js +1 -12
- package/build/commands/login.js +1 -26
- package/build/commands/setupCi.js +1 -189
- package/build/commands/skillup.js +1 -80
- package/build/commands/start.js +1 -1
- package/build/commands/status.js +1 -198
- package/build/commands/update.js +1 -182
- package/build/commands/updateEnv.js +1 -1
- package/build/commands/useEnv.js +1 -1
- package/build/commands/utils/activeProfile.js +1 -76
- package/build/commands/utils/browserSessionsApi.js +1 -1
- package/build/commands/utils/claudeConfig.js +1 -73
- package/build/commands/utils/claudePlugin.js +1 -85
- package/build/commands/utils/crypto.js +1 -42
- package/build/commands/utils/desirePathLog.js +1 -139
- package/build/commands/utils/deviceAuth.js +1 -232
- package/build/commands/utils/environment.js +1 -65
- package/build/commands/utils/featureApi.js +1 -371
- package/build/commands/utils/featureReportGenerator.js +1 -204
- package/build/commands/utils/git.js +1 -44
- package/build/commands/utils/keychain.js +1 -1
- package/build/commands/utils/localAgentInstallationsApi.js +1 -1
- package/build/commands/utils/profileMessages.js +1 -8
- package/build/commands/utils/profileSetupBanner.js +1 -167
- package/build/commands/utils/rangerRoot.js +1 -60
- package/build/commands/utils/reportGenerator.js +1 -130
- package/build/commands/utils/retry.js +1 -25
- package/build/commands/utils/sessionCache.js +1 -299
- package/build/commands/utils/settings.js +1 -313
- package/build/commands/utils/skillContent.js +1 -28
- package/build/commands/utils/skills.js +1 -1
- package/build/commands/utils/telemetry.js +1 -254
- package/build/commands/utils/userApi.js +1 -32
- package/build/commands/utils/version.js +1 -62
- package/build/commands/verifyFeature.js +1 -1343
- package/build/commands/verifyInBrowser.js +1 -1
- package/package.json +1 -1
- package/build/cli.js.map +0 -1
- package/build/commands/addEnv.js.map +0 -1
- package/build/commands/authEncrypt.js.map +0 -1
- package/build/commands/clean.js.map +0 -1
- package/build/commands/config.js.map +0 -1
- package/build/commands/env.js.map +0 -1
- package/build/commands/feature.js.map +0 -1
- package/build/commands/hook.js.map +0 -1
- package/build/commands/hooks/autoPrompt.js.map +0 -1
- package/build/commands/hooks/disable.js.map +0 -1
- package/build/commands/hooks/enable.js.map +0 -1
- package/build/commands/hooks/exitPlanMode.js.map +0 -1
- package/build/commands/hooks/index.js.map +0 -1
- package/build/commands/hooks/output.js.map +0 -1
- package/build/commands/hooks/planReminder.js.map +0 -1
- package/build/commands/hooks/planStart.js.map +0 -1
- package/build/commands/hooks/postEdit.js.map +0 -1
- package/build/commands/hooks/preCompact.js.map +0 -1
- package/build/commands/hooks/sessionEnd.js.map +0 -1
- package/build/commands/hooks/sessionStart.js.map +0 -1
- package/build/commands/hooks/stopHook.js.map +0 -1
- package/build/commands/index.js.map +0 -1
- package/build/commands/login.js.map +0 -1
- package/build/commands/setupCi.js.map +0 -1
- package/build/commands/skillup.js.map +0 -1
- package/build/commands/start.js.map +0 -1
- package/build/commands/status.js.map +0 -1
- package/build/commands/update.js.map +0 -1
- package/build/commands/updateEnv.js.map +0 -1
- package/build/commands/useEnv.js.map +0 -1
- package/build/commands/utils/activeProfile.js.map +0 -1
- package/build/commands/utils/browserSessionsApi.js.map +0 -1
- package/build/commands/utils/claudeConfig.js.map +0 -1
- package/build/commands/utils/claudePlugin.js.map +0 -1
- package/build/commands/utils/crypto.js.map +0 -1
- package/build/commands/utils/desirePathLog.js.map +0 -1
- package/build/commands/utils/deviceAuth.js.map +0 -1
- package/build/commands/utils/environment.js.map +0 -1
- package/build/commands/utils/featureApi.js.map +0 -1
- package/build/commands/utils/featureReportGenerator.js.map +0 -1
- package/build/commands/utils/git.js.map +0 -1
- package/build/commands/utils/keychain.js.map +0 -1
- package/build/commands/utils/localAgentInstallationsApi.js.map +0 -1
- package/build/commands/utils/profileMessages.js.map +0 -1
- package/build/commands/utils/profileSetupBanner.js.map +0 -1
- package/build/commands/utils/rangerRoot.js.map +0 -1
- package/build/commands/utils/reportGenerator.js.map +0 -1
- package/build/commands/utils/retry.js.map +0 -1
- package/build/commands/utils/sessionCache.js.map +0 -1
- package/build/commands/utils/settings.js.map +0 -1
- package/build/commands/utils/skillContent.js.map +0 -1
- package/build/commands/utils/skills.js.map +0 -1
- package/build/commands/utils/telemetry.js.map +0 -1
- package/build/commands/utils/userApi.js.map +0 -1
- package/build/commands/utils/version.js.map +0 -1
- package/build/commands/verifyFeature.js.map +0 -1
- package/build/commands/verifyInBrowser.js.map +0 -1
|
@@ -1,76 +1 @@
|
|
|
1
|
-
import { existsSync }
|
|
2
|
-
import { mkdir, readFile, rename, unlink, writeFile } from 'fs/promises';
|
|
3
|
-
import { join } from 'path';
|
|
4
|
-
import { getRangerDir } from './rangerRoot.js';
|
|
5
|
-
const ACTIVE_PROFILE_FILE = 'active-profile.txt';
|
|
6
|
-
const LEGACY_ACTIVE_ENV_FILE = 'active-env.txt';
|
|
7
|
-
function getActiveProfilePath() {
|
|
8
|
-
return join(getRangerDir(), ACTIVE_PROFILE_FILE);
|
|
9
|
-
}
|
|
10
|
-
function getLegacyActiveEnvPath() {
|
|
11
|
-
return join(getRangerDir(), LEGACY_ACTIVE_ENV_FILE);
|
|
12
|
-
}
|
|
13
|
-
async function migrateLegacyActiveEnv() {
|
|
14
|
-
const legacyPath = getLegacyActiveEnvPath();
|
|
15
|
-
if (!existsSync(legacyPath)) {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
let value = null;
|
|
19
|
-
try {
|
|
20
|
-
value = (await readFile(legacyPath, 'utf-8')).trim() || null;
|
|
21
|
-
}
|
|
22
|
-
catch {
|
|
23
|
-
value = null;
|
|
24
|
-
}
|
|
25
|
-
if (!value) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
const newPath = getActiveProfilePath();
|
|
29
|
-
try {
|
|
30
|
-
await rename(legacyPath, newPath);
|
|
31
|
-
}
|
|
32
|
-
catch {
|
|
33
|
-
try {
|
|
34
|
-
const rangerDir = getRangerDir();
|
|
35
|
-
await mkdir(rangerDir, { recursive: true });
|
|
36
|
-
await writeFile(newPath, value, 'utf-8');
|
|
37
|
-
await unlink(legacyPath);
|
|
38
|
-
}
|
|
39
|
-
catch {
|
|
40
|
-
// Best effort only.
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return value;
|
|
44
|
-
}
|
|
45
|
-
export async function readActiveProfileName() {
|
|
46
|
-
const activeProfilePath = getActiveProfilePath();
|
|
47
|
-
if (existsSync(activeProfilePath)) {
|
|
48
|
-
try {
|
|
49
|
-
return (await readFile(activeProfilePath, 'utf-8')).trim() || null;
|
|
50
|
-
}
|
|
51
|
-
catch {
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return await migrateLegacyActiveEnv();
|
|
56
|
-
}
|
|
57
|
-
export async function writeActiveProfileName(profileName) {
|
|
58
|
-
const rangerDir = getRangerDir();
|
|
59
|
-
await mkdir(rangerDir, { recursive: true });
|
|
60
|
-
const activeProfilePath = getActiveProfilePath();
|
|
61
|
-
await writeFile(activeProfilePath, profileName, 'utf-8');
|
|
62
|
-
const legacyPath = getLegacyActiveEnvPath();
|
|
63
|
-
if (existsSync(legacyPath)) {
|
|
64
|
-
try {
|
|
65
|
-
await unlink(legacyPath);
|
|
66
|
-
}
|
|
67
|
-
catch {
|
|
68
|
-
// Best effort cleanup.
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
export async function migrateActiveProfileFile() {
|
|
73
|
-
const migrated = await migrateLegacyActiveEnv();
|
|
74
|
-
return migrated !== null;
|
|
75
|
-
}
|
|
76
|
-
//# sourceMappingURL=activeProfile.js.map
|
|
1
|
+
(function(_0x148d67,_0x10ee8e){const _0x2c49f8=_0x40c9,_0x51617c=_0x148d67();while(!![]){try{const _0x734e6c=-parseInt(_0x2c49f8(0x139))/0x1+-parseInt(_0x2c49f8(0x143))/0x2*(-parseInt(_0x2c49f8(0x14a))/0x3)+parseInt(_0x2c49f8(0x14b))/0x4*(parseInt(_0x2c49f8(0x14d))/0x5)+-parseInt(_0x2c49f8(0x146))/0x6+parseInt(_0x2c49f8(0x13d))/0x7*(parseInt(_0x2c49f8(0x13f))/0x8)+parseInt(_0x2c49f8(0x148))/0x9*(parseInt(_0x2c49f8(0x145))/0xa)+-parseInt(_0x2c49f8(0x13a))/0xb;if(_0x734e6c===_0x10ee8e)break;else _0x51617c['push'](_0x51617c['shift']());}catch(_0x168e74){_0x51617c['push'](_0x51617c['shift']());}}}(_0x53e0,0x34037));import{existsSync}from'fs';import{mkdir,readFile,rename,unlink,writeFile}from'fs/promises';import{join}from'path';import{getRangerDir}from'./rangerRoot.js';const ACTIVE_PROFILE_FILE='active-profile.txt',LEGACY_ACTIVE_ENV_FILE='active-env.txt';function getActiveProfilePath(){const _0x115c0e=_0x40c9,_0x1e40ae={'VHMHN':function(_0x576038,_0x12872c,_0x18b2fa){return _0x576038(_0x12872c,_0x18b2fa);},'JCWPj':function(_0x4c5251){return _0x4c5251();}};return _0x1e40ae[_0x115c0e(0x14c)](join,_0x1e40ae['JCWPj'](getRangerDir),ACTIVE_PROFILE_FILE);}function getLegacyActiveEnvPath(){const _0x5e2e09={'Gpbrx':function(_0x1e28a3,_0x2548e9,_0xa06781){return _0x1e28a3(_0x2548e9,_0xa06781);},'lZxJK':function(_0x208822){return _0x208822();}};return _0x5e2e09['Gpbrx'](join,_0x5e2e09['lZxJK'](getRangerDir),LEGACY_ACTIVE_ENV_FILE);}async function migrateLegacyActiveEnv(){const _0xff4edb=_0x40c9,_0x135c59={'mHcgR':function(_0x5e549c,_0x570191){return _0x5e549c(_0x570191);},'IYHKd':function(_0x32dd18,_0x170aa5,_0x25c0ee){return _0x32dd18(_0x170aa5,_0x25c0ee);},'djxCi':function(_0x4018ce){return _0x4018ce();},'rqQUS':function(_0x4a25a5,_0x249348,_0x5c5689){return _0x4a25a5(_0x249348,_0x5c5689);},'xlPcO':function(_0x2926f2,_0x5b3244,_0x1a42b0,_0x43feaa){return _0x2926f2(_0x5b3244,_0x1a42b0,_0x43feaa);},'VDbjb':function(_0x5b7dd1,_0x368a65){return _0x5b7dd1(_0x368a65);}},_0x183ff7=getLegacyActiveEnvPath();if(!_0x135c59[_0xff4edb(0x149)](existsSync,_0x183ff7))return null;let _0x3096a=null;try{_0x3096a=(await readFile(_0x183ff7,'utf-8'))[_0xff4edb(0x147)]()||null;}catch{_0x3096a=null;}if(!_0x3096a)return null;const _0x26ef4b=getActiveProfilePath();try{await _0x135c59[_0xff4edb(0x141)](rename,_0x183ff7,_0x26ef4b);}catch{try{const _0x443662=_0x135c59[_0xff4edb(0x13b)](getRangerDir);await _0x135c59['rqQUS'](mkdir,_0x443662,{'recursive':!![]}),await _0x135c59[_0xff4edb(0x142)](writeFile,_0x26ef4b,_0x3096a,_0xff4edb(0x138)),await _0x135c59['VDbjb'](unlink,_0x183ff7);}catch{}}return _0x3096a;}export async function readActiveProfileName(){const _0x10e87f=_0x40c9,_0x1f8f55={'NYxIS':function(_0xf0ca81){return _0xf0ca81();},'CCjgR':function(_0xb47fea,_0x439db7){return _0xb47fea(_0x439db7);},'XUTKg':function(_0x31afa5,_0x4a36f2,_0x383108){return _0x31afa5(_0x4a36f2,_0x383108);},'VOleA':'utf-8'},_0x1fef32=_0x1f8f55[_0x10e87f(0x144)](getActiveProfilePath);if(_0x1f8f55[_0x10e87f(0x140)](existsSync,_0x1fef32))try{return(await _0x1f8f55['XUTKg'](readFile,_0x1fef32,_0x1f8f55['VOleA']))['trim']()||null;}catch{return null;}return await _0x1f8f55['NYxIS'](migrateLegacyActiveEnv);}function _0x40c9(_0x54d25d,_0x51913b){_0x54d25d=_0x54d25d-0x138;const _0x53e09b=_0x53e0();let _0x40c940=_0x53e09b[_0x54d25d];return _0x40c940;}function _0x53e0(){const _0x36a36f=['2510AqPBPd','utf-8','387726tQFkmv','2389552KvxLEc','djxCi','oVmMg','6986GQeqdU','skoZI','3016qdPNbu','CCjgR','IYHKd','xlPcO','12hjLzoV','NYxIS','360RfLOgq','977502eVJmVs','trim','3834kzYTad','mHcgR','207573iyiqvK','1388lxIBYK','VHMHN'];_0x53e0=function(){return _0x36a36f;};return _0x53e0();}export async function writeActiveProfileName(_0x3440fd){const _0x116e7f=_0x40c9,_0x2ba8d9={'oVmMg':function(_0x425eed,_0x17fbf5,_0xedf055){return _0x425eed(_0x17fbf5,_0xedf055);},'nYKIO':function(_0x1d3d2d){return _0x1d3d2d();},'Snzwv':function(_0x531654,_0x57302d){return _0x531654(_0x57302d);}},_0xecb999=getRangerDir();await _0x2ba8d9[_0x116e7f(0x13c)](mkdir,_0xecb999,{'recursive':!![]});const _0x372441=getActiveProfilePath();await writeFile(_0x372441,_0x3440fd,_0x116e7f(0x138));const _0x6f9db6=_0x2ba8d9['nYKIO'](getLegacyActiveEnvPath);if(existsSync(_0x6f9db6))try{await _0x2ba8d9['Snzwv'](unlink,_0x6f9db6);}catch{}}export async function migrateActiveProfileFile(){const _0xc9e546=_0x40c9,_0x49e892={'skoZI':function(_0x2a0925){return _0x2a0925();}},_0x244ef6=await _0x49e892[_0xc9e546(0x13e)](migrateLegacyActiveEnv);return _0x244ef6!==null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x4b9dea,_0x364df9){const _0x142393=_0x467e,_0x44c48d=_0x4b9dea();while(!![]){try{const _0x4c1567=parseInt(_0x142393(0x191))/0x1*(parseInt(_0x142393(0x179))/0x2)+-parseInt(_0x142393(0x18b))/0x3+-parseInt(_0x142393(0x13e))/0x4*(parseInt(_0x142393(0x128))/0x5)+-parseInt(_0x142393(0x158))/0x6*(parseInt(_0x142393(0x169))/0x7)+parseInt(_0x142393(0x12b))/0x8*(parseInt(_0x142393(0x126))/0x9)+-parseInt(_0x142393(0x16a))/0xa*(parseInt(_0x142393(0x17d))/0xb)+parseInt(_0x142393(0x13b))/0xc;if(_0x4c1567===_0x364df9)break;else _0x44c48d['push'](_0x44c48d['shift']());}catch(_0xb50f84){_0x44c48d['push'](_0x44c48d['shift']());}}}(_0x5044,0x82c47));const _0xab2321=(function(){const _0x1bc821=_0x467e,_0x4c982e={'AgTiw':_0x1bc821(0x181),'nHOuK':_0x1bc821(0x16b),'CyDXZ':_0x1bc821(0x12d),'lhDog':'base64'};let _0x3a2322=!![];return function(_0x4ce773,_0x512c22){const _0x16d385=_0x1bc821,_0x3fae1c={'tUqMY':_0x4c982e[_0x16d385(0x143)],'DpxTP':_0x4c982e[_0x16d385(0x17c)]},_0x227d67=_0x3a2322?function(){const _0x4a6a21=_0x16d385;if(_0x512c22){if(_0x4c982e[_0x4a6a21(0x18a)]===_0x4c982e[_0x4a6a21(0x176)])return _0x4f6098(_0x3fae1c[_0x4a6a21(0x124)])[_0x4a6a21(0x171)](_0x37bdba)['digest'](_0x3fae1c['DpxTP']);else{const _0x5306a0=_0x512c22[_0x4a6a21(0x16f)](_0x4ce773,arguments);return _0x512c22=null,_0x5306a0;}}}:function(){};return _0x3a2322=![],_0x227d67;};}()),_0xb78100=_0xab2321(this,function(){const _0x2b885d=_0x467e,_0x1c6762={'MBCLJ':'(((.+)+)+)+$'};return _0xb78100[_0x2b885d(0x156)]()[_0x2b885d(0x13c)](_0x1c6762[_0x2b885d(0x12f)])['toString']()['constructor'](_0xb78100)['search'](_0x1c6762[_0x2b885d(0x12f)]);});_0xb78100();import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{createHash}from'crypto';import{withRetry}from'./retry.js';export async function createBrowserSession(_0x5e0302){const _0x1c4788=_0x467e,_0x5017f1={'EpOWC':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','pkTrm':function(_0xd15d7c,_0x3cde0b,_0x3f2a86,_0x1ecf58){return _0xd15d7c(_0x3cde0b,_0x3f2a86,_0x1ecf58);},'qKbkh':_0x1c4788(0x19b),'olERO':_0x1c4788(0x152),'rpRBe':function(_0x4f9e1b){return _0x4f9e1b();},'Ugxgd':function(_0x5c060a,_0x23cbba,_0xed7f76){return _0x5c060a(_0x23cbba,_0xed7f76);},'mTxmO':_0x1c4788(0x190),'TlcXE':_0x1c4788(0x14b),'tkmJC':function(_0x33bcd1,_0x22e511){return _0x33bcd1===_0x22e511;},'qSwpt':_0x1c4788(0x157)},_0x34ec9d=await getToken();if(!_0x34ec9d){if(_0x5017f1[_0x1c4788(0x154)]!==_0x5017f1['olERO'])throw new _0x5bde73(_0x5017f1[_0x1c4788(0x182)]);else throw new Error(_0x1c4788(0x147));}const _0x82d0e=_0x5017f1[_0x1c4788(0x15d)](getApiBaseUrl),_0x25a4c2=await _0x5017f1[_0x1c4788(0x132)](fetch,_0x82d0e+_0x1c4788(0x14c),{'method':_0x5017f1[_0x1c4788(0x12e)],'headers':{'Authorization':_0x1c4788(0x15f)+_0x34ec9d,'Content-Type':_0x5017f1[_0x1c4788(0x193)]},'body':JSON[_0x1c4788(0x15b)]({'environmentName':_0x5e0302?.[_0x1c4788(0x167)],'settings':_0x5e0302?.[_0x1c4788(0x184)],'task':_0x5e0302?.[_0x1c4788(0x14a)],'url':_0x5e0302?.[_0x1c4788(0x173)],'featureId':_0x5e0302?.[_0x1c4788(0x18c)],'checklistItemId':_0x5e0302?.[_0x1c4788(0x162)]})});if(!_0x25a4c2['ok']){if(_0x5017f1[_0x1c4788(0x185)](_0x5017f1['qSwpt'],_0x1c4788(0x157))){const _0x5af454=await _0x25a4c2[_0x1c4788(0x140)]();throw new Error(_0x1c4788(0x15c)+_0x5af454);}else return _0x5017f1[_0x1c4788(0x155)](_0x445806,_0x1eb937,_0x112e94,_0x5017f1[_0x1c4788(0x186)]);}return _0x25a4c2[_0x1c4788(0x163)]();}export async function updateBrowserSession(_0x506b4a,_0x54af1c){const _0x11d816=_0x467e,_0x40ff26={'tZjPN':_0x11d816(0x150),'JddtW':function(_0x55359e){return _0x55359e();},'KTbCO':function(_0x231d12,_0x16f64f,_0x14332a){return _0x231d12(_0x16f64f,_0x14332a);},'IWOXI':_0x11d816(0x141),'EGuPP':_0x11d816(0x17b)};return _0x40ff26[_0x11d816(0x15e)](withRetry,async()=>{const _0x2704d4=_0x11d816;if(_0x40ff26[_0x2704d4(0x17a)]===_0x40ff26[_0x2704d4(0x17a)]){const _0x339a30=await _0x40ff26[_0x2704d4(0x149)](getToken);if(!_0x339a30)throw new Error(_0x2704d4(0x147));const _0xbaa980=_0x40ff26[_0x2704d4(0x149)](getApiBaseUrl),_0x39b777=await _0x40ff26['KTbCO'](fetch,_0xbaa980+_0x2704d4(0x139)+_0x506b4a,{'method':_0x40ff26[_0x2704d4(0x131)],'headers':{'Authorization':_0x2704d4(0x15f)+_0x339a30,'Content-Type':'application/json'},'body':JSON['stringify'](_0x54af1c)});if(!_0x39b777['ok']){const _0x15b84e=await _0x39b777['text']();throw new Error('Failed\x20to\x20update\x20browser\x20session:\x20'+_0x15b84e);}return _0x39b777['json']();}else return _0x36a042(_0x18ca38,_0x3869cd,'application/zip');},{'label':_0x40ff26['EGuPP']});}function _0x467e(_0x1be57a,_0x23c2a0){_0x1be57a=_0x1be57a-0x124;const _0x43559e=_0x5044();let _0xb78100=_0x43559e[_0x1be57a];if(_0x467e['GAIosq']===undefined){var _0xab2321=function(_0x1289d4){const _0x120fab='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x23e24f='',_0x3dbee6='',_0x11a57d=_0x23e24f+_0xab2321;for(let _0x14290b=0x0,_0x230d49,_0x423b93,_0x40192f=0x0;_0x423b93=_0x1289d4['charAt'](_0x40192f++);~_0x423b93&&(_0x230d49=_0x14290b%0x4?_0x230d49*0x40+_0x423b93:_0x423b93,_0x14290b++%0x4)?_0x23e24f+=_0x11a57d['charCodeAt'](_0x40192f+0xa)-0xa!==0x0?String['fromCharCode'](0xff&_0x230d49>>(-0x2*_0x14290b&0x6)):_0x14290b:0x0){_0x423b93=_0x120fab['indexOf'](_0x423b93);}for(let _0x2efc4a=0x0,_0x164731=_0x23e24f['length'];_0x2efc4a<_0x164731;_0x2efc4a++){_0x3dbee6+='%'+('00'+_0x23e24f['charCodeAt'](_0x2efc4a)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x3dbee6);};_0x467e['srtKBS']=_0xab2321,_0x467e['VaSgXm']={},_0x467e['GAIosq']=!![];}const _0x5044f3=_0x43559e[0x0],_0x467ecc=_0x1be57a+_0x5044f3,_0x234a04=_0x467e['VaSgXm'][_0x467ecc];if(!_0x234a04){const _0x3b8cbe=function(_0x133083){this['NIBeHp']=_0x133083,this['JVrVaL']=[0x1,0x0,0x0],this['VaTmFR']=function(){return'newState';},this['QYoYgX']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['upmJAJ']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x3b8cbe['prototype']['EkkVvl']=function(){const _0x5ce0f3=new RegExp(this['QYoYgX']+this['upmJAJ']),_0xb93358=_0x5ce0f3['test'](this['VaTmFR']['toString']())?--this['JVrVaL'][0x1]:--this['JVrVaL'][0x0];return this['sIBxYt'](_0xb93358);},_0x3b8cbe['prototype']['sIBxYt']=function(_0x1b6a00){if(!Boolean(~_0x1b6a00))return _0x1b6a00;return this['RtPTvo'](this['NIBeHp']);},_0x3b8cbe['prototype']['RtPTvo']=function(_0x15dea9){for(let _0x5e33b4=0x0,_0xfa54db=this['JVrVaL']['length'];_0x5e33b4<_0xfa54db;_0x5e33b4++){this['JVrVaL']['push'](Math['round'](Math['random']())),_0xfa54db=this['JVrVaL']['length'];}return _0x15dea9(this['JVrVaL'][0x0]);},new _0x3b8cbe(_0x467e)['EkkVvl'](),_0xb78100=_0x467e['srtKBS'](_0xb78100),_0x467e['VaSgXm'][_0x467ecc]=_0xb78100;}else _0xb78100=_0x234a04;return _0xb78100;}export async function getBrowserSession(_0x2b5800){const _0x4882aa=_0x467e,_0x5187={'VqZIJ':function(_0x86133b){return _0x86133b();},'fkqoa':function(_0x3637bc,_0x1def66){return _0x3637bc!==_0x1def66;},'zBULf':_0x4882aa(0x13f),'ZxayQ':_0x4882aa(0x147),'RbTxR':function(_0x4fb9fa,_0x491bde,_0x2b7aeb){return _0x4fb9fa(_0x491bde,_0x2b7aeb);},'IOVTw':'GET'},_0x37f3d8=await _0x5187[_0x4882aa(0x198)](getToken);if(!_0x37f3d8){if(_0x5187[_0x4882aa(0x177)](_0x4882aa(0x16d),_0x5187[_0x4882aa(0x160)]))throw new Error(_0x5187[_0x4882aa(0x145)]);else{const _0x2b4e65=_0x296c20[_0x4882aa(0x16f)](_0x3df962,arguments);return _0xfc5b4a=null,_0x2b4e65;}}const _0x115b16=getApiBaseUrl(),_0x35fe8e=await _0x5187['RbTxR'](fetch,_0x115b16+_0x4882aa(0x139)+_0x2b5800,{'method':_0x5187['IOVTw'],'headers':{'Authorization':'Bearer\x20'+_0x37f3d8}});if(!_0x35fe8e['ok']){const _0x8eec40=await _0x35fe8e[_0x4882aa(0x140)]();throw new Error(_0x4882aa(0x168)+_0x8eec40);}return _0x35fe8e[_0x4882aa(0x163)]();}export async function getUploadUrls(_0x3475ea,_0x35afc6,_0x4a10a8,_0x42bab4){const _0x294091=_0x467e,_0x11c91f={'wZxGa':function(_0x27b152){return _0x27b152();},'ZPKPl':function(_0x2cde73,_0x58e45d){return _0x2cde73===_0x58e45d;},'OlXhg':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','xNOVP':function(_0x34d937){return _0x34d937();},'aVhDt':function(_0x107131,_0x2e2a5b,_0x19549e){return _0x107131(_0x2e2a5b,_0x19549e);},'pIDCz':_0x294091(0x190),'ygkmJ':function(_0x455218,_0x25f986){return _0x455218!==_0x25f986;},'SgTQD':function(_0x2c3584,_0x3d99a6){return _0x2c3584!==_0x3d99a6;}},_0x33942d=await _0x11c91f[_0x294091(0x130)](getToken);if(!_0x33942d){if(_0x11c91f[_0x294091(0x188)]('wggXd',_0x294091(0x133)))throw new Error(_0x11c91f[_0x294091(0x12a)]);else{if(_0x13afb8){const _0xc67028=_0x24a3ec[_0x294091(0x16f)](_0x48267a,arguments);return _0x517d4a=null,_0xc67028;}}}const _0x262cf1=_0x11c91f[_0x294091(0x196)](getApiBaseUrl),_0x587265=await _0x11c91f[_0x294091(0x17f)](fetch,_0x262cf1+'/api/v1/mcp/browser-sessions/'+_0x3475ea+_0x294091(0x13d),{'method':_0x11c91f[_0x294091(0x175)],'headers':{'Authorization':_0x294091(0x15f)+_0x33942d,'Content-Type':_0x294091(0x14b)},'body':JSON[_0x294091(0x15b)]({'filename':_0x35afc6,'filetype':_0x4a10a8,..._0x11c91f[_0x294091(0x144)](_0x42bab4?.[_0x294091(0x18f)],undefined)&&{'size':_0x42bab4[_0x294091(0x18f)]},..._0x11c91f[_0x294091(0x144)](_0x42bab4?.['checksum'],undefined)&&{'checksum':_0x42bab4[_0x294091(0x13a)]},..._0x11c91f[_0x294091(0x18e)](_0x42bab4?.[_0x294091(0x142)],undefined)&&{'metadata':_0x42bab4[_0x294091(0x142)]}})});if(!_0x587265['ok']){const _0x23e763=await _0x587265[_0x294091(0x140)]();throw new Error(_0x294091(0x151)+_0x23e763);}return _0x587265[_0x294091(0x163)]();}export async function uploadFile(_0x1ef6cc,_0x39d9a1,_0x1c0d82){const _0x14b932=_0x467e,_0x111970={'PrKIh':_0x14b932(0x147),'oYHWk':function(_0x462eb4,_0x2a63f2,_0x3c7dc5){return _0x462eb4(_0x2a63f2,_0x3c7dc5);},'yBoEA':function(_0x4a0d06,_0x278e0a){return _0x4a0d06!==_0x278e0a;},'ZiKqB':_0x14b932(0x172)},_0x151115=await _0x111970[_0x14b932(0x134)](fetch,_0x1ef6cc,{'method':'PUT','headers':{'Content-Type':_0x1c0d82,'Content-Length':_0x39d9a1[_0x14b932(0x14d)]['toString']()},'body':_0x39d9a1});if(!_0x151115['ok']){if(_0x111970[_0x14b932(0x148)](_0x111970[_0x14b932(0x127)],_0x14b932(0x172)))throw new _0x8d77b2(_0x111970[_0x14b932(0x180)]);else{const _0x189de1=await _0x151115[_0x14b932(0x140)]();throw new Error(_0x14b932(0x170)+_0x189de1);}}}export async function uploadTrace(_0x426ae9,_0x460ef6){const _0x2d2618=_0x467e,_0x543eef={'WHCrW':function(_0x4049c0,_0x16c702,_0x1bea3e,_0x1e2779){return _0x4049c0(_0x16c702,_0x1bea3e,_0x1e2779);}};return _0x543eef[_0x2d2618(0x159)](uploadFile,_0x426ae9,_0x460ef6,_0x2d2618(0x136));}export async function uploadConversation(_0x100704,_0x4dbff4){const _0x40cad3=_0x467e,_0x4d2b1c={'lBBaV':_0x40cad3(0x19b)};return uploadFile(_0x100704,_0x4dbff4,_0x4d2b1c[_0x40cad3(0x165)]);}export async function uploadScreenshot(_0x24529d,_0x25dc31){const _0x50fe7d=_0x467e,_0x2a815a={'aptAu':function(_0xc8dbca,_0x34342e,_0x2dedb0,_0xf63831){return _0xc8dbca(_0x34342e,_0x2dedb0,_0xf63831);}};return _0x2a815a[_0x50fe7d(0x16c)](uploadFile,_0x24529d,_0x25dc31,_0x50fe7d(0x189));}export async function uploadVideo(_0x2a179b,_0x433eca){const _0x565375=_0x467e,_0x33ab56={'mxiAO':'video/webm'};return uploadFile(_0x2a179b,_0x433eca,_0x33ab56[_0x565375(0x161)]);}export function buildTraceViewerUrl(_0x264fdb){const _0x2116b1=_0x467e,_0x5838cd={'LirsI':function(_0x2f99f8,_0x1c4b4a){return _0x2f99f8(_0x1c4b4a);}},_0x360822=_0x5838cd[_0x2116b1(0x194)](encodeURIComponent,_0x264fdb);return _0x2116b1(0x12c)+_0x360822;}export async function getProxySessionToken(){const _0x17d62a=_0x467e,_0x5394c3={'LPANn':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','ucuDm':function(_0x1964a6){return _0x1964a6();},'NMYjI':function(_0x4005fc,_0x65013f,_0x367d6b){return _0x4005fc(_0x65013f,_0x367d6b);},'DyMch':_0x17d62a(0x190),'FsYdm':function(_0x294105,_0x11197f){return _0x294105===_0x11197f;},'KaykE':_0x17d62a(0x138)},_0x3c0c9f=await getToken();if(!_0x3c0c9f)throw new Error(_0x5394c3['LPANn']);const _0x1de010=_0x5394c3[_0x17d62a(0x174)](getApiBaseUrl),_0x27335c=await _0x5394c3[_0x17d62a(0x125)](fetch,_0x1de010+_0x17d62a(0x166),{'method':_0x5394c3[_0x17d62a(0x199)],'headers':{'Authorization':_0x17d62a(0x15f)+_0x3c0c9f}});if(!_0x27335c['ok']){if(_0x5394c3[_0x17d62a(0x164)](_0x17d62a(0x138),_0x5394c3['KaykE'])){const _0x5b6f1d=await _0x27335c[_0x17d62a(0x140)]();throw new Error(_0x17d62a(0x153)+_0x5b6f1d);}else throw new _0x22d7cb(_0x5394c3[_0x17d62a(0x137)]);}const _0x16468b=await _0x27335c[_0x17d62a(0x163)]();return _0x16468b['sessionToken'];}export function computeChecksum(_0xdc280a){const _0x3a21a6=_0x467e,_0x1cfe7e={'xBNgT':function(_0xb5ea2e,_0x5b7c07){return _0xb5ea2e(_0x5b7c07);},'RGrxO':_0x3a21a6(0x129)};return _0x1cfe7e[_0x3a21a6(0x183)](createHash,_0x3a21a6(0x12d))[_0x3a21a6(0x171)](_0xdc280a)['digest'](_0x1cfe7e[_0x3a21a6(0x135)]);}function _0x5044(){const _0x1d8504=['uKDYEe8','yxbWBgLJyxrPB24VEMLW','tfbbtM4','vMDlyvK','l2fWAs92ms9Ty3aVyNjVD3nLCI1ZzxnZAw9UCY8','y2HLy2TZDw0','mJq2oda5ndbJuvn2ve4','C2vHCMnO','l3vWBg9Hzc11CMXZ','offJwhnRAG','ExbdAKG','Dgv4Da','uefuq0G','Bwv0ywrHDge','q3LewfO','EwDRBuO','wNHHEve','rMfPBgvKihrVignYzwf0zsb2zxjPzMLJyxrPB24GC3rLCdOG','tM8GqvbjihrVA2vUignVBMzPz3vYzwqUifj1BJOGCMfUz2vYihnLDhvWifT0B2TLBL0','EujVrue','sMrKDfC','DgfZAW','yxbWBgLJyxrPB24VANnVBG','l2fWAs92ms9Ty3aVyNjVD3nLCI1ZzxnZAw9UCW','BgvUz3rO','D3D2r3e','l3n0zxbZlW','BwjMuLu','rMfPBgvKihrVigDLDcb1CgXVywqGvvjmCZOG','tvrgEfu','rMfPBgvKihrVigDLDcbWCM94EsbZzxnZAw9UihrVA2vUoIa','B2XfuK8','CgTuCM0','Dg9tDhjPBMC','D212ugm','mZzcrhnrD1C','v0HdCLC','l3n0zxbZ','C3rYAw5NAwz5','rMfPBgvKihrVignYzwf0zsbICM93C2vYihnLC3nPB246ia','CNbsqMu','s1rIq08','qMvHCMvYia','EKjvtgy','BxHPqu8','y2HLy2TSAxn0sxrLBuLK','ANnVBG','rNnzzg0','Bejcyvy','l2fWAs92ms9Ty3aVChjVEhKTC2vZC2LVBG','zw52AxjVBM1LBNroyw1L','rMfPBgvKihrVigDLDcbICM93C2vYihnLC3nPB246ia','mZGXmtqZt2vlsLLV','mta1mJi0nZbky3PeDxO','rLD5wvy','yxb0qxu','Eu5es04','rMfPBgvKihrVignYzwf0zsbZDgvWigfZC2v0oIa','yxbWBhK','rMfPBgvKihrVihvWBg9HzcbMAwXLoIa','DxbKyxrL','uxDNv2m','DxjS','Dwn1rg0','CeLeq3O','BKHpDuS','zMTXB2e','BwzdseC','mKzyugLyCG','DfPQue4','DxbKyxrLqNjVD3nLCLnLC3nPB24','BgHeB2C','mtfiAgXTqvq','uM9ACxy','yvzOrhq','uhjlswG','BLHyvw8','rxbpv0m','Eejoz1q','C2v0DgLUz3m','DgTTsKm','CuTIA2G','suXXr20','wLblugW','Aw1Hz2uVCg5N','qwDuAxC','mtaWnJiWnNf2zhL1vW','zMvHDhvYzuLK','ChnLrfK','u2Duuuq','C2L6zq','ue9tva','ntmXotqYEufmt0Hs','wfHlvfm','vgXJweu','tgLYC0K','sfzjr3G','Ee5pvLa','qNfKs1K','vNfAsuO','rhLny2G','AvLJsu0','yxbWBgLJyxrPB24VANnVBMW','DfvXtvK','tK1zAKK','mta1odC2ownHBfHRva','wMLlCui','mte0mdKWnuntvLLMwa','yMfZzty0','t2XyAgC','ohPIr2P3tW','Ahr0Chm6lY90CMfJzs5WBgf5D3jPz2H0lMrLDI8/DhjHy2u9','Bwq1','Bvr4Bu8','tujdteO','D1P4r2e','svDpweK','vwD4z2q','D2DNwgq','B1Liv2S'];_0x5044=function(){return _0x1d8504;};return _0x5044();}export async function createVerificationStep(_0x2e53ef,_0x48226a){const _0x4f4317=_0x467e,_0x16545b={'XXKTS':_0x4f4317(0x147),'iYcIM':function(_0x19d95b){return _0x19d95b();},'mfCHG':function(_0x21fb6c,_0xab7027,_0x3b1e93){return _0x21fb6c(_0xab7027,_0x3b1e93);},'pseDY':_0x4f4317(0x190),'BqdKY':_0x4f4317(0x14b)},_0x17cfa6=await getToken();if(!_0x17cfa6)throw new Error(_0x16545b[_0x4f4317(0x192)]);const _0x4ecb3d=_0x16545b[_0x4f4317(0x19a)](getApiBaseUrl),_0x400de3=await _0x16545b[_0x4f4317(0x178)](fetch,_0x4ecb3d+_0x4f4317(0x139)+_0x2e53ef+_0x4f4317(0x15a),{'method':_0x16545b[_0x4f4317(0x18d)],'headers':{'Authorization':_0x4f4317(0x15f)+_0x17cfa6,'Content-Type':_0x16545b[_0x4f4317(0x197)]},'body':JSON[_0x4f4317(0x15b)](_0x48226a)});if(!_0x400de3['ok']){const _0x1e6e4d=await _0x400de3[_0x4f4317(0x140)]();throw new Error(_0x4f4317(0x146)+_0x1e6e4d);}return _0x400de3[_0x4f4317(0x163)]();}export async function createStepAsset(_0x294a76,_0x5bfdb3,_0x10d49a){const _0x4a187a=_0x467e,_0x3f4cc1={'ILqGm':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','HVIGx':function(_0x43d5f6){return _0x43d5f6();},'wwvGq':function(_0x3c69d6,_0x3dc0d5,_0x4cef76){return _0x3c69d6(_0x3dc0d5,_0x4cef76);},'IfGZv':'POST','RoZqv':'application/json'},_0x549a5a=await getToken();if(!_0x549a5a)throw new Error(_0x3f4cc1[_0x4a187a(0x187)]);const _0x4b2816=_0x3f4cc1[_0x4a187a(0x195)](getApiBaseUrl),_0x32489c=await _0x3f4cc1[_0x4a187a(0x14e)](fetch,_0x4b2816+_0x4a187a(0x139)+_0x294a76+_0x4a187a(0x14f)+_0x5bfdb3+'/assets',{'method':_0x3f4cc1['IfGZv'],'headers':{'Authorization':_0x4a187a(0x15f)+_0x549a5a,'Content-Type':_0x3f4cc1[_0x4a187a(0x17e)]},'body':JSON['stringify'](_0x10d49a)});if(!_0x32489c['ok']){const _0x2f4b13=await _0x32489c['text']();throw new Error(_0x4a187a(0x16e)+_0x2f4b13);}return _0x32489c[_0x4a187a(0x163)]();}
|
|
1
|
+
(function(_0x3d34f5,_0x5f3c6d){const _0x543b50=_0x4206,_0x110b65=_0x3d34f5();while(!![]){try{const _0x21e6d4=parseInt(_0x543b50(0x1a9))/0x1+parseInt(_0x543b50(0x1ce))/0x2*(-parseInt(_0x543b50(0x1cf))/0x3)+parseInt(_0x543b50(0x1b6))/0x4*(parseInt(_0x543b50(0x186))/0x5)+-parseInt(_0x543b50(0x17b))/0x6+parseInt(_0x543b50(0x191))/0x7+parseInt(_0x543b50(0x1a6))/0x8*(parseInt(_0x543b50(0x184))/0x9)+-parseInt(_0x543b50(0x197))/0xa;if(_0x21e6d4===_0x5f3c6d)break;else _0x110b65['push'](_0x110b65['shift']());}catch(_0x5c9f17){_0x110b65['push'](_0x110b65['shift']());}}}(_0x8161,0x27a7a));const _0x300bec=(function(){const _0x241dc7=_0x4206,_0x2eb454={'gzjgU':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','QRKyx':_0x241dc7(0x195),'saZQw':_0x241dc7(0x1d0),'uDoaq':_0x241dc7(0x1a5),'DBpwr':_0x241dc7(0x178),'tFnuu':function(_0x164dca,_0x4662a5){return _0x164dca===_0x4662a5;},'btIEQ':'eudsB'};let _0x2d5c96=!![];return function(_0x24e242,_0x4ff5d5){const _0xe41e8e=_0x241dc7,_0x533488={'bLygA':function(_0x9a8d09,_0x8a7ab0){return _0x9a8d09(_0x8a7ab0);},'hcXxZ':_0x2eb454[_0xe41e8e(0x1dd)],'HfreN':_0x2eb454[_0xe41e8e(0x173)],'AoqXv':_0x2eb454['uDoaq'],'mNQDo':_0x2eb454[_0xe41e8e(0x1b4)]};if(_0x2eb454[_0xe41e8e(0x194)](_0x2eb454[_0xe41e8e(0x1c1)],_0x2eb454[_0xe41e8e(0x1c1)])){const _0x20446b=_0x2d5c96?function(){const _0x25b211=_0xe41e8e,_0xd816ef={'zQNGM':function(_0x32c9fb,_0x3a9fb3){const _0x4a1a34=_0x4206;return _0x533488[_0x4a1a34(0x1ca)](_0x32c9fb,_0x3a9fb3);},'WNBPG':_0x533488[_0x25b211(0x196)],'gBUKR':_0x533488[_0x25b211(0x19b)]};if(_0x533488[_0x25b211(0x1c2)]!==_0x533488['mNQDo']){if(_0x4ff5d5){const _0x416a72=_0x4ff5d5['apply'](_0x24e242,arguments);return _0x4ff5d5=null,_0x416a72;}}else return _0xd816ef[_0x25b211(0x1b2)](_0x217245,_0xd816ef[_0x25b211(0x18a)])[_0x25b211(0x1a8)](_0x1b440c)[_0x25b211(0x1ba)](_0xd816ef[_0x25b211(0x1d5)]);}:function(){};return _0x2d5c96=![],_0x20446b;}else throw new _0x574e31(_0x2eb454[_0xe41e8e(0x1cd)]);};}()),_0x2e5964=_0x300bec(this,function(){const _0x88b3a1=_0x4206,_0x5cca7f={'EKgwe':_0x88b3a1(0x1dc)};return _0x2e5964[_0x88b3a1(0x1c8)]()[_0x88b3a1(0x1bb)](_0x5cca7f[_0x88b3a1(0x1d6)])[_0x88b3a1(0x1c8)]()['constructor'](_0x2e5964)[_0x88b3a1(0x1bb)](_0x5cca7f[_0x88b3a1(0x1d6)]);});_0x2e5964();import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{createHash}from'crypto';import{withRetry}from'./retry.js';export async function createBrowserSession(_0x4741bd){const _0x1d882b=_0x4206,_0x519b82={'FLaBk':_0x1d882b(0x199),'UuFJz':function(_0x4cb612){return _0x4cb612();},'QLPxP':function(_0x37a990,_0x2d3c49,_0x33aa8f){return _0x37a990(_0x2d3c49,_0x33aa8f);},'nLcjm':_0x1d882b(0x183)},_0x5f24ee=await getToken();if(!_0x5f24ee)throw new Error(_0x519b82[_0x1d882b(0x1af)]);const _0x49efa5=_0x519b82['UuFJz'](getApiBaseUrl),_0x7ffe=await _0x519b82[_0x1d882b(0x1aa)](fetch,_0x49efa5+_0x1d882b(0x180),{'method':'POST','headers':{'Authorization':'Bearer\x20'+_0x5f24ee,'Content-Type':_0x519b82[_0x1d882b(0x1b9)]},'body':JSON[_0x1d882b(0x19d)]({'environmentName':_0x4741bd?.[_0x1d882b(0x175)],'settings':_0x4741bd?.[_0x1d882b(0x1a3)],'task':_0x4741bd?.[_0x1d882b(0x1d1)],'url':_0x4741bd?.[_0x1d882b(0x198)],'featureId':_0x4741bd?.[_0x1d882b(0x1c4)],'checklistItemId':_0x4741bd?.['checklistItemId']})});if(!_0x7ffe['ok']){const _0x21fe61=await _0x7ffe[_0x1d882b(0x1bc)]();throw new Error(_0x1d882b(0x171)+_0x21fe61);}return _0x7ffe[_0x1d882b(0x192)]();}export async function updateBrowserSession(_0x5dbf2f,_0x159251){const _0x51f5fd=_0x4206,_0xcbe690={'KGJaN':_0x51f5fd(0x199),'hxNKG':function(_0x3f9484,_0x29da63){return _0x3f9484===_0x29da63;},'tRnja':_0x51f5fd(0x1b1),'dauTK':function(_0x41bced){return _0x41bced();},'zyArC':function(_0x42afce,_0x85abb8,_0x5e5368){return _0x42afce(_0x85abb8,_0x5e5368);},'AIwny':_0x51f5fd(0x183),'WBmnv':_0x51f5fd(0x179)};return _0xcbe690[_0x51f5fd(0x17a)](withRetry,async()=>{const _0x2da1be=_0x51f5fd,_0x1cdcad={'JsCyh':_0xcbe690[_0x2da1be(0x18c)]};if(_0xcbe690['hxNKG'](_0x2da1be(0x1b1),_0xcbe690[_0x2da1be(0x1d3)])){const _0x258fb4=await getToken();if(!_0x258fb4)throw new Error(_0xcbe690[_0x2da1be(0x18c)]);const _0xccc5b9=_0xcbe690[_0x2da1be(0x1de)](getApiBaseUrl),_0x323c8d=await _0xcbe690['zyArC'](fetch,_0xccc5b9+_0x2da1be(0x1b8)+_0x5dbf2f,{'method':_0x2da1be(0x19a),'headers':{'Authorization':_0x2da1be(0x1d7)+_0x258fb4,'Content-Type':_0xcbe690[_0x2da1be(0x18b)]},'body':JSON[_0x2da1be(0x19d)](_0x159251)});if(!_0x323c8d['ok']){const _0x150836=await _0x323c8d['text']();throw new Error('Failed\x20to\x20update\x20browser\x20session:\x20'+_0x150836);}return _0x323c8d['json']();}else throw new _0x50b1c4(_0x1cdcad[_0x2da1be(0x1a1)]);},{'label':_0xcbe690[_0x51f5fd(0x1b7)]});}export async function getBrowserSession(_0x4aee13){const _0x1f11da=_0x4206,_0x5c3cb6={'HujNb':function(_0xa3b38f){return _0xa3b38f();},'ytqLA':function(_0x1d6b5b,_0x3830dc,_0x2bd0d9){return _0x1d6b5b(_0x3830dc,_0x2bd0d9);},'Fpbce':_0x1f11da(0x19f)},_0x461e9a=await _0x5c3cb6[_0x1f11da(0x187)](getToken);if(!_0x461e9a)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x53447d=_0x5c3cb6[_0x1f11da(0x187)](getApiBaseUrl),_0x5cdb3f=await _0x5c3cb6[_0x1f11da(0x1d8)](fetch,_0x53447d+'/api/v1/mcp/browser-sessions/'+_0x4aee13,{'method':_0x5c3cb6[_0x1f11da(0x190)],'headers':{'Authorization':_0x1f11da(0x1d7)+_0x461e9a}});if(!_0x5cdb3f['ok']){const _0xd0605=await _0x5cdb3f['text']();throw new Error(_0x1f11da(0x170)+_0xd0605);}return _0x5cdb3f[_0x1f11da(0x192)]();}export async function getUploadUrls(_0x5a91e3,_0x1e912b,_0x424d6f,_0x1b7d9c){const _0x4c5c5b=_0x4206,_0x5ac786={'SpWMF':function(_0x321889,_0x3b631d){return _0x321889(_0x3b631d);},'ADQTB':function(_0x44f2d3){return _0x44f2d3();},'OUYLl':function(_0x199892,_0x1b7dd3){return _0x199892===_0x1b7dd3;},'eWQHk':'fLAyC','LjUZv':_0x4c5c5b(0x199),'NhMSZ':function(_0x3cae1d){return _0x3cae1d();},'eRvtK':function(_0x31e704,_0x2810e6,_0x154eb8){return _0x31e704(_0x2810e6,_0x154eb8);},'gzlVu':_0x4c5c5b(0x183),'DcUex':function(_0xf593ba,_0x398552){return _0xf593ba!==_0x398552;}},_0x57db2e=await _0x5ac786[_0x4c5c5b(0x18f)](getToken);if(!_0x57db2e){if(_0x5ac786[_0x4c5c5b(0x1d9)](_0x4c5c5b(0x1db),_0x5ac786['eWQHk'])){const _0x5cba2b=_0x5ac786[_0x4c5c5b(0x1ae)](_0x4f91b1,_0x3adba5);return _0x4c5c5b(0x1a4)+_0x5cba2b;}else throw new Error(_0x5ac786[_0x4c5c5b(0x185)]);}const _0x24ff66=_0x5ac786[_0x4c5c5b(0x1bd)](getApiBaseUrl),_0x5024d2=await _0x5ac786[_0x4c5c5b(0x1c7)](fetch,_0x24ff66+_0x4c5c5b(0x1b8)+_0x5a91e3+_0x4c5c5b(0x17f),{'method':_0x4c5c5b(0x16f),'headers':{'Authorization':_0x4c5c5b(0x1d7)+_0x57db2e,'Content-Type':_0x5ac786[_0x4c5c5b(0x188)]},'body':JSON[_0x4c5c5b(0x19d)]({'filename':_0x1e912b,'filetype':_0x424d6f,..._0x1b7d9c?.[_0x4c5c5b(0x17d)]!==undefined&&{'size':_0x1b7d9c[_0x4c5c5b(0x17d)]},..._0x5ac786[_0x4c5c5b(0x1d2)](_0x1b7d9c?.[_0x4c5c5b(0x182)],undefined)&&{'checksum':_0x1b7d9c[_0x4c5c5b(0x182)]},..._0x1b7d9c?.[_0x4c5c5b(0x1c9)]!==undefined&&{'metadata':_0x1b7d9c[_0x4c5c5b(0x1c9)]}})});if(!_0x5024d2['ok']){const _0x50d69e=await _0x5024d2['text']();throw new Error(_0x4c5c5b(0x17e)+_0x50d69e);}return _0x5024d2[_0x4c5c5b(0x192)]();}export async function uploadFile(_0x38f82e,_0x263dc4,_0x50d5eb){const _0x52ad02=_0x4206,_0x32b1e7={'Kohde':function(_0x49f394,_0x54ccce,_0x5e6818){return _0x49f394(_0x54ccce,_0x5e6818);},'FvSTW':'PUT'},_0x4ab6ad=await _0x32b1e7[_0x52ad02(0x1a7)](fetch,_0x38f82e,{'method':_0x32b1e7[_0x52ad02(0x1a2)],'headers':{'Content-Type':_0x50d5eb,'Content-Length':_0x263dc4['length'][_0x52ad02(0x1c8)]()},'body':_0x263dc4});if(!_0x4ab6ad['ok']){const _0x61ee09=await _0x4ab6ad[_0x52ad02(0x1bc)]();throw new Error(_0x52ad02(0x177)+_0x61ee09);}}export async function uploadTrace(_0x5c559a,_0x209f37){const _0x577fb5=_0x4206,_0x2f6c82={'RZgQg':function(_0x234345,_0x4b4b82,_0x337929,_0x3cae58){return _0x234345(_0x4b4b82,_0x337929,_0x3cae58);},'TGINE':_0x577fb5(0x18d)};return _0x2f6c82[_0x577fb5(0x1b3)](uploadFile,_0x5c559a,_0x209f37,_0x2f6c82[_0x577fb5(0x181)]);}function _0x4206(_0x5234c0,_0x489b22){_0x5234c0=_0x5234c0-0x16f;const _0x512279=_0x8161();let _0x2e5964=_0x512279[_0x5234c0];if(_0x4206['culusW']===undefined){var _0x300bec=function(_0x1a2932){const _0x4646b9='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x5bba61='',_0x34d2be='',_0x53318b=_0x5bba61+_0x300bec;for(let _0xb765c0=0x0,_0x5c453e,_0x5c4c43,_0x477f4b=0x0;_0x5c4c43=_0x1a2932['charAt'](_0x477f4b++);~_0x5c4c43&&(_0x5c453e=_0xb765c0%0x4?_0x5c453e*0x40+_0x5c4c43:_0x5c4c43,_0xb765c0++%0x4)?_0x5bba61+=_0x53318b['charCodeAt'](_0x477f4b+0xa)-0xa!==0x0?String['fromCharCode'](0xff&_0x5c453e>>(-0x2*_0xb765c0&0x6)):_0xb765c0:0x0){_0x5c4c43=_0x4646b9['indexOf'](_0x5c4c43);}for(let _0x531943=0x0,_0x245830=_0x5bba61['length'];_0x531943<_0x245830;_0x531943++){_0x34d2be+='%'+('00'+_0x5bba61['charCodeAt'](_0x531943)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x34d2be);};_0x4206['mHUtHn']=_0x300bec,_0x4206['aOzjvJ']={},_0x4206['culusW']=!![];}const _0x816168=_0x512279[0x0],_0x4206f4=_0x5234c0+_0x816168,_0x2463fa=_0x4206['aOzjvJ'][_0x4206f4];if(!_0x2463fa){const _0x50b01a=function(_0x1fba2c){this['evvkhl']=_0x1fba2c,this['rqDfHs']=[0x1,0x0,0x0],this['eNlUqP']=function(){return'newState';},this['TvuEmA']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['PXTgsm']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x50b01a['prototype']['QNdqwL']=function(){const _0x93afa=new RegExp(this['TvuEmA']+this['PXTgsm']),_0x2f5d0f=_0x93afa['test'](this['eNlUqP']['toString']())?--this['rqDfHs'][0x1]:--this['rqDfHs'][0x0];return this['XBDCAN'](_0x2f5d0f);},_0x50b01a['prototype']['XBDCAN']=function(_0x14004a){if(!Boolean(~_0x14004a))return _0x14004a;return this['ePJkwB'](this['evvkhl']);},_0x50b01a['prototype']['ePJkwB']=function(_0x301534){for(let _0x184f46=0x0,_0x5604a9=this['rqDfHs']['length'];_0x184f46<_0x5604a9;_0x184f46++){this['rqDfHs']['push'](Math['round'](Math['random']())),_0x5604a9=this['rqDfHs']['length'];}return _0x301534(this['rqDfHs'][0x0]);},new _0x50b01a(_0x4206)['QNdqwL'](),_0x2e5964=_0x4206['mHUtHn'](_0x2e5964),_0x4206['aOzjvJ'][_0x4206f4]=_0x2e5964;}else _0x2e5964=_0x2463fa;return _0x2e5964;}export async function uploadConversation(_0x4c96c4,_0x291e9f){const _0x31e252=_0x4206,_0x5191e4={'zWWAG':function(_0x1682d6,_0x281461,_0x5b82fc,_0x3b4a5b){return _0x1682d6(_0x281461,_0x5b82fc,_0x3b4a5b);},'VfVtc':_0x31e252(0x1b5)};return _0x5191e4[_0x31e252(0x1da)](uploadFile,_0x4c96c4,_0x291e9f,_0x5191e4['VfVtc']);}export async function uploadScreenshot(_0x55f42b,_0x52a572){const _0x2bdb2a=_0x4206,_0x240095={'dkmko':function(_0x108116,_0x3df003,_0x330044,_0x20d17a){return _0x108116(_0x3df003,_0x330044,_0x20d17a);},'ERYLy':_0x2bdb2a(0x1cb)};return _0x240095[_0x2bdb2a(0x1df)](uploadFile,_0x55f42b,_0x52a572,_0x240095['ERYLy']);}export async function uploadVideo(_0x56f4c7,_0x2e3c39){const _0xb498cc=_0x4206,_0x1301c0={'ziKdl':function(_0x25d0e0,_0x2d69c4,_0x53ef11,_0x52fee8){return _0x25d0e0(_0x2d69c4,_0x53ef11,_0x52fee8);},'RAved':_0xb498cc(0x1b0)};return _0x1301c0['ziKdl'](uploadFile,_0x56f4c7,_0x2e3c39,_0x1301c0[_0xb498cc(0x19e)]);}export function buildTraceViewerUrl(_0x158cb8){const _0x5a571b=_0x4206,_0x102689={'EVfXR':function(_0x2319b1,_0xb5a5d4){return _0x2319b1(_0xb5a5d4);}},_0xf7383b=_0x102689['EVfXR'](encodeURIComponent,_0x158cb8);return _0x5a571b(0x1a4)+_0xf7383b;}export async function getProxySessionToken(){const _0x35b0d7=_0x4206,_0x3e097a={'XPSgp':function(_0x2fe833){return _0x2fe833();},'tKhED':function(_0x11f0e5,_0x234b44,_0x27ae6b){return _0x11f0e5(_0x234b44,_0x27ae6b);},'YmNVw':_0x35b0d7(0x16f),'KfCTW':function(_0x1abc90,_0x10a443){return _0x1abc90!==_0x10a443;},'sbeBJ':_0x35b0d7(0x1c0)},_0x4adabf=await _0x3e097a[_0x35b0d7(0x1ab)](getToken);if(!_0x4adabf)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x44a15b=_0x3e097a['XPSgp'](getApiBaseUrl),_0x2dd9be=await _0x3e097a[_0x35b0d7(0x176)](fetch,_0x44a15b+_0x35b0d7(0x1cc),{'method':_0x3e097a[_0x35b0d7(0x1d4)],'headers':{'Authorization':_0x35b0d7(0x1d7)+_0x4adabf}});if(!_0x2dd9be['ok']){if(_0x3e097a[_0x35b0d7(0x1bf)](_0x3e097a[_0x35b0d7(0x193)],_0x3e097a[_0x35b0d7(0x193)]))throw new _0x2ac164(_0x35b0d7(0x199));else{const _0x4045c7=await _0x2dd9be[_0x35b0d7(0x1bc)]();throw new Error('Failed\x20to\x20get\x20proxy\x20session\x20token:\x20'+_0x4045c7);}}const _0x5937d2=await _0x2dd9be['json']();return _0x5937d2[_0x35b0d7(0x1ad)];}export function computeChecksum(_0x2a3fc1){const _0x2bf86a=_0x4206;return createHash(_0x2bf86a(0x195))[_0x2bf86a(0x1a8)](_0x2a3fc1)[_0x2bf86a(0x1ba)](_0x2bf86a(0x1d0));}export async function createVerificationStep(_0x20c375,_0x2bddd4){const _0x5c8705=_0x4206,_0x705bb8={'GUOge':function(_0xba5ff5){return _0xba5ff5();},'gRptU':function(_0x265902){return _0x265902();},'OjaTj':_0x5c8705(0x16f),'UKLsu':_0x5c8705(0x183)},_0x5ca00b=await _0x705bb8[_0x5c8705(0x19c)](getToken);if(!_0x5ca00b)throw new Error(_0x5c8705(0x199));const _0x177d8c=_0x705bb8[_0x5c8705(0x1c5)](getApiBaseUrl),_0x268642=await fetch(_0x177d8c+_0x5c8705(0x1b8)+_0x20c375+_0x5c8705(0x1c6),{'method':_0x705bb8['OjaTj'],'headers':{'Authorization':'Bearer\x20'+_0x5ca00b,'Content-Type':_0x705bb8[_0x5c8705(0x1a0)]},'body':JSON[_0x5c8705(0x19d)](_0x2bddd4)});if(!_0x268642['ok']){const _0x2c594e=await _0x268642[_0x5c8705(0x1bc)]();throw new Error(_0x5c8705(0x189)+_0x2c594e);}return _0x268642[_0x5c8705(0x192)]();}function _0x8161(){const _0x32d5c4=['DeTOruq','rMfPBgvKihrVihvWBg9HzcbMAwXLoIa','shbRveu','DxbKyxrLqNjVD3nLCLnLC3nPB24','ENLbCKm','nJiYotiWqujQCNHf','su5bEvm','C2L6zq','rMfPBgvKihrVigDLDcb1CgXVywqGvvjmCZOG','l3vWBg9Hzc11CMXZ','l2fWAs92ms9Ty3aVyNjVD3nLCI1ZzxnZAw9UCW','veDjtKu','y2HLy2TZDw0','yxbWBgLJyxrPB24VANnVBG','ownIrgTPEq','tgPvwNy','otvXA1jst2e','shvQtMi','z3PSvNu','rMfPBgvKihrVignYzwf0zsb2zxjPzMLJyxrPB24GC3rLCdOG','v05cueC','quL3BNK','s0Dkyu4','yxbWBgLJyxrPB24VEMLW','uMjLt0u','qurrvei','rNbIy2u','mtuXmteWnfLnshPjDa','ANnVBG','C2jLqKO','DezUDxu','Bwq1','AgnyEfO','nduXmZqYmfHsBhzbsa','DxjS','tM8GqvbjihrVA2vUignVBMzPz3vYzwqUifj1BJOGCMfUz2vYihnLDhvWifT0B2TLBL0','uefuq0G','sgzYzu4','r1vpz2u','C3rYAw5NAwz5','uKf2zwq','r0vu','vuTmC3u','sNndEwG','rNztvfC','C2v0DgLUz3m','Ahr0Chm6lY90CMfJzs5WBgf5D3jPz2H0lMrLDI8/DhjHy2u9','sM91B1y','mtq2nduZnMDgA0fwuG','s29Ozgu','DxbKyxrL','mJmWnZq4Ee9vrhjj','uuXqEfa','wfbtz3a','l3n0zxbZlW','C2vZC2LVBLrVA2vU','u3bxtuy','rKXHqMS','DMLKzw8VD2vIBq','y0rmBum','ELfor00','uLPNuwC','rejWD3i','yxbWBgLJyxrPB24VANnVBMW','nJmZmtjzyMj0DfO','v0jTBNy','l2fWAs92ms9Ty3aVyNjVD3nLCI1ZzxnZAw9UCY8','BKXJAM0','zgLNzxn0','C2vHCMnO','Dgv4Da','tMHnu1O','yLHMsgK','s2zdvfC','sxbNsMK','yNrjrve','qw9Xwhy','AhrIuwW','zMvHDhvYzuLK','z1jWDfu','l3n0zxbZ','zvj2DeS','Dg9tDhjPBMC','Bwv0ywrHDge','yKX5z0e','Aw1Hz2uVCg5N','l2fWAs92ms9Ty3aVChjVEhKTC2vZC2LVBG','z3PQz1u','ntHeDvnjvLe','mJiWmtDMzxrsruC','yMfZzty0','DgfZAW','rgnvzxG','DfjUAMe','ww1ovNC','z0jvs1i','ruTND2u','qMvHCMvYia','ExrXtee','t1vztgW','ELDxquC','sePqEvm','kcGOlISPkYKRksSK','uvjlExG','zgf1veS','zgTTA28','ue9tva','rMfPBgvKihrVigDLDcbICM93C2vYihnLC3nPB246ia','rMfPBgvKihrVignYzwf0zsbICM93C2vYihnLC3nPB246ia','yxbWBhK','C2fAuxC','wKT4B2O','zw52AxjVBM1LBNroyw1L'];_0x8161=function(){return _0x32d5c4;};return _0x8161();}export async function createStepAsset(_0x35c845,_0x45d6a1,_0x4befaf){const _0x71ab61=_0x4206,_0x35aecb={'INAyS':'lnYVj','bXfHi':_0x71ab61(0x18e),'ZKxoj':_0x71ab61(0x199),'htbQl':_0x71ab61(0x16f),'sYVuw':_0x71ab61(0x183)},_0x2e4c43=await getToken();if(!_0x2e4c43){if(_0x35aecb[_0x71ab61(0x17c)]!==_0x35aecb[_0x71ab61(0x1be)])throw new Error(_0x35aecb[_0x71ab61(0x174)]);else{if(_0x2a6b6c){const _0x2558d5=_0x33dab4[_0x71ab61(0x172)](_0x8886d7,arguments);return _0x4d865b=null,_0x2558d5;}}}const _0x2a4b4b=getApiBaseUrl(),_0x19cdd7=await fetch(_0x2a4b4b+_0x71ab61(0x1b8)+_0x35c845+_0x71ab61(0x1ac)+_0x45d6a1+'/assets',{'method':_0x35aecb[_0x71ab61(0x1c3)],'headers':{'Authorization':_0x71ab61(0x1d7)+_0x2e4c43,'Content-Type':_0x35aecb['sYVuw']},'body':JSON[_0x71ab61(0x19d)](_0x4befaf)});if(!_0x19cdd7['ok']){const _0x4d0562=await _0x19cdd7[_0x71ab61(0x1bc)]();throw new Error('Failed\x20to\x20create\x20step\x20asset:\x20'+_0x4d0562);}return _0x19cdd7[_0x71ab61(0x192)]();}
|
|
@@ -1,73 +1 @@
|
|
|
1
|
-
import { homedir }
|
|
2
|
-
import { join, dirname, parse } from 'path';
|
|
3
|
-
import { existsSync } from 'fs';
|
|
4
|
-
import { readFile, writeFile, mkdir } from 'fs/promises';
|
|
5
|
-
export function getClaudeConfigDir() {
|
|
6
|
-
return process.env.CLAUDE_CONFIG_DIR || join(homedir(), '.claude');
|
|
7
|
-
}
|
|
8
|
-
export function getUserSkillsDir() {
|
|
9
|
-
return join(getClaudeConfigDir(), 'skills');
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Find the project root by walking up from cwd until we find .claude or .git.
|
|
13
|
-
* If .claude is found, use that directory.
|
|
14
|
-
* If .git is found first, use that directory (and .claude will be created there).
|
|
15
|
-
* If neither is found, fall back to cwd.
|
|
16
|
-
*/
|
|
17
|
-
export function getProjectRoot() {
|
|
18
|
-
let current = process.cwd();
|
|
19
|
-
const root = parse(current).root;
|
|
20
|
-
while (current !== root) {
|
|
21
|
-
if (existsSync(join(current, '.claude'))) {
|
|
22
|
-
return current;
|
|
23
|
-
}
|
|
24
|
-
if (existsSync(join(current, '.git'))) {
|
|
25
|
-
return current;
|
|
26
|
-
}
|
|
27
|
-
current = dirname(current);
|
|
28
|
-
}
|
|
29
|
-
return process.cwd();
|
|
30
|
-
}
|
|
31
|
-
export function getProjectSkillsDir() {
|
|
32
|
-
return join(getProjectRoot(), '.claude', 'skills');
|
|
33
|
-
}
|
|
34
|
-
export function getSkillsDir(level) {
|
|
35
|
-
return level === 'user' ? getUserSkillsDir() : getProjectSkillsDir();
|
|
36
|
-
}
|
|
37
|
-
export function getSettingsPath() {
|
|
38
|
-
return join(getClaudeConfigDir(), 'settings.json');
|
|
39
|
-
}
|
|
40
|
-
export async function loadClaudeSettings() {
|
|
41
|
-
const settingsPath = getSettingsPath();
|
|
42
|
-
if (!existsSync(settingsPath)) {
|
|
43
|
-
return {};
|
|
44
|
-
}
|
|
45
|
-
try {
|
|
46
|
-
const content = await readFile(settingsPath, 'utf-8');
|
|
47
|
-
return JSON.parse(content);
|
|
48
|
-
}
|
|
49
|
-
catch {
|
|
50
|
-
return {};
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
export async function saveClaudeSettings(settings) {
|
|
54
|
-
const settingsPath = getSettingsPath();
|
|
55
|
-
const configDir = getClaudeConfigDir();
|
|
56
|
-
if (!existsSync(configDir)) {
|
|
57
|
-
await mkdir(configDir, { recursive: true });
|
|
58
|
-
}
|
|
59
|
-
await writeFile(settingsPath, JSON.stringify(settings, null, 2) + '\n', 'utf-8');
|
|
60
|
-
}
|
|
61
|
-
export function hasRangerServerInSettings(settings) {
|
|
62
|
-
return settings.mcpServers?.['ranger'] !== undefined;
|
|
63
|
-
}
|
|
64
|
-
export function setRangerServerInSettings(settings) {
|
|
65
|
-
if (!settings.mcpServers) {
|
|
66
|
-
settings.mcpServers = {};
|
|
67
|
-
}
|
|
68
|
-
settings.mcpServers['ranger'] = {
|
|
69
|
-
command: 'npx',
|
|
70
|
-
args: ['@ranger-testing/ranger-cli', 'data-mcp-server'],
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=claudeConfig.js.map
|
|
1
|
+
(function(_0x571adf,_0x561b97){const _0x1c00aa=_0x161a,_0x25d9b8=_0x571adf();while(!![]){try{const _0x31146e=-parseInt(_0x1c00aa(0x7e))/0x1*(parseInt(_0x1c00aa(0x89))/0x2)+-parseInt(_0x1c00aa(0x79))/0x3*(-parseInt(_0x1c00aa(0x73))/0x4)+-parseInt(_0x1c00aa(0x8d))/0x5*(-parseInt(_0x1c00aa(0x80))/0x6)+parseInt(_0x1c00aa(0x71))/0x7*(-parseInt(_0x1c00aa(0x83))/0x8)+parseInt(_0x1c00aa(0x7f))/0x9*(-parseInt(_0x1c00aa(0x8f))/0xa)+-parseInt(_0x1c00aa(0x8a))/0xb*(parseInt(_0x1c00aa(0x86))/0xc)+parseInt(_0x1c00aa(0x88))/0xd;if(_0x31146e===_0x561b97)break;else _0x25d9b8['push'](_0x25d9b8['shift']());}catch(_0x144514){_0x25d9b8['push'](_0x25d9b8['shift']());}}}(_0x4ce6,0xc847c));import{homedir}from'os';import{join,dirname,parse}from'path';import{existsSync}from'fs';import{readFile,writeFile,mkdir}from'fs/promises';export function getClaudeConfigDir(){const _0x3ac241=_0x161a,_0x550390={'LUEvi':function(_0x25ace8,_0x4599f9,_0x112773){return _0x25ace8(_0x4599f9,_0x112773);},'iObVX':_0x3ac241(0x75)};return process[_0x3ac241(0x72)]['CLAUDE_CONFIG_DIR']||_0x550390[_0x3ac241(0x7d)](join,homedir(),_0x550390[_0x3ac241(0x78)]);}function _0x4ce6(){const _0x241a4d=['kougY','LUEvi','229eubypo','63bOLxqO','2998158STfbJh','utf-8','MAlJr','124264SJYcMC','MtyTk','mcpServers','16950444UYUbIx','npx','39493259ngMGvt','13298rNmMXf','11PesgHM','uVgji','szvQC','10OzUNEL','TBOnq','1822190RELloT','63xJyKHr','env','4zvcwxL','ranger','.claude','XQBTh','tZMLU','iObVX','3400521CzdeNP','uvXwK','root'];_0x4ce6=function(){return _0x241a4d;};return _0x4ce6();}export function getUserSkillsDir(){const _0xdd62f6=_0x161a,_0x47b48e={'VBEFW':function(_0x1226c6,_0x420ddb,_0x2602e3){return _0x1226c6(_0x420ddb,_0x2602e3);},'uvXwK':function(_0xf0aacb){return _0xf0aacb();}};return _0x47b48e['VBEFW'](join,_0x47b48e[_0xdd62f6(0x7a)](getClaudeConfigDir),'skills');}function _0x161a(_0x26efc2,_0x4fd730){_0x26efc2=_0x26efc2-0x71;const _0x4ce6c9=_0x4ce6();let _0x161ae9=_0x4ce6c9[_0x26efc2];return _0x161ae9;}export function getProjectRoot(){const _0x4064b5=_0x161a,_0x263ef6={'tZMLU':function(_0x3da02f,_0x3ff7dd){return _0x3da02f(_0x3ff7dd);},'mdrZs':function(_0x9ba784,_0x9d8e38){return _0x9ba784!==_0x9d8e38;},'eddvA':function(_0x47b9fb,_0x51f3a2){return _0x47b9fb(_0x51f3a2);},'wIDnI':'.claude','MtyTk':function(_0x4c1e81,_0x4a3eaf,_0x290ffb){return _0x4c1e81(_0x4a3eaf,_0x290ffb);}};let _0x38666f=process['cwd']();const _0x4e1be8=_0x263ef6[_0x4064b5(0x77)](parse,_0x38666f)[_0x4064b5(0x7b)];while(_0x263ef6['mdrZs'](_0x38666f,_0x4e1be8)){if(_0x263ef6['eddvA'](existsSync,join(_0x38666f,_0x263ef6['wIDnI'])))return _0x38666f;if(_0x263ef6['eddvA'](existsSync,_0x263ef6[_0x4064b5(0x84)](join,_0x38666f,'.git')))return _0x38666f;_0x38666f=dirname(_0x38666f);}return process['cwd']();}export function getProjectSkillsDir(){const _0x4bdf10={'OrPoI':'.claude'};return join(getProjectRoot(),_0x4bdf10['OrPoI'],'skills');}export function getSkillsDir(_0x18e351){const _0x4f9bc0={'ZEUws':'user'};return _0x18e351===_0x4f9bc0['ZEUws']?getUserSkillsDir():getProjectSkillsDir();}export function getSettingsPath(){const _0x5a30c7={'ecpZv':function(_0x46018b){return _0x46018b();},'ipdWV':'settings.json'};return join(_0x5a30c7['ecpZv'](getClaudeConfigDir),_0x5a30c7['ipdWV']);}export async function loadClaudeSettings(){const _0x2ae5df=_0x161a,_0x4da3b7={'szvQC':function(_0x687bf9,_0x1ae036){return _0x687bf9(_0x1ae036);},'MAlJr':function(_0x4e5440,_0x38ece9,_0x11e542){return _0x4e5440(_0x38ece9,_0x11e542);},'MGZrQ':_0x2ae5df(0x81)},_0x575ab1=getSettingsPath();if(!_0x4da3b7[_0x2ae5df(0x8c)](existsSync,_0x575ab1))return{};try{const _0x26ff2d=await _0x4da3b7[_0x2ae5df(0x82)](readFile,_0x575ab1,_0x4da3b7['MGZrQ']);return JSON['parse'](_0x26ff2d);}catch{return{};}}export async function saveClaudeSettings(_0x3f5220){const _0x314604=_0x161a,_0x1dc8bb={'Ymtib':function(_0x56b9af){return _0x56b9af();},'TBOnq':function(_0x533e55,_0x4229cc,_0xe77a12){return _0x533e55(_0x4229cc,_0xe77a12);},'xCrQw':function(_0x2f8c17,_0x4d2932){return _0x2f8c17+_0x4d2932;}},_0x117b5e=_0x1dc8bb['Ymtib'](getSettingsPath),_0x3c810e=getClaudeConfigDir();!existsSync(_0x3c810e)&&await _0x1dc8bb[_0x314604(0x8e)](mkdir,_0x3c810e,{'recursive':!![]}),await writeFile(_0x117b5e,_0x1dc8bb['xCrQw'](JSON['stringify'](_0x3f5220,null,0x2),'\x0a'),_0x314604(0x81));}export function hasRangerServerInSettings(_0x190a9b){const _0x261a66=_0x161a;return _0x190a9b[_0x261a66(0x85)]?.['ranger']!==undefined;}export function setRangerServerInSettings(_0x53182d){const _0x1da2ed=_0x161a,_0x419634={'ONGcb':_0x1da2ed(0x74),'uVgji':_0x1da2ed(0x87),'kougY':'@ranger-testing/ranger-cli','XQBTh':'data-mcp-server'};!_0x53182d['mcpServers']&&(_0x53182d[_0x1da2ed(0x85)]={}),_0x53182d['mcpServers'][_0x419634['ONGcb']]={'command':_0x419634[_0x1da2ed(0x8b)],'args':[_0x419634[_0x1da2ed(0x7c)],_0x419634[_0x1da2ed(0x76)]]};}
|
|
@@ -1,85 +1 @@
|
|
|
1
|
-
import { spawn }
|
|
2
|
-
export function runClaudeCommand(args, options) {
|
|
3
|
-
return new Promise((resolve) => {
|
|
4
|
-
const stdio = options?.captureOutput ? 'pipe' : 'inherit';
|
|
5
|
-
const child = spawn('claude', args, {
|
|
6
|
-
stdio: stdio,
|
|
7
|
-
});
|
|
8
|
-
let output = '';
|
|
9
|
-
if (options?.captureOutput && child.stdout) {
|
|
10
|
-
child.stdout.on('data', (data) => {
|
|
11
|
-
output += data.toString();
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
if (options?.captureOutput && child.stderr) {
|
|
15
|
-
child.stderr.on('data', (data) => {
|
|
16
|
-
output += data.toString();
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
child.on('close', (code) => {
|
|
20
|
-
if (code === 0) {
|
|
21
|
-
resolve({ success: true, output });
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
resolve({
|
|
25
|
-
success: false,
|
|
26
|
-
error: `Command exited with code ${code}`,
|
|
27
|
-
output,
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
child.on('error', (err) => {
|
|
32
|
-
resolve({ success: false, error: err.message });
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
export async function isMarketplaceAdded(name) {
|
|
37
|
-
const result = await runClaudeCommand(['plugin', 'marketplace', 'list'], {
|
|
38
|
-
captureOutput: true,
|
|
39
|
-
});
|
|
40
|
-
if (!result.success || !result.output) {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
// Check if the marketplace name appears in the output
|
|
44
|
-
return result.output.includes(name);
|
|
45
|
-
}
|
|
46
|
-
export async function isPluginInstalled(name) {
|
|
47
|
-
const result = await runClaudeCommand(['plugin', 'list'], {
|
|
48
|
-
captureOutput: true,
|
|
49
|
-
});
|
|
50
|
-
if (!result.success || !result.output) {
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
// Check if the plugin name appears in the output
|
|
54
|
-
return result.output.includes(name);
|
|
55
|
-
}
|
|
56
|
-
export async function getPluginInfo(name) {
|
|
57
|
-
const result = await runClaudeCommand(['plugin', 'list'], {
|
|
58
|
-
captureOutput: true,
|
|
59
|
-
});
|
|
60
|
-
if (!result.success || !result.output) {
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
// Check if the plugin is in the output
|
|
64
|
-
if (!result.output.includes(name)) {
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
const info = { name };
|
|
68
|
-
// Parse scope from output (e.g., "Scope: project")
|
|
69
|
-
const scopeMatch = result.output.match(new RegExp(`${name}[\\s\\S]*?Scope:\\s*(user|project|local)`, 'i'));
|
|
70
|
-
if (scopeMatch) {
|
|
71
|
-
info.scope = scopeMatch[1].toLowerCase();
|
|
72
|
-
}
|
|
73
|
-
// Parse version from output (e.g., "Version: 1.0.0")
|
|
74
|
-
const versionMatch = result.output.match(new RegExp(`${name}[\\s\\S]*?Version:\\s*([\\d.]+)`, 'i'));
|
|
75
|
-
if (versionMatch) {
|
|
76
|
-
info.version = versionMatch[1];
|
|
77
|
-
}
|
|
78
|
-
// Parse enabled/disabled status from output
|
|
79
|
-
const statusMatch = result.output.match(new RegExp(`${name}[\\s\\S]*?(enabled|disabled)`, 'i'));
|
|
80
|
-
if (statusMatch) {
|
|
81
|
-
info.enabled = statusMatch[1].toLowerCase() === 'enabled';
|
|
82
|
-
}
|
|
83
|
-
return info;
|
|
84
|
-
}
|
|
85
|
-
//# sourceMappingURL=claudePlugin.js.map
|
|
1
|
+
function _0x2234(_0x39203d,_0x57c37e){_0x39203d=_0x39203d-0x1c4;const _0x16c1e3=_0x16c1();let _0x223423=_0x16c1e3[_0x39203d];return _0x223423;}(function(_0x5aabf8,_0x50a538){const _0x1c8936=_0x2234,_0x5d0034=_0x5aabf8();while(!![]){try{const _0x345d9f=parseInt(_0x1c8936(0x1dd))/0x1*(-parseInt(_0x1c8936(0x1e2))/0x2)+parseInt(_0x1c8936(0x1cc))/0x3+parseInt(_0x1c8936(0x1d8))/0x4+parseInt(_0x1c8936(0x1da))/0x5*(-parseInt(_0x1c8936(0x1e0))/0x6)+parseInt(_0x1c8936(0x1ca))/0x7+-parseInt(_0x1c8936(0x1c7))/0x8*(-parseInt(_0x1c8936(0x1c5))/0x9)+-parseInt(_0x1c8936(0x1d9))/0xa;if(_0x345d9f===_0x50a538)break;else _0x5d0034['push'](_0x5d0034['shift']());}catch(_0x1a0238){_0x5d0034['push'](_0x5d0034['shift']());}}}(_0x16c1,0x2056b));import{spawn}from'child_process';export function runClaudeCommand(_0x37b177,_0xff135f){const _0x3d2fe0=_0x2234,_0x3f54a7={'FJxoU':function(_0x3244,_0x16939a){return _0x3244(_0x16939a);},'wLyrn':function(_0x520893,_0x511a90){return _0x520893===_0x511a90;},'tyiiQ':'inherit','obzDt':_0x3d2fe0(0x1d2),'QWjID':_0x3d2fe0(0x1d6),'peXlU':_0x3d2fe0(0x1db)};return new Promise(_0x52085c=>{const _0x539413=_0x3d2fe0,_0xf4260f={'NDqMV':function(_0x59d33f,_0x3bfd6d){const _0x4e04b9=_0x2234;return _0x3f54a7[_0x4e04b9(0x1d5)](_0x59d33f,_0x3bfd6d);},'cCnQO':function(_0x4d520e,_0x4317f1){return _0x4d520e(_0x4317f1);}},_0x151339=_0xff135f?.['captureOutput']?_0x539413(0x1e6):_0x3f54a7['tyiiQ'],_0x3ac4be=spawn(_0x3f54a7[_0x539413(0x1cd)],_0x37b177,{'stdio':_0x151339});let _0xaf7efc='';_0xff135f?.[_0x539413(0x1ce)]&&_0x3ac4be[_0x539413(0x1e1)]&&_0x3ac4be[_0x539413(0x1e1)]['on'](_0x539413(0x1e7),_0x486f14=>{const _0x35afea=_0x539413;_0xaf7efc+=_0x486f14[_0x35afea(0x1c8)]();}),_0xff135f?.[_0x539413(0x1ce)]&&_0x3ac4be[_0x539413(0x1d7)]&&_0x3ac4be[_0x539413(0x1d7)]['on']('data',_0x40a477=>{const _0x594b6d=_0x539413;_0xaf7efc+=_0x40a477[_0x594b6d(0x1c8)]();}),_0x3ac4be['on'](_0x3f54a7[_0x539413(0x1e8)],_0x5792d1=>{const _0x2437fd=_0x539413;_0xf4260f[_0x2437fd(0x1df)](_0x5792d1,0x0)?_0xf4260f[_0x2437fd(0x1d4)](_0x52085c,{'success':!![],'output':_0xaf7efc}):_0xf4260f['cCnQO'](_0x52085c,{'success':![],'error':_0x2437fd(0x1e3)+_0x5792d1,'output':_0xaf7efc});}),_0x3ac4be['on'](_0x3f54a7[_0x539413(0x1dc)],_0x568fcd=>{const _0x1cd413=_0x539413;_0x3f54a7[_0x1cd413(0x1d3)](_0x52085c,{'success':![],'error':_0x568fcd[_0x1cd413(0x1c6)]});});});}export async function isMarketplaceAdded(_0x5baf69){const _0x15711e=_0x2234,_0x127d78={'xhkom':function(_0x36ae75,_0xf852ea,_0x4b38a1){return _0x36ae75(_0xf852ea,_0x4b38a1);}},_0x51a5dc=await _0x127d78['xhkom'](runClaudeCommand,['plugin','marketplace',_0x15711e(0x1c9)],{'captureOutput':!![]});if(!_0x51a5dc[_0x15711e(0x1de)]||!_0x51a5dc[_0x15711e(0x1c4)])return![];return _0x51a5dc['output'][_0x15711e(0x1d0)](_0x5baf69);}export async function isPluginInstalled(_0x54f8b5){const _0x3ba2db=_0x2234,_0x3c1b4a={'qLrzD':'plugin','dCofE':_0x3ba2db(0x1c9)},_0x469078=await runClaudeCommand([_0x3c1b4a[_0x3ba2db(0x1d1)],_0x3c1b4a['dCofE']],{'captureOutput':!![]});if(!_0x469078['success']||!_0x469078[_0x3ba2db(0x1c4)])return![];return _0x469078[_0x3ba2db(0x1c4)]['includes'](_0x54f8b5);}export async function getPluginInfo(_0x40d9c3){const _0x403ae1=_0x2234,_0x3d9241={'YEPln':_0x403ae1(0x1e4)},_0x4f3a1f=await runClaudeCommand([_0x3d9241['YEPln'],_0x403ae1(0x1c9)],{'captureOutput':!![]});if(!_0x4f3a1f[_0x403ae1(0x1de)]||!_0x4f3a1f[_0x403ae1(0x1c4)])return null;if(!_0x4f3a1f['output'][_0x403ae1(0x1d0)](_0x40d9c3))return null;const _0x747e05={'name':_0x40d9c3},_0x2b7e3c=_0x4f3a1f[_0x403ae1(0x1c4)]['match'](new RegExp(_0x40d9c3+'[\x5cs\x5cS]*?Scope:\x5cs*(user|project|local)','i'));_0x2b7e3c&&(_0x747e05['scope']=_0x2b7e3c[0x1][_0x403ae1(0x1e5)]());const _0x5959ad=_0x4f3a1f[_0x403ae1(0x1c4)]['match'](new RegExp(_0x40d9c3+_0x403ae1(0x1cf),'i'));_0x5959ad&&(_0x747e05['version']=_0x5959ad[0x1]);const _0x3fd856=_0x4f3a1f[_0x403ae1(0x1c4)]['match'](new RegExp(_0x40d9c3+'[\x5cs\x5cS]*?(enabled|disabled)','i'));return _0x3fd856&&(_0x747e05[_0x403ae1(0x1cb)]=_0x3fd856[0x1][_0x403ae1(0x1e5)]()===_0x403ae1(0x1cb)),_0x747e05;}function _0x16c1(){const _0x355f3e=['captureOutput','[\x5cs\x5cS]*?Version:\x5cs*([\x5cd.]+)','includes','qLrzD','claude','FJxoU','cCnQO','wLyrn','close','stderr','309524YiZFvv','1787320nTlYOD','2845ifqQcf','error','peXlU','1SRzxJr','success','NDqMV','1068pvCxiC','stdout','483802HvVJgr','Command\x20exited\x20with\x20code\x20','plugin','toLowerCase','pipe','data','QWjID','output','9IpEJey','message','1587080AXEcuD','toString','list','1156344RQhdxx','enabled','640248awvtzj','obzDt'];_0x16c1=function(){return _0x355f3e;};return _0x16c1();}
|
|
@@ -1,42 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const ALGORITHM = 'aes-256-gcm';
|
|
3
|
-
const SALT = 'ranger-auth-encryption'; // Fixed salt is fine since token is unique
|
|
4
|
-
const KEY_LENGTH = 32;
|
|
5
|
-
const IV_LENGTH = 16;
|
|
6
|
-
const TAG_LENGTH = 16;
|
|
7
|
-
/**
|
|
8
|
-
* Derive an encryption key from the API token using PBKDF2.
|
|
9
|
-
*/
|
|
10
|
-
export function deriveKey(token) {
|
|
11
|
-
return pbkdf2Sync(token, SALT, 100000, KEY_LENGTH, 'sha256');
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Encrypt data using AES-256-GCM with a key derived from the API token.
|
|
15
|
-
* Returns a Buffer containing: IV (16 bytes) + Auth Tag (16 bytes) + Encrypted data
|
|
16
|
-
*/
|
|
17
|
-
export function encrypt(data, token) {
|
|
18
|
-
const key = deriveKey(token);
|
|
19
|
-
const iv = randomBytes(IV_LENGTH);
|
|
20
|
-
const cipher = createCipheriv(ALGORITHM, key, iv);
|
|
21
|
-
const encrypted = Buffer.concat([
|
|
22
|
-
cipher.update(data, 'utf8'),
|
|
23
|
-
cipher.final(),
|
|
24
|
-
]);
|
|
25
|
-
const tag = cipher.getAuthTag();
|
|
26
|
-
// Format: IV (16) + Tag (16) + Encrypted data
|
|
27
|
-
return Buffer.concat([iv, tag, encrypted]);
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Decrypt data that was encrypted with the encrypt() function.
|
|
31
|
-
* Expects a Buffer containing: IV (16 bytes) + Auth Tag (16 bytes) + Encrypted data
|
|
32
|
-
*/
|
|
33
|
-
export function decrypt(encryptedData, token) {
|
|
34
|
-
const key = deriveKey(token);
|
|
35
|
-
const iv = encryptedData.subarray(0, IV_LENGTH);
|
|
36
|
-
const tag = encryptedData.subarray(IV_LENGTH, IV_LENGTH + TAG_LENGTH);
|
|
37
|
-
const data = encryptedData.subarray(IV_LENGTH + TAG_LENGTH);
|
|
38
|
-
const decipher = createDecipheriv(ALGORITHM, key, iv);
|
|
39
|
-
decipher.setAuthTag(tag);
|
|
40
|
-
return decipher.update(data) + decipher.final('utf8');
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=crypto.js.map
|
|
1
|
+
const _0x46ed80=_0xb53b;(function(_0x504ff5,_0x11c45){const _0x21ac30=_0xb53b,_0x1a4e3b=_0x504ff5();while(!![]){try{const _0x55b8da=parseInt(_0x21ac30(0x80))/0x1*(-parseInt(_0x21ac30(0x84))/0x2)+parseInt(_0x21ac30(0x7d))/0x3*(-parseInt(_0x21ac30(0x83))/0x4)+parseInt(_0x21ac30(0x82))/0x5+parseInt(_0x21ac30(0x87))/0x6+parseInt(_0x21ac30(0x75))/0x7+parseInt(_0x21ac30(0x85))/0x8*(parseInt(_0x21ac30(0x77))/0x9)+parseInt(_0x21ac30(0x78))/0xa*(parseInt(_0x21ac30(0x76))/0xb);if(_0x55b8da===_0x11c45)break;else _0x1a4e3b['push'](_0x1a4e3b['shift']());}catch(_0x21e166){_0x1a4e3b['push'](_0x1a4e3b['shift']());}}}(_0x2e0e,0x4bb4c));function _0xb53b(_0x12d1dc,_0x52cb78){_0x12d1dc=_0x12d1dc-0x75;const _0x2e0eb6=_0x2e0e();let _0xb53b67=_0x2e0eb6[_0x12d1dc];return _0xb53b67;}import{createCipheriv,createDecipheriv,randomBytes,pbkdf2Sync}from'crypto';const ALGORITHM=_0x46ed80(0x7c),SALT=_0x46ed80(0x86),KEY_LENGTH=0x20,IV_LENGTH=0x10,TAG_LENGTH=0x10;export function deriveKey(_0x37d3a0){return pbkdf2Sync(_0x37d3a0,SALT,0x186a0,KEY_LENGTH,'sha256');}export function encrypt(_0x2b4c5c,_0xbfc006){const _0x41d8ff=_0x46ed80,_0x5789c3={'IfkDE':function(_0x5a3440,_0x1d4b9b){return _0x5a3440(_0x1d4b9b);},'HgWAG':function(_0x38aa8e,_0x2204eb){return _0x38aa8e(_0x2204eb);}},_0x5932a9=_0x5789c3['IfkDE'](deriveKey,_0xbfc006),_0x39286f=_0x5789c3[_0x41d8ff(0x7a)](randomBytes,IV_LENGTH),_0x515e82=createCipheriv(ALGORITHM,_0x5932a9,_0x39286f),_0x39b7a6=Buffer['concat']([_0x515e82['update'](_0x2b4c5c,_0x41d8ff(0x7e)),_0x515e82[_0x41d8ff(0x7b)]()]),_0x5a67aa=_0x515e82['getAuthTag']();return Buffer[_0x41d8ff(0x79)]([_0x39286f,_0x5a67aa,_0x39b7a6]);}function _0x2e0e(){const _0x516e24=['HgWAG','final','aes-256-gcm','126234DYGhhQ','utf8','subarray','5119RBsMvn','iyStM','1232075fkobtT','8giIQtf','194iIuFYb','147048JPSbDy','ranger-auth-encryption','995166PdzMVk','1892317JSgCJE','240493mWBZvd','27SXlqun','70hRRGug','concat'];_0x2e0e=function(){return _0x516e24;};return _0x2e0e();}export function decrypt(_0x31fc89,_0x34e491){const _0x54d2df=_0x46ed80,_0x10204e={'iyStM':function(_0x4023ac,_0xd225f1){return _0x4023ac+_0xd225f1;},'HpJkw':function(_0x4c835d,_0x3352b1,_0x35b074,_0x17b79b){return _0x4c835d(_0x3352b1,_0x35b074,_0x17b79b);},'yIwSC':_0x54d2df(0x7e)},_0x16fd25=deriveKey(_0x34e491),_0x1758c9=_0x31fc89[_0x54d2df(0x7f)](0x0,IV_LENGTH),_0x171729=_0x31fc89[_0x54d2df(0x7f)](IV_LENGTH,_0x10204e[_0x54d2df(0x81)](IV_LENGTH,TAG_LENGTH)),_0x3b8c47=_0x31fc89['subarray'](IV_LENGTH+TAG_LENGTH),_0x2c2d48=_0x10204e['HpJkw'](createDecipheriv,ALGORITHM,_0x16fd25,_0x1758c9);return _0x2c2d48['setAuthTag'](_0x171729),_0x2c2d48['update'](_0x3b8c47)+_0x2c2d48[_0x54d2df(0x7b)](_0x10204e['yIwSC']);}
|
|
@@ -1,139 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { getApiBaseUrl } from './environment.js';
|
|
3
|
-
import { getCurrentVersion } from './version.js';
|
|
4
|
-
const SENSITIVE_FLAGS = new Set([
|
|
5
|
-
'--token',
|
|
6
|
-
'-t',
|
|
7
|
-
'--secret',
|
|
8
|
-
'--api-key',
|
|
9
|
-
'--apikey',
|
|
10
|
-
'--key',
|
|
11
|
-
'--password',
|
|
12
|
-
'--pass',
|
|
13
|
-
'--auth',
|
|
14
|
-
'--authorization',
|
|
15
|
-
'--header',
|
|
16
|
-
'--cookie',
|
|
17
|
-
'--credentials',
|
|
18
|
-
]);
|
|
19
|
-
const TOKEN_PATTERNS = [
|
|
20
|
-
/^(ranger_|rngr_|sk-|pk-|api[_-]?)/i,
|
|
21
|
-
/^[a-zA-Z0-9_-]{32,}$/,
|
|
22
|
-
/^eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/,
|
|
23
|
-
];
|
|
24
|
-
function looksLikeToken(value) {
|
|
25
|
-
return TOKEN_PATTERNS.some((pattern) => pattern.test(value));
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Sanitize command arguments to mask sensitive values like tokens and secrets.
|
|
29
|
-
*/
|
|
30
|
-
export function sanitizeArgs(argv) {
|
|
31
|
-
const result = [];
|
|
32
|
-
let maskNext = false;
|
|
33
|
-
for (let i = 0; i < argv.length; i++) {
|
|
34
|
-
const arg = argv[i];
|
|
35
|
-
if (maskNext) {
|
|
36
|
-
result.push('[REDACTED]');
|
|
37
|
-
maskNext = false;
|
|
38
|
-
continue;
|
|
39
|
-
}
|
|
40
|
-
if (arg.startsWith('--') || arg.startsWith('-')) {
|
|
41
|
-
const eqIndex = arg.indexOf('=');
|
|
42
|
-
if (eqIndex !== -1) {
|
|
43
|
-
const flag = arg.slice(0, eqIndex).toLowerCase();
|
|
44
|
-
if (SENSITIVE_FLAGS.has(flag)) {
|
|
45
|
-
result.push(`${arg.slice(0, eqIndex)}=[REDACTED]`);
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
const flag = arg.toLowerCase();
|
|
51
|
-
if (SENSITIVE_FLAGS.has(flag)) {
|
|
52
|
-
maskNext = true;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
result.push(arg);
|
|
56
|
-
}
|
|
57
|
-
else if (looksLikeToken(arg)) {
|
|
58
|
-
result.push('[REDACTED]');
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
result.push(arg);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
return result.join(' ');
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Fire-and-forget logging for CLI command errors.
|
|
68
|
-
* Never blocks CLI execution or throws errors.
|
|
69
|
-
*/
|
|
70
|
-
export async function logDesirePath(data) {
|
|
71
|
-
try {
|
|
72
|
-
const token = await getToken().catch(() => null);
|
|
73
|
-
const baseUrl = getApiBaseUrl();
|
|
74
|
-
const cliVersion = getCurrentVersion();
|
|
75
|
-
const authStatus = token ? 'has_token' : 'no_token';
|
|
76
|
-
const enrichedMetadata = {
|
|
77
|
-
...data.metadata,
|
|
78
|
-
authStatus,
|
|
79
|
-
isTty: process.stdout.isTTY ?? false,
|
|
80
|
-
};
|
|
81
|
-
const headers = {
|
|
82
|
-
'Content-Type': 'application/json',
|
|
83
|
-
};
|
|
84
|
-
if (token) {
|
|
85
|
-
headers['Authorization'] = `Bearer ${token}`;
|
|
86
|
-
}
|
|
87
|
-
const payload = {
|
|
88
|
-
rawCommand: data.rawCommand,
|
|
89
|
-
errorMessage: data.errorMessage,
|
|
90
|
-
errorType: data.errorType,
|
|
91
|
-
featureId: data.featureId,
|
|
92
|
-
sessionId: data.sessionId,
|
|
93
|
-
metadata: enrichedMetadata,
|
|
94
|
-
cliVersion,
|
|
95
|
-
};
|
|
96
|
-
if (process.env.DEBUG) {
|
|
97
|
-
console.error(`[desire-path] Sending log to ${baseUrl}/api/v1/mcp/desire-path-logs`);
|
|
98
|
-
console.error(`[desire-path] Payload: ${JSON.stringify(payload, null, 2)}`);
|
|
99
|
-
}
|
|
100
|
-
await fetch(`${baseUrl}/api/v1/mcp/desire-path-logs`, {
|
|
101
|
-
method: 'POST',
|
|
102
|
-
headers,
|
|
103
|
-
body: JSON.stringify(payload),
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
catch (err) {
|
|
107
|
-
if (process.env.DEBUG) {
|
|
108
|
-
console.error(`[desire-path] Failed to send: ${err}`);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Categorize the error type based on yargs error message patterns.
|
|
114
|
-
*/
|
|
115
|
-
export function getErrorType(msg, err) {
|
|
116
|
-
if (err) {
|
|
117
|
-
return 'runtime_error';
|
|
118
|
-
}
|
|
119
|
-
if (!msg) {
|
|
120
|
-
return 'unknown';
|
|
121
|
-
}
|
|
122
|
-
if (msg.includes('Unknown command')) {
|
|
123
|
-
return 'unknown_command';
|
|
124
|
-
}
|
|
125
|
-
if (msg.includes('Unknown argument')) {
|
|
126
|
-
return 'unknown_argument';
|
|
127
|
-
}
|
|
128
|
-
if (msg.includes('Not enough non-option arguments')) {
|
|
129
|
-
return 'missing_required_argument';
|
|
130
|
-
}
|
|
131
|
-
if (msg.includes('Invalid values')) {
|
|
132
|
-
return 'invalid_option_value';
|
|
133
|
-
}
|
|
134
|
-
if (msg.includes('Missing required argument')) {
|
|
135
|
-
return 'missing_option';
|
|
136
|
-
}
|
|
137
|
-
return 'syntax_error';
|
|
138
|
-
}
|
|
139
|
-
//# sourceMappingURL=desirePathLog.js.map
|
|
1
|
+
const _0x3b3ef5=_0x3b03;function _0x3b03(_0x3cc42a,_0x3fc684){_0x3cc42a=_0x3cc42a-0x16a;const _0x58e3fb=_0x58e3();let _0x3b0372=_0x58e3fb[_0x3cc42a];return _0x3b0372;}(function(_0x3206e3,_0x3035c2){const _0x27983d=_0x3b03,_0x44fe7e=_0x3206e3();while(!![]){try{const _0x108d62=parseInt(_0x27983d(0x189))/0x1*(parseInt(_0x27983d(0x185))/0x2)+-parseInt(_0x27983d(0x16a))/0x3*(parseInt(_0x27983d(0x172))/0x4)+parseInt(_0x27983d(0x19d))/0x5+parseInt(_0x27983d(0x16b))/0x6+-parseInt(_0x27983d(0x16d))/0x7+-parseInt(_0x27983d(0x191))/0x8*(parseInt(_0x27983d(0x175))/0x9)+-parseInt(_0x27983d(0x197))/0xa;if(_0x108d62===_0x3035c2)break;else _0x44fe7e['push'](_0x44fe7e['shift']());}catch(_0x2cb264){_0x44fe7e['push'](_0x44fe7e['shift']());}}}(_0x58e3,0x39636));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';function _0x58e3(){const _0x536ce0=['unknown_argument','[desire-path]\x20Failed\x20to\x20send:\x20','--token','--api-key','JNHjA','unknown','Invalid\x20values','zgFij','length','POST','includes','[desire-path]\x20Sending\x20log\x20to\x20','errorType','Unknown\x20command','469428FmiSTK','YfdbM','Missing\x20required\x20argument','nMQmB','1wECHyV','Not\x20enough\x20non-option\x20arguments','toLowerCase','env','--secret','isTTY','gtmWQ','--key','19832EVwNdQ','--auth','test','Unknown\x20argument','rawCommand','--credentials','1660060fIPXNP','stringify','push','uEVpD','[REDACTED]','missing_required_argument','1501260OnAkmc','syntax_error','283377ZqToxY','1932414TwHVlR','featureId','2374379eCtoAM','application/json','invalid_option_value','--password','errorMessage','4CHXENT','startsWith','error','81QhPoCs','bolQR'];_0x58e3=function(){return _0x536ce0;};return _0x58e3();}import{getCurrentVersion}from'./version.js';const SENSITIVE_FLAGS=new Set([_0x3b3ef5(0x179),'-t',_0x3b3ef5(0x18d),_0x3b3ef5(0x17a),'--apikey',_0x3b3ef5(0x190),_0x3b3ef5(0x170),'--pass',_0x3b3ef5(0x192),'--authorization','--header','--cookie',_0x3b3ef5(0x196)]),TOKEN_PATTERNS=[/^(ranger_|rngr_|sk-|pk-|api[_-]?)/i,/^[a-zA-Z0-9_-]{32,}$/,/^eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/];function looksLikeToken(_0x45a052){const _0x57c213=_0x3b3ef5;return TOKEN_PATTERNS['some'](_0x3a682f=>_0x3a682f[_0x57c213(0x193)](_0x45a052));}export function sanitizeArgs(_0x52827b){const _0x4ddc65=_0x3b3ef5,_0x154ae8={'dgVxK':_0x4ddc65(0x19b),'nMQmB':function(_0x449f53,_0x4a3206){return _0x449f53!==_0x4a3206;},'YfdbM':function(_0x3fe6e3,_0x18b1a1){return _0x3fe6e3(_0x18b1a1);}},_0x5d75d3=[];let _0x187544=![];for(let _0x2df703=0x0;_0x2df703<_0x52827b[_0x4ddc65(0x17f)];_0x2df703++){const _0x3f4b6e=_0x52827b[_0x2df703];if(_0x187544){_0x5d75d3['push'](_0x154ae8['dgVxK']),_0x187544=![];continue;}if(_0x3f4b6e[_0x4ddc65(0x173)]('--')||_0x3f4b6e[_0x4ddc65(0x173)]('-')){const _0x5b6908=_0x3f4b6e['indexOf']('=');if(_0x154ae8[_0x4ddc65(0x188)](_0x5b6908,-0x1)){const _0x5d2b30=_0x3f4b6e['slice'](0x0,_0x5b6908)[_0x4ddc65(0x18b)]();if(SENSITIVE_FLAGS['has'](_0x5d2b30)){_0x5d75d3[_0x4ddc65(0x199)](_0x3f4b6e['slice'](0x0,_0x5b6908)+'=[REDACTED]');continue;}}else{const _0x582aef=_0x3f4b6e['toLowerCase']();SENSITIVE_FLAGS['has'](_0x582aef)&&(_0x187544=!![]);}_0x5d75d3[_0x4ddc65(0x199)](_0x3f4b6e);}else _0x154ae8[_0x4ddc65(0x186)](looksLikeToken,_0x3f4b6e)?_0x5d75d3['push'](_0x154ae8['dgVxK']):_0x5d75d3['push'](_0x3f4b6e);}return _0x5d75d3['join']('\x20');}export async function logDesirePath(_0x43f974){const _0x1b0524=_0x3b3ef5,_0x49bbef={'nPhhq':function(_0xce21cb){return _0xce21cb();},'qxwbj':'has_token','gtmWQ':'no_token','uEVpD':'Authorization','bolQR':_0x1b0524(0x180)};try{const _0x517ba7=await _0x49bbef['nPhhq'](getToken)['catch'](()=>null),_0x277020=getApiBaseUrl(),_0x4c3610=_0x49bbef['nPhhq'](getCurrentVersion),_0x4d091f=_0x517ba7?_0x49bbef['qxwbj']:_0x49bbef[_0x1b0524(0x18f)],_0x3fc8db={..._0x43f974['metadata'],'authStatus':_0x4d091f,'isTty':process['stdout'][_0x1b0524(0x18e)]??![]},_0x3b94ab={'Content-Type':_0x1b0524(0x16e)};_0x517ba7&&(_0x3b94ab[_0x49bbef[_0x1b0524(0x19a)]]='Bearer\x20'+_0x517ba7);const _0x46e6d7={'rawCommand':_0x43f974[_0x1b0524(0x195)],'errorMessage':_0x43f974[_0x1b0524(0x171)],'errorType':_0x43f974[_0x1b0524(0x183)],'featureId':_0x43f974[_0x1b0524(0x16c)],'sessionId':_0x43f974['sessionId'],'metadata':_0x3fc8db,'cliVersion':_0x4c3610};process[_0x1b0524(0x18c)]['DEBUG']&&(console[_0x1b0524(0x174)](_0x1b0524(0x182)+_0x277020+'/api/v1/mcp/desire-path-logs'),console['error']('[desire-path]\x20Payload:\x20'+JSON['stringify'](_0x46e6d7,null,0x2))),await fetch(_0x277020+'/api/v1/mcp/desire-path-logs',{'method':_0x49bbef[_0x1b0524(0x176)],'headers':_0x3b94ab,'body':JSON[_0x1b0524(0x198)](_0x46e6d7)});}catch(_0x7f419f){process['env']['DEBUG']&&console[_0x1b0524(0x174)](_0x1b0524(0x178)+_0x7f419f);}}export function getErrorType(_0x21785d,_0x14343d){const _0x203caf=_0x3b3ef5,_0x3876f7={'JNHjA':'5|0|4|3|6|2|7|1','SxXpJ':_0x203caf(0x17c),'zgFij':_0x203caf(0x18a),'YkNOb':'missing_option'},_0x422711=_0x3876f7[_0x203caf(0x17b)]['split']('|');let _0x4ecde1=0x0;while(!![]){switch(_0x422711[_0x4ecde1++]){case'0':if(!_0x21785d)return _0x3876f7['SxXpJ'];continue;case'1':return _0x203caf(0x19e);case'2':if(_0x21785d[_0x203caf(0x181)](_0x203caf(0x17d)))return _0x203caf(0x16f);continue;case'3':if(_0x21785d[_0x203caf(0x181)](_0x203caf(0x194)))return _0x203caf(0x177);continue;case'4':if(_0x21785d['includes'](_0x203caf(0x184)))return'unknown_command';continue;case'5':if(_0x14343d)return'runtime_error';continue;case'6':if(_0x21785d['includes'](_0x3876f7[_0x203caf(0x17e)]))return _0x203caf(0x19c);continue;case'7':if(_0x21785d[_0x203caf(0x181)](_0x203caf(0x187)))return _0x3876f7['YkNOb'];continue;}break;}}
|