@treasuredata/tdx 0.8.5 → 0.8.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/dist/bin.js +1 -1
- package/dist/build-info.json +2 -2
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/client/cdp-api-client.js +1 -1
- package/dist/client/engage-api-client.js +1 -1
- package/dist/client/http-client.js +1 -1
- package/dist/client/llm-api-client.js +1 -1
- package/dist/client/rate-limiter.js +1 -1
- package/dist/client/td-api-client.js +1 -1
- package/dist/client/trino-api-client.js +1 -1
- package/dist/client/workflow-client.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.d.ts +1 -0
- package/dist/commands/claude-command.d.ts.map +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-command.js.map +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/context-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/llm-proxy.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/index.js +1 -1
- package/dist/proxy/anthropic-adapter.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/context-signature.js +1 -1
- package/dist/proxy/conversation-utils.js +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/session-cache.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm.js +1 -1
- package/dist/sdk/query.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/workflow.js +1 -1
- package/dist/types/endpoints.js +1 -1
- package/dist/types/index.js +1 -1
- package/dist/utils/agent-ref-parser.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/chat-cache.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/command-output.js +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/fields-display.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/format-detector.js +1 -1
- package/dist/utils/formatters.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/llm-backup-utils.js +1 -1
- package/dist/utils/model-aliases.js +1 -1
- package/dist/utils/model-factors.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/segment-path-parser.js +1 -1
- package/dist/utils/segment-ref-parser.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sql-parser.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-config.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/tree-formatter.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/dist/utils/workflow-utils.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a41_0xce7c29=a41_0x49a9;(function(_0x2ba67b,_0x1ec246){const _0x30ab10=a41_0x49a9,_0x46c2b3=_0x2ba67b();while(!![]){try{const _0x79d209=-parseInt(_0x30ab10(0x137))/0x1+parseInt(_0x30ab10(0x146))/0x2+parseInt(_0x30ab10(0x136))/0x3*(-parseInt(_0x30ab10(0x11f))/0x4)+parseInt(_0x30ab10(0x128))/0x5+parseInt(_0x30ab10(0x141))/0x6*(parseInt(_0x30ab10(0x12e))/0x7)+parseInt(_0x30ab10(0x143))/0x8+parseInt(_0x30ab10(0x142))/0x9*(-parseInt(_0x30ab10(0x149))/0xa);if(_0x79d209===_0x1ec246)break;else _0x46c2b3['push'](_0x46c2b3['shift']());}catch(_0x65b5b4){_0x46c2b3['push'](_0x46c2b3['shift']());}}}(a41_0x232f,0xc297f));import{BaseCommand}from'./command.js';import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions,clearSessionContext}from'../core/session.js';import{profileExists}from'../core/profile.js';import{GlobalContext}from'../core/global-context.js';import a41_0xca9ffc from'chalk';export class UseCommand extends BaseCommand{[a41_0xce7c29(0x13b)]=a41_0xce7c29(0x125);[a41_0xce7c29(0x12f)]=a41_0xce7c29(0x121);['validate'](_0x1265da){const _0x185795=a41_0xce7c29,{args:_0x14830d}=_0x1265da;if(_0x14830d[_0x185795(0x14c)]===0x0)return undefined;if(_0x14830d[_0x185795(0x14c)]===0x1)return _0x185795(0x133)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20use\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20current\x20context\x0a'+_0x185795(0x148)+'\x0aResources:\x20database,\x20parent_segment,\x20llm_project,\x20profile,\x20engage_workspace\x0a'+_0x185795(0x131);const _0x2bae4b=_0x14830d[0x0],_0xb2590b=[_0x185795(0x129),_0x185795(0x123),_0x185795(0x11e),_0x185795(0x138),_0x185795(0x140)];if(!_0xb2590b['includes'](_0x2bae4b))return _0x185795(0x120)+_0x2bae4b+_0x185795(0x124)+_0xb2590b[_0x185795(0x126)](',\x20');return undefined;}async[a41_0xce7c29(0x132)](_0x1f2c23){const _0x218a03=a41_0xce7c29,{args:_0x314098,options:_0x3cee20}=_0x1f2c23,_0x3ab184=_0x3cee20[_0x218a03(0x135)],_0x5e7503=_0x3cee20['clear'];cleanExpiredSessions();try{if(_0x5e7503){clearSessionContext(_0x3cee20[_0x218a03(0x13c)]);const _0x31b7fb=_0x3cee20[_0x218a03(0x13c)]||getCurrentSessionPID()[_0x218a03(0x122)]();return console[_0x218a03(0x130)]('Session\x20context\x20'+a41_0xca9ffc[_0x218a03(0x12a)](_0x218a03(0x144))+'\x20'+a41_0xca9ffc[_0x218a03(0x139)]('(session:\x20'+_0x31b7fb+')')),0x0;}if(_0x314098['length']===0x0){const _0x1bceb4=new GlobalContext(_0x3cee20);return _0x3ab184?_0x1bceb4[_0x218a03(0x14a)]():_0x1bceb4['display'](),console[_0x218a03(0x130)](a41_0xca9ffc['dim'](_0x218a03(0x11d))),console[_0x218a03(0x130)](a41_0xca9ffc['dim']('Resources:\x20database,\x20parent_segment,\x20llm_project,\x20profile,\x20engage_workspace')),0x0;}const _0x30803d=_0x314098[0x0],_0x1e0a91=_0x314098[0x1];if(_0x30803d===_0x218a03(0x138)){if(!profileExists(_0x1e0a91))return console[_0x218a03(0x12d)]('Error:\x20Profile\x20\x27'+_0x1e0a91+_0x218a03(0x13f)),console[_0x218a03(0x12d)](_0x218a03(0x127)),0x1;const _0x3d03f8=_0x3cee20[_0x218a03(0x13c)]||getCurrentSessionPID()[_0x218a03(0x122)]();return saveSessionContext({'profile':_0x1e0a91},_0x3cee20[_0x218a03(0x13c)]),console[_0x218a03(0x130)](_0x218a03(0x13e)+a41_0xca9ffc[_0x218a03(0x12a)](_0x1e0a91)+'\x20'+a41_0xca9ffc[_0x218a03(0x139)](_0x218a03(0x145)+_0x3d03f8+')')),console['log'](a41_0xca9ffc[_0x218a03(0x139)](_0x218a03(0x13d))),0x0;}const _0x3e2f53={},_0x5280e0=_0x3cee20['session']||getCurrentSessionPID()[_0x218a03(0x122)]();switch(_0x30803d){case _0x218a03(0x129):_0x3e2f53[_0x218a03(0x129)]=_0x1e0a91,console[_0x218a03(0x130)](_0x218a03(0x12b)+a41_0xca9ffc[_0x218a03(0x12a)](_0x1e0a91)+'\x20'+a41_0xca9ffc[_0x218a03(0x139)](_0x218a03(0x145)+_0x5280e0+')'));break;case'parent_segment':_0x3e2f53[_0x218a03(0x123)]=_0x1e0a91,console['log'](_0x218a03(0x12c)+a41_0xca9ffc[_0x218a03(0x12a)](_0x1e0a91)+'\x20'+a41_0xca9ffc['dim']('(session:\x20'+_0x5280e0+')'));break;case'llm_project':_0x3e2f53[_0x218a03(0x11e)]=_0x1e0a91,console[_0x218a03(0x130)](_0x218a03(0x147)+a41_0xca9ffc[_0x218a03(0x12a)](_0x1e0a91)+'\x20'+a41_0xca9ffc[_0x218a03(0x139)](_0x218a03(0x145)+_0x5280e0+')'));break;case'engage_workspace':_0x3e2f53[_0x218a03(0x140)]=_0x1e0a91,console[_0x218a03(0x130)](_0x218a03(0x14b)+a41_0xca9ffc[_0x218a03(0x12a)](_0x1e0a91)+'\x20'+a41_0xca9ffc[_0x218a03(0x139)](_0x218a03(0x145)+_0x5280e0+')'));break;}return saveSessionContext(_0x3e2f53,_0x3cee20[_0x218a03(0x13c)]),console[_0x218a03(0x130)](a41_0xca9ffc[_0x218a03(0x139)](_0x218a03(0x13d))),0x0;}catch(_0x453b94){return _0x453b94 instanceof Error&&console[_0x218a03(0x12d)](_0x218a03(0x134)+_0x453b94[_0x218a03(0x13a)]),0x1;}}}function a41_0x49a9(_0x19c552,_0x3094df){_0x19c552=_0x19c552-0x11d;const _0x232f1d=a41_0x232f();let _0x49a9a8=_0x232f1d[_0x19c552];return _0x49a9a8;}function a41_0x232f(){const _0x3517a0=['Session\x20llm_project\x20set\x20to:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20use\x20--clear\x20\x20\x20\x20\x20\x20#\x20Clear\x20session\x20context\x0a','2168200zdfwXS','displayWithSources','Session\x20engage_workspace\x20set\x20to:\x20','length','\x0aSet\x20context:\x20tdx\x20use\x20<resource>\x20<value>','llm_project','5319628gcODWU','Invalid\x20resource:\x20','Set\x20session-level\x20context','toString','parent_segment','.\x20Must\x20be\x20one\x20of:\x20','use','join','\x0aUse\x20\x27tdx\x20profiles\x27\x20to\x20see\x20available\x20profiles','3813250HEjjsv','database','green','Session\x20database\x20set\x20to:\x20','Session\x20parent_segment\x20set\x20to:\x20','error','35HyTjmY','description','log','\x0aRun\x20\x27tdx\x20use\x20--help\x27\x20for\x20more\x20options','execute','Usage:\x20tdx\x20use\x20<resource>\x20<value>\x0a','Error:\x20','debug','3KbHMod','701427VCtOnU','profile','dim','message','name','session','\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides','Session\x20profile\x20set\x20to:\x20','\x27\x20does\x20not\x20exist','engage_workspace','1768566zuOUbs','45VLtSrd','3708208qhgGcy','cleared','(session:\x20','2425016eybFIG'];a41_0x232f=function(){return _0x3517a0;};return a41_0x232f();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a42_0x4262bb=a42_0x2c95;function a42_0x2c95(_0x2d1427,_0x5ad5b0){_0x2d1427=_0x2d1427-0x152;const _0x345c15=a42_0x345c();let _0x2c95fb=_0x345c15[_0x2d1427];return _0x2c95fb;}function a42_0x345c(){const _0x25fab8=['81kpBRGE','Listing\x20users...','message','6IpYDSM','\x20user','10MeLRBy','11004851GPhhWo','Fetching\x20user\x20info...','11857dwjUFo','description','3394559qdSLmK','1827244aurABC','Error:\x20','List\x20all\x20users\x20in\x20the\x20account','execute','2549391YBZFZR','✔\x20Found\x20','list','cause','user','getCurrent','verbose','length','data','error','name','\x20\x20Cause:\x20','399836pDLJnh','25oWEAAd','479504bkuHZM'];a42_0x345c=function(){return _0x25fab8;};return a42_0x345c();}(function(_0x52a820,_0x2917a3){const _0x2b4ccb=a42_0x2c95,_0x4f1966=_0x52a820();while(!![]){try{const _0x1f576b=-parseInt(_0x2b4ccb(0x167))/0x1+-parseInt(_0x2b4ccb(0x16a))/0x2+-parseInt(_0x2b4ccb(0x16e))/0x3+-parseInt(_0x2b4ccb(0x15c))/0x4*(-parseInt(_0x2b4ccb(0x15d))/0x5)+-parseInt(_0x2b4ccb(0x162))/0x6*(-parseInt(_0x2b4ccb(0x169))/0x7)+parseInt(_0x2b4ccb(0x15e))/0x8*(parseInt(_0x2b4ccb(0x15f))/0x9)+-parseInt(_0x2b4ccb(0x164))/0xa*(-parseInt(_0x2b4ccb(0x165))/0xb);if(_0x1f576b===_0x2917a3)break;else _0x4f1966['push'](_0x4f1966['shift']());}catch(_0x5581a0){_0x4f1966['push'](_0x4f1966['shift']());}}}(a42_0x345c,0xb6f1b));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';export class UserCommand extends BaseCommand{['name']=a42_0x4262bb(0x154);[a42_0x4262bb(0x168)]='Show\x20current\x20user\x20information';async[a42_0x4262bb(0x16d)](_0xca53fd){const _0x1f25c5=a42_0x4262bb,{options:_0x37042d,tdx:_0x5a7e38}=_0xca53fd;try{const _0x4dad97=await withSpinner(_0x1f25c5(0x166),()=>_0x5a7e38['user'][_0x1f25c5(0x155)](),{'verbose':_0x37042d['verbose']}),_0xe4c5b=_0x4dad97[_0x1f25c5(0x158)];return await handleSingleObjectOutput(_0xe4c5b,_0x37042d),0x0;}catch(_0x5c8905){if(_0x5c8905 instanceof SDKError)return console[_0x1f25c5(0x159)](_0x1f25c5(0x16b)+_0x5c8905[_0x1f25c5(0x161)]),_0x5c8905[_0x1f25c5(0x153)]&&console['error'](_0x1f25c5(0x15b)+_0x5c8905[_0x1f25c5(0x153)]),0x1;throw _0x5c8905;}}}export class UserListCommand extends BaseCommand{[a42_0x4262bb(0x15a)]='user\x20list';[a42_0x4262bb(0x168)]=a42_0x4262bb(0x16c);async[a42_0x4262bb(0x16d)](_0x8b1121){const _0x2e010b=a42_0x4262bb,{options:_0x1e9ec1,tdx:_0xb091c2}=_0x8b1121;try{const _0x2f71a5=await withSpinner(_0x2e010b(0x160),()=>_0xb091c2[_0x2e010b(0x154)][_0x2e010b(0x152)](),{'verbose':_0x1e9ec1[_0x2e010b(0x156)]}),_0x5be021=_0x2f71a5['data'];return console['error'](_0x2e010b(0x16f)+_0x5be021['length']+_0x2e010b(0x163)+(_0x5be021[_0x2e010b(0x157)]!==0x1?'s':'')),await handleSDKOutput(_0x5be021,_0x1e9ec1),0x0;}catch(_0x2e7411){if(_0x2e7411 instanceof SDKError)return console[_0x2e010b(0x159)](_0x2e010b(0x16b)+_0x2e7411[_0x2e010b(0x161)]),_0x2e7411['cause']&&console['error']('\x20\x20Cause:\x20'+_0x2e7411[_0x2e010b(0x153)]),0x1;throw _0x2e7411;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a43_0xd64fae=a43_0x3052;function a43_0x53f8(){const _0x18181d=['Killing\x20attempt...','Workflow:\x20','No\x20log\x20files\x20found\x20for\x20this\x20attempt','Error:\x20','Kill\x20a\x20running\x20attempt','workflow:logs','resumeFrom','filesExtracted','Parameters:\x20','Pushing\x20workflow\x20project...','attempt','\x20\x20Revision:\x20','...','Retry\x20a\x20session\x20or\x20attempt','Listing\x20workflow\x20attempts...','fileSize','success','yes','workflow:projects','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','retrySession','9KzkSKf','Params:\x20','revision','Listing\x20workflow\x20projects...','params','startsWith','taskName','limit','done','error','cause','Error:\x20Workflow\x20identifier\x20is\x20required','\x20\x20Project:\x20','Listing\x20workflow\x20sessions...','keys','Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]','index','✔\x20Retry\x20started','✔\x20Workflow\x20run\x20started','\x22?\x20This\x20cannot\x20be\x20undone.','322557SyVkKL','\x20\x20Attempt\x20ID:\x20','1668768vrNPzX','tasks','542472LvcGvP','Revision:\x20','Task\x20name:\x20','Show\x20specific\x20attempt\x20details','Start\x20a\x20workflow\x20run','indexOf','round','workflow:retry','run','Project:\x20','From\x20task:\x20','✔\x20Found\x20','description','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','workflow','attempts','stat','format','reason','Error:\x20Invalid\x20parameter\x20format:\x20','retryAttempt','length','\x20\x20Files\x20extracted:\x20','Getting\x20attempt\x20details...','split','execute','finishedAt','\x20is\x20not\x20a\x20directory','select','Project\x20filter:\x20','project','cancelRequested','2JlLWsQ','kill','Downloading\x20project\x20','Show\x20tasks\x20for\x20an\x20attempt','Include\x20retried:\x20yes','isArray','Select\x20a\x20task\x20to\x20view\x20logs:','Target:\x20','1566080GFAbae','utf-8','workflow:attempt','json','Filter:\x20project=','Downloading\x20logs...','List\x20workflows','projectId','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','Resume\x20from:\x20','\x20session','\x20\x20Project\x20ID:\x20','\x20\x20Session\x20ID:\x20','projectName','substring','name','Error:\x20Attempt\x20ID\x20is\x20required','\x20task','\x20\x20Cause:\x20','fs/promises','Pattern:\x20','status','download','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','task','\x20attempt','workflow:sessions','Fetching\x20log\x20files...','stringify','Expected\x20format:\x20--param\x20key=value','readFile','List\x20workflow\x20execution\x20sessions','createdAt','Status:\x20','Show\x20logs\x20for\x20a\x20workflow\x20attempt','sessions','Deleting\x20project\x20','sessionId','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','from','158818PdkPyU','map','message','Error:\x20Invalid\x20JSON\x20in\x20--params','canceling','sessionTime','Attempt\x20ID:\x20','Filter:\x20','Including\x20subtasks:\x20yes','log','Validation:\x20skipped','delete','Retrying\x20attempt...','includeSubtasks','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','✔\x20Downloaded\x20','running','537535OCwWOc','Starting\x20workflow\x20run...','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','Cancelled','1757525BOFqbr','skipValidation','Session\x20time:\x20','force','fromTask','data','verbose','attemptId','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','Project\x20name:\x20','\x20project','getTime','includeRetried','isDirectory','session','12aEuDDS','\x20workflow','Getting\x20attempt\x20tasks...','List\x20all\x20workflow\x20projects','session:','parse','retryAttemptName','✔\x20Pushed\x20','param'];a43_0x53f8=function(){return _0x18181d;};return a43_0x53f8();}(function(_0x165675,_0x2b91d7){const _0x544bc1=a43_0x3052,_0x35ae02=_0x165675();while(!![]){try{const _0x56b93a=-parseInt(_0x544bc1(0x185))/0x1*(-parseInt(_0x544bc1(0x1ff))/0x2)+-parseInt(_0x544bc1(0x1db))/0x3+parseInt(_0x544bc1(0x1df))/0x4+-parseInt(_0x544bc1(0x196))/0x5*(-parseInt(_0x544bc1(0x1a9))/0x6)+-parseInt(_0x544bc1(0x19a))/0x7+parseInt(_0x544bc1(0x1dd))/0x8*(parseInt(_0x544bc1(0x1c7))/0x9)+-parseInt(_0x544bc1(0x15c))/0xa;if(_0x56b93a===_0x2b91d7)break;else _0x35ae02['push'](_0x35ae02['shift']());}catch(_0x422474){_0x35ae02['push'](_0x35ae02['shift']());}}}(a43_0x53f8,0x3185c));import{BaseCommand}from'./command.js';function a43_0x3052(_0x1b44d4,_0x12748e){_0x1b44d4=_0x1b44d4-0x15c;const _0x53f8a0=a43_0x53f8();let _0x305222=_0x53f8a0[_0x1b44d4];return _0x305222;}import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{formatBytes}from'../utils/formatters.js';import a43_0x2cbd65 from'prompts';export class WorkflowProjectsCommand extends BaseCommand{[a43_0xd64fae(0x16b)]=a43_0xd64fae(0x1c4);[a43_0xd64fae(0x1eb)]=a43_0xd64fae(0x1ac);async['execute'](_0x1dc9c2){const _0x3acd1f=a43_0xd64fae,{options:_0x160a70,args:_0x1df96b,tdx:_0x447555}=_0x1dc9c2,_0x339f75=_0x1df96b[0x0];try{_0x160a70[_0x3acd1f(0x1a0)]&&_0x339f75&&console['error'](_0x3acd1f(0x170)+_0x339f75);const _0x210820=await withSpinner(_0x3acd1f(0x1ca),()=>_0x447555[_0x3acd1f(0x1ed)]['projects'](_0x339f75,{'limit':_0x160a70['limit']}),{'verbose':_0x160a70[_0x3acd1f(0x1a0)]}),_0x32645e=_0x210820[_0x3acd1f(0x19f)];return console[_0x3acd1f(0x1d0)](_0x3acd1f(0x1ea)+_0x32645e['length']+_0x3acd1f(0x1a4)+(_0x32645e['length']!==0x1?'s':'')),await handleSDKOutput(_0x32645e,_0x160a70),0x0;}catch(_0x5dee9f){if(_0x5dee9f instanceof SDKError)return console[_0x3acd1f(0x1d0)]('Error:\x20'+_0x5dee9f[_0x3acd1f(0x187)]),_0x5dee9f[_0x3acd1f(0x1d1)]&&console[_0x3acd1f(0x1d0)](_0x3acd1f(0x16e)+_0x5dee9f[_0x3acd1f(0x1d1)]),0x1;throw _0x5dee9f;}}}export class WorkflowWorkflowsCommand extends BaseCommand{[a43_0xd64fae(0x16b)]='workflow:workflows';['description']=a43_0xd64fae(0x162);async[a43_0xd64fae(0x1f8)](_0x303795){const _0x509e44=a43_0xd64fae,{options:_0x4ae4da,args:_0x2b0e82,tdx:_0x504142}=_0x303795,_0x3914e5=_0x2b0e82[0x0];try{_0x4ae4da[_0x509e44(0x1a0)]&&_0x3914e5&&console[_0x509e44(0x1d0)](_0x509e44(0x1fc)+_0x3914e5);const _0x586837=await withSpinner('Listing\x20workflows...',()=>_0x504142['workflow']['workflows'](_0x3914e5,{'limit':_0x4ae4da[_0x509e44(0x1ce)]}),{'verbose':_0x4ae4da[_0x509e44(0x1a0)]}),_0x5d8eb9=_0x586837[_0x509e44(0x19f)];return console[_0x509e44(0x1d0)](_0x509e44(0x1ea)+_0x5d8eb9[_0x509e44(0x1f4)]+_0x509e44(0x1aa)+(_0x5d8eb9[_0x509e44(0x1f4)]!==0x1?'s':'')),await handleSDKOutput(_0x5d8eb9,_0x4ae4da),0x0;}catch(_0x4d0e72){if(_0x4d0e72 instanceof SDKError)return console[_0x509e44(0x1d0)](_0x509e44(0x1b5)+_0x4d0e72[_0x509e44(0x187)]),_0x4d0e72['cause']&&console['error']('\x20\x20Cause:\x20'+_0x4d0e72['cause']),0x1;throw _0x4d0e72;}}}export class WorkflowSessionsCommand extends BaseCommand{[a43_0xd64fae(0x16b)]=a43_0xd64fae(0x177);['description']=a43_0xd64fae(0x17c);async[a43_0xd64fae(0x1f8)](_0x2eaa5d){const _0x193798=a43_0xd64fae,{options:_0x6e467c,args:_0x4cb7af,tdx:_0xab4a33}=_0x2eaa5d;let _0xbe4238,_0x20df6e;if(_0x4cb7af[0x0]){const _0x365e14=_0x4cb7af[0x0]['split']('.');if(_0x365e14['length']===0x1)_0xbe4238=_0x365e14[0x0];else{if(_0x365e14[_0x193798(0x1f4)]===0x2)[_0xbe4238,_0x20df6e]=_0x365e14;else return console[_0x193798(0x1d0)](_0x193798(0x198)),0x1;}}try{if(_0x6e467c[_0x193798(0x1a0)]){if(_0xbe4238&&_0x20df6e)console['error'](_0x193798(0x18c)+_0xbe4238+'.'+_0x20df6e);else _0xbe4238&&console[_0x193798(0x1d0)](_0x193798(0x160)+_0xbe4238);const _0x52afef=_0x6e467c[_0x193798(0x171)];_0x52afef&&console['error'](_0x193798(0x17e)+_0x52afef);}const _0x260b31=await withSpinner(_0x193798(0x1d4),()=>_0xab4a33[_0x193798(0x1ed)][_0x193798(0x180)]({'projectName':_0xbe4238,'workflowName':_0x20df6e,'status':_0x6e467c[_0x193798(0x171)],'fromTime':_0x6e467c[_0x193798(0x184)],'toTime':_0x6e467c['to'],'limit':_0x6e467c[_0x193798(0x1ce)]}),{'verbose':_0x6e467c[_0x193798(0x1a0)]}),_0x557eb6=_0x260b31[_0x193798(0x19f)];return console[_0x193798(0x1d0)]('✔\x20Found\x20'+_0x557eb6['length']+_0x193798(0x166)+(_0x557eb6[_0x193798(0x1f4)]!==0x1?'s':'')),await handleSDKOutput(_0x557eb6,_0x6e467c),0x0;}catch(_0x4938ff){if(_0x4938ff instanceof SDKError)return console[_0x193798(0x1d0)](_0x193798(0x1b5)+_0x4938ff[_0x193798(0x187)]),_0x4938ff['cause']&&console[_0x193798(0x1d0)](_0x193798(0x16e)+_0x4938ff[_0x193798(0x1d1)]),0x1;throw _0x4938ff;}}}export class WorkflowAttemptsCommand extends BaseCommand{['name']='workflow:attempts';['description']='List\x20workflow\x20attempts';async[a43_0xd64fae(0x1f8)](_0x214c91){const _0x452ea1=a43_0xd64fae,{options:_0x5c3bd0,args:_0x4fd0e8,tdx:_0x1eedfa}=_0x214c91;let _0x32e0b2,_0x39a1fb;if(_0x4fd0e8[0x0]){const _0x2b9436=_0x4fd0e8[0x0][_0x452ea1(0x1f7)]('.');if(_0x2b9436[_0x452ea1(0x1f4)]===0x1)_0x32e0b2=_0x2b9436[0x0];else{if(_0x2b9436['length']===0x2)[_0x32e0b2,_0x39a1fb]=_0x2b9436;else return console[_0x452ea1(0x1d0)]('Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow'),0x1;}}try{const _0x589933=_0x5c3bd0[_0x452ea1(0x1a6)];if(_0x5c3bd0[_0x452ea1(0x1a0)]){if(_0x32e0b2&&_0x39a1fb)console[_0x452ea1(0x1d0)](_0x452ea1(0x18c)+_0x32e0b2+'.'+_0x39a1fb);else _0x32e0b2&&console[_0x452ea1(0x1d0)](_0x452ea1(0x160)+_0x32e0b2);_0x589933&&console[_0x452ea1(0x1d0)](_0x452ea1(0x203));}const _0xb7200b=await withSpinner(_0x452ea1(0x1c0),()=>_0x1eedfa[_0x452ea1(0x1ed)][_0x452ea1(0x1ee)]({'projectName':_0x32e0b2,'workflowName':_0x39a1fb,'includeRetried':_0x589933,'limit':_0x5c3bd0[_0x452ea1(0x1ce)]}),{'verbose':_0x5c3bd0[_0x452ea1(0x1a0)]}),_0xdce5e9=_0xb7200b['data'];return console[_0x452ea1(0x1d0)](_0x452ea1(0x1ea)+_0xdce5e9[_0x452ea1(0x1f4)]+_0x452ea1(0x176)+(_0xdce5e9['length']!==0x1?'s':'')),await handleSDKOutput(_0xdce5e9,_0x5c3bd0),0x0;}catch(_0x63d3aa){if(_0x63d3aa instanceof SDKError)return console[_0x452ea1(0x1d0)](_0x452ea1(0x1b5)+_0x63d3aa[_0x452ea1(0x187)]),_0x63d3aa[_0x452ea1(0x1d1)]&&console[_0x452ea1(0x1d0)](_0x452ea1(0x16e)+_0x63d3aa['cause']),0x1;throw _0x63d3aa;}}}export class WorkflowAttemptCommand extends BaseCommand{[a43_0xd64fae(0x16b)]=a43_0xd64fae(0x15e);[a43_0xd64fae(0x1eb)]=a43_0xd64fae(0x1e2);async[a43_0xd64fae(0x1f8)](_0x1a37f9){const _0x5654a5=a43_0xd64fae,{options:_0x216eda,args:_0xfb19bb,tdx:_0x1ca673}=_0x1a37f9,_0x587640=_0xfb19bb[0x0];if(!_0x587640)return console[_0x5654a5(0x1d0)](_0x5654a5(0x16c)),0x1;try{_0x216eda[_0x5654a5(0x1a0)]&&console[_0x5654a5(0x1d0)]('Attempt\x20ID:\x20'+_0x587640);const _0x142d6d=await withSpinner(_0x5654a5(0x1f6),()=>_0x1ca673['workflow'][_0x5654a5(0x1bc)](_0x587640),{'verbose':_0x216eda[_0x5654a5(0x1a0)]}),_0x5227a4=_0x142d6d['data'];let _0xc8fb96;!_0x5227a4[_0x5654a5(0x1cf)]?_0xc8fb96=_0x5227a4[_0x5654a5(0x1fe)]?_0x5654a5(0x189):_0x5654a5(0x195):_0xc8fb96=_0x5227a4[_0x5654a5(0x1c2)]?_0x5654a5(0x1c2):_0x5654a5(0x1d0);let _0x3d31c1;if(_0x5227a4['createdAt']&&_0x5227a4[_0x5654a5(0x1f9)]){const _0x32fcc5=new Date(_0x5227a4[_0x5654a5(0x17d)])['getTime'](),_0x243c51=new Date(_0x5227a4[_0x5654a5(0x1f9)])[_0x5654a5(0x1a5)]();_0x3d31c1=Math[_0x5654a5(0x1e5)]((_0x243c51-_0x32fcc5)/0x3e8);}const _0x39ab84={'attempt_id':_0x5227a4['id'],'status':_0xc8fb96,..._0x5227a4[_0x5654a5(0x1d7)]!==undefined&&{'index':_0x5227a4[_0x5654a5(0x1d7)]},..._0x5227a4[_0x5654a5(0x1fd)]&&{'project':_0x5227a4[_0x5654a5(0x1fd)][_0x5654a5(0x16b)]},..._0x5227a4[_0x5654a5(0x1ed)]&&{'workflow':_0x5227a4['workflow'][_0x5654a5(0x16b)]},..._0x5227a4[_0x5654a5(0x182)]&&{'session_id':_0x5227a4[_0x5654a5(0x182)]},..._0x5227a4[_0x5654a5(0x18a)]&&{'session_time':_0x5227a4['sessionTime']},..._0x5227a4[_0x5654a5(0x1af)]&&{'retry_attempt':_0x5227a4['retryAttemptName']},..._0x3d31c1!==undefined&&{'duration_sec':_0x3d31c1},..._0x5227a4[_0x5654a5(0x17d)]&&{'created_at':_0x5227a4['createdAt']},..._0x5227a4[_0x5654a5(0x1f9)]&&{'finished_at':_0x5227a4[_0x5654a5(0x1f9)]},...Object[_0x5654a5(0x1d5)](_0x5227a4[_0x5654a5(0x1cb)])[_0x5654a5(0x1f4)]>0x0&&{'params':_0x5227a4['params']}};return await handleSingleObjectOutput(_0x39ab84,_0x216eda),0x0;}catch(_0x5e1e56){if(_0x5e1e56 instanceof SDKError)return console[_0x5654a5(0x1d0)](_0x5654a5(0x1b5)+_0x5e1e56['message']),_0x5e1e56['cause']&&console['error']('\x20\x20Cause:\x20'+_0x5e1e56[_0x5654a5(0x1d1)]),0x1;throw _0x5e1e56;}}}export class WorkflowTasksCommand extends BaseCommand{[a43_0xd64fae(0x16b)]='workflow:tasks';[a43_0xd64fae(0x1eb)]=a43_0xd64fae(0x202);async[a43_0xd64fae(0x1f8)](_0x3b5d04){const _0x123879=a43_0xd64fae,{options:_0x115359,args:_0x2e52b2,tdx:_0x523af4}=_0x3b5d04,_0x569e29=_0x2e52b2[0x0];if(!_0x569e29)return console[_0x123879(0x1d0)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{const _0x36c046=_0x115359[_0x123879(0x192)];_0x115359['verbose']&&(console[_0x123879(0x1d0)](_0x123879(0x18b)+_0x569e29),_0x36c046&&console[_0x123879(0x1d0)](_0x123879(0x18d)));const _0x128c92=await withSpinner(_0x123879(0x1ab),()=>_0x523af4[_0x123879(0x1ed)][_0x123879(0x1de)](_0x569e29,_0x36c046||![]),{'verbose':_0x115359['verbose']}),_0x285d1c=_0x128c92[_0x123879(0x19f)];return console['error'](_0x123879(0x1ea)+_0x285d1c[_0x123879(0x1f4)]+_0x123879(0x16d)+(_0x285d1c[_0x123879(0x1f4)]!==0x1?'s':'')),await handleSDKOutput(_0x285d1c,_0x115359),0x0;}catch(_0x294505){if(_0x294505 instanceof SDKError)return console[_0x123879(0x1d0)](_0x123879(0x1b5)+_0x294505['message']),_0x294505[_0x123879(0x1d1)]&&console['error'](_0x123879(0x16e)+_0x294505[_0x123879(0x1d1)]),0x1;throw _0x294505;}}}export class WorkflowLogsCommand extends BaseCommand{['name']=a43_0xd64fae(0x1b7);[a43_0xd64fae(0x1eb)]=a43_0xd64fae(0x17f);async[a43_0xd64fae(0x1f8)](_0x50ada3){const _0xe7c4c6=a43_0xd64fae,{options:_0x5a764a,args:_0x138b67,tdx:_0x38b848}=_0x50ada3,_0x27c3f9=_0x138b67[0x0];let _0x240de2=_0x138b67[0x1];if(!_0x27c3f9)return console[_0xe7c4c6(0x1d0)](_0xe7c4c6(0x16c)),0x1;try{_0x5a764a['verbose']&&(console[_0xe7c4c6(0x1d0)](_0xe7c4c6(0x18b)+_0x27c3f9),_0x240de2&&console['error'](_0xe7c4c6(0x1e1)+_0x240de2));const _0x59598f=await withSpinner(_0xe7c4c6(0x178),()=>_0x38b848['workflow']['logFiles'](_0x27c3f9,_0x240de2),{'verbose':_0x5a764a['verbose']}),_0x4a37d3=_0x59598f['data'];if(_0x4a37d3[_0xe7c4c6(0x1f4)]===0x0)return console[_0xe7c4c6(0x1d0)](_0xe7c4c6(0x1b4)),0x0;if(!_0x240de2&&(_0x5a764a[_0xe7c4c6(0x15f)]||_0x5a764a[_0xe7c4c6(0x1f0)]))return await handleSDKOutput(_0x4a37d3,_0x5a764a),0x0;if(!_0x240de2){const _0x554d2f=_0x4a37d3[_0xe7c4c6(0x186)](_0x348039=>({'title':_0x348039[_0xe7c4c6(0x1cd)]+'\x20('+formatBytes(_0x348039[_0xe7c4c6(0x1c1)])+')','value':_0x348039[_0xe7c4c6(0x1cd)]})),_0x59da31=await a43_0x2cbd65({'type':_0xe7c4c6(0x1fb),'name':_0xe7c4c6(0x175),'message':_0xe7c4c6(0x205),'choices':_0x554d2f});if(!_0x59da31[_0xe7c4c6(0x175)])return console[_0xe7c4c6(0x1d0)](_0xe7c4c6(0x199)),0x0;_0x240de2=_0x59da31['task'];}const _0x33ceae=await withSpinner(_0xe7c4c6(0x161),()=>_0x38b848[_0xe7c4c6(0x1ed)]['logs'](_0x27c3f9,_0x240de2),{'verbose':_0x5a764a['verbose']}),_0x15a671=_0x33ceae['data'];return _0x15a671?console[_0xe7c4c6(0x18e)](_0x15a671):console['error']('No\x20log\x20content\x20found'),0x0;}catch(_0x323840){if(_0x323840 instanceof SDKError)return console[_0xe7c4c6(0x1d0)]('Error:\x20'+_0x323840[_0xe7c4c6(0x187)]),_0x323840[_0xe7c4c6(0x1d1)]&&console[_0xe7c4c6(0x1d0)](_0xe7c4c6(0x16e)+_0x323840[_0xe7c4c6(0x1d1)]),0x1;throw _0x323840;}}}export class WorkflowKillCommand extends BaseCommand{[a43_0xd64fae(0x16b)]='workflow:kill';['description']=a43_0xd64fae(0x1b6);async[a43_0xd64fae(0x1f8)](_0x57438a){const _0x35e83d=a43_0xd64fae,{options:_0x3005ac,args:_0x41cf55,tdx:_0x4d38ed}=_0x57438a,_0x1da7fc=_0x41cf55[0x0];if(!_0x1da7fc)return console[_0x35e83d(0x1d0)](_0x35e83d(0x16c)),0x1;try{const _0x1e9356=_0x3005ac[_0x35e83d(0x1f1)];_0x3005ac['verbose']&&(console[_0x35e83d(0x1d0)](_0x35e83d(0x18b)+_0x1da7fc),_0x1e9356&&console[_0x35e83d(0x1d0)]('Reason:\x20'+_0x1e9356));if(!_0x3005ac['yes']){const _0x21ec8b=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20'+_0x1da7fc+'?');if(!_0x21ec8b)return console[_0x35e83d(0x1d0)]('Cancelled'),0x0;}const _0x5ab083=await withSpinner(_0x35e83d(0x1b2),()=>_0x4d38ed[_0x35e83d(0x1ed)][_0x35e83d(0x200)](_0x1da7fc,_0x1e9356),{'verbose':_0x3005ac[_0x35e83d(0x1a0)]}),_0x593a69=_0x5ab083['data'];return console[_0x35e83d(0x1d0)]('✔\x20'+_0x593a69),0x0;}catch(_0x12999b){if(_0x12999b instanceof SDKError)return console[_0x35e83d(0x1d0)](_0x35e83d(0x1b5)+_0x12999b[_0x35e83d(0x187)]),_0x12999b['cause']&&console[_0x35e83d(0x1d0)]('\x20\x20Cause:\x20'+_0x12999b[_0x35e83d(0x1d1)]),0x1;throw _0x12999b;}}}export class WorkflowRetryCommand extends BaseCommand{[a43_0xd64fae(0x16b)]=a43_0xd64fae(0x1e6);['description']=a43_0xd64fae(0x1bf);async[a43_0xd64fae(0x1f8)](_0x294b3a){const _0x2d5d8b=a43_0xd64fae,{options:_0x335b19,args:_0x337aa4,tdx:_0x12f073}=_0x294b3a,_0x322cbf=_0x337aa4[0x0];if(!_0x322cbf)return console[_0x2d5d8b(0x1d0)](_0x2d5d8b(0x164)),console[_0x2d5d8b(0x1d0)]('Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>'),0x1;let _0x4487a8=![],_0x22295a=_0x322cbf;if(_0x322cbf[_0x2d5d8b(0x1cc)](_0x2d5d8b(0x1ad)))_0x4487a8=!![],_0x22295a=_0x322cbf['substring'](0x8);else{if(_0x322cbf['startsWith']('attempt:'))_0x4487a8=![],_0x22295a=_0x322cbf[_0x2d5d8b(0x16a)](0x8);else return console[_0x2d5d8b(0x1d0)](_0x2d5d8b(0x1c5)),console[_0x2d5d8b(0x1d0)](_0x2d5d8b(0x174)),0x1;}try{const _0xe35922=_0x335b19[_0x2d5d8b(0x19e)],_0x2d110c=_0x335b19[_0x2d5d8b(0x1b8)],_0x3fc46e=_0x335b19[_0x2d5d8b(0x1cb)],_0x4f6fd4=_0x335b19[_0x2d5d8b(0x19d)];_0x335b19[_0x2d5d8b(0x1a0)]&&(console[_0x2d5d8b(0x1d0)](_0x2d5d8b(0x206)+(_0x4487a8?_0x2d5d8b(0x1a8):_0x2d5d8b(0x1bc))+'\x20'+_0x22295a),_0xe35922&&console['error'](_0x2d5d8b(0x1e9)+_0xe35922),_0x2d110c&&console['error'](_0x2d5d8b(0x165)+_0x2d110c),_0x3fc46e&&console[_0x2d5d8b(0x1d0)](_0x2d5d8b(0x1c8)+_0x3fc46e),_0x4f6fd4&&console[_0x2d5d8b(0x1d0)]('Force:\x20yes'));let _0x626d20;if(_0x3fc46e)try{if(_0x3fc46e[_0x2d5d8b(0x1cc)]('@')){const _0x48f119=await import(_0x2d5d8b(0x16f)),_0x11d956=_0x3fc46e[_0x2d5d8b(0x16a)](0x1),_0x1a3fa3=await _0x48f119[_0x2d5d8b(0x17b)](_0x11d956,_0x2d5d8b(0x15d));_0x626d20=JSON[_0x2d5d8b(0x1ae)](_0x1a3fa3);}else _0x626d20=JSON[_0x2d5d8b(0x1ae)](_0x3fc46e);}catch{return console[_0x2d5d8b(0x1d0)](_0x2d5d8b(0x188)),0x1;}if(!_0x335b19['yes']){const _0x343e3b=await confirm(_0x2d5d8b(0x1a2)+(_0x4487a8?_0x2d5d8b(0x1a8):_0x2d5d8b(0x1bc))+'\x20'+_0x22295a+'?');if(!_0x343e3b)return console[_0x2d5d8b(0x1d0)](_0x2d5d8b(0x199)),0x0;}let _0x5e32b1;_0x4487a8?_0x5e32b1=await withSpinner('Retrying\x20session...',()=>_0x12f073['workflow'][_0x2d5d8b(0x1c6)](_0x22295a,{'fromTask':_0xe35922,'retryParams':_0x626d20}),{'verbose':_0x335b19['verbose']}):_0x5e32b1=await withSpinner(_0x2d5d8b(0x191),()=>_0x12f073['workflow'][_0x2d5d8b(0x1f3)](_0x22295a,{'resumeFrom':_0x2d110c,'retryParams':_0x626d20,'force':_0x4f6fd4}),{'verbose':_0x335b19[_0x2d5d8b(0x1a0)]});const _0x59e021=_0x5e32b1[_0x2d5d8b(0x19f)];return console[_0x2d5d8b(0x1d0)](_0x2d5d8b(0x1d8)),console['error']('\x20\x20New\x20attempt\x20ID:\x20'+_0x59e021[_0x2d5d8b(0x1a1)]),console['error'](_0x2d5d8b(0x168)+_0x59e021[_0x2d5d8b(0x182)]),0x0;}catch(_0x15b5d1){if(_0x15b5d1 instanceof SDKError)return console[_0x2d5d8b(0x1d0)](_0x2d5d8b(0x1b5)+_0x15b5d1['message']),_0x15b5d1[_0x2d5d8b(0x1d1)]&&console[_0x2d5d8b(0x1d0)]('\x20\x20Cause:\x20'+_0x15b5d1['cause']),0x1;throw _0x15b5d1;}}}export class WorkflowRunCommand extends BaseCommand{[a43_0xd64fae(0x16b)]='workflow:run';[a43_0xd64fae(0x1eb)]=a43_0xd64fae(0x1e3);async[a43_0xd64fae(0x1f8)](_0x122447){const _0x50404a=a43_0xd64fae,{options:_0x28ee8b,args:_0x468570,tdx:_0x224599}=_0x122447,_0xc3e227=_0x468570[0x0];if(!_0xc3e227)return console[_0x50404a(0x1d0)](_0x50404a(0x1d2)),console[_0x50404a(0x1d0)](_0x50404a(0x1d6)),0x1;const _0x37e3d7=_0x28ee8b[_0x50404a(0x1b1)],_0x2a77c6=_0x28ee8b[_0x50404a(0x18a)],_0x392620={};if(_0x37e3d7&&Array[_0x50404a(0x204)](_0x37e3d7))for(const _0x461237 of _0x37e3d7){const _0x1e4db1=_0x461237[_0x50404a(0x1e4)]('=');if(_0x1e4db1===-0x1)return console['error'](_0x50404a(0x1f2)+_0x461237),console[_0x50404a(0x1d0)](_0x50404a(0x17a)),0x1;const _0x23d32a=_0x461237[_0x50404a(0x16a)](0x0,_0x1e4db1),_0x379461=_0x461237[_0x50404a(0x16a)](_0x1e4db1+0x1);try{_0x392620[_0x23d32a]=JSON[_0x50404a(0x1ae)](_0x379461);}catch{_0x392620[_0x23d32a]=_0x379461;}}_0x28ee8b[_0x50404a(0x1a0)]&&(console[_0x50404a(0x1d0)](_0x50404a(0x1b3)+_0xc3e227),Object[_0x50404a(0x1d5)](_0x392620)['length']>0x0&&console[_0x50404a(0x1d0)](_0x50404a(0x1ba)+JSON[_0x50404a(0x179)](_0x392620)),_0x2a77c6&&console[_0x50404a(0x1d0)](_0x50404a(0x19c)+_0x2a77c6));const _0x95ec09=await withSpinner(_0x50404a(0x197),()=>_0x224599[_0x50404a(0x1ed)][_0x50404a(0x1e7)](_0xc3e227,_0x392620,{'sessionTime':_0x2a77c6}),{'verbose':_0x28ee8b[_0x50404a(0x1a0)]}),_0x56802b=_0x95ec09[_0x50404a(0x19f)];return console[_0x50404a(0x1d0)](_0x50404a(0x1d9)),console[_0x50404a(0x1d0)](_0x50404a(0x1dc)+_0x56802b['id']),console[_0x50404a(0x1d0)](_0x50404a(0x168)+_0x56802b['sessionId']),console[_0x50404a(0x1d0)](_0x50404a(0x1d3)+_0x56802b[_0x50404a(0x1fd)]?.[_0x50404a(0x16b)]),console['error']('\x20\x20Workflow:\x20'+_0x56802b[_0x50404a(0x1ed)]?.[_0x50404a(0x16b)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{[a43_0xd64fae(0x16b)]='workflow:download';['description']=a43_0xd64fae(0x1ec);async['execute'](_0x1d97df){const _0x4878a7=a43_0xd64fae,{options:_0x3371e1,args:_0x4c101f,tdx:_0x5595c6}=_0x1d97df,_0xa237d4=_0x4c101f[0x0],_0x4e4d0d=_0x4c101f[0x1]||'.';if(!_0xa237d4)return console[_0x4878a7(0x1d0)]('Error:\x20Project\x20name\x20is\x20required'),console[_0x4878a7(0x1d0)]('Usage:\x20workflow:download\x20<project-name>\x20[output-dir]'),0x1;const _0x4eea74=_0x3371e1[_0x4878a7(0x1c9)];_0x3371e1[_0x4878a7(0x1a0)]&&(console[_0x4878a7(0x1d0)]('Project:\x20'+_0xa237d4),console[_0x4878a7(0x1d0)]('Output\x20directory:\x20'+_0x4e4d0d),_0x4eea74&&console[_0x4878a7(0x1d0)](_0x4878a7(0x1e0)+_0x4eea74));const _0x50e9c2=await withSpinner(_0x4878a7(0x201)+_0xa237d4+'...',()=>_0x5595c6['workflow'][_0x4878a7(0x172)](_0xa237d4,_0x4e4d0d,{'revision':_0x4eea74}),{'verbose':_0x3371e1['verbose']}),_0x3d5707=_0x50e9c2[_0x4878a7(0x19f)];return console[_0x4878a7(0x1d0)](_0x4878a7(0x194)+_0x3d5707['projectName']),console['error'](_0x4878a7(0x1bd)+_0x3d5707[_0x4878a7(0x1c9)]),console[_0x4878a7(0x1d0)](_0x4878a7(0x1f5)+_0x3d5707[_0x4878a7(0x1b9)]),console[_0x4878a7(0x1d0)]('\x20\x20Location:\x20'+_0x4e4d0d+'/'+_0x3d5707[_0x4878a7(0x169)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{['name']='workflow:push';[a43_0xd64fae(0x1eb)]=a43_0xd64fae(0x183);async[a43_0xd64fae(0x1f8)](_0x1a15d6){const _0x500f0a=a43_0xd64fae,{options:_0x17e89f,args:_0x522136,tdx:_0xb84679}=_0x1a15d6;let _0x42e7b2='.',_0x38fafa=_0x17e89f[_0x500f0a(0x16b)];if(_0x522136[0x0]){const {promises:_0x4a26b0}=await import('fs');try{const _0x5e1d92=await _0x4a26b0[_0x500f0a(0x1ef)](_0x522136[0x0]);if(_0x5e1d92[_0x500f0a(0x1a7)]())_0x42e7b2=_0x522136[0x0];else return console[_0x500f0a(0x1d0)](_0x500f0a(0x1b5)+_0x522136[0x0]+_0x500f0a(0x1fa)),0x1;}catch{_0x38fafa=_0x522136[0x0],_0x42e7b2='.';}}const _0x2b7f11=_0x17e89f[_0x500f0a(0x1c9)],_0x5a8107=_0x17e89f[_0x500f0a(0x19b)];_0x17e89f[_0x500f0a(0x1a0)]&&(console['error']('Project\x20directory:\x20'+_0x42e7b2),_0x38fafa&&console[_0x500f0a(0x1d0)](_0x500f0a(0x1a3)+_0x38fafa),_0x2b7f11&&console['error']('Revision:\x20'+_0x2b7f11),_0x5a8107&&console['error'](_0x500f0a(0x18f)));const _0x46152a=await withSpinner(_0x500f0a(0x1bb),()=>_0xb84679[_0x500f0a(0x1ed)]['push'](_0x42e7b2,{'projectName':_0x38fafa,'revision':_0x2b7f11,'skipValidation':_0x5a8107}),{'verbose':_0x17e89f['verbose']}),_0x2e7d2e=_0x46152a['data'];return console[_0x500f0a(0x1d0)](_0x500f0a(0x1b0)+_0x2e7d2e[_0x500f0a(0x169)]),console[_0x500f0a(0x1d0)]('\x20\x20Project\x20ID:\x20'+_0x2e7d2e[_0x500f0a(0x163)]),console[_0x500f0a(0x1d0)](_0x500f0a(0x1bd)+_0x2e7d2e['revision']),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{['name']='workflow:delete';[a43_0xd64fae(0x1eb)]='Delete\x20workflow\x20project\x20from\x20Treasure\x20Data';async[a43_0xd64fae(0x1f8)](_0x3ad4b4){const _0x57a78f=a43_0xd64fae,{options:_0x576f9a,args:_0x5a22a6,tdx:_0x3beb06}=_0x3ad4b4,_0xaf1f3c=_0x5a22a6[0x0];if(!_0xaf1f3c)return console[_0x57a78f(0x1d0)](_0x57a78f(0x193)),console[_0x57a78f(0x1d0)]('Usage:\x20workflow:delete\x20<project-name-or-id>'),0x1;_0x576f9a[_0x57a78f(0x1a0)]&&console[_0x57a78f(0x1d0)](_0x57a78f(0x1e8)+_0xaf1f3c);if(!_0x576f9a[_0x57a78f(0x1c3)]){const _0x197b47=await confirm(_0x57a78f(0x173)+_0xaf1f3c+_0x57a78f(0x1da));if(!_0x197b47)return console[_0x57a78f(0x1d0)](_0x57a78f(0x199)),0x0;}const _0x312001=await withSpinner(_0x57a78f(0x181)+_0xaf1f3c+_0x57a78f(0x1be),()=>_0x3beb06['workflow'][_0x57a78f(0x190)](_0xaf1f3c),{'verbose':_0x576f9a[_0x57a78f(0x1a0)]}),_0x2e3f4b=_0x312001['data'];return console[_0x57a78f(0x1d0)]('✔\x20Deleted\x20project\x20'+_0x2e3f4b[_0x57a78f(0x169)]),console[_0x57a78f(0x1d0)](_0x57a78f(0x167)+_0x2e3f4b[_0x57a78f(0x163)]),0x0;}}
|
|
1
|
+
const a43_0x144bdc=a43_0x256d;function a43_0x256d(_0x5263e5,_0x149b6d){_0x5263e5=_0x5263e5-0x1ef;const _0x1df1ef=a43_0x1df1();let _0x256d13=_0x1df1ef[_0x5263e5];return _0x256d13;}(function(_0x23e884,_0x4d2b9f){const _0x42526c=a43_0x256d,_0x2e758a=_0x23e884();while(!![]){try{const _0x31115c=-parseInt(_0x42526c(0x23b))/0x1*(parseInt(_0x42526c(0x282))/0x2)+parseInt(_0x42526c(0x215))/0x3*(-parseInt(_0x42526c(0x23f))/0x4)+parseInt(_0x42526c(0x263))/0x5+parseInt(_0x42526c(0x255))/0x6*(parseInt(_0x42526c(0x235))/0x7)+parseInt(_0x42526c(0x230))/0x8+parseInt(_0x42526c(0x287))/0x9+-parseInt(_0x42526c(0x269))/0xa;if(_0x31115c===_0x4d2b9f)break;else _0x2e758a['push'](_0x2e758a['shift']());}catch(_0x55b868){_0x2e758a['push'](_0x2e758a['shift']());}}}(a43_0x1df1,0x66da4));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{formatBytes}from'../utils/formatters.js';import a43_0x46b35f from'prompts';export class WorkflowProjectsCommand extends BaseCommand{[a43_0x144bdc(0x242)]='workflow:projects';[a43_0x144bdc(0x22d)]=a43_0x144bdc(0x22b);async[a43_0x144bdc(0x21b)](_0x2858bb){const _0x45fcde=a43_0x144bdc,{options:_0x2762cd,args:_0x2b5bdd,tdx:_0x42878f}=_0x2858bb,_0x20b9d5=_0x2b5bdd[0x0];try{_0x2762cd[_0x45fcde(0x231)]&&_0x20b9d5&&console['error'](_0x45fcde(0x254)+_0x20b9d5);const _0x4adff0=await withSpinner(_0x45fcde(0x226),()=>_0x42878f[_0x45fcde(0x207)][_0x45fcde(0x201)](_0x20b9d5,{'limit':_0x2762cd[_0x45fcde(0x229)]}),{'verbose':_0x2762cd[_0x45fcde(0x231)]}),_0x3e1079=_0x4adff0[_0x45fcde(0x277)];return console['error'](_0x45fcde(0x249)+_0x3e1079[_0x45fcde(0x23e)]+_0x45fcde(0x232)+(_0x3e1079[_0x45fcde(0x23e)]!==0x1?'s':'')),await handleSDKOutput(_0x3e1079,_0x2762cd),0x0;}catch(_0x2aabca){if(_0x2aabca instanceof SDKError)return console[_0x45fcde(0x22a)](_0x45fcde(0x1f4)+_0x2aabca[_0x45fcde(0x252)]),_0x2aabca['cause']&&console['error'](_0x45fcde(0x1fd)+_0x2aabca[_0x45fcde(0x259)]),0x1;throw _0x2aabca;}}}export class WorkflowWorkflowsCommand extends BaseCommand{[a43_0x144bdc(0x242)]=a43_0x144bdc(0x20e);[a43_0x144bdc(0x22d)]=a43_0x144bdc(0x274);async[a43_0x144bdc(0x21b)](_0x30efa3){const _0x9a16e3=a43_0x144bdc,{options:_0xd030f1,args:_0x3179df,tdx:_0x4bd7e6}=_0x30efa3,_0x26903f=_0x3179df[0x0];try{_0xd030f1['verbose']&&_0x26903f&&console[_0x9a16e3(0x22a)]('Project\x20filter:\x20'+_0x26903f);const _0x3ba67d=await withSpinner('Listing\x20workflows...',()=>_0x4bd7e6[_0x9a16e3(0x207)][_0x9a16e3(0x26a)](_0x26903f,{'limit':_0xd030f1[_0x9a16e3(0x229)]}),{'verbose':_0xd030f1[_0x9a16e3(0x231)]}),_0x43f2c4=_0x3ba67d[_0x9a16e3(0x277)];return console['error'](_0x9a16e3(0x249)+_0x43f2c4[_0x9a16e3(0x23e)]+_0x9a16e3(0x218)+(_0x43f2c4[_0x9a16e3(0x23e)]!==0x1?'s':'')),await handleSDKOutput(_0x43f2c4,_0xd030f1),0x0;}catch(_0x3adfb1){if(_0x3adfb1 instanceof SDKError)return console[_0x9a16e3(0x22a)](_0x9a16e3(0x1f4)+_0x3adfb1[_0x9a16e3(0x252)]),_0x3adfb1[_0x9a16e3(0x259)]&&console[_0x9a16e3(0x22a)]('\x20\x20Cause:\x20'+_0x3adfb1['cause']),0x1;throw _0x3adfb1;}}}export class WorkflowSessionsCommand extends BaseCommand{['name']='workflow:sessions';['description']='List\x20workflow\x20execution\x20sessions';async['execute'](_0x8ca84b){const _0x2aab9d=a43_0x144bdc,{options:_0x41c6fe,args:_0x4d5c37,tdx:_0x872b65}=_0x8ca84b;let _0x7f4f95,_0x1fb23d;if(_0x4d5c37[0x0]){const _0x40975b=_0x4d5c37[0x0]['split']('.');if(_0x40975b['length']===0x1)_0x7f4f95=_0x40975b[0x0];else{if(_0x40975b['length']===0x2)[_0x7f4f95,_0x1fb23d]=_0x40975b;else return console[_0x2aab9d(0x22a)](_0x2aab9d(0x220)),0x1;}}try{if(_0x41c6fe[_0x2aab9d(0x231)]){if(_0x7f4f95&&_0x1fb23d)console[_0x2aab9d(0x22a)](_0x2aab9d(0x246)+_0x7f4f95+'.'+_0x1fb23d);else _0x7f4f95&&console[_0x2aab9d(0x22a)](_0x2aab9d(0x210)+_0x7f4f95);const _0x4d1218=_0x41c6fe[_0x2aab9d(0x291)];_0x4d1218&&console[_0x2aab9d(0x22a)]('Status:\x20'+_0x4d1218);}const _0x581551=await withSpinner(_0x2aab9d(0x24b),()=>_0x872b65[_0x2aab9d(0x207)][_0x2aab9d(0x21e)]({'projectName':_0x7f4f95,'workflowName':_0x1fb23d,'status':_0x41c6fe[_0x2aab9d(0x291)],'fromTime':_0x41c6fe[_0x2aab9d(0x266)],'toTime':_0x41c6fe['to'],'limit':_0x41c6fe[_0x2aab9d(0x229)]}),{'verbose':_0x41c6fe['verbose']}),_0x2057db=_0x581551[_0x2aab9d(0x277)];return console[_0x2aab9d(0x22a)](_0x2aab9d(0x249)+_0x2057db['length']+'\x20session'+(_0x2057db[_0x2aab9d(0x23e)]!==0x1?'s':'')),await handleSDKOutput(_0x2057db,_0x41c6fe),0x0;}catch(_0x5f2303){if(_0x5f2303 instanceof SDKError)return console[_0x2aab9d(0x22a)](_0x2aab9d(0x1f4)+_0x5f2303[_0x2aab9d(0x252)]),_0x5f2303['cause']&&console[_0x2aab9d(0x22a)](_0x2aab9d(0x1fd)+_0x5f2303[_0x2aab9d(0x259)]),0x1;throw _0x5f2303;}}}export class WorkflowAttemptsCommand extends BaseCommand{['name']=a43_0x144bdc(0x260);['description']=a43_0x144bdc(0x203);async[a43_0x144bdc(0x21b)](_0x246b51){const _0x380c8b=a43_0x144bdc,{options:_0x487af8,args:_0x4e8eb2,tdx:_0x216500}=_0x246b51;let _0x1212ed,_0x43108a;if(_0x4e8eb2[0x0]){const _0x20db43=_0x4e8eb2[0x0]['split']('.');if(_0x20db43['length']===0x1)_0x1212ed=_0x20db43[0x0];else{if(_0x20db43[_0x380c8b(0x23e)]===0x2)[_0x1212ed,_0x43108a]=_0x20db43;else return console[_0x380c8b(0x22a)]('Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow'),0x1;}}try{const _0x5571cc=_0x487af8[_0x380c8b(0x286)];if(_0x487af8[_0x380c8b(0x231)]){if(_0x1212ed&&_0x43108a)console[_0x380c8b(0x22a)](_0x380c8b(0x246)+_0x1212ed+'.'+_0x43108a);else _0x1212ed&&console[_0x380c8b(0x22a)](_0x380c8b(0x210)+_0x1212ed);_0x5571cc&&console[_0x380c8b(0x22a)]('Include\x20retried:\x20yes');}const _0x554233=await withSpinner(_0x380c8b(0x212),()=>_0x216500[_0x380c8b(0x207)][_0x380c8b(0x1ef)]({'projectName':_0x1212ed,'workflowName':_0x43108a,'includeRetried':_0x5571cc,'limit':_0x487af8[_0x380c8b(0x229)]}),{'verbose':_0x487af8[_0x380c8b(0x231)]}),_0x563da2=_0x554233[_0x380c8b(0x277)];return console[_0x380c8b(0x22a)]('✔\x20Found\x20'+_0x563da2[_0x380c8b(0x23e)]+'\x20attempt'+(_0x563da2['length']!==0x1?'s':'')),await handleSDKOutput(_0x563da2,_0x487af8),0x0;}catch(_0x4a4590){if(_0x4a4590 instanceof SDKError)return console[_0x380c8b(0x22a)](_0x380c8b(0x1f4)+_0x4a4590[_0x380c8b(0x252)]),_0x4a4590[_0x380c8b(0x259)]&&console[_0x380c8b(0x22a)](_0x380c8b(0x1fd)+_0x4a4590[_0x380c8b(0x259)]),0x1;throw _0x4a4590;}}}export class WorkflowAttemptCommand extends BaseCommand{[a43_0x144bdc(0x242)]=a43_0x144bdc(0x23d);[a43_0x144bdc(0x22d)]=a43_0x144bdc(0x23a);async[a43_0x144bdc(0x21b)](_0x4223a1){const _0x28aa4f=a43_0x144bdc,{options:_0xfaf4ef,args:_0x10f26a,tdx:_0x132d67}=_0x4223a1,_0x268a3e=_0x10f26a[0x0];if(!_0x268a3e)return console['error'](_0x28aa4f(0x1f5)),0x1;try{_0xfaf4ef[_0x28aa4f(0x231)]&&console[_0x28aa4f(0x22a)](_0x28aa4f(0x20f)+_0x268a3e);const _0x5da75d=await withSpinner(_0x28aa4f(0x26b),()=>_0x132d67[_0x28aa4f(0x207)][_0x28aa4f(0x238)](_0x268a3e),{'verbose':_0xfaf4ef[_0x28aa4f(0x231)]}),_0x34a82f=_0x5da75d[_0x28aa4f(0x277)];let _0x51753f;!_0x34a82f[_0x28aa4f(0x271)]?_0x51753f=_0x34a82f[_0x28aa4f(0x27d)]?_0x28aa4f(0x27e):'running':_0x51753f=_0x34a82f[_0x28aa4f(0x26e)]?'success':_0x28aa4f(0x22a);let _0x288d25;if(_0x34a82f[_0x28aa4f(0x272)]&&_0x34a82f[_0x28aa4f(0x22c)]){const _0x1e7029=new Date(_0x34a82f[_0x28aa4f(0x272)])[_0x28aa4f(0x213)](),_0x141df0=new Date(_0x34a82f[_0x28aa4f(0x22c)])[_0x28aa4f(0x213)]();_0x288d25=Math[_0x28aa4f(0x22e)]((_0x141df0-_0x1e7029)/0x3e8);}const _0x52de7a={'attempt_id':_0x34a82f['id'],'status':_0x51753f,..._0x34a82f['index']!==undefined&&{'index':_0x34a82f[_0x28aa4f(0x264)]},..._0x34a82f['project']&&{'project':_0x34a82f['project'][_0x28aa4f(0x242)]},..._0x34a82f['workflow']&&{'workflow':_0x34a82f['workflow']['name']},..._0x34a82f['sessionId']&&{'session_id':_0x34a82f[_0x28aa4f(0x273)]},..._0x34a82f[_0x28aa4f(0x221)]&&{'session_time':_0x34a82f['sessionTime']},..._0x34a82f[_0x28aa4f(0x20c)]&&{'retry_attempt':_0x34a82f[_0x28aa4f(0x20c)]},..._0x288d25!==undefined&&{'duration_sec':_0x288d25},..._0x34a82f[_0x28aa4f(0x272)]&&{'created_at':_0x34a82f[_0x28aa4f(0x272)]},..._0x34a82f[_0x28aa4f(0x22c)]&&{'finished_at':_0x34a82f[_0x28aa4f(0x22c)]},...Object[_0x28aa4f(0x240)](_0x34a82f[_0x28aa4f(0x28d)])[_0x28aa4f(0x23e)]>0x0&&{'params':_0x34a82f[_0x28aa4f(0x28d)]}};return await handleSingleObjectOutput(_0x52de7a,_0xfaf4ef),0x0;}catch(_0x2d5e33){if(_0x2d5e33 instanceof SDKError)return console['error'](_0x28aa4f(0x1f4)+_0x2d5e33['message']),_0x2d5e33[_0x28aa4f(0x259)]&&console['error'](_0x28aa4f(0x1fd)+_0x2d5e33[_0x28aa4f(0x259)]),0x1;throw _0x2d5e33;}}}export class WorkflowTasksCommand extends BaseCommand{[a43_0x144bdc(0x242)]='workflow:tasks';[a43_0x144bdc(0x22d)]='Show\x20tasks\x20for\x20an\x20attempt';async[a43_0x144bdc(0x21b)](_0x107023){const _0x441379=a43_0x144bdc,{options:_0x2e0734,args:_0x27b625,tdx:_0x39aef9}=_0x107023,_0x12bd89=_0x27b625[0x0];if(!_0x12bd89)return console[_0x441379(0x22a)](_0x441379(0x1f5)),0x1;try{const _0x55b654=_0x2e0734[_0x441379(0x200)];_0x2e0734['verbose']&&(console[_0x441379(0x22a)](_0x441379(0x20f)+_0x12bd89),_0x55b654&&console[_0x441379(0x22a)](_0x441379(0x211)));const _0xe73a97=await withSpinner(_0x441379(0x224),()=>_0x39aef9[_0x441379(0x207)][_0x441379(0x261)](_0x12bd89,_0x55b654||![]),{'verbose':_0x2e0734[_0x441379(0x231)]}),_0xb840b3=_0xe73a97[_0x441379(0x277)];return console[_0x441379(0x22a)]('✔\x20Found\x20'+_0xb840b3['length']+'\x20task'+(_0xb840b3['length']!==0x1?'s':'')),await handleSDKOutput(_0xb840b3,_0x2e0734),0x0;}catch(_0x57151c){if(_0x57151c instanceof SDKError)return console['error']('Error:\x20'+_0x57151c[_0x441379(0x252)]),_0x57151c['cause']&&console[_0x441379(0x22a)](_0x441379(0x1fd)+_0x57151c['cause']),0x1;throw _0x57151c;}}}export class WorkflowLogsCommand extends BaseCommand{[a43_0x144bdc(0x242)]='workflow:logs';[a43_0x144bdc(0x22d)]='Show\x20logs\x20for\x20a\x20workflow\x20attempt';async[a43_0x144bdc(0x21b)](_0x29532f){const _0xd9c472=a43_0x144bdc,{options:_0x4f2860,args:_0x36ceb4,tdx:_0x16bf8f}=_0x29532f,_0x3c7a68=_0x36ceb4[0x0];let _0x465612=_0x36ceb4[0x1];if(!_0x3c7a68)return console['error'](_0xd9c472(0x1f5)),0x1;try{_0x4f2860[_0xd9c472(0x231)]&&(console[_0xd9c472(0x22a)](_0xd9c472(0x20f)+_0x3c7a68),_0x465612&&console[_0xd9c472(0x22a)](_0xd9c472(0x26c)+_0x465612));const _0x51e977=await withSpinner(_0xd9c472(0x24a),()=>_0x16bf8f[_0xd9c472(0x207)]['logFiles'](_0x3c7a68,_0x465612),{'verbose':_0x4f2860[_0xd9c472(0x231)]}),_0xfb8179=_0x51e977['data'];if(_0xfb8179[_0xd9c472(0x23e)]===0x0)return console[_0xd9c472(0x22a)]('No\x20log\x20files\x20found\x20for\x20this\x20attempt'),0x0;if(!_0x465612&&(_0x4f2860['json']||_0x4f2860[_0xd9c472(0x25b)]))return await handleSDKOutput(_0xfb8179,_0x4f2860),0x0;if(!_0x465612){const _0x357edf=_0xfb8179[_0xd9c472(0x285)](_0x238180=>({'title':_0x238180[_0xd9c472(0x1f2)]+'\x20('+formatBytes(_0x238180['fileSize'])+')','value':_0x238180[_0xd9c472(0x1f2)]})),_0x293922=await a43_0x46b35f({'type':_0xd9c472(0x28c),'name':_0xd9c472(0x250),'message':_0xd9c472(0x258),'choices':_0x357edf});if(!_0x293922[_0xd9c472(0x250)])return console['error'](_0xd9c472(0x28a)),0x0;_0x465612=_0x293922[_0xd9c472(0x250)];}const _0x41ae1d=await withSpinner(_0xd9c472(0x268),()=>_0x16bf8f[_0xd9c472(0x207)][_0xd9c472(0x216)](_0x3c7a68,_0x465612),{'verbose':_0x4f2860['verbose']}),_0x18775b=_0x41ae1d['data'];return _0x18775b?console[_0xd9c472(0x1f9)](_0x18775b):console[_0xd9c472(0x22a)](_0xd9c472(0x1f1)),0x0;}catch(_0x168642){if(_0x168642 instanceof SDKError)return console[_0xd9c472(0x22a)](_0xd9c472(0x1f4)+_0x168642[_0xd9c472(0x252)]),_0x168642[_0xd9c472(0x259)]&&console[_0xd9c472(0x22a)](_0xd9c472(0x1fd)+_0x168642[_0xd9c472(0x259)]),0x1;throw _0x168642;}}}function a43_0x1df1(){const _0x3fbb5a=['Show\x20specific\x20attempt\x20details','7149OYSAkU','workflow:kill','workflow:attempt','length','92vyzuJu','keys','yes','name','Params:\x20','revision','\x20\x20Location:\x20','Filter:\x20','Project\x20directory:\x20','isArray','✔\x20Found\x20','Fetching\x20log\x20files...','Listing\x20workflow\x20sessions...','attemptId','parse','✔\x20Retry\x20started','reason','task','Parameters:\x20','message','force','Pattern:\x20','178278lAUBha','\x20\x20Project\x20ID:\x20','Starting\x20workflow\x20run...','Select\x20a\x20task\x20to\x20view\x20logs:','cause','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','format','\x20\x20Workflow:\x20','run','✔\x20Downloaded\x20','workflow:run','workflow:attempts','tasks','indexOf','2979420qdXFEk','index','Validation:\x20skipped','from','\x20\x20New\x20attempt\x20ID:\x20','Downloading\x20logs...','7434500fIBfMP','workflows','Getting\x20attempt\x20details...','Task\x20name:\x20','Workflow:\x20','success','✔\x20Pushed\x20','Error:\x20Workflow\x20identifier\x20is\x20required','done','createdAt','sessionId','List\x20workflows','\x20\x20Revision:\x20','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','data','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','Force:\x20yes','From\x20task:\x20','stat','skipValidation','cancelRequested','canceling','filesExtracted','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','Error:\x20Invalid\x20parameter\x20format:\x20','188tkbbso','...','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','map','includeRetried','4402953upIiFb','Project:\x20','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','Cancelled','param','select','params','Retrying\x20attempt...','session','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','status','readFile','projectName','attempts','\x20\x20Files\x20extracted:\x20','No\x20log\x20content\x20found','taskName','Deleting\x20project\x20','Error:\x20','Error:\x20Attempt\x20ID\x20is\x20required','substring','Error:\x20Project\x20name\x20is\x20required','Usage:\x20workflow:delete\x20<project-name-or-id>','log','Resume\x20from:\x20','retryAttempt','Output\x20directory:\x20','\x20\x20Cause:\x20','delete','projectId','includeSubtasks','projects','workflow:download','List\x20workflow\x20attempts','Reason:\x20','startsWith','project','workflow','Revision:\x20','Retrying\x20session...','attempt:','\x20\x20Attempt\x20ID:\x20','retryAttemptName','\x22?\x20This\x20cannot\x20be\x20undone.','workflow:workflows','Attempt\x20ID:\x20','Filter:\x20project=','Including\x20subtasks:\x20yes','Listing\x20workflow\x20attempts...','getTime','session:','6954ruGvmS','logs','stringify','\x20workflow','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','Error:\x20Invalid\x20JSON\x20in\x20--params','execute','Start\x20a\x20workflow\x20run','\x20\x20Project:\x20','sessions','Project\x20name:\x20','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','sessionTime','\x20\x20Session\x20ID:\x20','fromTask','Getting\x20attempt\x20tasks...','Killing\x20attempt...','Listing\x20workflow\x20projects...','Kill\x20a\x20running\x20attempt','Expected\x20format:\x20--param\x20key=value','limit','error','List\x20all\x20workflow\x20projects','finishedAt','description','round','kill','5251104ACFOcF','verbose','\x20project','isDirectory','Session\x20time:\x20','35epkFPu','Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]','Target:\x20','attempt','Pushing\x20workflow\x20project...'];a43_0x1df1=function(){return _0x3fbb5a;};return a43_0x1df1();}export class WorkflowKillCommand extends BaseCommand{[a43_0x144bdc(0x242)]=a43_0x144bdc(0x23c);['description']=a43_0x144bdc(0x227);async['execute'](_0x5e8038){const _0x70c6c2=a43_0x144bdc,{options:_0x5b1128,args:_0x472f5a,tdx:_0xcbc343}=_0x5e8038,_0x410651=_0x472f5a[0x0];if(!_0x410651)return console[_0x70c6c2(0x22a)](_0x70c6c2(0x1f5)),0x1;try{const _0x5b5921=_0x5b1128[_0x70c6c2(0x24f)];_0x5b1128[_0x70c6c2(0x231)]&&(console[_0x70c6c2(0x22a)]('Attempt\x20ID:\x20'+_0x410651),_0x5b5921&&console[_0x70c6c2(0x22a)](_0x70c6c2(0x204)+_0x5b5921));if(!_0x5b1128[_0x70c6c2(0x241)]){const _0x132a76=await confirm(_0x70c6c2(0x290)+_0x410651+'?');if(!_0x132a76)return console[_0x70c6c2(0x22a)]('Cancelled'),0x0;}const _0x349a83=await withSpinner(_0x70c6c2(0x225),()=>_0xcbc343[_0x70c6c2(0x207)][_0x70c6c2(0x22f)](_0x410651,_0x5b5921),{'verbose':_0x5b1128['verbose']}),_0x20d850=_0x349a83[_0x70c6c2(0x277)];return console[_0x70c6c2(0x22a)]('✔\x20'+_0x20d850),0x0;}catch(_0x4c0eed){if(_0x4c0eed instanceof SDKError)return console[_0x70c6c2(0x22a)](_0x70c6c2(0x1f4)+_0x4c0eed[_0x70c6c2(0x252)]),_0x4c0eed[_0x70c6c2(0x259)]&&console[_0x70c6c2(0x22a)](_0x70c6c2(0x1fd)+_0x4c0eed[_0x70c6c2(0x259)]),0x1;throw _0x4c0eed;}}}export class WorkflowRetryCommand extends BaseCommand{[a43_0x144bdc(0x242)]='workflow:retry';['description']='Retry\x20a\x20session\x20or\x20attempt';async[a43_0x144bdc(0x21b)](_0x3b3443){const _0xb1ae8=a43_0x144bdc,{options:_0x46b87f,args:_0x188deb,tdx:_0x4052d3}=_0x3b3443,_0x51718b=_0x188deb[0x0];if(!_0x51718b)return console[_0xb1ae8(0x22a)](_0xb1ae8(0x284)),console[_0xb1ae8(0x22a)]('Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>'),0x1;let _0x2853e1=![],_0x2d6956=_0x51718b;if(_0x51718b[_0xb1ae8(0x205)](_0xb1ae8(0x214)))_0x2853e1=!![],_0x2d6956=_0x51718b[_0xb1ae8(0x1f6)](0x8);else{if(_0x51718b[_0xb1ae8(0x205)](_0xb1ae8(0x20a)))_0x2853e1=![],_0x2d6956=_0x51718b[_0xb1ae8(0x1f6)](0x8);else return console['error'](_0xb1ae8(0x25a)),console[_0xb1ae8(0x22a)]('Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>'),0x1;}try{const _0x469ebc=_0x46b87f[_0xb1ae8(0x223)],_0x11bf16=_0x46b87f['resumeFrom'],_0x588b8f=_0x46b87f[_0xb1ae8(0x28d)],_0x188fd5=_0x46b87f[_0xb1ae8(0x253)];_0x46b87f[_0xb1ae8(0x231)]&&(console[_0xb1ae8(0x22a)](_0xb1ae8(0x237)+(_0x2853e1?_0xb1ae8(0x28f):_0xb1ae8(0x238))+'\x20'+_0x2d6956),_0x469ebc&&console['error'](_0xb1ae8(0x27a)+_0x469ebc),_0x11bf16&&console[_0xb1ae8(0x22a)](_0xb1ae8(0x1fa)+_0x11bf16),_0x588b8f&&console[_0xb1ae8(0x22a)](_0xb1ae8(0x243)+_0x588b8f),_0x188fd5&&console[_0xb1ae8(0x22a)](_0xb1ae8(0x279)));let _0x4d23ce;if(_0x588b8f)try{if(_0x588b8f[_0xb1ae8(0x205)]('@')){const _0x387a17=await import('fs/promises'),_0x57078e=_0x588b8f[_0xb1ae8(0x1f6)](0x1),_0x2cf4e7=await _0x387a17[_0xb1ae8(0x292)](_0x57078e,'utf-8');_0x4d23ce=JSON[_0xb1ae8(0x24d)](_0x2cf4e7);}else _0x4d23ce=JSON[_0xb1ae8(0x24d)](_0x588b8f);}catch{return console['error'](_0xb1ae8(0x21a)),0x1;}if(!_0x46b87f[_0xb1ae8(0x241)]){const _0x544652=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20'+(_0x2853e1?'session':_0xb1ae8(0x238))+'\x20'+_0x2d6956+'?');if(!_0x544652)return console[_0xb1ae8(0x22a)](_0xb1ae8(0x28a)),0x0;}let _0xaf436b;_0x2853e1?_0xaf436b=await withSpinner(_0xb1ae8(0x209),()=>_0x4052d3[_0xb1ae8(0x207)]['retrySession'](_0x2d6956,{'fromTask':_0x469ebc,'retryParams':_0x4d23ce}),{'verbose':_0x46b87f['verbose']}):_0xaf436b=await withSpinner(_0xb1ae8(0x28e),()=>_0x4052d3['workflow'][_0xb1ae8(0x1fb)](_0x2d6956,{'resumeFrom':_0x11bf16,'retryParams':_0x4d23ce,'force':_0x188fd5}),{'verbose':_0x46b87f[_0xb1ae8(0x231)]});const _0x3b2554=_0xaf436b[_0xb1ae8(0x277)];return console[_0xb1ae8(0x22a)](_0xb1ae8(0x24e)),console[_0xb1ae8(0x22a)](_0xb1ae8(0x267)+_0x3b2554[_0xb1ae8(0x24c)]),console[_0xb1ae8(0x22a)](_0xb1ae8(0x222)+_0x3b2554['sessionId']),0x0;}catch(_0x29fbb7){if(_0x29fbb7 instanceof SDKError)return console[_0xb1ae8(0x22a)]('Error:\x20'+_0x29fbb7[_0xb1ae8(0x252)]),_0x29fbb7['cause']&&console[_0xb1ae8(0x22a)]('\x20\x20Cause:\x20'+_0x29fbb7[_0xb1ae8(0x259)]),0x1;throw _0x29fbb7;}}}export class WorkflowRunCommand extends BaseCommand{[a43_0x144bdc(0x242)]=a43_0x144bdc(0x25f);[a43_0x144bdc(0x22d)]=a43_0x144bdc(0x21c);async[a43_0x144bdc(0x21b)](_0x26787a){const _0x3377e6=a43_0x144bdc,{options:_0x4a5c72,args:_0x264cd5,tdx:_0x1570cb}=_0x26787a,_0x5c7d5e=_0x264cd5[0x0];if(!_0x5c7d5e)return console['error'](_0x3377e6(0x270)),console[_0x3377e6(0x22a)](_0x3377e6(0x236)),0x1;const _0x551b25=_0x4a5c72[_0x3377e6(0x28b)],_0xe98c0=_0x4a5c72['sessionTime'],_0x4f6c56={};if(_0x551b25&&Array[_0x3377e6(0x248)](_0x551b25))for(const _0xd39c4 of _0x551b25){const _0x39617c=_0xd39c4[_0x3377e6(0x262)]('=');if(_0x39617c===-0x1)return console[_0x3377e6(0x22a)](_0x3377e6(0x281)+_0xd39c4),console['error'](_0x3377e6(0x228)),0x1;const _0x191664=_0xd39c4[_0x3377e6(0x1f6)](0x0,_0x39617c),_0x4673da=_0xd39c4[_0x3377e6(0x1f6)](_0x39617c+0x1);try{_0x4f6c56[_0x191664]=JSON['parse'](_0x4673da);}catch{_0x4f6c56[_0x191664]=_0x4673da;}}_0x4a5c72[_0x3377e6(0x231)]&&(console[_0x3377e6(0x22a)](_0x3377e6(0x26d)+_0x5c7d5e),Object[_0x3377e6(0x240)](_0x4f6c56)[_0x3377e6(0x23e)]>0x0&&console[_0x3377e6(0x22a)](_0x3377e6(0x251)+JSON[_0x3377e6(0x217)](_0x4f6c56)),_0xe98c0&&console[_0x3377e6(0x22a)](_0x3377e6(0x234)+_0xe98c0));const _0x4efb2e=await withSpinner(_0x3377e6(0x257),()=>_0x1570cb['workflow'][_0x3377e6(0x25d)](_0x5c7d5e,_0x4f6c56,{'sessionTime':_0xe98c0}),{'verbose':_0x4a5c72[_0x3377e6(0x231)]}),_0x47fddf=_0x4efb2e[_0x3377e6(0x277)];return console[_0x3377e6(0x22a)]('✔\x20Workflow\x20run\x20started'),console['error'](_0x3377e6(0x20b)+_0x47fddf['id']),console[_0x3377e6(0x22a)](_0x3377e6(0x222)+_0x47fddf[_0x3377e6(0x273)]),console[_0x3377e6(0x22a)](_0x3377e6(0x21d)+_0x47fddf[_0x3377e6(0x206)]?.['name']),console[_0x3377e6(0x22a)](_0x3377e6(0x25c)+_0x47fddf['workflow']?.['name']),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{[a43_0x144bdc(0x242)]=a43_0x144bdc(0x202);[a43_0x144bdc(0x22d)]=a43_0x144bdc(0x289);async[a43_0x144bdc(0x21b)](_0x1e1188){const _0x16798e=a43_0x144bdc,{options:_0x106059,args:_0x3d8033,tdx:_0x315f9b}=_0x1e1188,_0x425dff=_0x3d8033[0x0],_0x16b7de=_0x3d8033[0x1]||'.';if(!_0x425dff)return console['error'](_0x16798e(0x1f7)),console[_0x16798e(0x22a)](_0x16798e(0x219)),0x1;const _0x581aa3=_0x106059['revision'];_0x106059[_0x16798e(0x231)]&&(console[_0x16798e(0x22a)]('Project:\x20'+_0x425dff),console[_0x16798e(0x22a)](_0x16798e(0x1fc)+_0x16b7de),_0x581aa3&&console['error'](_0x16798e(0x208)+_0x581aa3));const _0xabd444=await withSpinner('Downloading\x20project\x20'+_0x425dff+_0x16798e(0x283),()=>_0x315f9b[_0x16798e(0x207)]['download'](_0x425dff,_0x16b7de,{'revision':_0x581aa3}),{'verbose':_0x106059[_0x16798e(0x231)]}),_0x65c98d=_0xabd444[_0x16798e(0x277)];return console['error'](_0x16798e(0x25e)+_0x65c98d[_0x16798e(0x293)]),console[_0x16798e(0x22a)](_0x16798e(0x275)+_0x65c98d[_0x16798e(0x244)]),console[_0x16798e(0x22a)](_0x16798e(0x1f0)+_0x65c98d[_0x16798e(0x27f)]),console[_0x16798e(0x22a)](_0x16798e(0x245)+_0x16b7de+'/'+_0x65c98d[_0x16798e(0x293)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{[a43_0x144bdc(0x242)]='workflow:push';[a43_0x144bdc(0x22d)]=a43_0x144bdc(0x278);async[a43_0x144bdc(0x21b)](_0x2a324b){const _0x30d20c=a43_0x144bdc,{options:_0x13b2f9,args:_0x46809a,tdx:_0x888b58}=_0x2a324b;let _0x3cd99b='.',_0x3108b0=_0x13b2f9[_0x30d20c(0x242)];if(_0x46809a[0x0]){const {promises:_0x59504c}=await import('fs');try{const _0x6eabc=await _0x59504c[_0x30d20c(0x27b)](_0x46809a[0x0]);if(_0x6eabc[_0x30d20c(0x233)]())_0x3cd99b=_0x46809a[0x0];else return console[_0x30d20c(0x22a)](_0x30d20c(0x1f4)+_0x46809a[0x0]+'\x20is\x20not\x20a\x20directory'),0x1;}catch{_0x3108b0=_0x46809a[0x0],_0x3cd99b='.';}}const _0x173f2a=_0x13b2f9[_0x30d20c(0x244)],_0x5f4ac8=_0x13b2f9[_0x30d20c(0x27c)];_0x13b2f9[_0x30d20c(0x231)]&&(console[_0x30d20c(0x22a)](_0x30d20c(0x247)+_0x3cd99b),_0x3108b0&&console['error'](_0x30d20c(0x21f)+_0x3108b0),_0x173f2a&&console[_0x30d20c(0x22a)](_0x30d20c(0x208)+_0x173f2a),_0x5f4ac8&&console['error'](_0x30d20c(0x265)));const _0x46b80d=await withSpinner(_0x30d20c(0x239),()=>_0x888b58[_0x30d20c(0x207)]['push'](_0x3cd99b,{'projectName':_0x3108b0,'revision':_0x173f2a,'skipValidation':_0x5f4ac8}),{'verbose':_0x13b2f9[_0x30d20c(0x231)]}),_0x1d7d25=_0x46b80d[_0x30d20c(0x277)];return console['error'](_0x30d20c(0x26f)+_0x1d7d25[_0x30d20c(0x293)]),console[_0x30d20c(0x22a)]('\x20\x20Project\x20ID:\x20'+_0x1d7d25[_0x30d20c(0x1ff)]),console[_0x30d20c(0x22a)](_0x30d20c(0x275)+_0x1d7d25['revision']),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{['name']='workflow:delete';[a43_0x144bdc(0x22d)]=a43_0x144bdc(0x280);async[a43_0x144bdc(0x21b)](_0xfa6d39){const _0x200454=a43_0x144bdc,{options:_0x5b70b2,args:_0x4c0be0,tdx:_0x23c9b9}=_0xfa6d39,_0x4db7a7=_0x4c0be0[0x0];if(!_0x4db7a7)return console[_0x200454(0x22a)](_0x200454(0x276)),console[_0x200454(0x22a)](_0x200454(0x1f8)),0x1;_0x5b70b2[_0x200454(0x231)]&&console[_0x200454(0x22a)](_0x200454(0x288)+_0x4db7a7);if(!_0x5b70b2['yes']){const _0x286cc4=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22'+_0x4db7a7+_0x200454(0x20d));if(!_0x286cc4)return console[_0x200454(0x22a)](_0x200454(0x28a)),0x0;}const _0x12b621=await withSpinner(_0x200454(0x1f3)+_0x4db7a7+_0x200454(0x283),()=>_0x23c9b9[_0x200454(0x207)][_0x200454(0x1fe)](_0x4db7a7),{'verbose':_0x5b70b2[_0x200454(0x231)]}),_0x33c000=_0x12b621['data'];return console[_0x200454(0x22a)]('✔\x20Deleted\x20project\x20'+_0x33c000[_0x200454(0x293)]),console[_0x200454(0x22a)](_0x200454(0x256)+_0x33c000['projectId']),0x0;}}
|
package/dist/core/auth.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a44_0x56b2(_0x3a64e8,_0x47cc4f){_0x3a64e8=_0x3a64e8-0xf6;const _0x4d0a85=a44_0x4d0a();let _0x56b27c=_0x4d0a85[_0x3a64e8];return _0x56b27c;}(function(_0x30f3ce,_0x14b21e){const _0x109ea7=a44_0x56b2,_0x2b92b5=_0x30f3ce();while(!![]){try{const _0x2181c8=parseInt(_0x109ea7(0xfd))/0x1*(parseInt(_0x109ea7(0x101))/0x2)+parseInt(_0x109ea7(0xfa))/0x3*(-parseInt(_0x109ea7(0xfe))/0x4)+-parseInt(_0x109ea7(0x105))/0x5+-parseInt(_0x109ea7(0x109))/0x6*(parseInt(_0x109ea7(0x106))/0x7)+parseInt(_0x109ea7(0x107))/0x8*(parseInt(_0x109ea7(0xf7))/0x9)+parseInt(_0x109ea7(0xfc))/0xa+parseInt(_0x109ea7(0x108))/0xb;if(_0x2181c8===_0x14b21e)break;else _0x2b92b5['push'](_0x2b92b5['shift']());}catch(_0xa20e9e){_0x2b92b5['push'](_0x2b92b5['shift']());}}}(a44_0x4d0a,0xe2ed5));import{platform}from'os';import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';import{getAPIKey}from'./config.js';export function getVersion(){const _0x5c4428=a44_0x56b2;try{const _0x54168c=fileURLToPath(import.meta.url),_0x4fc2a5=dirname(_0x54168c),_0x2fb1c3=join(_0x4fc2a5,_0x5c4428(0xfb)),_0x4de60e=JSON[_0x5c4428(0xf6)](readFileSync(_0x2fb1c3,_0x5c4428(0xf8)));return _0x4de60e[_0x5c4428(0xf9)];}catch{return _0x5c4428(0x104);}}export function getUserAgent(){const _0x460a71=a44_0x56b2,_0x4c204e=getVersion(),_0x46de8e=platform(),_0x372bfb=process[_0x460a71(0xf9)]['replace']('v','');return'tdx/'+_0x4c204e+'\x20('+_0x46de8e+_0x460a71(0x10a)+_0x372bfb+')';}export function getAuthHeaders(_0x3d4e66,_0x10e5ab){const _0x4e8e97=a44_0x56b2,_0xaeef5c=getVersion(),_0x39fa09={'User-Agent':getUserAgent(),'X-TD-Client':_0x4e8e97(0x102),'X-TD-Client-Version':_0xaeef5c};return _0x10e5ab&&(_0x39fa09[_0x4e8e97(0x103)]=_0x4e8e97(0x10b)+_0x10e5ab),_0x39fa09;}function a44_0x4d0a(){const _0x3f073b=['2KAzOzx','tdx','Authorization','0.0.0','7583275cKhObm','91SilHYX','192NjvmOk','32921075tcDnMC','850638AIblSf',';\x20node/','TD1\x20','parse','267048GLwoKP','utf-8','version','819GbinCp','../../package.json','4614880YOThZI','1200833ssiIKE','15796ZqTbZD','length','X-Trino-User'];a44_0x4d0a=function(){return _0x3f073b;};return a44_0x4d0a();}export function toHeaderRecord(_0xfb0f6d){const _0xc5b129={};for(const [_0x364cf0,_0x2abf60]of Object['entries'](_0xfb0f6d)){_0x2abf60!==undefined&&(_0xc5b129[_0x364cf0]=_0x2abf60);}return _0xc5b129;}export function getTrinoHeaders(_0x3b5be,_0x274ee5){const _0x40e714=a44_0x56b2,_0x235145=getAuthHeaders(_0x3b5be,_0x274ee5),_0x570a9d=toHeaderRecord(_0x235145);return delete _0x570a9d[_0x40e714(0x103)],_0x274ee5&&(_0x570a9d[_0x40e714(0x100)]=_0x274ee5),_0x570a9d;}export function hasAPIKey(_0x1b7288){const _0x476653=a44_0x56b2,_0x166306=getAPIKey(_0x1b7288);return _0x166306!==undefined&&_0x166306[_0x476653(0xff)]>0x0;}
|
package/dist/core/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function a45_0x23e9(_0x4f1577,_0x360e7f){_0x4f1577=_0x4f1577-0x100;const _0x7a7cec=a45_0x7a7c();let _0x23e9e0=_0x7a7cec[_0x4f1577];return _0x23e9e0;}(function(_0x36fc22,_0x5105d1){const _0x4bee3f=a45_0x23e9,_0x24043b=_0x36fc22();while(!![]){try{const _0x17c8c6=-parseInt(_0x4bee3f(0x110))/0x1*(parseInt(_0x4bee3f(0x10d))/0x2)+parseInt(_0x4bee3f(0x116))/0x3*(-parseInt(_0x4bee3f(0x139))/0x4)+parseInt(_0x4bee3f(0x148))/0x5*(-parseInt(_0x4bee3f(0x13f))/0x6)+-parseInt(_0x4bee3f(0x124))/0x7*(-parseInt(_0x4bee3f(0x119))/0x8)+parseInt(_0x4bee3f(0x14a))/0x9+parseInt(_0x4bee3f(0x115))/0xa*(parseInt(_0x4bee3f(0x118))/0xb)+parseInt(_0x4bee3f(0x103))/0xc;if(_0x17c8c6===_0x5105d1)break;else _0x24043b['push'](_0x24043b['shift']());}catch(_0x5c034a){_0x24043b['push'](_0x24043b['shift']());}}}(a45_0x7a7c,0x3be69));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a45_0x41352d from'node:fs';import*as a45_0x3ff37b from'node:path';import{SITE_ALIASES}from'../types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';import{getKeychainAPIKey,saveKeychainAPIKey,isKeychainAvailable}from'./keychain.js';function a45_0x7a7c(){const _0x5eaa72=['.env','accountId','Warning:\x20Unknown\x20site\x20\x27','154148bbwDxK','entries','stg-us01','\x20env\x20var','split','isDeprecated','404724vyzTxk','stg-ap03','Warning:\x20Failed\x20to\x20read\x20','toUpperCase','TDX_API_KEY','trim','account_info.','TDX_API_KEY\x20env\x20var','tdx','10yjDCuJ','keychain','3892239ZVgGUY','stringify','eu01','existsSync','map','match','\x27,\x20defaulting\x20to\x20us01','jp01','slice','profiles','2623644sEQLmm','replace','includes','source','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','readFileSync','us01','TD_API_KEY\x20env\x20var\x20(deprecated)','number','TDX_CACHE_DIR','105970TReRdW','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','dev-eu01','6dZDwNQ','llm_default_project.','.env.','endsWith','\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20','20jrEUBX','6uNlyWK','keychain\x20(profile:\x20','165275mNvsBJ','752696PfELCx','parse','startsWith','yellow','site','env','llm_default_project','TD_API_KEY','.json','ap03','string','7YiQeXa','TD_API_KEY_','join','account_info.json','stg-jp01','filter','.cache','TDX_CONFIG_DIR','Warning:\x20Failed\x20to\x20load\x20','dev-us01','warn','tdx.json','profile','apiKeys','apiKey','name','TDX_API_KEY_','utf-8'];a45_0x7a7c=function(){return _0x5eaa72;};return a45_0x7a7c();}import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a45_0x21338d from'chalk';export function getConfigDir(){const _0x3d9f79=a45_0x23e9;return process[_0x3d9f79(0x11e)][_0x3d9f79(0x12b)]||join(homedir(),'.config',_0x3d9f79(0x147));}export function getConfigFile(){const _0x55fda8=a45_0x23e9;return join(getConfigDir(),_0x55fda8(0x136));}export function getConfigFilePath(_0x43e571){const _0x2c6f5b=a45_0x23e9,_0x433bd2=getConfigDir();return _0x43e571?a45_0x3ff37b[_0x2c6f5b(0x126)](_0x433bd2,_0x2c6f5b(0x112)+_0x43e571):getConfigFile();}export function getCacheDir(){const _0x438a0b=a45_0x23e9;return process[_0x438a0b(0x11e)][_0x438a0b(0x10c)]||join(homedir(),_0x438a0b(0x12a),_0x438a0b(0x147));}export function getLLMProjectCacheFile(_0x4eb1d7){const _0x35912f=a45_0x23e9,_0x16cafa=_0x4eb1d7?_0x35912f(0x111)+_0x4eb1d7:_0x35912f(0x11f);return join(getCacheDir(),_0x16cafa);}export function readCachedLLMProject(_0x3c6d04){const _0x4d2226=a45_0x23e9;try{const _0x4f66be=getLLMProjectCacheFile(_0x3c6d04);if(!existsSync(_0x4f66be))return null;const _0x4a9c04=readFileSync(_0x4f66be,_0x4d2226(0x135))[_0x4d2226(0x144)]();try{const _0x10ab29=JSON[_0x4d2226(0x11a)](_0x4a9c04);if(_0x10ab29&&typeof _0x10ab29['id']===_0x4d2226(0x123)&&typeof _0x10ab29[_0x4d2226(0x133)]===_0x4d2226(0x123))return _0x10ab29;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x4a60b0,_0x515bc7,_0x6d4775){const _0x3e5878=a45_0x23e9;try{const _0x59fcfb=getCacheDir(),_0x3cf91f=getLLMProjectCacheFile(_0x6d4775);!existsSync(_0x59fcfb)&&mkdirSync(_0x59fcfb,{'recursive':!![]});const _0x381666={'name':_0x4a60b0,'id':_0x515bc7};writeFileSync(_0x3cf91f,JSON[_0x3e5878(0x14b)](_0x381666),_0x3e5878(0x135));}catch{}}export function getAccountInfoCacheFile(_0x4b5606){const _0x4f81d2=a45_0x23e9,_0x92e0a3=_0x4b5606?_0x4f81d2(0x145)+_0x4b5606+_0x4f81d2(0x121):_0x4f81d2(0x127);return join(getCacheDir(),_0x92e0a3);}export function readCachedAccountInfo(_0x433f29){const _0x351e5e=a45_0x23e9;try{const _0x6db284=getAccountInfoCacheFile(_0x433f29);if(!existsSync(_0x6db284))return null;const _0xc6bdb6=readFileSync(_0x6db284,'utf-8')['trim'](),_0xd156=JSON[_0x351e5e(0x11a)](_0xc6bdb6);if(_0xd156&&typeof _0xd156[_0x351e5e(0x11d)]==='string'&&typeof _0xd156[_0x351e5e(0x137)]===_0x351e5e(0x10b))return _0xd156;return null;}catch{return null;}}export function writeCachedAccountInfo(_0xf501f8,_0x4dc62e,_0x4b12cf){const _0xd9d38c=a45_0x23e9;try{const _0x21dd5e=getCacheDir(),_0x5a329d=getAccountInfoCacheFile(_0x4b12cf);!existsSync(_0x21dd5e)&&mkdirSync(_0x21dd5e,{'recursive':!![]});const _0x10d8c4={'site':_0xf501f8,'accountId':_0x4dc62e,'cachedAt':new Date()['toISOString']()};writeFileSync(_0x5a329d,JSON[_0xd9d38c(0x14b)](_0x10d8c4),_0xd9d38c(0x135));}catch{}}export function parseEnvFile(_0x2b67a7){const _0xa81bbf=a45_0x23e9,_0x4121b0={};for(const _0x3eb2fa of _0x2b67a7['split']('\x0a')){const _0x357c83=_0x3eb2fa[_0xa81bbf(0x144)]();if(!_0x357c83||_0x357c83['startsWith']('#'))continue;const _0xa2dd92=_0x357c83[_0xa81bbf(0x14f)](/^([^=]+)=(.*)$/);if(_0xa2dd92){const _0x33284d=_0xa2dd92[0x1][_0xa81bbf(0x144)]();let _0x2dfb91=_0xa2dd92[0x2][_0xa81bbf(0x144)]();(_0x2dfb91[_0xa81bbf(0x11b)]('\x22')&&_0x2dfb91[_0xa81bbf(0x113)]('\x22')||_0x2dfb91[_0xa81bbf(0x11b)]('\x27')&&_0x2dfb91['endsWith']('\x27'))&&(_0x2dfb91=_0x2dfb91[_0xa81bbf(0x101)](0x1,-0x1)),_0x4121b0[_0x33284d]=_0x2dfb91;}}return _0x4121b0;}export function readUserConfig(){const _0x5def9d=getConfigFile();if(!existsSync(_0x5def9d))return{};try{const _0x10c260=readFileSync(_0x5def9d,'utf-8');return parseEnvFile(_0x10c260);}catch(_0x5cd3a8){return console['warn']('Warning:\x20Failed\x20to\x20read\x20config\x20file\x20'+_0x5def9d+':',_0x5cd3a8),{};}}export function resolveSite(_0x233f2b){const _0x14ab52=a45_0x23e9,_0x131784=[_0x14ab52(0x109),_0x14ab52(0x100),_0x14ab52(0x14c),'ap02','ap03',_0x14ab52(0x12d),_0x14ab52(0x10f),_0x14ab52(0x13b),_0x14ab52(0x128),'stg-ap03'];if(_0x131784['includes'](_0x233f2b))return _0x233f2b;if(_0x233f2b in SITE_ALIASES)return SITE_ALIASES[_0x233f2b];return console[_0x14ab52(0x12e)](_0x14ab52(0x138)+_0x233f2b+_0x14ab52(0x150)),'us01';}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x5812f6,_0xf9ea6a){const _0x5eda20=a45_0x23e9,_0x28af3b=_0xf9ea6a||getActiveProfileName();if(_0x28af3b){const _0x518022='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x28af3b);if(process[_0x5eda20(0x11e)][_0x518022])return process[_0x5eda20(0x11e)][_0x518022];}if(process[_0x5eda20(0x11e)][_0x5eda20(0x143)])return process[_0x5eda20(0x11e)][_0x5eda20(0x143)];if(process['env'][_0x5eda20(0x120)])return process[_0x5eda20(0x11e)]['TD_API_KEY'];const _0x3b8ff4=_0x5812f6['toUpperCase']()[_0x5eda20(0x104)](/-/g,'_'),_0xfe2d95=_0x5eda20(0x125)+_0x3b8ff4;if(_0x28af3b){const _0xb02988=loadProfileEnv(_0x28af3b);if(_0xb02988){if(_0xb02988[_0xfe2d95])return _0xb02988[_0xfe2d95];if(_0xb02988['TD_API_KEY'])return _0xb02988[_0x5eda20(0x120)];}}const _0x1db109=loadUserConfigOnce();if(_0x1db109[_0xfe2d95])return _0x1db109[_0xfe2d95];if(_0x1db109['TD_API_KEY'])return _0x1db109[_0x5eda20(0x120)];return undefined;}export function normalizeProfileForEnvVar(_0x4afeb3){return _0x4afeb3['toUpperCase']()['replace'](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x176c89,_0x2327d6){const _0x526437=a45_0x23e9,_0x136962=_0x2327d6||getActiveProfileName()||undefined;if(_0x136962){const _0x55f84e=_0x526437(0x134)+normalizeProfileForEnvVar(_0x136962);if(process[_0x526437(0x11e)][_0x55f84e])return{'apiKey':process[_0x526437(0x11e)][_0x55f84e],'source':_0x55f84e+_0x526437(0x13c),'isDeprecated':![]};const _0x19de51=getCachedCredential(_0x176c89,_0x136962);if(_0x19de51)return{'apiKey':_0x19de51,'source':_0x526437(0x117)+_0x136962+')','isDeprecated':![]};const _0x129fa3=await getKeychainAPIKey(_0x136962);if(_0x129fa3)return setCachedCredential(_0x129fa3,_0x176c89,_0x136962),{'apiKey':_0x129fa3,'source':_0x526437(0x117)+_0x136962+')','isDeprecated':![]};}if(process[_0x526437(0x11e)][_0x526437(0x143)])return{'apiKey':process[_0x526437(0x11e)][_0x526437(0x143)],'source':_0x526437(0x146),'isDeprecated':![]};if(!_0x136962){const _0xc3bd=getCachedCredential(_0x176c89,undefined);if(_0xc3bd)return{'apiKey':_0xc3bd,'source':_0x526437(0x149),'isDeprecated':![]};const _0x384328=await getKeychainAPIKey(undefined);if(_0x384328)return setCachedCredential(_0x384328,_0x176c89,undefined),{'apiKey':_0x384328,'source':_0x526437(0x149),'isDeprecated':![]};}if(process[_0x526437(0x11e)][_0x526437(0x120)])return{'apiKey':process[_0x526437(0x11e)]['TD_API_KEY'],'source':_0x526437(0x10a),'isDeprecated':!![]};const _0x144579=getLegacyEnvAPIKey(_0x176c89,_0x136962);if(_0x144579){const _0x535191=await isKeychainAvailable();if(_0x535191)try{await saveKeychainAPIKey(_0x144579,_0x136962),setCachedCredential(_0x144579,_0x176c89,_0x136962);const _0x10473e=getConfigFilePath(_0x136962);cleanupLegacyEnvFile(_0x10473e)&&console[_0x526437(0x12e)](a45_0x21338d[_0x526437(0x11c)]('⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage'));}catch(_0x7cface){console['warn'](a45_0x21338d['yellow']('⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20'+_0x7cface));}const _0x35490a=_0x136962?'legacy\x20.env\x20file\x20(profile:\x20'+_0x136962+')':'legacy\x20.env\x20file';return{'apiKey':_0x144579,'source':_0x35490a,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x2ec4a2,_0x537318,_0x5a1744=!![]){const _0xb2c290=a45_0x23e9,_0x1bb94a=await resolveAPIKeyAsync(_0x2ec4a2,_0x537318);if(!_0x1bb94a)return undefined;if(_0x5a1744&&_0x1bb94a[_0xb2c290(0x13e)]&&_0x1bb94a[_0xb2c290(0x106)][_0xb2c290(0x105)](_0xb2c290(0x120))){const _0x5e8f33=_0x537318||getActiveProfileName()||undefined,_0x3b4fd6=_0x5e8f33?_0xb2c290(0x134)+normalizeProfileForEnvVar(_0x5e8f33):'TDX_API_KEY_<PROFILE>';console['warn'](a45_0x21338d['yellow'](_0xb2c290(0x10e)+(_0xb2c290(0x114)+_0x3b4fd6+').')));}return _0x1bb94a[_0xb2c290(0x132)];}function getLegacyEnvAPIKey(_0x37a5df,_0x2bb346){const _0xaffbb2=a45_0x23e9,_0x545436=_0x37a5df[_0xaffbb2(0x142)]()[_0xaffbb2(0x104)](/-/g,'_'),_0x4923a6='TD_API_KEY_'+_0x545436;if(_0x2bb346){const _0x165276=loadProfileEnv(_0x2bb346);if(_0x165276){if(_0x165276[_0x4923a6])return _0x165276[_0x4923a6];if(_0x165276[_0xaffbb2(0x120)])return _0x165276[_0xaffbb2(0x120)];}}const _0x5e9b6b=loadUserConfigOnce();if(_0x5e9b6b[_0x4923a6])return _0x5e9b6b[_0x4923a6];if(_0x5e9b6b['TD_API_KEY'])return _0x5e9b6b['TD_API_KEY'];return undefined;}function cleanupLegacyEnvFile(_0xce3389){const _0x11f0de=a45_0x23e9;if(!existsSync(_0xce3389))return![];try{const _0x447589=readFileSync(_0xce3389,_0x11f0de(0x135)),_0x3da74d=_0x447589[_0x11f0de(0x13d)]('\x0a'),_0x292327=_0x3da74d[_0x11f0de(0x129)](_0x2770b0=>{const _0x1b50c0=_0x11f0de,_0x2309b3=_0x2770b0['trim']();if(!_0x2309b3||_0x2309b3['startsWith']('#'))return!![];const [_0x512993]=_0x2309b3[_0x1b50c0(0x13d)]('=');return!_0x512993[_0x1b50c0(0x11b)](_0x1b50c0(0x120));}),_0x172e2d=_0x292327['some'](_0x431960=>{const _0x3c2ef1=_0x11f0de,_0x332651=_0x431960[_0x3c2ef1(0x144)]();return _0x332651&&!_0x332651[_0x3c2ef1(0x11b)]('#');});if(!_0x172e2d)return unlinkSync(_0xce3389),!![];return writeFileSync(_0xce3389,_0x292327[_0x11f0de(0x126)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x45d3e3){const _0x30eb51=a45_0x23e9,_0x338a6f=a45_0x3ff37b[_0x30eb51(0x126)](getConfigDir(),_0x30eb51(0x112)+_0x45d3e3);if(a45_0x41352d['existsSync'](_0x338a6f)){validateSecureFilePermissions(_0x338a6f);try{const _0x12514e=a45_0x41352d['readFileSync'](_0x338a6f,'utf-8');return parseEnvFile(_0x12514e);}catch(_0x28cf5a){console[_0x30eb51(0x12e)](_0x30eb51(0x12c)+_0x338a6f+':\x20'+_0x28cf5a);}}const _0x29da5e=a45_0x3ff37b['join'](getConfigDir(),_0x30eb51(0x102),_0x45d3e3,_0x30eb51(0x136));if(a45_0x41352d[_0x30eb51(0x14d)](_0x29da5e)){validateSecureFilePermissions(_0x29da5e);try{const _0x1cd4f5=a45_0x41352d[_0x30eb51(0x108)](_0x29da5e,_0x30eb51(0x135));return parseEnvFile(_0x1cd4f5);}catch(_0x53b97e){return console['warn']('Warning:\x20Failed\x20to\x20load\x20'+_0x29da5e+':\x20'+_0x53b97e),null;}}return null;}function getActiveProfileName(){const _0x249448=a45_0x23e9,_0x3aa0a8=a45_0x3ff37b['join'](getConfigDir(),_0x249448(0x12f));if(!a45_0x41352d[_0x249448(0x14d)](_0x3aa0a8))return null;try{const _0x51c6eb=a45_0x41352d[_0x249448(0x108)](_0x3aa0a8,'utf-8'),_0x2d14a5=JSON['parse'](_0x51c6eb);return _0x2d14a5[_0x249448(0x130)]||null;}catch{return null;}}export function saveAPIKey(_0x5a1f24,_0x46c0a1,_0x218b6d){const _0x252f4a=a45_0x23e9,_0x2f3e09=getConfigDir(),_0x1db9aa=getConfigFilePath(_0x218b6d);!existsSync(_0x2f3e09)&&mkdirSync(_0x2f3e09,{'recursive':!![],'mode':0x1c0});let _0x3bc73d={};if(existsSync(_0x1db9aa))try{const _0x51cc74=readFileSync(_0x1db9aa,_0x252f4a(0x135));_0x3bc73d=parseEnvFile(_0x51cc74);}catch(_0x1e15c3){console['warn'](_0x252f4a(0x141)+_0x1db9aa+':',_0x1e15c3);}const _0xd6a6c8=_0x5a1f24[_0x252f4a(0x142)]()[_0x252f4a(0x104)](/-/g,'_');_0x3bc73d[_0x252f4a(0x125)+_0xd6a6c8]=_0x46c0a1;const _0x137cd0=Object[_0x252f4a(0x13a)](_0x3bc73d)[_0x252f4a(0x14e)](([_0x39b4bc,_0xb3f427])=>_0x39b4bc+'='+_0xb3f427);writeFileSync(_0x1db9aa,_0x137cd0[_0x252f4a(0x126)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x171cf2,_0x224fc3,_0x111f82){const _0x410838=a45_0x23e9;await saveKeychainAPIKey(_0x171cf2,_0x111f82),setCachedCredential(_0x171cf2,_0x224fc3,_0x111f82);const _0x17d848=getConfigFilePath(_0x111f82);cleanupLegacyEnvFile(_0x17d848)&&console[_0x410838(0x12e)](a45_0x21338d[_0x410838(0x11c)](_0x410838(0x107)));}export function loadConfig(){const _0x566d56=a45_0x23e9,_0x381476={'apiKeys':{},'defaultSite':'us01'},_0x44ce35=['us01','jp01',_0x566d56(0x14c),'ap02',_0x566d56(0x122),'dev-us01','dev-eu01',_0x566d56(0x13b),_0x566d56(0x128),_0x566d56(0x140)];for(const _0x24698f of _0x44ce35){const _0x3862bb=getAPIKey(_0x24698f);_0x3862bb&&(_0x381476[_0x566d56(0x131)][_0x24698f]=_0x3862bb);}return _0x381476;}
|
|
1
|
+
(function(_0x178263,_0x5f3583){const _0x2e5816=a45_0x1f0c,_0x3a8407=_0x178263();while(!![]){try{const _0x2cb81e=parseInt(_0x2e5816(0x14d))/0x1+parseInt(_0x2e5816(0x163))/0x2*(parseInt(_0x2e5816(0x140))/0x3)+-parseInt(_0x2e5816(0x139))/0x4+parseInt(_0x2e5816(0x153))/0x5+-parseInt(_0x2e5816(0x158))/0x6*(parseInt(_0x2e5816(0x164))/0x7)+-parseInt(_0x2e5816(0x165))/0x8*(parseInt(_0x2e5816(0x123))/0x9)+-parseInt(_0x2e5816(0x14b))/0xa*(-parseInt(_0x2e5816(0x14f))/0xb);if(_0x2cb81e===_0x5f3583)break;else _0x3a8407['push'](_0x3a8407['shift']());}catch(_0x154ec3){_0x3a8407['push'](_0x3a8407['shift']());}}}(a45_0x25cc,0x3d571));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a45_0x21762c from'node:fs';import*as a45_0x624711 from'node:path';import{SITE_ALIASES}from'../types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';import{getKeychainAPIKey,saveKeychainAPIKey,isKeychainAvailable}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a45_0x49209b from'chalk';export function getConfigDir(){const _0x329e0a=a45_0x1f0c;return process[_0x329e0a(0x120)][_0x329e0a(0x162)]||join(homedir(),_0x329e0a(0x131),_0x329e0a(0x121));}export function getConfigFile(){return join(getConfigDir(),'.env');}export function getConfigFilePath(_0x51a856){const _0x4fa4e0=a45_0x1f0c,_0x4e4a89=getConfigDir();return _0x51a856?a45_0x624711[_0x4fa4e0(0x15a)](_0x4e4a89,'.env.'+_0x51a856):getConfigFile();}export function getCacheDir(){const _0x359b12=a45_0x1f0c;return process[_0x359b12(0x120)][_0x359b12(0x155)]||join(homedir(),_0x359b12(0x125),_0x359b12(0x121));}export function getLLMProjectCacheFile(_0x1fe77d){const _0x1dd3a9=a45_0x1f0c,_0x1065af=_0x1fe77d?'llm_default_project.'+_0x1fe77d:_0x1dd3a9(0x13b);return join(getCacheDir(),_0x1065af);}export function readCachedLLMProject(_0x2e2003){const _0x1bc534=a45_0x1f0c;try{const _0x2044be=getLLMProjectCacheFile(_0x2e2003);if(!existsSync(_0x2044be))return null;const _0x2b5533=readFileSync(_0x2044be,_0x1bc534(0x124))[_0x1bc534(0x15d)]();try{const _0x4f26f2=JSON[_0x1bc534(0x126)](_0x2b5533);if(_0x4f26f2&&typeof _0x4f26f2['id']===_0x1bc534(0x166)&&typeof _0x4f26f2[_0x1bc534(0x160)]===_0x1bc534(0x166))return _0x4f26f2;}catch{}return null;}catch{return null;}}function a45_0x1f0c(_0x41965e,_0x58c560){_0x41965e=_0x41965e-0x11f;const _0x25cc50=a45_0x25cc();let _0x1f0c38=_0x25cc50[_0x41965e];return _0x1f0c38;}export function writeCachedLLMProject(_0x56b2e3,_0x44bce9,_0x4e154d){const _0x21bd55=a45_0x1f0c;try{const _0x5191db=getCacheDir(),_0x56572b=getLLMProjectCacheFile(_0x4e154d);!existsSync(_0x5191db)&&mkdirSync(_0x5191db,{'recursive':!![]});const _0x184e2d={'name':_0x56b2e3,'id':_0x44bce9};writeFileSync(_0x56572b,JSON[_0x21bd55(0x135)](_0x184e2d),_0x21bd55(0x124));}catch{}}export function getAccountInfoCacheFile(_0x8113a2){const _0x23260f=a45_0x1f0c,_0x143a30=_0x8113a2?'account_info.'+_0x8113a2+_0x23260f(0x128):'account_info.json';return join(getCacheDir(),_0x143a30);}export function readCachedAccountInfo(_0xe2c474){const _0x3c891f=a45_0x1f0c;try{const _0x573cfd=getAccountInfoCacheFile(_0xe2c474);if(!existsSync(_0x573cfd))return null;const _0xa5910e=readFileSync(_0x573cfd,_0x3c891f(0x124))[_0x3c891f(0x15d)](),_0x57beed=JSON['parse'](_0xa5910e);if(_0x57beed&&typeof _0x57beed[_0x3c891f(0x132)]===_0x3c891f(0x166)&&typeof _0x57beed[_0x3c891f(0x152)]===_0x3c891f(0x12c))return _0x57beed;return null;}catch{return null;}}export function writeCachedAccountInfo(_0x260153,_0x51cd87,_0xdb76c9){const _0x2e2e2a=a45_0x1f0c;try{const _0x48f83e=getCacheDir(),_0x192be4=getAccountInfoCacheFile(_0xdb76c9);!existsSync(_0x48f83e)&&mkdirSync(_0x48f83e,{'recursive':!![]});const _0x1b6962={'site':_0x260153,'accountId':_0x51cd87,'cachedAt':new Date()[_0x2e2e2a(0x14c)]()};writeFileSync(_0x192be4,JSON[_0x2e2e2a(0x135)](_0x1b6962),'utf-8');}catch{}}export function parseEnvFile(_0x9dce26){const _0x573690=a45_0x1f0c,_0x5bab6f={};for(const _0x56749a of _0x9dce26[_0x573690(0x14a)]('\x0a')){const _0x71d4b6=_0x56749a[_0x573690(0x15d)]();if(!_0x71d4b6||_0x71d4b6['startsWith']('#'))continue;const _0x3ddca7=_0x71d4b6[_0x573690(0x14e)](/^([^=]+)=(.*)$/);if(_0x3ddca7){const _0x1c5d9=_0x3ddca7[0x1]['trim']();let _0x2e57ba=_0x3ddca7[0x2][_0x573690(0x15d)]();(_0x2e57ba[_0x573690(0x161)]('\x22')&&_0x2e57ba['endsWith']('\x22')||_0x2e57ba[_0x573690(0x161)]('\x27')&&_0x2e57ba['endsWith']('\x27'))&&(_0x2e57ba=_0x2e57ba[_0x573690(0x144)](0x1,-0x1)),_0x5bab6f[_0x1c5d9]=_0x2e57ba;}}return _0x5bab6f;}export function readUserConfig(){const _0x41ef74=a45_0x1f0c,_0xaffb0c=getConfigFile();if(!existsSync(_0xaffb0c))return{};try{const _0x29f0b8=readFileSync(_0xaffb0c,_0x41ef74(0x124));return parseEnvFile(_0x29f0b8);}catch(_0x382eeb){return console[_0x41ef74(0x12f)]('Warning:\x20Failed\x20to\x20read\x20config\x20file\x20'+_0xaffb0c+':',_0x382eeb),{};}}export function resolveSite(_0x1fedcd){const _0x318504=a45_0x1f0c,_0x52314e=['us01',_0x318504(0x15b),_0x318504(0x13e),'ap02','ap03','dev-us01',_0x318504(0x13a),_0x318504(0x12e),_0x318504(0x149),'stg-ap03'];if(_0x52314e[_0x318504(0x12b)](_0x1fedcd))return _0x1fedcd;if(_0x1fedcd in SITE_ALIASES)return SITE_ALIASES[_0x1fedcd];return console['warn']('Warning:\x20Unknown\x20site\x20\x27'+_0x1fedcd+'\x27,\x20defaulting\x20to\x20us01'),_0x318504(0x137);}function a45_0x25cc(){const _0x55285c=['TDX_API_KEY','2304066HqEBFy','TD_API_KEY','join','jp01','replace','trim','TD_API_KEY\x20env\x20var\x20(deprecated)','isDeprecated','name','startsWith','TDX_CONFIG_DIR','49186lfpJlH','7vyaaNy','2064VKMeJW','string','keychain','env','tdx','filter','621DnRaiT','utf-8','.cache','parse','TD_API_KEY_','.json','yellow','profiles','includes','number','.env.','stg-us01','warn','stg-ap03','.config','site','entries','TDX_API_KEY_','stringify','.env','us01','apiKeys','1873264odahzG','dev-eu01','llm_default_project','existsSync','map','eu01','some','45mmcIjo','ap02','TDX_API_KEY_<PROFILE>','\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20','slice','Warning:\x20Failed\x20to\x20load\x20','keychain\x20(profile:\x20','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','readFileSync','stg-jp01','split','290jOaqNP','toISOString','430803hhpXks','match','66451cevmTm','\x20env\x20var','toUpperCase','accountId','732455VliGus','Warning:\x20Failed\x20to\x20read\x20','TDX_CACHE_DIR','apiKey'];a45_0x25cc=function(){return _0x55285c;};return a45_0x25cc();}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0xfaa26a,_0xc269f){const _0x43a1a8=a45_0x1f0c,_0x4a5346=_0xc269f||getActiveProfileName();if(_0x4a5346){const _0x3cab79='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x4a5346);if(process[_0x43a1a8(0x120)][_0x3cab79])return process[_0x43a1a8(0x120)][_0x3cab79];}if(process[_0x43a1a8(0x120)]['TDX_API_KEY'])return process[_0x43a1a8(0x120)][_0x43a1a8(0x157)];if(process['env'][_0x43a1a8(0x159)])return process[_0x43a1a8(0x120)][_0x43a1a8(0x159)];const _0x38acc4=_0xfaa26a['toUpperCase']()['replace'](/-/g,'_'),_0x226591='TD_API_KEY_'+_0x38acc4;if(_0x4a5346){const _0x2fe69f=loadProfileEnv(_0x4a5346);if(_0x2fe69f){if(_0x2fe69f[_0x226591])return _0x2fe69f[_0x226591];if(_0x2fe69f[_0x43a1a8(0x159)])return _0x2fe69f[_0x43a1a8(0x159)];}}const _0x413757=loadUserConfigOnce();if(_0x413757[_0x226591])return _0x413757[_0x226591];if(_0x413757[_0x43a1a8(0x159)])return _0x413757['TD_API_KEY'];return undefined;}export function normalizeProfileForEnvVar(_0x46a313){const _0x4cd6a7=a45_0x1f0c;return _0x46a313['toUpperCase']()[_0x4cd6a7(0x15c)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0xa291c1,_0xd255ae){const _0x377840=a45_0x1f0c,_0x305e1a=_0xd255ae||getActiveProfileName()||undefined;if(_0x305e1a){const _0x53b0f0=_0x377840(0x134)+normalizeProfileForEnvVar(_0x305e1a);if(process['env'][_0x53b0f0])return{'apiKey':process[_0x377840(0x120)][_0x53b0f0],'source':_0x53b0f0+_0x377840(0x150),'isDeprecated':![]};const _0x4325bc=getCachedCredential(_0xa291c1,_0x305e1a);if(_0x4325bc)return{'apiKey':_0x4325bc,'source':'keychain\x20(profile:\x20'+_0x305e1a+')','isDeprecated':![]};const _0x4caecb=await getKeychainAPIKey(_0x305e1a);if(_0x4caecb)return setCachedCredential(_0x4caecb,_0xa291c1,_0x305e1a),{'apiKey':_0x4caecb,'source':_0x377840(0x146)+_0x305e1a+')','isDeprecated':![]};}if(process[_0x377840(0x120)][_0x377840(0x157)])return{'apiKey':process['env']['TDX_API_KEY'],'source':'TDX_API_KEY\x20env\x20var','isDeprecated':![]};if(!_0x305e1a){const _0x49ed0e=getCachedCredential(_0xa291c1,undefined);if(_0x49ed0e)return{'apiKey':_0x49ed0e,'source':_0x377840(0x11f),'isDeprecated':![]};const _0x5c3fdd=await getKeychainAPIKey(undefined);if(_0x5c3fdd)return setCachedCredential(_0x5c3fdd,_0xa291c1,undefined),{'apiKey':_0x5c3fdd,'source':_0x377840(0x11f),'isDeprecated':![]};}if(process[_0x377840(0x120)][_0x377840(0x159)])return{'apiKey':process[_0x377840(0x120)][_0x377840(0x159)],'source':_0x377840(0x15e),'isDeprecated':!![]};const _0x5b1d02=getLegacyEnvAPIKey(_0xa291c1,_0x305e1a);if(_0x5b1d02){const _0x40e5b4=await isKeychainAvailable();if(_0x40e5b4)try{await saveKeychainAPIKey(_0x5b1d02,_0x305e1a),setCachedCredential(_0x5b1d02,_0xa291c1,_0x305e1a);const _0x14155a=getConfigFilePath(_0x305e1a);cleanupLegacyEnvFile(_0x14155a)&&console[_0x377840(0x12f)](a45_0x49209b['yellow']('⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage'));}catch(_0x1691d7){console['warn'](a45_0x49209b[_0x377840(0x129)]('⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20'+_0x1691d7));}const _0x2d0f8a=_0x305e1a?'legacy\x20.env\x20file\x20(profile:\x20'+_0x305e1a+')':'legacy\x20.env\x20file';return{'apiKey':_0x5b1d02,'source':_0x2d0f8a,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x257f64,_0x1e546a,_0x13b879=!![]){const _0x2b3bfe=a45_0x1f0c,_0x33db27=await resolveAPIKeyAsync(_0x257f64,_0x1e546a);if(!_0x33db27)return undefined;if(_0x13b879&&_0x33db27[_0x2b3bfe(0x15f)]&&_0x33db27['source']['includes'](_0x2b3bfe(0x159))){const _0x13cfe4=_0x1e546a||getActiveProfileName()||undefined,_0x4bf780=_0x13cfe4?'TDX_API_KEY_'+normalizeProfileForEnvVar(_0x13cfe4):_0x2b3bfe(0x142);console[_0x2b3bfe(0x12f)](a45_0x49209b[_0x2b3bfe(0x129)](_0x2b3bfe(0x147)+(_0x2b3bfe(0x143)+_0x4bf780+').')));}return _0x33db27[_0x2b3bfe(0x156)];}function getLegacyEnvAPIKey(_0x5bb65e,_0x10aa58){const _0x3a9e36=a45_0x1f0c,_0x3a5f1c=_0x5bb65e['toUpperCase']()[_0x3a9e36(0x15c)](/-/g,'_'),_0x52358e=_0x3a9e36(0x127)+_0x3a5f1c;if(_0x10aa58){const _0x1fa663=loadProfileEnv(_0x10aa58);if(_0x1fa663){if(_0x1fa663[_0x52358e])return _0x1fa663[_0x52358e];if(_0x1fa663[_0x3a9e36(0x159)])return _0x1fa663[_0x3a9e36(0x159)];}}const _0x153317=loadUserConfigOnce();if(_0x153317[_0x52358e])return _0x153317[_0x52358e];if(_0x153317[_0x3a9e36(0x159)])return _0x153317[_0x3a9e36(0x159)];return undefined;}function cleanupLegacyEnvFile(_0x21d05d){const _0xce67c4=a45_0x1f0c;if(!existsSync(_0x21d05d))return![];try{const _0x3d4128=readFileSync(_0x21d05d,_0xce67c4(0x124)),_0x28249b=_0x3d4128[_0xce67c4(0x14a)]('\x0a'),_0x4aa030=_0x28249b[_0xce67c4(0x122)](_0x2052e7=>{const _0x55702d=_0xce67c4,_0x4a61a5=_0x2052e7[_0x55702d(0x15d)]();if(!_0x4a61a5||_0x4a61a5[_0x55702d(0x161)]('#'))return!![];const [_0x401ed7]=_0x4a61a5[_0x55702d(0x14a)]('=');return!_0x401ed7[_0x55702d(0x161)](_0x55702d(0x159));}),_0x35c7bd=_0x4aa030[_0xce67c4(0x13f)](_0x2d9e2f=>{const _0x317cdf=_0xce67c4,_0x42681a=_0x2d9e2f[_0x317cdf(0x15d)]();return _0x42681a&&!_0x42681a['startsWith']('#');});if(!_0x35c7bd)return unlinkSync(_0x21d05d),!![];return writeFileSync(_0x21d05d,_0x4aa030['join']('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x3d97ac){const _0x50ccac=a45_0x1f0c,_0x461ad2=a45_0x624711[_0x50ccac(0x15a)](getConfigDir(),_0x50ccac(0x12d)+_0x3d97ac);if(a45_0x21762c['existsSync'](_0x461ad2)){validateSecureFilePermissions(_0x461ad2);try{const _0x33ef52=a45_0x21762c['readFileSync'](_0x461ad2,_0x50ccac(0x124));return parseEnvFile(_0x33ef52);}catch(_0x3ded82){console[_0x50ccac(0x12f)](_0x50ccac(0x145)+_0x461ad2+':\x20'+_0x3ded82);}}const _0x446a43=a45_0x624711['join'](getConfigDir(),_0x50ccac(0x12a),_0x3d97ac,_0x50ccac(0x136));if(a45_0x21762c[_0x50ccac(0x13c)](_0x446a43)){validateSecureFilePermissions(_0x446a43);try{const _0x599ced=a45_0x21762c[_0x50ccac(0x148)](_0x446a43,'utf-8');return parseEnvFile(_0x599ced);}catch(_0x5a77e7){return console[_0x50ccac(0x12f)](_0x50ccac(0x145)+_0x446a43+':\x20'+_0x5a77e7),null;}}return null;}function getActiveProfileName(){const _0x2fc700=a45_0x1f0c,_0x3fa75f=a45_0x624711[_0x2fc700(0x15a)](getConfigDir(),'tdx.json');if(!a45_0x21762c['existsSync'](_0x3fa75f))return null;try{const _0xed2699=a45_0x21762c[_0x2fc700(0x148)](_0x3fa75f,_0x2fc700(0x124)),_0x5b0552=JSON[_0x2fc700(0x126)](_0xed2699);return _0x5b0552['profile']||null;}catch{return null;}}export function saveAPIKey(_0x36ab57,_0x39cef4,_0x40e312){const _0x312abc=a45_0x1f0c,_0x3a8897=getConfigDir(),_0x1cc7b8=getConfigFilePath(_0x40e312);!existsSync(_0x3a8897)&&mkdirSync(_0x3a8897,{'recursive':!![],'mode':0x1c0});let _0x448952={};if(existsSync(_0x1cc7b8))try{const _0x229b43=readFileSync(_0x1cc7b8,_0x312abc(0x124));_0x448952=parseEnvFile(_0x229b43);}catch(_0x53af44){console[_0x312abc(0x12f)](_0x312abc(0x154)+_0x1cc7b8+':',_0x53af44);}const _0x2ee64c=_0x36ab57[_0x312abc(0x151)]()[_0x312abc(0x15c)](/-/g,'_');_0x448952[_0x312abc(0x127)+_0x2ee64c]=_0x39cef4;const _0x14ef56=Object[_0x312abc(0x133)](_0x448952)[_0x312abc(0x13d)](([_0x9ae471,_0x134aa2])=>_0x9ae471+'='+_0x134aa2);writeFileSync(_0x1cc7b8,_0x14ef56[_0x312abc(0x15a)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x5cc93d,_0x3b45f7,_0x5d85da){const _0x3588b6=a45_0x1f0c;await saveKeychainAPIKey(_0x5cc93d,_0x5d85da),setCachedCredential(_0x5cc93d,_0x3b45f7,_0x5d85da);const _0x5d5a80=getConfigFilePath(_0x5d85da);cleanupLegacyEnvFile(_0x5d5a80)&&console[_0x3588b6(0x12f)](a45_0x49209b[_0x3588b6(0x129)]('⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file'));}export function loadConfig(){const _0x2fe702=a45_0x1f0c,_0x59eb8b={'apiKeys':{},'defaultSite':_0x2fe702(0x137)},_0xa311e8=[_0x2fe702(0x137),'jp01','eu01',_0x2fe702(0x141),'ap03','dev-us01',_0x2fe702(0x13a),_0x2fe702(0x12e),_0x2fe702(0x149),_0x2fe702(0x130)];for(const _0x278149 of _0xa311e8){const _0x49b73c=getAPIKey(_0x278149);_0x49b73c&&(_0x59eb8b[_0x2fe702(0x138)][_0x278149]=_0x49b73c);}return _0x59eb8b;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x5ad3d6,_0x3eab03){const _0x55c5d1=a46_0x3106,_0x270071=_0x5ad3d6();while(!![]){try{const _0x409102=-parseInt(_0x55c5d1(0x14f))/0x1*(-parseInt(_0x55c5d1(0x143))/0x2)+-parseInt(_0x55c5d1(0x145))/0x3+parseInt(_0x55c5d1(0x148))/0x4+-parseInt(_0x55c5d1(0x14c))/0x5+-parseInt(_0x55c5d1(0x14d))/0x6*(parseInt(_0x55c5d1(0x149))/0x7)+parseInt(_0x55c5d1(0x142))/0x8*(parseInt(_0x55c5d1(0x150))/0x9)+parseInt(_0x55c5d1(0x151))/0xa;if(_0x409102===_0x3eab03)break;else _0x270071['push'](_0x270071['shift']());}catch(_0x3770d4){_0x270071['push'](_0x270071['shift']());}}}(a46_0x526e,0x5eb38));import{existsSync,mkdirSync,readFileSync,writeFileSync,unlinkSync}from'fs';function a46_0x3106(_0x2ac171,_0x5e95b5){_0x2ac171=_0x2ac171-0x141;const _0x526ef6=a46_0x526e();let _0x3106e3=_0x526ef6[_0x2ac171];return _0x3106e3;}import{join}from'path';import{getCacheDir}from'./config.js';function a46_0x526e(){const _0x3306cc=['parse','.json','2149630pqgzKg','1316886GinskK','connections','3nNXJVk','261wLGotV','10771320KqbSvF','connections-','24672ylBuom','183032ALOrbY','default','2125371XzzZJx','utf-8','now','1218576aWeXNm','7BpgATh'];a46_0x526e=function(){return _0x3306cc;};return a46_0x526e();}function getCacheFilePath(_0x17b0c5){const _0x152582=a46_0x3106,_0x27556f=_0x17b0c5||_0x152582(0x144);return join(getCacheDir(),_0x152582(0x141)+_0x27556f+_0x152582(0x14b));}export function loadCachedConnections(_0x397418){const _0x353768=a46_0x3106,_0x8af63a=getCacheFilePath(_0x397418);if(!existsSync(_0x8af63a))return null;try{const _0x138cf4=readFileSync(_0x8af63a,_0x353768(0x146)),_0x17bb11=JSON[_0x353768(0x14a)](_0x138cf4);return _0x17bb11[_0x353768(0x14e)];}catch{return null;}}export function saveCachedConnections(_0x7c5165,_0x2ff24d){const _0x1212c6=a46_0x3106,_0x4d019a=getCacheDir();!existsSync(_0x4d019a)&&mkdirSync(_0x4d019a,{'recursive':!![]});const _0x195bf4=getCacheFilePath(_0x7c5165),_0x794786={'connections':_0x2ff24d,'cachedAt':Date[_0x1212c6(0x147)]()};writeFileSync(_0x195bf4,JSON['stringify'](_0x794786,null,0x2),_0x1212c6(0x146));}export function clearConnectionCache(_0x36656f){const _0x1dff58=getCacheFilePath(_0x36656f);if(existsSync(_0x1dff58))try{unlinkSync(_0x1dff58);}catch{}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x5c0e90,_0x174290){const _0x49fea6=a47_0x2558,_0x19bdee=_0x5c0e90();while(!![]){try{const _0xbdae2d=-parseInt(_0x49fea6(0x1d1))/0x1*(parseInt(_0x49fea6(0x1cf))/0x2)+parseInt(_0x49fea6(0x1cd))/0x3+-parseInt(_0x49fea6(0x1d0))/0x4+-parseInt(_0x49fea6(0x1c6))/0x5+-parseInt(_0x49fea6(0x1d4))/0x6+-parseInt(_0x49fea6(0x1c9))/0x7*(parseInt(_0x49fea6(0x1c8))/0x8)+parseInt(_0x49fea6(0x1c7))/0x9*(parseInt(_0x49fea6(0x1c5))/0xa);if(_0xbdae2d===_0x174290)break;else _0x19bdee['push'](_0x19bdee['shift']());}catch(_0x1c5b85){_0x19bdee['push'](_0x19bdee['shift']());}}}(a47_0x28f3,0xa4bfb));function a47_0x2558(_0x467c56,_0x33be38){_0x467c56=_0x467c56-0x1c5;const _0x28f337=a47_0x28f3();let _0x255885=_0x28f337[_0x467c56];return _0x255885;}const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x4ea335,_0x1cfa2e){const _0x2bb4ef=a47_0x2558,_0x28261b=_0x4ea335||_0x2bb4ef(0x1d2),_0x2b12d7=_0x1cfa2e||_0x2bb4ef(0x1d6);return _0x28261b+':'+_0x2b12d7;}function a47_0x28f3(){const _0x335da4=['delete','2036736vEYJwG','get','427444ONBeZg','1602604KBNdAb','5ByxMcY','__default_site__','now','975972bwwLnF','loadedAt','__default_profile__','90TxNLdD','5603395uWHNtz','3506103VIohCb','16iVIKoQ','2651607LHKujP','apiKey','set'];a47_0x28f3=function(){return _0x335da4;};return a47_0x28f3();}export function getCachedCredential(_0x1c66d3,_0x44ac5b){const _0x26517e=a47_0x2558,_0xdd2299=getCacheKey(_0x1c66d3,_0x44ac5b),_0x59b3df=cache[_0x26517e(0x1ce)](_0xdd2299);if(!_0x59b3df)return null;if(Date[_0x26517e(0x1d3)]()-_0x59b3df[_0x26517e(0x1d5)]>CACHE_TTL_MS)return cache[_0x26517e(0x1cc)](_0xdd2299),null;return _0x59b3df[_0x26517e(0x1ca)];}export function setCachedCredential(_0x25b6c3,_0x1bced2,_0xdbfd37){const _0x29f91a=a47_0x2558,_0x516643=getCacheKey(_0x1bced2,_0xdbfd37);cache[_0x29f91a(0x1cb)](_0x516643,{'apiKey':_0x25b6c3,'loadedAt':Date['now']()});}export function clearCredentialCache(){cache['clear']();}export function clearCachedCredential(_0x325855,_0x58e3f0){const _0x1a4431=getCacheKey(_0x325855,_0x58e3f0);cache['delete'](_0x1a4431);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a48_0x4ddee2=a48_0x5ab2;(function(_0xd0d511,_0x10d77f){const _0x4017fe=a48_0x5ab2,_0x128b92=_0xd0d511();while(!![]){try{const _0x4a0cd8=-parseInt(_0x4017fe(0x1f5))/0x1*(-parseInt(_0x4017fe(0x20d))/0x2)+parseInt(_0x4017fe(0x201))/0x3*(parseInt(_0x4017fe(0x1f1))/0x4)+-parseInt(_0x4017fe(0x204))/0x5+parseInt(_0x4017fe(0x1e2))/0x6+-parseInt(_0x4017fe(0x200))/0x7*(-parseInt(_0x4017fe(0x208))/0x8)+-parseInt(_0x4017fe(0x1f7))/0x9*(parseInt(_0x4017fe(0x1fb))/0xa)+-parseInt(_0x4017fe(0x1e7))/0xb;if(_0x4a0cd8===_0x10d77f)break;else _0x128b92['push'](_0x128b92['shift']());}catch(_0x58abec){_0x128b92['push'](_0x128b92['shift']());}}}(a48_0x56ea,0x22a4a));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getCurrentSessionPID}from'./session.js';function a48_0x5ab2(_0x16491e,_0x2f7819){_0x16491e=_0x16491e-0x1c9;const _0x56eafe=a48_0x56ea();let _0x5ab23e=_0x56eafe[_0x16491e];return _0x5ab23e;}import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/tdx-logger.js';import*as a48_0x2482a2 from'node:fs';import*as a48_0xb8d889 from'node:path';function a48_0x56ea(){const _0x413c0d=['join','replace','2907245CbpMCe','segment_path','tdx.json','global','CLI\x20flag:\x20--','profile','profileCredentials','verbose','database','activeProfile','4pVVbzr','apiKey','resolveAPIKeyAsync',':\x20none\x20(using\x20session:\x20','1802yVVcAB','(active)','252657WfkiTt','loadGlobalConfig','displayWithSources','parent_segment','30FoNvMw','profile:\x20','cliFlags','llm_project','(session:\x20','1242374fxSKdf','608088BlNdxb','config','profiles','1263125dGWzPL','llmProject','Project','default','8uKAlfc','us01','Global','Global\x20Credentials','[context]','114RKJqed','parentSegment','Profile','INFO','not\x20set','logLevel','session','sessions','entries','sessionId','.json','configFiles','layers','utf-8','getParameters','Profile\x20Credentials','\x0a[configuration\x20files]','globalCredentials',':\x20none','injectIntoOptions','Session','getSource','display','project','.env','site','parse','1560870oJONJj','existsSync','log'];a48_0x56ea=function(){return _0x413c0d;};return a48_0x56ea();}export class GlobalContext{[a48_0x4ddee2(0x1e0)];['database'];[a48_0x4ddee2(0x1fa)];['segment_path'];[a48_0x4ddee2(0x1fe)];[a48_0x4ddee2(0x1f2)];[a48_0x4ddee2(0x1ee)];[a48_0x4ddee2(0x1cc)];[a48_0x4ddee2(0x1ec)];[a48_0x4ddee2(0x1d3)];[a48_0x4ddee2(0x1f0)];[a48_0x4ddee2(0x1d0)];['configFiles'];constructor(_0x7d5c94){const _0x4d4570=a48_0x4ddee2;this['sessionId']=_0x7d5c94[_0x4d4570(0x1cd)]||getCurrentSessionPID()['toString']();const _0x26b4f6=loadSessionContext(_0x7d5c94['session']),_0x14cfa6=loadProjectConfig(),_0x3803cf=this['loadGlobalConfig']();this['activeProfile']=_0x7d5c94[_0x4d4570(0x1ec)]||_0x26b4f6?.[_0x4d4570(0x1ec)]||_0x3803cf['profile']||getActiveProfile();const _0x14d7b4=this[_0x4d4570(0x1f0)]?loadProfile(this[_0x4d4570(0x1f0)]):null,_0x496ec1=_0x4413be=>{const _0x2dd627=_0x4d4570;if(!_0x4413be)return{};const _0x50b029=_0x4413be,_0x295ceb={};for(const [_0x42d4ac,_0x3a390a]of Object[_0x2dd627(0x1cf)](_0x50b029)){typeof _0x3a390a==='string'&&(_0x295ceb[_0x42d4ac]=_0x3a390a);}return _0x295ceb;},_0x2274f6={};if(_0x7d5c94[_0x4d4570(0x1e0)]&&_0x7d5c94[_0x4d4570(0x1e0)]!==_0x4d4570(0x209))_0x2274f6['site']=_0x7d5c94[_0x4d4570(0x1e0)];const _0xa1d10a=_0x26b4f6?.[_0x4d4570(0x1ef)],_0x1df961=_0x14cfa6?.[_0x4d4570(0x1ef)],_0xf015=_0x14d7b4?.[_0x4d4570(0x202)]?.[_0x4d4570(0x1ef)],_0x374fa0=_0x3803cf[_0x4d4570(0x1ef)];_0x7d5c94[_0x4d4570(0x1ef)]&&(_0x7d5c94['database']!==_0xa1d10a&&_0x7d5c94['database']!==_0x1df961&&_0x7d5c94[_0x4d4570(0x1ef)]!==_0xf015&&_0x7d5c94[_0x4d4570(0x1ef)]!==_0x374fa0)&&(_0x2274f6[_0x4d4570(0x1ef)]=_0x7d5c94[_0x4d4570(0x1ef)]);if(_0x7d5c94['parentSegment'])_0x2274f6[_0x4d4570(0x1fa)]=_0x7d5c94[_0x4d4570(0x20e)];if(_0x7d5c94[_0x4d4570(0x205)])_0x2274f6['llm_project']=_0x7d5c94[_0x4d4570(0x205)];if(_0x7d5c94[_0x4d4570(0x1ec)])_0x2274f6['profile']=_0x7d5c94[_0x4d4570(0x1ec)];this[_0x4d4570(0x1d3)]={'cliFlags':_0x2274f6,'session':_0x496ec1(_0x26b4f6),'project':_0x496ec1(_0x14cfa6),'profile':_0x496ec1(_0x14d7b4?.['config']),'global':_0x496ec1(_0x3803cf)};const _0x42d807={...this['layers']['global'],...this['layers'][_0x4d4570(0x1ec)],...this[_0x4d4570(0x1d3)][_0x4d4570(0x1de)],...this['layers'][_0x4d4570(0x1cd)],...this['layers']['cliFlags']},_0x48d4d9=_0x42d807[_0x4d4570(0x1e0)]||'us01';this[_0x4d4570(0x1e0)]=resolveSite(_0x48d4d9),this[_0x4d4570(0x1ef)]=_0x42d807[_0x4d4570(0x1ef)],this[_0x4d4570(0x1fa)]=_0x42d807['parent_segment'],this[_0x4d4570(0x1e8)]=_0x42d807['segment_path'],this[_0x4d4570(0x1fe)]=_0x42d807[_0x4d4570(0x1fe)],this['verbose']=_0x7d5c94[_0x4d4570(0x1ee)]||![],this[_0x4d4570(0x1cc)]=_0x7d5c94[_0x4d4570(0x1cc)]??LogLevel[_0x4d4570(0x1ca)],this[_0x4d4570(0x1ec)]=this[_0x4d4570(0x1f0)]||undefined,this[_0x4d4570(0x1f2)]=getAPIKey(this[_0x4d4570(0x1e0)],this[_0x4d4570(0x1f0)]||undefined);const _0x4071bd=getConfigDir(),_0x24449e=a48_0xb8d889['join'](_0x4071bd,_0x4d4570(0x1ce),this['sessionId']+_0x4d4570(0x1d1)),_0x46e70c=findProjectConfigPath(),_0x7028fe=a48_0xb8d889[_0x4d4570(0x1e5)](_0x4071bd,'tdx.json'),_0x3d789f=a48_0xb8d889[_0x4d4570(0x1e5)](_0x4071bd,_0x4d4570(0x1df));let _0x589b42=null,_0x2f85d6=null;this[_0x4d4570(0x1f0)]&&(_0x589b42=a48_0xb8d889[_0x4d4570(0x1e5)](_0x4071bd,_0x4d4570(0x203),this[_0x4d4570(0x1f0)],'tdx.json'),_0x2f85d6=a48_0xb8d889[_0x4d4570(0x1e5)](_0x4071bd,_0x4d4570(0x203),this[_0x4d4570(0x1f0)],_0x4d4570(0x1df))),this[_0x4d4570(0x1d2)]={'session':a48_0x2482a2[_0x4d4570(0x1e3)](_0x24449e)?_0x24449e:null,'project':_0x46e70c,'profile':_0x589b42&&a48_0x2482a2[_0x4d4570(0x1e3)](_0x589b42)?_0x589b42:null,'profileCredentials':_0x2f85d6&&a48_0x2482a2[_0x4d4570(0x1e3)](_0x2f85d6)?_0x2f85d6:null,'global':a48_0x2482a2[_0x4d4570(0x1e3)](_0x7028fe)?_0x7028fe:null,'globalCredentials':a48_0x2482a2[_0x4d4570(0x1e3)](_0x3d789f)?_0x3d789f:null};}[a48_0x4ddee2(0x1dc)](_0x14c147,_0x30dd0f){const _0x5d6f2d=a48_0x4ddee2;if(!_0x30dd0f)return _0x5d6f2d(0x1cb);const _0x407d8e=_0x30dd0f;if(this['layers'][_0x5d6f2d(0x1fd)][_0x14c147]===_0x407d8e){if(_0x14c147==='site'&&_0x407d8e===_0x5d6f2d(0x209)&&!this[_0x5d6f2d(0x1d3)]['session'][_0x5d6f2d(0x1e0)]&&!this[_0x5d6f2d(0x1d3)][_0x5d6f2d(0x1de)][_0x5d6f2d(0x1e0)]&&!this[_0x5d6f2d(0x1d3)][_0x5d6f2d(0x1ec)][_0x5d6f2d(0x1e0)]&&!this[_0x5d6f2d(0x1d3)][_0x5d6f2d(0x1ea)][_0x5d6f2d(0x1e0)])return _0x5d6f2d(0x207);return _0x5d6f2d(0x1eb)+_0x14c147[_0x5d6f2d(0x1e6)](/_/g,'-');}if(this[_0x5d6f2d(0x1d3)][_0x5d6f2d(0x1cd)][_0x14c147]===_0x407d8e)return _0x5d6f2d(0x1cd);if(this['layers']['project'][_0x14c147]===_0x407d8e)return _0x5d6f2d(0x1de);if(this[_0x5d6f2d(0x1d3)][_0x5d6f2d(0x1ec)][_0x14c147]===_0x407d8e)return _0x5d6f2d(0x1fc)+this[_0x5d6f2d(0x1f0)];if(this[_0x5d6f2d(0x1d3)][_0x5d6f2d(0x1ea)][_0x14c147]===_0x407d8e)return'global';return _0x5d6f2d(0x207);}[a48_0x4ddee2(0x1f8)](){const _0x3a4a21=a48_0x4ddee2,_0x1c1ec1=a48_0xb8d889['join'](getConfigDir(),_0x3a4a21(0x1e9));if(!a48_0x2482a2['existsSync'](_0x1c1ec1))return{};try{const _0x1d429d=a48_0x2482a2['readFileSync'](_0x1c1ec1,_0x3a4a21(0x1d4));return JSON[_0x3a4a21(0x1e1)](_0x1d429d);}catch{return{};}}[a48_0x4ddee2(0x1da)](_0x2332ff){const _0x88ad41=a48_0x4ddee2;_0x2332ff[_0x88ad41(0x1e0)]=this[_0x88ad41(0x1e0)],!_0x2332ff['database']&&this['database']&&(_0x2332ff[_0x88ad41(0x1ef)]=this[_0x88ad41(0x1ef)]),!_0x2332ff[_0x88ad41(0x20e)]&&this[_0x88ad41(0x1fa)]&&(_0x2332ff[_0x88ad41(0x20e)]=this['parent_segment']),!_0x2332ff['segmentPath']&&this['segment_path']&&(_0x2332ff['segmentPath']=this['segment_path']),!_0x2332ff[_0x88ad41(0x205)]&&this['llm_project']&&(_0x2332ff[_0x88ad41(0x205)]=this['llm_project']);}[a48_0x4ddee2(0x1d5)](){const _0x28f384=a48_0x4ddee2;return[{'key':_0x28f384(0x1e0),'value':this['site']},{'key':_0x28f384(0x1ef),'value':this[_0x28f384(0x1ef)]},{'key':_0x28f384(0x1fa),'value':this[_0x28f384(0x1fa)]},{'key':_0x28f384(0x1e8),'value':this[_0x28f384(0x1e8)]},{'key':_0x28f384(0x1fe),'value':this[_0x28f384(0x1fe)]},{'key':_0x28f384(0x1ec),'value':this[_0x28f384(0x1f0)]||undefined}];}[a48_0x4ddee2(0x1dd)](){const _0x1bf7e4=a48_0x4ddee2;console[_0x1bf7e4(0x1e4)](_0x1bf7e4(0x20c));for(const {key:_0x281ece,value:_0x542093}of this[_0x1bf7e4(0x1d5)]()){_0x542093&&console[_0x1bf7e4(0x1e4)](_0x281ece+':\x20'+_0x542093);}}[a48_0x4ddee2(0x1f9)](){const _0x572d53=a48_0x4ddee2;console[_0x572d53(0x1e4)](_0x572d53(0x20c));for(const {key:_0x26539b,value:_0x3dad46}of this[_0x572d53(0x1d5)]()){if(_0x3dad46){const _0x9e66db=_0x26539b===_0x572d53(0x1ec)?_0x572d53(0x1f6):'('+this[_0x572d53(0x1dc)](_0x26539b,_0x3dad46)+')';console['log'](_0x26539b+':\x20'+_0x3dad46+'\x20'+_0x9e66db);}}console['log'](_0x572d53(0x1d7));const _0x1bcd78=[{'label':_0x572d53(0x1db),'path':this[_0x572d53(0x1d2)][_0x572d53(0x1cd)],'extra':_0x572d53(0x1ff)+this['sessionId']+')'},{'label':_0x572d53(0x206),'path':this[_0x572d53(0x1d2)]['project']},{'label':_0x572d53(0x1c9),'path':this[_0x572d53(0x1d2)][_0x572d53(0x1ec)]},{'label':_0x572d53(0x1d6),'path':this[_0x572d53(0x1d2)][_0x572d53(0x1ed)]},{'label':_0x572d53(0x20a),'path':this[_0x572d53(0x1d2)][_0x572d53(0x1ea)]},{'label':_0x572d53(0x20b),'path':this[_0x572d53(0x1d2)][_0x572d53(0x1d8)]}];for(const {label:_0x4a195e,path:_0x347c9d,extra:_0x3f08ee}of _0x1bcd78){if(_0x347c9d)console[_0x572d53(0x1e4)](_0x4a195e+':\x20'+_0x347c9d+'\x20✓'+(_0x3f08ee?'\x20'+_0x3f08ee:''));else{if(_0x4a195e===_0x572d53(0x1db))console[_0x572d53(0x1e4)](_0x4a195e+_0x572d53(0x1f4)+this['sessionId']+')');else(_0x4a195e===_0x572d53(0x206)||_0x4a195e===_0x572d53(0x20a))&&console['log'](_0x4a195e+_0x572d53(0x1d9));}}}async['resolveAPIKeyAsync'](){const _0x38b5e5=a48_0x4ddee2;return this[_0x38b5e5(0x1f2)]=await getAPIKeyAsync(this[_0x38b5e5(0x1e0)],this[_0x38b5e5(0x1f0)]||undefined),this[_0x38b5e5(0x1f2)];}static async['createAsync'](_0x1b4208){const _0xc0d530=a48_0x4ddee2,_0xc10278=new GlobalContext(_0x1b4208);return await _0xc10278[_0xc0d530(0x1f3)](),_0xc10278;}}
|
|
1
|
+
const a48_0x462195=a48_0xdd49;function a48_0xdd49(_0x53401e,_0x4dd42f){_0x53401e=_0x53401e-0x7c;const _0x434ddd=a48_0x434d();let _0xdd498d=_0x434ddd[_0x53401e];return _0xdd498d;}(function(_0x1139f6,_0x4a1497){const _0x43fcf9=a48_0xdd49,_0x4bc467=_0x1139f6();while(!![]){try{const _0x5a36cd=parseInt(_0x43fcf9(0x80))/0x1+parseInt(_0x43fcf9(0x95))/0x2*(parseInt(_0x43fcf9(0xa7))/0x3)+-parseInt(_0x43fcf9(0x89))/0x4+-parseInt(_0x43fcf9(0xb0))/0x5+parseInt(_0x43fcf9(0x81))/0x6+-parseInt(_0x43fcf9(0x7d))/0x7+parseInt(_0x43fcf9(0x92))/0x8*(parseInt(_0x43fcf9(0x96))/0x9);if(_0x5a36cd===_0x4a1497)break;else _0x4bc467['push'](_0x4bc467['shift']());}catch(_0x5b51bd){_0x4bc467['push'](_0x4bc467['shift']());}}}(a48_0x434d,0x6dbb2));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';function a48_0x434d(){const _0x11561b=['getParameters','llmProject','getSource','display','global','loadGlobalConfig','segmentPath','INFO','project','resolveAPIKeyAsync','apiKey','Profile\x20Credentials','870867oFkPLm','CLI\x20flag:\x20--','(active)','utf-8','layers','verbose','default','llm_project','segment_path','4375145ukKtLS','displayWithSources','\x0a[configuration\x20files]','[context]','existsSync','parent_segment','session','Global\x20Credentials','parentSegment','log','profiles','not\x20set','Global','296373vwFjok','join','.env','756961psOlds','3497922eJmrey','profile','Session','cliFlags','us01','site','configFiles','Project','2159340tyiWdY','config','sessionId','database','entries',':\x20none\x20(using\x20session:\x20','toString','.json','logLevel','20288pfeuRF','tdx.json','activeProfile','2WwpoOX','981YYFdvg','readFileSync','createAsync','parse','Profile'];a48_0x434d=function(){return _0x11561b;};return a48_0x434d();}import{loadSessionContext,getCurrentSessionPID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/tdx-logger.js';import*as a48_0x22d67c from'node:fs';import*as a48_0x5b4660 from'node:path';export class GlobalContext{['site'];[a48_0x462195(0x8c)];['parent_segment'];['segment_path'];['llm_project'];[a48_0x462195(0xa5)];[a48_0x462195(0xac)];[a48_0x462195(0x91)];['profile'];['layers'];[a48_0x462195(0x94)];['sessionId'];[a48_0x462195(0x87)];constructor(_0x49e8b9){const _0x1e3265=a48_0x462195;this[_0x1e3265(0x8b)]=_0x49e8b9['session']||getCurrentSessionPID()[_0x1e3265(0x8f)]();const _0x37df1b=loadSessionContext(_0x49e8b9['session']),_0x23f1aa=loadProjectConfig(),_0x150293=this['loadGlobalConfig']();this[_0x1e3265(0x94)]=_0x49e8b9[_0x1e3265(0x82)]||_0x37df1b?.[_0x1e3265(0x82)]||_0x150293[_0x1e3265(0x82)]||getActiveProfile();const _0x52c20e=this[_0x1e3265(0x94)]?loadProfile(this['activeProfile']):null,_0x1c2b90=_0x219954=>{const _0x27add0=_0x1e3265;if(!_0x219954)return{};const _0x2f543e=_0x219954,_0x137645={};for(const [_0x19a3ac,_0x90863]of Object[_0x27add0(0x8d)](_0x2f543e)){typeof _0x90863==='string'&&(_0x137645[_0x19a3ac]=_0x90863);}return _0x137645;},_0x1d2323={};if(_0x49e8b9[_0x1e3265(0x86)]&&_0x49e8b9[_0x1e3265(0x86)]!==_0x1e3265(0x85))_0x1d2323[_0x1e3265(0x86)]=_0x49e8b9['site'];const _0x24b073=_0x37df1b?.[_0x1e3265(0x8c)],_0x313e28=_0x23f1aa?.['database'],_0x209b6b=_0x52c20e?.['config']?.[_0x1e3265(0x8c)],_0x349683=_0x150293[_0x1e3265(0x8c)];_0x49e8b9['database']&&(_0x49e8b9[_0x1e3265(0x8c)]!==_0x24b073&&_0x49e8b9[_0x1e3265(0x8c)]!==_0x313e28&&_0x49e8b9[_0x1e3265(0x8c)]!==_0x209b6b&&_0x49e8b9[_0x1e3265(0x8c)]!==_0x349683)&&(_0x1d2323[_0x1e3265(0x8c)]=_0x49e8b9['database']);if(_0x49e8b9[_0x1e3265(0xb8)])_0x1d2323[_0x1e3265(0xb5)]=_0x49e8b9[_0x1e3265(0xb8)];if(_0x49e8b9[_0x1e3265(0x9c)])_0x1d2323[_0x1e3265(0xae)]=_0x49e8b9[_0x1e3265(0x9c)];if(_0x49e8b9[_0x1e3265(0x82)])_0x1d2323[_0x1e3265(0x82)]=_0x49e8b9[_0x1e3265(0x82)];this[_0x1e3265(0xab)]={'cliFlags':_0x1d2323,'session':_0x1c2b90(_0x37df1b),'project':_0x1c2b90(_0x23f1aa),'profile':_0x1c2b90(_0x52c20e?.[_0x1e3265(0x8a)]),'global':_0x1c2b90(_0x150293)};const _0x370a3d={...this[_0x1e3265(0xab)][_0x1e3265(0x9f)],...this['layers'][_0x1e3265(0x82)],...this['layers'][_0x1e3265(0xa3)],...this[_0x1e3265(0xab)][_0x1e3265(0xb6)],...this[_0x1e3265(0xab)][_0x1e3265(0x84)]},_0x14d54d=_0x370a3d[_0x1e3265(0x86)]||_0x1e3265(0x85);this[_0x1e3265(0x86)]=resolveSite(_0x14d54d),this[_0x1e3265(0x8c)]=_0x370a3d[_0x1e3265(0x8c)],this[_0x1e3265(0xb5)]=_0x370a3d[_0x1e3265(0xb5)],this[_0x1e3265(0xaf)]=_0x370a3d[_0x1e3265(0xaf)],this[_0x1e3265(0xae)]=_0x370a3d[_0x1e3265(0xae)],this['verbose']=_0x49e8b9[_0x1e3265(0xac)]||![],this[_0x1e3265(0x91)]=_0x49e8b9[_0x1e3265(0x91)]??LogLevel[_0x1e3265(0xa2)],this[_0x1e3265(0x82)]=this[_0x1e3265(0x94)]||undefined,this[_0x1e3265(0xa5)]=getAPIKey(this[_0x1e3265(0x86)],this['activeProfile']||undefined);const _0x30dd64=getConfigDir(),_0x4db3d4=a48_0x5b4660[_0x1e3265(0x7e)](_0x30dd64,'sessions',this[_0x1e3265(0x8b)]+_0x1e3265(0x90)),_0x31b65d=findProjectConfigPath(),_0x91cf2f=a48_0x5b4660['join'](_0x30dd64,_0x1e3265(0x93)),_0xb8c573=a48_0x5b4660[_0x1e3265(0x7e)](_0x30dd64,_0x1e3265(0x7f));let _0x4561c6=null,_0x33dd22=null;this[_0x1e3265(0x94)]&&(_0x4561c6=a48_0x5b4660[_0x1e3265(0x7e)](_0x30dd64,'profiles',this[_0x1e3265(0x94)],_0x1e3265(0x93)),_0x33dd22=a48_0x5b4660[_0x1e3265(0x7e)](_0x30dd64,_0x1e3265(0xba),this['activeProfile'],_0x1e3265(0x7f))),this[_0x1e3265(0x87)]={'session':a48_0x22d67c[_0x1e3265(0xb4)](_0x4db3d4)?_0x4db3d4:null,'project':_0x31b65d,'profile':_0x4561c6&&a48_0x22d67c[_0x1e3265(0xb4)](_0x4561c6)?_0x4561c6:null,'profileCredentials':_0x33dd22&&a48_0x22d67c[_0x1e3265(0xb4)](_0x33dd22)?_0x33dd22:null,'global':a48_0x22d67c[_0x1e3265(0xb4)](_0x91cf2f)?_0x91cf2f:null,'globalCredentials':a48_0x22d67c[_0x1e3265(0xb4)](_0xb8c573)?_0xb8c573:null};}[a48_0x462195(0x9d)](_0x27b7e2,_0x2a89af){const _0xc32f17=a48_0x462195;if(!_0x2a89af)return _0xc32f17(0xbb);const _0x1400b6=_0x2a89af;if(this[_0xc32f17(0xab)][_0xc32f17(0x84)][_0x27b7e2]===_0x1400b6){if(_0x27b7e2===_0xc32f17(0x86)&&_0x1400b6===_0xc32f17(0x85)&&!this['layers'][_0xc32f17(0xb6)][_0xc32f17(0x86)]&&!this['layers'][_0xc32f17(0xa3)][_0xc32f17(0x86)]&&!this['layers'][_0xc32f17(0x82)][_0xc32f17(0x86)]&&!this[_0xc32f17(0xab)][_0xc32f17(0x9f)][_0xc32f17(0x86)])return'default';return _0xc32f17(0xa8)+_0x27b7e2['replace'](/_/g,'-');}if(this[_0xc32f17(0xab)][_0xc32f17(0xb6)][_0x27b7e2]===_0x1400b6)return _0xc32f17(0xb6);if(this[_0xc32f17(0xab)][_0xc32f17(0xa3)][_0x27b7e2]===_0x1400b6)return _0xc32f17(0xa3);if(this[_0xc32f17(0xab)][_0xc32f17(0x82)][_0x27b7e2]===_0x1400b6)return'profile:\x20'+this[_0xc32f17(0x94)];if(this[_0xc32f17(0xab)][_0xc32f17(0x9f)][_0x27b7e2]===_0x1400b6)return _0xc32f17(0x9f);return _0xc32f17(0xad);}[a48_0x462195(0xa0)](){const _0x181c3e=a48_0x462195,_0x45536c=a48_0x5b4660[_0x181c3e(0x7e)](getConfigDir(),_0x181c3e(0x93));if(!a48_0x22d67c[_0x181c3e(0xb4)](_0x45536c))return{};try{const _0x2cbc6f=a48_0x22d67c[_0x181c3e(0x97)](_0x45536c,_0x181c3e(0xaa));return JSON[_0x181c3e(0x99)](_0x2cbc6f);}catch{return{};}}['injectIntoOptions'](_0x5d9236){const _0x8ed927=a48_0x462195;_0x5d9236['site']=this[_0x8ed927(0x86)],!_0x5d9236[_0x8ed927(0x8c)]&&this[_0x8ed927(0x8c)]&&(_0x5d9236[_0x8ed927(0x8c)]=this[_0x8ed927(0x8c)]),!_0x5d9236[_0x8ed927(0xb8)]&&this[_0x8ed927(0xb5)]&&(_0x5d9236[_0x8ed927(0xb8)]=this[_0x8ed927(0xb5)]),!_0x5d9236[_0x8ed927(0xa1)]&&this[_0x8ed927(0xaf)]&&(_0x5d9236[_0x8ed927(0xa1)]=this[_0x8ed927(0xaf)]),!_0x5d9236[_0x8ed927(0x9c)]&&this[_0x8ed927(0xae)]&&(_0x5d9236[_0x8ed927(0x9c)]=this[_0x8ed927(0xae)]);}[a48_0x462195(0x9b)](){const _0x4a53f5=a48_0x462195;return[{'key':_0x4a53f5(0x86),'value':this[_0x4a53f5(0x86)]},{'key':_0x4a53f5(0x8c),'value':this[_0x4a53f5(0x8c)]},{'key':_0x4a53f5(0xb5),'value':this[_0x4a53f5(0xb5)]},{'key':_0x4a53f5(0xaf),'value':this[_0x4a53f5(0xaf)]},{'key':'llm_project','value':this['llm_project']},{'key':_0x4a53f5(0x82),'value':this['activeProfile']||undefined}];}[a48_0x462195(0x9e)](){const _0x80f4ac=a48_0x462195;console[_0x80f4ac(0xb9)](_0x80f4ac(0xb3));for(const {key:_0x1fe377,value:_0x2588a0}of this[_0x80f4ac(0x9b)]()){_0x2588a0&&console[_0x80f4ac(0xb9)](_0x1fe377+':\x20'+_0x2588a0);}}[a48_0x462195(0xb1)](){const _0x181671=a48_0x462195;console[_0x181671(0xb9)](_0x181671(0xb3));for(const {key:_0x6c1c7,value:_0x212f8c}of this['getParameters']()){if(_0x212f8c){const _0x4bc94f=_0x6c1c7===_0x181671(0x82)?_0x181671(0xa9):'('+this[_0x181671(0x9d)](_0x6c1c7,_0x212f8c)+')';console[_0x181671(0xb9)](_0x6c1c7+':\x20'+_0x212f8c+'\x20'+_0x4bc94f);}}console[_0x181671(0xb9)](_0x181671(0xb2));const _0x1566c9=[{'label':_0x181671(0x83),'path':this[_0x181671(0x87)][_0x181671(0xb6)],'extra':'(session:\x20'+this[_0x181671(0x8b)]+')'},{'label':'Project','path':this[_0x181671(0x87)][_0x181671(0xa3)]},{'label':_0x181671(0x9a),'path':this[_0x181671(0x87)]['profile']},{'label':_0x181671(0xa6),'path':this[_0x181671(0x87)]['profileCredentials']},{'label':_0x181671(0x7c),'path':this[_0x181671(0x87)][_0x181671(0x9f)]},{'label':_0x181671(0xb7),'path':this['configFiles']['globalCredentials']}];for(const {label:_0x25694c,path:_0x1b0a87,extra:_0x1796a7}of _0x1566c9){if(_0x1b0a87)console['log'](_0x25694c+':\x20'+_0x1b0a87+'\x20✓'+(_0x1796a7?'\x20'+_0x1796a7:''));else{if(_0x25694c===_0x181671(0x83))console['log'](_0x25694c+_0x181671(0x8e)+this[_0x181671(0x8b)]+')');else(_0x25694c===_0x181671(0x88)||_0x25694c===_0x181671(0x7c))&&console[_0x181671(0xb9)](_0x25694c+':\x20none');}}}async[a48_0x462195(0xa4)](){const _0x2f6726=a48_0x462195;return this[_0x2f6726(0xa5)]=await getAPIKeyAsync(this[_0x2f6726(0x86)],this['activeProfile']||undefined),this['apiKey'];}static async[a48_0x462195(0x98)](_0x173e1e){const _0x416c58=new GlobalContext(_0x173e1e);return await _0x416c58['resolveAPIKeyAsync'](),_0x416c58;}}
|
package/dist/core/keychain.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a49_0x3df17e=a49_0x5c4a;(function(_0xd00b32,_0x3e9a44){const _0x5b30d7=a49_0x5c4a,_0x58b858=_0xd00b32();while(!![]){try{const _0x29c22a=-parseInt(_0x5b30d7(0x14b))/0x1*(-parseInt(_0x5b30d7(0x14f))/0x2)+parseInt(_0x5b30d7(0x12d))/0x3+parseInt(_0x5b30d7(0x148))/0x4*(parseInt(_0x5b30d7(0x14e))/0x5)+parseInt(_0x5b30d7(0x145))/0x6+-parseInt(_0x5b30d7(0x12f))/0x7*(-parseInt(_0x5b30d7(0x14d))/0x8)+-parseInt(_0x5b30d7(0x14a))/0x9+-parseInt(_0x5b30d7(0x132))/0xa;if(_0x29c22a===_0x3e9a44)break;else _0x58b858['push'](_0x58b858['shift']());}catch(_0x3c7a4f){_0x58b858['push'](_0x58b858['shift']());}}}(a49_0x5a7a,0x8bbfa));const SERVICE_NAME=a49_0x3df17e(0x12c);let keyringModule=null,keyringLoadError=null;function a49_0x5c4a(_0xbafe51,_0xb68a48){_0xbafe51=_0xbafe51-0x12b;const _0x5a7a26=a49_0x5a7a();let _0x5c4ac9=_0x5a7a26[_0xbafe51];return _0x5c4ac9;}async function getKeyring(){const _0x4b04e4=a49_0x3df17e;if(keyringModule!==null)return keyringModule;if(keyringLoadError!==null)return null;try{const _0x376b3d=await import(_0x4b04e4(0x137));return keyringModule=_0x376b3d[_0x4b04e4(0x14c)],keyringModule;}catch(_0x23df15){return keyringLoadError=_0x23df15 instanceof Error?_0x23df15:new Error(String(_0x23df15)),null;}}function getAccountName(_0x5226d){const _0x371a9e=a49_0x3df17e,_0x11208d=_0x5226d||'';return _0x371a9e(0x13a)+_0x11208d+_0x371a9e(0x13c);}export async function getKeychainAPIKey(_0x16dee3){const _0x1b5b69=a49_0x3df17e,_0x377121=await getKeychainAPIKeyWithStatus(_0x16dee3);if(_0x377121[_0x1b5b69(0x146)])return _0x377121[_0x1b5b69(0x144)];return _0x377121[_0x1b5b69(0x147)]==='access_denied'&&console[_0x1b5b69(0x13e)](_0x1b5b69(0x140)+_0x377121[_0x1b5b69(0x130)]),null;}function a49_0x5a7a(){const _0x501172=['-25293','toLowerCase','not\x20available','value','5219070PBBeMv','success','reason','2338396BXYHQX','setPassword','8200908jLuSpJ','163243RXTjbw','keyring','8aWhGaU','5KzpZey','12krlxjK','cannot\x20find','unavailable','restricted','tdx','1607172AZWDdL','includes','3707564cSZwel','message','access','20156560nbTiCa','could\x20not\x20be\x20found','getPassword','not_found','not\x20supported','@zowe/secrets-for-zowe-sdk','-25300','deletePassword','profile:','System\x20keychain\x20is\x20not\x20available',':api_key','Keychain\x20access\x20denied.\x20The\x20API\x20key\x20exists\x20but\x20cannot\x20be\x20accessed.\x20Try\x20running\x20\x22tdx\x20auth\x20setup\x22\x20to\x20re-authenticate,\x20or\x20check\x20your\x20keychain\x20permissions\x20for\x20\x22tdx\x22.','error','__keychain_test__','Warning:\x20'];a49_0x5a7a=function(){return _0x501172;};return a49_0x5a7a();}export async function getKeychainAPIKeyWithStatus(_0xfea292){const _0x59d9a9=a49_0x3df17e;try{const _0x198855=await getKeyring();if(!_0x198855)return{'success':![],'reason':_0x59d9a9(0x151)};const _0x2085fd=getAccountName(_0xfea292),_0x4f3d37=await _0x198855[_0x59d9a9(0x134)](SERVICE_NAME,_0x2085fd);if(_0x4f3d37)return{'success':!![],'value':_0x4f3d37};return{'success':![],'reason':_0x59d9a9(0x135)};}catch(_0xec380e){const _0x4453dd=_0xec380e instanceof Error?_0xec380e[_0x59d9a9(0x130)]:String(_0xec380e);if(_0x4453dd[_0x59d9a9(0x12e)](_0x59d9a9(0x138))||_0x4453dd[_0x59d9a9(0x142)]()['includes'](_0x59d9a9(0x133))||_0x4453dd[_0x59d9a9(0x142)]()[_0x59d9a9(0x12e)]('not\x20found'))return{'success':![],'reason':_0x59d9a9(0x135)};if(_0x4453dd[_0x59d9a9(0x12e)](_0x59d9a9(0x141))||_0x4453dd[_0x59d9a9(0x142)]()[_0x59d9a9(0x12e)](_0x59d9a9(0x12b))||_0x4453dd[_0x59d9a9(0x142)]()[_0x59d9a9(0x12e)](_0x59d9a9(0x131)))return{'success':![],'reason':'access_denied','message':_0x59d9a9(0x13d)};return{'success':![],'reason':_0x59d9a9(0x151),'message':_0x4453dd};}}export async function saveKeychainAPIKey(_0x58d175,_0x5c5152){const _0x24d4f2=a49_0x3df17e,_0xa4ca83=await getKeyring();if(!_0xa4ca83)throw new Error(_0x24d4f2(0x13b));const _0x4e3af0=getAccountName(_0x5c5152);await _0xa4ca83[_0x24d4f2(0x149)](SERVICE_NAME,_0x4e3af0,_0x58d175);}export async function deleteKeychainAPIKey(_0x2f0dc8){const _0x598e2a=a49_0x3df17e;try{const _0x3f59ea=await getKeyring();if(!_0x3f59ea)return![];const _0x3e96c7=getAccountName(_0x2f0dc8);return await _0x3f59ea[_0x598e2a(0x139)](SERVICE_NAME,_0x3e96c7);}catch{return![];}}export async function isKeychainAvailable(){const _0x552ca0=a49_0x3df17e;try{const _0x4ee56a=await getKeyring();if(!_0x4ee56a)return![];return await _0x4ee56a[_0x552ca0(0x134)](SERVICE_NAME,_0x552ca0(0x13f)),!![];}catch(_0x53dcab){const _0x1659a4=_0x53dcab instanceof Error?_0x53dcab[_0x552ca0(0x130)][_0x552ca0(0x142)]():'';if(_0x1659a4['includes'](_0x552ca0(0x143))||_0x1659a4[_0x552ca0(0x12e)](_0x552ca0(0x136))||_0x1659a4['includes'](_0x552ca0(0x150)))return![];return!![];}}
|
package/dist/core/profile.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x2c1d56,_0x5f218c){const _0x22fe05=a50_0x297c,_0x5e8120=_0x2c1d56();while(!![]){try{const _0x12b943=-parseInt(_0x22fe05(0xd8))/0x1+-parseInt(_0x22fe05(0xd0))/0x2+parseInt(_0x22fe05(0xdc))/0x3+parseInt(_0x22fe05(0xaa))/0x4*(parseInt(_0x22fe05(0xbb))/0x5)+parseInt(_0x22fe05(0xd5))/0x6*(-parseInt(_0x22fe05(0xcb))/0x7)+-parseInt(_0x22fe05(0xc1))/0x8+parseInt(_0x22fe05(0xb2))/0x9;if(_0x12b943===_0x5f218c)break;else _0x5e8120['push'](_0x5e8120['shift']());}catch(_0x5021fe){_0x5e8120['push'](_0x5e8120['shift']());}}}(a50_0x30f1,0xf0b6a));import*as a50_0xa7ad29 from'node:fs';import*as a50_0x44d796 from'node:path';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export function getProfileParams(_0x179b19){const _0x188278=a50_0x297c,_0x2d41ad={};if(!_0x179b19)return _0x2d41ad;for(const [_0x44dd6a,_0x2a621a]of Object[_0x188278(0xdb)](_0x179b19)){_0x44dd6a!==_0x188278(0xac)&&_0x2a621a!==undefined&&(_0x2d41ad[_0x44dd6a]=_0x2a621a);}return _0x2d41ad;}export function getProfilesDir(){const _0x259344=a50_0x297c;return a50_0x44d796[_0x259344(0xb7)](getConfigDir(),_0x259344(0xda));}function getProfileDir(_0x547b07){const _0x37b8ec=a50_0x297c;return a50_0x44d796[_0x37b8ec(0xb7)](getProfilesDir(),_0x547b07);}function getProfileConfigPath(_0x1da61f){const _0x5aa99f=a50_0x297c;return a50_0x44d796[_0x5aa99f(0xb7)](getProfileDir(_0x1da61f),'tdx.json');}function getProfileEnvPath(_0x236133){const _0x197d6e=a50_0x297c;return a50_0x44d796[_0x197d6e(0xb7)](getProfileDir(_0x236133),'.env');}function getGlobalConfigPath(){const _0x6e459b=a50_0x297c;return a50_0x44d796[_0x6e459b(0xb7)](getConfigDir(),_0x6e459b(0xce));}function validateProfileName(_0x57a0a8){const _0x30d76f=a50_0x297c;if(!/^[a-zA-Z0-9_-]+$/[_0x30d76f(0xae)](_0x57a0a8))throw new Error('Invalid\x20profile\x20name:\x20'+_0x57a0a8+_0x30d76f(0xe8));}function validateProfileConfig(_0xd41815,_0x404c3f){const _0x187118=a50_0x297c;if(typeof _0xd41815!==_0x187118(0xde)||_0xd41815===null)throw new Error('Profile\x20\x27'+_0x404c3f+_0x187118(0xc5));const _0x3a18de=['description',_0x187118(0xe1),'database',_0x187118(0xdf),_0x187118(0xd7),'llm_agent'],_0x36da1d=_0xd41815;for(const _0x2bef52 of Object[_0x187118(0xbf)](_0x36da1d)){!_0x3a18de[_0x187118(0xaf)](_0x2bef52)&&console[_0x187118(0xec)]('Warning:\x20Profile\x20\x27'+_0x404c3f+_0x187118(0xcf)+_0x2bef52+'\x27\x20will\x20be\x20ignored');}if(_0x36da1d['description']!==undefined&&typeof _0x36da1d[_0x187118(0xac)]!==_0x187118(0xcd))throw new Error(_0x187118(0xab)+_0x404c3f+_0x187118(0xc6));if(_0x36da1d[_0x187118(0xe1)]!==undefined&&typeof _0x36da1d[_0x187118(0xe1)]!==_0x187118(0xcd))throw new Error('Profile\x20\x27'+_0x404c3f+'\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string');if(_0x36da1d['database']!==undefined&&typeof _0x36da1d[_0x187118(0xd1)]!==_0x187118(0xcd))throw new Error(_0x187118(0xab)+_0x404c3f+_0x187118(0xc9));if(_0x36da1d[_0x187118(0xdf)]!==undefined&&typeof _0x36da1d['parent_segment']!=='string')throw new Error(_0x187118(0xab)+_0x404c3f+'\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string');if(_0x36da1d[_0x187118(0xd7)]!==undefined&&typeof _0x36da1d[_0x187118(0xd7)]!=='string')throw new Error(_0x187118(0xab)+_0x404c3f+_0x187118(0xa6));if(_0x36da1d[_0x187118(0xca)]!==undefined&&typeof _0x36da1d[_0x187118(0xca)]!=='string')throw new Error('Profile\x20\x27'+_0x404c3f+'\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string');return!![];}function loadProfilesFromTdxJson(_0x58e62f,_0x565571){const _0x5c28e5=a50_0x297c;if(!a50_0xa7ad29[_0x5c28e5(0xe0)](_0x58e62f))return[];try{const _0x3748ba=a50_0xa7ad29[_0x5c28e5(0xb6)](_0x58e62f,_0x5c28e5(0xa8)),_0x111bdf=JSON[_0x5c28e5(0xe3)](_0x3748ba);if(!_0x111bdf[_0x5c28e5(0xda)]||typeof _0x111bdf[_0x5c28e5(0xda)]!=='object')return[];const _0x5076c7=[];for(const [_0x528052,_0x2d6724]of Object[_0x5c28e5(0xdb)](_0x111bdf['profiles'])){try{validateProfileConfig(_0x2d6724,_0x528052);const _0x288d98=getNewCredentialPath(_0x528052),_0x1c7540=getOldCredentialPath(_0x528052),_0xa50422=a50_0xa7ad29[_0x5c28e5(0xe0)](_0x288d98)||a50_0xa7ad29[_0x5c28e5(0xe0)](_0x1c7540);_0x5076c7[_0x5c28e5(0xe6)]({'name':_0x528052,'config':_0x2d6724,'metadata':{'name':_0x528052,'createdAt':new Date()[_0x5c28e5(0xdd)]()},'hasCredentials':_0xa50422,'scope':_0x565571});}catch(_0x2eb0bd){_0x2eb0bd instanceof Error&&(console[_0x5c28e5(0xec)](_0x5c28e5(0xc2)+_0x58e62f+':'),console[_0x5c28e5(0xec)]('\x20\x20'+_0x2eb0bd[_0x5c28e5(0xbc)]+'\x0a'));}}return _0x5076c7;}catch(_0x4970a6){return _0x4970a6 instanceof SyntaxError?(console[_0x5c28e5(0xec)]('\x0aWarning:\x20Failed\x20to\x20parse\x20'+_0x58e62f+_0x5c28e5(0xad)),console[_0x5c28e5(0xec)]('Error:\x20'+_0x4970a6['message']+'\x0a')):console[_0x5c28e5(0xec)]('\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20'+_0x58e62f+':\x20'+_0x4970a6+'\x0a'),[];}}export function getNewCredentialPath(_0x538e0f){const _0x24a616=a50_0x297c;return a50_0x44d796[_0x24a616(0xb7)](getConfigDir(),'.env.'+_0x538e0f);}function getOldCredentialPath(_0x17eec7){const _0x25602a=a50_0x297c;return a50_0x44d796[_0x25602a(0xb7)](getProfilesDir(),_0x17eec7,_0x25602a(0xe7));}function loadProfilesFromTdxJsonFiles(){const _0x12b634=a50_0x297c,_0x5a1b87=[],_0x265cee=findProjectConfigPath();_0x265cee&&_0x5a1b87[_0x12b634(0xe6)](...loadProfilesFromTdxJson(_0x265cee,_0x12b634(0xe5)));const _0x356bd6=a50_0x44d796[_0x12b634(0xb7)](getConfigDir(),_0x12b634(0xce));return _0x5a1b87['push'](...loadProfilesFromTdxJson(_0x356bd6,_0x12b634(0xd9))),_0x5a1b87;}function loadProfilesFromDirectories(){const _0x33c311=a50_0x297c,_0x40c052=getProfilesDir();if(!a50_0xa7ad29['existsSync'](_0x40c052))return[];try{return a50_0xa7ad29[_0x33c311(0xba)](_0x40c052,{'withFileTypes':!![]})[_0x33c311(0xb4)](_0x5ba36f=>_0x5ba36f['isDirectory']())[_0x33c311(0xa7)](_0x48e005=>_0x48e005[_0x33c311(0xd2)])[_0x33c311(0xb4)](_0x3a9336=>{const _0xb7a069=_0x33c311,_0x277b81=getProfileConfigPath(_0x3a9336),_0x32bf66=getProfileEnvPath(_0x3a9336);return a50_0xa7ad29['existsSync'](_0x277b81)||a50_0xa7ad29[_0xb7a069(0xe0)](_0x32bf66);})[_0x33c311(0xa7)](_0x41c946=>{const _0x170322=_0x33c311,_0x55eb01=loadProfileFromDirectory(_0x41c946);if(_0x55eb01)return{..._0x55eb01,'scope':_0x170322(0xb3)};return null;})[_0x33c311(0xb4)](_0x3e6464=>_0x3e6464!==null);}catch{return[];}}function loadProfileFromDirectory(_0x10b109){const _0x145533=a50_0x297c,_0x2933bf=getProfileConfigPath(_0x10b109),_0x42ffae=getOldCredentialPath(_0x10b109);if(!a50_0xa7ad29[_0x145533(0xe0)](_0x2933bf)&&!a50_0xa7ad29[_0x145533(0xe0)](_0x42ffae))return null;let _0x20ae1d={},_0xc5536e={'name':_0x10b109,'createdAt':new Date()[_0x145533(0xdd)]()};if(a50_0xa7ad29[_0x145533(0xe0)](_0x2933bf))try{const _0x5ebe4c=a50_0xa7ad29[_0x145533(0xb6)](_0x2933bf,_0x145533(0xa8)),_0x3c9b55=JSON[_0x145533(0xe3)](_0x5ebe4c),{metadata:_0x561a4c,..._0x37617c}=_0x3c9b55;_0x20ae1d=_0x37617c,_0x561a4c&&(_0xc5536e=_0x561a4c);}catch{}return{'name':_0x10b109,'config':_0x20ae1d,'metadata':_0xc5536e,'hasCredentials':a50_0xa7ad29[_0x145533(0xe0)](_0x42ffae),'scope':_0x145533(0xb3)};}function a50_0x297c(_0x346cdb,_0x496f09){_0x346cdb=_0x346cdb-0xa5;const _0x30f1d4=a50_0x30f1();let _0x297cef=_0x30f1d4[_0x346cdb];return _0x297cef;}export function listProfiles(){const _0x17b360=a50_0x297c,_0x113cec=loadProfilesFromTdxJsonFiles(),_0x1d358b=loadProfilesFromDirectories();if(_0x1d358b['length']>0x0){const _0x9a16bd=_0x1d358b['map'](_0x88e037=>_0x88e037[_0x17b360(0xd2)])[_0x17b360(0xb7)](',\x20'),_0x1bc3b8=getConfigDir();console['warn'](_0x17b360(0xa9)+_0x9a16bd),console['warn'](_0x17b360(0xa5)),console['warn'](_0x17b360(0xc4)+a50_0x44d796['join'](_0x1bc3b8,_0x17b360(0xce))),console[_0x17b360(0xec)](_0x17b360(0xcc)),console[_0x17b360(0xec)](_0x17b360(0xc7));}const _0x33c822=[..._0x113cec,..._0x1d358b],_0x5190da=new Map();for(const _0x2b4c10 of _0x33c822){!_0x5190da[_0x17b360(0xb9)](_0x2b4c10[_0x17b360(0xd2)])&&_0x5190da[_0x17b360(0xe9)](_0x2b4c10[_0x17b360(0xd2)],_0x2b4c10);}return Array[_0x17b360(0xd3)](_0x5190da[_0x17b360(0xb0)]())[_0x17b360(0xbe)]((_0x2fc43e,_0x57dbb4)=>_0x2fc43e[_0x17b360(0xd2)]['localeCompare'](_0x57dbb4[_0x17b360(0xd2)]));}export function profileExists(_0x18e40e){const _0x541bd5=a50_0x297c,_0x553f5b=listProfiles();return _0x553f5b[_0x541bd5(0xc3)](_0x3ff45e=>_0x3ff45e[_0x541bd5(0xd2)]===_0x18e40e);}export function loadProfile(_0x37a785){const _0x100cc8=a50_0x297c;validateProfileName(_0x37a785);const _0x55c3e8=listProfiles(),_0x4527f2=_0x55c3e8[_0x100cc8(0xd4)](_0x7f4d5=>_0x7f4d5[_0x100cc8(0xd2)]===_0x37a785);return _0x4527f2||null;}export function saveProfile(_0x4e7ba0,_0x3ac1d5,_0x1d7a93=![]){saveProfileToUserConfig(_0x4e7ba0,_0x3ac1d5);}export function deleteProfile(_0x1c8d26){const _0x4ab1fb=a50_0x297c;validateProfileName(_0x1c8d26);const _0x295355=getProfileDir(_0x1c8d26);if(!a50_0xa7ad29['existsSync'](_0x295355))throw new Error('Profile\x20'+_0x1c8d26+'\x20does\x20not\x20exist');a50_0xa7ad29[_0x4ab1fb(0xea)](_0x295355,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x4de8ff,_0x18950c){const _0x3b2f0e=a50_0x297c;validateProfileName(_0x4de8ff);const _0x21ad9c=getGlobalConfigPath(),_0x33bc44=getConfigDir();!a50_0xa7ad29['existsSync'](_0x33bc44)&&createSecureDirectory(_0x33bc44);let _0x185bb9={};if(a50_0xa7ad29[_0x3b2f0e(0xe0)](_0x21ad9c))try{const _0x44aa76=a50_0xa7ad29[_0x3b2f0e(0xb6)](_0x21ad9c,_0x3b2f0e(0xa8));_0x185bb9=JSON[_0x3b2f0e(0xe3)](_0x44aa76);}catch{console['warn'](_0x3b2f0e(0xe2)+_0x21ad9c+',\x20creating\x20new\x20file');}!_0x185bb9['profiles']&&(_0x185bb9[_0x3b2f0e(0xda)]={}),_0x185bb9[_0x3b2f0e(0xda)][_0x4de8ff]=_0x18950c,writeSecureFile(_0x21ad9c,JSON[_0x3b2f0e(0xc0)](_0x185bb9,null,0x2));}function a50_0x30f1(){const _0x25f707=['llm_project','1176107WIPhqr','user','profiles','entries','1536477NXcrYG','toISOString','object','parent_segment','existsSync','site','Warning:\x20Failed\x20to\x20parse\x20','parse','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','local','push','.env','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','set','rmSync','\x20already\x20exists','warn','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','map','utf-8','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','4VQdJZl','Profile\x20\x27','description',':\x20Invalid\x20JSON\x20syntax','test','includes','values','profile','35964000ZwOebG','directory','filter','\x20\x20mv\x20\x22','readFileSync','join','Profile\x20','has','readdirSync','4083245ISGCSI','message','\x20does\x20not\x20exist','sort','keys','stringify','7561080GbLynW','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','some','\x20\x201.\x20Edit:\x20','\x27:\x20config\x20must\x20be\x20an\x20object','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','llm_agent','11903507AWvivY','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','string','tdx.json','\x27:\x20unknown\x20config\x20key\x20\x27','1034206gfGJfQ','database','name','from','find','6EIWVqY','To\x20migrate:'];a50_0x30f1=function(){return _0x25f707;};return a50_0x30f1();}export function getActiveProfile(){const _0x46a6fe=a50_0x297c,_0x20b3e8=loadSessionContext();if(_0x20b3e8?.[_0x46a6fe(0xb1)])return _0x20b3e8[_0x46a6fe(0xb1)];const _0x20a87f=getGlobalConfigPath();if(!a50_0xa7ad29['existsSync'](_0x20a87f))return null;try{const _0x440176=a50_0xa7ad29[_0x46a6fe(0xb6)](_0x20a87f,_0x46a6fe(0xa8)),_0x5546b8=JSON[_0x46a6fe(0xe3)](_0x440176);return _0x5546b8[_0x46a6fe(0xb1)]||null;}catch{return null;}}export function createProfile(_0x21d621,_0x4f709b){const _0x1cbadb=a50_0x297c;validateProfileName(_0x21d621);if(profileExists(_0x21d621))throw new Error(_0x1cbadb(0xb8)+_0x21d621+_0x1cbadb(0xeb));saveProfile(_0x21d621,_0x4f709b);}export function saveProfileCredentials(_0x20ef0a,_0x1edf3d){const _0x428b99=a50_0x297c;validateProfileName(_0x20ef0a);if(!profileExists(_0x20ef0a))throw new Error(_0x428b99(0xb8)+_0x20ef0a+_0x428b99(0xbd));const _0x29f207=getNewCredentialPath(_0x20ef0a);writeSecureFile(_0x29f207,_0x1edf3d);}export function loadProfileCredentials(_0x59938c){const _0x27027a=a50_0x297c;validateProfileName(_0x59938c);const _0x321fa0=getNewCredentialPath(_0x59938c);if(a50_0xa7ad29[_0x27027a(0xe0)](_0x321fa0))try{return a50_0xa7ad29[_0x27027a(0xb6)](_0x321fa0,'utf-8');}catch{}const _0x4c5755=getOldCredentialPath(_0x59938c);if(a50_0xa7ad29[_0x27027a(0xe0)](_0x4c5755)){console[_0x27027a(0xec)](_0x27027a(0xc8)+_0x59938c+'\x27'),console[_0x27027a(0xec)](_0x27027a(0xd6)),console[_0x27027a(0xec)](_0x27027a(0xb5)+_0x4c5755+'\x22\x20\x22'+_0x321fa0+'\x22'),console[_0x27027a(0xec)](_0x27027a(0xe4));try{return a50_0xa7ad29['readFileSync'](_0x4c5755,_0x27027a(0xa8));}catch{return null;}}return null;}
|
|
1
|
+
(function(_0x4b104c,_0x54db1e){const _0x31ed16=a50_0xcfac,_0xf6c5d8=_0x4b104c();while(!![]){try{const _0x57ce88=-parseInt(_0x31ed16(0x1d8))/0x1*(-parseInt(_0x31ed16(0x1f4))/0x2)+parseInt(_0x31ed16(0x1ea))/0x3+parseInt(_0x31ed16(0x1d7))/0x4*(parseInt(_0x31ed16(0x1eb))/0x5)+-parseInt(_0x31ed16(0x1b6))/0x6*(parseInt(_0x31ed16(0x1be))/0x7)+parseInt(_0x31ed16(0x1b0))/0x8+-parseInt(_0x31ed16(0x1b2))/0x9+parseInt(_0x31ed16(0x1b1))/0xa*(parseInt(_0x31ed16(0x1e3))/0xb);if(_0x57ce88===_0x54db1e)break;else _0xf6c5d8['push'](_0xf6c5d8['shift']());}catch(_0x3ecd72){_0xf6c5d8['push'](_0xf6c5d8['shift']());}}}(a50_0x712e,0xd3bde));import*as a50_0x1a841f from'node:fs';import*as a50_0x246644 from'node:path';import{getConfigDir}from'./config.js';function a50_0x712e(){const _0x280ea1=['isDirectory','To\x20migrate:','451UQsyUL','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','.env.','sort','llm_agent','llm_project','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','290739mqhFrl','1134380IpGuJx','Invalid\x20profile\x20name:\x20','\x22\x20\x22','map','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','\x20\x20mv\x20\x22','parent_segment','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','29804MYscLd','\x0aWarning:\x20Failed\x20to\x20parse\x20','includes','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','Warning:\x20Failed\x20to\x20parse\x20','keys','user','localeCompare','13280856QStXlA','1770PlLgBr','12931542ctCBDz','values','name','parse','5586TzPVWc','readdirSync','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','warn','Profile\x20\x27',':\x20Invalid\x20JSON\x20syntax','push','utf-8','11641tjQmSE','\x27:\x20unknown\x20config\x20key\x20\x27','string','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','Profile\x20','rmSync','filter','description','set','toISOString','.env','profile','join','site','directory','object','find','\x20\x201.\x20Edit:\x20','\x27\x20will\x20be\x20ignored','stringify','from','message','tdx.json','existsSync','test','20TRNtDa','64ryAfso','has','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','readFileSync','database','entries','profiles','\x20already\x20exists','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20'];a50_0x712e=function(){return _0x280ea1;};return a50_0x712e();}import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export function getProfileParams(_0x5882f1){const _0x2ade23=a50_0xcfac,_0x390b92={};if(!_0x5882f1)return _0x390b92;for(const [_0xf88bc5,_0x41587c]of Object[_0x2ade23(0x1dd)](_0x5882f1)){_0xf88bc5!==_0x2ade23(0x1c5)&&_0x41587c!==undefined&&(_0x390b92[_0xf88bc5]=_0x41587c);}return _0x390b92;}export function getProfilesDir(){return a50_0x246644['join'](getConfigDir(),'profiles');}function getProfileDir(_0x2af40b){const _0x3c47f3=a50_0xcfac;return a50_0x246644[_0x3c47f3(0x1ca)](getProfilesDir(),_0x2af40b);}function a50_0xcfac(_0x1a49f4,_0x4de06d){_0x1a49f4=_0x1a49f4-0x1b0;const _0x712e64=a50_0x712e();let _0xcfacdc=_0x712e64[_0x1a49f4];return _0xcfacdc;}function getProfileConfigPath(_0x16709c){const _0x145b78=a50_0xcfac;return a50_0x246644[_0x145b78(0x1ca)](getProfileDir(_0x16709c),_0x145b78(0x1d4));}function getProfileEnvPath(_0x1ea995){const _0x5b1da5=a50_0xcfac;return a50_0x246644['join'](getProfileDir(_0x1ea995),_0x5b1da5(0x1c8));}function getGlobalConfigPath(){const _0x3c5454=a50_0xcfac;return a50_0x246644[_0x3c5454(0x1ca)](getConfigDir(),_0x3c5454(0x1d4));}function validateProfileName(_0x4d56c9){const _0x286717=a50_0xcfac;if(!/^[a-zA-Z0-9_-]+$/[_0x286717(0x1d6)](_0x4d56c9))throw new Error(_0x286717(0x1ec)+_0x4d56c9+'.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.');}function validateProfileConfig(_0x126fa8,_0x485089){const _0x11170d=a50_0xcfac;if(typeof _0x126fa8!=='object'||_0x126fa8===null)throw new Error('Profile\x20\x27'+_0x485089+'\x27:\x20config\x20must\x20be\x20an\x20object');const _0x5c37d7=[_0x11170d(0x1c5),'site',_0x11170d(0x1dc),_0x11170d(0x1f2),'llm_project',_0x11170d(0x1e7)],_0x1a1e0e=_0x126fa8;for(const _0x21430e of Object[_0x11170d(0x1f9)](_0x1a1e0e)){!_0x5c37d7[_0x11170d(0x1f6)](_0x21430e)&&console['warn']('Warning:\x20Profile\x20\x27'+_0x485089+_0x11170d(0x1bf)+_0x21430e+_0x11170d(0x1d0));}if(_0x1a1e0e[_0x11170d(0x1c5)]!==undefined&&typeof _0x1a1e0e[_0x11170d(0x1c5)]!==_0x11170d(0x1c0))throw new Error(_0x11170d(0x1ba)+_0x485089+'\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string');if(_0x1a1e0e['site']!==undefined&&typeof _0x1a1e0e[_0x11170d(0x1cb)]!==_0x11170d(0x1c0))throw new Error(_0x11170d(0x1ba)+_0x485089+_0x11170d(0x1ef));if(_0x1a1e0e[_0x11170d(0x1dc)]!==undefined&&typeof _0x1a1e0e[_0x11170d(0x1dc)]!=='string')throw new Error('Profile\x20\x27'+_0x485089+_0x11170d(0x1f3));if(_0x1a1e0e['parent_segment']!==undefined&&typeof _0x1a1e0e[_0x11170d(0x1f2)]!==_0x11170d(0x1c0))throw new Error(_0x11170d(0x1ba)+_0x485089+_0x11170d(0x1da));if(_0x1a1e0e[_0x11170d(0x1e8)]!==undefined&&typeof _0x1a1e0e[_0x11170d(0x1e8)]!==_0x11170d(0x1c0))throw new Error(_0x11170d(0x1ba)+_0x485089+_0x11170d(0x1f7));if(_0x1a1e0e[_0x11170d(0x1e7)]!==undefined&&typeof _0x1a1e0e[_0x11170d(0x1e7)]!=='string')throw new Error(_0x11170d(0x1ba)+_0x485089+_0x11170d(0x1c1));return!![];}function loadProfilesFromTdxJson(_0x2aa45a,_0x140a5e){const _0x5c10ef=a50_0xcfac;if(!a50_0x1a841f[_0x5c10ef(0x1d5)](_0x2aa45a))return[];try{const _0xe2d1bc=a50_0x1a841f[_0x5c10ef(0x1db)](_0x2aa45a,'utf-8'),_0x351187=JSON[_0x5c10ef(0x1b5)](_0xe2d1bc);if(!_0x351187[_0x5c10ef(0x1de)]||typeof _0x351187[_0x5c10ef(0x1de)]!==_0x5c10ef(0x1cd))return[];const _0x5685d7=[];for(const [_0x26ffd5,_0x5ce54d]of Object[_0x5c10ef(0x1dd)](_0x351187[_0x5c10ef(0x1de)])){try{validateProfileConfig(_0x5ce54d,_0x26ffd5);const _0x42490c=getNewCredentialPath(_0x26ffd5),_0x4b9574=getOldCredentialPath(_0x26ffd5),_0x421410=a50_0x1a841f[_0x5c10ef(0x1d5)](_0x42490c)||a50_0x1a841f[_0x5c10ef(0x1d5)](_0x4b9574);_0x5685d7[_0x5c10ef(0x1bc)]({'name':_0x26ffd5,'config':_0x5ce54d,'metadata':{'name':_0x26ffd5,'createdAt':new Date()[_0x5c10ef(0x1c7)]()},'hasCredentials':_0x421410,'scope':_0x140a5e});}catch(_0x214f88){_0x214f88 instanceof Error&&(console['warn']('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x2aa45a+':'),console[_0x5c10ef(0x1b9)]('\x20\x20'+_0x214f88[_0x5c10ef(0x1d3)]+'\x0a'));}}return _0x5685d7;}catch(_0x97d51e){return _0x97d51e instanceof SyntaxError?(console[_0x5c10ef(0x1b9)](_0x5c10ef(0x1f5)+_0x2aa45a+_0x5c10ef(0x1bb)),console[_0x5c10ef(0x1b9)]('Error:\x20'+_0x97d51e[_0x5c10ef(0x1d3)]+'\x0a')):console[_0x5c10ef(0x1b9)]('\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20'+_0x2aa45a+':\x20'+_0x97d51e+'\x0a'),[];}}export function getNewCredentialPath(_0x545721){const _0x19f77a=a50_0xcfac;return a50_0x246644[_0x19f77a(0x1ca)](getConfigDir(),_0x19f77a(0x1e5)+_0x545721);}function getOldCredentialPath(_0x7971ca){const _0x4a1eb9=a50_0xcfac;return a50_0x246644['join'](getProfilesDir(),_0x7971ca,_0x4a1eb9(0x1c8));}function loadProfilesFromTdxJsonFiles(){const _0x740f7f=a50_0xcfac,_0x2b4d7e=[],_0x4bd33e=findProjectConfigPath();_0x4bd33e&&_0x2b4d7e[_0x740f7f(0x1bc)](...loadProfilesFromTdxJson(_0x4bd33e,'local'));const _0x25f673=a50_0x246644['join'](getConfigDir(),_0x740f7f(0x1d4));return _0x2b4d7e['push'](...loadProfilesFromTdxJson(_0x25f673,_0x740f7f(0x1fa))),_0x2b4d7e;}function loadProfilesFromDirectories(){const _0x25a164=a50_0xcfac,_0x2cefcb=getProfilesDir();if(!a50_0x1a841f[_0x25a164(0x1d5)](_0x2cefcb))return[];try{return a50_0x1a841f[_0x25a164(0x1b7)](_0x2cefcb,{'withFileTypes':!![]})[_0x25a164(0x1c4)](_0x3fd236=>_0x3fd236[_0x25a164(0x1e1)]())[_0x25a164(0x1ee)](_0x18886b=>_0x18886b[_0x25a164(0x1b4)])['filter'](_0x4c9f4b=>{const _0x1caab2=_0x25a164,_0x184cd6=getProfileConfigPath(_0x4c9f4b),_0x6695a3=getProfileEnvPath(_0x4c9f4b);return a50_0x1a841f['existsSync'](_0x184cd6)||a50_0x1a841f[_0x1caab2(0x1d5)](_0x6695a3);})['map'](_0x4c602a=>{const _0x46d3c8=_0x25a164,_0x627ed1=loadProfileFromDirectory(_0x4c602a);if(_0x627ed1)return{..._0x627ed1,'scope':_0x46d3c8(0x1cc)};return null;})[_0x25a164(0x1c4)](_0xd694a8=>_0xd694a8!==null);}catch{return[];}}function loadProfileFromDirectory(_0x4e7b6e){const _0x31b215=a50_0xcfac,_0x320674=getProfileConfigPath(_0x4e7b6e),_0x5c97a1=getOldCredentialPath(_0x4e7b6e);if(!a50_0x1a841f[_0x31b215(0x1d5)](_0x320674)&&!a50_0x1a841f['existsSync'](_0x5c97a1))return null;let _0x2ad88a={},_0x167e29={'name':_0x4e7b6e,'createdAt':new Date()['toISOString']()};if(a50_0x1a841f[_0x31b215(0x1d5)](_0x320674))try{const _0xdeaf4d=a50_0x1a841f[_0x31b215(0x1db)](_0x320674,'utf-8'),_0x40a5d0=JSON[_0x31b215(0x1b5)](_0xdeaf4d),{metadata:_0x4fb469,..._0x1d6680}=_0x40a5d0;_0x2ad88a=_0x1d6680,_0x4fb469&&(_0x167e29=_0x4fb469);}catch{}return{'name':_0x4e7b6e,'config':_0x2ad88a,'metadata':_0x167e29,'hasCredentials':a50_0x1a841f[_0x31b215(0x1d5)](_0x5c97a1),'scope':_0x31b215(0x1cc)};}export function listProfiles(){const _0x3de381=a50_0xcfac,_0xddcfef=loadProfilesFromTdxJsonFiles(),_0x5be859=loadProfilesFromDirectories();if(_0x5be859['length']>0x0){const _0x15c556=_0x5be859[_0x3de381(0x1ee)](_0x2f3785=>_0x2f3785['name'])[_0x3de381(0x1ca)](',\x20'),_0x5d3391=getConfigDir();console[_0x3de381(0x1b9)](_0x3de381(0x1e0)+_0x15c556),console[_0x3de381(0x1b9)](_0x3de381(0x1e9)),console[_0x3de381(0x1b9)](_0x3de381(0x1cf)+a50_0x246644['join'](_0x5d3391,'tdx.json')),console[_0x3de381(0x1b9)](_0x3de381(0x1e4)),console['warn'](_0x3de381(0x1b8));}const _0x1e0181=[..._0xddcfef,..._0x5be859],_0x274de0=new Map();for(const _0x2d7343 of _0x1e0181){!_0x274de0[_0x3de381(0x1d9)](_0x2d7343[_0x3de381(0x1b4)])&&_0x274de0[_0x3de381(0x1c6)](_0x2d7343[_0x3de381(0x1b4)],_0x2d7343);}return Array[_0x3de381(0x1d2)](_0x274de0[_0x3de381(0x1b3)]())[_0x3de381(0x1e6)]((_0x552263,_0x15f621)=>_0x552263['name'][_0x3de381(0x1fb)](_0x15f621[_0x3de381(0x1b4)]));}export function profileExists(_0x39a8fc){const _0x293a84=listProfiles();return _0x293a84['some'](_0x2e3b6b=>_0x2e3b6b['name']===_0x39a8fc);}export function loadProfile(_0x4eea43){const _0xa8eea0=a50_0xcfac;validateProfileName(_0x4eea43);const _0x127f8f=listProfiles(),_0x16e466=_0x127f8f[_0xa8eea0(0x1ce)](_0x58fcc4=>_0x58fcc4[_0xa8eea0(0x1b4)]===_0x4eea43);return _0x16e466||null;}export function saveProfile(_0x459a4f,_0x12a453,_0x476f20=![]){saveProfileToUserConfig(_0x459a4f,_0x12a453);}export function deleteProfile(_0x6d8fd0){const _0x321a1a=a50_0xcfac;validateProfileName(_0x6d8fd0);const _0x2c2d42=getProfileDir(_0x6d8fd0);if(!a50_0x1a841f[_0x321a1a(0x1d5)](_0x2c2d42))throw new Error('Profile\x20'+_0x6d8fd0+'\x20does\x20not\x20exist');a50_0x1a841f[_0x321a1a(0x1c3)](_0x2c2d42,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x108e91,_0x4e7562){const _0x5e0276=a50_0xcfac;validateProfileName(_0x108e91);const _0x4505a5=getGlobalConfigPath(),_0x3f7413=getConfigDir();!a50_0x1a841f['existsSync'](_0x3f7413)&&createSecureDirectory(_0x3f7413);let _0x1a343d={};if(a50_0x1a841f[_0x5e0276(0x1d5)](_0x4505a5))try{const _0x57b2d5=a50_0x1a841f[_0x5e0276(0x1db)](_0x4505a5,_0x5e0276(0x1bd));_0x1a343d=JSON[_0x5e0276(0x1b5)](_0x57b2d5);}catch{console[_0x5e0276(0x1b9)](_0x5e0276(0x1f8)+_0x4505a5+',\x20creating\x20new\x20file');}!_0x1a343d[_0x5e0276(0x1de)]&&(_0x1a343d['profiles']={}),_0x1a343d['profiles'][_0x108e91]=_0x4e7562,writeSecureFile(_0x4505a5,JSON[_0x5e0276(0x1d1)](_0x1a343d,null,0x2));}export function getActiveProfile(){const _0x4c2726=a50_0xcfac,_0x1d2f8a=loadSessionContext();if(_0x1d2f8a?.['profile'])return _0x1d2f8a[_0x4c2726(0x1c9)];const _0x5b1505=getGlobalConfigPath();if(!a50_0x1a841f[_0x4c2726(0x1d5)](_0x5b1505))return null;try{const _0x698d98=a50_0x1a841f[_0x4c2726(0x1db)](_0x5b1505,'utf-8'),_0x2bb4e9=JSON['parse'](_0x698d98);return _0x2bb4e9[_0x4c2726(0x1c9)]||null;}catch{return null;}}export function createProfile(_0x50a9e7,_0x31d85d){const _0x5b2a12=a50_0xcfac;validateProfileName(_0x50a9e7);if(profileExists(_0x50a9e7))throw new Error(_0x5b2a12(0x1c2)+_0x50a9e7+_0x5b2a12(0x1df));saveProfile(_0x50a9e7,_0x31d85d);}export function saveProfileCredentials(_0xb3e771,_0x3df3e8){const _0x55c8db=a50_0xcfac;validateProfileName(_0xb3e771);if(!profileExists(_0xb3e771))throw new Error(_0x55c8db(0x1c2)+_0xb3e771+'\x20does\x20not\x20exist');const _0x2d3b04=getNewCredentialPath(_0xb3e771);writeSecureFile(_0x2d3b04,_0x3df3e8);}export function loadProfileCredentials(_0x327c91){const _0x588f46=a50_0xcfac;validateProfileName(_0x327c91);const _0x265829=getNewCredentialPath(_0x327c91);if(a50_0x1a841f[_0x588f46(0x1d5)](_0x265829))try{return a50_0x1a841f[_0x588f46(0x1db)](_0x265829,_0x588f46(0x1bd));}catch{}const _0xf3ad76=getOldCredentialPath(_0x327c91);if(a50_0x1a841f['existsSync'](_0xf3ad76)){console[_0x588f46(0x1b9)]('\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27'+_0x327c91+'\x27'),console['warn'](_0x588f46(0x1e2)),console['warn'](_0x588f46(0x1f1)+_0xf3ad76+_0x588f46(0x1ed)+_0x265829+'\x22'),console[_0x588f46(0x1b9)](_0x588f46(0x1f0));try{return a50_0x1a841f[_0x588f46(0x1db)](_0xf3ad76,'utf-8');}catch{return null;}}return null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a51_0x18aff6=a51_0x9bcd;(function(_0x3669bf,_0xecbfe0){const _0x148120=a51_0x9bcd,_0x3744c5=_0x3669bf();while(!![]){try{const _0x3cdac4=parseInt(_0x148120(0xe9))/0x1+-parseInt(_0x148120(0xe6))/0x2+parseInt(_0x148120(0xf9))/0x3*(parseInt(_0x148120(0xed))/0x4)+parseInt(_0x148120(0xf8))/0x5*(-parseInt(_0x148120(0x102))/0x6)+parseInt(_0x148120(0xfa))/0x7+-parseInt(_0x148120(0xe7))/0x8+parseInt(_0x148120(0xf2))/0x9;if(_0x3cdac4===_0xecbfe0)break;else _0x3744c5['push'](_0x3744c5['shift']());}catch(_0x1e37af){_0x3744c5['push'](_0x3744c5['shift']());}}}(a51_0x19bf,0xec91e));import*as a51_0x22f8ea from'node:fs';import*as a51_0x5990a2 from'node:path';function a51_0x19bf(){const _0x12d8ee=['apiKey','warn','Warning:\x20\x27profile\x27\x20field\x20in\x20','join','1140Snfxvm','parse','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','2660836fXOCeI','9143680vhXAjN','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','1783844jxPson','stringify','tdx.json','ENOENT','4MZuMee','TD_API_KEY','Failed\x20to\x20load\x20project\x20config\x20from\x20','includes','readFileSync','3965445KziuQR',').\x20','api_key','existsSync','profile','writeFileSync','23195EGjQKd','2425938equIdi','9034781oAlvKL','dirname','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','cwd'];a51_0x19bf=function(){return _0x12d8ee;};return a51_0x19bf();}const PROJECT_CONFIG_FILENAME=a51_0x18aff6(0xeb);export function findProjectConfigPath(_0xfb0ba1){const _0x44cda6=a51_0x18aff6;let _0x4ec345=_0xfb0ba1||process[_0x44cda6(0xfd)]();while(!![]){const _0x43c219=a51_0x5990a2[_0x44cda6(0x101)](_0x4ec345,PROJECT_CONFIG_FILENAME);if(a51_0x22f8ea[_0x44cda6(0xf5)](_0x43c219))return _0x43c219;const _0x4dbb10=a51_0x5990a2[_0x44cda6(0xfb)](_0x4ec345);if(_0x4dbb10===_0x4ec345)return null;_0x4ec345=_0x4dbb10;}}export function loadProjectConfig(_0x322cb7){const _0x4c872a=a51_0x18aff6,_0x23f0c8=findProjectConfigPath(_0x322cb7);if(!_0x23f0c8)return null;try{const _0x129405=a51_0x22f8ea[_0x4c872a(0xf1)](_0x23f0c8,'utf-8'),_0x17df48=JSON[_0x4c872a(0xe4)](_0x129405),_0x3ceaf8=JSON[_0x4c872a(0xea)](_0x17df48);if(_0x3ceaf8['includes'](_0x4c872a(0xee))||_0x3ceaf8[_0x4c872a(0xf0)](_0x4c872a(0xfe))||_0x3ceaf8['includes']('api_key'))throw new Error('Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20('+_0x23f0c8+_0x4c872a(0xf3)+_0x4c872a(0xe8));const {metadata:_0x3de65e,profile:_0x2a5769,..._0x438aae}=_0x17df48;return _0x2a5769&&console[_0x4c872a(0xff)](_0x4c872a(0x100)+_0x23f0c8+'\x20is\x20ignored.\x20'+_0x4c872a(0xfc)),_0x438aae;}catch(_0x35207b){if(_0x35207b instanceof Error&&'code'in _0x35207b&&_0x35207b['code']===_0x4c872a(0xec))return null;throw new Error(_0x4c872a(0xef)+_0x23f0c8+':\x20'+_0x35207b);}}export function saveProjectConfig(_0x2dfd06,_0x4707ec){const _0x424e5a=a51_0x18aff6,_0x23bb59=_0x4707ec||process[_0x424e5a(0xfd)](),_0x236580=a51_0x5990a2[_0x424e5a(0x101)](_0x23bb59,PROJECT_CONFIG_FILENAME),_0x262c98=JSON['stringify'](_0x2dfd06);if(_0x262c98[_0x424e5a(0xf0)](_0x424e5a(0xee))||_0x262c98[_0x424e5a(0xf0)](_0x424e5a(0xfe))||_0x262c98[_0x424e5a(0xf0)](_0x424e5a(0xf4)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.');if(_0x424e5a(0xf6)in _0x2dfd06)throw new Error(_0x424e5a(0xe5));a51_0x22f8ea[_0x424e5a(0xf7)](_0x236580,JSON[_0x424e5a(0xea)](_0x2dfd06,null,0x2));}export function hasProjectConfig(_0x40e3d1){return findProjectConfigPath(_0x40e3d1)!==null;}function a51_0x9bcd(_0x46bd74,_0x40f144){_0x46bd74=_0x46bd74-0xe4;const _0x19bf5e=a51_0x19bf();let _0x9bcd35=_0x19bf5e[_0x46bd74];return _0x9bcd35;}export function getProjectRoot(_0x51723e){const _0x443698=a51_0x18aff6,_0x2dc915=findProjectConfigPath(_0x51723e);return _0x2dc915?a51_0x5990a2[_0x443698(0xfb)](_0x2dc915):null;}
|